Files
bl/logic/service/fight/info/over.go
xinian 2ee0cbc094
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful
fix: 修复boss奖励发放逻辑
2026-04-05 07:28:39 +08:00

43 lines
1.3 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package info
import "blazing/common/data"
type S2C_GET_BOSS_MONSTER struct {
BonusID uint32 // 激活前端任务的ID
// EXP uint32 `json:"exp" description:"奖励经验"`
// EV int64 `struc:"uint32"`
PetID uint32 // 发放精灵的ID
CaptureTm uint32 // 发放精灵的捕获时间
ItemListLen uint32 `struc:"sizeof=ItemList"`
ItemList []data.ItemInfo // 发放物品的数组:
// 特殊说明:
// 1. 仅发放精灵不发放物品时ItemList 无需填充元素,但序列化时需先写入 uint 类型的长度值为0
// 2. 发放多个物品时:序列化时先写入 uint 类型的数组长度再依次写入每个ItemInfo元素
// 3. 该List结构参考PetInfo的特性List长度为Uint型非int
}
func (s *S2C_GET_BOSS_MONSTER) AddItem(id, count uint32) bool {
if id == 0 || count == 0 {
return false
}
s.ItemList = append(s.ItemList, data.ItemInfo{
ItemId: int64(id),
ItemCnt: int64(count),
})
return true
}
func (s *S2C_GET_BOSS_MONSTER) AddItemInfo(item data.ItemInfo) bool {
if item.ItemId == 0 || item.ItemCnt <= 0 {
return false
}
s.ItemList = append(s.ItemList, item)
return true
}
func (s *S2C_GET_BOSS_MONSTER) HasReward() bool {
return s.BonusID != 0 || s.PetID != 0 || s.CaptureTm != 0 || len(s.ItemList) > 0
}