| | |
| | | import PlayerPet
|
| | | import PlayerRefineStove
|
| | | import PlayerSuccess
|
| | | import SkillShell
|
| | |
|
| | | (
|
| | | Def_LimitType_Cnt, # 按个数限制
|
| | |
| | | Sync_AttrFruitEatCnt(curPlayer, [itemID])
|
| | |
|
| | | # 增加属性
|
| | | __AddFruitAttr(curPlayer, itemID, funcIndex, addValue)
|
| | | attrIDList = __AddFruitAttr(curPlayer, itemID, funcIndex, addValue)
|
| | |
|
| | | # 刷新属性
|
| | | __RefreshAttr(curPlayer, funcIndex)
|
| | | |
| | | return True, hasUseCnt
|
| | |
|
| | | ## 玩家使用属性果实
|
| | |
| | | if funcIndex == ShareDefine.Def_AttrFruitFunc_Stove:
|
| | | PlayerSuccess.DoAddSuccessProgress(curPlayer, ShareDefine.SuccType_UseStoveBylv, hasUseCnt, [item.GetLV()])
|
| | |
|
| | | effect = item.GetEffectByIndex(0)
|
| | | effID = effect.GetEffectID()
|
| | | ## 特殊属性ID处理,此属性ID做一次性处理,不做属性计算
|
| | | if effID == ShareDefine.Def_Effect_FreePoint:
|
| | | effValue = effect.GetEffectValue(0)
|
| | | addFreePoint = effValue * hasUseCnt
|
| | | freePoint = curPlayer.GetFreePoint()
|
| | | updFreePoint = freePoint + addFreePoint
|
| | | curPlayer.SetFreePoint(updFreePoint)
|
| | | GameWorld.DebugLog("丹药增加自由属性点: freePoint=%s,addFreePoint=%s(%s*%s),updFreePoint=%s" |
| | | % (freePoint, addFreePoint, effValue, hasUseCnt, updFreePoint))
|
| | | |
| | | ItemCommon.DelItem(curPlayer, item, hasUseCnt, True, ChConfig.ItemDel_AttrFruit)
|
| | | return addValue, hasUseCnt
|
| | |
|
| | |
| | | def __AddFruitAttr(curPlayer, fruitItemID, funcIndex, addValue):
|
| | |
|
| | | if addValue < 1:
|
| | | return
|
| | | return []
|
| | |
|
| | | itemData = GameWorld.GetGameData().GetItemByTypeID(fruitItemID)
|
| | | if not itemData:
|
| | | return
|
| | | return []
|
| | |
|
| | |
|
| | | limitType = Def_LimitType_Cnt #默认按个数
|
| | |
| | | fightPowerEx = fightPowerEx + addFightPowerEx * addValue
|
| | | curPlayer.SetDict(fightPowerExfigKey, fightPowerEx)
|
| | | GameWorld.DebugLog(" Add funcIndex=%s,addFightPowerEx=%s,addValue=%s,fightPowerEx=%s" % (funcIndex, addFightPowerEx, addValue, fightPowerEx))
|
| | | |
| | | attrIDList = []
|
| | | for i in range(itemData.GetEffectCount()):
|
| | | curEffect = itemData.GetEffectByIndex(i)
|
| | | effectID = curEffect.GetEffectID()
|
| | |
|
| | | if not effectID or effectID not in ChConfig.ItemEffect_AttrDict:
|
| | | if not effectID or effectID not in ChConfig.ItemEffect_AttrDict or effectID == ShareDefine.Def_Effect_FreePoint:
|
| | | continue
|
| | | |
| | | attrIDList.append(effectID)
|
| | | attrKey = ChConfig.Def_PlayerKey_FruitAttr % (funcIndex, effectID)
|
| | | curValue = curPlayer.GetDictByKey(attrKey)
|
| | | effValueA = curEffect.GetEffectValue(0)
|
| | |
| | | curPlayer.SetDict(attrKey, updValue)
|
| | | GameWorld.DebugLog(" Add funcIndex=%s,effID=%s,curValue=%s,effA=%s,effB=%s,count=%s,updV=%s"
|
| | | % (funcIndex, effectID, curValue, effValueA, effValueB, addValue, updValue))
|
| | | return
|
| | | return attrIDList
|
| | |
|
| | | ## 加载果实增加的属性缓存,一般是登录或切地图后
|
| | | # @param curPlayer
|