hxp
2 天以前 388823edfe6308cba6f76ca6dc4f20022c5cb2be
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
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
#!/usr/bin/python
# -*- coding: GBK -*-
#-------------------------------------------------------------------------------
#
##@package Player.PlayerTongTianLing
#
# @todo:ͨÌìÁî
# @author hxp
# @date 2022-01-17
# @version 1.0
#
# ÏêϸÃèÊö: Í¨ÌìÁî
#
#-------------------------------------------------------------------------------
#"""Version = 2022-01-17 19:00"""
#-------------------------------------------------------------------------------
 
import GameWorld
import ShareDefine
import PlayerControl
import IpyGameDataPY
import ChPyNetSendPack
import NetPackCommon
import ItemControler
import ChConfig
import time
 
TTL_LVAwardKeyCount = 2
TTL_TaskAwardKeyCount = 9
 
def OnPlayerLogin(curPlayer):
    if CheckTongTianLingReset(curPlayer):
        return
    SyncTongTianLVInfo(curPlayer)
    SyncTongTianTaskInfo(curPlayer)
    SyncTongTianTaskAward(curPlayer)
    return
 
def OnDay(curPlayer, onEventType):
    
    if onEventType == ShareDefine.Def_OnEventType:
        # ³£¹æÊ±¼ä0µã¹ýÌì¼ì²éÖØÖÃ
        if CheckTongTianLingReset(curPlayer):
            return
        return
    
    resetTaskTypeList, resetTaskIDList = [], []
    ipyDataMgr = IpyGameDataPY.IPY_Data()
    for index in xrange(ipyDataMgr.GetTongTianTaskCount()):
        ipyData = ipyDataMgr.GetTongTianTaskByIndex(index)
        if not ipyData.GetIsDailyTask():
            continue
        ttTaskID = ipyData.GetTTTaskID()
        ttTaskType = ipyData.GetTTTaskType()
        resetTaskTypeList.append(ttTaskType)
        
        if GameWorld.GetDictValueByBit(curPlayer, ChConfig.Def_PDict_TTL_TaskAwardRecord, ttTaskID):
            GameWorld.SetDictValueByBit(curPlayer, ChConfig.Def_PDict_TTL_TaskAwardRecord, ttTaskID, 0)
            resetTaskIDList.append(ttTaskID)
            
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TTL_DailyTaskPointToday, 0)
    isDailyTask = 1 # Ö»´¦ÀíÿÈÕÖØÖõÄÈÎÎñ
    syncTaskInfoList = []
    for ttTaskType in resetTaskTypeList:
        curValue = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TTL_TaskValue % (ttTaskType, isDailyTask))
        if not curValue:
            continue
        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TTL_TaskValue % (ttTaskType, isDailyTask), 0)
        syncTaskInfoList.append([ttTaskType, isDailyTask])
        
    if syncTaskInfoList:
        #GameWorld.DebugLog("ÖØÖÃͨÌìÈÎÎñ½ø¶È: syncTaskInfoList=%s" % syncTaskInfoList)
        SyncTongTianTaskInfo(curPlayer, syncTaskInfoList)
        
    if resetTaskIDList:
        #GameWorld.DebugLog("ÖØÖÃͨÌìÈÎÎñ½±Àø: resetTaskIDList=%s" % resetTaskIDList)
        SyncTongTianTaskAward(curPlayer)
        
    return
 
