From ae61ddd3f3855b0ca17db6db981d852fd3ee8dbc Mon Sep 17 00:00:00 2001 From: UnKownOwO <80520429@qq.com> Date: Sat, 3 Dec 2022 18:48:34 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=87=8D=E8=BF=9E=E5=AF=BC?= =?UTF-8?q?=E8=87=B4=E7=9A=84=E6=96=B0=E7=94=A8=E6=88=B7=E6=B3=A8=E5=86=8C?= =?UTF-8?q?=E5=A4=B1=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gate/forward/forward.go | 4 +--- gs/game/game_manager.go | 9 ++------- gs/game/route_manager.go | 1 - 3 files changed, 3 insertions(+), 11 deletions(-) diff --git a/gate/forward/forward.go b/gate/forward/forward.go index 22c5c13b..d1ec01c2 100644 --- a/gate/forward/forward.go +++ b/gate/forward/forward.go @@ -362,10 +362,8 @@ func (f *ForwardManager) recvNetMsgFromGameServer() { protoMsg.HeadMessage = f.getHeadMsg(netMsg.ClientSeq) protoMsg.PayloadMessage = netMsg.PayloadMessage f.protoMsgInput <- protoMsg - continue } else { logger.LOG.Error("recv unknown event from game server, event id: %v", netMsg.EventId) - continue } } } @@ -500,7 +498,7 @@ func (f *ForwardManager) ChangeGateOpenState(isOpen bool) bool { return true } -// 剔除玩家下线 +// 踢出玩家下线 func (f *ForwardManager) KickPlayer(info *gm.KickPlayerInfo) bool { if info == nil { return false diff --git a/gs/game/game_manager.go b/gs/game/game_manager.go index 0dbef4a5..506c2ac0 100644 --- a/gs/game/game_manager.go +++ b/gs/game/game_manager.go @@ -1,6 +1,7 @@ package game import ( + pb "google.golang.org/protobuf/proto" "hk4e/gate/entity/gm" "hk4e/gate/kcp" "hk4e/gs/dao" @@ -8,8 +9,6 @@ import ( "hk4e/pkg/logger" "hk4e/protocol/cmd" "hk4e/protocol/proto" - - pb "google.golang.org/protobuf/proto" ) type GameManager struct { @@ -74,11 +73,6 @@ func (g *GameManager) Stop() { // 保存玩家数据 g.userManager.SaveUser() - // 踢出所有在线玩家 - for userId := range g.userManager.GetAllOnlineUserList() { - g.DisconnectPlayer(userId) - } - //g.worldManager.worldStatic.SaveTerrain() } @@ -110,6 +104,7 @@ func (g *GameManager) DisconnectPlayer(userId uint32) { g.SendMsg(cmd.ServerDisconnectClientNotify, userId, 0, new(proto.ServerDisconnectClientNotify)) } +// 踢出玩家 func (g *GameManager) KickPlayer(userId uint32) { info := new(gm.KickPlayerInfo) info.UserId = userId diff --git a/gs/game/route_manager.go b/gs/game/route_manager.go index 58cf5f15..d9d075be 100644 --- a/gs/game/route_manager.go +++ b/gs/game/route_manager.go @@ -38,7 +38,6 @@ func (r *RouteManager) doRoute(cmdId uint16, userId uint32, clientSeq uint32, pa player := r.gameManager.userManager.GetOnlineUser(userId) if player == nil { logger.LOG.Error("player is nil, uid: %v", userId) - r.gameManager.ReconnectPlayer(userId) return } player.ClientSeq = clientSeq