```
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful

feat(controller): 增强命令注册逻辑并修复试炼塔关卡限制

- 在命令注册时检查重复方法,如果存在则panic提示错误
- 移除CurrentFreshStage和CurrentStage的默认值设置逻辑
- 添加关卡等级验证,确保用户不能挑战超过最大关卡数的关卡
- 修复试炼之塔和勇者之塔的关卡计算逻辑

fix(item): 修复道具
This commit is contained in:
昔念
2026-03-03 19:28:59 +08:00
parent 103bc0c232
commit 5caa9a1e4f
10 changed files with 98 additions and 36 deletions

View File

@@ -179,14 +179,16 @@ func (h Controller) UseSpeedupItem(data *item.C2S_USE_SPEEDUP_ITEM, c *player.Pl
return nil, errorcode.ErrorCodes.ErrItemInUse
}
c.Info.ThreeTimes += 30 // 玩家对象新增 ThreeTimesExp 字段存储三倍剩余次数
default:
return nil, errorcode.ErrorCodes.ErrSystemError // 未知道具ID
}
// 3. 扣减道具(数量-1
c.Service.Item.UPDATE(data.ItemID, -1)
result.ThreeTimes = c.Info.ThreeTimes // 返回三倍经验剩余次数
result.TwoTimes = c.Info.TwoTimes // 返回双倍经验剩余次数
result.ThreeTimes = uint32(c.Info.ThreeTimes) // 返回三倍经验剩余次数
result.TwoTimes = uint32(c.Info.TwoTimes) // 返回双倍经验剩余次数
// 4. (可选)持久化玩家经验次数(根据你的项目存储逻辑补充)
// c.Service.Player.SaveExpTimes(c)
@@ -218,6 +220,9 @@ func (h Controller) UseEnergyXishou(data *item.C2S_USE_ENERGY_XISHOU, c *player.
// 3. 扣减道具(数量-1
c.Service.Item.UPDATE(data.ItemID, -1)
result = &item.S2C_USE_ENERGY_XISHOU{
EnergyTimes: uint32(c.Info.EnergyTime),
}
// 4. (可选)持久化玩家能量次数
// c.Service.Player.SaveEnergyTimes(c)