feat(item): 新增性格道具支持与相关逻辑调整
新增对特定性格道具的支持,包括 Nature 和 NatureSet 属性解析, 并优化精灵融合、任务奖励、战斗捕捉等流程中的宠物添加方式。 同时修复部分战斗逻辑及数据结构引用问题。
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user