def CheckTongTianLingReset(curPlayer):
    ## ¼ì²éͨÌìÁîÖØÖÃ
    
    playerID = curPlayer.GetPlayerID()
    resetDays = IpyGameDataPY.GetFuncCfg("TongTianLing", 4)
    if resetDays <= 0:
        return
    
    curTime = int(time.time())
    startTime = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TTL_StartTime)
    passDays = GameWorld.GetDiff_Day(curTime, startTime) + 1
    if passDays <= resetDays:
        GameWorld.DebugLog("ͨÌìÁî±¾ÂÖÌìÊýδÍ꣬²»ÖØÖÃ! startTime(%s),passDays=%s <= %s" 
                           % (GameWorld.ChangeTimeNumToStr(startTime), passDays, resetDays), playerID)
        return
    
    syncTaskInfoList = []
    for ttTaskType in ChConfig.TTLTaskTypeList:
        for isDailyTask in [0, 1]:
            curValue = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TTL_TaskValue % (ttTaskType, isDailyTask))
            if not curValue:
                continue
            PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TTL_TaskValue % (ttTaskType, isDailyTask), 0)
            syncTaskInfoList.append([ttTaskType, isDailyTask])
            
    for i in xrange(TTL_LVAwardKeyCount):
        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TTL_CommAwardRecord % i, 0)
        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TTL_XianAwardRecord % i, 0)
        
    for i in xrange(TTL_TaskAwardKeyCount):
        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TTL_TaskAwardRecord % i, 0)
        
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TTL_StartTime, curTime)
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TTL_LVInfo, 0)
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TTL_LVPoint, 0)
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TTL_DailyTaskPointToday, 0)
    
    GameWorld.Log("ͨÌìÁîÖØÖÃ! StartTime=%s" % curTime, playerID)
    SyncTongTianLVInfo(curPlayer)
    SyncTongTianTaskInfo(curPlayer, syncTaskInfoList)
    SyncTongTianTaskAward(curPlayer)
    return True
 
def GetTongTianLingLVInfo(curPlayer):
    ## »ñȡͨÌìÁîµÈ¼¶×´Ì¬ÐÅÏ¢
    # @return: Í¨ÌìÁîµÈ¼¶, ÊÇ·ñ¼¤»îͨÌìÁî
    lvInfo = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TTL_LVInfo)
    ttLV, ttState = lvInfo / 10, lvInfo % 10
    return ttLV, ttState
 
def SetTongTianLingLVInfo(curPlayer, ttLV, ttState):
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TTL_LVInfo, ttLV * 10 + ttState)
    return
 
def AddTongTianTaskValue(curPlayer, ttTaskType, addValue):
    ## Ôö¼ÓͨÌìÁîÈÎÎñ½ø¶È
    
    taskIpyList = IpyGameDataPY.GetIpyGameDataByCondition("TongTianTask", {"TTTaskType":ttTaskType}, True, False)
    if not taskIpyList:
        return
    
    addValueDict = {}
    for ipyData in taskIpyList:
        taskID = ipyData.GetTTTaskID()
        if GameWorld.GetDictValueByBit(curPlayer, ChConfig.Def_PDict_TTL_TaskAwardRecord, taskID):
            # ÒÑÁì½±µÄ²»ÔÙ´¦Àí
            continue
        isDailyTask = ipyData.GetIsDailyTask()
        finishNeedValue = ipyData.GetFinishNeedValue()
        maxValue = addValueDict.get((ttTaskType, isDailyTask), 0)
        if finishNeedValue > maxValue:
            addValueDict[(ttTaskType, isDailyTask)] = finishNeedValue
            
    syncTaskInfoList = []
    for key, finishNeedValue in addValueDict.items():
        ttTaskType, isDailyTask = key
        curValue = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TTL_TaskValue % (ttTaskType, isDailyTask))
        if curValue >= finishNeedValue:
            continue
        updValue = min(curValue + addValue, finishNeedValue)
        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TTL_TaskValue % (ttTaskType, isDailyTask), updValue)
        #GameWorld.DebugLog("¸üÐÂͨÌìÁîÈÎÎñ½ø¶È: ttTaskType=%s,isDailyTask=%s,curValue=%s,addValue=%s,updValue=%s" 
        #                   % (ttTaskType, isDailyTask, curValue, addValue, updValue), curPlayer.GetPlayerID())
        syncTaskInfoList.append([ttTaskType, isDailyTask])
        
    if syncTaskInfoList:
        SyncTongTianTaskInfo(curPlayer, syncTaskInfoList)
        
    return
 
