Files
bl/modules/config/model/map_model.go
昔念 1b6586aedc
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful
```
feat(space): 添加地图模型配置支持并优化BOSS信息结构

添加MapModel字段到MapBossInfo结构体中,用于存储更完整的BOSS模型数据,
修改初始化逻辑从新的MapModel服务获取数据,并更新HP恢复逻辑使用新模型数据。

同时优化MapNode配置表结构,移除冗余字段并调整数据查询逻辑,
将IsBroadcast字段类型改为uint32以
2026-04-01 06:27:03 +08:00

66 lines
2.2 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"
)
// 表名统一改为 map_model
const (
TableNameMapModel = "map_model"
)
// 模型类型常量 (1:NPC, 2:精灵)
const (
MapModelTypeNPC = 1
MapModelTypePet = 2
)
// MapModelBroadcastNode 地图模型广播节点配置
type MapModelBroadcastNode struct {
TriggerID uint32 `gorm:"comment:'触发器ID'" json:"trigger_id" description:"触发器ID"`
Pos string `gorm:"type:varchar(255);default:'';comment:'位置'" json:"pos" description:"位置"`
HP int32 `gorm:"type:int;default:0;comment:'血量'" json:"hp" description:"血量"`
Direction int32 `gorm:"type:int;default:0;comment:'方向'" json:"direction" description:"方向"`
}
// MapModel 地图模型配置表(NPC/宠物)
type MapModel struct {
*cool.Model // 保留通用ModelID/创建时间/更新时间等)
*MapModelBroadcastNode
MapID int32 `gorm:"not null;index;comment:'所属地图ID'" json:"map_id" description:"地图ID"`
NodeID uint32 `gorm:"not null;default:0;comment:'节点ID'" json:"node_id" description:"节点ID"`
ModelID uint32 `gorm:"not null;default:0;comment:'模型ID(NPCID或精灵ID)'" json:"model_id" description:"模型ID"`
ModelType int32 `gorm:"type:int;default:1;comment:'模型类型(1:NPC,2:精灵)'" json:"model_type" description:"模型类型"`
ModelName string `gorm:"type:varchar(100);default:'';comment:'模型名称'" json:"model_name" description:"模型名称"`
HeadTalk string `gorm:"type:varchar(255);default:'';comment:'头顶对话框内容'" json:"head_talk" description:"头顶对话框内容"`
TriggerPlotID uint32 `gorm:"default:0;comment:'触发剧情ID0表示无剧情'" json:"trigger_plot_id" description:"触发剧情ID"`
Cloths []uint32 `gorm:"type:varchar(255);default:'';comment:'服装'" json:"cloths" description:"服装"`
Shinyid int32 `gorm:"type:int;default:0;comment:'是否发光'" json:"shiny" description:"是否发光"`
}
func (*MapModel) TableName() string {
return TableNameMapModel
}
func (*MapModel) GroupName() string {
return "default"
}
func NewMapModel() *MapModel {
return &MapModel{
Model: cool.NewModel(),
MapModelBroadcastNode: &MapModelBroadcastNode{},
}
}
func init() {
cool.CreateTable(&MapModel{})
}