From 93b6f00c8b142fee8560d58c54d71de135584788 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期五, 03 十二月 2021 18:48:52 +0800
Subject: [PATCH] 9341 【BT5】【主干】【后端】情缘系统(增加魅力等级属性;伴侣亲密度等级属性;优化已成亲的伴侣再次提亲时直接成亲)

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerLove.py |   62 ++++++++++++++++++++++++++++++-
 1 files changed, 60 insertions(+), 2 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 99570be..0feb3be 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerLove.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerLove.py
@@ -25,6 +25,9 @@
 import ItemControler
 import NetPackCommon
 import ChConfig
+import SkillCommon
+import BuffSkill
+import PyGameData
 
 def DoPlayerOnDay(curPlayer):   
     return
@@ -219,6 +222,10 @@
     ## 离婚成功
     elif msgType == "ClearCoupleSocial":
         __ClearCoupleSocial(curPlayer, dataMsg)
+    
+    ## 同步亲密度
+    elif msgType == "SyncMapServerIntimacy":
+        SyncMapServerIntimacy(curPlayer, dataMsg)
         
     return
 
@@ -326,11 +333,11 @@
 
 def __DoMarrySuccess(curPlayer, dataMsg):
     ## 执行成亲成功
-    reqPlayerID, bridePriceID, mapServerCoupleInfo = dataMsg
+    reqPlayerID, bridePriceID, mapServerCoupleInfo, coupleIntimacy = dataMsg
     playerID = curPlayer.GetPlayerID()
     PlayerControl.SetCoupleInfo(playerID, mapServerCoupleInfo)
     
-    GameWorld.Log("执行成亲成功! reqPlayerID=%s,bridePriceID=%s" % (reqPlayerID, bridePriceID), playerID)
+    GameWorld.Log("执行成亲成功! reqPlayerID=%s,bridePriceID=%s,coupleIntimacy=%s" % (reqPlayerID, bridePriceID, coupleIntimacy), playerID)
     
     if curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_LoveRingClassLV) == 0:
         GameWorld.DebugLog("激活情戒!")
@@ -339,6 +346,9 @@
         PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_LoveRingEatCount, 0)
         Sync_LoveRingInfo(curPlayer)
         
+    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_LoveCoupleIntimacy, coupleIntimacy)
+    RefreshCoupleTeamBuff(curPlayer)
+    
     # 提亲的玩家扣除消耗
     if playerID == reqPlayerID:
         ipyData = IpyGameDataPY.GetIpyGameData("Marry", bridePriceID)
@@ -359,6 +369,10 @@
     PlayerControl.SetCoupleInfo(playerID, None)
     
     GameWorld.Log("清除伴侣关系成功! coupleID=%s" % (coupleID), playerID)
+    
+    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_LoveCoupleIntimacy, 0)
+    RefreshCoupleTeamBuff(curPlayer)
+    
     RefreshLoveAttr(curPlayer)
     return
 
@@ -543,3 +557,47 @@
     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