def AddTongTianPoint(curPlayer, addPoint):
    ## Ôö¼ÓͨÌìÁî¾­Ñéµã
    playerID = curPlayer.GetPlayerID()
    ttLV, ttState = GetTongTianLingLVInfo(curPlayer)
    ttPoint = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TTL_LVPoint)
    ipyData = IpyGameDataPY.GetIpyGameData("TongTianLV", ttLV)
    if not ipyData:
        return
    lvUPPoint = ipyData.GetLVUPPoint()
    if not lvUPPoint:
        GameWorld.DebugLog("ͨÌìÁîÒÑÂú¼¶!", playerID)
        return
    updLV = ttLV
    updPoint = ttPoint + addPoint
    GameWorld.DebugLog("Ôö¼ÓͨÌìÁî¾­Ñé: ttLV=%s,ttPoint=%s,addPoint=%s,updPoint=%s,lvUPPoint=%s" 
                       % (ttLV, ttPoint, addPoint, updPoint, lvUPPoint), playerID)
    doCount = 0
    while lvUPPoint and updPoint >= lvUPPoint and doCount < 50:
        doCount += 1
        updPoint -= lvUPPoint
        updLV += 1
        nextLVIPYData = IpyGameDataPY.GetIpyGameDataNotLog("TongTianLV", updLV)
        lvUPPoint = nextLVIPYData.GetLVUPPoint() if nextLVIPYData else 0
        GameWorld.DebugLog("    Í¨ÌìÁîÉý¼¶: updLV=%s,updPoint=%s,nextLVUPPoint=%s" % (updLV, updPoint, lvUPPoint), playerID)
        
    SetTongTianLingLVInfo(curPlayer, updLV, ttState)
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TTL_LVPoint, updPoint)
    SyncTongTianLVInfo(curPlayer)
    return updLV, updPoint
 
#// A5 43 Í¨ÌìÁîÁìÈ¡ÈÎÎñ½±Àø #tagCMGetTongTianTaskAward
#
#struct    tagCMGetTongTianTaskAward
#{
#    tagHead        Head;
#    BYTE        TaskID;    // ÈÎÎñID
#};
def OnGetTongTianTaskAward(index, clientData, tick):
    curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
    playerID = curPlayer.GetPlayerID()
    ttTaskID = clientData.TaskID
    
    ipyData = IpyGameDataPY.GetIpyGameData("TongTianTask", ttTaskID)
    if not ipyData:
        return
    
    if GameWorld.GetDictValueByBit(curPlayer, ChConfig.Def_PDict_TTL_TaskAwardRecord, ttTaskID):
        GameWorld.DebugLog("ͨÌìÈÎÎñÒÑÁì½±! ttTaskID=%s" % ttTaskID, playerID)
        return
    
    ttTaskType = ipyData.GetTTTaskType()
    isDailyTask = ipyData.GetIsDailyTask()
    finishNeedValue = ipyData.GetFinishNeedValue()
    curValue = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TTL_TaskValue % (ttTaskType, isDailyTask))
    if curValue < finishNeedValue:
        GameWorld.DebugLog("ͨÌìÈÎÎñ½ø¶ÈδÍê³É£¬ÎÞ·¨Áì½±! ttTaskID=%s,ttTaskType=%s,isDailyTask=%s,curValue=%s < %s" 
                           % (ttTaskID, ttTaskType, isDailyTask, curValue, finishNeedValue), playerID)
        return
    
    addTaskPoint = ipyData.GetTaskPoint()
    dailyTaskPointMax = IpyGameDataPY.GetFuncCfg("TongTianLing", 3)
    if isDailyTask and dailyTaskPointMax:
        dailyTaskPointToday = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TTL_DailyTaskPointToday)
        if dailyTaskPointToday >= dailyTaskPointMax:
            GameWorld.DebugLog("ͨÌìÈÎÎñÈÕ³£ÈÎÎñ»ý·Ö½±ÀøÒÑ´ïÉÏÏÞ! ttTaskID=%s,ttTaskType=%s,dailyTaskPointToday=%s >= %s" 
                               % (ttTaskID, ttTaskType, dailyTaskPointToday, dailyTaskPointMax), playerID)
            return
        addTaskPoint = min(addTaskPoint, dailyTaskPointMax - dailyTaskPointToday)
        dailyTaskPointToday += addTaskPoint
        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TTL_DailyTaskPointToday, dailyTaskPointToday)
        GameWorld.DebugLog("¸üÐÂͨÌìÈÎÎñÈÕ³£ÈÎÎñ½ñÈÕÒÑ»ñµÃ»ý·Ö: dailyTaskPointToday=%s" % dailyTaskPointToday, playerID)
    GameWorld.SetDictValueByBit(curPlayer, ChConfig.Def_PDict_TTL_TaskAwardRecord, ttTaskID, 1)
    AddTongTianPoint(curPlayer, addTaskPoint)
    SyncTongTianTaskAward(curPlayer)
    return
 
