From 8a5cd920235eefda418bba0e949ba522cab72a4c Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期四, 11 八月 2022 16:18:29 +0800
Subject: [PATCH] 9685 【后台】开服时间整合(清档完毕后入库存档)

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/UseItem/Item_Chests.py |   49 ++++++++++++++++++++++++++++++++-----------------
 1 files changed, 32 insertions(+), 17 deletions(-)

diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/UseItem/Item_Chests.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/UseItem/Item_Chests.py
index aa034f3..c8b0ebe 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/UseItem/Item_Chests.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/UseItem/Item_Chests.py
@@ -25,6 +25,7 @@
 import PlayerRune
 import NPCCommon
 import ChConfig
+import ChEquip
 import ChItem
 
 import random
@@ -40,14 +41,16 @@
         return
     
     showType = chestsIpyData.GetShowType() # 规定有开箱表现的默认只能开启1个
-    if showType:
-        useCnt = 1
-        
+    #if showType:
+    #    useCnt = 1
+    useCnt = min(curRoleItem.GetCount(), useCnt)
+    
     isBind = int(chestsIpyData.GetIsBind()) # 奖励物品是否绑定
     costItemID = chestsIpyData.GetCostItemID()
     costItemCountTotal = chestsIpyData.GetCostItemCount() * useCnt
     costGoldTotal = chestsIpyData.GetCostGold() * useCnt
     auctionItemCanSell = chestsIpyData.GetAucionItemCanSell()
+    aucionItemDiffSellIDList = chestsIpyData.GetAucionItemDiffSellIDList()
     
     if costGoldTotal and not PlayerControl.HaveMoney(curPlayer, IPY_GameWorld.TYPE_Price_Gold_Money, costGoldTotal):
         return
@@ -66,8 +69,8 @@
     if not awardInfo:
         return
     needSpaceDict, jobAwardItemList, moneyType, moneyCount, notifyItemList, updOpenCount = awardInfo
-    GameWorld.DebugLog("    needSpaceDict=%s,jobAwardItemList=%s,moneyType=%s,moneyCount=%s,notifyItemList=%s,updOpenCount=%s,auctionItemCanSell=%s" 
-                       % (needSpaceDict, jobAwardItemList, moneyType, moneyCount, notifyItemList, updOpenCount, auctionItemCanSell))
+    GameWorld.DebugLog("    needSpaceDict=%s,jobAwardItemList=%s,moneyType=%s,moneyCount=%s,notifyItemList=%s,updOpenCount=%s,auctionItemCanSell=%s,aucionItemDiffSellIDList=%s" 
+                       % (needSpaceDict, jobAwardItemList, moneyType, moneyCount, notifyItemList, updOpenCount, auctionItemCanSell, aucionItemDiffSellIDList))
     
     for packType, needSpace in needSpaceDict.items():
         packSpace = ItemCommon.GetItemPackSpace(curPlayer, packType, needSpace)
@@ -94,7 +97,8 @@
     # 给奖励
     syncItemList = []
     for itemID, itemCount in jobAwardItemList:
