43 lines
1.3 KiB
Go
43 lines
1.3 KiB
Go
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
|
||
}
|