Files
bl/modules/config/model/map_node.go
昔念 dc4835f14c
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful
```
feat(common/utils): 添加时间范围检查工具函数

添加了 IsCurrentTimeInRange 函数用于判断当前时间是否在指定的 HH:MM
时间区间内,支持当前日期的时间比较功能。

refactor(logic/controller): 重构 Boss 挑战逻辑并集成配置服务

- 集成 service 模块替代原有硬编码逻辑
- 重构 PlayerFightBoss 方法,使用新的配置数据结构
- 移除已废弃的 processMonID 函数和相关注释代码

refactor(logic/space): 优化地图 Boss 信息管理和天气系统

- 更新地图 Boss 数据
2026-02-25 19:05:50 +08:00

78 lines
2.8 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
*Event // 嵌入BOSS事件配置
// 基础关联字段
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"`
NodeName string `gorm:"type:varchar(100);default:'';comment:'节点名称'" json:"node_name" description:"节点名称"`
//节点激活脚本
Pos string `gorm:"type:varchar(255);default:'';comment:'位置'" json:"pos"`
HP int32 `gorm:"type:int;default:0;comment:'血量'" json:"hp" description:"血量"`
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"`
//是否需要广播,比如雷伊
IsBroadcast int `gorm:"type:int;default:0;comment:'是否需要广播'" json:"is_broadcast"`
// 剧情相关配置
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
//回调通boss打完给前端发送固定事件
//PlotFinishScript string `gorm:"type:text;comment:'剧情完成后脚本回调'" json:"plot_finish_script" description:"剧情完成后脚本回调"`
BossIds []uint32 `gorm:"type:jsonb; ;comment:'塔层BOSS ID列表'" json:"boss_ids"`
}
// -------------------------- 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{})
}