hxp
2024-12-26 22c964784d465c77365c2495f6d43117618d8482
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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
#!/usr/bin/python
# -*- coding: GBK -*-
#-------------------------------------------------------------------------------
#
##@package GM.Commands.SetCrossPK
#
# @todo:ÉèÖÃÍæ¼Ò¿ç·þPK»î¶¯Êý¾Ý
# @author hxp
# @date 2018-12-25
# @version 1.0
#
# ÏêϸÃèÊö: ÉèÖÃÍæ¼Ò¿ç·þPK»î¶¯Êý¾Ý
#
#-------------------------------------------------------------------------------
#"""Version = 2018-12-25 21:30"""
#-------------------------------------------------------------------------------
 
import GameWorld
import PlayerControl
import PlayerCrossRealmPK
import IpyGameDataPY
import ShareDefine
import ChConfig
 
#---------------------------------------------------------------------
#Âß¼­ÊµÏÖ
## GMÃüÁîÖ´ÐÐÈë¿Ú
#  @param curPlayer µ±Ç°Íæ¼Ò
#  @param list ²ÎÊýÁбí [npcID]
#  @return None
#  @remarks º¯ÊýÏêϸ˵Ã÷.
def OnExec(curPlayer, msgList):
    
    if not msgList:
        __PrintHelp(curPlayer)
        return
    
    if msgList[0] == "b":        
        danLV = msgList[1] if len(msgList) > 1 else 0
        pkScore = msgList[2] if len(msgList) > 2 else 0
        cWinCount = msgList[3] if len(msgList) > 3 else None
        danIpyData = IpyGameDataPY.GetIpyGameData("CrossRealmPKDan", danLV)
        if not danIpyData:
            GameWorld.DebugAnswer(curPlayer, "²»´æÔڸöÎλ:%s" % danLV)
            return
        if pkScore <= 0:
            pkScore = danIpyData.GetLVUpScore()
        errorMsg = PlayerCrossRealmPK.GMSetPlayerCrossPKData(curPlayer, danLV, pkScore, cWinCount)
        if errorMsg:
            GameWorld.DebugAnswer(curPlayer, "·ÖÇøÈü¼¾Òì³£!")
        else:
            GameWorld.DebugAnswer(curPlayer, "ÉèÖÃÉϰñ¶Îλ:%s,»ý·Ö:%s" % (danLV, pkScore))
        return
    
    if len(msgList) == 1:
        if msgList[0] != 0:
            __PrintHelp(curPlayer)
            return
        
        # ÖØÖÃÊý¾Ý
        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_TotalScore, 0)
        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_DanLV, 0)
        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_PKCount, 0)
        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_WinCount, 0)
        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_CWinCount, 0)
        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_CLoseCount, 0)
        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_TodayPKCount, 0)
        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_TodayWinCount, 0)
        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_TodayBuyCount, 0)
        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_RefreshCount, 0)
        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_DayPKCountAwardState, 0)
        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_DayWinCountAwardState, 0)
        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_DanLVAwardState, 0)
        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_SeasonAwardState, 0)
        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_ZoneID, 0)
        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_SeasonID, 0)
        for i in xrange(1, 20):
            PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_SeasonDanLV % i, 0)
            PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_SeasonScore % i, 0)
            PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_SeasonOrder % i, 0)
            PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_SeasonAwardLV % i, 0)
            
        GameWorld.DebugAnswer(curPlayer, "ÖØÖÿç·þPKÊý¾ÝOK£¡")
        PlayerCrossRealmPK.SyncCrossRealmPKPlayerInfo(curPlayer)
        PlayerCrossRealmPK.SyncCrossRealmPKAwardState(curPlayer)
        PlayerCrossRealmPK.SyncCrossRealmPKHisSeasonInfo(curPlayer)
        return
    
    if len(msgList) == 2 or len(msgList) % 2 == 0:
        setTypeDict = {0:[ChConfig.Def_PDict_CrossPK_TotalScore, "»ý·Ö"],
                       2:[ChConfig.Def_PDict_CrossPK_DanLV, "¶Îλ"],
                       3:[ChConfig.Def_PDict_CrossPK_PKCount, "PK´ÎÊý"],
                       4:[ChConfig.Def_PDict_CrossPK_WinCount, "ʤÀû´ÎÊý"],
                       5:[ChConfig.Def_PDict_CrossPK_CWinCount, "Á¬Ê¤´ÎÊý"],
                       6:[ChConfig.Def_PDict_CrossPK_CLoseCount, "Á¬°Ü´ÎÊý"],
                       7:[ChConfig.Def_PDict_CrossPK_TodayPKCount, "½ñÈÕPK´ÎÊý"],
                       8:[ChConfig.Def_PDict_CrossPK_TodayWinCount, "½ñÈÕʤÀû´ÎÊý"],
                       9:[ChConfig.Def_PDict_CrossPK_TodayBuyCount, "½ñÈÕ¹ºÂò´ÎÊý"],
                       10:[ChConfig.Def_PDict_CrossPK_RefreshCount, "½ñÈÕˢдÎÊý"],
                       }
        indexList = range(len(msgList))
        for i in indexList[::2]:
            setType, value = msgList[i:i+2]
            if setType not in setTypeDict:
                continue
            dictName, chName = setTypeDict[setType]
            PlayerControl.NomalDictSetProperty(curPlayer, dictName, value)
            GameWorld.DebugAnswer(curPlayer, "ÉèÖÃ%s: %s" % (chName, value))
            
        mapZoneID = GameWorld.GetGameWorld().GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_CrossPKZoneID)
        mapSeasonID = GameWorld.GetGameWorld().GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_CrossPKSeasonID)
        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_ZoneID, mapZoneID)
        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_SeasonID, mapSeasonID)
        PlayerCrossRealmPK.SyncCrossRealmPKPlayerInfo(curPlayer)
        return
    
    if len(msgList) == 3:
        seasonID, setType, value = msgList
        setTypeDict = {0:[ChConfig.Def_PDict_CrossPK_SeasonDanLV, "¶Îλ"],
                       1:[ChConfig.Def_PDict_CrossPK_SeasonOrder, "Ãû´Î"],
                       2:[ChConfig.Def_PDict_CrossPK_SeasonScore, "»ý·Ö"],
                       3:[ChConfig.Def_PDict_CrossPK_SeasonAwardLV, "½±ÀøµÈ¼¶"],
                       }
        if setType not in setTypeDict:
            __PrintHelp(curPlayer)
            return
        dictName, chName = setTypeDict[setType]
        PlayerControl.NomalDictSetProperty(curPlayer, dictName % seasonID, value)
        GameWorld.DebugAnswer(curPlayer, "ÉèÖÃÈü¼¾%s%s: %s" % (seasonID, chName, value))
        return
    
    __PrintHelp(curPlayer)
    return
 
