Files
bl/modules/config/model/map_node.go
昔念 6c26e448fd ```
refactor(common): 移除未使用的XML解析测试代码

移除test_test.go中未完成的Mapxml函数和login/main.go中的
XML解析注释代码,清理无用的导入包,优化代码结构

BREAKING CHANGE: 删除了modules/config/model/map_moster_node.go
文件中的MapPit相关模型定义
```
2026-02-24 12:53:07 +08:00

89 lines
3.1 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package model
import (
"blazing/cool"
)
// 这个是替换盖亚的实现,因为是单独类的
const (
// 新增地图节点表常量
TableNameMapNode = "config_map_node" // 地图节点配置表记录地图各节点的类型、绑定BOSS、剧情等信息
)
// 节点类型常量定义
const (
MapNodeTypeBoss = 1 // BOSS节点
MapNodeTypeNPC = 2 // NPC节点
MapNodeTypeScene = 3 // 场景触发节点
MapNodeTypePortal = 4 // 传送门节点
)
// MapNode 地图节点配置模型
type MapNode struct {
*BaseConfig
// 基础关联字段
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:"节点激活脚本"`
//
// 节点核心配置
NodeType int `gorm:"not null;default:0;comment:'节点类型1-BOSS2-NPC3-场景触发4-传送门)'" json:"node_type" description:"节点类型"`
PositionX float64 `gorm:"not null;default:0;comment:'节点X坐标'" json:"position_x" description:"X坐标"`
PositionY float64 `gorm:"not null;default:0;comment:'节点Y坐标'" json:"position_y" description:"Y坐标"`
// 剧情相关配置
TriggerPlotID uint32 `gorm:"default:0;comment:'触发剧情ID0表示无剧情'" json:"trigger_plot_id" description:"触发剧情ID"`
BindPlotIDs []uint32 `gorm:"type:int[];comment:'绑定的剧情ID列表'" json:"bind_plot_ids" description:"绑定剧情ID列表"`
//完成后的脚本回调比如战胜和击败绑定不同的任务ID以及剧情绑定不同的ID
PlotFinishScript string `gorm:"type:text;comment:'剧情完成后脚本回调'" json:"plot_finish_script" description:"剧情完成后脚本回调"`
// BOSS相关配置
BindBossID uint32 `gorm:"default:0;comment:'绑定的BOSS ID0表示无BOSS'" json:"bind_boss_id" description:"绑定BOSS ID"`
}
// -------------------------- 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 (m *MapNode) GetNodeTypeName() string {
switch m.NodeType {
case MapNodeTypeBoss:
return "BOSS节点"
case MapNodeTypeNPC:
return "NPC节点"
case MapNodeTypeScene:
return "场景触发节点"
case MapNodeTypePortal:
return "传送门节点"
default:
return "未知节点"
}
}
// -------------------------- 表结构自动同步 --------------------------
func init() {
// 同步原有地图配置表
cool.CreateTable(&MapConfig{})
// 同步新增的地图节点配置表
cool.CreateTable(&MapNode{})
}