9341 【BT5】【主干】【后端】情缘系统(优化已结婚伴侣离线时也可以直接提亲直接成亲)
2个文件已修改
27 ■■■■ 已修改文件
ServerPython/CoreServerGroup/GameServer/Script/GM/Commands/Couple.py 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerLove.py 25 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/CoreServerGroup/GameServer/Script/GM/Commands/Couple.py
@@ -93,7 +93,7 @@
        PyGameData.g_marryReqInfo[tagPlayerID] = reqData
        
        reqPlayer = GameWorld.GetPlayerManager().FindPlayerByID(tagPlayerID)
        isOK = PlayerLove.__DoMarryResponse(curPlayer, reqPlayer, tagPlayerID, 1)
        isOK = PlayerLove.__DoMarryResponse(curPlayer, playerID, reqPlayer, tagPlayerID, 1)
        GameWorld.DebugAnswer(curPlayer, "设置伴侣【%s】 %s" % (tagPlayerID, isOK))
        return
    
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") # 已经有其他伴侣了
@@ -834,6 +830,11 @@
    tagCouple = PyDataManager.GetDBPyCoupleManager().GetCouple(tagPlayerID)
    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
    
    # 回应方可不检查亲密度
@@ -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)