2025-12-16 02:50:10 +08:00
|
|
|
package controller
|
2026-01-03 01:35:32 +08:00
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"blazing/common/data/xmlres"
|
|
|
|
|
"blazing/common/socket/errorcode"
|
|
|
|
|
"blazing/logic/service/fight"
|
|
|
|
|
"blazing/logic/service/fight/info"
|
|
|
|
|
"blazing/logic/service/pet"
|
|
|
|
|
"blazing/logic/service/player"
|
|
|
|
|
|
|
|
|
|
"github.com/jinzhu/copier"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
func (h Controller) PetELV(data *pet.C2S_PET_EVOLVTION, c *player.Player) (result *fight.NullOutboundInfo, err errorcode.ErrorCode) {
|
|
|
|
|
_, currentPet, found := c.FindPet(data.CacthTime)
|
|
|
|
|
if !found {
|
|
|
|
|
return nil, errorcode.ErrorCodes.Err10401
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
flag := xmlres.PetMAP[int(currentPet.ID)].EvolvFlag
|
|
|
|
|
|
|
|
|
|
if flag == 0 {
|
|
|
|
|
return nil, errorcode.ErrorCodes.ErrPokemonNotEvolveReady
|
|
|
|
|
}
|
2026-03-01 11:25:30 +08:00
|
|
|
if xmlres.PetMAP[int(currentPet.ID)].EvolvingLv > int(currentPet.Level) {
|
|
|
|
|
return nil, errorcode.ErrorCodes.ErrPokemonNotEvolveReady
|
|
|
|
|
}
|
2026-01-03 01:35:32 +08:00
|
|
|
evinfo := xmlres.EVOLVMAP[flag].Branches[data.Index-1]
|
|
|
|
|
|
2026-02-12 04:28:20 +08:00
|
|
|
if c.Service.Item.CheakItem(uint32(evinfo.EvolvItem)) < int64(evinfo.EvolvItemCount) {
|
2026-01-03 01:35:32 +08:00
|
|
|
return nil, errorcode.ErrorCodes.ErrInsufficientItemsMulti
|
|
|
|
|
}
|
|
|
|
|
if evinfo.EvolvItem != 0 {
|
|
|
|
|
c.Service.Item.UPDATE(uint32(evinfo.EvolvItem), -evinfo.EvolvItemCount)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
currentPet.ID = uint32(xmlres.EVOLVMAP[flag].Branches[data.Index-1].MonTo)
|
|
|
|
|
currentPet.Update(true)
|
|
|
|
|
currentPet.CalculatePetPane(false)
|
|
|
|
|
|
|
|
|
|
currentPet.Update(true)
|
|
|
|
|
updateOutbound := &info.PetUpdateOutboundInfo{}
|
|
|
|
|
|
|
|
|
|
var petUpdateInfo info.UpdatePropInfo
|
|
|
|
|
|
|
|
|
|
copier.Copy(&petUpdateInfo, currentPet)
|
|
|
|
|
|
|
|
|
|
updateOutbound.Data = append(updateOutbound.Data, petUpdateInfo)
|
|
|
|
|
c.SendPackCmd(2508, updateOutbound) //准备包由各自发,因为协议不一样
|
|
|
|
|
return nil, -1
|
|
|
|
|
}
|