2026-02-22 07:51:37 +08:00
|
|
|
|
package model
|
|
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
|
"blazing/cool"
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
// 这个是替换盖亚的实现,因为是单独类的
|
|
|
|
|
|
const (
|
|
|
|
|
|
|
|
|
|
|
|
// 新增地图节点表常量
|
|
|
|
|
|
TableNameMapNode = "config_map_node" // 地图节点配置表(记录地图各节点的类型、绑定BOSS、剧情等信息)
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
// 节点类型常量定义
|
|
|
|
|
|
const (
|
|
|
|
|
|
MapNodeTypeBoss = 1 // BOSS节点
|
|
|
|
|
|
MapNodeTypeNPC = 2 // NPC节点
|
|
|
|
|
|
MapNodeTypeScene = 3 // 场景触发节点
|
|
|
|
|
|
MapNodeTypePortal = 4 // 传送门节点
|
|
|
|
|
|
)
|
|
|
|
|
|
|
2026-02-27 23:13:50 +08:00
|
|
|
|
type BroadcastNode struct {
|
|
|
|
|
|
//节点激活脚本
|
|
|
|
|
|
TriggerID uint32 `gorm:"comment:'触发器ID'" json:"trigger_id" description:"触发器ID"`
|
|
|
|
|
|
//BOSS位置,多位置就是循环触发,固定点就是单位置,如果要实现原地动,就用2个固定位置来做
|
|
|
|
|
|
//0:固定点,1:多位置,2:循环触发 赛有随机的boss和伪装的boss,如果是伪装boss,就触发剧情后实现boss的切换后再操作
|
|
|
|
|
|
Pos string `gorm:"type:varchar(255);default:'';comment:'位置'" json:"pos"`
|
|
|
|
|
|
HP int32 `gorm:"type:int;default:0;comment:'血量'" json:"hp" description:"血量"`
|
|
|
|
|
|
//方向BroadcastNode
|
|
|
|
|
|
Direction int32 `gorm:"type:int;default:0;comment:'方向'" json:"direction" description:"方向"`
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-22 07:51:37 +08:00
|
|
|
|
// MapNode 地图节点配置模型
|
|
|
|
|
|
type MapNode struct {
|
|
|
|
|
|
*BaseConfig
|
2026-02-25 13:20:38 +08:00
|
|
|
|
*Event // 嵌入BOSS事件配置
|
2026-02-27 23:13:50 +08:00
|
|
|
|
*BroadcastNode
|
2026-02-22 07:51:37 +08:00
|
|
|
|
// 基础关联字段
|
2026-02-25 16:18:10 +08:00
|
|
|
|
MapID int32 `gorm:"not null;index;comment:'所属地图ID'" json:"map_id" description:"地图ID"`
|
2026-02-25 22:47:16 +08:00
|
|
|
|
//可以是精灵也可以是NPC ,到时候npc用高ID去控制就行
|
2026-02-25 13:20:38 +08:00
|
|
|
|
|
2026-02-27 23:13:50 +08:00
|
|
|
|
NodeID uint32 `gorm:"not null;default:0;comment:'节点ID'" json:"node_id" description:"节点ID"`
|
2026-02-22 07:51:37 +08:00
|
|
|
|
|
2026-02-27 23:13:50 +08:00
|
|
|
|
NodeName string `gorm:"type:varchar(100);default:'';comment:'节点名称'" json:"node_name" description:"节点名称"`
|
2026-02-22 07:51:37 +08:00
|
|
|
|
|
2026-02-25 13:20:38 +08:00
|
|
|
|
WinBonusID int `gorm:"type:int;default:0;comment:'胜利奖励ID'" json:"win_bonus_id"`
|
|
|
|
|
|
FailBonusID int `gorm:"type:int;default:0;comment:'失败奖励ID'" json:"fail_bonus_id"`
|
2026-02-25 19:05:50 +08:00
|
|
|
|
//是否需要广播,比如雷伊
|
|
|
|
|
|
IsBroadcast int `gorm:"type:int;default:0;comment:'是否需要广播'" json:"is_broadcast"`
|
2026-02-25 22:47:16 +08:00
|
|
|
|
// 剧情相关配置 通过剧情去主动触发boss显示和对话显示 ,待重构通过NPC节点判断哪种类型
|
2026-02-25 13:20:38 +08:00
|
|
|
|
TriggerPlotID uint32 `gorm:"default:0;comment:'触发剧情ID(0表示无剧情)'" json:"trigger_plot_id" description:"触发剧情ID"`
|
|
|
|
|
|
//BindPlotIDs []uint32 `gorm:"type:int[];comment:'绑定的剧情ID列表'" json:"bind_plot_ids" description:"绑定剧情ID列表"`
|
2026-02-22 07:51:37 +08:00
|
|
|
|
//完成后的脚本回调,比如战胜和击败绑定不同的任务ID,以及剧情绑定不同的ID
|
2026-02-25 13:20:38 +08:00
|
|
|
|
//回调通boss打完给前端发送固定事件
|
|
|
|
|
|
//PlotFinishScript string `gorm:"type:text;comment:'剧情完成后脚本回调'" json:"plot_finish_script" description:"剧情完成后脚本回调"`
|
2026-02-22 07:51:37 +08:00
|
|
|
|
|
2026-02-25 16:18:10 +08:00
|
|
|
|
BossIds []uint32 `gorm:"type:jsonb; ;comment:'塔层BOSS ID列表'" json:"boss_ids"`
|
2026-02-22 07:51:37 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// -------------------------- MapNode 配套方法(遵循项目规范)--------------------------
|
|
|
|
|
|
// TableName 指定数据库表名
|
|
|
|
|
|
func (*MapNode) TableName() string {
|
|
|
|
|
|
return TableNameMapNode
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// GroupName 指定分组名称(与原有规范保持一致)
|
|
|
|
|
|
func (*MapNode) GroupName() string {
|
|
|
|
|
|
return "default"
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// NewMapNode 创建MapNode实例
|
|
|
|
|
|
func NewMapNode() *MapNode {
|
|
|
|
|
|
return &MapNode{
|
|
|
|
|
|
BaseConfig: NewBaseConfig(),
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// GetNodeTypeName 获取节点类型的中文名称(方便展示)
|
|
|
|
|
|
|
|
|
|
|
|
// -------------------------- 表结构自动同步 --------------------------
|
|
|
|
|
|
func init() {
|
|
|
|
|
|
// 同步原有地图配置表
|
|
|
|
|
|
cool.CreateTable(&MapConfig{})
|
|
|
|
|
|
// 同步新增的地图节点配置表
|
|
|
|
|
|
cool.CreateTable(&MapNode{})
|
|
|
|
|
|
}
|