From 2fca4ba3abab2ea232d64ef084be1991506d57a2 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期四, 27 六月 2024 16:32:51 +0800
Subject: [PATCH] 10178 【越南】【香港】【主干】挂机奖励(屏蔽跨服上线通知:古宝、神通、战令、福地、挂机)

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerLove.py |  331 ++++++++++++++++++++++++------------------------------
 1 files changed, 147 insertions(+), 184 deletions(-)

diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerLove.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerLove.py
index 33f4029..e86bf90 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerLove.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerLove.py
@@ -20,88 +20,73 @@
 import PlayerControl
 import IpyGameDataPY
 import ChPyNetSendPack
-import PlayerBillboard
+import FunctionNPCCommon
 import IPY_GameWorld
 import ItemControler
 import NetPackCommon
-import ShareDefine
 import ChConfig
-
-import time
+import SkillCommon
+import BuffSkill
+import PyGameData
 
 def DoPlayerOnDay(curPlayer):
-    
-    # 重置每日魅力
-    if curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_LoveCharmToday):
-        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_LoveCharmToday, 0)
-        Sync_CharmInfo(curPlayer)
-        
-    # 重置每日聘礼
-    bridePriceState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_LoveBridePriceState)
-    if bridePriceState:
-        updBridePriceState = bridePriceState
-        ipyDataMgr = IpyGameDataPY.IPY_Data()
-        for index in range(ipyDataMgr.GetMarryCount()):
-            ipyData = ipyDataMgr.GetMarryByIndex(index)
-            if not ipyData.GetIsDayReset():
-                continue
-            bridePriceID = ipyData.GetBridePriceID()
-            dataIndex = bridePriceID - 1
-            buyCount = GameWorld.GetDataByDigitPlace(updBridePriceState, dataIndex)
-            if not buyCount:
-                continue
-            updBridePriceState = GameWorld.ChangeDataByDigitPlace(updBridePriceState, dataIndex, 0)
-            PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_LoveBridePriceState, updBridePriceState)
-            GameWorld.DebugLog("重置每日聘礼次数: bridePriceState=%s,bridePriceID=%s,updBridePriceState=%s" 
-                               % (bridePriceState, bridePriceID, updBridePriceState), curPlayer.GetPlayerID())
-            
-        if bridePriceState != updBridePriceState:
-            Sync_CoupleInfo(curPlayer)
-            
+    if curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_LoveEatCandyToday):
+        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_LoveEatCandyToday, 0)
+        Sync_LoveInfo(curPlayer)
     return
 
 def DoPlayerLogin(curPlayer):
-    Sync_CharmInfo(curPlayer)
-    Sync_CoupleInfo(curPlayer)
+    Sync_LoveInfo(curPlayer)
     Sync_LoveRingInfo(curPlayer)
     return
 
-#// B3 10 送花 #tagCMSendFlowers
+#// B3 10 送礼物 #tagCMSendGifts
 #
-#struct    tagCMSendFlowers
+#struct    tagCMSendGifts
 #{
 #    tagHead        Head;
 #    DWORD        TagPlayerID;    // 目标玩家ID
-#    DWORD        FlowerCount;    // 赠送花数量
+#    WORD        GiftNum;        // 赠送礼物编号
+#    DWORD        GiftCount;    // 赠送礼物数量
+#    BYTE        IsAutoBuy;    // 是否自动购买
 #};
-def OnSendFlowers(index, clientData, tick):
+def OnSendGifts(index, clientData, tick):
     curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
     tagPlayerID = clientData.TagPlayerID
-    flowerCount = clientData.FlowerCount
+    giftNum = clientData.GiftNum
+    giftCount = clientData.GiftCount
+    isAutoBuy = clientData.IsAutoBuy
     
-    if flowerCount <= 0:
+    if giftNum <= 0 or giftCount <= 0:
         return
     
-    flowerCountInfoDict = IpyGameDataPY.GetFuncEvalCfg("LoveFlower", 2, {})
-    if str(flowerCount) not in flowerCountInfoDict:
+    ipyData = IpyGameDataPY.GetIpyGameData("LoveGift", giftNum)
+    if not ipyData:
         return
-    addCharm, addCharmTag, addIntimacy = flowerCountInfoDict[str(flowerCount)]
-    flowerID = IpyGameDataPY.GetFuncCfg("LoveFlower", 1)
     
