```
refactor(task): 重构任务奖励系统,优化任务奖励处理逻辑 移除废弃的任务相关代码文件,包括task/list.go和task/list_daily.go, 以及相关的模型定义config_task表和PetReward服务。 修改任务奖励获取方式,从原有的TaskResultMap改为通过数据库配置获取, 新增TaskService.Get方法用于获取任务配置信息。 --- feat(boss): 优化
This commit is contained in:
@@ -2,7 +2,6 @@ package controller
|
||||
|
||||
import (
|
||||
"blazing/common/socket/errorcode"
|
||||
"sync/atomic"
|
||||
|
||||
"blazing/logic/service/fight"
|
||||
"blazing/logic/service/fight/info"
|
||||
@@ -41,14 +40,6 @@ func (h Controller) Escape(data *fight.EscapeFightInboundInfo, c *player.Player)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
battleMode := atomic.LoadUint32(&c.Fightinfo.Mode)
|
||||
if battleMode == 0 {
|
||||
return nil, errorcode.ErrorCodes.ErrBattleNotStarted
|
||||
}
|
||||
if battleMode == 1 {
|
||||
return nil, errorcode.ErrorCodes.ErrCannotFleePlayerBattle
|
||||
}
|
||||
|
||||
defer c.FightC.Over(c, info.BattleOverReason.PlayerEscape)
|
||||
return nil, 0
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import (
|
||||
|
||||
"blazing/logic/service/fight"
|
||||
"blazing/logic/service/fight/info"
|
||||
"blazing/logic/service/task"
|
||||
|
||||
"blazing/logic/service/player"
|
||||
"blazing/modules/blazing/model"
|
||||
@@ -140,17 +141,29 @@ func (h Controller) PlayerFightBoss(data *fight.ChallengeBossInboundInfo, p *pla
|
||||
if p.Info.GetTask(taskID) == model.Unaccepted {
|
||||
p.Info.SetTask(taskID, model.Completed) //设置完成任务
|
||||
|
||||
monsterInfo.PetList[0].Downgrade(1)
|
||||
petID := monsterInfo.PetList[0].ID
|
||||
gift := task.GetTaskInfo(uint32(taskID), 0)
|
||||
if gift != nil {
|
||||
|
||||
newPet := model.GenPetInfo(int(petID), -1, -1, 0, 1, nil)
|
||||
p.Service.Pet.PetAdd(newPet)
|
||||
res := &info.S2C_GET_BOSS_MONSTER{
|
||||
BonusID: uint32(taskID),
|
||||
}
|
||||
if gift.Pet != nil {
|
||||
p.Service.Pet.PetAdd(gift.Pet)
|
||||
res.PetID = gift.Pet.ID
|
||||
res.CaptureTm = gift.Pet.CatchTime
|
||||
|
||||
}
|
||||
for _, item := range gift.ItemList {
|
||||
success := p.ItemAdd(item.ItemId, item.ItemCnt)
|
||||
if success {
|
||||
res.ItemList = append(res.ItemList, item)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
p.SendPackCmd(8004, res)
|
||||
}
|
||||
|
||||
p.SendPackCmd(8004, &info.S2C_GET_BOSS_MONSTER{
|
||||
BonusID: uint32(taskID),
|
||||
PetID: petID,
|
||||
CaptureTm: newPet.CatchTime,
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -59,16 +59,15 @@ func (h Controller) CompleteTask(data1 *task.CompleteTaskInboundInfo, c *player.
|
||||
ItemList: make([]data.ItemInfo, 0),
|
||||
}
|
||||
|
||||
taskInfo := task.Get_Task_Info(*data1)
|
||||
taskInfo := task.GetTaskInfo(data1.TaskId, data1.OutState)
|
||||
if taskInfo == nil {
|
||||
return result, 0
|
||||
}
|
||||
|
||||
if taskInfo.PetTypeId != 0 {
|
||||
newPet := model.GenPetInfo(int(taskInfo.PetTypeId), 31, -1, 0, 50, nil)
|
||||
result.PetTypeId = newPet.ID
|
||||
c.Service.Pet.PetAdd(newPet)
|
||||
result.CaptureTime = newPet.CatchTime
|
||||
if taskInfo.Pet != nil {
|
||||
|
||||
c.Service.Pet.PetAdd(taskInfo.Pet)
|
||||
result.CaptureTime = taskInfo.Pet.CatchTime
|
||||
}
|
||||
|
||||
for _, item := range taskInfo.ItemList {
|
||||
|
||||
Reference in New Issue
Block a user