42 lines
1.0 KiB
Go
42 lines
1.0 KiB
Go
package task
|
||
|
||
import (
|
||
"blazing/common/data"
|
||
|
||
"blazing/modules/config/service"
|
||
"blazing/modules/player/model"
|
||
)
|
||
|
||
type TaskResult struct {
|
||
Pet *model.PetInfo `json:"petTypeId" description:"发放的精灵ID"` // 发放的精灵ID,
|
||
|
||
ItemList []data.ItemInfo `json:"itemList" description:"发放物品的数组"` // 发放物品的数组,
|
||
Title uint32 `json:"title" description:"称号奖励"`
|
||
}
|
||
|
||
func GetTaskInfo(id, ot int) *TaskResult {
|
||
ret := &TaskResult{}
|
||
|
||
r := service.NewTaskService().Get(id, ot)
|
||
if r == nil {
|
||
return nil
|
||
}
|
||
|
||
pet := service.NewPetRewardService().Get(r.ElfRewardIds)
|
||
if pet != nil {
|
||
ret.Pet = model.GenPetInfo(int(pet.MonID), int(pet.DV), int(pet.Nature), int(pet.Effect), int(pet.Lv), nil, 0)
|
||
}
|
||
|
||
for _, itemID := range r.ItemRewardIds {
|
||
iteminfo := service.NewItemService().GetItemCount(itemID)
|
||
ret.ItemList = append(ret.ItemList, data.ItemInfo{ItemId: iteminfo.ItemId, ItemCnt: iteminfo.ItemCnt})
|
||
|
||
}
|
||
if r.TitleRewardIds != 0 {
|
||
ret.Title = r.TitleRewardIds
|
||
|
||
}
|
||
|
||
return ret
|
||
}
|