mirror of
https://github.com/FlourishingWorld/hk4e.git
synced 2026-02-04 16:02:26 +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) {
|
||||
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
|
||||
}
|
||||
// 获取角色突破下一级的配置表
|
||||
avatarPromoteConfig, ok = avatarPromoteDataMap[int32(avatar.Promote+1)]
|
||||
if !ok {
|
||||
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
|
||||
}
|
||||
// 将被消耗的物品列表
|
||||
@@ -130,14 +130,18 @@ func (g *GameManager) AvatarPromoteReq(player *model.Player, payloadMsg pb.Messa
|
||||
for _, item := range costItemList {
|
||||
if player.GetItemCount(item.ItemId) < item.ChangeCount {
|
||||
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
|
||||
}
|
||||
}
|
||||
// 冒险等级是否符合要求
|
||||
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])
|
||||
g.CommonRetError(cmd.AvatarPromoteRsp, player, &proto.AvatarPromoteRsp{})
|
||||
g.CommonRetError(cmd.AvatarPromoteRsp, player, &proto.AvatarPromoteRsp{}, proto.Retcode_RET_PLAYER_LEVEL_LESS_THAN)
|
||||
return
|
||||
}
|
||||
// 消耗突破材料和摩拉
|
||||
@@ -219,7 +223,7 @@ func (g *GameManager) AvatarUpgradeReq(player *model.Player, payloadMsg pb.Messa
|
||||
// 角色等级是否达到限制
|
||||
if avatar.Level >= uint8(avatarPromoteConfig.LevelLimit) {
|
||||
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
|
||||
}
|
||||
// 消耗升级材料以及摩拉
|
||||
|
||||
@@ -654,6 +654,11 @@ func (g *GameManager) PacketSceneEntityInfoAvatar(scene *Scene, player *model.Pl
|
||||
Z: float32(entity.pos.Z),
|
||||
}
|
||||
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{
|
||||
EntityType: proto.ProtEntityType_PROT_ENTITY_AVATAR,
|
||||
EntityId: entity.id,
|
||||
@@ -667,11 +672,43 @@ func (g *GameManager) PacketSceneEntityInfoAvatar(scene *Scene, player *model.Pl
|
||||
Speed: &proto.Vector{},
|
||||
State: proto.MotionState(entity.moveState),
|
||||
},
|
||||
PropList: []*proto.PropPair{{Type: uint32(constant.PlayerPropertyConst.PROP_LEVEL), PropValue: &proto.PropValue{
|
||||
Type: uint32(constant.PlayerPropertyConst.PROP_LEVEL),
|
||||
Value: &proto.PropValue_Ival{Ival: int64(entity.level)},
|
||||
Val: int64(entity.level),
|
||||
}}},
|
||||
PropList: []*proto.PropPair{
|
||||
{
|
||||
Type: uint32(constant.PlayerPropertyConst.PROP_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),
|
||||
LifeState: uint32(entity.lifeState),
|
||||
AnimatorParaList: make([]*proto.AnimatorParameterValueInfoPair, 0),
|
||||
|
||||
@@ -862,7 +862,7 @@ func (s *Scene) CreateEntityAvatar(player *model.Player, avatarId uint32) uint32
|
||||
lastMoveReliableSeq: 0,
|
||||
fightProp: player.AvatarMap[avatarId].FightPropMap,
|
||||
entityType: uint32(proto.ProtEntityType_PROT_ENTITY_AVATAR),
|
||||
level: player.AvatarMap[avatarId].Level,
|
||||
level: 0, // 角色等级直接读取角色对象
|
||||
avatarEntity: &AvatarEntity{
|
||||
uid: player.PlayerID,
|
||||
avatarId: avatarId,
|
||||
|
||||
Reference in New Issue
Block a user