feat(room): 更新房间宠物展示逻辑并优化数据结构 - 修改 `OnGetRoomPetShowInfo` 方法,使用 `pet.PetShortInfo` 替代原有的 `room.PetShowInfo` 结构体 - 引入 `github.com/jinzhu/copier` 实现结构体字段自动复制 - 调整 `SET_Pet` 接口实现逻辑以支持批量设置展示中的宠物 - 更新 `PetRoomListOutboundInfo` 中 Pets 字段类型为 `[]pet.PetShortInfo` - 将 `RoomService.Show` 方法参数由单个 uint32 改为切片 []uint32 以支持多宠物展示 - 修改数据库表名常量 `TableNameBaseHouse` 从 "base_house" 更名为 "room_house
73 lines
2.4 KiB
Go
73 lines
2.4 KiB
Go
package room
|
||
|
||
import (
|
||
"blazing/logic/service/common"
|
||
"blazing/logic/service/pet"
|
||
"blazing/modules/blazing/model"
|
||
)
|
||
|
||
// FitmentUseringInboundInfo FitmentUseringInboundInfo类,实现InboundMessage接口
|
||
type FitmentUseringInboundInfo struct {
|
||
Head common.TomeeHeader `cmd:"10006" struc:"skip"` //玩家登录
|
||
// 需要获取基地信息的目标玩家账号ID
|
||
TargetUserID uint32 `json:"targetUserId"`
|
||
}
|
||
type SET_FITMENT struct {
|
||
Head common.TomeeHeader `cmd:"10008" struc:"skip"` //玩家登录
|
||
// RoomID 房间ID
|
||
// 特殊规则:怀旧服官服固定为1,新服与用户ID(userid)相同
|
||
RoomID uint32 `json:"roomID"`
|
||
|
||
FitmentsLen uint32 `json:"fitmentsLen" struc:"sizeof=Fitments"`
|
||
// UsedList 已摆放家具列表
|
||
// 包含家具ID、坐标,且内嵌房间小屋ID;其中小屋的坐标(PosX/PosY)固定为0
|
||
Fitments []model.FitmentShowInfo `json:"usedList"`
|
||
}
|
||
|
||
// FitmentUseringOutboundInfo FitmentUseringOutboundInfo,实现OutboundMessage接口
|
||
type FitmentUseringOutboundInfo struct {
|
||
// 玩家账号ID
|
||
UserId uint32 ` json:"userId"`
|
||
// 进入基地所有者的userid
|
||
RoomId uint32 `codec:"auto" json:"roomId"`
|
||
FitmentsLen uint32 `json:"fitmentsLen" struc:"sizeof=Fitments"`
|
||
// 基地摆放物品的数组, 就算没有摆放物品, 也必带一个小屋的参数
|
||
Fitments []model.FitmentShowInfo `codec:"auto" json:"fitments"`
|
||
}
|
||
|
||
// PetShowInfo 宠物展示信息
|
||
|
||
type PetRoomListOutboundInfo struct {
|
||
PetsLen uint32 `json:"petsLen" struc:"sizeof=Pets"`
|
||
Pets []pet.PetShortInfo `json:"pets"`
|
||
}
|
||
|
||
type PetRoomListInboundInfo struct {
|
||
Head common.TomeeHeader `cmd:"2324" struc:"skip"` //玩家登录
|
||
// 需要获取基地信息的目标玩家账号ID
|
||
TargetUserID uint32 `json:"targetUserId"`
|
||
}
|
||
type FitmentAllInboundEmpty struct {
|
||
Head common.TomeeHeader `cmd:"10007" struc:"skip"`
|
||
}
|
||
type FitmentAllOutboundInfo struct {
|
||
FitmentsLen uint32 `json:"fitmentsLen" struc:"sizeof=Fitments"`
|
||
// 基地摆放物品的数组, 就算没有摆放物品, 也必带一个小屋的参数
|
||
Fitments []FitmentItemInfo `codec:"auto" json:"fitments"`
|
||
}
|
||
|
||
// FitmentItemInfo
|
||
type FitmentItemInfo struct {
|
||
// Id 家具id 或 默认房型id: 500001(
|
||
Id uint32 `json:"id"`
|
||
|
||
// UsedCount 使用数量(默认房型id项目的使用数据固定为1)(
|
||
UsedCount uint32 `json:"usedCount"`
|
||
|
||
// AllCount 拥有数量(默认房型id项目的拥有数量固定为1)(
|
||
AllCount uint32 `json:"allCount"`
|
||
}
|
||
|
||
type NullInfo struct {
|
||
}
|