hxp
2018-09-12 73f586a3147b956b81e56aa6c6ffdfefa4cff1cc
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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
#!/usr/bin/python
# -*- coding: GBK -*-
#---------------------------------------------------------------------
#
#---------------------------------------------------------------------
##@package PlayerControl
# @todo: Íæ¼Ò¿ØÖÆÆ÷
#
# @author: panwei
# @date 2010-02-16
# @version 2.6
#
# @change: "2011-02-23 14:20" panwei ÏµÍ³Ìáʾº¯ÊýÖØÐ´
# @change: "2011-07-15 19:30" Alee ¶ÓÎé֪ͨ
# @change: "2011-09-02 16:20" panwei ÐÂÔö¾º¼¼³¡ÉèÖúͻñÈ¡¾ö¶·Öµ½Ó¿Ú
# @change: "2012-11-06 15:00" jiang ÐÂÔö¾ºÍþÍûÉèÖúͻñÈ¡ÍþÍûÉè½Ó¿Ú
# @change: "2012-11-07 17:30" wdb ÐÂÔö¿ç·þԤѡÈüÅÅλÐÅÏ¢
# @change: "2012-11-14 12:00" jiang ÐÞ¸ÄÀ©Õ¹ÊôÐÔ×ֶμǼµÄÊôÐÔÀàÐͱØÐëºÍMapServerÒ»ÖÂ
# @change: "2013-12-27 13:30" xmnathan ÁÄÌì¼ÓGm±êʶ
# @change: "2014-02-28 21:10" hxp Ôö¼ÓÐÂÊÖÖ¸µ¼Ô±Âß¼­
# @change: "2014-03-05 10:00" Alee ÁÄÌì֪ͨ±êʶ
# @change: "2014-11-12 20:00" hxp Ôö¼Ó֪ͨMapServerÔö¼Ó³É¾ÍÍê³É½ø¶È
# @change: "2015-07-14 21:00" xdh ÁÄÌìÐÅÏ¢Ô­¸½¼ÓÖµ¸ÄΪExtras
# @change: "2015-10-28 00:00" hxp Ôö¼ÓÉèÖöÔÕ½·¿¼äID
# @change: "2015-11-05 12:00" hxp Ôö¼Ó¿ç·þÈ«·þ¹ã²¥
# @change: "2015-11-06 16:30" hxp Ôö¼ÓGetMergePlayerName
# @change: "2017-06-22 15:00" hxp ¿ç·þ¹ã²¥Ôö¼ÓÌõ¼þ¹ýÂË×Ó·þÊÇ·ñÌáÐÑ£»¿ç·þ·þÎñÆ÷È«·þ¹ã²¥Í¬²½×Ó·þ
#---------------------------------------------------------------------
#"""Version = 2017-06-22 15:00"""
#---------------------------------------------------------------------
import GameWorld
import IPY_GameServer
import MergeBroadcast
import IpyGameDataPY
import ShareDefine
import ChConfig
import types
#---------------------------------------------------------------------
#ϵͳÌáʾ²ÎÊýÁбí
NotifyCodeList = IPY_GameServer.IPY_NotifyCodeList()
#---------------------------------------------------------------------
## ÏûÏ¢Ìáʾ
#  @param curPlayer ÌáʾµÄÍæ¼Ò
#  @param msgMark ÌáʾÐÅÏ¢Mark
#  @param msgParamList ÐÅÏ¢²ÎÊýÁбí
#  @return ÎÞ·µ»ØÖµ
#  @remarks 
def NotifyCode(curPlayer, msgMark, msgParamList=[]):
    if curPlayer == None:
        GameWorld.ErrLog('NotifyCode Player = None')
        return
      
    curPlayer.NotifyCode(msgMark, __GetNotifyCodeList(msgParamList))
    return
    