#// A5 44 Í¨ÌìÁîÁìÈ¡µÈ¼¶½±Àø #tagCMGetTongTianLVAward
#
#struct    tagCMGetTongTianLVAward
#{
#    tagHead        Head;
#    BYTE        TTLV;    // ÁìÈ¡¶ÔÓ¦µÈ¼¶½±Àø£¬·¢255Ϊһ¼üÁìÈ¡ËùÓеȼ¶½±Àø£¬°üº¬ÏÉÆ·½±Àø
#    BYTE        IsXian;    // ÊÇ·ñÁìÈ¡ÏÉÆ·½±Àø£¬½öÖ¸¶¨µÈ¼¶½±ÀøÓÐЧ
#};
def OnGetTongTianLVAward(index, clientData, tick):
    curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
    playerID = curPlayer.GetPlayerID()
    getTTLVLV = clientData.TTLV
    isXian = clientData.IsXian
    
    ttLV, ttState = GetTongTianLingLVInfo(curPlayer)
    if getTTLVLV == 255:
        awardLVList = range(0, ttLV + 1)
        isXian = 1 # Ò»¼üÁìÈ¡µÄĬÈϰüº¬ÏÉÆ·½±Àø
    else:
        awardLVList = [getTTLVLV]
        
    GameWorld.DebugLog("ÁìȡͨÌìÁî½±Àø: getTTLVLV=%s,isXian=%s,awardLVList=%s" % (getTTLVLV, isXian, awardLVList), playerID)
    
    notifyItemIDList = []
    itemList = []
    for awardTTLV in awardLVList:
        if awardTTLV > ttLV:
            GameWorld.DebugLog("    Í¨ÌìµÈ¼¶²»×㣬ÎÞ·¨Áì½±! awardTTLV=%s < %s" % (awardTTLV, ttLV), playerID)
            break
        ipyData = IpyGameDataPY.GetIpyGameData("TongTianLV", awardTTLV)
        if not ipyData:
            continue
        commAwardItemList = ipyData.GetCommAwardItemList()
        xianAwardItemList = ipyData.GetXianAwardItemList()
        notifyItemIDList.extend(ipyData.GetNotifyItemIDList())
        
        if commAwardItemList and not GameWorld.GetDictValueByBit(curPlayer, ChConfig.Def_PDict_TTL_CommAwardRecord, awardTTLV):
            GameWorld.SetDictValueByBit(curPlayer, ChConfig.Def_PDict_TTL_CommAwardRecord, awardTTLV, 1)
            itemList.extend(commAwardItemList)
            GameWorld.DebugLog("    ³£¹æ½±Àø: awardTTLV=%s,commAwardItemList=%s" % (awardTTLV, commAwardItemList), playerID)
        #elif commAwardItemList:
        #    GameWorld.DebugLog("    ÒÑÁìÈ¡¹ý¸Ã½±Àø: awardTTLV=%s" % (awardTTLV), playerID)
                
        getXian = (isXian and xianAwardItemList)
        if getXian and ttState and not GameWorld.GetDictValueByBit(curPlayer, ChConfig.Def_PDict_TTL_XianAwardRecord, awardTTLV):
            GameWorld.SetDictValueByBit(curPlayer, ChConfig.Def_PDict_TTL_XianAwardRecord, awardTTLV, 1)
            itemList.extend(xianAwardItemList)
            GameWorld.DebugLog("    ÏÉÆ·½±Àø: awardTTLV=%s,xianAwardItemList=%s" % (awardTTLV, xianAwardItemList), playerID)
        #elif getXian:
        #    GameWorld.DebugLog("    ÏÉÆ·Í¨ÌìÁîδ¼¤»î»òÒÑÁì½±: awardTTLV=%s,ttState=%s" % (awardTTLV, ttState), playerID)
            
    GameWorld.DebugLog("    ×îÖÕ½±Àø: itemList=%s" % itemList, playerID)
    if not itemList:
        return
    
    giveItemDict = {}
    for itemID, itemCount, isBind in itemList:
        key = (itemID, isBind)
        giveItemDict[key] = giveItemDict.get(key, 0) + itemCount
        
    awardItemList = []
    for key, itemCount in giveItemDict.items():
        itemID, isBind = key
        awardItemList.append([itemID, itemCount, isBind])
        if itemID in notifyItemIDList:
            PlayerControl.NotifyCode(curPlayer, "TongTianLingLVAward", [curPlayer.GetPlayerName(), itemID, itemCount])
            
    GameWorld.DebugLog("    »ã×ܽ±Àø: awardItemList=%s" % awardItemList, playerID)
    dataDict = {"awardLVList":awardLVList, "isXian":isXian}
    ItemControler.GivePlayerItemOrMail(curPlayer, awardItemList, event=["TongTianLing", False, dataDict])
    SyncTongTianLVInfo(curPlayer)
    return
 
