Files
bl/modules/blazing/model/item.go
昔念 c9bc4be244 ```
feat: 添加ItemInfo结构体并重构抽蛋和任务系统

- 在common/data/color.go中添加ItemInfo结构体用于表示发放物品的信息
- 在common/utils/tomap.go中添加RandomSlice泛型函数用于从切片中随机选取元素
- 重构action_egg.go中的EggGamePlay功能,实现抽蛋逻辑和物品发放
- 更新fight_boss.go中使用新的ItemInfo结构体替换旧的model.ItemInfo
- 修改user_talk.go中获取物品数量的逻辑
- 更新user_task.go中任务完成逻辑使用新的ItemInfo结构体
- 在egg.go中更新抽蛋结果结构体使用ItemInfo
- 更新战斗奖励结构体使用ItemInfo
- 在player.go中添加学习力道具处理逻辑
- 重构任务系统使用新的ItemInfo结构体
- 移除旧的model.ItemInfo定义
- 更新宠物奖励配置模型添加成长值等字段
- 实现GetEgg方法用于获取扭蛋奖励
- 修复宠物融合材料服务中的道具验证逻辑
```
2025-12-26 20:38:08 +08:00

51 lines
1.1 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 model
import (
"blazing/cool"
)
const TableNamePlayerBagItem = "player_bag_item"
// PlayerBagItem mapped from table <player_bag_item>
type Item struct {
*cool.Model
PlayerID uint64 `gorm:"not null;index:idx_player_bag_item_by_player_id;comment:'所属玩家ID'" json:"player_id"`
// 物品Id
ItemId uint32 `json:"item_id"`
// 物品数量,
ItemCnt uint32 `json:"item_cnt"`
}
type SingleItemInfo struct {
// 物品Id
ItemId uint32 `json:"itemId"`
// 物品数量,
ItemCnt uint32 `json:"itemCnt"`
// 固定值360000
LeftTime uint32 `json:"leftTime"`
// 固定值0
ItemLevel uint32 `json:"itemLevel"`
}
// TableName PlayerBagItem's table name
func (*Item) TableName() string {
return TableNamePlayerBagItem
}
// GroupName PlayerBagItem's table group
func (*Item) GroupName() string {
return "default"
}
// NewPlayerBagItem create a new PlayerBagItem
func NewPlayerBag() *Item {
return &Item{
Model: cool.NewModel(),
}
}
// init 创建表
func init() {
cool.CreateTable(&Item{})
}