This commit is contained in:
flswld
2023-04-15 20:48:30 +08:00
parent 094ad5add0
commit 7fe19297e3
5 changed files with 57 additions and 33 deletions

View File

@@ -505,6 +505,8 @@ func (w *World) InitPlayerWorldAvatar(player *model.Player) {
if !player.SceneJump && (worldAvatar.avatarEntityId != 0 || worldAvatar.weaponEntityId != 0) {
continue
}
scene.DestroyEntity(worldAvatar.avatarEntityId)
scene.DestroyEntity(worldAvatar.weaponEntityId)
worldAvatar.avatarEntityId = scene.CreateEntityAvatar(player, worldAvatar.avatarId)
worldAvatar.weaponEntityId = scene.CreateEntityWeapon()
}

View File

@@ -437,14 +437,12 @@ func (g *Game) GetOnlinePlayerInfoReq(player *model.Player, payloadMsg pb.Messag
func (g *Game) PacketOnlinePlayerInfo(player *model.Player) *proto.OnlinePlayerInfo {
world := WORLD_MANAGER.GetWorldByID(player.WorldId)
if world == nil {
logger.Error("get world is nil, worldId: %v, uid: %v", player.WorldId, player.PlayerID)
return new(proto.OnlinePlayerInfo)
}
worldPlayerNum := uint32(1)
// TODO 远程玩家的世界内人数
if world != nil {
worldPlayerNum = uint32(world.GetWorldPlayerNum())
} else {
// TODO 远程玩家的世界内人数
worldPlayerNum = 1
}
onlinePlayerInfo := &proto.OnlinePlayerInfo{
Uid: player.PlayerID,

View File

@@ -191,7 +191,7 @@ func (g *Game) ChangeMpTeamAvatarReq(player *model.Player, payloadMsg pb.Message
logger.Error("get world is nil, worldId: %v, uid: %v", player.WorldId, player.PlayerID)
return
}
if !world.GetMultiplayer() || len(avatarGuidList) == 0 || len(avatarGuidList) > 4 {
if WORLD_MANAGER.IsBigWorld(world) || !world.GetMultiplayer() || len(avatarGuidList) == 0 || len(avatarGuidList) > 4 {
g.SendError(cmd.ChangeMpTeamAvatarRsp, player, &proto.ChangeMpTeamAvatarRsp{})
return
}