-    _, bindCnt, unBindCnt = ItemCommon.GetPackItemBindStateIndexInfo(curPlayer, flowerID, flowerCount)
-    lackCnt = flowerCount - bindCnt - unBindCnt
+    giftItemID = ipyData.GetGiftItemID()
+    if not ipyData.GetAllowBatch():
+        giftCount = 1 # 不允许批量赠送的默认赠送1个
+        
+    _, bindCnt, unBindCnt = ItemCommon.GetPackItemBindStateIndexInfo(curPlayer, giftItemID, giftCount)
+    lackCnt = giftCount - bindCnt - unBindCnt
     if lackCnt > 0:
-        GameWorld.DebugLog("鲜花道具不足,无法赠送! flowerID=%s,flowerCount=%s,bindCnt=%s,unBindCnt=%s,lackCnt=%s" 
-                           % (flowerID, flowerCount, bindCnt, unBindCnt, lackCnt))
-        return
-    
+        if not isAutoBuy:
+            GameWorld.DebugLog("礼物道具不足,无法赠送! giftItemID=%s,giftCount=%s,bindCnt=%s,unBindCnt=%s,lackCnt=%s" 
+                               % (giftItemID, giftCount, bindCnt, unBindCnt, lackCnt))
+            return
+        
+        moneyType = IpyGameDataPY.GetFuncCfg("LoveGift", 1)
+        infoDict = {ChConfig.Def_Cost_Reason_SonKey:giftItemID}
+        if not FunctionNPCCommon.PayAutoBuyItem(curPlayer, {giftItemID:lackCnt}, moneyType, ChConfig.Def_Cost_Love, infoDict, isCheck=True):
+            return
+        
     if not GameWorld.SetPlayerTickTime(curPlayer, ChConfig.TYPE_Player_Tick_Love, tick):
         PlayerControl.NotifyCode(curPlayer, "RequestLater")
         return
     
-    isWorldNotify = (flowerCount in IpyGameDataPY.GetFuncEvalCfg("LoveFlower", 3))
-    dataMsg = [tagPlayerID, flowerID, flowerCount, addCharm, addCharmTag, addIntimacy, isWorldNotify]
-    SendToGameServer_Love(curPlayer, "SendFlowersReq", dataMsg)
+    dataMsg = [tagPlayerID, giftNum, giftItemID, giftCount, isAutoBuy]
+    SendToGameServer_Love(curPlayer, "SendGiftsReq", dataMsg)
     return
 
 #// B3 11 提亲 #tagCMMarryReq
@@ -117,26 +102,9 @@
     tagPlayerID = clientData.TagPlayerID
     bridePriceID = clientData.BridePriceID
     
-    playerID = curPlayer.GetPlayerID()
-    coupleID = PlayerControl.GetCoupleID(curPlayer)
-    if coupleID and coupleID != tagPlayerID:
-        GameWorld.DebugLog("已成亲伴侣ID不一致,无法提亲! tagPlayerID(%s) != coupleID(%s)" % (tagPlayerID, coupleID), playerID)
-        return
-    
     ipyData = IpyGameDataPY.GetIpyGameData("Marry", bridePriceID)
     if not ipyData:
         return
-    
-    canBuyMax = ipyData.GetCanBuyCount()
-    
-    dataIndex = bridePriceID - 1
-    bridePriceState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_LoveBridePriceState)
-    buyCount = GameWorld.GetDataByDigitPlace(bridePriceState, dataIndex)
-    if canBuyMax and buyCount >= canBuyMax:
-        GameWorld.DebugLog("聘礼提亲次数不足,无法提亲! bridePriceID=%s,buyCount(%s) >= canBuyMax(%s)" 
-                           % (bridePriceID, buyCount, canBuyMax), playerID)
-        return
-    
     costMoneyInfo = ipyData.GetCostMoneyInfo()
     if len(costMoneyInfo) != 2:
         return
@@ -169,6 +137,13 @@
     
     playerID = curPlayer.GetPlayerID()
     
+    EatCandyMax = IpyGameDataPY.GetFuncCfg("LoveCandy", 4)
+    if EatCandyMax:
+        eatCandyToday = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_LoveEatCandyToday)
+        if eatCandyToday >= EatCandyMax:
+            GameWorld.DebugLog("已达今日吃喜糖次数上限. eatCandyToday=%s >= %s" % (eatCandyToday, EatCandyMax), playerID)
+            return
+        
     if not GameWorld.SetPlayerTickTime(curPlayer, ChConfig.TYPE_Player_Tick_Love, tick):
         PlayerControl.NotifyCode(curPlayer, "RequestLater")
         return
