fix: 修复黑暗传送门打开时boss不存在导致的错误
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful

This commit is contained in:
xinian
2026-02-26 17:21:43 +08:00
committed by cnb
parent de711bec7a
commit 3157c4d41a

View File

@@ -24,14 +24,15 @@ func (h Controller) FreshOpen(data *fight.C2S_OPEN_DARKPORTAL, c *player.Player)
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
}
if len(boss[0].BossIds) == 0 {
return nil, errorcode.ErrorCodes.ErrPokemonNotExists
}
result = &fight.S2C_OPEN_DARKPORTAL{}
r := service.NewBossService().Get(boss[0].BossIds[0])
result.CurBossID = uint32(r[0].MonID)
// for _, v := range r {
// r := service.NewBossService().Get(boss.BossIds[0])
// result.CurBossID = uint32(r.MonID)
// }
c.CurDark = uint32(data.Level)
defer c.GetSpace().LeaveMap(c)
@@ -81,7 +82,7 @@ func (h Controller) FreshChoiceFightLevel(data *fight.C2S_FRESH_CHOICE_FIGHT_LEV
//next := service.NewTower600Service().Boss(c.Info.CurrentFreshStage + 1)
}
if len(boss[0].BossIds) != 0 {
if len(boss) != 0 && len(boss[0].BossIds) != 0 {
//单节点,取获取到的一个,然后因为不是剧情,所以只有一层
r := service.NewBossService().Get(boss[0].BossIds[0])
for _, v := range r {