- 重构了任务系统的数据结构和执行逻辑 - 优化了地图加载和怪物刷新机制 - 改进了宠物系统的基础架构 - 调整了玩家信息和背包的处理方式 - 统一了数据访问层的接口和实现
43 lines
1.2 KiB
Go
43 lines
1.2 KiB
Go
package model
|
|
|
|
import (
|
|
"blazing/cool"
|
|
)
|
|
|
|
const TableNamePlayerBagItem = "player_bag_item"
|
|
|
|
// PlayerBagItem mapped from table <player_bag_item>
|
|
type PlayerBag struct {
|
|
*cool.Model
|
|
PlayerID uint64 `gorm:"not null;index:idx_player_bag_item_by_player_id;comment:'所属玩家ID'" json:"player_id"`
|
|
Data string `gorm:"type:text;not null;comment:'全部数据'" json:"data"`
|
|
}
|
|
type PlayerBagItem struct {
|
|
ID int32 `gorm:"not null;comment:'道具唯一编号'" json:"item_id"`
|
|
Count int32 `gorm:"not null;default:0;comment:'拥有数量 '" json:"count"`
|
|
Max int32 `gorm:"not null;default:0;comment:'最大数量 '" json:"max"`
|
|
Total int32 `gorm:"not null;default:0;comment:'使用次数'" json:"total"`
|
|
}
|
|
|
|
// TableName PlayerBagItem's table name
|
|
func (*PlayerBagItem) TableName() string {
|
|
return TableNamePlayerBagItem
|
|
}
|
|
|
|
// GroupName PlayerBagItem's table group
|
|
func (*PlayerBagItem) GroupName() string {
|
|
return "default"
|
|
}
|
|
|
|
// NewPlayerBagItem create a new PlayerBagItem
|
|
func NewPlayerBag() *PlayerBag {
|
|
return &PlayerBag{
|
|
Model: cool.NewModel(),
|
|
}
|
|
}
|
|
|
|
// init 创建表
|
|
func init() {
|
|
cool.CreateTable(&PlayerBag{})
|
|
}
|