From 2b1f9e7dcc20440576ee63014e0080a529ab0486 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期四, 14 一月 2021 18:31:22 +0800
Subject: [PATCH] 4908 【BT】【主干】gameserver realtime备份过大导致卡顿(优化拍品记录保存期限;输出自定义表存档大小);

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_GatherSoul.py |   67 ++++++++++++++++++++++-----------
 1 files changed, 45 insertions(+), 22 deletions(-)

diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_GatherSoul.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_GatherSoul.py
index e99d2ec..aef14af 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_GatherSoul.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_GatherSoul.py
@@ -153,6 +153,7 @@
     else:
         return
     DoFBHelp(curPlayer, tick)
+    curPlayer.SetFaction(ShareDefine.CampType_Justice)
     return
 
 
@@ -196,16 +197,16 @@
         guardDict[npcid] = gameFB.GetGameFBDictByKey(FBPlayerDict_GuardNPCCnt%npcid)
     hasRefreshBoss = gameFB.GetGameFBDictByKey(FBPlayerDict_HasRefreshBoss)
     isAutoBoss = gameFB.GetGameFBDictByKey(FBPlayerDict_AutoBoss)
-
-    itemDict = PyGameData.g_gathersoulfbAwardDict.get(curPlayer.GetID(), {})
+    lineID = GameWorld.GetGameWorld().GetLineID()
+    itemDict = PyGameData.g_gathersoulfbAwardDict.get(lineID, {})
     helpItemInfo = {}
-    for wheel, itemList in itemDict:
+    for wheel, itemList in itemDict.items():
         helpItemInfo[str(wheel)] = FBCommon.GetJsonItemList(itemList)
     helpDict = {FBCommon.Help_wheel:curWheel, 
                 FBCommon.Help_step:fbStep, 
                 FBCommon.Help_npc:FBCommon.GetJsonNPCKillList(guardDict),
                 FBCommon.Help_isAuto:isAutoBoss,
-                FBCommon.Help_isAuto:hasRefreshBoss,
+                FBCommon.Help_hasRefreshBoss:hasRefreshBoss,
                 FBCommon.Help_gsItemInfo:helpItemInfo,
                 }
     #副本帮助
@@ -413,6 +414,8 @@
     NPCCustomRefresh.SetNPCRefresh(gatherSoulFBCfg[Def_BuildMark], [(guardNPCID, 1)], 1, 1)
     key = FBPlayerDict_GuardNPCCnt % guardNPCID
     gameFB.SetGameFBDict(key, gameFB.GetGameFBDictByKey(key) + 1)
+    gameFB.SetGameFBDict(FBPlayerDict_GuardNPCID, 0)
+    DoFBHelp(curPlayer, tick)
     return
 
 
@@ -484,8 +487,12 @@
     if gameFB.GetGameFBDictByKey(FBPlayerDict_HasRefreshBoss):
         #本波已刷黄金BOSS
         return
-    
     gatherSoulFBCfg = GetGatherSoulFBCfg()
+    lastWheelEndTime = gameFB.GetGameFBDictByKey(FBPlayerDict_LastWheelEndTime)
+    if lastWheelEndTime and tick - lastWheelEndTime < gatherSoulFBCfg[Def_WheelRefreshCD]:
+        return
+    
+    
     costMoney = gatherSoulFBCfg[Def_BossCostMoney]
     costMoneyList = PlayerControl.HaveMoneyEx(curPlayer, ShareDefine.TYPE_Price_Gold_Paper_Money, costMoney, False)
     if not costMoneyList:
@@ -533,12 +540,13 @@
     ##掉落奖励 {wheel:[[itemid,itemCnt,isBind]]}
     gameFB = GameWorld.GetGameFB()
     curWheel = gameFB.GetGameFBDictByKey(FBPlayerDict_CurWheel) + 1
