From 2a54477d35896bd3f1bd6f48e222a438034a11b9 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期一, 27 十二月 2021 12:28:44 +0800
Subject: [PATCH] 5323 【主干】【后端】法器自动培养问题(自动购买支持按指定的商城表商品标识ID购买)

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventSrc/FunctionNPCCommon.py |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventSrc/FunctionNPCCommon.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventSrc/FunctionNPCCommon.py
index ddcfb1c..1baa9a2 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventSrc/FunctionNPCCommon.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventSrc/FunctionNPCCommon.py
@@ -531,9 +531,11 @@
     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 = {}
@@ -547,12 +549,17 @@
         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:

--
Gitblit v1.8.0