feat(item): 新增性格道具支持与相关逻辑调整
新增对特定性格道具的支持,包括 Nature 和 NatureSet 属性解析, 并优化精灵融合、任务奖励、战斗捕捉等流程中的宠物添加方式。 同时修复部分战斗逻辑及数据结构引用问题。
This commit is contained in:
@@ -56,7 +56,7 @@ func (h Controller) PetFusion(data *pet.C2S_PetFusion, c *player.Player) (result
|
||||
dv2 := decimal.NewFromInt(1).Div(decimal.NewFromInt(3)).Mul(decimal.NewFromInt(int64(Auxpetinfo.Dv)))
|
||||
dv := dv1.Add(dv2).Add(decimal.NewFromInt(1)).IntPart()
|
||||
r := model.GenPetInfo(resid, int(dv), int(natureId), effect, -1, 1)
|
||||
c.Service.Pet.PetAdd(*r)
|
||||
c.Service.Pet.PetAdd(r)
|
||||
c.Pet_del(Auxpetinfo.CatchTime)
|
||||
c.Pet_del(Mcatchpetinfo.CatchTime)
|
||||
//todo材料扣除
|
||||
|
||||
@@ -125,7 +125,7 @@ func (h Controller) PlayerFightBoss(data *fight.ChallengeBossInboundInfo, c *pla
|
||||
PetID := moinfo.PetList[0].ID
|
||||
|
||||
newm1 := model.GenPetInfo(int(PetID), -1, -1, 0, 0, 1)
|
||||
c.Service.Pet.PetAdd(*newm1)
|
||||
c.Service.Pet.PetAdd(newm1)
|
||||
|
||||
c.SendPackCmd(8004, &info.S2C_GET_BOSS_MONSTER{
|
||||
BonusID: uint32(taskid),
|
||||
@@ -192,7 +192,7 @@ func (h Controller) OnPlayerFightNpcMonster(data *fight.FightNpcMonsterInboundIn
|
||||
}
|
||||
|
||||
evs := gconv.Uint32s(strings.Split(xmlres.PetMAP[int(mo.ID)].YieldingEV, " "))
|
||||
items.EV = lo.Sum(evs)
|
||||
items.EV = lo.Sum(evs) - 1
|
||||
c.Info.EVPool += lo.Sum(evs) //给予累计学习力
|
||||
foi.Winpet.AddEV(evs)
|
||||
|
||||
|
||||
@@ -1,12 +1,15 @@
|
||||
package controller
|
||||
|
||||
import (
|
||||
"blazing/common/data/xmlres"
|
||||
"blazing/common/socket/errorcode"
|
||||
"blazing/logic/service/fight"
|
||||
"blazing/logic/service/item"
|
||||
"blazing/logic/service/player"
|
||||
"blazing/modules/blazing/model"
|
||||
"strings"
|
||||
|
||||
"github.com/gogf/gf/v2/util/gconv"
|
||||
"github.com/gogf/gf/v2/util/grand"
|
||||
"github.com/jinzhu/copier"
|
||||
)
|
||||
@@ -48,6 +51,17 @@ func (h Controller) ItemUsePet(data *item.C2S_USE_PET_ITEM_OUT_OF_FIGHT, c *play
|
||||
//性格随机
|
||||
case itemID == 300025:
|
||||
onpet.Nature = uint32(grand.Intn(25))
|
||||
|
||||
case itemID >= 240042 && itemID <= 240056:
|
||||
|
||||
if xmlres.ItemsMAP[int(itemID)].Nature != 0 {
|
||||
onpet.Nature = uint32(xmlres.ItemsMAP[int(itemID)].Nature)
|
||||
}
|
||||
if xmlres.ItemsMAP[int(itemID)].NatureSet != "" {
|
||||
|
||||
rr := strings.Split(xmlres.ItemsMAP[int(itemID)].NatureSet, " ")
|
||||
onpet.Nature = gconv.Uint32(rr[grand.Intn(len(rr))-1])
|
||||
}
|
||||
default:
|
||||
// 无效ID处理
|
||||
return nil, errorcode.ErrorCodes.ErrSystemError
|
||||
|
||||
@@ -77,9 +77,10 @@ func (h Controller) Complete_Task(data *task.CompleteTaskInboundInfo, c *player.
|
||||
|
||||
if tt.PetTypeId != 0 {
|
||||
r := model.GenPetInfo(int(tt.PetTypeId), 31, -1, 0, 0, 50)
|
||||
result.CaptureTime = r.CatchTime
|
||||
|
||||
result.PetTypeId = r.ID
|
||||
c.Service.Pet.PetAdd(*r)
|
||||
c.Service.Pet.PetAdd(r)
|
||||
result.CaptureTime = r.CatchTime //这个写到后面,方便捕捉时间被修改后造成的时间不对问题
|
||||
}
|
||||
|
||||
ret := c.ItemAdd(result.ItemList...) //获取成功的条目
|
||||
|
||||
Reference in New Issue
Block a user