fix: 修复boss奖励发放逻辑
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful

This commit is contained in:
xinian
2026-04-05 07:28:39 +08:00
committed by cnb
parent 6510e4e09b
commit 2ee0cbc094
4 changed files with 41 additions and 20 deletions

View File

@@ -18,6 +18,10 @@ import (
"github.com/gogf/gf/v2/util/grand"
)
const (
rewardItemExpPool = 3
)
// PlayerFightBoss 挑战地图boss
func (Controller) PlayerFightBoss(req *ChallengeBossInboundInfo, p *player.Player) (result *fight.NullOutboundInfo, err errorcode.ErrorCode) {
if err = p.CanFight(); err != 0 {
@@ -250,7 +254,7 @@ func handleNpcFightRewards(p *player.Player, foi model.FightOverInfo, monster *m
rewards := &fightinfo.S2C_GET_BOSS_MONSTER{}
p.ItemAdd(3, int64(poolexp+addexp))
rewards.ADDitem(3, uint32(poolexp))
rewards.AddItem(rewardItemExpPool, uint32(poolexp))
p.AddPetExp(foi.Winpet, int64(addexp))
if p.CanGetItem() {
@@ -258,7 +262,7 @@ func handleNpcFightRewards(p *player.Player, foi model.FightOverInfo, monster *m
if itemID != 0 {
count := uint32(grand.N(1, 2))
if p.ItemAdd(itemID, int64(count)) {
rewards.ADDitem(uint32(itemID), count)
rewards.AddItem(uint32(itemID), count)
}
}
}
@@ -268,10 +272,12 @@ func handleNpcFightRewards(p *player.Player, foi model.FightOverInfo, monster *m
xuanID := uint32(400686 + petType)
count := uint32(grand.N(1, 2))
if p.ItemAdd(int64(xuanID), int64(count)) {
rewards.ADDitem(xuanID, count)
rewards.AddItem(xuanID, count)
}
}
p.SendPackCmd(8004, rewards)
if rewards.HasReward() {
p.SendPackCmd(8004, rewards)
}
foi.Winpet.AddEV(gconv.Int64s(strings.Fields(petCfg.YieldingEV)))
}

View File

@@ -1,7 +1,6 @@
package controller
import (
"blazing/common/data"
"blazing/common/socket/errorcode"
"blazing/modules/player/model"
"sync/atomic"
@@ -35,9 +34,11 @@ func (h Controller) ArenaSetOwner(data *ARENA_SET_OWENR, c *player.Player) (resu
return nil, errorcode.ErrorCodes.ErrChampionExists
}
type ARENA_FIGHT_OWENR struct {
Head common.TomeeHeader `cmd:"2418" struc:"skip"`
}
// ArenaFightOwner 挑战擂台的包
// 还是后端主动发送2503的包给双方前端后 等待前端加载完毕 主动发送2404包通知后端开始战斗
// ArenaFightOwner 并不会通知对方是否接受挑战。只要有人挑战就直接进入对战
@@ -87,12 +88,9 @@ func (h Controller) ArenaFightOwner(data1 *ARENA_FIGHT_OWENR, c *player.Player)
if addev != 0 {
c.Info.EVPool += addev
c.SendPackCmd(8004, &info.S2C_GET_BOSS_MONSTER{ //发送EV
ItemList: []data.ItemInfo{{
ItemId: 9,
ItemCnt: int64(addev),
}},
})
rewards := &info.S2C_GET_BOSS_MONSTER{}
rewards.AddItem(9, uint32(addev))
c.SendPackCmd(8004, rewards) //发送EV
}
} else {
@@ -103,12 +101,9 @@ func (h Controller) ArenaFightOwner(data1 *ARENA_FIGHT_OWENR, c *player.Player)
if addev != 0 {
c.GetSpace().Owner.ARENA_Player.GetInfo().EVPool += addev
c.GetSpace().Owner.ARENA_Player.SendPackCmd(8004, &info.S2C_GET_BOSS_MONSTER{ //发送EV
ItemList: []data.ItemInfo{{
ItemId: 9,
ItemCnt: int64(addev),
}},
})
rewards := &info.S2C_GET_BOSS_MONSTER{}
rewards.AddItem(9, uint32(addev))
c.GetSpace().Owner.ARENA_Player.SendPackCmd(8004, rewards) //发送EV
}
}