fix(fight_boss): 调整Boss捕捉逻辑位置以确保正确执行

将Boss捕捉率获取逻辑从循环外移至循环内,确保在处理Boss宠物信息之后再进行捕捉率赋值。

feat(pet): 新增协议结构体定义用于学习力相关操作

新增C2S_9756与S2C_9756结构体,支持学习力相关的客户端请求与服务端响应处理。
This commit is contained in:
2025-11-25 02:35:36 +08:00
parent 28e0addda0
commit 147758c5ae
3 changed files with 27 additions and 3 deletions

View File

@@ -0,0 +1,17 @@
package controller
import (
"blazing/common/socket/errorcode"
"blazing/logic/service/pet"
"blazing/logic/service/player"
"github.com/gogf/gf/v2/util/grand"
)
// 传送仓抓稀有
func (h Controller) Cacthpet(data *pet.C2S_9756, c *player.Player) (result *pet.S2C_9756, err errorcode.ErrorCode) {
result = &pet.S2C_9756{
UseEV: uint32(grand.Intn(10)),
}
return
}

View File

@@ -71,9 +71,7 @@ func (h Controller) PlayerFightBoss(data *fight.ChallengeBossInboundInfo, c *pla
if bc.TaskID != nil {
taskid = *bc.TaskID
}
if bc.BossCatchable == 1 {
cancpet = xmlres.PetMAP[int(mo.ID)].CatchRate
}
for _, bm := range bc.BossMon {
mo = c.GenPetInfo(
@@ -88,6 +86,9 @@ func (h Controller) PlayerFightBoss(data *fight.ChallengeBossInboundInfo, c *pla
moinfo.PetList = append(moinfo.PetList, *mo)
}
if bc.BossCatchable == 1 {
cancpet = xmlres.PetMAP[int(mo.ID)].CatchRate
}
moinfo.Nick = xmlres.PetMAP[int(mo.ID)].DefName
break
}

View File

@@ -8,6 +8,9 @@ type PetBargeListInboundInfo struct {
StartPetId uint32 `description:"开始精灵id" codec:"startPetId"` // @UInt long 对应Go的uint32无符号64位
EndPetId uint32 `description:"结束精灵id" codec:"endPetId"` // 字段标签模拟注解功能(描述、编解码标识)
}
type C2S_9756 struct {
Head common.TomeeHeader `cmd:"9756" struc:"skip"`
}
// PetBargeListInfo 对应Java的PetBargeListInfo类
type PetBargeListInfo struct {
@@ -29,3 +32,6 @@ type PetEV struct {
type S2C_50001 struct {
UseEV uint32 //用掉的学习力
}
type S2C_9756 struct {
UseEV uint32 //用掉的学习力
}