| | |
| | | Sync_AttrFruitEatCnt(curPlayer, [itemID])
|
| | |
|
| | | # 增加属性
|
| | | attrIDList = __AddFruitAttr(curPlayer, itemID, funcIndex, addValue)
|
| | | __AddFruitAttr(curPlayer, itemID, funcIndex, addValue)
|
| | |
|
| | | # 刷新属性
|
| | | __RefreshAttr(curPlayer, funcIndex)
|
| | |
| | | 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
|
| | |
|
| | |
| | | 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)
|
| | |
| | |
|
| | | #[属性索引, 是否基础属性,(非)线性]
|
| | | attrInfo = ChConfig.ItemEffect_AttrDict.get(effPerID, [])
|
| | | if attrInfo == []:
|
| | | if attrInfo is []:
|
| | | return
|
| | |
|
| | | addAttrList = attrInfo[0]
|
| | |
| | | # @param curPlayer
|
| | | # @param fruitItemID
|
| | | # @return None
|
| | | def Sync_AttrFruitEatCnt(curPlayer, fruitItemIDList=[]):
|
| | | def Sync_AttrFruitEatCnt(curPlayer, fruitItemIDList=None):
|
| | |
|
| | | eatPack = ChPyNetSendPack.tagMCAttrFruitEatCntList()
|
| | | eatPack.Clear()
|
| | | eatPack.EatCntList = []
|
| | | if fruitItemIDList == []:
|
| | | if fruitItemIDList is None:
|
| | | itemidList = []
|
| | | ipyDataMgr = IpyGameDataPY.IPY_Data()
|
| | | maxCnt = ipyDataMgr.GetAttrFruitCount()
|
| | |
| | | eatCntPack.Clear()
|
| | | eatCntPack.ItemID = fruitItemID
|
| | | eatCntPack.EatCnt = curPlayer.NomalDictGetProperty(eatCntKey)
|
| | | eatCntPack.AddItemCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_AttrFruitAddItemCnt % fruitItemID)
|
| | | eatCntPack.ItemAddCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_AttrFruitAddItemCnt % fruitItemID)
|
| | | eatCntPack.ItemBreakCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_AttrFruitItemBreakCnt % fruitItemID)
|
| | | eatPack.EatCntList.append(eatCntPack)
|
| | |
|
| | | eatPack.count = len(eatPack.EatCntList)
|
| | |
| | | maxEatCnt = maxEatCntDict[order]
|
| | | break
|
| | | addItemUseCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_AttrFruitAddItemCnt % itemID)
|
| | | if addItemUseCnt:
|
| | | addItemInfo = ipyData.GetAddItemInfo()
|
| | | if addItemInfo:
|
| | | singleItemCnt, singleAddCnt = addItemInfo[1:]
|
| | | maxEatCnt += (addItemUseCnt/singleItemCnt*singleAddCnt)
|
| | | maxEatCnt += addItemUseCnt
|
| | | return maxEatCnt
|
| | |
|
| | |
|
| | |
| | | ipyData = GetAttrFruitIpyData(itemID)
|
| | | if not ipyData:
|
| | | return
|
| | | addItemInfo = ipyData.GetAddItemInfo()
|
| | | if not addItemInfo:
|
| | | addItemInfoList = ipyData.GetAddItemInfo()
|
| | | if not addItemInfoList:
|
| | | return
|
| | | addItemUseCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_AttrFruitAddItemCnt % itemID)
|
| | | needItemID, singleItemCnt, singleAddCnt = addItemInfo
|
| | | if addItemUseCnt + singleItemCnt> ChConfig.Def_UpperLimit_DWord:
|
| | | itemBreakCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_AttrFruitItemBreakCnt % itemID)
|
| | | itemAddUseCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_AttrFruitAddItemCnt % itemID)
|
| | | needUseCnt = canUpCnt = 0
|
| | | for breakCnt, useCnt, upCnt in addItemInfoList:
|
| | | if itemBreakCnt >= breakCnt:
|
| | | continue
|
| | | needUseCnt, canUpCnt = useCnt, upCnt
|
| | | break
|
| | | if not needUseCnt:
|
| | | return
|
| | |
|
| | | needItemID = IpyGameDataPY.GetFuncCfg('AlchemyOverLimit')
|
| | | if itemAddUseCnt + canUpCnt> ChConfig.Def_UpperLimit_DWord:
|
| | | return
|
| | | itemPack = curPlayer.GetItemManager().GetPack(IPY_GameWorld.rptItem)
|
| | | enough, indexList, hasBind, lackCnt = ItemCommon.GetItem_FromPack_ByID_ExEx(needItemID, itemPack, singleItemCnt)
|
| | | enough, indexList, hasBind, lackCnt = ItemCommon.GetItem_FromPack_ByID_ExEx(needItemID, itemPack, needUseCnt)
|
| | | if not enough:
|
| | | return
|
| | | ItemCommon.ReduceItem(curPlayer, itemPack, indexList, singleItemCnt, False, "AddFruitUseLimit")
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_AttrFruitAddItemCnt % itemID, addItemUseCnt+singleItemCnt)
|
| | | |
| | | ItemCommon.ReduceItem(curPlayer, itemPack, indexList, needUseCnt, False, "AddFruitUseLimit")
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_AttrFruitAddItemCnt % itemID, itemAddUseCnt+canUpCnt)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_AttrFruitItemBreakCnt % itemID,
|
| | | itemBreakCnt + 1)
|
| | | Sync_AttrFruitEatCnt(curPlayer, [itemID])
|
| | | return
|