#// A5 45 ¶Ò»»Í¨ÌìÁîµÈ¼¶¾­Ñé»ý·Öµã #tagCMExchangeTongTianLVPoint
#
#struct    tagCMExchangeTongTianLVPoint
#{
#    tagHead        Head;
#    DWORD        ExchangePoint;    // ¶Ò»»µãÊý
#};
def OnExchangeTongTianLVPoint(index, clientData, tick):
    curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
    playerID = curPlayer.GetPlayerID()
    exchangePoint = clientData.ExchangePoint
    exchangeCostInfo = IpyGameDataPY.GetFuncEvalCfg("TongTianLing", 1)
    if len(exchangeCostInfo) != 2:
        return
    costMoneyType, costMoneyValue = exchangeCostInfo
    if not costMoneyType or not costMoneyValue:
        return
    
    ttLV = GetTongTianLingLVInfo(curPlayer)[0]
    ttPoint = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TTL_LVPoint)
    canBuyPointMax = 0
    ipyDataMgr = IpyGameDataPY.IPY_Data()
    for index in xrange(ttLV, ipyDataMgr.GetTongTianLVCount()):
        ipyData = ipyDataMgr.GetTongTianLVByIndex(index)
        canBuyPointMax += ipyData.GetLVUPPoint()
    canBuyPointMax -= ttPoint
    
    exchangePoint = min(exchangePoint, canBuyPointMax)
    costMoneyTotal = costMoneyValue * exchangePoint
    GameWorld.DebugLog("¶Ò»»Í¨ÌìÁîµÈ¼¶¾­Ñé: ttLV=%s,ttPoint=%s,exchangePoint=%s,canBuyPointMax=%s,costMoneyType=%s,costMoneyTotal=%s" 
                       % (ttLV, ttPoint, exchangePoint, canBuyPointMax, costMoneyType, costMoneyTotal), playerID)
    
    if not PlayerControl.HaveMoney(curPlayer, costMoneyType, costMoneyTotal):
        return
        
    updInfo = AddTongTianPoint(curPlayer, exchangePoint)
    updLV, updPoint = updInfo if updInfo else (ttLV, ttPoint)
    
    infoDict = {ChConfig.Def_Cost_Reason_SonKey:"ExchangeTongTianLVPoint", "exchangePoint":exchangePoint, 
                "ttLV":ttLV, "ttPoint":ttPoint, "updLV":updLV, "updPoint":updPoint}
    PlayerControl.PayMoney(curPlayer, costMoneyType, costMoneyTotal, ChConfig.Def_Cost_TongTianLing, infoDict)
    return
 
