refactor(blazing): 重构任务系统并优化相关功能
- 重构了任务系统的数据结构和执行逻辑 - 优化了地图加载和怪物刷新机制 - 改进了宠物系统的基础架构 - 调整了玩家信息和背包的处理方式 - 统一了数据访问层的接口和实现
This commit is contained in:
@@ -7,11 +7,16 @@ import (
|
||||
const TableNamePlayerBagItem = "player_bag_item"
|
||||
|
||||
// PlayerBagItem mapped from table <player_bag_item>
|
||||
type PlayerBagItem struct {
|
||||
type PlayerBag struct {
|
||||
*cool.Model
|
||||
PlayerID uint64 `gorm:"not null;index:idx_player_bag_item_by_player_id;comment:'所属玩家ID'" json:"player_id"`
|
||||
ItemID int32 `gorm:"not null;comment:'道具唯一编号'" json:"item_id"`
|
||||
Quantity int32 `gorm:"not null;default:0;comment:'拥有数量(uint16)'" json:"quantity"`
|
||||
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
|
||||
@@ -25,13 +30,13 @@ func (*PlayerBagItem) GroupName() string {
|
||||
}
|
||||
|
||||
// NewPlayerBagItem create a new PlayerBagItem
|
||||
func NewPlayerBagItem() *PlayerBagItem {
|
||||
return &PlayerBagItem{
|
||||
func NewPlayerBag() *PlayerBag {
|
||||
return &PlayerBag{
|
||||
Model: cool.NewModel(),
|
||||
}
|
||||
}
|
||||
|
||||
// init 创建表
|
||||
func init() {
|
||||
cool.CreateTable(&PlayerBagItem{})
|
||||
cool.CreateTable(&PlayerBag{})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user