feat(fight): 添加试炼之塔和勇者之塔战斗功能 - 实现FreshChoiceFightLevel方法,支持试炼之塔(2428)和勇者之塔(2414)的关卡选择 - 添加PetTawor方法,支持宠物对战功能,处理CMD 2429和2415命令 - 集成Boss配置服务,动态获取Boss信息并设置战斗属性 - 重构Boss性别检查字段访问路径,修正战斗逻辑错误 - 移除未使用的xmlres依赖
40 lines
608 B
Go
40 lines
608 B
Go
package service
|
|
|
|
import (
|
|
"blazing/cool"
|
|
"blazing/modules/config/model"
|
|
|
|
"github.com/gogf/gf/v2/database/gdb"
|
|
)
|
|
|
|
type BossService struct {
|
|
*cool.Service
|
|
}
|
|
|
|
func NewBossService() *BossService {
|
|
return &BossService{
|
|
&cool.Service{
|
|
Model: model.NewBossConfig(),
|
|
PageQueryOp: &cool.QueryOp{
|
|
KeyWordField: []string{"desc"},
|
|
},
|
|
},
|
|
}
|
|
}
|
|
|
|
func (s *BossService) Get(id uint32) *model.BossConfig {
|
|
if id == 0 {
|
|
return nil
|
|
}
|
|
var item *model.BossConfig
|
|
cool.DBM(s.Model).Where("id", id).
|
|
Cache(gdb.CacheOption{
|
|
// Duration: time.Hour,
|
|
|
|
Force: false,
|
|
}).Scan(&item)
|
|
|
|
return item
|
|
|
|
}
|