diff --git a/logic/controller/pet.go b/logic/controller/pet.go index 78c1aa1f..591e6079 100644 --- a/logic/controller/pet.go +++ b/logic/controller/pet.go @@ -143,3 +143,24 @@ func (h *Controller) PetOneCure( return result, 0 } + +// 精灵首发 +func (h *Controller) PetFirst( + data *pet.PetDefaultInboundInfo, c *service.Player) (result *pet.PetDefaultOutboundInfo, err errorcode.ErrorCode) { //这个时候player应该是空的 + result = &pet.PetDefaultOutboundInfo{} + var ttt []model.PetInfo + + for index, pi := range c.Info.PetList { + if pi.CatchTime == data.CatchTime { + ttt = append(ttt, pi) + ttt = append(ttt, c.Info.PetList[:index]...) + ttt = append(ttt, c.Info.PetList[index+1:]...) + result.IsDefault = 1 + break + } + + } + c.Info.PetList = ttt + return result, 0 + +} diff --git a/logic/service/pet/pet.go b/logic/service/pet/pet.go index 3a18f9e3..96566a5b 100644 --- a/logic/service/pet/pet.go +++ b/logic/service/pet/pet.go @@ -65,3 +65,16 @@ type PetOneCureInboundInfo struct { type PetOneCureOutboundInfo struct { CatchTime uint32 `json:"catchTime" fieldDescription:"精灵捕捉时间" uint:"true"` } + +// PetDefaultInboundInfo 对应Java的PetDefaultInboundInfo类 +// 实现了InboundMessage接口 +type PetDefaultInboundInfo struct { + Head service.TomeeHeader `cmd:"2308" struc:"[0]pad"` + CatchTime uint32 `json:"catchTime" fieldDescription:"精灵捕捉时间" uint:"true" autoCodec:"true" inboundMessageType:"Pet_Default"` +} + +// PetDefaultOutboundInfo 对应Java的PetDefaultOutboundInfo类 +// 实现了OutboundMessage接口 +type PetDefaultOutboundInfo struct { + IsDefault uint32 `json:"isDefault" fieldDescription:"0: 首发设置失败,1: 首发设置成功" uint:"true" autoCodec:"true" outboundMessageType:"Pet_Default"` +}