feat(fight): 添加捕捉宠物功能并优化物品系统

- 新增 Capture 函数处理捕捉宠物逻辑
- 修改 ChangePet 函数返回值
- 优化物品添加和查询逻辑
- 增加新消息类型 CatchMonsterOutboundInfo
- 调整战斗循环处理捕捉逻辑
待修复技能丢失问题
This commit is contained in:
2025-09-11 02:44:21 +08:00
parent 53df18c1e1
commit 0ca743a592
9 changed files with 123 additions and 20 deletions

View File

@@ -89,5 +89,12 @@ func (h Controller) Escape(data *fight.EscapeFightInboundInfo, c *service.Player
func (h Controller) ChangePet(data *fight.ChangePetInboundInfo, c *service.Player) (result *fight.NullOutboundInfo, err errorcode.ErrorCode) {
c.FightC.ChangePet(c, int32(data.CatchTime))
return nil, 0
return nil, -1
}
// 切换精灵
func (h Controller) Capture(data *fight.CatchMonsterInboundInfo, c *service.Player) (result *info.CatchMonsterOutboundInfo, err errorcode.ErrorCode) {
c.FightC.Capture(c, (data.CapsuleId))
return nil, -1
}

View File

@@ -14,7 +14,7 @@ func (h Controller) UserItemList(data *item.ItemListInboundInfo, c *service.Play
re := c.Service.ItemCheak()
for _, v := range re {
if int32(v.ItemId) > int32(data.Param1) && int32(v.ItemId) < int32(data.Param2) {
if int32(v.ItemId) >= int32(data.Param1) && int32(v.ItemId) <= int32(data.Param2) {
v.LeftTime = 360000
result.ItemList = append(result.ItemList, v)
}

View File

@@ -16,15 +16,24 @@ func (h *Controller) GetPetInfo(
data *pet.InInfo,
c *service.Player) (result *pet.OutInfo,
err errorcode.ErrorCode) { //这个时候player应该是空的
for _, pi := range c.Info.PetList {
if pi.CatchTime == data.CatchTime {
return &pet.OutInfo{
result = &pet.OutInfo{
PetInfo: pi,
}, 0
}
}
}
return result, errorcode.ErrorCodes.ErrNoPrerequisiteFacility
if result == nil {
result = &pet.OutInfo{
PetInfo: c.Service.GetPetInfo(data.CatchTime),
}
}
return result, 0
}
// 获取仓库列表