hxp
2021-11-17 ffa8a645ed6a92a3c723bbf5c7f1eb4d5425c826
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
#!/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 Ç×ÃܶÈ")
    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:
        if couple:
            GameWorld.DebugAnswer(curPlayer, "ÒÑÓаéÂÂ! coupleID=%s" % couple.GetCoupleID(playerID))
            return
        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
        tagCouple = coupleMgr.GetCouple(tagPlayerID)
        if tagCouple:
            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, 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)))     
    else:
        __Help(curPlayer)
        return
    
    return