This commit is contained in:
@@ -2,11 +2,8 @@ package controller
|
||||
|
||||
import (
|
||||
"blazing/common/socket/errorcode"
|
||||
"blazing/logic/service/pet"
|
||||
"blazing/logic/service/player"
|
||||
"blazing/logic/service/room"
|
||||
|
||||
"github.com/jinzhu/copier"
|
||||
)
|
||||
|
||||
// SetFitment 设置基地家具摆放
|
||||
@@ -18,29 +15,3 @@ func (h Controller) SetFitment(data *SET_FITMENT, c *player.Player) (result *roo
|
||||
c.Service.Room.Set(data.Fitments)
|
||||
return
|
||||
}
|
||||
|
||||
// SetPet 设置基地展示的精灵
|
||||
// data: 包含精灵展示列表的输入信息
|
||||
// c: 当前玩家对象
|
||||
// 返回: 精灵展示列表和错误码
|
||||
func (h Controller) SetPet(data *C2S_PET_ROOM_SHOW, c *player.Player) (result *room.S2C_PET_ROOM_SHOW, err errorcode.ErrorCode) {
|
||||
var showPetCatchTimes []uint32
|
||||
for _, petShowInfo := range data.PetShowList {
|
||||
if petShowInfo.CatchTime != 0 {
|
||||
showPetCatchTimes = append(showPetCatchTimes, petShowInfo.CatchTime)
|
||||
}
|
||||
}
|
||||
c.Service.Room.Show(showPetCatchTimes)
|
||||
result = &room.S2C_PET_ROOM_SHOW{}
|
||||
result.PetShowList = make([]pet.PetShortInfo, 0, len(showPetCatchTimes))
|
||||
for _, catchTime := range showPetCatchTimes {
|
||||
petInfo := c.Service.Pet.PetInfoOneByCatchTime(catchTime)
|
||||
if petInfo == nil {
|
||||
continue
|
||||
}
|
||||
var petShortInfo pet.PetShortInfo
|
||||
copier.Copy(&petShortInfo, &petInfo.Data)
|
||||
result.PetShowList = append(result.PetShowList, petShortInfo)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user