#!/usr/bin/python  
 | 
# -*- coding: GBK -*-  
 | 
#-------------------------------------------------------------------------------  
 | 
#  
 | 
##@package GM.Commands.Couple  
 | 
#  
 | 
# @todo:°é  
 | 
# @author hxp  
 | 
# @date 2021-11-17  
 | 
# @version 1.0  
 | 
#  
 | 
# ÏêϸÃèÊö: °é  
 | 
#  
 | 
#-------------------------------------------------------------------------------  
 | 
#"""Version = 2021-11-17 15:00"""  
 | 
#-------------------------------------------------------------------------------  
 | 
  
 | 
import GameWorld  
 | 
import PyDataManager  
 | 
import PlayerLove  
 | 
import PyGameData  
 | 
  
 | 
import time  
 | 
  
 | 
def __Help(curPlayer):  
 | 
    GameWorld.DebugAnswer(curPlayer, "---------- %s" % GameWorld.GetCurrentDataTimeStr())  
 | 
    GameWorld.DebugAnswer(curPlayer, "Çå³ý°éÂÂ: Couple 0")  
 | 
    GameWorld.DebugAnswer(curPlayer, "ÖØÖÃÆ¸Àñ: Couple 0 1")  
 | 
    GameWorld.DebugAnswer(curPlayer, "ÉèÖóÉÇ×: Couple 1 °éÂÂID [¿ÉѡƸÀñID]")  
 | 
    GameWorld.DebugAnswer(curPlayer, "ÉèÇ×ÃܶÈ: Couple 2 Ä¿±êID Ç×ÃܶÈ")  
 | 
    GameWorld.DebugAnswer(curPlayer, "Ôö¼ÓÃܶÈ: Couple 3 Ä¿±êID Ç×ÃܶÈ")  
 | 
    GameWorld.DebugAnswer(curPlayer, "Ìí¼ÓϲÑç: Couple 4 Æ¸ÀñID Ñç»á¸öÊý")  
 | 
    return  
 | 
  
 | 
#Â߼ʵÏÖ  
 | 
## Ö´ÐÐÂß¼  
 | 
#  @param curPlayer µ±Ç°Íæ¼Ò  
 | 
#  @param gmList [cmdIndex gmAccID msg]  
 | 
#  @return None  
 | 
#  @remarks º¯ÊýÏêϸ˵Ã÷.  
 | 
