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)))
}