49 lines
1.6 KiB
Go
49 lines
1.6 KiB
Go
|
|
package model
|
|||
|
|
|
|||
|
|
import (
|
|||
|
|
"blazing/cool"
|
|||
|
|
)
|
|||
|
|
|
|||
|
|
const (
|
|||
|
|
TableNameMapBoss = "config_map_boss" // 地图BOSS配置表(记录BOSS归属、属性、刷新规则、奖励等)
|
|||
|
|
)
|
|||
|
|
|
|||
|
|
// MapBoss 地图BOSS核心配置模型(完全仿照MapPit实现风格)
|
|||
|
|
type MapBoss struct {
|
|||
|
|
*BaseConfig // 复用通用基础配置(ID/创建时间/更新时间/删除时间/备注等)
|
|||
|
|
*Event // 嵌入BOSS事件配置
|
|||
|
|
MapID int32 `gorm:"not null;index;comment:'所属地图ID'" json:"map_id" description:"地图ID"`
|
|||
|
|
// BOSS唯一标识ID
|
|||
|
|
BossID int `gorm:"not null;index;comment:'BOSSID'" json:"boss_id"`
|
|||
|
|
BossName string `gorm:"type:varchar(100);default:'';comment:'BOSS名称'" json:"boss_name" description:"BOSS名称"`
|
|||
|
|
BossMonID []int `gorm:"type:int[];comment:'BOSS怪ID列表'" json:"boss_mon_id"`
|
|||
|
|
|
|||
|
|
WinBonusID []int `gorm:"type:int[];comment:'胜利奖励ID'" json:"win_bonus_id"`
|
|||
|
|
FailBonusID []int `gorm:"type:int[];comment:'失败奖励ID'" json:"fail_bonus_id"`
|
|||
|
|
//是否可捕捉MapPit
|
|||
|
|
IsCapture int `gorm:"type:int;default:0;comment:'是否可捕捉'" json:"is_capture"`
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// TableName 指定MapBoss对应的数据库表名(遵循原模型规范)
|
|||
|
|
func (*MapBoss) TableName() string {
|
|||
|
|
return TableNameMapBoss
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// GroupName 指定表所属的分组(保持和MapPit一致)
|
|||
|
|
func (*MapBoss) GroupName() string {
|
|||
|
|
return "default"
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// NewMapBoss 创建一个新的MapBoss实例(初始化通用BaseConfig和BossEvent)
|
|||
|
|
func NewMapBoss() *MapBoss {
|
|||
|
|
return &MapBoss{
|
|||
|
|
BaseConfig: NewBaseConfig(),
|
|||
|
|
Event: &Event{},
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// init 初始化表结构(程序启动时自动创建/同步表)
|
|||
|
|
func init() {
|
|||
|
|
cool.CreateTable(&MapBoss{})
|
|||
|
|
}
|