## ¿ç·þÊÀ½ç¹ã²¥
#  @param country ÌáʾµÄ¹ú¼Ò
#  @param msgMark ÌáʾÐÅÏ¢Mark
#  @param msgParamList ÐÅÏ¢²ÎÊýÁбí
#  @param mergeMinOSD ¸ÃÌáʾÕë¶Ô¿ç·þ×Ó·þÓÐЧµÄ×îС¿ª·þÌì, >=0ʱÓÐÏÞÖÆ
#  @param mergeMaxOSD ¸ÃÌáʾÕë¶Ô¿ç·þ×Ó·þÓÐЧµÄ×î´ó¿ª·þÌì, >=0ʱÓÐÏÞÖÆ
#  @param mergeMapInfo ¸ÃÌáʾËùÊôµÄ¿ç·þ»î¶¯µØÍ¼ÐÅÏ¢, Ö÷ÒªÓÃÓÚ²»Í¬×Ó·þ¶ÔÓ¦Ëù¿çµÄ»î¶¯µØÍ¼ID
#  @remarks 
def MergeWorldNotify(country, msgMark, msgParamList=[], lineID=0, mergeMinOSD=-1, mergeMaxOSD=-1, mergeMapInfo=[], isMapNotify=0):
    # ·ÇµØÍ¼Í¬²½µÄ¹ã²¥²Å½øÐÐÈ«·þ¹ã²¥
    if not isMapNotify:
        GameWorld.GetPlayerManager().CountryNotifyCode(country, msgMark, __GetNotifyCodeList(msgParamList))
    notifyDict = {"country":country, "msgMark":msgMark, "msgParamList":msgParamList, "lineID":lineID, 
                  "mergeMinOSD":mergeMinOSD, "mergeMaxOSD":mergeMaxOSD, "mergeMapInfo":mergeMapInfo}
    MergeBroadcast.SendBroadcastMerge(ChConfig.Def_MergeWorldNotify, 0, notifyDict, False)
    return
    
## ÊÀ½ç¹ã²¥
#  @param country ÌáʾµÄ¹ú¼Ò
#  @param msgMark ÌáʾÐÅÏ¢Mark
#  @param msgParamList ÐÅÏ¢²ÎÊýÁбí
#  @return ÎÞ·µ»ØÖµ
#  @remarks 
def WorldNotify(country, msgMark, msgParamList=[]):
    if GameWorld.IsMergeServer():
        MergeWorldNotify(country, msgMark, msgParamList)
    else:
        GameWorld.GetPlayerManager().CountryNotifyCode(country, msgMark, __GetNotifyCodeList(msgParamList))
    return
 
#---------------------------------------------------------------------
## ¼Ò×å¹ã²¥
#  @param familyID ÌáʾµÄ¼Ò×åID
#  @param msgMark ÌáʾÐÅÏ¢Mark
#  @param msgParamList ÐÅÏ¢²ÎÊýÁбí
#  @return ÎÞ·µ»ØÖµ
#  @remarks 
def FamilyNotify(familyID, msgMark, msgParamList=[]):
    GameWorld.GetPlayerManager().FamilyNotifyCode(familyID, msgMark, __GetNotifyCodeList(msgParamList))
    return
 
## ¶ÓÎé¹ã²¥
#  @param teamID ¶ÓÎéID
#  @param msgMark ÌáʾÐÅÏ¢Mark
#  @param msgParamList ÐÅÏ¢²ÎÊýÁбí
#  @return ÎÞ·µ»ØÖµ
def TeamNotify(teamID, msgMark, msgParamList=[]):
    curTeam = GameWorld.GetGameWorld().GetTeamManager().FindTeam(teamID)
    if curTeam == None:
        return
    
    for i in range(curTeam.GetMemberCount()):
        curPlayer = curTeam.GetMemberPlayer(i)
        if not curPlayer:
            continue
        
        #֪ͨÿ¸ö¶ÓÔ±
        NotifyCode(curPlayer, msgMark, msgParamList)
    
    return
 
#---------------------------------------------------------------------
## ¹¹½¨ÏµÍ³Ìáʾ²ÎÊýÁбí
#  @param msgParamList ÐÅÏ¢²ÎÊýÁбí
#  @return ÏµÍ³Ìáʾ²ÎÊýÁбí IPY_NotifyCodeList
#  @remarks 
def __GetNotifyCodeList(msgParamList):
    #ÏûÏ¢ÌáʾÁбí, ÏÈÇåÔÚÌí¼Ó
    global NotifyCodeList
    NotifyCodeList.Clear()
    
    if not msgParamList:
        return NotifyCodeList
    
    for msg in msgParamList:
        itemPythonType = type(msg)
        
        if itemPythonType is types.IntType or itemPythonType is types.LongType:
            #PythonÒªÑéÖ¤ÕûÐͺͳ¤ÕûÐÍ
            NotifyCodeList.AddInt(msg)
        else:
            NotifyCodeList.AddStr(msg)
 
    return NotifyCodeList
 
 
 
