feat(fight): 支持勇者之塔和试炼之塔战斗功能 - 实现勇者之塔(CMD 2414)和试炼之塔(CMD 2428)的战斗逻辑 - 添加Tower500Service和Tower600Service的Boss查询功能 - 统一处理两个塔的BossId
58 lines
2.1 KiB
Go
58 lines
2.1 KiB
Go
package model
|
||
|
||
import (
|
||
"blazing/cool"
|
||
)
|
||
|
||
// 表名常量定义:试炼之塔配置表
|
||
const (
|
||
TableNameTrialTowerConfig = "trial_tower_config" // 试炼之塔配置表(核心记录层数、BOSS数组、奖励物品/精灵)
|
||
)
|
||
|
||
type BaseTowerConfig struct {
|
||
*cool.Model `json:"-" gorm:"embedded"` // 嵌入通用Model(ID/创建时间/更新时间,不参与json序列化)
|
||
|
||
// 核心必填字段(与勇者之塔完全一致,仅表名和标识不同)
|
||
TowerLevel uint32 `gorm:"not null;default:0;uniqueIndex;comment:'试炼之塔层数(唯一标识每层配置)'" json:"tower_level" description:"试炼之塔层数"`
|
||
BossIds []uint32 `gorm:"not null;type:json;default:'[]';comment:'绑定BOSS ID数组,关联config_pet_boss表主键'" json:"boss_ids" description:"绑定BOSS数组"`
|
||
|
||
//绑定任务数组BaseTowerConfig
|
||
TaskIds []uint32 `gorm:"not null;type:json;default:'[]';comment:'绑定任务ID数组,关联config_task表主键'" json:"task_ids" description:"绑定任务数组"`
|
||
|
||
// 通用辅助字段(与勇者之塔完全一致,无额外添加)
|
||
IsEnabled uint32 `gorm:"not null;default:1;comment:'是否启用该层配置(0-禁用 1-启用)'" json:"is_enabled" description:"是否启用"`
|
||
Remark string `gorm:"size:512;default:'';comment:'试炼之塔层备注'" json:"remark" description:"备注信息"`
|
||
// ItemGift []ItemGift `orm:"with:item_id=id"`
|
||
}
|
||
|
||
func NewBaseTowerConfig() BaseTowerConfig {
|
||
return BaseTowerConfig{
|
||
Model: cool.NewModel(),
|
||
}
|
||
}
|
||
|
||
// Tower500Config 试炼之塔核心配置模型(与勇者之塔结构完全一致,无额外专属字段)
|
||
type Tower500Config struct {
|
||
BaseTowerConfig
|
||
}
|
||
|
||
// -------------------------- 核心配套方法(与勇者之塔完全一致)--------------------------
|
||
func (*Tower500Config) TableName() string {
|
||
return TableNameTrialTowerConfig
|
||
}
|
||
|
||
func (*Tower500Config) GroupName() string {
|
||
return "default"
|
||
}
|
||
|
||
func New500TowerConfig() *Tower500Config {
|
||
return &Tower500Config{
|
||
BaseTowerConfig: NewBaseTowerConfig(),
|
||
}
|
||
}
|
||
|
||
// -------------------------- 表结构自动同步 --------------------------
|
||
func init() {
|
||
cool.CreateTable(&Tower500Config{})
|
||
}
|