| | |
| | | SyncTreeInfo(curPlayer)
|
| | | return
|
| | |
|
| | | #// B2 24 使用仙树升级减时物品 #tagCMUseTreeLVUPTimeItem
|
| | | #
|
| | | #struct tagCMUseTreeLVUPTimeItem
|
| | | #{
|
| | | # tagHead Head;
|
| | | # DWORD UseCount; // 使用个数
|
| | | # BYTE IsAutoBuy; // 不足个数是否自动购买
|
| | | #};
|
| | | def OnUseTreeLVUPTimeItem(index, clientData, tick):
|
| | | curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
|
| | | useCount = clientData.UseCount
|
| | | isAutoBuy = clientData.IsAutoBuy
|
| | | |
| | | playerID = curPlayer.GetPlayerID()
|
| | | lvupState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TreeLVUPState)
|
| | | LVUPRemainTime = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TreeLVUPRemainTime)
|
| | | if not lvupState or not LVUPRemainTime:
|
| | | GameWorld.DebugLog("仙树非升级中或剩余时间为0,不需要减少时间! lvupState=%s,LVUPRemainTime=%s" |
| | | % (lvupState, LVUPRemainTime), playerID)
|
| | | return
|
| | | |
| | | costItemID, reduceSeconds = IpyGameDataPY.GetFuncEvalCfg("TreeLVUP", 2)
|
| | | GameWorld.DebugLog("使用仙树升级减时物品! costItemID=%s,reduceSeconds=%s,useCount=%s" % (costItemID, reduceSeconds, useCount), playerID)
|
| | | if not costItemID or not useCount:
|
| | | return
|
| | | |
| | | costItemIndexList, bindCnt, unBindCnt = ItemCommon.GetPackItemBindStateIndexInfo(curPlayer, costItemID, useCount)
|
| | | lackCnt = useCount - bindCnt - unBindCnt
|
| | | if lackCnt > 0 and not isAutoBuy:
|
| | | GameWorld.DebugLog("消耗道具不足! costItemID=%s,useCount=%s,bindCnt=%s,unBindCnt=%s,lackCnt=%s" |
| | | % (costItemID, useCount, bindCnt, unBindCnt, lackCnt), playerID)
|
| | | return
|
| | | |
| | | delCnt = useCount
|
| | | if lackCnt > 0:
|
| | | moneyType = IPY_GameWorld.TYPE_Price_Gold_Money
|
| | | lackCost = ItemCommon.GetAutoBuyItemNeedGold({costItemID:lackCnt})
|
| | | if lackCost <= 0:
|
| | | return
|
| | | GameWorld.DebugLog("自动购买道具: lackCnt=%s,moneyType=%s,lackCost=%s" % (lackCnt, moneyType, lackCost), playerID)
|
| | | infoDict = {ChConfig.Def_Cost_Reason_SonKey:costItemID}
|
| | | if not PlayerControl.PayMoney(curPlayer, moneyType, lackCost, ChConfig.Def_Cost_BuyStoreItem, infoDict):
|
| | | return
|
| | | delCnt -= lackCnt
|
| | | |
| | | # 扣除消耗
|
| | | if delCnt:
|
| | | ItemCommon.DelCostItemByBind(curPlayer, costItemIndexList, bindCnt, unBindCnt, delCnt, "TreeLVUPTimeItem")
|
| | | |
| | | reduceTime = reduceSeconds * useCount
|
| | | ReduceTreeLVUPTime(curPlayer, reduceTime)
|
| | | return
|
| | |
|
| | | def RefreshTreeLVUPTime(curPlayer):
|
| | | ## 刷新仙树升级剩余时间
|
| | | lvupState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TreeLVUPState)
|