#waring:ÒÔÏÂʹÓõÄÀ©Õ¹ÊôÐÔ×ֶμǼµÄÊôÐÔÀàÐͱØÐëºÍMapServerÒ»ÖÂ
#------------------------------------------------------------------------------ 
##ÉèÖþö¶·Öµ(¾º¼¼³¡ÓÃ)
# @param curPlayer Íæ¼Ò
# @param value ÊýÖµ
# @return None
def SetVsFightValue(curPlayer, value):
    return
 
 
##»ñÈ¡¾ö¶·Öµ(¾º¼¼³¡ÓÃ)
# @param curPlayer Íæ¼Ò
# @return ¾ö¶·Öµ
def GetVsFightValue(curPlayer):
    return 0
 
#------------------------------------------------------------------------------ 
## ÉèÖÃÍþÍû
#  @param curPlayer: Íæ¼ÒʵÀý
#  @param value: ÍþÍûÖµ
#  @return: 
def SetPrestige(curPlayer, value):
    return
 
 
## »ñÈ¡ÍþÍû
#  @param curPlayer: Íæ¼ÒʵÀý
#  @return: ÍþÍûÖµ
def GetPrestige(curPlayer):
    return 0
 
 
#------------------------------------------------------------------------------ 
## ÉèÖÃÍæ¼Ò¿ç·þÔ¤ÈüÅÅλ
#  @param curPlayer: Íæ¼ÒʵÀý
#  @param value: ÍþÍûÖµ
#  @return: 
def SetMergeWarRank(curPlayer, value):
    curPlayer.SetExAttr10(value)
    return
 
 
## »ñÈ¡Íæ¼Ò¿ç·þÔ¤ÈüÅÅλ
#  @param curPlayer: Íæ¼ÒʵÀý
#  @return: ÍþÍûÖµ
def GetMergeWarRank(curPlayer):
    return curPlayer.GetExAttr10()
 
## Ö°Òµ½×Êý
def GetJobRank(curPlayer): return curPlayer.GetExAttr1()
def SetJobRank(curPlayer, jobRank): return curPlayer.SetExAttr1(jobRank)
 
##VIPµ½ÆÚʱ¼ä
def GetVIPExpireTime(curPlayer): return curPlayer.GetExAttr9()
def SetVIPExpireTime(curPlayer, expireTime): return curPlayer.SetExAttr9(expireTime)
def GetValidVIPLV(curPlayer):
    # @return: ·µ»Øµ±Ç°ÓÐЧµÄVIPµÈ¼¶
#    vipTime = GetVIPExpireTime(curPlayer)
#    curTime = GameWorld.ChangeTimeStrToNum(GameWorld.GetCurrentDataTimeStr())
#    if vipTime <= curTime:
#        return 0
    return curPlayer.GetVIPLv()
 
## ÊÇ·ñÍÑ»ú¹Ò»ú״̬
def GetIsTJG(curPlayer):
    if curPlayer.GetDictByKey(ChConfig.Def_OnlineType):
        return True
    
    if curPlayer.GetIP() == "127.0.0.1":
        # ´Ë´¦Ö»ÄÜÓÃIPÅж¨£¬ÒòΪÍÑ»ú״̬»¹Î´Í¨Öªµ½GameServer
        return True
    
    return False
 
def SetIsTJG(curPlayer, state): curPlayer.SetDict(ChConfig.Def_OnlineType, state)
## »ñÈ¡ÍÑ»ú¹Ò»úÊ£Óàʱ¼ä
def GetTJGTime(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_TJGTime)
def SetTJGTime(curPlayer, tjgTime): curPlayer.SetDict(ChConfig.Def_TJGTime, tjgTime)
 
# ½ûÑÔ
def GetGMForbidenTalk(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_ForbiddenTalk)
def SetGMForbidenTalk(curPlayer, value): curPlayer.SetDict(ChConfig.Def_ForbiddenTalk, value)
 
 
#------------------------------------------------------------------------------ 
 
 
## ÉèÖÃÐÂÊÖÖ¸µ¼Ô±ÌìÊý
#  @param curPlayer: Íæ¼ÒʵÀý
#  @param day: ÌìÊý
#  @return: 
def SetFreshmanGuiderDay(curPlayer, day):
    curPlayer.SetDict(ChConfig.Def_PlayerKey_FreshmanGuiderDay, day) 
    return
 
