From ec5de0b415bb3fd2c12367b1babfe0d4351a2827 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期二, 17 三月 2026 15:03:38 +0800
Subject: [PATCH] 405 【公会】自动转让会长规则调整(优化优先传位配置;优化跨服邮件发送;)

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventSrc/FunctionNPCCommon.py |   42 +++++++++++++++++++++++++++++++-----------
 1 files changed, 31 insertions(+), 11 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 c19100c..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
@@ -55,7 +55,6 @@
 import PlayerControl
 import IpyGameDataPY
 import ItemCommon
-import ObjPool
 
 # 重置类型
 ResetType_Day = 1
@@ -118,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()
@@ -244,7 +252,9 @@
     totalItemList = []
     if itemID:
         totalItemList.append([itemID, itemCount * clientBuyCount, isBind])
-    for itemIDEx, itemCountEx, isBindEx in itemListEx:
+    for itemEx in itemListEx:
+        itemIDEx, itemCountEx = itemEx[:2]
+        isBindEx = itemEx[2] if len(itemEx) > 2 else 0
         totalItemList.append([itemIDEx, itemCountEx * clientBuyCount, isBindEx])
     if not totalItemList:
         GameWorld.ErrLog("Store shop item error! shopType=%s,shopID=%s" % (shopType, shopID), curPlayer.GetPlayerID())
@@ -257,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):
@@ -264,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)
@@ -405,7 +426,7 @@
             syncIDList.append(shopID)
     if not syncIDList:
         return
-    clientPack = ObjPool.GetPoolMgr().acquire(ChPyNetSendPack.tagSCShopRefreshItemInfo)
+    clientPack = ChPyNetSendPack.tagSCShopRefreshItemInfo()
     clientPack.ShopType = shopType
     clientPack.RefreshCnt = min(curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ShopRefreshCnt % shopType), 250)
     clientPack.ShopIDList = syncIDList
@@ -416,11 +437,10 @@
 def SyncShopItemBuyCntInfo(curPlayer, syncIDList=[]):
     ##同步商品购买次数
     
-    objPool = ObjPool.GetPoolMgr()
     buyCntList = []
     if syncIDList:
         for shopID in syncIDList:
-            buyInfo = objPool.acquire(ChPyNetSendPack.tagSCShopItemBuyCnt)
+            buyInfo = ChPyNetSendPack.tagSCShopItemBuyCnt()
             buyInfo.ShopID = shopID
             buyInfo.BuyCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ShopBuyCnt % shopID)
             buyCntList.append(buyInfo)
@@ -434,7 +454,7 @@
             buyCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ShopBuyCnt % shopID)
             if buyCnt <= 0:
                 continue
-            buyInfo = objPool.acquire(ChPyNetSendPack.tagSCShopItemBuyCnt)
+            buyInfo = ChPyNetSendPack.tagSCShopItemBuyCnt()
             buyInfo.ShopID = shopID
             buyInfo.BuyCnt = buyCnt
             buyCntList.append(buyInfo)
@@ -442,7 +462,7 @@
     if not buyCntList:
         return
     
-    clientPack = objPool.acquire(ChPyNetSendPack.tagSCShopItemBuyCntInfo)
+    clientPack = ChPyNetSendPack.tagSCShopItemBuyCntInfo()
     clientPack.BuyCntList = buyCntList
     clientPack.Count = len(clientPack.BuyCntList)
     NetPackCommon.SendFakePack(curPlayer, clientPack)

--
Gitblit v1.8.0