From 5d79b486b2974522c2d1978dc90c3081827224e0 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期四, 26 二月 2026 15:46:46 +0800
Subject: [PATCH] 493 【活动内容】武将登场-服务端

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventSrc/FunctionNPCCommon.py |   28 ++++++++++++++++++++++++----
 1 files changed, 24 insertions(+), 4 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 80d38e8..cba53e5 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
@@ -117,16 +117,25 @@
         SyncShopItemBuyCntInfo(curPlayer, syncIDList)
     return
 
-def ResetShopItemBuyCountByShopType(curPlayer, shopTypeList):
+def ResetShopItemBuyCountByShopType(curPlayer, shopTypeList, recycleItemMail=""):
     ##根据商店类型重置商店限购物品次数
+    # @param recycleItemMail: 商店消耗物品回收通知邮件,为空时不回收
     if not shopTypeList:
         return
+    recycleCostItemIDList = []
     syncIDList = []
     for shopType in shopTypeList:
         ipyDataList = IpyGameDataPY.GetIpyGameDataByCondition("Store", {"ShopType":shopType}, True, True)
         if not ipyDataList:
             continue
         for ipyData in ipyDataList:
+            
+            # 消耗道具回收
+            costItemID = ipyData.GetCostItemID()
+            if recycleItemMail and costItemID and costItemID not in recycleCostItemIDList:
+                recycleCostItemIDList.append(costItemID)
+                ItemControler.RecycleItem(curPlayer, costItemID, recycleItemMail)
+                
             if not ipyData.GetLimitCnt():
                 continue
             shopID = ipyData.GetID()
@@ -258,6 +267,7 @@
         GameWorld.Log("Store shop item lock! shopID=%s,shopID=%s" % (shopType, shopID), curPlayer.GetPlayerID())
         return
     
+    costItemID = ipyData.GetCostItemID()
     priceType, itemPrice = ipyData.GetMoneyType(), ipyData.GetMoneyNum()
     itemPrice *= clientBuyCount
     #if not PlayerControl.HaveMoney(curPlayer, priceType, itemPrice):
@@ -265,9 +275,19 @@
     
     infoDict = {"TotalItemList":totalItemList, "ClientBuyCount":clientBuyCount, "ShopType":shopType,
                 "ShopID":shopID, ChConfig.Def_Cost_Reason_SonKey:mainItemID}
-    if priceType and itemPrice and not PlayerControl.PayMoney(curPlayer, priceType, itemPrice, ChConfig.Def_Cost_BuyStoreItem, infoDict, clientBuyCount):
-        return
-    
+    # 支持消耗货币或道具二选一
+    if priceType:
+        if itemPrice and not PlayerControl.PayMoney(curPlayer, priceType, itemPrice, ChConfig.Def_Cost_BuyStoreItem, infoDict, clientBuyCount):
+            return
+    elif costItemID and itemPrice:
+        needItemCnt = itemPrice
+        costItemIndexList, bindCnt, unBindCnt = ItemCommon.GetPackItemBindStateIndexInfo(curPlayer, costItemID, needItemCnt)
+        lackCnt = needItemCnt - bindCnt - unBindCnt
+        if lackCnt > 0:
+            GameWorld.DebugLog("所需消耗道具不足! costItemID=%s,needItemCnt=%s,lackCnt=%s" % (costItemID, needItemCnt, lackCnt))
+            return
+        ItemCommon.DelCostItemByBind(curPlayer, costItemIndexList, bindCnt, unBindCnt, needItemCnt, "BuyItem")
+        
     # 今日购买次数+1
     if limitBuyCnt > 0:
         updBuyCnt = min(curBuyCnt + clientBuyCount, ChConfig.Def_UpperLimit_DWord)

--
Gitblit v1.8.0