-    ownerID = gameFB.GetGameFBDictByKey(ChConfig.Def_FB_SingleFBPlayerID)
-    if ownerID not in PyGameData.g_gathersoulfbAwardDict:
-        PyGameData.g_gathersoulfbAwardDict[ownerID] = {}
-    if curWheel not in PyGameData.g_gathersoulfbAwardDict[ownerID]:
-        PyGameData.g_gathersoulfbAwardDict[ownerID][curWheel] = []
-    PyGameData.g_gathersoulfbAwardDict[ownerID][curWheel].append([itemID, itemCnt, isBind])
+    #ownerID = gameFB.GetGameFBDictByKey(ChConfig.Def_FB_SingleFBPlayerID)
+    lineID = GameWorld.GetGameWorld().GetLineID()
+    if lineID not in PyGameData.g_gathersoulfbAwardDict:
+        PyGameData.g_gathersoulfbAwardDict[lineID] = {}
+    if curWheel not in PyGameData.g_gathersoulfbAwardDict[lineID]:
+        PyGameData.g_gathersoulfbAwardDict[lineID][curWheel] = []
+    PyGameData.g_gathersoulfbAwardDict[lineID][curWheel].append([itemID, itemCnt, isBind])
     curPlayer = FBCommon.GetCurSingleFBPlayer()
     if curPlayer:
         DoFBHelp(curPlayer, 0)
@@ -554,7 +562,8 @@
     # 进入离开阶段
     FBCommon.SetFBStep(FB_Step_Over, tick)
     ownerID = gameFB.GetGameFBDictByKey(ChConfig.Def_FB_SingleFBPlayerID)
-    itemDict = PyGameData.g_gathersoulfbAwardDict.pop(ownerID, {})
+    lineID = GameWorld.GetGameWorld().GetLineID()
+    itemDict = PyGameData.g_gathersoulfbAwardDict.pop(lineID, {})
     totalItemList = []
     for itemList in itemDict.values():
         totalItemList += itemList
@@ -562,20 +571,34 @@
     curPlayer = FBCommon.GetCurSingleFBPlayer()
     if not curPlayer:
         #奖励直接发邮件
-        PlayerControl.SendMailByKey('JHBagFull2', [ownerID], totalItemList)
+        if totalItemList:
+            PlayerControl.SendMailByKey('JHBagFull2', [ownerID], totalItemList)
         
         GameWorldProcess.CloseFB(tick)
         return
-    needSpace = len(totalItemList)
-    emptySpace = ItemCommon.GetItemPackSpace(curPlayer, ShareDefine.rptGatherSoul, needSpace)
-    isSendMail = int(needSpace > emptySpace) # 是否发送邮件
-    if isSendMail:
-        PlayerControl.SendMailByKey('JHBagFull2', [curPlayer.GetPlayerID()], totalItemList)
-        GameWorld.DebugLog("背包空间不够,发送邮件: mailItemList=%s" % str(totalItemList), curPlayer.GetPlayerID())
-    else:
+    if totalItemList:
+        needPackSpaceDict = {}
         for itemID, itemCnt, isBind in totalItemList:
-            ItemControler.GivePlayerItem(curPlayer, itemID, itemCnt, isBind, [ShareDefine.rptGatherSoul],
-                                            event=["GatherSoulFB", False, {}])
+            curItem = GameWorld.GetGameData().GetItemByTypeID(itemID)
+            if not curItem:
+                return
+            packType = ChConfig.GetItemPackType(curItem.GetType())
+            needSpace = ItemControler.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('JHBagFull2', [curPlayer.GetPlayerID()], totalItemList)
+            GameWorld.DebugLog("背包空间不够,发送邮件: mailItemList=%s" % str(totalItemList), curPlayer.GetPlayerID())
+        else:
+            for itemID, itemCnt, isBind in totalItemList:
+                ItemControler.GivePlayerItem(curPlayer, itemID, itemCnt, 0, [],
+                                                event=["GatherSoulFB", False, {}])
             
     fbCfg = GetGatherSoulFBCfg()
     costTime = tick - GameWorld.GetGameWorld().GetOpenFBTick()

--
Gitblit v1.8.0