From 790bc21034a69a1b64578c08d6f62aa9748c654c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=98=94=E5=BF=B5?= <12574910+72wo@users.noreply.github.com> Date: Sun, 22 Feb 2026 10:03:46 +0800 Subject: [PATCH] =?UTF-8?q?```=20feat(config):=20=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E4=BA=8B=E4=BB=B6=E9=85=8D=E7=BD=AE=E5=92=8C=E5=9C=B0=E5=9B=BE?= =?UTF-8?q?=E7=BB=91=E5=AE=9A=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在BossConfig中添加MapID字段用于绑定地图ID和Event结构体 - 新增Event结构体包含精灵数组、触发时间、天气等事件相关字段 - 在MapPit中添加MapID字段用于绑定地图ID和Event结构体 - 为MapPit添加IsCapture字段标识是否可捕捉 - 更新NewBossConfig和NewMapPit构造函数初始化Event实例 - 注释掉MapNode中的NodeActiveScript字段 ``` --- modules/config/model/boss_pet.go | 4 ++++ modules/config/model/map_moster_node.go | 21 +++++++++++++++++---- modules/config/model/mapnode.go | 3 ++- 3 files changed, 23 insertions(+), 5 deletions(-) diff --git a/modules/config/model/boss_pet.go b/modules/config/model/boss_pet.go index 1b2404b7..5a70540e 100644 --- a/modules/config/model/boss_pet.go +++ b/modules/config/model/boss_pet.go @@ -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{}, } } diff --git a/modules/config/model/map_moster_node.go b/modules/config/model/map_moster_node.go index e8346257..666cfcb3 100644 --- a/modules/config/model/map_moster_node.go +++ b/modules/config/model/map_moster_node.go @@ -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{}, } } diff --git a/modules/config/model/mapnode.go b/modules/config/model/mapnode.go index 503d643f..4b51befd 100644 --- a/modules/config/model/mapnode.go +++ b/modules/config/model/mapnode.go @@ -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:"节点类型"`