From b4b72d0c241ffc26dbbbd7a047578f1f4fead2f4 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期四, 09 十二月 2021 16:11:53 +0800
Subject: [PATCH] 9341 【BT5】【主干】【后端】情缘系统(Couple命令增加添加喜糖宴会;修复多个喜糖宴会同时存在时吃喜糖同步错误bug)

---
 ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerLove.py |   45 ++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 44 insertions(+), 1 deletions(-)

diff --git a/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerLove.py b/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerLove.py
index 395be4e..019ac6e 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerLove.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerLove.py
@@ -582,6 +582,45 @@
     PyGameData.g_marryReqInfo.pop(playerID, None) # 可能存在相互提亲的情况,尝试顺便把自身的提亲请求删除,因为已经无用了
     return True
 
+def GMAddCandy(curPlayer, bridePriceID, addCount):
+    ## GM添加测试喜糖宴会
+    fakeID = 0
+    for playerIDA, playerIDB in PyGameData.g_marryCandyInfo.keys():
+        if playerIDA < 10000:
+            fakeID = max(playerIDA, fakeID)
+        if playerIDB < 10000:
+            fakeID = max(playerIDB, fakeID)
+            
+    ipyData = IpyGameDataPY.GetIpyGameData("Marry", bridePriceID)
+    if not ipyData:
+        return 0
+    prosperity = ipyData.GetProsperity()
+    candyTimes = ipyData.GetCandyTimes()
+    
+    syncCandyList = []
+    curTime = int(time.time())
+    for _ in xrange(addCount):
+        playerIDA = fakeID + 1
+        playerIDB = fakeID + 2
+        fakeID = playerIDB
+        
+        candyObj = MarryCandy()
+        candyObj.playerIDA = playerIDA
+        candyObj.playerNameA = PlayerSocial.GetSocialPlayerName(playerIDA)
+        candyObj.playerIDB = playerIDB
+        candyObj.playerNameB = PlayerSocial.GetSocialPlayerName(playerIDB)
+        candyObj.bridePriceID = bridePriceID
+        candyObj.marryTime = curTime
+        candyObj.endTime = curTime + candyTimes
+        AddProsperity(candyObj, prosperity)
+        
+        PyGameData.g_marryCandyInfo[(playerIDA, playerIDB)] = candyObj
+        syncCandyList.append(candyObj)
+        
+    __SortCandy()
+    Sync_CandyList(None, syncCandyList)
+    return addCount
+    
 def __SortCandy():
     PyGameData.g_marryCandySortList = PyGameData.g_marryCandyInfo.values()
     PyGameData.g_marryCandySortList.sort(key=operator.attrgetter("endTime"))
@@ -1116,7 +1155,7 @@
     
     clientPack = ChPyNetSendPack.tagGCCandyList()
     clientPack.CandyInfoList = []
-    for candyObj in PyGameData.g_marryCandySortList:
+    for candyObj in syncCandyList:
         candyInfo = ChPyNetSendPack.tagGCCandyInfo()
         candyInfo.PlayerIDA = candyObj.playerIDA
         candyInfo.PlayerNameA = candyObj.playerNameA
@@ -1147,6 +1186,10 @@
                 continue
             
             for candyInfo in clientPack.CandyInfoList:
+                coupleIDInfo = (candyInfo.PlayerIDA, candyInfo.PlayerIDB)
+                if coupleIDInfo not in PyGameData.g_marryCandyInfo:
+                    continue
+                candyObj = PyGameData.g_marryCandyInfo[coupleIDInfo]
                 candyInfo.FireworksPlayerBuyCount = candyObj.fireworksCountDict.get(curPlayer.GetPlayerID(), 0)
                 candyInfo.PlayerFreeEatCandyCount = candyObj.playerFreeEatCountDict.get(curPlayer.GetPlayerID(), 0)
                 

--
Gitblit v1.8.0