mirror of
https://github.com/FlourishingWorld/hk4e.git
synced 2026-03-01 00:35:36 +08:00
切换角色等级错误问题修复
This commit is contained in:
@@ -102,14 +102,14 @@ func (g *GameManager) AvatarPromoteReq(player *model.Player, payloadMsg pb.Messa
|
|||||||
// 角色等级是否达到限制
|
// 角色等级是否达到限制
|
||||||
if avatar.Level < uint8(avatarPromoteConfig.LevelLimit) {
|
if avatar.Level < uint8(avatarPromoteConfig.LevelLimit) {
|
||||||
logger.Error("avatar level le level limit, level: %v", avatar.Level)
|
logger.Error("avatar level le level limit, level: %v", avatar.Level)
|
||||||
g.CommonRetError(cmd.AvatarPromoteRsp, player, &proto.AvatarPromoteRsp{})
|
g.CommonRetError(cmd.AvatarPromoteRsp, player, &proto.AvatarPromoteRsp{}, proto.Retcode_RET_AVATAR_LEVEL_LESS_THAN)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// 获取角色突破下一级的配置表
|
// 获取角色突破下一级的配置表
|
||||||
avatarPromoteConfig, ok = avatarPromoteDataMap[int32(avatar.Promote+1)]
|
avatarPromoteConfig, ok = avatarPromoteDataMap[int32(avatar.Promote+1)]
|
||||||
if !ok {
|
if !ok {
|
||||||
logger.Error("avatar promote config error, promoteLevel: %v", avatar.Promote)
|
logger.Error("avatar promote config error, promoteLevel: %v", avatar.Promote)
|
||||||
g.CommonRetError(cmd.AvatarPromoteRsp, player, &proto.AvatarPromoteRsp{})
|
g.CommonRetError(cmd.AvatarPromoteRsp, player, &proto.AvatarPromoteRsp{}, proto.Retcode_RET_AVATAR_ON_MAX_BREAK_LEVEL)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// 将被消耗的物品列表
|
// 将被消耗的物品列表
|
||||||
@@ -130,14 +130,18 @@ func (g *GameManager) AvatarPromoteReq(player *model.Player, payloadMsg pb.Messa
|
|||||||
for _, item := range costItemList {
|
for _, item := range costItemList {
|
||||||
if player.GetItemCount(item.ItemId) < item.ChangeCount {
|
if player.GetItemCount(item.ItemId) < item.ChangeCount {
|
||||||
logger.Error("item count not enough, itemId: %v", item.ItemId)
|
logger.Error("item count not enough, itemId: %v", item.ItemId)
|
||||||
g.CommonRetError(cmd.AvatarPromoteRsp, player, &proto.AvatarPromoteRsp{}, proto.Retcode_RET_SCOIN_NOT_ENOUGH)
|
// 摩拉的错误提示与材料不同
|
||||||
|
if item.ItemId == constant.ItemConstantConst.SCOIN {
|
||||||
|
g.CommonRetError(cmd.AvatarPromoteRsp, player, &proto.AvatarPromoteRsp{}, proto.Retcode_RET_SCOIN_NOT_ENOUGH)
|
||||||
|
}
|
||||||
|
g.CommonRetError(cmd.AvatarPromoteRsp, player, &proto.AvatarPromoteRsp{}, proto.Retcode_RET_ITEM_COUNT_NOT_ENOUGH)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 冒险等级是否符合要求
|
// 冒险等级是否符合要求
|
||||||
if player.PropertiesMap[constant.PlayerPropertyConst.PROP_PLAYER_LEVEL] < uint32(avatarPromoteConfig.MinPlayerLevel) {
|
if player.PropertiesMap[constant.PlayerPropertyConst.PROP_PLAYER_LEVEL] < uint32(avatarPromoteConfig.MinPlayerLevel) {
|
||||||
logger.Error("player level not enough, level: %v", player.PropertiesMap[constant.PlayerPropertyConst.PROP_PLAYER_LEVEL])
|
logger.Error("player level not enough, level: %v", player.PropertiesMap[constant.PlayerPropertyConst.PROP_PLAYER_LEVEL])
|
||||||
g.CommonRetError(cmd.AvatarPromoteRsp, player, &proto.AvatarPromoteRsp{})
|
g.CommonRetError(cmd.AvatarPromoteRsp, player, &proto.AvatarPromoteRsp{}, proto.Retcode_RET_PLAYER_LEVEL_LESS_THAN)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// 消耗突破材料和摩拉
|
// 消耗突破材料和摩拉
|
||||||
@@ -219,7 +223,7 @@ func (g *GameManager) AvatarUpgradeReq(player *model.Player, payloadMsg pb.Messa
|
|||||||
// 角色等级是否达到限制
|
// 角色等级是否达到限制
|
||||||
if avatar.Level >= uint8(avatarPromoteConfig.LevelLimit) {
|
if avatar.Level >= uint8(avatarPromoteConfig.LevelLimit) {
|
||||||
logger.Error("avatar level ge level limit, level: %v", avatar.Level)
|
logger.Error("avatar level ge level limit, level: %v", avatar.Level)
|
||||||
g.CommonRetError(cmd.AvatarUpgradeRsp, player, &proto.AvatarUpgradeRsp{})
|
g.CommonRetError(cmd.AvatarUpgradeRsp, player, &proto.AvatarUpgradeRsp{}, proto.Retcode_RET_AVATAR_BREAK_LEVEL_LESS_THAN)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// 消耗升级材料以及摩拉
|
// 消耗升级材料以及摩拉
|
||||||
|
|||||||
@@ -654,6 +654,11 @@ func (g *GameManager) PacketSceneEntityInfoAvatar(scene *Scene, player *model.Pl
|
|||||||
Z: float32(entity.pos.Z),
|
Z: float32(entity.pos.Z),
|
||||||
}
|
}
|
||||||
worldAvatar := scene.world.GetWorldAvatarByEntityId(entity.id)
|
worldAvatar := scene.world.GetWorldAvatarByEntityId(entity.id)
|
||||||
|
avatar, ok := player.AvatarMap[worldAvatar.avatarId]
|
||||||
|
if !ok {
|
||||||
|
logger.Error("avatar error, avatarId: %v", worldAvatar.avatarId)
|
||||||
|
return new(proto.SceneEntityInfo)
|
||||||
|
}
|
||||||
sceneEntityInfo := &proto.SceneEntityInfo{
|
sceneEntityInfo := &proto.SceneEntityInfo{
|
||||||
EntityType: proto.ProtEntityType_PROT_ENTITY_AVATAR,
|
EntityType: proto.ProtEntityType_PROT_ENTITY_AVATAR,
|
||||||
EntityId: entity.id,
|
EntityId: entity.id,
|
||||||
@@ -667,11 +672,43 @@ func (g *GameManager) PacketSceneEntityInfoAvatar(scene *Scene, player *model.Pl
|
|||||||
Speed: &proto.Vector{},
|
Speed: &proto.Vector{},
|
||||||
State: proto.MotionState(entity.moveState),
|
State: proto.MotionState(entity.moveState),
|
||||||
},
|
},
|
||||||
PropList: []*proto.PropPair{{Type: uint32(constant.PlayerPropertyConst.PROP_LEVEL), PropValue: &proto.PropValue{
|
PropList: []*proto.PropPair{
|
||||||
Type: uint32(constant.PlayerPropertyConst.PROP_LEVEL),
|
{
|
||||||
Value: &proto.PropValue_Ival{Ival: int64(entity.level)},
|
Type: uint32(constant.PlayerPropertyConst.PROP_LEVEL),
|
||||||
Val: int64(entity.level),
|
PropValue: &proto.PropValue{
|
||||||
}}},
|
Type: uint32(constant.PlayerPropertyConst.PROP_LEVEL),
|
||||||
|
Value: &proto.PropValue_Ival{Ival: int64(avatar.Level)},
|
||||||
|
Val: int64(avatar.Level)},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Type: uint32(constant.PlayerPropertyConst.PROP_EXP),
|
||||||
|
PropValue: &proto.PropValue{
|
||||||
|
Type: uint32(constant.PlayerPropertyConst.PROP_EXP),
|
||||||
|
Value: &proto.PropValue_Ival{Ival: int64(avatar.Exp)},
|
||||||
|
Val: int64(avatar.Exp)},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Type: uint32(constant.PlayerPropertyConst.PROP_BREAK_LEVEL),
|
||||||
|
PropValue: &proto.PropValue{
|
||||||
|
Type: uint32(constant.PlayerPropertyConst.PROP_BREAK_LEVEL),
|
||||||
|
Value: &proto.PropValue_Ival{Ival: int64(avatar.Promote)},
|
||||||
|
Val: int64(avatar.Promote)},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Type: uint32(constant.PlayerPropertyConst.PROP_SATIATION_VAL),
|
||||||
|
PropValue: &proto.PropValue{
|
||||||
|
Type: uint32(constant.PlayerPropertyConst.PROP_SATIATION_VAL),
|
||||||
|
Value: &proto.PropValue_Ival{Ival: int64(avatar.Satiation)},
|
||||||
|
Val: int64(avatar.Satiation)},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Type: uint32(constant.PlayerPropertyConst.PROP_SATIATION_PENALTY_TIME),
|
||||||
|
PropValue: &proto.PropValue{
|
||||||
|
Type: uint32(constant.PlayerPropertyConst.PROP_SATIATION_PENALTY_TIME),
|
||||||
|
Value: &proto.PropValue_Ival{Ival: int64(avatar.SatiationPenalty)},
|
||||||
|
Val: int64(avatar.SatiationPenalty)},
|
||||||
|
},
|
||||||
|
},
|
||||||
FightPropList: g.PacketFightPropMapToPbFightPropList(entity.fightProp),
|
FightPropList: g.PacketFightPropMapToPbFightPropList(entity.fightProp),
|
||||||
LifeState: uint32(entity.lifeState),
|
LifeState: uint32(entity.lifeState),
|
||||||
AnimatorParaList: make([]*proto.AnimatorParameterValueInfoPair, 0),
|
AnimatorParaList: make([]*proto.AnimatorParameterValueInfoPair, 0),
|
||||||
|
|||||||
@@ -862,7 +862,7 @@ func (s *Scene) CreateEntityAvatar(player *model.Player, avatarId uint32) uint32
|
|||||||
lastMoveReliableSeq: 0,
|
lastMoveReliableSeq: 0,
|
||||||
fightProp: player.AvatarMap[avatarId].FightPropMap,
|
fightProp: player.AvatarMap[avatarId].FightPropMap,
|
||||||
entityType: uint32(proto.ProtEntityType_PROT_ENTITY_AVATAR),
|
entityType: uint32(proto.ProtEntityType_PROT_ENTITY_AVATAR),
|
||||||
level: player.AvatarMap[avatarId].Level,
|
level: 0, // 角色等级直接读取角色对象
|
||||||
avatarEntity: &AvatarEntity{
|
avatarEntity: &AvatarEntity{
|
||||||
uid: player.PlayerID,
|
uid: player.PlayerID,
|
||||||
avatarId: avatarId,
|
avatarId: avatarId,
|
||||||
|
|||||||
Reference in New Issue
Block a user