All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful
feat(config): 添加事件配置和地图绑定功能 - 在BossConfig中添加MapID字段用于绑定地图ID和Event结构体 - 新增Event结构体包含精灵数组、触发时间、天气等事件相关字段 - 在MapPit中添加MapID字段用于绑定地图ID和Event结构体 - 为MapPit添加IsCapture字段标识是否可捕捉 - 更新NewBossConfig和NewMapPit构造函数初始化Event实例 - 注释掉MapNode中的NodeActiveScript字段 ```
60 lines
1.9 KiB
Go
60 lines
1.9 KiB
Go
package model
|
||
|
||
import (
|
||
"blazing/cool"
|
||
)
|
||
|
||
const (
|
||
TableNameMapPit = "config_map_pit" // 地图坑位配置表(记录坑位归属、类型、属性、关联刷新规则等)
|
||
)
|
||
|
||
type Event struct {
|
||
//携带精灵数组Event
|
||
Sprites []int32 `gorm:"type:int[];comment:'携带精灵数组'" json:"sprites"`
|
||
//触发开始时间Event
|
||
StartTime int32 `gorm:"type:int;default:0;comment:'触发开始时间'" json:"start_time"`
|
||
//触发结束时间Event
|
||
EndTime int32 `gorm:"type:int;default:0;comment:'触发结束时间'" json:"end_time"`
|
||
//触发天气Event
|
||
Weather []int32 `gorm:"type:int[];comment:'触发天气'" json:"weather"`
|
||
}
|
||
|
||
// MapPit 地图坑位核心配置模型(参照MonsterRefresh实现风格)
|
||
type MapPit struct {
|
||
*BaseConfig // 复用通用基础配置(ID/创建时间/更新时间等)
|
||
MapID []int32 `gorm:"type:int[];comment:'绑定地图地图ID'" json:"map_id"`
|
||
*Event
|
||
PitName string `gorm:"type:varchar(100);default:'';comment:'坑位名称'" json:"pit_name"`
|
||
|
||
RefreshID []int `gorm:"type:int[];comment:'关联刷新规则ID列表'" json:"refresh_id"`
|
||
//最小等级
|
||
MinLevel int `gorm:"type:int;default:0;comment:'最小等级'" json:"min_level"`
|
||
//最大等级
|
||
MaxLevel int `gorm:"type:int;default:0;comment:'最大等级'" json:"max_level"`
|
||
//是否可捕捉MapPit
|
||
IsCapture int `gorm:"type:int;default:0;comment:'是否可捕捉'" json:"is_capture"`
|
||
}
|
||
|
||
// TableName 指定MapPit对应的数据库表名(遵循原模型规范)
|
||
func (*MapPit) TableName() string {
|
||
return TableNameMapPit
|
||
}
|
||
|
||
// GroupName 指定表所属的分组(保持和原模型一致)
|
||
func (*MapPit) GroupName() string {
|
||
return "default"
|
||
}
|
||
|
||
// NewMapPit 创建一个新的MapPit实例(初始化通用BaseConfig)
|
||
func NewMapPit() *MapPit {
|
||
return &MapPit{
|
||
BaseConfig: NewBaseConfig(),
|
||
Event: &Event{},
|
||
}
|
||
}
|
||
|
||
// init 初始化表结构(程序启动时自动创建/同步表)
|
||
func init() {
|
||
cool.CreateTable(&MapPit{})
|
||
}
|