diff --git a/common/data/xmlres/public b/common/data/xmlres/public new file mode 120000 index 000000000..4009081fe --- /dev/null +++ b/common/data/xmlres/public @@ -0,0 +1 @@ +E:/newcode/sun/public \ No newline at end of file diff --git a/logic/controller/fight_tawor.go b/logic/controller/fight_tawor.go index 50e67b3b6..308ba722a 100644 --- a/logic/controller/fight_tawor.go +++ b/logic/controller/fight_tawor.go @@ -41,25 +41,28 @@ func (h Controller) FreshChoiceFightLevel(data *fight.C2S_FRESH_CHOICE_FIGHT_LEV c.Info.CurrentStage = uint32((data.Level-1)*10) + 1 } } - + var boss *configmodel.BaseTowerConfig switch data.Head.CMD { case 2428: //试炼之塔 result.CurFightLevel = uint(c.Info.CurrentFreshStage) - boss := service.NewTower600Service().Boss(c.Info.CurrentFreshStage) - //next := service.NewTower600Service().Boss(c.Info.CurrentFreshStage + 1) - if boss != nil { + boss = service.NewTower600Service().Boss(c.Info.CurrentFreshStage) - for _, v := range boss.BossIds { - r := configservice.NewBossService().Get(v) - result.BossId = append(result.BossId, uint32(r.MonID)) - - } - - } case 2414: //勇者之塔 result.CurFightLevel = uint(c.Info.CurrentStage) + boss = service.NewTower500Service().Boss(c.Info.CurrentFreshStage) + //next := service.NewTower600Service().Boss(c.Info.CurrentFreshStage + 1) + + } + if boss != nil { + + for _, v := range boss.BossIds { + r := configservice.NewBossService().Get(v) + result.BossId = append(result.BossId, uint32(r.MonID)) + + } + } // 重置玩家的Canmon标志位为0,表示可以刷怪 atomic.StoreUint32(&c.Canmon, 0) @@ -86,11 +89,12 @@ func (h Controller) PetTawor(data *fight.StartTwarInboundInfo, c *player.Player) c.Fightinfo.Status = fightinfo.BattleMode.FIGHT_WITH_NPC monsterInfo := &model.PlayerInfo{} var boss *configmodel.BaseTowerConfig + var next *configmodel.BaseTowerConfig result = &fight.S2C_ChoiceLevelRequestInfo{} switch data.Head.CMD { case 2429: //试炼之塔 boss = service.NewTower600Service().Boss(c.Info.CurrentFreshStage) - next := service.NewTower600Service().Boss(c.Info.CurrentFreshStage + 1) + next = service.NewTower600Service().Boss(c.Info.CurrentFreshStage + 1) if next != nil { for _, v := range next.BossIds { r := configservice.NewBossService().Get(v) @@ -101,10 +105,19 @@ func (h Controller) PetTawor(data *fight.StartTwarInboundInfo, c *player.Player) result.CurFightLevel = uint32(c.Info.CurrentFreshStage) case 2415: //勇者之塔 + boss = service.NewTower500Service().Boss(c.Info.CurrentStage) + next = service.NewTower500Service().Boss(c.Info.CurrentStage + 1) + result.CurFightLevel = uint32(c.Info.CurrentStage) } + if next == nil { + for _, v := range next.BossIds { + r := configservice.NewBossService().Get(v) + result.BossID = append(result.BossID, uint32(r.MonID)) + } + } for i, v := range boss.BossIds { r := configservice.NewBossService().Get(v) if r != nil { @@ -146,7 +159,7 @@ func (h Controller) PetTawor(data *fight.StartTwarInboundInfo, c *player.Player) c.Info.CurrentFreshStage++ case 2415: //勇者之塔 - + c.Info.CurrentStage++ } } diff --git a/logic/service/task/task.go b/logic/service/task/task.go index 33d885ba2..71b318dbc 100644 --- a/logic/service/task/task.go +++ b/logic/service/task/task.go @@ -23,7 +23,7 @@ func GetTaskInfo(id, ot uint32) *TaskResult { pet := service.NewPetRewardService().Get(r.ElfRewardIds) if pet != nil { - ret.Pet = model.GenPetInfo(int(pet.MonID), int(pet.Lv), int(pet.Nature), int(pet.Effect), int(pet.DV), nil) + ret.Pet = model.GenPetInfo(int(pet.MonID), int(pet.DV), int(pet.Nature), int(pet.Effect), int(pet.Lv), nil) } for _, itemID := range r.ItemRewardIds { diff --git a/modules/blazing/service/info.go b/modules/blazing/service/info.go index 0eb8f619e..cf2873785 100644 --- a/modules/blazing/service/info.go +++ b/modules/blazing/service/info.go @@ -2,9 +2,9 @@ package service import ( "blazing/common/data/share" - "blazing/common/data/xmlres" "blazing/cool" "blazing/modules/blazing/model" + "blazing/modules/config/service" "context" "time" @@ -80,19 +80,14 @@ func (s *InfoService) Personself() *model.PlayerInfo { tt.LastResetTime = gtime.Now() //每天login时候检查重置时间,然后把电池,任务,挖矿重置 //挖矿需要单独存,因为防止多开挖矿 - tt.Data.TimeToday = 0 //重置电池 - for i := 400; i < 500; i++ { //每日任务区段 + tt.Data.TimeToday = 0 //重置电池 - tttL, ok := xmlres.TaskMap[i] - if ok { - if tttL.Type == 1 { //日常任务 + for _, v := range service.NewTaskService().GetDaily() { - tt.Data.SetTask(i, model.Unaccepted) - - } - } + tt.Data.SetTask(int(v.TaskId), model.Unaccepted) } + for i := 0; i < 50; i++ { //每日任务区段 tt.Data.DailyResArr[i] = 0 //重置每日任务 diff --git a/modules/config/model/pet_gift.go b/modules/config/model/pet_gift.go index 1d4b0dba1..cef2607b9 100644 --- a/modules/config/model/pet_gift.go +++ b/modules/config/model/pet_gift.go @@ -15,7 +15,7 @@ type PetReward struct { IsEnabled uint32 `gorm:"not null;default:0;comment:'是否启用(0-禁用 1-启用)'" json:"is_enabled"` MonID int32 `gorm:"not null;comment:'BOSS对应的精灵ID'" json:"mon_id"` DV int32 `gorm:"not null;default:0;comment:'成长值'" json:"dv"` - Nature uint32 `gorm:"not null;default:0;comment:'BOSS属性-性格'" json:"nature"` + Nature int32 `gorm:"not null;default:0;comment:'BOSS属性-性格'" json:"nature"` Effect int32 `gorm:"not null;comment:'BOSS特性'" json:"effect"` Lv int32 `gorm:"not null;comment:'BOSS等级(LvHpMatchUser非0时此配置无效)'" json:"lv"` IsEgg uint32 `gorm:"not null;default:0;comment:'是否蛋'" json:"is_egg"` //奖励是否为扭蛋奖励 diff --git a/modules/config/model/task.go b/modules/config/model/task.go index 990bc6ea2..5232a6ef8 100644 --- a/modules/config/model/task.go +++ b/modules/config/model/task.go @@ -18,6 +18,8 @@ type TaskConfig struct { OutState uint32 `gorm:"not null;default:0;comment:'任务分支'" json:"out_state" description:"任务分支"` //父级任务 ParentTaskId uint32 `gorm:"not null;default:0;comment:'父级任务ID'" json:"parent_task_id" description:"父级任务ID"` + // type(任务类型,0为常规任务,1为日常任务), + TaskType uint32 `gorm:"not null;default:0;comment:'任务类型'" json:"task_type" description:"任务类型"` // 奖励配置 ItemRewardIds []uint32 `gorm:"not null;type:json;default:'[]';comment:'绑定奖励物品ID数组,关联item_gift表主键'" json:"item_reward_ids" description:"奖励物品数组"` diff --git a/modules/config/model/tower_500.go b/modules/config/model/tower_500.go index f28c15103..1d4ad1fdf 100644 --- a/modules/config/model/tower_500.go +++ b/modules/config/model/tower_500.go @@ -13,10 +13,11 @@ 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数组"` - ItemRewardIds []uint32 `gorm:"not null;type:json;default:'[]';comment:'绑定奖励物品ID数组,关联item_gift表主键'" json:"item_reward_ids" description:"绑定奖励物品数组"` - ElfRewardIds []uint32 `gorm:"not null;type:json;default:'[]';comment:'绑定奖励精灵ID数组,关联config_pet_boss表主键'" json:"elf_reward_ids" description:"绑定奖励精灵数组"` + 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:"是否启用"` diff --git a/modules/config/service/task.go b/modules/config/service/task.go index bbaedfbb9..03f0217fb 100644 --- a/modules/config/service/task.go +++ b/modules/config/service/task.go @@ -15,6 +15,7 @@ func NewTaskService() *TaskService { return &TaskService{ &cool.Service{ Model: model.NewTaskConfig(), + //UniqueKey: map[string]string{"task_id": "索引不能重复"}, }, } } @@ -30,3 +31,15 @@ func (s *TaskService) Get(id, os uint32) *model.TaskConfig { return item } +func (s *TaskService) GetDaily() []model.TaskConfig { + var item []model.TaskConfig + cool.DBM(s.Model).Where("task_type", 1). + Cache(gdb.CacheOption{ + // Duration: time.Hour, + + Force: false, + }).Scan(&item) + + return item + +} diff --git a/modules/config/service/tower500.go b/modules/config/service/tower500.go index 378839e42..89e06db46 100644 --- a/modules/config/service/tower500.go +++ b/modules/config/service/tower500.go @@ -3,6 +3,8 @@ package service import ( "blazing/cool" "blazing/modules/config/model" + + "github.com/gogf/gf/v2/database/gdb" ) type Tower500Service struct { @@ -16,3 +18,14 @@ func NewTower500Service() *Tower500Service { }, } } +func (s *Tower500Service) Boss(tower_level uint32) *model.BaseTowerConfig { + var config model.Tower600Config + cool.DBM(s.Model).Where("tower_level = ?", tower_level). + Cache(gdb.CacheOption{ + // Duration: time.Hour, + + Force: false, + }).Scan(&config) + + return &config.BaseTowerConfig +} diff --git a/modules/config/service/tower600.go b/modules/config/service/tower600.go index eb00e728d..96f77fd40 100644 --- a/modules/config/service/tower600.go +++ b/modules/config/service/tower600.go @@ -3,6 +3,8 @@ package service import ( "blazing/cool" "blazing/modules/config/model" + + "github.com/gogf/gf/v2/database/gdb" ) type Tower600Service struct { @@ -19,7 +21,12 @@ func NewTower600Service() *Tower600Service { func (s *Tower600Service) Boss(tower_level uint32) *model.BaseTowerConfig { var config model.Tower600Config - cool.DBM(s.Model).Where("tower_level = ?", tower_level).Scan(&config) + cool.DBM(s.Model).Where("tower_level = ?", tower_level). + Cache(gdb.CacheOption{ + // Duration: time.Hour, + + Force: false, + }).Scan(&config) return &config.BaseTowerConfig } diff --git a/modules/dict/service/dict_info.go b/modules/dict/service/dict_info.go index aa1216519..d985c1d0b 100644 --- a/modules/dict/service/dict_info.go +++ b/modules/dict/service/dict_info.go @@ -134,8 +134,8 @@ var DictInfoServiceS = NewDictInfoService() func NewDictInfoService() *DictInfoService { return &DictInfoService{ &cool.Service{ - UniqueKey: map[string]string{"name": "名称不能重复"}, - Model: model.NewDictInfo(), + //UniqueKey: map[string]string{"name": "名称不能重复"}, + Model: model.NewDictInfo(), ListQueryOp: &cool.QueryOp{ FieldEQ: []string{"typeId"}, KeyWordField: []string{"name"},