feat(config): 添加事件配置和地图绑定功能 - 在BossConfig中添加MapID字段用于绑定地图ID和Event结构体 - 新增Event结构体包含精灵数组、触发时间、天气等事件相关字段 - 在MapPit中添加MapID字段用于绑定地图ID和Event结构体 - 为MapPit添加IsCapture字段标识是否可捕捉 - 更新NewBossConfig和NewMapPit构造函数初始化Event实例 - 注释掉MapNode中的NodeActiveScript字段 ```
This commit is contained in:
@@ -12,6 +12,9 @@ const (
|
||||
type BossConfig struct {
|
||||
*cool.Model // 嵌入通用Model(包含ID/创建时间/更新时间等通用字段)
|
||||
PetBaseConfig
|
||||
//绑定地图地图ID
|
||||
MapID []int32 `gorm:"type:int[];comment:'绑定地图地图ID'" json:"map_id"`
|
||||
*Event
|
||||
Script string `gorm:"size:1024;default:'';comment:'BOSS脚本'" json:"script"` //boss出招逻辑做成js脚本
|
||||
// ISboss uint32 `gorm:"not null;default:0;comment:'是否是Boss'" json:"is_boss"`
|
||||
|
||||
@@ -33,6 +36,7 @@ func (*BossConfig) GroupName() string {
|
||||
func NewBossConfig() *BossConfig {
|
||||
return &BossConfig{
|
||||
Model: cool.NewModel(),
|
||||
Event: &Event{},
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -8,10 +8,22 @@ 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/创建时间/更新时间等)
|
||||
|
||||
*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"`
|
||||
@@ -19,8 +31,8 @@ type MapPit struct {
|
||||
MinLevel int `gorm:"type:int;default:0;comment:'最小等级'" json:"min_level"`
|
||||
//最大等级
|
||||
MaxLevel int `gorm:"type:int;default:0;comment:'最大等级'" json:"max_level"`
|
||||
|
||||
Script string `gorm:"type:text;not null;comment:'刷新脚本(JS格式,对应前端编辑器配置)'" json:"value"`
|
||||
//是否可捕捉MapPit
|
||||
IsCapture int `gorm:"type:int;default:0;comment:'是否可捕捉'" json:"is_capture"`
|
||||
}
|
||||
|
||||
// TableName 指定MapPit对应的数据库表名(遵循原模型规范)
|
||||
@@ -37,6 +49,7 @@ func (*MapPit) GroupName() string {
|
||||
func NewMapPit() *MapPit {
|
||||
return &MapPit{
|
||||
BaseConfig: NewBaseConfig(),
|
||||
Event: &Event{},
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,8 @@ type MapNode struct {
|
||||
MapID uint32 `gorm:"not null;index;comment:'所属地图ID'" json:"map_id" description:"地图ID"`
|
||||
NodeName string `gorm:"type:varchar(100);default:'';comment:'节点名称'" json:"node_name" description:"节点名称"`
|
||||
//节点激活脚本
|
||||
NodeActiveScript string `gorm:"type:text;comment:'节点激活脚本'" json:"node_active_script" description:"节点激活脚本"`
|
||||
// NodeActiveScript string `gorm:"type:text;comment:'节点激活脚本'" json:"node_active_script" description:"节点激活脚本"`
|
||||
//
|
||||
|
||||
// 节点核心配置
|
||||
NodeType int `gorm:"not null;default:0;comment:'节点类型(1-BOSS,2-NPC,3-场景触发,4-传送门)'" json:"node_type" description:"节点类型"`
|
||||
|
||||
Reference in New Issue
Block a user