耐力表、武器切换、无效角色修复

This commit is contained in:
UnKownOwO
2023-02-02 15:06:38 +08:00
parent bd8a68b8d6
commit 52e0cb4586
5 changed files with 64 additions and 36 deletions

View File

@@ -23,6 +23,10 @@ func (g *GameManager) GetAllAvatarDataConfig() map[int32]*gdconf.AvatarData {
// 跳过主角
continue
}
if avatarId >= 10000079 {
// 跳过后续版本的角色
continue
}
allAvatarDataConfig[avatarId] = avatarData
}
return allAvatarDataConfig
@@ -67,8 +71,18 @@ func (g *GameManager) WearEquipReq(player *model.Player, payloadMsg pb.Message)
req := payloadMsg.(*proto.WearEquipReq)
avatarGuid := req.AvatarGuid
equipGuid := req.EquipGuid
avatar := player.GameObjectGuidMap[avatarGuid].(*model.Avatar)
weapon := player.GameObjectGuidMap[equipGuid].(*model.Weapon)
avatar, ok := player.GameObjectGuidMap[avatarGuid].(*model.Avatar)
if !ok {
logger.Error("avatar error, avatar guid: %v", avatarGuid)
g.CommonRetError(cmd.WearEquipRsp, player, &proto.WearEquipRsp{})
return
}
weapon, ok := player.GameObjectGuidMap[equipGuid].(*model.Weapon)
if !ok {
logger.Error("equip error, equip guid: %v", equipGuid)
g.CommonRetError(cmd.WearEquipRsp, player, &proto.WearEquipRsp{})
return
}
g.WearUserAvatarEquip(player.PlayerID, avatar.AvatarId, weapon.WeaponId)
wearEquipRsp := &proto.WearEquipRsp{
@@ -203,23 +217,30 @@ func (g *GameManager) AvatarWearFlycloakReq(player *model.Player, payloadMsg pb.
}
func (g *GameManager) PacketAvatarEquipChangeNotify(avatar *model.Avatar, weapon *model.Weapon, entityId uint32) *proto.AvatarEquipChangeNotify {
itemDataConfig, ok := gdconf.CONF.ItemDataMap[int32(weapon.ItemId)]
if !ok {
logger.Error("item data config error, item id: %v")
return new(proto.AvatarEquipChangeNotify)
}
avatarEquipChangeNotify := &proto.AvatarEquipChangeNotify{
AvatarGuid: avatar.Guid,
ItemId: weapon.ItemId,
EquipGuid: weapon.Guid,
}
switch itemDataConfig.Type {
case int32(constant.ItemTypeConst.ITEM_WEAPON):
avatarEquipChangeNotify.EquipType = uint32(constant.EquipTypeConst.EQUIP_WEAPON)
case int32(constant.ItemTypeConst.ITEM_RELIQUARY):
avatarEquipChangeNotify.EquipType = uint32(itemDataConfig.ReliquaryType)
}
avatarEquipChangeNotify.Weapon = &proto.SceneWeaponInfo{
EntityId: entityId,
GadgetId: uint32(gdconf.CONF.ItemDataMap[int32(weapon.ItemId)].GadgetId),
GadgetId: uint32(itemDataConfig.GadgetId),
ItemId: weapon.ItemId,
Guid: weapon.Guid,
Level: uint32(weapon.Level),
AbilityInfo: new(proto.AbilitySyncStateInfo),
}
itemDataConfig, exist := gdconf.CONF.ItemDataMap[int32(weapon.ItemId)]
if exist {
avatarEquipChangeNotify.EquipType = uint32(itemDataConfig.Type)
}
return avatarEquipChangeNotify
}

View File

@@ -394,6 +394,7 @@ func (g *GameManager) ClientAbilityChangeNotify(player *model.Player, payloadMsg
}
ok := utils.UnmarshalProtoObj(abilityMetaAddAbility, clientProtoObj, abilityInvokeEntry.AbilityData)
if !ok {
logger.Error("AbilityMetaAddAbility proto error")
continue
}
} else {
@@ -421,6 +422,7 @@ func (g *GameManager) ClientAbilityChangeNotify(player *model.Player, payloadMsg
}
ok := utils.UnmarshalProtoObj(abilityMetaModifierChange, clientProtoObj, abilityInvokeEntry.AbilityData)
if !ok {
logger.Error("AbilityMetaModifierChange proto error")
continue
}
} else {

View File

@@ -16,26 +16,30 @@ func (g *GameManager) GCGLogin(player *model.Player) {
// player.Pos.X = 8.974
// player.Pos.Y = 0
// player.Pos.Z = 9.373
// GCG基础信息
g.SendMsg(cmd.GCGBasicDataNotify, player.PlayerID, player.ClientSeq, g.PacketGCGBasicDataNotify(player))
// GCG等级挑战解锁
g.SendMsg(cmd.GCGLevelChallengeNotify, player.PlayerID, player.ClientSeq, g.PacketGCGLevelChallengeNotify(player))
// GCG禁止的卡牌
g.SendMsg(cmd.GCGDSBanCardNotify, player.PlayerID, player.ClientSeq, g.PacketGCGDSBanCardNotify(player))
// GCG解锁或拥有的内容
g.SendMsg(cmd.GCGDSDataNotify, player.PlayerID, player.ClientSeq, g.PacketGCGDSDataNotify(player))
// GCG酒馆挑战数据
g.SendMsg(cmd.GCGTCTavernChallengeDataNotify, player.PlayerID, player.ClientSeq, g.PacketGCGTCTavernChallengeDataNotify(player))
// GCG目前可能有点问题先不发送
// 以后再慢慢搞
// // GCG基础信息
// g.SendMsg(cmd.GCGBasicDataNotify, player.PlayerID, player.ClientSeq, g.PacketGCGBasicDataNotify(player))
// // GCG等级挑战解锁
// g.SendMsg(cmd.GCGLevelChallengeNotify, player.PlayerID, player.ClientSeq, g.PacketGCGLevelChallengeNotify(player))
// // GCG禁止的卡牌
// g.SendMsg(cmd.GCGDSBanCardNotify, player.PlayerID, player.ClientSeq, g.PacketGCGDSBanCardNotify(player))
// // GCG解锁或拥有的内容
// g.SendMsg(cmd.GCGDSDataNotify, player.PlayerID, player.ClientSeq, g.PacketGCGDSDataNotify(player))
// // GCG酒馆挑战数据
// g.SendMsg(cmd.GCGTCTavernChallengeDataNotify, player.PlayerID, player.ClientSeq, g.PacketGCGTCTavernChallengeDataNotify(player))
}
// GCGTavernInit GCG酒馆初始化
func (g *GameManager) GCGTavernInit(player *model.Player) {
if player.SceneId == 1076 {
// GCG酒馆信息通知
g.SendMsg(cmd.GCGTCTavernInfoNotify, player.PlayerID, player.ClientSeq, g.PacketGCGTCTavernInfoNotify(player))
// GCG酒馆NPC信息通知
g.SendMsg(cmd.GCGTavernNpcInfoNotify, player.PlayerID, player.ClientSeq, g.PacketGCGTavernNpcInfoNotify(player))
}
// if player.SceneId == 1076 {
// // GCG酒馆信息通知
// g.SendMsg(cmd.GCGTCTavernInfoNotify, player.PlayerID, player.ClientSeq, g.PacketGCGTCTavernInfoNotify(player))
// // GCG酒馆NPC信息通知
// g.SendMsg(cmd.GCGTavernNpcInfoNotify, player.PlayerID, player.ClientSeq, g.PacketGCGTavernNpcInfoNotify(player))
// }
}
// GCGStartChallenge GCG开始挑战

View File

@@ -19,6 +19,7 @@ func (g *GameManager) ChangeAvatarReq(player *model.Player, payloadMsg pb.Messag
world := WORLD_MANAGER.GetWorldByID(player.WorldId)
scene := world.GetSceneById(player.SceneId)
targetAvatarId := player.GetAvatarIdByGuid(targetAvatarGuid)
logger.Error("avatarId: %v", targetAvatarGuid)
oldAvatarId := world.GetPlayerActiveAvatarId(player)
if targetAvatarId == oldAvatarId {
logger.Error("can not change to the same avatar, uid: %v, oldAvatarId: %v, targetAvatarId: %v", player.PlayerID, oldAvatarId, targetAvatarId)