From a303af4186a3055ac7ca5fbaa7ce00e7be757f42 Mon Sep 17 00:00:00 2001
From: xdh <xiefantasy@qq.com>
Date: 星期四, 24 一月 2019 16:50:12 +0800
Subject: [PATCH] 2942 【BUG】【1.5.100】诛仙Boss未显示失败界面 2941 【1.5.100】诛仙背包满后,通关诛仙塔获得装备不会发邮件

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_ZhuXianBoss.py  |   27 +++++--------
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/ItemControler.py                              |   26 +++++++++++++
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_ZhuXianTower.py |   12 +-----
 3 files changed, 38 insertions(+), 27 deletions(-)

diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_ZhuXianBoss.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_ZhuXianBoss.py
index 31ae509..c0902b3 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_ZhuXianBoss.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_ZhuXianBoss.py
@@ -433,7 +433,6 @@
             
     helpItemList = FBCommon.GetFBLineReward(mapID, lineID)
     if helpItemList: #同盟协助奖励
-        needSpace = len(helpItemList)
         jsonItemList = FBCommon.GetJsonItemList(helpItemList)
         for index in range(0 , playerManager.GetPlayerCount()):
             curPlayer = playerManager.GetPlayerByIndex(index)
@@ -442,24 +441,18 @@
                 continue
             if curPlayerID == firstPlayerID:
                 continue
-            if curPlayer.GetFamilyID() != firstPlayerFamilyID:
-                continue
-            remainCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ZhuXianBossHelpCnt)
-            if not remainCnt:
-                continue
-            PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_ZhuXianBossHelpCnt, remainCnt-1)
-            NotifyZXHelpCnt(curPlayer)
             curPlayer.Sync_TimeTick(IPY_GameWorld.tttLeaveMap, 0, leaveTick, True)
-            overDict = {FBCommon.Over_rank:0, FBCommon.Over_itemInfo:jsonItemList}
-            FBCommon.NotifyFBOver(curPlayer, ChConfig.Def_FBMapID_ZhuXianBoss, lineID, isPass, overDict)
-            
-            packSpace = ItemCommon.GetItemPackSpace(curPlayer, IPY_GameWorld.rptItem, needSpace)
-            if needSpace > packSpace:
-                PlayerControl.SendMailByKey('ZXBossHelperReward', [curPlayerID], helpItemList)
+            remainCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ZhuXianBossHelpCnt)
+            if curPlayer.GetFamilyID() == firstPlayerFamilyID and remainCnt:
+                PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_ZhuXianBossHelpCnt, remainCnt-1)
+                NotifyZXHelpCnt(curPlayer)
+                ItemControler.GivePlayerItemOrMail(curPlayer, helpItemList, 'ZXBossHelperReward')
+                overDict = {FBCommon.Over_rank:0, FBCommon.Over_itemInfo:jsonItemList}
+                FBCommon.NotifyFBOver(curPlayer, ChConfig.Def_FBMapID_ZhuXianBoss, lineID, isPass, overDict)
             else:
-                for itemID, itemCount, isBind in helpItemList:
-                    ItemControler.GivePlayerItem(curPlayer, itemID, itemCount, isBind, [IPY_GameWorld.rptItem])
-    
+                overDict = {FBCommon.Over_rank:0}
+                FBCommon.NotifyFBOver(curPlayer, ChConfig.Def_FBMapID_ZhuXianBoss, lineID, 0, overDict)
+            
     return
 
 def GiveZhuXianBossAward(curPlayer, lineID, isMail=False, dropItemMapInfo=[]):
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_ZhuXianTower.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_ZhuXianTower.py
index 72934b1..bf9d933 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_ZhuXianTower.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_ZhuXianTower.py
@@ -477,16 +477,8 @@
         return
     
     # 发邮件或放入背包
-    needSpace = len(prizeItemList)
-    emptySpace = ItemCommon.GetItemPackSpace(curPlayer, IPY_GameWorld.rptItem, needSpace)
-    isSendMail = int(needSpace > emptySpace)  # 是否发送邮件
-    if isSendMail:
-        PlayerControl.SendMailByKey('KillGodTowerReward', [curPlayer.GetPlayerID()], prizeItemList)
-        GameWorld.DebugLog("背包空间不够,发送邮件: mailItemList=%s" % str(prizeItemList), curPlayer.GetPlayerID())
-    else:
-        for itemID, itemCnt, isBind in prizeItemList:
-            ItemControler.GivePlayerItem(curPlayer, itemID, itemCnt, isBind, [IPY_GameWorld.rptItem],
-                                            event=["ZhuXianTower", False, {}])
+    ItemControler.GivePlayerItemOrMail(curPlayer, prizeItemList, 'KillGodTowerReward', ["ZhuXianTower", False, {}])
+    
     #首次S级不扣次数,非S级给奖励扣次数,非首次S扣次数
     if not isFirstPass:
         FBCommon.AddEnterFBCount(curPlayer, ChConfig.Def_FBMapID_ZhuXianTower, 1)
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/ItemControler.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/ItemControler.py
index 47c70b3..64a20a5 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/ItemControler.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/ItemControler.py
@@ -2756,4 +2756,30 @@
             itemID, isBind = keyStr.split('_')
             itemList.append([int(itemID), giveCnt, int(isBind)])
         PlayerControl.SendMailByKey(mailKey, [curPlayer.GetID()], itemList)
+    return
+
+def GivePlayerItemOrMail(curPlayer, itemList, mailKey=None, event=["", False, {}]):
+    ##给物品,背包满则发邮件
+    needPackSpaceDict = {}
+    for itemID, itemCnt, isBind in itemList:
+        curItem = GameWorld.GetGameData().GetItemByTypeID(itemID)
+        if not curItem:
+            GameWorld.ErrLog('GivePlayerItemOrMail 物品ID不存在 itemID=%s'%itemID, curPlayer.GetID())
+            return
+        packType = ChConfig.GetItemPackType(curItem.GetType())
+        needSpace = GetItemNeedPackCount(packType, curItem, itemCnt)
+        needPackSpaceDict[packType] = needPackSpaceDict.get(packType, 0) + needSpace
+    isSendMail = False
+    for packType, needSpace in needPackSpaceDict.items():
+        if needSpace > ItemCommon.GetItemPackSpace(curPlayer, packType, needSpace):
+            isSendMail = True
+            break
+           
+    if isSendMail:
+        PlayerControl.SendMailByKey(mailKey, [curPlayer.GetPlayerID()], itemList)
+        GameWorld.DebugLog("GivePlayerItemOrMail背包空间不够,发送邮件: mailItemList=%s" % str(itemList), curPlayer.GetPlayerID())
+    else:
+        for itemID, itemCnt, isBind in itemList:
+            GivePlayerItem(curPlayer, itemID, itemCnt, isBind, [IPY_GameWorld.rptItem],
+                                            event=event)
     return
\ No newline at end of file

--
Gitblit v1.8.0