feat(controller): 增强命令注册逻辑并修复试炼塔关卡限制 - 在命令注册时检查重复方法,如果存在则panic提示错误 - 移除CurrentFreshStage和CurrentStage的默认值设置逻辑 - 添加关卡等级验证,确保用户不能挑战超过最大关卡数的关卡 - 修复试炼之塔和勇者之塔的关卡计算逻辑 fix(item): 修复道具
This commit is contained in:
@@ -21,8 +21,8 @@ import (
|
||||
func (h Controller) FreshOpen(data *fight.C2S_OPEN_DARKPORTAL, c *player.Player) (result *fight.S2C_OPEN_DARKPORTAL, err errorcode.ErrorCode) {
|
||||
|
||||
result = &fight.S2C_OPEN_DARKPORTAL{}
|
||||
c.Info.CurrentFreshStage = utils.Max(c.Info.CurrentFreshStage, 1)
|
||||
c.Info.CurrentStage = utils.Max(c.Info.CurrentStage, 1)
|
||||
// c.Info.CurrentFreshStage = utils.Max(c.Info.CurrentFreshStage, 1)
|
||||
// c.Info.CurrentStage = utils.Max(c.Info.CurrentStage, 1)
|
||||
boss := service.NewTower110Service().Boss(uint32(data.Level))
|
||||
if len(boss) == 0 {
|
||||
return nil, errorcode.ErrorCodes.ErrPokemonNotExists
|
||||
@@ -59,11 +59,16 @@ func (h Controller) FreshChoiceFightLevel(data *fight.C2S_FRESH_CHOICE_FIGHT_LEV
|
||||
if data.Level > 0 {
|
||||
switch data.Head.CMD {
|
||||
case 2428: //试炼之塔
|
||||
if data.Level > uint(c.Info.MaxFreshStage) {
|
||||
return nil, errorcode.ErrorCodes.ErrPokemonNotExists
|
||||
}
|
||||
|
||||
c.Info.CurrentFreshStage = uint32((data.Level-1)*10) + 1
|
||||
c.Info.CurrentFreshStage = uint32(data.Level)
|
||||
case 2414: //勇者之塔
|
||||
|
||||
c.Info.CurrentStage = uint32((data.Level-1)*10) + 1
|
||||
if data.Level > uint(c.Info.MaxStage) {
|
||||
return nil, errorcode.ErrorCodes.ErrPokemonNotExists
|
||||
}
|
||||
c.Info.CurrentStage = uint32(data.Level)
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user