This commit is contained in:
@@ -4,18 +4,20 @@ import (
|
||||
"blazing/common/socket/errorcode"
|
||||
"blazing/logic/service/common"
|
||||
"blazing/logic/service/pet"
|
||||
"blazing/logic/service/player"
|
||||
playersvc "blazing/logic/service/player"
|
||||
"blazing/modules/player/model"
|
||||
)
|
||||
|
||||
// GetPetInfo 获取精灵信息
|
||||
func (h Controller) GetPetInfo(
|
||||
data *GetPetInfoInboundInfo,
|
||||
player *player.Player) (result *model.PetInfo,
|
||||
player *playersvc.Player) (result *model.PetInfo,
|
||||
err errorcode.ErrorCode) {
|
||||
levelLimit := player.CurrentMapPetLevelLimit()
|
||||
if slot, found := player.FindPetBagSlot(data.CatchTime); found {
|
||||
if petInfo := slot.PetInfoPtr(); petInfo != nil {
|
||||
result = petInfo
|
||||
petCopy := playersvc.ApplyPetLevelLimit(*petInfo, levelLimit)
|
||||
result = &petCopy
|
||||
return result, 0
|
||||
}
|
||||
}
|
||||
@@ -25,16 +27,18 @@ func (h Controller) GetPetInfo(
|
||||
return nil, errorcode.ErrorCodes.ErrPokemonNotExists
|
||||
}
|
||||
|
||||
result = &ret.Data
|
||||
petData := ret.Data
|
||||
petData = playersvc.ApplyPetLevelLimit(petData, levelLimit)
|
||||
result = &petData
|
||||
return result, 0
|
||||
}
|
||||
|
||||
// GetUserBagPetInfo 获取主背包和并列备用精灵列表
|
||||
func (h Controller) GetUserBagPetInfo(
|
||||
data *GetUserBagPetInfoInboundEmpty,
|
||||
player *player.Player) (result *pet.GetUserBagPetInfoOutboundInfo,
|
||||
player *playersvc.Player) (result *pet.GetUserBagPetInfoOutboundInfo,
|
||||
err errorcode.ErrorCode) {
|
||||
return player.GetUserBagPetInfo(), 0
|
||||
return player.GetUserBagPetInfo(player.CurrentMapPetLevelLimit()), 0
|
||||
}
|
||||
|
||||
// GetPetListInboundEmpty 定义请求或响应数据结构。
|
||||
@@ -45,7 +49,7 @@ type GetPetListInboundEmpty struct {
|
||||
// GetPetList 获取当前主背包列表
|
||||
func (h Controller) GetPetList(
|
||||
data *GetPetListInboundEmpty,
|
||||
player *player.Player) (result *pet.GetPetListOutboundInfo,
|
||||
player *playersvc.Player) (result *pet.GetPetListOutboundInfo,
|
||||
err errorcode.ErrorCode) {
|
||||
return buildPetListOutboundInfo(player.Info.PetList), 0
|
||||
}
|
||||
@@ -58,7 +62,7 @@ type GetPetListFreeInboundEmpty struct {
|
||||
// GetPetReleaseList 获取仓库可放生列表
|
||||
func (h Controller) GetPetReleaseList(
|
||||
data *GetPetListFreeInboundEmpty,
|
||||
player *player.Player) (result *pet.GetPetListOutboundInfo,
|
||||
player *playersvc.Player) (result *pet.GetPetListOutboundInfo,
|
||||
err errorcode.ErrorCode) {
|
||||
|
||||
return buildPetListOutboundInfo(player.WarehousePetList()), 0
|
||||
@@ -67,7 +71,7 @@ func (h Controller) GetPetReleaseList(
|
||||
// PlayerShowPet 精灵展示
|
||||
func (h Controller) PlayerShowPet(
|
||||
data *PetShowInboundInfo,
|
||||
player *player.Player) (result *pet.PetShowOutboundInfo, err errorcode.ErrorCode) {
|
||||
player *playersvc.Player) (result *pet.PetShowOutboundInfo, err errorcode.ErrorCode) {
|
||||
result = &pet.PetShowOutboundInfo{
|
||||
UserID: data.Head.UserID,
|
||||
CatchTime: data.CatchTime,
|
||||
|
||||
Reference in New Issue
Block a user