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

refactor(common/data/xmlres): 注释掉未使用的MonsterMap配置变量

- 将MonsterMap配置变量注释掉,因为当前不再使用该配置
- 相应地注释掉了初始化代码中的MonsterMap赋值逻辑

feat(logic/controller): 统一CanFight方法返回值为ErrorCode

- 修改PlayerFightBoss等战斗控制器中的Can
This commit is contained in:
昔念
2026-02-25 16:18:10 +08:00
parent 5e9ac0bef5
commit 7c1540ff6d
20 changed files with 284 additions and 272 deletions

View File

@@ -25,11 +25,13 @@ func (h Controller) FreshOpen(data *fight.C2S_OPEN_DARKPORTAL, c *player.Player)
c.Info.CurrentStage = utils.Max(c.Info.CurrentStage, 1)
boss := service.NewTower110Service().Boss(uint32(data.Level))
result = &fight.S2C_OPEN_DARKPORTAL{}
for _, v := range boss.BossIds {
r := service.NewBossService().Get(v)
result.CurBossID = uint32(r.MonID)
r := service.NewBossService().Get(boss.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)
@@ -80,13 +82,9 @@ func (h Controller) FreshChoiceFightLevel(data *fight.C2S_FRESH_CHOICE_FIGHT_LEV
}
if boss != nil {
for _, v := range boss.BossIds {
r := service.NewBossService().Get(v)
if r != nil {
result.BossId = append(result.BossId, uint32(r.MonID))
}
r := service.NewBossService().Get(boss.BossIds[0])
for _, v := range r {
result.BossId = append(result.BossId, uint32(v.MonID))
}
}
@@ -108,8 +106,9 @@ func (h Controller) FreshLeaveFightLevel(data *fight.FRESH_LEAVE_FIGHT_LEVEL, c
}
func (h Controller) PetTawor(data *fight.StartTwarInboundInfo, c *player.Player) (result *fight.S2C_ChoiceLevelRequestInfo, err errorcode.ErrorCode) {
if !c.CanFight() {
return nil, errorcode.ErrorCodes.ErrSystemError
r := c.CanFight()
if c.CanFight() != 0 {
return nil, r
}
c.Fightinfo.Mode = fightinfo.BattleMode.MULTI_MODE
c.Fightinfo.Status = fightinfo.BattleMode.FIGHT_WITH_NPC
@@ -132,57 +131,57 @@ func (h Controller) PetTawor(data *fight.StartTwarInboundInfo, c *player.Player)
boss = service.NewTower110Service().Boss(c.CurDark)
}
if next != nil {
for _, v := range next.BossIds {
r := service.NewBossService().Get(v)
result.BossID = append(result.BossID, uint32(r.MonID))
r := service.NewBossService().Get(boss.BossIds[0])
for _, v := range r {
result.BossID = append(result.BossID, uint32(v.MonID))
}
}
for i, v := range boss.BossIds {
r := service.NewBossService().Get(v)
if r != nil {
monster := model.GenPetInfo(int(r.MonID), 24, int(r.Nature), 0, int(r.Lv), nil, 0)
if r.Hp != 0 {
monster.Hp = uint32(r.Hp)
monster.MaxHp = uint32(r.Hp)
bosss := service.NewBossService().Get(boss.BossIds[0])
monsterInfo.Nick = boss.Name
for i, r := range bosss {
}
monster := model.GenPetInfo(int(r.MonID), 24, int(r.Nature), 0, int(r.Lv), nil, 0)
if r.Hp != 0 {
monster.Hp = uint32(r.Hp)
monster.MaxHp = uint32(r.Hp)
for i, v := range r.Prop {
if v != 0 {
monster.Prop[i] = v
}
}
if len(r.SKill) != 0 {
for i := 0; i < len(monster.SkillList); i++ {
if r.SKill[i] != 0 {
monster.SkillList[i].ID = r.SKill[i]
}
}
}
if len(r.Effect) != 0 {
for _, v := range r.Effect {
EID, args := service.NewEffectService().Args(v)
monster.EffectInfo = append(monster.EffectInfo, model.PetEffectInfo{
Idx: uint16(v),
EID: gconv.Uint16(EID),
Args: gconv.Ints(args),
})
}
}
monster.CatchTime = uint32(i)
monsterInfo.PetList = append(monsterInfo.PetList, *monster)
}
for i, v := range r.Prop {
if v != 0 {
monster.Prop[i] = v
}
}
if len(r.SKill) != 0 {
for i := 0; i < len(monster.SkillList); i++ {
if r.SKill[i] != 0 {
monster.SkillList[i].ID = r.SKill[i]
}
}
}
if len(r.Effect) != 0 {
for _, v := range r.Effect {
EID, args := service.NewEffectService().Args(v)
monster.EffectInfo = append(monster.EffectInfo, model.PetEffectInfo{
Idx: uint16(v),
EID: gconv.Uint16(EID),
Args: gconv.Ints(args),
})
}
}
monster.CatchTime = uint32(i)
monsterInfo.PetList = append(monsterInfo.PetList, *monster)
}
ai := player.NewAI_player(monsterInfo)