def OnExec(curPlayer, gmList):  
 | 
      
 | 
    if not gmList:  
 | 
        __Help(curPlayer)  
 | 
        return  
 | 
      
 | 
    playerID = curPlayer.GetPlayerID()  
 | 
    coupleMgr = PyDataManager.GetDBPyCoupleManager()  
 | 
    couple = coupleMgr.GetCouple(playerID)  
 | 
      
 | 
    value1 = gmList[0]  
 | 
    if value1 == 0:  
 | 
        # Àë»é  
 | 
        if len(gmList) == 1:  
 | 
            PlayerLove.__DoMarryBreakLogic(couple, playerID)  
 | 
            GameWorld.DebugAnswer(curPlayer, "Çå³ý°éÂÂOK!")  
 | 
            return  
 | 
          
 | 
        value2 = gmList[1]  
 | 
        # ÖØÖÃÆ¸Àñ  
 | 
        if value2 == 1:  
 | 
            if not couple:  
 | 
                GameWorld.DebugAnswer(curPlayer, "ûÓаéÂÂ!")  
 | 
                return  
 | 
            couple.coupleData.BridePriceState = 0  
 | 
            PlayerLove.Sync_CoupleInfo(curPlayer)  
 | 
            GameWorld.DebugAnswer(curPlayer, "ÖØÖÃÆ¸ÀñOK!")  
 | 
              
 | 
        return  
 | 
      
 | 
    # ÉèÖóÉÇ×  
 | 
    elif value1 == 1:  
 | 
        tagPlayerID = gmList[1] if len(gmList) > 1 else 0  
 | 
        if not tagPlayerID or tagPlayerID == playerID:  
 | 
            GameWorld.DebugAnswer(curPlayer, "·Ç·¨°éÂÂÍæ¼ÒID:%s,playerID=%s" % (tagPlayerID, playerID))  
 | 
            return  
 | 
        if couple:  
 | 
            if couple.GetCoupleID(playerID) != tagPlayerID:  
 | 
                GameWorld.DebugAnswer(curPlayer, "ÒÑÓаéÂÂ! coupleID=%s" % couple.GetCoupleID(playerID))  
 | 
                return  
 | 
        tagCouple = coupleMgr.GetCouple(tagPlayerID)  
 | 
        if tagCouple:  
 | 
            if tagCouple.GetCoupleID(tagPlayerID) != playerID:  
 | 
                GameWorld.DebugAnswer(curPlayer, "¶Ô·½ÒÑÓаéÂÂ! tagCoupleID=%s" % tagCouple.GetCoupleID(tagPlayerID))  
 | 
                return  
 | 
          
 | 
        bridePriceID = gmList[2] if len(gmList) > 2 else 1  
 | 
          
 | 
        reqData = PlayerLove.MarryReq()  
 | 
        reqData.playerIDA = tagPlayerID  
 | 
        reqData.playerIDB = playerID  
 | 
        reqData.bridePriceID = bridePriceID  
 | 
        reqData.reqTime = int(time.time())  
 | 
        PyGameData.g_marryReqInfo[tagPlayerID] = reqData  
 | 
          
 | 
        reqPlayer = GameWorld.GetPlayerManager().FindPlayerByID(tagPlayerID)  
 | 
        isOK = PlayerLove.__DoMarryResponse(curPlayer, playerID, reqPlayer, tagPlayerID, 1)  
 | 
        GameWorld.DebugAnswer(curPlayer, "ÉèÖð顾%s¡¿ %s" % (tagPlayerID, isOK))  
 | 
        return  
 | 
      
 | 
    # ÉèÖÃÇ×ÃÜ¶È  
 | 
    elif value1 == 2 and len(gmList) >= 3:  
 | 
        tagPlayerID = gmList[1]  
 | 
        setValue = gmList[2]  
 | 
        if not tagPlayerID or tagPlayerID == playerID:  
 | 
            GameWorld.DebugAnswer(curPlayer, "Íæ¼ÒID²»ÄÜÉèÖÃÇ×ÃܶÈ:%s,playerID=%s" % (tagPlayerID, playerID))  
 | 
            return  
 | 
        intimacys = PyDataManager.GetIntimacyManager().GetIntimacys(playerID)  
 | 
        updIntimacy = intimacys.SetIntimacy(curPlayer, tagPlayerID, setValue)  
 | 
        GameWorld.DebugAnswer(curPlayer, "ÉèÖÃÄ¿±ê¡¾%s¡¿Ç×ÃܶÈ: %s" % (tagPlayerID, updIntimacy))  
 | 
          
 | 
    # Ôö¼ÓÇ×ÃÜ¶È  
 | 
    elif value1 == 3 and len(gmList) >= 3:  
 | 
        tagPlayerID = gmList[1]  
 | 
        addValue = gmList[2]  
 | 
        if not tagPlayerID or tagPlayerID == playerID:  
 | 
            GameWorld.DebugAnswer(curPlayer, "Íæ¼ÒID²»ÄÜÔö¼ÓÇ×ÃܶÈ:%s,playerID=%s" % (tagPlayerID, playerID))  
 | 
            return  
 | 
        PyDataManager.GetIntimacyManager().AddIntimacyBoth(playerID, tagPlayerID, addValue)  
 | 
        intimacys = PyDataManager.GetIntimacyManager().GetIntimacys(playerID)  
 | 
        if intimacys:  
 | 
            GameWorld.DebugAnswer(curPlayer, "¸üÐÂÄ¿±ê¡¾%s¡¿Ç×ÃܶÈ: %s" % (tagPlayerID, intimacys.GetTagIntimacy(tagPlayerID)))  
 | 
  
 | 
    # Ôö¼ÓÇ×ÃÜ¶È  
 | 
    elif value1 == 4:  
 | 
        bridePriceID = gmList[1] if len(gmList) > 1 else 1  
 | 
        addCount = gmList[2] if len(gmList) > 2 else 1  
 | 
        addCount = PlayerLove.GMAddCandy(curPlayer, bridePriceID, addCount)  
 | 
        GameWorld.DebugAnswer(curPlayer, "Ìí¼ÓϲÑçÊý:%s" % addCount)  
 | 
    else:  
 | 
        __Help(curPlayer)  
 | 
        return  
 | 
      
 | 
    return  
 | 
  
 | 
  
 | 
  
 | 
  
 |