@@ -222,23 +197,9 @@
     breakType = clientData.BreakType
     playerID = curPlayer.GetPlayerID()
     
-    coupleID = PlayerControl.GetCoupleID(curPlayer)
-    if not coupleID:
-        GameWorld.DebugLog("没有伴侣,不需要离婚!", playerID)
-        return
-    
-    curTime = int(time.time())
-    marryTime = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_LoveMarryTime)
-    passTime = curTime - marryTime
-    breakCD = IpyGameDataPY.GetFuncCfg("LoveMarryBreak", 1)
-    if breakCD and passTime < breakCD:
-        GameWorld.Log("离婚等待时间未到,无法离婚! marryTime=%s,passTime(%s) < %s" 
-                      % (GameWorld.ChangeTimeNumToStr(marryTime), passTime, breakCD), playerID)
-        return
-    
     moneyType, moneyValue = 0, 0
     if breakType == 1:
-        costMoneyInfo = IpyGameDataPY.GetFuncEvalCfg("LoveMarryBreak", 2)
+        costMoneyInfo = IpyGameDataPY.GetFuncEvalCfg("LoveMarryBreak", 3)
         if len(costMoneyInfo) != 2:
             return
         moneyType, moneyValue = costMoneyInfo
@@ -250,7 +211,7 @@
         PlayerControl.NotifyCode(curPlayer, "RequestLater")
         return
     
-    dataMsg = [playerID, coupleID, breakType, moneyType, moneyValue]
+    dataMsg = [playerID, breakType, moneyType, moneyValue]
     SendToGameServer_Love(curPlayer, "MarryBreakReq", dataMsg)
     return
 
@@ -265,19 +226,17 @@
     
     msgType, dataMsg = msgData[:2]
     
-    ## 增加魅力值
-    if msgType == "AddCharm":
-        addCharmTag = dataMsg[0]
-        __DoAddCharm(curPlayer, addCharmTag)
-        return
-    
     ## 结婚成功
-    elif msgType == "MarrySuccess":
+    if msgType == "MarrySuccess":
         __DoMarrySuccess(curPlayer, dataMsg)
     
     ## 离婚成功
     elif msgType == "ClearCoupleSocial":
         __ClearCoupleSocial(curPlayer, dataMsg)
+    
+    ## 同步亲密度
+    elif msgType == "SyncMapServerIntimacy":
+        SyncMapServerIntimacy(curPlayer, dataMsg)
         
     return
 
@@ -285,11 +244,11 @@
     
     msgType, dataMsg, ret = msgData
     
-    ## 送花请求返回
-    if msgType == "SendFlowersReq":
+    ## 送礼物请求返回
+    if msgType == "SendGiftsReq":
         if not ret:
             return
-        __DoSendFlowers(curPlayer, dataMsg)
+        __DoSendGiftsReq(curPlayer, dataMsg)
         
     ## 吃喜糖返回
     elif msgType == "MarryEatCandy":
@@ -311,27 +270,35 @@
         
     return
 
-def __DoSendFlowers(curPlayer, dataMsg):
-    ## 送花方处理
+def __DoSendGiftsReq(curPlayer, dataMsg):
+    ## 送礼物方处理
     
     playerID = curPlayer.GetPlayerID()
-    tagPlayerID, flowerID, flowerCount, addCharm = dataMsg[:4]
+    tagPlayerID, giftNum, giftItemID, giftCount, isAutoBuy = dataMsg
     
-    costItemIndexList, bindCnt, unBindCnt = ItemCommon.GetPackItemBindStateIndexInfo(curPlayer, flowerID, flowerCount)
-    lackCnt = flowerCount - bindCnt - unBindCnt
+    costItemIndexList, bindCnt, unBindCnt = ItemCommon.GetPackItemBindStateIndexInfo(curPlayer, giftItemID, giftCount)
+    lackCnt = giftCount - bindCnt - unBindCnt
+    delCnt = giftCount
     if lackCnt > 0:
