feat(fight): 支持勇者之塔和试炼之塔战斗功能

- 实现勇者之塔(CMD 2414)和试炼之塔(CMD 2428)的战斗逻辑
- 添加Tower500Service和Tower600Service的Boss查询功能
- 统一处理两个塔的BossId
This commit is contained in:
2026-01-01 15:37:43 +08:00
parent 4b6f2862d8
commit d88a2d19ea
11 changed files with 77 additions and 32 deletions

View File

@@ -41,25 +41,28 @@ func (h Controller) FreshChoiceFightLevel(data *fight.C2S_FRESH_CHOICE_FIGHT_LEV
c.Info.CurrentStage = uint32((data.Level-1)*10) + 1
}
}
var boss *configmodel.BaseTowerConfig
switch data.Head.CMD {
case 2428: //试炼之塔
result.CurFightLevel = uint(c.Info.CurrentFreshStage)
boss := service.NewTower600Service().Boss(c.Info.CurrentFreshStage)
//next := service.NewTower600Service().Boss(c.Info.CurrentFreshStage + 1)
if boss != nil {
boss = service.NewTower600Service().Boss(c.Info.CurrentFreshStage)
for _, v := range boss.BossIds {
r := configservice.NewBossService().Get(v)
result.BossId = append(result.BossId, uint32(r.MonID))
}
}
case 2414: //勇者之塔
result.CurFightLevel = uint(c.Info.CurrentStage)
boss = service.NewTower500Service().Boss(c.Info.CurrentFreshStage)
//next := service.NewTower600Service().Boss(c.Info.CurrentFreshStage + 1)
}
if boss != nil {
for _, v := range boss.BossIds {
r := configservice.NewBossService().Get(v)
result.BossId = append(result.BossId, uint32(r.MonID))
}
}
// 重置玩家的Canmon标志位为0表示可以刷怪
atomic.StoreUint32(&c.Canmon, 0)
@@ -86,11 +89,12 @@ func (h Controller) PetTawor(data *fight.StartTwarInboundInfo, c *player.Player)
c.Fightinfo.Status = fightinfo.BattleMode.FIGHT_WITH_NPC
monsterInfo := &model.PlayerInfo{}
var boss *configmodel.BaseTowerConfig
var next *configmodel.BaseTowerConfig
result = &fight.S2C_ChoiceLevelRequestInfo{}
switch data.Head.CMD {
case 2429: //试炼之塔
boss = service.NewTower600Service().Boss(c.Info.CurrentFreshStage)
next := service.NewTower600Service().Boss(c.Info.CurrentFreshStage + 1)
next = service.NewTower600Service().Boss(c.Info.CurrentFreshStage + 1)
if next != nil {
for _, v := range next.BossIds {
r := configservice.NewBossService().Get(v)
@@ -101,10 +105,19 @@ func (h Controller) PetTawor(data *fight.StartTwarInboundInfo, c *player.Player)
result.CurFightLevel = uint32(c.Info.CurrentFreshStage)
case 2415: //勇者之塔
boss = service.NewTower500Service().Boss(c.Info.CurrentStage)
next = service.NewTower500Service().Boss(c.Info.CurrentStage + 1)
result.CurFightLevel = uint32(c.Info.CurrentStage)
}
if next == nil {
for _, v := range next.BossIds {
r := configservice.NewBossService().Get(v)
result.BossID = append(result.BossID, uint32(r.MonID))
}
}
for i, v := range boss.BossIds {
r := configservice.NewBossService().Get(v)
if r != nil {
@@ -146,7 +159,7 @@ func (h Controller) PetTawor(data *fight.StartTwarInboundInfo, c *player.Player)
c.Info.CurrentFreshStage++
case 2415: //勇者之塔
c.Info.CurrentStage++
}
}