fix(socket): 移除未使用的包导入和调试日志

移除了 `blazing/cool` 和 `context` 包的导入,以及不再需要的调试日志输出。

feat(fight): 增强玩家初始化检查并返回结果

修改 `initplayer` 方法以在没有宠物时返回 false,并在 `NewFight` 中增加对初始化结果的检查,若失败则返回 nil。
This commit is contained in:
2025-10-28 22:08:27 +08:00
parent a37b459793
commit 32d60e8d91
2 changed files with 14 additions and 7 deletions

View File

@@ -1,8 +1,6 @@
package codec
import (
"blazing/cool"
"context"
"encoding/binary"
"errors"
"io"
@@ -60,7 +58,7 @@ func (codec TomeeSocketCodec) Decode(c gnet.Conn) ([]byte, error) {
}
bodyLen := binary.BigEndian.Uint32(lenBuf)
cool.Loger.Print(context.TODO(), "lenBuf", bodyLen)
if bodyLen > maxBodyLen {
return nil, errors.New("packet body exceeds max length")
}