From cd5fd5114c9871305a9c8823791008843562a742 Mon Sep 17 00:00:00 2001 From: UnKownOwO <80520429@qq.com> Date: Mon, 2 Oct 2023 22:31:35 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dpubg=E6=B8=B8=E6=88=8F?= =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=8C=BA=E5=9F=9F=E6=97=B6=E9=87=8D=E8=BF=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gs/game/game_plugin_pubg.go | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/gs/game/game_plugin_pubg.go b/gs/game/game_plugin_pubg.go index 7afaa5b5..79bf3f99 100644 --- a/gs/game/game_plugin_pubg.go +++ b/gs/game/game_plugin_pubg.go @@ -132,7 +132,7 @@ func (p *PluginPubg) GlobalTickPubg() { } alivePlayerList := p.GetAlivePlayerList() if len(alivePlayerList) <= 1 { - if len(alivePlayerList) == 1 { + if len(alivePlayerList) <= 1 { info := fmt.Sprintf("『%v』大吉大利,今晚吃鸡。", alivePlayerList[0].NickName) GAME.PlayerChatReq(world.GetOwner(), &proto.PlayerChatReq{ChatInfo: &proto.ChatInfo{Content: &proto.ChatInfo_Text{Text: info}}}) } @@ -149,9 +149,9 @@ func (p *PluginPubg) GlobalTickHourStart() { // UserTimerPubgEnd pubg游戏结束后执行定时器 func (p *PluginPubg) UserTimerPubgEnd(player *model.Player, data []any) { - world := WORLD_MANAGER.GetWorldById(player.WorldId) + logger.Debug("PubgEnd") + world := p.world if world == nil { - logger.Error("get world is nil, worldId: %v, uid: %v", player.WorldId, player.PlayerId) return } for _, worldPlayer := range world.GetAllPlayer() { @@ -164,21 +164,14 @@ func (p *PluginPubg) UserTimerPubgEnd(player *model.Player, data []any) { // UserTimerPubgUpdateArea 更新游戏区域 func (p *PluginPubg) UserTimerPubgUpdateArea(player *model.Player, data []any) { - world := WORLD_MANAGER.GetWorldById(player.WorldId) - if world == nil { - logger.Error("get world is nil, worldId: %v, uid: %v", player.WorldId, player.PlayerId) - return - } - for _, worldPlayer := range world.GetAllPlayer() { - if worldPlayer.PlayerId == world.GetOwner().PlayerId { - continue - } - GAME.ReLoginPlayer(worldPlayer.PlayerId, true) - } + logger.Debug("PubgUpdateArea") + p.phase++ + p.RefreshArea() } // UserTimerPubgDieExit pubg死亡离开 func (p *PluginPubg) UserTimerPubgDieExit(player *model.Player, data []any) { + logger.Debug("PubgDieExit") GAME.ReLoginPlayer(player.PlayerId, true) }