#// A5 46 ¹ºÂòͨÌìÁî #tagCMBuyTongTianLing
#
#struct    tagCMBuyTongTianLing
#{
#    tagHead        Head;
#};
def OnBuyTongTianLing(index, clientData, tick):
    # ·ÏÆú£¬¸ÄΪ³äÖµ¼¤»î
    return
 
def OnActiviteTTTByCTGID(curPlayer, ctgID):
    ctgIDList = IpyGameDataPY.GetFuncEvalCfg("TongTianLing", 5)
    if ctgID not in ctgIDList:
        return
    
    playerID = curPlayer.GetPlayerID()
    ttLV, ttState = GetTongTianLingLVInfo(curPlayer)
    if ttState:
        GameWorld.DebugLog("ͨÌìÁîÒѾ­¹ºÂò¹ýÁË£¡", playerID)
        return
    
    ttState = 1
    SetTongTianLingLVInfo(curPlayer, ttLV, ttState)
    GameWorld.DebugLog("¹ºÂò¼¤»îͨÌìÁ", playerID)
    PlayerControl.NotifyCode(curPlayer, "TongTianLingActive")
    SyncTongTianLVInfo(curPlayer)
    return
 
def SyncTongTianLVInfo(curPlayer):
    ## µÈ¼¶ÐÅÏ¢
    ttLV, ttState = GetTongTianLingLVInfo(curPlayer)
    clientPack = ChPyNetSendPack.tagMCTongTianLingInfo()
    clientPack.TTLBuyState = ttState
    clientPack.TTLLV = ttLV
    clientPack.CurPoint = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TTL_LVPoint)
    clientPack.CommAwardStateList = []
    clientPack.XianAwardStateList = []
    for i in xrange(TTL_LVAwardKeyCount):
        clientPack.CommAwardStateList.append(curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TTL_CommAwardRecord % i))
        clientPack.XianAwardStateList.append(curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TTL_XianAwardRecord % i))
    clientPack.AwardStateCount = len(clientPack.CommAwardStateList)
    clientPack.StartTime = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TTL_StartTime)
    NetPackCommon.SendFakePack(curPlayer, clientPack)
    return
 
def SyncTongTianTaskInfo(curPlayer, syncTaskInfoList=None):
    ## ÈÎÎñ½ø¶ÈÐÅÏ¢
    syncAppoint = True
    if syncTaskInfoList == None:
        syncAppoint = False
        syncTaskInfoList = []
        for ttTaskType in ChConfig.TTLTaskTypeList:
            syncTaskInfoList.append([ttTaskType, 0])
            syncTaskInfoList.append([ttTaskType, 1])
            
    clientPack = ChPyNetSendPack.tagMCTongTianLingTaskValueInfo()
    clientPack.TaskValueList = []
    for ttTaskType, isDailyTask in syncTaskInfoList:
        curValue = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TTL_TaskValue % (ttTaskType, isDailyTask))
        if not curValue and not syncAppoint:
            continue
        task = ChPyNetSendPack.tagMCTongTianLingTaskValue()
        task.TaskType = ttTaskType
        task.IsDaily = isDailyTask
        task.TaskValue = curValue
        clientPack.TaskValueList.append(task)
    clientPack.Count = len(clientPack.TaskValueList)
    NetPackCommon.SendFakePack(curPlayer, clientPack)
    return
 
def SyncTongTianTaskAward(curPlayer):
    ## ÈÎÎñ½±ÀøÐÅÏ¢
    clientPack = ChPyNetSendPack.tagMCTongTianLingTaskAwardInfo()
    clientPack.TaskAwardStateList = []
    for i in xrange(TTL_TaskAwardKeyCount):
        clientPack.TaskAwardStateList.append(curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TTL_TaskAwardRecord % i))
    clientPack.AwardStateCount = len(clientPack.TaskAwardStateList)
    NetPackCommon.SendFakePack(curPlayer, clientPack)
    return