5323 【主干】【后端】法器自动培养问题(自动购买支持按指定的商城表商品标识ID购买)
| | |
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_DelPackIndex, int(itemIndexs))
|
| | | return
|
| | |
|
| | | def PayAutoBuyItem(curPlayer, lackItemDict, priceType, costType=ChConfig.Def_Cost_Unknown, infoDict={}, isCheck=False):
|
| | | def PayAutoBuyItem(curPlayer, lackItemDict, priceType, costType=ChConfig.Def_Cost_Unknown, infoDict={}, isCheck=False, shopItemIndexDict=None):
|
| | | ''' 支付自动购买物品消耗,从商城中购买,直接扣钱,不产生物品
|
| | | 一般用于基础商店自动购买物品,不考虑复杂的限购逻辑
|
| | | @param isCheck: 是否只是检查,不执行实际消耗逻辑
|
| | | @param shopItemIndexDict: 指定购买的商品对应商城表商品ID索引字典,如果没有指定商品索引,则按消耗的价格类型自动搜索商城表
|
| | | '''
|
| | |
|
| | | addLimitCountInfo = {}
|
| | |
| | | if not curItem:
|
| | | return
|
| | |
|
| | | ipyData = ItemCommon.GetShopItemPriceIpyData(itemID, priceType)
|
| | | if shopItemIndexDict and itemID in shopItemIndexDict:
|
| | | itemIndex = shopItemIndexDict[itemID]
|
| | | ipyData = IpyGameDataPY.GetIpyGameData("Store", itemIndex)
|
| | | else:
|
| | | ipyData = ItemCommon.GetShopItemPriceIpyData(itemID, priceType)
|
| | | if not ipyData:
|
| | | return
|
| | |
|
| | | itemIndex = ipyData.GetID()
|
| | | shopType = ipyData.GetShopType()
|
| | | priceType = ipyData.GetMoneyType()
|
| | | itemMoney = ipyData.GetMoneyNum()
|
| | | limitCntList = ipyData.GetLimitCnt()
|
| | | if limitCntList:
|
| | |
| | | return
|
| | |
|
| | | costItemID = IpyGameDataPY.GetFuncCfg("FaQiUpItem", 1)
|
| | | autoBuyShopIndex = IpyGameDataPY.GetFuncCfg("FaQiUpItem", 2)
|
| | | if not costItemID or not costItemCount:
|
| | | return
|
| | |
|
| | |
| | | if lackCnt > 0:
|
| | | autoBuyMoneyType = IPY_GameWorld.TYPE_Price_Gold_Money
|
| | | infoDict = {ChConfig.Def_Cost_Reason_SonKey:costItemID}
|
| | | if not FunctionNPCCommon.PayAutoBuyItem(curPlayer, {costItemID:lackCnt}, autoBuyMoneyType, ChConfig.Def_Cost_FaQi, infoDict):
|
| | | if not FunctionNPCCommon.PayAutoBuyItem(curPlayer, {costItemID:lackCnt}, autoBuyMoneyType, ChConfig.Def_Cost_FaQi, infoDict, shopItemIndexDict={costItemID:autoBuyShopIndex}):
|
| | | return
|
| | | delCnt -= lackCnt
|
| | |
|