feat(pet): 实现精灵融合功能并优化相关逻辑

新增精灵融合接口及处理逻辑,支持主副精灵融合生成新精灵,并消耗金币与材料。
同时调整了战斗技能选择流程、修复地图热度统计安全问题以及完善宠物删除机制。

- 添加 `PetFusion` 控制器方法实现融合核心逻辑
- 新增 `C2S_PetFusion` 和 `PetFusionInfo` 结构体用于通信
- 修正战斗中技能随机选取后立即返回的问题
- 修复太空站进入/离开时对地图热度的并发访问风险
-
This commit is contained in:
2025-11-26 01:33:48 +08:00
parent f682abe537
commit f76587f952
14 changed files with 198 additions and 18 deletions

View File

@@ -1 +1,47 @@
package controller
import (
"blazing/common/data/xmlres"
"blazing/common/socket/errorcode"
"blazing/logic/service/pet"
"blazing/logic/service/player"
"blazing/modules/blazing/model"
)
func (h Controller) PetFusion(data *pet.C2S_PetFusion, c *player.Player) (result *pet.PetFusionInfo, err errorcode.ErrorCode) {
if !c.UseCoins(1000) {
return result, errorcode.ErrorCodes.ErrSystemBusy
}
//防止同一只
if data.Mcatchtime == data.Auxcatchtime {
return result, errorcode.ErrorCodes.ErrSystemBusy
}
_, Mcatchpetinfo, ok := c.FindPet(data.Mcatchtime)
if !ok {
return result, errorcode.ErrorCodes.ErrSystemBusy
}
if xmlres.PetMAP[int(Mcatchpetinfo.ID)].FuseMaster == 0 {
return result, errorcode.ErrorCodes.ErrSystemBusy
}
_, Auxpetinfo, ok := c.FindPet(data.Auxcatchtime)
if !ok {
return result, errorcode.ErrorCodes.ErrSystemBusy
}
if xmlres.PetMAP[int(Auxpetinfo.ID)].FuseSub == 0 {
return result, errorcode.ErrorCodes.ErrSystemBusy
}
r := model.GenPetInfo(1, -1, -1, -1, -1, 1)
c.Service.Pet.PetAdd(*r)
c.Pet_del(Auxpetinfo.CatchTime)
c.Pet_del(Mcatchpetinfo.CatchTime)
return &pet.PetFusionInfo{
ObtainTime: r.CatchTime,
SoulID: 1000017,
StarterCpTm: r.ID,
CostItemFlag: 0,
}, 0
}

View File

@@ -186,9 +186,6 @@ func (h *Controller) PetOneCure(
return result, errorcode.ErrorCodes.ErrChampionCannotHeal
}
if !c.UseCoins(20) {
return result, errorcode.ErrorCodes.ErrSystemBusy
}
_, onpet, ok := c.FindPet(data.CatchTime)
if ok {
onpet.Cure()

View File

@@ -0,0 +1,17 @@
package controller
import (
"blazing/common/socket/errorcode"
"blazing/logic/service/pet"
"blazing/logic/service/player"
)
func (h *Controller) IS_COLLECT(
data *pet.C2S_IS_COLLECT, c *player.Player) (result *pet.S2C_IS_COLLECT, err errorcode.ErrorCode) { //这个时候player应该是空的
result = &pet.S2C_IS_COLLECT{
ID: data.Type,
IsCom: 0,
}
return result, 0
}