From 01e46bb91dbc5023379dd2e10f2cb3532ca57ad0 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期一, 02 九月 2024 10:35:33 +0800
Subject: [PATCH] 10256 【越南】【砍树】排行榜名次加入积分限制(修复特殊排名规则跨服榜单报错bug;)

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

diff --git a/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerLove.py b/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerLove.py
index 395be4e..6105118 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerLove.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerLove.py
@@ -159,12 +159,18 @@
         syncCoupleInfo = {}
         if syncPlayerIDList == None:
             syncPlayerIDList = self.coupleIDDict.keys()
+        # 分批同步,子服长度不能超过 65535,每批暂定最大同步1000个
         for playerID in syncPlayerIDList:
             couple = self.GetCouple(playerID)
             if not couple:
                 syncCoupleInfo[playerID] = []
             else:
                 syncCoupleInfo[playerID] = couple.GetSendMapServerCoupleInfo(playerID)
+            if len(syncCoupleInfo) >= 1000:
+                GameWorld.SendMapServerMsgEx(ShareDefine.Def_Notify_WorldKey_CoupleInfo, syncCoupleInfo)
+                syncCoupleInfo = {}
+        if not syncCoupleInfo:
+            return
         GameWorld.SendMapServerMsgEx(ShareDefine.Def_Notify_WorldKey_CoupleInfo, syncCoupleInfo)
         return
     
@@ -582,6 +588,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"))
@@ -739,6 +784,10 @@
     tagPlayerID = dataMsg[0]
     playerID = curPlayer.GetPlayerID()
     
+    if not PlayerControl.GetDBPlayerAccIDByID(tagPlayerID):
+        PlayerControl.NotifyCode(curPlayer, "NoInDBPlayer")
+        return
+        
     # 黑名单检查
     if PyDataManager.GetBlacklistManager().CheckBlacklistBoth(playerID, tagPlayerID, curPlayer):
         return
@@ -757,8 +806,8 @@
     if not ipyData:
         return
     
-    addCharmSelf = ipyData.GetAddCharmSelf() * giftCount
-    addCharmTag = ipyData.GetAddCharmTag() * giftCount
+    addCharmSelf = int(ipyData.GetAddCharmSelf() * giftCount)
+    addCharmTag = int(ipyData.GetAddCharmTag() * giftCount)
     addIntimacy = ipyData.GetAddIntimacy() * giftCount
     worldNotifyKey = ipyData.GetWorldNotifyKey()
     
@@ -818,6 +867,10 @@
     
     playerID = curPlayer.GetPlayerID()
     
+    if not PlayerControl.GetDBPlayerAccIDByID(tagPlayerID):
+        PlayerControl.NotifyCode(curPlayer, "NoInDBPlayer")
+        return
+    
     # 黑名单检查
     if PyDataManager.GetBlacklistManager().CheckBlacklistBoth(playerID, tagPlayerID, curPlayer):
         return
@@ -869,6 +922,10 @@
         coupleID = couple.GetCoupleID(playerID)
         if coupleID != tagPlayerID:
             GameWorld.Log("已成亲伴侣ID不一致,无法提亲! tagPlayerID(%s) != coupleID(%s)" % (tagPlayerID, coupleID), playerID)
+            return
+        
+        if couple.GetBreakRequestID():
+            PlayerControl.NotifyCode(curPlayer, "LimitByMarryBroke") # 和离中无法操作
             return
         
         ipyData = IpyGameDataPY.GetIpyGameData("Marry", bridePriceID)
@@ -1116,7 +1173,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 +1204,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