def __PrintHelp(curPlayer):
    GameWorld.DebugAnswer(curPlayer, "ÖØÖÃÊý¾Ý: SetCrossPK 0")
    GameWorld.DebugAnswer(curPlayer, "ÉèÖÃÊý¾Ý: SetCrossPK ÀàÐÍ  Öµ")
    GameWorld.DebugAnswer(curPlayer, "ÀàÐÍ:0-»ý·Ö,2-¶Îλ,3-PK´ÎÊý,4-ʤÀû´ÎÊý,5-Á¬Ê¤´ÎÊý,6-Á¬°Ü´ÎÊý")
    GameWorld.DebugAnswer(curPlayer, "7-½ñÈÕPK´ÎÊý,8-½ñÈÕʤÀû´ÎÊý,9-½ñÈÕ¹ºÂò´ÎÊý,10-½ñÈÕˢдÎÊý")
    GameWorld.DebugAnswer(curPlayer, "ÉèÖÃÀúÊ·¼Ç¼: SetCrossPK Èü¼¾ID ÀàÐÍ ÊýÖµ")
    GameWorld.DebugAnswer(curPlayer, "ÀàÐÍ:0-¶Îλ,1-Ãû´Î,2-»ý·Ö,3-½±ÀøµÈ¼¶")
    GameWorld.DebugAnswer(curPlayer, "µ±Ç°Á¬°Ü´ÎÊý£º %s" % curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CrossPK_CLoseCount))
    GameWorld.DebugAnswer(curPlayer, "ÉèÖÃÉϰñ: SetCrossPK b ¶Îλ [»ý·Ö Á¬Ê¤]")
    return