From 65cc6607f70da938ad5d64e382ece1d37d74fa02 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期二, 07 十二月 2021 14:38:48 +0800
Subject: [PATCH] 9341 【BT5】【主干】【后端】情缘系统(优化已结婚伴侣离线时也可以直接提亲直接成亲)

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

diff --git a/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerLove.py b/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerLove.py
index 111ff1f..78e3e0c 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerLove.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerLove.py
@@ -464,10 +464,10 @@
         PyGameData.g_marryReqInfo.pop(reqPlayerID, None)
         return
     
-    __DoMarryResponse(curPlayer, reqPlayer, reqPlayerID, isOK)
+    __DoMarryResponse(curPlayer, playerID, reqPlayer, reqPlayerID, isOK)
     return
 
-def __DoMarryResponse(curPlayer, reqPlayer, reqPlayerID, isOK, needResponse=True):
+def __DoMarryResponse(curPlayer, playerID, reqPlayer, reqPlayerID, isOK, needResponse=True):
     ''' 提亲回应
     @param curPlayer: 回应玩家
     @param reqPlayer: 提亲玩家
@@ -481,9 +481,9 @@
     if not ipyData:
         return
     
-    playerID = curPlayer.GetPlayerID()
+    #playerID = curPlayer.GetPlayerID()
     reqPlayerName = reqPlayer.GetName() if reqPlayer else PlayerSocial.GetSocialPlayerName(reqPlayerID)
-    playerName = curPlayer.GetName()
+    playerName = curPlayer.GetName() if curPlayer else PlayerSocial.GetSocialPlayerName(playerID)
     
     if needResponse:
         responsePack = ChPyNetSendPack.tagGCMarryResponseRet()
@@ -499,7 +499,7 @@
     # 拒绝
     if not isOK:
         return
-    if needResponse:
+    if needResponse and curPlayer:
         NetPackCommon.SendFakePack(curPlayer, responsePack) # 回应方仅同意时同步
     
     # ===================== 以下执行成亲逻辑 ===================== 
@@ -822,10 +822,6 @@
     if PyDataManager.GetBlacklistManager().CheckBlacklistBoth(playerID, tagPlayerID, curPlayer):
         return
     
-    if not tagPlayer or PlayerControl.GetIsTJG(tagPlayer):
-        PlayerControl.NotifyCode(curPlayer, "LoveOffline") # 离线
-        return
-    
     curCouple = PyDataManager.GetDBPyCoupleManager().GetCouple(playerID)
     if curCouple and curCouple.GetCoupleID(playerID) != tagPlayerID:
         PlayerControl.NotifyCode(curPlayer, "HaveCouple") # 已经有其他伴侣了
@@ -835,6 +831,11 @@
     if tagCouple and tagCouple.GetCoupleID(tagPlayerID) != playerID:
         PlayerControl.NotifyCode(curPlayer, "TagHaveCouple") # 对方已经有其他伴侣了
         return
+    
+    if not tagPlayer or PlayerControl.GetIsTJG(tagPlayer):
+        if not curCouple:
+            PlayerControl.NotifyCode(curPlayer, "LoveOffline") # 离线
+            return
     
     # 回应方可不检查亲密度
     if checkIntimacy:
@@ -889,7 +890,7 @@
         reqData.bridePriceID = bridePriceID
         reqData.reqTime = curTime
         PyGameData.g_marryReqInfo[playerID] = reqData
-        __DoMarryResponse(tagPlayer, curPlayer, playerID, 1, False)
+        __DoMarryResponse(tagPlayer, tagPlayerID, curPlayer, playerID, 1, False)
         return
     
     if tagPlayerID in PyGameData.g_marryReqInfo:
@@ -905,11 +906,11 @@
                 reqData.bridePriceID = bridePriceID
                 reqData.reqTime = curTime
                 PyGameData.g_marryReqInfo[playerID] = reqData
-                if __DoMarryResponse(tagPlayer, curPlayer, playerID, 1):
+                if __DoMarryResponse(tagPlayer, tagPlayerID, curPlayer, playerID, 1):
                     return
             GameWorld.Log("玩家提亲时,目标刚好已经先提过亲,且在有效期内,直接成亲!tagPlayerID=%s,tagBridePriceID=%s,bridePriceID=%s" 
                           % (tagPlayerID, tagBridePriceID, bridePriceID), playerID)
-            if __DoMarryResponse(curPlayer, tagPlayer, tagPlayerID, 1):
+            if __DoMarryResponse(curPlayer, playerID, tagPlayer, tagPlayerID, 1):
                 return
         else:
             GameWorld.DebugLog("对方有提亲,但是对象不一样或已超时! tagPlayerID=%s, timeout=%s" % (tagReqData.playerIDB, __CheckMarryReqTimeout(tagReqData)), playerID)

--
Gitblit v1.8.0