## »ñÈ¡ÐÂÊÖÖ¸µ¼Ô±ÌìÊý
#  @param curPlayer: Íæ¼ÒʵÀý
#  @return: ÌìÊý
def GetFreshmanGuiderDay(curPlayer):
    return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_FreshmanGuiderDay)
 
## Ôö¼Ó³É¾ÍÍê³É½ø¶È
#  @param curPlayer
#  @param successType: ³É¾ÍÀàÐÍ
#  @param addCnt: Ôö¼Ó½ø¶ÈÖµ
#  @param condition: À©Õ¹Ìõ¼þ
#  @return
def DoAddSuccessProgress(curPlayer, successType, addCnt, condition=[]):
    if successType not in ShareDefine.SuccessTypeList:
        return
    
    sysMsg = '%s'%([successType, addCnt, condition])
    curPlayer.MapServer_QueryPlayerResult(0, 0, "AddSuccessProgress", sysMsg, len(sysMsg))
    return
 
## ÉèÖÃÍæ¼Ò·¿¼äID
#  @param curPlayer
#  @param roomID
#  @return
def SetVsRoomId(curPlayer, roomID, isSetMergeRegRoomID=False):
    curPlayer.SetVsRoomId(roomID)
    if isSetMergeRegRoomID:
        curPlayer.SetDict(ChConfig.Def_PlayerKey_MergeRegisterRoomID, roomID) 
    
    battleIDStr = str(roomID)
    GameWorld.Log("SetVSRoomID playerID=%s, roomID=%s" % (curPlayer.GetPlayerID(), roomID))
    curPlayer.MapServer_QueryPlayerResult(0, 0, 'CreatePlayerRoomID', battleIDStr, len(battleIDStr))
    return
 
## ¸ù¾Ý×Ó·þÕ˺ż°Ãû³Æ»ñÈ¡¿ç·þ½ÇÉ«Ãû
def GetMergePlayerName(playerAccID, playerName):
    orgPlayerName = playerName.strip()
    
    #È¡Õʺźó׺×÷ÎªÇø·þ±êʶ
    parserList = playerAccID.split('@')
    serverSign = ""
    if len(parserList) >= 2:
        serverSign = parserList[-1]               
    
    parserList2 = orgPlayerName.split('-')
    orgNameServerSign = ""
    nameNotServerSign = parserList2[0]
    if len(parserList2) >= 2:
        orgNameServerSign = parserList2[-1]
        
    if orgNameServerSign:
        if orgNameServerSign == serverSign:
            return orgPlayerName
        else:
            return "%s-%s" % (nameNotServerSign, serverSign)
    
    if serverSign:
        return "%s-%s" % (nameNotServerSign, serverSign)
    
    return orgPlayerName
 
## µØÍ¼·þÎñÆ÷¿ÛÎïÆ·
#  @param curPlayer
#  @param itemList [(itemID,count), (itemID,count),..]
def MapServerDelItem(curPlayer, itemList, eventName):
    result = str([itemList, eventName])
    curPlayer.MapServer_QueryPlayerResult(0, 0, "DelItem", result, len(result))
    return
 
## Ôö¼ÓÏÉÃË»îÔ¾
#  @param curPlayer
#  @param successType: ³É¾ÍÀàÐÍ
#  @param addCnt: Ôö¼Ó½ø¶ÈÖµ
#  @param condition: À©Õ¹Ìõ¼þ
#  @return
def DoAddFamilyActivity(curPlayer, actionid, addCnt):
    if actionid not in ShareDefine.FamilyActiveIDList:
        return
    sysMsg = '%s'%([actionid, addCnt])
    curPlayer.MapServer_QueryPlayerResult(0, 0, "AddFamilyActivity", sysMsg, len(sysMsg))
    return
 
## »ñÈ¡¹¦ÄÜÏÞÖÆµÈ¼¶(µÈ¼¶Ìõ¼þΪȫ¾Ö)
def GetFuncLimitLV(funcID):
    ipyData = IpyGameDataPY.GetIpyGameData("FuncOpenLV", funcID)
    if not ipyData:
        return 0
    
    return ipyData.GetLimitLV()