-        GameWorld.ErrLog("地图鲜花道具不足,无法赠送! tagPlayerID=%s,flowerID=%s,flowerCount=%s,lackCnt=%s" 
-                         % (tagPlayerID, flowerID, flowerCount, lackCnt), playerID)
-        return
+        if not isAutoBuy:
+            GameWorld.ErrLog("礼物道具不足,无法赠送! giftItemID=%s,giftCount=%s,bindCnt=%s,unBindCnt=%s,lackCnt=%s" 
+                             % (giftItemID, giftCount, bindCnt, unBindCnt, lackCnt))
+            return
+        
+        moneyType = IpyGameDataPY.GetFuncCfg("LoveGift", 1)
+        infoDict = {ChConfig.Def_Cost_Reason_SonKey:giftItemID}
+        if not FunctionNPCCommon.PayAutoBuyItem(curPlayer, {giftItemID:lackCnt}, moneyType, ChConfig.Def_Cost_Love, infoDict):
+            return
+        delCnt -= lackCnt
+        
+    GameWorld.Log("赠送礼物: tagPlayerID=%s,giftNum=%s,giftItemID=%s,giftCount=%s,isAutoBuy=%s" 
+                  % (tagPlayerID, giftNum, giftItemID, giftCount, isAutoBuy), playerID)
     
-    GameWorld.Log("赠送鲜花: tagPlayerID=%s,flowerID=%s,flowerCount=%s,addCharm=%s" % (tagPlayerID, flowerID, flowerCount, addCharm), playerID)
-    
-    saveDataDict = {"tagPlayerID":tagPlayerID}
-    ItemCommon.DelCostItemByBind(curPlayer, costItemIndexList, bindCnt, unBindCnt, flowerCount, "Love", saveDataDict)
-    
-    __DoAddCharm(curPlayer, addCharm)
-    
-    SendToGameServer_Love(curPlayer, "SendFlowersOK", dataMsg)
+    # 扣除消耗
+    if delCnt > 0:
+        ItemCommon.DelCostItemByBind(curPlayer, costItemIndexList, bindCnt, unBindCnt, delCnt, "Love")
+        
+    SendToGameServer_Love(curPlayer, "SendGiftsOK", dataMsg)
     return
 
 def __DoMarryEatCandy(curPlayer, retInfo):
@@ -346,7 +313,11 @@
     if not canBuy:
         return
     
-    GameWorld.Log("吃喜糖结果: isFree=%s" % (isFree), curPlayer.GetPlayerID())
+    updEatCandyToday = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_LoveEatCandyToday) + 1
+    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_LoveEatCandyToday, updEatCandyToday)
+    Sync_LoveInfo(curPlayer)
+    
+    GameWorld.Log("吃喜糖结果: isFree=%s,updEatCandyToday=%s" % (isFree, updEatCandyToday), curPlayer.GetPlayerID())
     
     if not isFree:
         infoDict = {ChConfig.Def_Cost_Reason_SonKey:"EatCandy"}
@@ -369,57 +340,19 @@
     ## 离婚请求结果返回
     
     costMoneyType, costMoneyValue = retInfo
-    GameWorld.Log("执行离婚请求结果: costMoneyType=%s, costMoneyValue=%s" % (costMoneyType, costMoneyValue), curPlayer.GetPlayerID())
+    GameWorld.Log("执行强制离婚请求结果: costMoneyType=%s, costMoneyValue=%s" % (costMoneyType, costMoneyValue), curPlayer.GetPlayerID())
     
     infoDict = {ChConfig.Def_Cost_Reason_SonKey:"MarryBreak"}
     PlayerControl.PayMoney(curPlayer, costMoneyType, costMoneyValue, ChConfig.Def_Cost_Love, infoDict, isMinus=True)
     return
 
-def __DoAddCharm(curPlayer, addValue):
-    ## 增加魅力值
-    charmTotal = min(curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_LoveCharmTotal) + addValue, ShareDefine.Def_UpperLimit_DWord)
-    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_LoveCharmTotal, charmTotal)
-    
-    charmToday = min(curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_LoveCharmToday) + addValue, ShareDefine.Def_UpperLimit_DWord)
-    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_LoveCharmToday, charmToday)
-    
-    GameWorld.Log("增加魅力: addValue=%s,charmTotal=%s,charmToday=%s" % (addValue, charmTotal, charmToday), curPlayer.GetPlayerID())
-    
-    PlayerControl.NotifyCode(curPlayer, "AddCharm", [addValue])
-    
-    PlayerBillboard.UpdatePlayerBillboard(curPlayer, ShareDefine.Def_BT_Charm, charmTotal)
-    PlayerBillboard.UpdatePlayerBillboard(curPlayer, ShareDefine.Def_BT_CharmDay, charmToday)
-    
-    Sync_CharmInfo(curPlayer)
-    return
-
 def __DoMarrySuccess(curPlayer, dataMsg):
     ## 执行成亲成功
