This commit is contained in:
1
2026-01-23 14:59:15 +00:00
parent 95055fe955
commit 53be2cb776
8 changed files with 129 additions and 121 deletions

View File

@@ -58,7 +58,7 @@ func (h *ClientData) Recv(data common.TomeeHeader) {
}
}()
cmdlister, ok := cool.CmdCache.Load(data.CMD)
cmdlister, ok := cool.CmdCache[data.CMD]
if !ok {
glog.Debug(context.Background(), data.UserID, data.CMD, "cmd未注册")

View File

@@ -3,7 +3,6 @@ package player
import (
"blazing/common/data"
"blazing/common/socket/errorcode"
"blazing/common/utils"
"blazing/cool"
"blazing/logic/service/common"
"blazing/logic/service/fight/info"
@@ -20,6 +19,7 @@ import (
"github.com/antlabs/timer"
"github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/util/gconv"
csmap "github.com/mhmtszr/concurrent-swiss-map"
"github.com/panjf2000/gnet/v2"
)
@@ -34,7 +34,7 @@ func CountPlayer() int {
}
// Mainplayer 全局玩家数据存储映射
var Mainplayer = &utils.SyncMap[uint32, *Player]{}
var Mainplayer = csmap.New[uint32, *Player]()
type OgrePetInfo struct {
Id uint32
@@ -226,7 +226,7 @@ func (player1 *Player) Kick() {
//取成功,否则创建
//player1.Save() //先保存数据再返回
head := common.NewTomeeHeader(1001, player1.Info.UserID)
head.Result = uint32(errorcode.ErrorCodes.ErrAccountLoggedInElsewhere)
head.Result = uint32(errorcode.ErrorCodes.ErrXinPlanSleepMode)
//实际上这里有个问题,会造成重复保存问题
player1.SendPack(head.Pack(nil))

View File

@@ -38,6 +38,7 @@ func KickPlayer(userid uint32) error { //踢出玩家
}
//return player
return nil
}