-        isAuctionItem = 1 if auctionItemCanSell and IpyGameDataPY.GetIpyGameDataNotLog("AuctionItem", itemID) else 0
+        canSell = (not auctionItemCanSell) if itemID in aucionItemDiffSellIDList else auctionItemCanSell
+        isAuctionItem = 1 if canSell and IpyGameDataPY.GetIpyGameDataNotLog("AuctionItem", itemID) else 0
         curItem = ItemControler.GetOutPutItemObj(itemID, itemCount, isAuctionItem, curPlayer=curPlayer)
         if not curItem:
             GameWorld.ErrLog("宝箱创建奖励物品异常!chestsItemID=%s,useCnt=%s,itemID=%s,itemCount=%s,isBind=%s" 
@@ -224,7 +228,7 @@
         if not itemData:
             GameWorld.ErrLog("宝箱奖励物品不存在! chestsItemID=%s,itemID=%s,jobItemID=%s" % (chestsItemID, itemID, jobItemID))
             return
-        packType = ChConfig.GetItemPackType(itemData.GetType())
+        packType = ChConfig.GetItemPackType(itemData)
         needSpace = int(math.ceil(itemCount / float(itemData.GetPackCount())))
         needSpaceDict[packType] = needSpaceDict.get(packType, 0) + needSpace
         
@@ -334,7 +338,6 @@
                 
     GameWorld.DebugLog("装备库产出: dropEquipInfoList=%s" % dropEquipInfoList)
     
-    placeKeyListDict = IpyGameDataPY.GetFuncCfg("EquipDropPartSets", 1)
     colorSuitRateDict = awardIpyData.GetEquipColorSuitInfo() # 装备颜色对应套装概率 {颜色:套装概率, ...}
     colorSuitPlaceKeyInfoDict = awardIpyData.GetEquipPartKeyRateInfo() # 装备部位集合信息 {(颜色,是否套装):部位集合key, ...}
     for classLV, color in dropEquipInfoList:
@@ -348,10 +351,15 @@
             continue
         placeKey = colorSuitPlaceKeyInfoDict[colorSuitKey]
         jobList = itemJobList
-        if placeKey not in placeKeyListDict:
+        placeList = NPCCommon.GetEquipPlaceByPlaceKey(placeKey)
+        if not placeList:
             GameWorld.ErrLog("部位集合key不存在!chestsItemID=%s,placeKey=%s" % (chestsItemID, placeKey))
             continue
-        placeList = placeKeyListDict[placeKey]
+        # 未指定,默认取当前解锁的最大境界装备阶
+        if classLV == 0:
+            classLV = ChEquip.GetPlayerMaxEquipClassLV(curPlayer)
+            GameWorld.DebugLog("    未指定装备阶,默认取玩家当前解锁的最大阶: classLV=%s" % classLV)
+            
         randEquipIDList = NPCCommon.__GetEquipIDList(chestsItemID, classLV, color, isSuit, placeList, itemJobList, findType="ChestsItem")
         if not randEquipIDList:
             continue
@@ -391,19 +399,26 @@
     # 多条产出记录的,按等级来
     lvIpyDataList = []
     for ipyData in awardIpyDataList:
-        lvIpyDataList.append([ipyData.GetAwardLV(), ipyData])
+        lvIpyDataList.append([ipyData.GetRealmLV(), ipyData.GetAwardLV(), ipyData])
     lvIpyDataList.sort() # 升序排序
     
     curLV = curPlayer.GetLV()
-    minLV = lvIpyDataList[0][0]
+    curRealmLV = curPlayer.GetOfficialRank()
+    minRealmLV, minLV = lvIpyDataList[0][0], lvIpyDataList[0][1]
     if curLV < minLV:
-        GameWorld.ErrLog("当前等级无法开启该宝箱!curLV=%s,minLV=%s,chestsItemID=%s" % (curLV, minLV, chestsItemID), curPlayer.GetPlayerID())
+        GameWorld.ErrLog("当前等级无法开启该宝箱!curLV=%s < minLV=%s,chestsItemID=%s" % (curLV, minLV, chestsItemID), curPlayer.GetPlayerID())
+        return
+    if curRealmLV < minRealmLV:
+        GameWorld.ErrLog("当前境界无法开启该宝箱!curRealmLV=%s < minRealmLV=%s,chestsItemID=%s" % (curRealmLV, minRealmLV, chestsItemID), curPlayer.GetPlayerID())
         return
     
     for i, lvIpyInfo in enumerate(lvIpyDataList[1:], 1):
-        awardLV, ipyData = lvIpyInfo
-        if curLV < awardLV:
-            awardLV, ipyData = lvIpyDataList[i - 1]
-            return ipyData
+        realmLV, awardLV, ipyData = lvIpyInfo
+        if realmLV: # 境界优先,二选一
+            if curRealmLV < realmLV:
+                return lvIpyDataList[i - 1][-1]
+        else:
+            if curLV < awardLV:
+                return lvIpyDataList[i - 1][-1]
     return awardIpyDataList[-1]
 

--
Gitblit v1.8.0