```
refactor(rpc): 更新结构体标签以跳过特定字段序列化 将多个结构体中的 `struc:"[0]pad"` 标签更改为 `struc:"skip"`, 以避免在序列化过程中处理不必要的填充字段。同时新增放生与领回相关逻辑, 并完善部分控制器函数和消息结构定义。 ```
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"blazing/common/data/xmlres"
|
||||
"blazing/common/socket/errorcode"
|
||||
"blazing/common/utils"
|
||||
"blazing/logic/service/fight"
|
||||
"blazing/logic/service/pet"
|
||||
"blazing/logic/service/player"
|
||||
|
||||
@@ -52,6 +53,62 @@ func (h *Controller) GetPetList(
|
||||
|
||||
}
|
||||
|
||||
// 获取放生列表
|
||||
func (h *Controller) PET_ROWEI_LIST(
|
||||
data *pet.GetPetListFreeInboundEmpty,
|
||||
c *player.Player) (result *pet.GetPetListOutboundInfo,
|
||||
err errorcode.ErrorCode) { //这个时候player应该是空的
|
||||
result = &pet.GetPetListOutboundInfo{}
|
||||
|
||||
tt := c.Service.Pet.PetInfo(1) //获得未放生的精灵
|
||||
result.ShortInfoList = make([]pet.PetShortInfo, len(tt))
|
||||
for i, v := range tt {
|
||||
|
||||
copier.Copy(&result.ShortInfoList[i], &v.Data)
|
||||
|
||||
}
|
||||
return result, 0
|
||||
|
||||
}
|
||||
|
||||
// 放生包
|
||||
func (h *Controller) PET_ROWEI(
|
||||
data *pet.PET_ROWEI, c *player.Player) (result *fight.NullOutboundInfo, err errorcode.ErrorCode) { //这个时候player应该是空的
|
||||
|
||||
c.Service.Pet.PetInfo_One_exec(data.CatchTime, func(t *model.PetEX) {
|
||||
|
||||
_, _, ok := c.FindPet(data.CatchTime)
|
||||
|
||||
//如果背包没找到,再放入背包
|
||||
if !ok && t.CatchTime != 0 {
|
||||
t.Free = 1
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
return nil, 0
|
||||
|
||||
}
|
||||
|
||||
// 领回包
|
||||
func (h *Controller) PET_RETRIEVE(
|
||||
data *pet.PET_RETRIEVE, c *player.Player) (result *fight.NullOutboundInfo, err errorcode.ErrorCode) { //这个时候player应该是空的
|
||||
|
||||
c.Service.Pet.PetInfo_One_exec(data.CatchTime, func(t *model.PetEX) {
|
||||
|
||||
_, _, ok := c.FindPet(data.CatchTime)
|
||||
|
||||
//如果背包没找到,再放入背包
|
||||
if !ok && t.CatchTime != 0 {
|
||||
t.Free = 0
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
return nil, 0
|
||||
|
||||
}
|
||||
|
||||
// 精灵背包仓库切换
|
||||
func (h *Controller) PetRelease(
|
||||
data *pet.PetReleaseInboundInfo,
|
||||
@@ -117,6 +174,8 @@ func (h *Controller) PlayerShowPet(
|
||||
return
|
||||
|
||||
}
|
||||
|
||||
// 单体治疗
|
||||
func (h *Controller) PetOneCure(
|
||||
data *pet.PetOneCureInboundInfo, c *player.Player) (result *pet.PetOneCureOutboundInfo, err errorcode.ErrorCode) { //这个时候player应该是空的
|
||||
if c.GetSpace().Owner.UserID == c.Info.UserID {
|
||||
|
||||
Reference in New Issue
Block a user