-    reqPlayerID, coupleID, curTime, bridePriceID = dataMsg
-    isNewlyMarried = (PlayerControl.GetCoupleID(curPlayer) != coupleID) # 是否新婚
+    reqPlayerID, bridePriceID, mapServerCoupleInfo, coupleIntimacy = dataMsg
     playerID = curPlayer.GetPlayerID()
+    PlayerControl.SetCoupleInfo(playerID, mapServerCoupleInfo)
     
-    if isNewlyMarried:
-        PlayerControl.SetCoupleID(curPlayer, coupleID)
-        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_LoveNewMarryTime, curTime)
-        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_LoveBridePriceState, 0)
-        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_LoveBridePriceMaxID, 0)
-        
-    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_LoveMarryTime, curTime)
-    
-    dataIndex = bridePriceID - 1
-    bridePriceState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_LoveBridePriceState)
-    buyCount = GameWorld.GetDataByDigitPlace(bridePriceState, dataIndex)
-    updBuyCount = min(9, buyCount + 1)
-    updBridePriceState = GameWorld.ChangeDataByDigitPlace(bridePriceState, dataIndex, updBuyCount)
-    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_LoveBridePriceState, updBridePriceState)
-    
-    bridePriceMaxID = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_LoveBridePriceMaxID)
-    if bridePriceID > bridePriceMaxID:
-        bridePriceMaxID = bridePriceID
-        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_LoveBridePriceMaxID, bridePriceMaxID)
-        
-    Sync_CoupleInfo(curPlayer)
+    GameWorld.Log("执行成亲成功! reqPlayerID=%s,bridePriceID=%s,coupleIntimacy=%s" % (reqPlayerID, bridePriceID, coupleIntimacy), playerID)
     
     if curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_LoveRingClassLV) == 0:
         GameWorld.DebugLog("激活情戒!")
@@ -428,8 +361,8 @@
         PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_LoveRingEatCount, 0)
         Sync_LoveRingInfo(curPlayer)
         
-    GameWorld.Log("执行成亲成功! coupleID=%s,curTime=%s,bridePriceID=%s,isNewlyMarried=%s,bridePriceState=%s,buyCount=%s,updBuyCount=%s,updBridePriceState=%s,bridePriceMaxID=%s" 
-                  % (coupleID, curTime, bridePriceID, isNewlyMarried, bridePriceState, buyCount, updBuyCount, updBridePriceState, bridePriceMaxID), playerID)
+    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_LoveCoupleIntimacy, coupleIntimacy)
+    RefreshCoupleTeamBuff(curPlayer)
     
     # 提亲的玩家扣除消耗
     if playerID == reqPlayerID:
@@ -442,22 +375,19 @@
     RefreshLoveAttr(curPlayer)
     return
 
-def GetBridePriceMaxID(curPlayer):
-    ## 获取结婚聘礼的最高ID
-    return curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_LoveBridePriceMaxID)
-
 def __ClearCoupleSocial(curPlayer, dataMsg):
     ## 离婚 - 清除伴侣关系
     
     playerID = curPlayer.GetPlayerID()
     
     coupleID = PlayerControl.GetCoupleID(curPlayer)
-    PlayerControl.SetCoupleID(curPlayer, 0)
-    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_LoveBridePriceState, 0)        
-    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_LoveBridePriceMaxID, 0)        
-    Sync_CoupleInfo(curPlayer)
+    PlayerControl.SetCoupleInfo(playerID, None)
     
     GameWorld.Log("清除伴侣关系成功! coupleID=%s" % (coupleID), playerID)
+    
+    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_LoveCoupleIntimacy, 0)
+    RefreshCoupleTeamBuff(curPlayer)
+    
     RefreshLoveAttr(curPlayer)
     return
 
@@ -555,7 +485,7 @@
         
     # 扣除消耗
     if delCnt:
-        ItemCommon.DelCostItemByBind(curPlayer, costItemIndexList, bindCnt, unBindCnt, delCnt, "LoveRing")
+        ItemCommon.DelCostItemByBind(curPlayer, costItemIndexList, bindCnt, unBindCnt, delCnt, "Love")
         
     # 升星
     if ringUpType == "starUp":
