Files
bl/modules/config/model/pet_base.go
昔念 026689f3ed ```
feat(cache): 添加复合键缓存操作支持

添加了基于 uint32+string 组合键的缓存操作方法,包括
GetByCompoundKey、SetByCompoundKey、DelByCompoundKey 和
ContainsByCompoundKey 方法,用于处理用户ID和会话ID的组合缓存场景

fix(vscode): 添加 cSpell 配置支持 struc 词汇

refactor(session): 移除过时的会话管理方法

移除了基于单一字符串键的会话管理方法,因为已迁移到使用
复合键的缓存操作方式
```
2026-01-19 18:51:56 +08:00

110 lines
8.1 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 (
TableNameMeleeConfig = "config_boss_melee" // BOSS配置表全量包含基础/奖励/护盾/捕捉/特效/世界野怪/地图费用/战斗通用逻辑)
)
// PetBaseConfig BOSS配置模型覆盖所有补充的配置项GBTL/非VIP费用/首场景/战斗通用逻辑)
type PetBaseConfig 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"`
Nature int32 `gorm:"not null;default:0;comment:'BOSS属性-性格'" json:"nature"`
Effect []uint32 `gorm:"type:jsonb;not null;default:'[]';comment:'BOSS特性'" json:"effect"`
Lv int32 `gorm:"not null;comment:'BOSS等级LvHpMatchUser非0时此配置无效'" json:"lv"`
Color string `gorm:"comment:'BOSS颜色'" json:"color"`
Hp int32 `gorm:"not null;comment:'BOSS血量值LvHpMatchUser非0时此配置无效'" json:"hp"`
// ===================== BOSS属性Boss_prop =====================
Prop []uint32 `gorm:"type:jsonb;not null;default:'[]';comment:'BOSS属性'" json:"prop"`
SKill []uint32 `gorm:"type:jsonb;not null;default:'[]';comment:'BOSS技能'" json:"skill"`
IsEnable uint32 `gorm:"not null;default:0;comment:'是否启用'" json:"is_enable"`
Desc *string `gorm:"comment:'BOSS描述'" json:"desc"`
// ISMELEE uint32 `gorm:"not null;default:0;comment:'是否乱斗配置'" json:"is_melee"`
// // ===================== 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-20000无特效对应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"`
}
// MeleeConfigEX 扩展BOSS配置模型用于前端/业务层的数组格式解析)
// TableName 指定MeleeConfig对应的数据库表名
func (*PetBaseConfig) TableName() string {
return TableNameMeleeConfig
}
// GroupName 指定表所属的分组(保持和怪物刷新表一致)
func (*PetBaseConfig) GroupName() string {
return "default"
}
// NewMeleeConfig 创建一个新的MeleeConfig实例初始化通用Model字段+所有默认值)
func NewMeettConfig() *PetBaseConfig {
return &PetBaseConfig{
Model: cool.NewModel(),
}
}
// init 程序启动时自动创建/同步boss_config表结构
func init() {
cool.CreateTable(&PetBaseConfig{})
}