109 lines
7.8 KiB
Go
109 lines
7.8 KiB
Go
|
|
package model
|
|||
|
|
|
|||
|
|
import (
|
|||
|
|
"blazing/cool"
|
|||
|
|
)
|
|||
|
|
|
|||
|
|
const (
|
|||
|
|
TableNameBossConfig = "boss_config" // BOSS配置表(全量包含基础/奖励/护盾/捕捉/特效/世界野怪/地图费用/战斗通用逻辑)
|
|||
|
|
)
|
|||
|
|
|
|||
|
|
// BossConfig BOSS配置模型(覆盖所有补充的配置项:GBTL/非VIP费用/首场景/战斗通用逻辑)
|
|||
|
|
type BossConfig struct {
|
|||
|
|
*cool.Model // 嵌入通用Model(包含ID/创建时间/更新时间等通用字段)
|
|||
|
|
|
|||
|
|
// ===================== 基础配置 =====================
|
|||
|
|
BossID int32 `gorm:"not null;comment:'BOSS唯一标识ID'" json:"boss_id"`
|
|||
|
|
MapID int32 `gorm:"not null;comment:'BOSS所在地图ID'" json:"map_id"`
|
|||
|
|
InitX int32 `gorm:"not null;default:0;comment:'BOSS初始X坐标(对应玩家登陆坐标逻辑)'" json:"init_x"`
|
|||
|
|
InitY int32 `gorm:"not null;default:0;comment:'BOSS初始Y坐标(对应玩家登陆坐标逻辑)'" json:"init_y"`
|
|||
|
|
BossVisible int32 `gorm:"not null;default:0;comment:'BOSS是否可见(0:不可见,1:可见)'" json:"boss_visible"`
|
|||
|
|
AppearTime string `gorm:"not null;comment:'BOSS出现时间(格式示例:0 23,空格分隔的时间点)'" json:"appear_time"`
|
|||
|
|
Name string `gorm:"not null;comment:'BOSS名称'" json:"name"`
|
|||
|
|
NonVipCost int32 `gorm:"not null;default:0;comment:'非VIP用户进地图需支付的赛尔豆(VIP用户免费,默认0)'" json:"non_vip_cost"`
|
|||
|
|
PrimaryScene int32 `gorm:"not null;default:0;comment:'首场景标识(0:非首场景地图;n>0:第n星系的星球且是首场景,默认0)'" json:"primary_scene"`
|
|||
|
|
|
|||
|
|
// ===================== 战斗核心属性(BossMon节点) =====================
|
|||
|
|
MonID int32 `gorm:"not null;comment:'BOSS对应的精灵ID'" json:"mon_id"`
|
|||
|
|
Hp int32 `gorm:"not null;comment:'BOSS血量值(LvHpMatchUser非0时此配置无效)'" json:"hp"`
|
|||
|
|
Lv int32 `gorm:"not null;comment:'BOSS等级(LvHpMatchUser非0时此配置无效)'" json:"lv"`
|
|||
|
|
Atk int32 `gorm:"not null;comment:'BOSS物理攻击'" json:"atk"`
|
|||
|
|
Def int32 `gorm:"not null;comment:'BOSS物理防御'" json:"def"`
|
|||
|
|
Spatk int32 `gorm:"not null;comment:'BOSS特殊攻击'" json:"spatk"`
|
|||
|
|
Spdef int32 `gorm:"not null;comment:'BOSS特殊防御'" json:"spdef"`
|
|||
|
|
Spd int32 `gorm:"not null;comment:'BOSS速度'" json:"spd"`
|
|||
|
|
|
|||
|
|
// ===================== BOSS奖励规则(Boss_bonus) =====================
|
|||
|
|
BonusProbability int32 `gorm:"not null;default:0;comment:'打赢BOSS给奖励概率-分子(值域:0-1000,默认0)'" json:"bonus_probability"`
|
|||
|
|
BonusTotalProbability int32 `gorm:"not null;default:1000;comment:'打赢BOSS给奖励概率-分母(值域:1000,默认1000)'" json:"bonus_total_probability"`
|
|||
|
|
BonusMonsterProbability int32 `gorm:"not null;default:0;comment:'给精灵奖励比例(值域:0-1000,默认0;物品奖励比例=分母-此值)'" json:"bonus_monster_probability"`
|
|||
|
|
BonusID int32 `gorm:"not null;comment:'奖励ID(必配,有效BonusID)'" json:"bonus_id"`
|
|||
|
|
MonBonusOutID int32 `gorm:"not null;comment:'精灵奖励ID(必配,有效精灵BonusID,奖精灵时生效)'" json:"mon_bonus_out_id"`
|
|||
|
|
ItemBonusOutID int32 `gorm:"not null;comment:'物品奖励ID(必配,有效物品BonusID,奖物品时生效)'" json:"item_bonus_out_id"`
|
|||
|
|
|
|||
|
|
NewSeIdxs string `gorm:"type:text;not null;default:'0';comment:'新特效idx(值域:1-2000,0无特效,对应conf/new_se.xml,空格分隔列表)'" json:"new_se_idxs"`
|
|||
|
|
|
|||
|
|
// ===================== BOSS护盾属性 =====================
|
|||
|
|
Shield int32 `gorm:"not null;default:0;comment:'BOSS护盾Hp(如蘑菇怪,默认0)'" json:"shield"`
|
|||
|
|
MaxAccLostShield int32 `gorm:"not null;default:0;comment:'护盾变化通知AS的阈值(默认0)'" json:"max_acc_lost_shield"`
|
|||
|
|
ShieldRecoverTime int32 `gorm:"not null;default:0;comment:'护盾恢复时间间隔(默认0)'" json:"shield_recover_time"`
|
|||
|
|
|
|||
|
|
// ===================== BOSS对战/捕捉规则 =====================
|
|||
|
|
BossCatchable int32 `gorm:"not null;default:0;comment:'BOSS是否可被捕捉(0:否,1:是,默认0)'" json:"boss_catchable"`
|
|||
|
|
BossFinOnce int32 `gorm:"not null;default:0;comment:'拥有后是否不能再打(0:否,1:是,默认0)'" json:"boss_fin_once"`
|
|||
|
|
BossFinTaskWay int32 `gorm:"not null;default:0;comment:'完成任务方式(0:正常+捕捉;1:仅正常;2:仅捕捉,默认0)'" json:"boss_fin_task_way"`
|
|||
|
|
PkFlag int32 `gorm:"not null;default:0;comment:'是否单精灵对战(0:否,1:是,默认0)'" json:"pk_flag"`
|
|||
|
|
LvHpMatchUser int32 `gorm:"not null;default:0;comment:'等级血量匹配用户(0:无效;2:低5级;3:高2级;4:高5级;5:低10级;6:低5级且HP4倍;7:同等级且HP2.5倍)'" json:"lv_hp_match_user"`
|
|||
|
|
//VipOnly int32 `gorm:"not null;default:0;comment:'仅VIP可打(0:否,1:是,默认0)'" json:"vip_only"`
|
|||
|
|
|
|||
|
|
// ===================== 世界野怪变身配置 =====================
|
|||
|
|
WorldWildProb int32 `gorm:"not null;default:0;comment:'变身世界野怪概率分子(值域:0-1000,默认0)'" json:"world_wild_prob"`
|
|||
|
|
WorldWildMonId int32 `gorm:"not null;default:0;comment:'变身世界野怪的精灵ID(默认0)'" json:"world_wild_mon_id"`
|
|||
|
|
WorldWildMonLv int32 `gorm:"not null;default:0;comment:'变身世界野怪的等级(默认0)'" json:"world_wild_mon_lv"`
|
|||
|
|
WorldWildStart int32 `gorm:"not null;default:0;comment:'世界野怪出现起始时间(值域:0-23,默认0)'" json:"world_wild_start"`
|
|||
|
|
WorldWildEnd int32 `gorm:"not null;default:23;comment:'世界野怪出现终止时间(值域:0-23,默认23)'" json:"world_wild_end"`
|
|||
|
|
|
|||
|
|
// ===================== 战斗开始/结束通用逻辑配置 =====================
|
|||
|
|
// 支持battle_mode_vs_boss battle_mode_no_region_boss,战斗协议2411、41129
|
|||
|
|
TimeFlag int32 `gorm:"not null;default:0;comment:'战斗时间判断标识(关联activity_config_pool.xml,默认0)'" json:"time_flag"`
|
|||
|
|
DailyKey string `gorm:"not null;default:'';comment:'战斗每天挑战次数key(为空则不限制次数)'" json:"daily_key"`
|
|||
|
|
MaxTimes int32 `gorm:"not null;default:0;comment:'每天挑战上限(非0生效,默认0)'" json:"max_times"`
|
|||
|
|
VipMaxTimes int32 `gorm:"not null;default:0;comment:'VIP每天挑战上限(非0生效,0时等于MaxTimes,默认0)'" json:"vip_max_times"`
|
|||
|
|
WinBonusId int32 `gorm:"not null;default:0;comment:'战斗成功输出奖励ID(对应no_wait_bonus.xml,默认0)'" json:"win_bonus_id"`
|
|||
|
|
WinOutId int32 `gorm:"not null;default:0;comment:'战斗成功输出奖励OutID(对应no_wait_bonus.xml,默认0)'" json:"win_out_id"`
|
|||
|
|
FailBonusId int32 `gorm:"not null;default:0;comment:'战斗失败输出奖励ID(对应no_wait_bonus.xml,默认0)'" json:"fail_bonus_id"`
|
|||
|
|
FailOutId int32 `gorm:"not null;default:0;comment:'战斗失败输出奖励OutID(对应no_wait_bonus.xml,默认0)'" json:"fail_out_id"`
|
|||
|
|
BitSet string `gorm:"type:text;not null;default:'';comment:'战斗成功bitset限制条件(默认空)'" json:"bit_set"`
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// BossConfigEX 扩展BOSS配置模型(用于前端/业务层的数组格式解析)
|
|||
|
|
type BossConfigEX struct {
|
|||
|
|
BossConfig
|
|||
|
|
NewSeIdxs []uint32 `json:"new_se_idxs"` // 特效idx数组(解析空格分隔的字符串为数组)
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// TableName 指定BossConfig对应的数据库表名
|
|||
|
|
func (*BossConfig) TableName() string {
|
|||
|
|
return TableNameBossConfig
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// GroupName 指定表所属的分组(保持和怪物刷新表一致)
|
|||
|
|
func (*BossConfig) GroupName() string {
|
|||
|
|
return "default"
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// NewBossConfig 创建一个新的BossConfig实例(初始化通用Model字段+所有默认值)
|
|||
|
|
func NewBossConfig() *BossConfig {
|
|||
|
|
return &BossConfig{
|
|||
|
|
Model: cool.NewModel(),
|
|||
|
|
BonusTotalProbability: 1000, // 奖励概率分母默认1000
|
|||
|
|
WorldWildEnd: 23, // 世界野怪结束时间默认23
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// init 程序启动时自动创建/同步boss_config表结构
|
|||
|
|
func init() {
|
|||
|
|
cool.CreateTable(&BossConfig{})
|
|||
|
|
}
|