@@ -633,24 +563,6 @@
     PlayerControl.SetCalcAttrListValue(curPlayer, ChConfig.Def_CalcAttrFunc_LoveRingCouple, allAttrListCouple)
     return
 
-def Sync_CharmInfo(curPlayer):
-    ## 同步魅力信息
-    clientPack = ChPyNetSendPack.tagMCCharmInfo()
-    clientPack.CharmTotal = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_LoveCharmTotal)
-    clientPack.CharmToday = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_LoveCharmToday)
-    NetPackCommon.SendFakePack(curPlayer, clientPack)
-    return
-
-def Sync_CoupleInfo(curPlayer):
-    ## 同步伴侣信息
-    clientPack = ChPyNetSendPack.tagMCCoupleInfo()
-    clientPack.CoupleID = PlayerControl.GetCoupleID(curPlayer)
-    clientPack.NewMarryTime = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_LoveNewMarryTime)
-    clientPack.MarryTime = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_LoveMarryTime)
-    clientPack.BridePriceState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_LoveBridePriceState)
-    NetPackCommon.SendFakePack(curPlayer, clientPack)
-    return
-
 def Sync_LoveRingInfo(curPlayer):
     ## 同步情戒信息
     clientPack = ChPyNetSendPack.tagMCLoveRingInfo()
@@ -660,3 +572,54 @@
     NetPackCommon.SendFakePack(curPlayer, clientPack)
     return
 
+def Sync_LoveInfo(curPlayer):
+    ## 同步情缘相关信息
+    clientPack = ChPyNetSendPack.tagMCLoveInfo()
+    clientPack.EatCandyToday = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_LoveEatCandyToday)
+    NetPackCommon.SendFakePack(curPlayer, clientPack)
+    return
+
+def SyncMapServerIntimacy(curPlayer, dataMsg):
+    tagID, intimacyValue = dataMsg
+    coupleID = PlayerControl.GetCoupleID(curPlayer)
+    if coupleID == tagID:
+        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_LoveCoupleIntimacy, intimacyValue)
+        RefreshCoupleTeamBuff(curPlayer)
+    return
+
+def RefreshCoupleTeamBuff(curPlayer):
+    ## 刷新伴侣组队buff
+    
+    teamID = curPlayer.GetTeamID()
+    playerID = curPlayer.GetPlayerID()
+    cupleID = PlayerControl.GetCoupleID(curPlayer)
+    teamPlayerInfoDict = PyGameData.g_teamPlayerInfoDict.get(teamID, {}) if teamID else {}
+    teamPlayerIDList = teamPlayerInfoDict.keys()
+    skillLV = 0
+    skillTypeID = IpyGameDataPY.GetFuncCfg("IntimacyBuff", 2)
+    coupleIntimacy = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_LoveCoupleIntimacy)
+    if cupleID and cupleID in teamPlayerIDList:
+        skillLVIntimacyList = IpyGameDataPY.GetFuncEvalCfg("IntimacyBuff", 1)
+        for lv, lvIntimacy in enumerate(skillLVIntimacyList, 1):
+            if coupleIntimacy >= lvIntimacy:
+                skillLV = lv
+            else:
+                break
+            
+    GameWorld.DebugLog("刷新伴侣组队Buff: cupleID=%s,coupleIntimacy=%s,teamID=%s,teamPlayerIDList=%s,skillTypeID=%s,skillLV=%s" 
+                       % (cupleID, coupleIntimacy, teamID, teamPlayerIDList, skillTypeID, skillLV), playerID)
+    tick = GameWorld.GetGameWorld().GetTick()
+    if skillLV > 0:
+        findBuff = SkillCommon.FindBuffByID(curPlayer, skillTypeID)[0]
+        if findBuff:
+            if skillLV == findBuff.GetSkill().GetSkillLV():
+                return
+            BuffSkill.DelBuffBySkillID(curPlayer, skillTypeID, tick)
+        SkillCommon.AddBuffBySkillType(curPlayer, skillTypeID, tick, skillLV)
+    else:
+        if BuffSkill.DelBuffBySkillID(curPlayer, skillTypeID, tick):
+            #统一刷新状态
+            playerControl = PlayerControl.PlayerControl(curPlayer)
+            playerControl.RefreshPlayerAttrByBuff()
+            
+    return

--
Gitblit v1.8.0