xdh
2019-01-28 8305e47be942c376430044332780e6e69a3c7a7f
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
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
#!/usr/bin/python
# -*- coding: GBK -*-
#-------------------------------------------------------------------------------
#
#-------------------------------------------------------------------------------
#
##@package Player.PlayerTeHui
#
# @todo:ÌØ»Ý»î¶¯
# @author hxp
# @date 2014-06-21
# @version 2.2
#
# @change: "2014-08-27 14:30" hxp Ôö¼ÓÁ콱ȫ·þ¹ã²¥
# @change: "2014-09-28 17:30" hxp Ôö¼Ó³äÖµÅÅÐÐÌØ»Ý»î¶¯
# @change: "2014-12-02 11:30" hxp ºÏ·þÕÛ¿Ûµê
# @change: "2014-12-26 00:05" Alee ÑéÖ¤¹¦Äܽ׼¶
# @change: "2015-01-23 14:30" hxp ³äÖµÌØ»Ý»î¶¯±ä¸üʱÔö¼ÓÓʼþ²¹·¢ÉÏ´ÎδÁìÈ¡µÄ³äÖµ½±Àø
# @change: "2015-01-29 22:30" hxp ÌػݳäÖµÈÕÖ¾
# @change: "2015-02-11 16:30" hxp Ôö¼ÓÇеØÍ¼³É¹¦ºó¼ì²éÌØ»Ý»î¶¯Ïà¹Ø
# @change: "2015-04-16 19:10" ljd Ôö¼ÓÏû·Ñ·µÀû¡¢Ôö¼Ó²»¼ÆÏû·Ñ·µÀûÉ̵êNPCIDÁбí
# @change: "2016-07-20 14:30" hxp Ïû·ÑµãÏû·Ñ¼Ç¼Âß¼­µ÷Õû
# @change: "2016-10-14 14:30" xdh ÀÛ³ä»î¶¯ÏµÍ³Ìáʾ¿ª³öÅäÖÃ
# @change: "2017-06-14 11:00" hxp »¹Ô­ÌØ»ÝÏû·Ñ·µÀû°ñ
# @change: "2017-07-07 11:30" hxp ÐÞ¸´³äÖµÅÅÐС¢³äÖµ·µÀû¡¢Ïû·ÑÅÅÐиüл×êʯkeyֵʱûÓиø²ÎÊý¿ÉÄÜ´æÔÚÖµ²»¸üеÄbug
# ÏêϸÃèÊö: Ìػݻ
#---------------------------------------------------------------------
#"""Version = 2017-07-07 11:30"""
#---------------------------------------------------------------------
import ShareDefine
import GameWorld
import ChConfig
import ReadChConfig
import ItemCommon
import IPY_GameWorld
import PlayerControl
import ItemControler
import ChPyNetSendPack
import NetPackCommon
import DataRecordPack
import ShopItemManage
import PlayerBillboard
 
(
Recharge_Type_Single, # ³äÖµÌØ»Ý¹æÔòÀàÐÍ - µ¥±Ê³äÖµ
Recharge_Type_Total, # ³äÖµÌØ»Ý¹æÔòÀàÐÍ - ÀۼƳäÖµ
) = range(2)
 
(
Recharge_Type, # ³äÖµÌØ»Ý¹æÔòÀàÐÍ
Recharge_NeedGold, # ËùÐè×êʯÊý
Recharge_MaxCnt, # ×î´ó½±Àø´ÎÊý
Recharge_AwardItemInfo, # ½±ÀøÐÅÏ¢
) = range(4)
 
# Ïû·Ñ½±ÀøÅäÖàTeHuiAction_CostProfitAward
(
CostProfit_GoldNum, # ×êʯÊý
CostProfit_NeedSpace, # ÐèÒªµÄ±³°ü¸ñ×ÓÊý
CostProfit_ItemList, # ½±ÀøÎïÆ·ÐÅÏ¢Áбí
) = range(3)
 
## »ñÈ¡Íæ¼ÒÌØ»Ý»î¶¯×ÖµäÖµ
#  @param curPlayer:
#  @return: None 
def __GetPlayerTeHuiDictValue(curPlayer, key, defaultValue=0):
    return curPlayer.NomalDictGetProperty(key, defaultValue, ChConfig.Def_PDictType_TeHuiAction)
 
 
## ÉèÖÃÍæ¼ÒÌØ»Ý»î¶¯×ÖµäÖµ
#  @param curPlayer:
#  @return: None 
def __SetPlayerTeHuiDictValue(curPlayer, key, value):
    PlayerControl.NomalDictSetProperty(curPlayer, key, value, ChConfig.Def_PDictType_TeHuiAction)
    return
 
## »ñÈ¡µ±Ç°»î¶¯ÕÛ¿ÛµêIDÁбí
#  @param None:
#  @return: None 
def GetCurActionShowIDList():
    return [GetCurActionShopID(), GetCurMixActionShopID()]
 
## »ñÈ¡µ±Ç°»î¶¯ÕÛ¿ÛµêID
#  @param None:
#  @return: None 
def GetCurActionShopID():
    gameWorld = GameWorld.GetGameWorld()
    shopIDKey = ShareDefine.Def_Notify_WorldKey_DayAction_DiscountShop
    shopID = gameWorld.GetGameWorldDictByKey(shopIDKey)
    return shopID
 
## »ñÈ¡µ±Ç°ºÏ·þ»î¶¯ÕÛ¿ÛµêID
#  @param None:
#  @return: None 
def GetCurMixActionShopID():
    gameWorld = GameWorld.GetGameWorld()
    mixShopIDKey = ShareDefine.Def_Notify_WorldKey_DayAction_MixDiscountShop
    mixShopID = gameWorld.GetGameWorldDictByKey(mixShopIDKey)
    return mixShopID
 
## Ìػݻ¸Ä±äʱ(µÇ½ ºÍ  key¸Ä±äʱ)
#  @param curPlayer: Ö÷½Ç
#  @return: None 
def ChangeTeHuiActionState(key):
    #__CheckResetAllPlayerData(key)
    return
 
 
## Íæ¼ÒµÇ¼ʱ
#  @param curPlayer:Íæ¼Ò
#  @return None
def PlayerLogin_TeHui(curPlayer):
    #===========================================================================
    # for teHuiKey in ShareDefine.TeHuiTypeKeyDict.values():
    #    __CheckResetPlayerData(curPlayer, teHuiKey)
    # 
    # # ÀϺżÇ¼±¾´Î³äÖµÌØ»Ý»î¶¯±àºÅ, ±ØÐë·ÅÔÚ¼ì²é»î¶¯Êý¾ÝÖ®ºó´¦Àí
    # gameWorld = GameWorld.GetGameWorld()
    # rechargeActionNumKey = ShareDefine.Def_Notify_WorldKey_DayAction_Recharge
    # actionNum = gameWorld.GetGameWorldDictByKey(rechargeActionNumKey)
    # rechargeActionDict = ReadChConfig.GetEvalChConfig("TeHuiAction_Recharge")
    # if actionNum in rechargeActionDict:
    #    lastRechargeNum = __GetPlayerTeHuiDictValue(curPlayer, ChConfig.Def_PDict_TeHui_LastRechargeNum)
    #    __SetPlayerTeHuiDictValue(curPlayer, ChConfig.Def_PDict_TeHui_LastRechargeNum, actionNum)
    #    GameWorld.DebugLog("µÇ¼¼Ç¼±¾´Î³äÖµÌØ»Ý»î¶¯±àºÅlastRechargeNum=%s,actionNum=%s" % (lastRechargeNum, actionNum))
    # 
    # Sync_ClassUPDayAwardRecord(curPlayer)
    # #Sync_RechargeTeHuiInfo(curPlayer)
    # Sync_RechargeRankTeHuiInfo(curPlayer)
    # Sync_CostRankTeHuiInfo(curPlayer)
    # Sync_CostProfitInfo(curPlayer)
    # SyncPlayerCostRank(curPlayer)
    #===========================================================================
    return
 
 
## Ïû·ÑÅÅÐаñÌØ»Ý»î¶¯
#  @param None
#  @return None
def SyncPlayerCostRank(curPlayer):
    gameWorld = GameWorld.GetGameWorld()
    actionNumKey = ShareDefine.Def_Notify_WorldKey_DayAction_CostRank
    actionNum = gameWorld.GetGameWorldDictByKey(actionNumKey)
    if not actionNum:
        return
    
    # ¸üÐÂ×ÜÀÛ¼ÆÏû·ÑÊý
    totalGold = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TeHui_CostRankTotalGold, 0, ChConfig.Def_PDictType_TeHuiAction)
    totalGold = max(curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TeHui_CostRankTotalGoldEx, 0, 
                                                   ChConfig.Def_PDictType_TeHuiAction), totalGold)
    GameWorld.Log("ͬ²½Ïû·ÑÅÅÐÐÌØ»Ý»î¶¯£¡actionNum=%s,totalGold=%s" % (actionNum, totalGold), curPlayer.GetPlayerID())
    
    # ¸üÐÂÅÅÐаñ
    actionID = gameWorld.GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_DayAction_ID % actionNumKey)
    PlayerBillboard.UpdateCostRankBillboard(curPlayer, actionID, actionNum, totalGold)
    return
 
## ÇеØÍ¼³É¹¦Ê±
#  @param curPlayer:Íæ¼Ò
#  @return None
def PlayerLoadMapOK(curPlayer):
    #===========================================================================
    # GameWorld.DebugLog("Íæ¼ÒÇеØÍ¼³É¹¦£¬¼ì²éÌØ»Ý»î¶¯£¡", curPlayer.GetPlayerID())
    # for teHuiKey in ShareDefine.TeHuiTypeKeyDict.values():
    #    __CheckResetPlayerData(curPlayer, teHuiKey)
    #===========================================================================
    return
 
 
## Çå³ýËùÓÐÍæ¼ÒÐÅÏ¢(key ¸Ä±äʱµ÷ÓÃ)
#  @param curPlayer: Íæ¼Ò
#  @return: None 
def __CheckResetAllPlayerData(key):
    for i in range(0, GameWorld.GetPlayerManager().GetPlayerCount()):
        curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(i)
        
        if curPlayer == None or not curPlayer.GetPlayerID():
            continue
    
        #Çå³ýÍæ¼ÒÐÅÏ¢
        __CheckResetPlayerData(curPlayer, key)
            
    return
 
## Çå³ýÍæ¼ÒÐÅÏ¢
#  @param curPlayer: Íæ¼Ò
#  @param key: Ìػݻkey£¬Ä¬ÈÏÈ«²¿¼ì²é£¬Ò»°ãµÇ¼ʱȫ²¿¼ì²é
#  @return: None
def __CheckResetPlayerData(curPlayer, key):
    playerID = curPlayer.GetPlayerID()
    gameWorld = GameWorld.GetGameWorld()
    actionIDKey = ShareDefine.Def_Notify_WorldKey_DayAction_ID % key
    # µ±Ç°»î¶¯µÄid(»î¶¯ÉèÖÃʱµÄʱ¼äÓÃÓÚ±êʶ»î¶¯Î¨Ò»)
    actionID = gameWorld.GetGameWorldDictByKey(actionIDKey)
    
    # Íæ¼ÒÉíÉÏÊý¾ÝµÄ»î¶¯id
    playerActionIDKey = ChConfig.Def_PDict_TeHui_ActionID % key
    playerActionID = __GetPlayerTeHuiDictValue(curPlayer, playerActionIDKey)
    if playerActionID == actionID:
        GameWorld.DebugLog("ÌØ»Ý»î¶¯idÏàͬ£¬²»´¦Àíkey=%s,actionID=%s" % (key, actionID), playerID)
        return
    GameWorld.DebugLog("ÌØ»Ý»î¶¯Êý¾ÝÖØÖÃkey=%s,actionID=%s" % (key, actionID), playerID)
    __SetPlayerTeHuiDictValue(curPlayer, playerActionIDKey, actionID)
 
    if key == ShareDefine.Def_Notify_WorldKey_DayAction_Recharge:
        ResetRechargeData(curPlayer)
    elif key == ShareDefine.Def_Notify_WorldKey_DayAction_ClassUPNum:
        ResetClassUPAwardRecord(curPlayer)
    elif key == ShareDefine.Def_Notify_WorldKey_DayAction_DiscountShop:
        # µÇ¼µÄʱºò»á´¥·¢Çå¿Õʱ»ú
        shopID = GetCurActionShopID()
        ShopItemManage.ClearPlayerShopItemBuyCnt(curPlayer, shopID)
    elif key == ShareDefine.Def_Notify_WorldKey_DayAction_MixDiscountShop:
        mixShopID = GetCurMixActionShopID()
        ShopItemManage.ClearPlayerShopItemBuyCnt(curPlayer, mixShopID)
    elif key == ShareDefine.Def_Notify_WorldKey_DayAction_RechargeRank:
        ResetRechargeRankData(curPlayer)
    elif key == ShareDefine.Def_Notify_WorldKey_DayAction_CostProfit:
        ResetCostProfitInfo(curPlayer)
    elif key == ShareDefine.Def_Notify_WorldKey_DayAction_CostRank:
        ResetCostRankData(curPlayer)
        
    return
 
## ÖØÖÃÏû·ÑÅÅÐÐÌØ»ÝÊý¾Ý
#  @param curPlayer:
#  @return: None 
def ResetCostRankData(curPlayer):
    __SetPlayerTeHuiDictValue(curPlayer, ChConfig.Def_PDict_TeHui_CostRankTotalGold, 0)
    __SetPlayerTeHuiDictValue(curPlayer, ChConfig.Def_PDict_TeHui_CostRankTotalGoldEx, 0)
    Sync_CostRankTeHuiInfo(curPlayer)
    return
 
## ÖØÖóäÖµÅÅÐÐÌØ»ÝÊý¾Ý
#  @param curPlayer:
#  @return: None 
def ResetRechargeRankData(curPlayer):
    __SetPlayerTeHuiDictValue(curPlayer, ChConfig.Def_PDict_TeHui_RechargeRankTotalGold, 0)
    __SetPlayerTeHuiDictValue(curPlayer, ChConfig.Def_PDict_TeHui_RechargeRankTotalGoldEx, 0)
    Sync_RechargeRankTeHuiInfo(curPlayer)
    return
 
## ÖØÖóäÖµÌØ»ÝÊý¾Ý
#  @param curPlayer:
#  @return: None 
def ResetRechargeData(curPlayer):
    gameWorld = GameWorld.GetGameWorld()
    rechargeActionNumKey = ShareDefine.Def_Notify_WorldKey_DayAction_Recharge
    actionNum = gameWorld.GetGameWorldDictByKey(rechargeActionNumKey)
    rechargeActionDict = ReadChConfig.GetEvalChConfig("TeHuiAction_Recharge")
    if actionNum not in rechargeActionDict:
        return
    
    # ²¹·¢ÉÏ´ÎδÁìÈ¡µÄ½±Àø
    __SendRechargeAwardMail(curPlayer, rechargeActionDict)
    
    # ¸üÐÂеĻ±àºÅ, ÖØÖÃÊý¾Ý
    __SetPlayerTeHuiDictValue(curPlayer, ChConfig.Def_PDict_TeHui_LastRechargeNum, actionNum)
    __SetPlayerTeHuiDictValue(curPlayer, ChConfig.Def_PDict_TeHui_RechargeTotalGold, 0)
    __SetPlayerTeHuiDictValue(curPlayer, ChConfig.Def_PDict_TeHui_RechargeTotalGoldEx, 0)
    
    ruleList = rechargeActionDict[actionNum]
    for index in range(len(ruleList)):
        __SetPlayerTeHuiDictValue(curPlayer, ChConfig.Def_PDict_TeHui_RechargeGotCnt % index, 0)
        __SetPlayerTeHuiDictValue(curPlayer, ChConfig.Def_PDict_TeHui_RechargeCanGetCnt % index, 0)
        __SetPlayerTeHuiDictValue(curPlayer, ChConfig.Def_PDict_TeHui_RechargeCurTotalGold % index, 0)
    
    Sync_RechargeTeHuiInfo(curPlayer)
    return
 
## Óʼþ²¹·¢ÉÏÒ»´Î³äÖµÌØ»ÝδÁìÈ¡½±Àø
#  @param curPlayer:
#  @return: None 
def __SendRechargeAwardMail(curPlayer, rechargeActionDict):
    try:
        lastRechargeNum = __GetPlayerTeHuiDictValue(curPlayer, ChConfig.Def_PDict_TeHui_LastRechargeNum)
        if lastRechargeNum not in rechargeActionDict:
            GameWorld.DebugLog("__SendRechargeAwardMail lastRechargeNum=%s not in actionDict!" % lastRechargeNum)
            return
        
        # Óʼþ²¹·¢Î´ÁìÈ¡µÄ½±Àø
        rechargeMail = ReadChConfig.GetEvalChConfig("TeHuiAction_RechargeMail")
        lastRuleList = rechargeActionDict[lastRechargeNum]
        job = curPlayer.GetJob()
        for lastIndex, ruleInfo in enumerate(lastRuleList):
            canGetCntKey = ChConfig.Def_PDict_TeHui_RechargeCanGetCnt % lastIndex
            lastCanGetCnt = __GetPlayerTeHuiDictValue(curPlayer, canGetCntKey)
            GameWorld.DebugLog("³äÖµÌØ»ÝÓʼþ²¹·¢½±Àø: lastRechargeNum=%s,index=%s,lastCanGetCnt=%s" 
                               % (lastRechargeNum, lastIndex, lastCanGetCnt))
            if lastCanGetCnt <= 0:
                continue
            
            mailTitle = rechargeMail[0]
            getDays = rechargeMail[1]
            mailContent = ""
            
            ruleType = ruleInfo[Recharge_Type]
            needGold = ruleInfo[Recharge_NeedGold]
            awardItemInfo = ruleInfo[Recharge_AwardItemInfo]
            itemList = awardItemInfo[1]
            
            mailItemList = []
            for itemInfo in itemList:
                if isinstance(itemInfo, dict):
                    if job not in itemInfo:
                        GameWorld.ErrLog('TeHuiAction_Recharge.txt Î´ÅäÖøÃÖ°Òµ½±Àø job=%s'%job)
                        continue
                    itemID, itemCnt, isBind = itemInfo[job]
                else:
                    itemID, itemCnt, isBind = itemInfo
                mailItemList.append((itemID, itemCnt * lastCanGetCnt, isBind))
            
            GameWorld.DebugLog("    ruleType=%s,needGold=%s,itemList=%s,mailItemList=%s" 
                               % (ruleType, needGold, str(itemList), str(mailItemList)))
 
            if ruleType == Recharge_Type_Single:
                mailContent = rechargeMail[2] % (needGold, lastCanGetCnt)
            elif ruleType == Recharge_Type_Total:
                mailContent = rechargeMail[3] % (needGold, lastCanGetCnt)
            
            isSend = PlayerControl.SendMail(mailTitle, mailContent, getDays, [curPlayer.GetPlayerID()], mailItemList)
            if isSend:
                GameWorld.Log("Óʼþ²¹·¢ÉϴγäÖµÌØ»Ý½±Àø£ºlastRechargeNum=%s,index=%s,canGetCnt=%s,mailItemList=%s" 
                              % (lastRechargeNum, lastIndex, lastCanGetCnt, str(mailItemList)), curPlayer.GetPlayerID())
                       
    except BaseException, e:
        GameWorld.ErrLog("Óʼþ²¹·¢ÉϴγäÖµÌØ»Ý½±Àø³ö´í£¡%s" % e, curPlayer.GetPlayerID())
        
    return
 
 
## ÖØÖÃÉý½×ÌØ»Ý½±Àø¼Ç¼Êý¾Ý
#  @param curPlayer:
#  @return: None 
def ResetClassUPAwardRecord(curPlayer):
    for dayType in ShareDefine.ClassUPDayList:
        __SetPlayerTeHuiDictValue(curPlayer, ChConfig.Def_PDict_TeHui_ClassUPAwardRecord % dayType, 0)
    
    Sync_ClassUPDayAwardRecord(curPlayer)
    return
 
 
## Íæ¼Ò³äÖµ
#  @param curPlayer: Íæ¼Ò
#  @param addGold: ³äÖµÔª±¦Êý
#  @return: None 
def PlayerGoldCharge_TeHuiAction(curPlayer, addGold):
    GameWorld.Log("ÌØ»Ý»î¶¯³äÖµ: addGold=%s" % addGold, curPlayer.GetPlayerID())
    # ³äÖµÅÅÐаñÌØ»Ý
    __PlayerRechargeRankAction(curPlayer, addGold)
    
    # ³äÖµÌØ»Ý
    gameWorld = GameWorld.GetGameWorld()
    rechargeActionNumKey = ShareDefine.Def_Notify_WorldKey_DayAction_Recharge
    actionNum = gameWorld.GetGameWorldDictByKey(rechargeActionNumKey)
    rechargeActionDict = ReadChConfig.GetEvalChConfig("TeHuiAction_Recharge")
    if actionNum not in rechargeActionDict:
        GameWorld.Log("³äÖµÌØ»Ý»î¶¯£¡Î޸û±àºÅ! actionNum=%s" % (actionNum), curPlayer.GetPlayerID())
        return
    
    # ¸üÐÂ×ÜÀۼƳäÖµÊý
    totalGold = __GetPlayerTeHuiDictValue(curPlayer, ChConfig.Def_PDict_TeHui_RechargeTotalGold)
    totalGold = max(__GetPlayerTeHuiDictValue(curPlayer, ChConfig.Def_PDict_TeHui_RechargeTotalGoldEx), totalGold)
    updateGold = totalGold + addGold
    __SetPlayerTeHuiDictValue(curPlayer, ChConfig.Def_PDict_TeHui_RechargeTotalGoldEx, updateGold)
    GameWorld.Log("³äÖµÌØ»Ý»î¶¯£¡actionNum=%s,totalGold=%s,addGold=%s,updateGold=%s" 
                  % (actionNum, totalGold, addGold, updateGold), curPlayer.GetPlayerID())
    
    ruleList = rechargeActionDict[actionNum]
    for index, ruleInfo in enumerate(ruleList):
        ruleType = ruleInfo[Recharge_Type]
        needGold = ruleInfo[Recharge_NeedGold]
        maxCnt = ruleInfo[Recharge_MaxCnt]
        
        # ¸üе±Ç°¹æÔòÀÛ³äÊý
        curTotalGoldKey = ChConfig.Def_PDict_TeHui_RechargeCurTotalGold % index
        curTotalGold = __GetPlayerTeHuiDictValue(curPlayer, curTotalGoldKey)
        curTotalGold += addGold 
        __SetPlayerTeHuiDictValue(curPlayer, curTotalGoldKey, curTotalGold)
        
        canCntKey = ChConfig.Def_PDict_TeHui_RechargeCanGetCnt % index
        curCanCnt = __GetPlayerTeHuiDictValue(curPlayer, canCntKey)
        curGotCnt = __GetPlayerTeHuiDictValue(curPlayer, ChConfig.Def_PDict_TeHui_RechargeGotCnt % index)
        
        # ´ïµ½×î´ó´ÎÊý£¬²»ÔÙ´¦Àí´ÎÊý
        if curGotCnt + curCanCnt >= maxCnt:
            continue
        
        if ruleType == Recharge_Type_Single:
            if addGold < needGold:
                continue
            
            # Âú×ãµ¥±Ê³äÖµ£¬¿ÉÁìÈ¡´ÎÊý+1
            __SetPlayerTeHuiDictValue(curPlayer, canCntKey, curCanCnt + 1)
            
        elif ruleType == Recharge_Type_Total:
            # ÀÛ³äºóʵ¼Ê¿ÉÁì½±´ÎÊý(¿ÉÁìÈ¡×Ü´ÎÊý - ÒÑÁìÈ¡´ÎÊý)
            canMaxCnt = min(maxCnt, curTotalGold / needGold) # µ±Ç°ÀÛ³äʵ¼Ê×î´ó¿ÉÁì½±´ÎÊý
            canCnt = max(0, canMaxCnt - curGotCnt)
            if canCnt != curCanCnt:
                __SetPlayerTeHuiDictValue(curPlayer, canCntKey, canCnt)
    
    # Í¬²½¿Í»§¶Ë
    Sync_RechargeTeHuiInfo(curPlayer)
    return
 
## ³äÖµÅÅÐаñÌØ»Ý»î¶¯
#  @param None
#  @return None
def __PlayerRechargeRankAction(curPlayer, addGold):
    gameWorld = GameWorld.GetGameWorld()
    actionNumKey = ShareDefine.Def_Notify_WorldKey_DayAction_RechargeRank
    actionNum = gameWorld.GetGameWorldDictByKey(actionNumKey)
    if not actionNum:
        GameWorld.Log("µ±Ç°Ã»ÓгäÖµÅÅÐÐÌØ»Ý»î¶¯£¬²»ÐèÒª¸üÐÂÅÅÐаñ£¡actionNum=%s" % actionNum, curPlayer.GetPlayerID())
        return
    
    # ¸üÐÂ×ÜÀۼƳäÖµÊý
    totalGold = __GetPlayerTeHuiDictValue(curPlayer, ChConfig.Def_PDict_TeHui_RechargeRankTotalGold)
    totalGold = max(__GetPlayerTeHuiDictValue(curPlayer, ChConfig.Def_PDict_TeHui_RechargeRankTotalGoldEx), totalGold)
    updateGold = totalGold + addGold
    __SetPlayerTeHuiDictValue(curPlayer, ChConfig.Def_PDict_TeHui_RechargeRankTotalGoldEx, updateGold)
    GameWorld.Log("³äÖµÅÅÐÐÌØ»Ý»î¶¯£¡actionNum=%s,totalGold=%s,addGold=%s,updateGold=%s" 
                  % (actionNum, totalGold, addGold, updateGold), curPlayer.GetPlayerID())
    
    # ¸üÐÂÅÅÐаñ
    actionID = gameWorld.GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_DayAction_ID % actionNumKey)
    PlayerBillboard.UpdateRechargeRankBillboard(curPlayer, actionID, actionNum, updateGold)
    
    # Í¬²½¿Í»§¶ËÀۼƳäÖµÊý
    Sync_RechargeRankTeHuiInfo(curPlayer)
    return
 
## Ïû·ÑÅÅÐаñÌØ»Ý»î¶¯
#  @param None
#  @return None
def __PlayerCostRankAction(curPlayer, addGold):
    gameWorld = GameWorld.GetGameWorld()
    actionNumKey = ShareDefine.Def_Notify_WorldKey_DayAction_CostRank
    actionNum = gameWorld.GetGameWorldDictByKey(actionNumKey)
    if not actionNum:
        GameWorld.Log("µ±Ç°Ã»ÓÐÏû·ÑÅÅÐÐÌØ»Ý»î¶¯£¬²»ÐèÒª¸üÐÂÅÅÐаñ£¡actionNum=%s" % actionNum, curPlayer.GetPlayerID())
        return
    
    # ¸üÐÂ×ÜÀÛ¼ÆÏû·ÑÊý
    totalGold = __GetPlayerTeHuiDictValue(curPlayer, ChConfig.Def_PDict_TeHui_CostRankTotalGold)
    totalGold = max(__GetPlayerTeHuiDictValue(curPlayer, ChConfig.Def_PDict_TeHui_CostRankTotalGoldEx), totalGold)
    updateGold = totalGold + addGold
    __SetPlayerTeHuiDictValue(curPlayer, ChConfig.Def_PDict_TeHui_CostRankTotalGoldEx, updateGold)
    GameWorld.Log("Ïû·ÑÅÅÐÐÌØ»Ý»î¶¯£¡actionNum=%s,totalGold=%s,addGold=%s,updateGold=%s" 
                  % (actionNum, totalGold, addGold, updateGold), curPlayer.GetPlayerID())
    
    # ¸üÐÂÅÅÐаñ
    actionID = gameWorld.GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_DayAction_ID % actionNumKey)
    PlayerBillboard.UpdateCostRankBillboard(curPlayer, actionID, actionNum, updateGold)
    
    # Í¬²½¿Í»§¶ËÀÛ¼ÆÏû·ÑÊý
    Sync_CostRankTeHuiInfo(curPlayer)
    return
 
## ÑéÖ¤µ±Ç°½×¼¶
#  @param classlv
#  @return bool
def CheckClassLV(curPlayer, dayType, classLV):
    
#    if dayType == ShareDefine.ClassUPDay_Horse:
#        if classLV <= curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_Horser_ClassLV, 
#                                                     0, ChConfig.Def_PDictType_Horse):
#            return True
    
    if dayType == ShareDefine.ClassUPDay_Office: # ¹Ù¾ô
        if classLV <= curPlayer.GetOfficialRank():
            return True
    
    return False
 
 
# AA 02 ÁìÈ¡Éý½×¹¦ÄÜÌØ»Ý½±Àø #tagCMGetClassUPDayAward
## ¿Í·þ¶ËÁìÈ¡Éý½×ÈÕÌØ»Ý½±Àø
#  @param index:Íæ¼ÒË÷Òý
#  @param clientPack:·â°ü½á¹¹Ìå
#  @param tick:ʱ¼ä´Á
#  @return None
def ClientGetClassUPDayAward(index, clientPack, tick):
    return
    curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
    dayType = clientPack.DayType
    classLV = clientPack.ClassLV
    
    GameWorld.DebugLog("ÁìÈ¡Éý½×ÌØ»Ý½±Àø dayType=%s,classLV=%s" % (dayType, classLV), curPlayer.GetPlayerID())
    
    if dayType not in ShareDefine.ClassUPDayList:
        GameWorld.ErrLog("    ÌػݻÀàÐÍ=%s ·Ç·¨!" % (dayType))
        return
    
    #ÑéÖ¤µ±Ç°½×¼¶
    if not CheckClassLV(curPlayer, dayType, classLV):
        return
    
    classUPTeHuiDict = ReadChConfig.GetEvalChConfig("TeHuiAction_ClassUP")
    
    gameWorld = GameWorld.GetGameWorld()
    # µ±Ç°Éý½×ÌØ»Ý»î¶¯±àºÅ
    classUPActionNumKey = ShareDefine.Def_Notify_WorldKey_DayAction_ClassUPNum
    actionNum = gameWorld.GetGameWorldDictByKey(classUPActionNumKey)
    if actionNum not in classUPTeHuiDict:
        GameWorld.ErrLog("    Ìػݻ±àºÅ=%s not in TeHuiAction_ClassUP.txt" % actionNum)
        return
    
    curDayTypeList = classUPTeHuiDict[actionNum] # µ±Ç°»î¶¯ÖеÄÉý½×ÈÕÌØ»Ý
    
    # ÊÇ·ñÊǵ±Ç°»î¶¯ÖеÄÉý½×ÈÕ
    if dayType not in curDayTypeList:
        GameWorld.ErrLog("    ÌػݻÀàÐÍ=%s ·Çµ±Ç°»î¶¯ÖеÄÉý½×ÌØ»ÝÈÕ£¡curDayTypeList=%s" 
                         % (dayType, str(curDayTypeList)))
        return
    
    awardRecordKey = ChConfig.Def_PDict_TeHui_ClassUPAwardRecord % dayType
    # ÊÇ·ñÒÑÁì½±
    awardRecord = __GetPlayerTeHuiDictValue(curPlayer, awardRecordKey)
    if awardRecord & pow(2, classLV):
        GameWorld.Log("    ÌػݻÀàÐÍ=%s,classLV=%s ÒÑÁì¹ý½±Àø£¡²»ÄÜÖØ¸´ÁìÈ¡£¡" 
                         % (dayType, classLV))
        return
    
    awardDict = ReadChConfig.GetEvalChConfig("TeHuiAction_ClassUPAward")
    if dayType not in awardDict.keys():
        GameWorld.ErrLog("    ÌػݻÀàÐÍ=%s Î´ÅäÖý±ÀøÐÅÏ¢£¡Çë¼ì²é TeHuiAction_ClassUPAward.txt" % (dayType))
        return
    
    awardClassInfoDict = awardDict[dayType]
    if classLV not in awardClassInfoDict.keys():
        GameWorld.ErrLog("    ÌػݻÀàÐÍ=%s,classLV=%s Î´ÅäÖý±ÀøÐÅÏ¢£¡Çë¼ì²éTeHuiAction_ClassUPAward.txt" 
                         % (dayType, classLV))
        return
    
    awardInfo = awardClassInfoDict[classLV]
    
    # ¼ì²é±³°ü
    packSpace = ItemCommon.GetItemPackSpace(curPlayer, IPY_GameWorld.rptItem)
    needSpace = awardInfo[0]
    if needSpace > packSpace:
        PlayerControl.NotifyCode(curPlayer, "GeRen_chenxin_998371")
        return
    
    itemList = awardInfo[1]
    
    # ¸üÐÂÁì½±¼Ç¼
    awardRecord = awardRecord|(1<<classLV)
    __SetPlayerTeHuiDictValue(curPlayer, awardRecordKey, awardRecord)
    
    # ¸øÎïÆ·
    for itemID, itemCnt, isBind in itemList:
        isPutIn = ItemControler.GivePlayerItem(curPlayer, itemID, itemCnt, isBind, 
                                               [IPY_GameWorld.rptItem], True)
        if isPutIn:
            PlayerControl.NotifyCode(curPlayer, "ObtainRes01", [itemID, itemCnt])
            
    # Áì½±¹ã²¥
    msgParamList = [dayType, curPlayer.GetPlayerName(), dayType, classLV, dayType]
    PlayerControl.WorldNotify(0, "GeRen_liubo_734488", msgParamList)
    
    # Í¨ÖªÁì½±¼Ç¼
    Sync_ClassUPDayAwardRecord(curPlayer, dayType)
    return
 
# AA 03 ÁìÈ¡³äÖµÌØ»Ý½±Àø #tagCMGetRechargeTeHuiAward
## ¿Í·þ¶ËÁìÈ¡³äÖµÌØ»Ý½±Àø
#  @param index:Íæ¼ÒË÷Òý
#  @param clientPack:·â°ü½á¹¹Ìå
#  @param tick:ʱ¼ä´Á
#  @return None
def ClientGetRechargeTeHuiAward(index, clientPack, tick):
    return
    gameWorld = GameWorld.GetGameWorld()
    curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
    actionID = clientPack.ActionID
    index = clientPack.Index
    
    curActionID = gameWorld.GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_DayAction_ID 
                                               % ShareDefine.Def_Notify_WorldKey_DayAction_Recharge)
    
    GameWorld.DebugLog("ÁìÈ¡³äÖµÌØ»Ý½±Àø actionID=%s,index=%s" % (actionID, index), curPlayer.GetPlayerID())
    if actionID != curActionID:        
        GameWorld.ErrLog("    »î¶¯id´íÎó£¡actionID=%s != µ±Ç°»î¶¯id=%s" % (actionID, curActionID))
        return
 
    rechargeDict = ReadChConfig.GetEvalChConfig("TeHuiAction_Recharge")
 
    # µ±Ç°Éý½×ÌØ»Ý»î¶¯±àºÅ
    actionNumKey = ShareDefine.Def_Notify_WorldKey_DayAction_Recharge
    actionNum = gameWorld.GetGameWorldDictByKey(actionNumKey)
    if actionNum not in rechargeDict:
        GameWorld.ErrLog("    »î¶¯±àºÅ=%s not in TeHuiAction_Recharge.txt" % actionNum)
        return
    
    ruleList = rechargeDict[actionNum] # µ±Ç°»î¶¯¹æÔòÁбí
    if index >= len(ruleList):
        GameWorld.ErrLog("    ÁìÈ¡Ë÷Òý=%s >=¹æÔòÁбíÌõÊýlen=%s" % (index, len(ruleList)))     
        return
    
    ruleInfo = ruleList[index]
    GameWorld.DebugLog("    ruleInfo=%s" % str(ruleInfo))
    
    gotCnt = __GetPlayerTeHuiDictValue(curPlayer, ChConfig.Def_PDict_TeHui_RechargeGotCnt % index)
    canGetCnt = __GetPlayerTeHuiDictValue(curPlayer, ChConfig.Def_PDict_TeHui_RechargeCanGetCnt % index)
    maxCnt = ruleInfo[Recharge_MaxCnt]
    GameWorld.DebugLog("    gotCnt=%s,canGetCnt=%s,maxCnt=%s" % (gotCnt, canGetCnt, maxCnt)) 
    if gotCnt >= maxCnt:
        GameWorld.ErrLog("    ÒÑ´ïµ½×î´óÁì½±´ÎÊý£¡")
        return
    
    if canGetCnt <= 0:
        GameWorld.ErrLog("    Ã»ÓпÉÁìÈ¡´ÎÊý£¡")
        return
    
    awardInfo = ruleInfo[Recharge_AwardItemInfo]
    
    # ¼ì²é±³°ü
    packSpace = ItemCommon.GetItemPackSpace(curPlayer, IPY_GameWorld.rptItem)
    needSpace = awardInfo[0]
    if needSpace > packSpace:
        PlayerControl.NotifyCode(curPlayer, "GeRen_chenxin_998371")
        return
    
    itemList = awardInfo[1]
     
    # ÁìÈ¡´ÎÊý+1£¬¿ÉÁì½±´ÎÊý-1
    __SetPlayerTeHuiDictValue(curPlayer, ChConfig.Def_PDict_TeHui_RechargeGotCnt % index, gotCnt + 1)
    __SetPlayerTeHuiDictValue(curPlayer, ChConfig.Def_PDict_TeHui_RechargeCanGetCnt % index, canGetCnt - 1)
    
    # ¸øÎïÆ·
    job = curPlayer.GetJob()
    for itemInfo in itemList:
        if isinstance(itemInfo, dict):
            if job not in itemInfo:
                GameWorld.ErrLog('TeHuiAction_Recharge.txt Î´ÅäÖøÃÖ°Òµ½±Àø job=%s'%job)
                continue
            itemID, itemCnt, isBind = itemInfo[job]
        else:
            itemID, itemCnt, isBind = itemInfo
        isPutIn = ItemControler.GivePlayerItem(curPlayer, itemID, itemCnt, isBind, 
                                               [IPY_GameWorld.rptItem], True)
        if isPutIn:
            PlayerControl.NotifyCode(curPlayer, "ObtainRes01", [itemID, itemCnt])
            
        DataRecordPack.DR_PlayerTeHuiRechargePrize(curPlayer, actionID, actionNum, 
                                                   itemID, itemCnt, isPutIn, index)
        
    # Áì½±¹ã²¥
    RechargeNotifyDict = ReadChConfig.GetEvalChConfig("TeHuiAction_RechargeNotify")
    notifyMark = RechargeNotifyDict.get(actionNum, '')
    if notifyMark:
        PlayerControl.WorldNotify(0, notifyMark, [curPlayer.GetPlayerName(), 
                                                         ruleInfo[Recharge_NeedGold]])
    
    # Í¬²½¼Ç¼
    Sync_RechargeTeHuiInfo(curPlayer)
    return
 
 
## Í¨ÖªÉý½×ÌØ»Ý½±Àø¼Ç¼ÐÅÏ¢
#  @param awardType Ä¬ÈÏ0Ϊȫ²¿Í¬²½
#  @return None
def Sync_ClassUPDayAwardRecord(curPlayer, awardType=0):
    
    awardRecordPack = ChPyNetSendPack.tagMCClassUPDayAwardRecordList()
    awardRecordPack.Clear()
    awardRecordPack.RecordInfoList = []
 
    for dayType in ShareDefine.ClassUPDayList:
        
        if awardType not in [0, dayType]:
            continue
        
        recordObj = ChPyNetSendPack.tagMCClassUPDayAwardRecord()
        recordObj.Clear()
        recordObj.DayType = dayType
        awardRecordKey = ChConfig.Def_PDict_TeHui_ClassUPAwardRecord % dayType
        recordObj.Record = __GetPlayerTeHuiDictValue(curPlayer, awardRecordKey)
        awardRecordPack.RecordInfoList.append(recordObj)
 
    awardRecordPack.RecordCount = len(awardRecordPack.RecordInfoList)
    NetPackCommon.SendFakePack(curPlayer, awardRecordPack)
    return
 
 
## Í¨Öª³äÖµÌØ»ÝÐÅÏ¢
#  @param None
#  @return None
def Sync_RechargeTeHuiInfo(curPlayer):
    gameWorld = GameWorld.GetGameWorld()
    rechargeActionNumKey = ShareDefine.Def_Notify_WorldKey_DayAction_Recharge
    actionNum = gameWorld.GetGameWorldDictByKey(rechargeActionNumKey)
    rechargeActionDict = ReadChConfig.GetEvalChConfig("TeHuiAction_Recharge")
    if actionNum not in rechargeActionDict:
        return
 
    # µ±Ç°»î¶¯µÄid(»î¶¯ÉèÖÃʱµÄʱ¼äÓÃÓÚ±êʶ»î¶¯Î¨Ò»)
    actionID = gameWorld.GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_DayAction_ID 
                                               % ShareDefine.Def_Notify_WorldKey_DayAction_Recharge)
    
    rechargePack = ChPyNetSendPack.tagMCRechargeTeHuiInfoList()
    rechargePack.Clear()
    rechargePack.ActionID = actionID
    rechargePack.TotalGold = __GetPlayerTeHuiDictValue(curPlayer, ChConfig.Def_PDict_TeHui_RechargeTotalGold)
    rechargePack.TotalGold = max(__GetPlayerTeHuiDictValue(curPlayer, ChConfig.Def_PDict_TeHui_RechargeTotalGoldEx), 
                                 rechargePack.TotalGold)
    rechargePack.InfoList = []
    
    ruleList = rechargeActionDict[actionNum]
    for index in range(len(ruleList)):
        rechargeInfo = ChPyNetSendPack.tagMCRechargeTeHuiInfo()
        rechargeInfo.Clear()
        rechargeInfo.CurTotalGold = __GetPlayerTeHuiDictValue(curPlayer,
                                      ChConfig.Def_PDict_TeHui_RechargeCurTotalGold % index)
        rechargeInfo.CanGetCnt = __GetPlayerTeHuiDictValue(curPlayer,
                                   ChConfig.Def_PDict_TeHui_RechargeCanGetCnt % index)
        rechargeInfo.GotCnt = __GetPlayerTeHuiDictValue(curPlayer,
                                ChConfig.Def_PDict_TeHui_RechargeGotCnt % index)
        
        rechargePack.InfoList.append(rechargeInfo)
        
    rechargePack.InfoCnt = len(rechargePack.InfoList)
    
    NetPackCommon.SendFakePack(curPlayer, rechargePack)
    return
 
 
## Í¨Öª³äÖµÅÅÐÐÌØ»ÝÐÅÏ¢
#  @param None
#  @return None
def Sync_RechargeRankTeHuiInfo(curPlayer):
    gameWorld = GameWorld.GetGameWorld()
    actionNumKey = ShareDefine.Def_Notify_WorldKey_DayAction_RechargeRank
    actionNum = gameWorld.GetGameWorldDictByKey(actionNumKey)
    if not actionNum:
        return
 
    # µ±Ç°»î¶¯µÄid(»î¶¯ÉèÖÃʱµÄʱ¼äÓÃÓÚ±êʶ»î¶¯Î¨Ò»)
    actionID = gameWorld.GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_DayAction_ID % actionNumKey)
    
    rechargePack = ChPyNetSendPack.tagMCRechargeRankTeHuiInfo()
    rechargePack.Clear()
    rechargePack.ActionID = actionID
    totalGold = __GetPlayerTeHuiDictValue(curPlayer, ChConfig.Def_PDict_TeHui_RechargeRankTotalGold)
    totalGold = max(__GetPlayerTeHuiDictValue(curPlayer, ChConfig.Def_PDict_TeHui_RechargeRankTotalGoldEx), totalGold)
    rechargePack.TotalGold = totalGold
    NetPackCommon.SendFakePack(curPlayer, rechargePack)
    return
 
 
## Í¨ÖªÏû·ÑÅÅÐÐÌØ»ÝÐÅÏ¢
#  @param None
#  @return None
def Sync_CostRankTeHuiInfo(curPlayer):
    gameWorld = GameWorld.GetGameWorld()
    actionNumKey = ShareDefine.Def_Notify_WorldKey_DayAction_CostRank
    actionNum = gameWorld.GetGameWorldDictByKey(actionNumKey)
    if not actionNum:
        return
 
    # µ±Ç°»î¶¯µÄid(»î¶¯ÉèÖÃʱµÄʱ¼äÓÃÓÚ±êʶ»î¶¯Î¨Ò»)
    actionID = gameWorld.GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_DayAction_ID % actionNumKey)
    
    sendPack = ChPyNetSendPack.tagMCCostRankTeHuiInfo()
    sendPack.Clear()
    sendPack.ActionID = actionID
    sendPack.TotalCost = __GetPlayerTeHuiDictValue(curPlayer, ChConfig.Def_PDict_TeHui_CostRankTotalGold)
    sendPack.TotalCost = max(__GetPlayerTeHuiDictValue(curPlayer, ChConfig.Def_PDict_TeHui_CostRankTotalGoldEx), 
                             sendPack.TotalCost)
    NetPackCommon.SendFakePack(curPlayer, sendPack)
    return
 
 
## AA 04 ÁìÈ¡Ïû·Ñ½±Àø
#  @param index
#  @param clientData <ActionID-»î¶¯ID Index-½±ÀøË÷Òý>
#  @param tick
#  @return None
def OnGetCostProfitAward(index, clientData, tick):
    return
    curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
    
    GameWorld.DebugLog("==[PlayerTeHui]== In->OnGetCostProfitAward(), Name:%s" % curPlayer.GetPlayerName())
    
    actionId = clientData.ActionID
    awardIndex = clientData.Index
    
    dayActionKeyId = ShareDefine.Def_Notify_WorldKey_DayAction_ID
    dayActionKey = ShareDefine.Def_Notify_WorldKey_DayAction_CostProfit
    
    curActionId = GameWorld.GetGameWorld().GetGameWorldDictByKey(dayActionKeyId % dayActionKey)
    if actionId != curActionId:        
        GameWorld.DebugLog("OnGetCostProfitAward() action(%s) no equal current action(%s)" % (actionId, curActionId))
        return
    
    gotState = __GetPlayerTeHuiDictValue(curPlayer, ChConfig.Def_PDict_TeHui_CostAwardState)
    if gotState & pow(2, awardIndex):
        GameWorld.DebugLog("OnGetCostProfitAward() have got award(%s)" % awardIndex)
        return
    
    actionAwardInfoList = __GetCostProfitCfg(curPlayer)
    if not actionAwardInfoList or awardIndex >= len(actionAwardInfoList):
        GameWorld.DebugLog("OnGetCostProfitAward() no configuration action(%s)" % actionId)
        return
    
    actionAwardInfo = actionAwardInfoList[awardIndex]
    
    curGoldNum = __GetPlayerTeHuiDictValue(curPlayer, ChConfig.Def_PDict_TeHui_CostTotalGold)
    needGoldNum = actionAwardInfo[CostProfit_GoldNum]
    if curGoldNum < needGoldNum:
        GameWorld.DebugLog("OnGetCostProfitAward() current cost(%s) need(%s)" % (curGoldNum, needGoldNum))
        return
    
    packSpace = ItemCommon.GetItemPackSpace(curPlayer, IPY_GameWorld.rptItem)
    needSpace = actionAwardInfo[CostProfit_NeedSpace]
    if packSpace < needSpace:
        GameWorld.DebugLog("OnGetCostProfitAward() pack space(%s) need space(%s)" % (packSpace, needSpace))
        return
    
    __SetPlayerTeHuiDictValue(curPlayer, ChConfig.Def_PDict_TeHui_CostAwardState, gotState | pow(2, awardIndex))
    
    itemInfoList = actionAwardInfo[CostProfit_ItemList]
    for itemId, itemNum, itemIsBind in itemInfoList:
        ItemControler.GivePlayerItem(curPlayer, itemId, itemNum, itemIsBind, [IPY_GameWorld.rptItem], True)
    addDataDict = {"actionId":actionId, "needCostGold":needGoldNum, "costGold":curGoldNum,
                   "itemInfoList":str(itemInfoList)}
    DataRecordPack.DR_FuncGiveItem(curPlayer, "CostProfitAward", addDataDict)
    
    Sync_CostProfitInfo(curPlayer)
    GameWorld.DebugLog("==[PlayerTeHui]== Out->OnGetCostProfitAward()")
    return
 
## Ïû·Ñ¼Ç¼
#  @param curPlayer
#  @param costType Ïû·ÑÀàÐÍ
#  @param costGold Ïû·Ñ×êʯÊý
#  @param extraValue Ô¤ÁôÐÅÏ¢
#  @return None
def AddCostProfitGold(curPlayer, costType, costGold, infoDict):
    #===============================================================================================
    # if costGold <= 0:
    #    return
    # if costType in ChConfig.CostProfit_CostType:
    #    return
    # 
    # delNPCIdList = ReadChConfig.GetEvalChConfig("TeHuiAction_CostProfitDelNPCID")
    # if costType == ChConfig.Def_Cost_BuyNPCShopItem:
    #    if infoDict.get("NPCID", 0) in delNPCIdList:
    #        return
    # 
    # __PlayerCostRankAction(curPlayer, costGold)
    # 
    # curGoldNum = __GetPlayerTeHuiDictValue(curPlayer, ChConfig.Def_PDict_TeHui_CostTotalGold)
    # __SetPlayerTeHuiDictValue(curPlayer, ChConfig.Def_PDict_TeHui_CostTotalGold, curGoldNum + costGold)
    # Sync_CostProfitInfo(curPlayer)
    #===============================================================================================
    return
 
## Í¨ÖªÏû·Ñ·µÀûÐÅÏ¢
#  @param curPlayer
#  @return None
def Sync_CostProfitInfo(curPlayer):
    dayActionKeyId = ShareDefine.Def_Notify_WorldKey_DayAction_ID
    dayActionKey = ShareDefine.Def_Notify_WorldKey_DayAction_CostProfit
    actionId = GameWorld.GetGameWorld().GetGameWorldDictByKey(dayActionKeyId % dayActionKey)
    if actionId <= 0:
        GameWorld.DebugLog("Sync_CostProfitInfo() no open action")
        return
    
    sendPack = ChPyNetSendPack.tagMCCostProfitInfo()
    sendPack.Clear()
    sendPack.ActionID = actionId
    sendPack.TotalCost = __GetPlayerTeHuiDictValue(curPlayer, ChConfig.Def_PDict_TeHui_CostTotalGold)
    sendPack.AwardState = __GetPlayerTeHuiDictValue(curPlayer, ChConfig.Def_PDict_TeHui_CostAwardState)
    NetPackCommon.SendFakePack(curPlayer, sendPack)
    return
 
## ÖØÖÃÏû·Ñ·µÀûÐÅÏ¢
#  @param curPlayer
#  @return None
def ResetCostProfitInfo(curPlayer):
    __SendCostProfitRepairMail(curPlayer)
    
    __SetPlayerTeHuiDictValue(curPlayer, ChConfig.Def_PDict_TeHui_CostTotalGold, 0)
    __SetPlayerTeHuiDictValue(curPlayer, ChConfig.Def_PDict_TeHui_CostAwardState, 0)
    
    dayActionKey = ShareDefine.Def_Notify_WorldKey_DayAction_CostProfit
    actionIndex = GameWorld.GetGameWorld().GetGameWorldDictByKey(dayActionKey)
    __SetPlayerTeHuiDictValue(curPlayer, ChConfig.Def_PDict_TeHui_LastCostIndex, actionIndex)
    
    Sync_CostProfitInfo(curPlayer)
    return
 
## ·¢ËͲ¹³¥Óʼþ
#  @param curPlayer
#  @return None
def __SendCostProfitRepairMail(curPlayer):
    mailInfo = ReadChConfig.GetEvalChConfig("TeHuiAction_CostProfitMail")
    actionAwardInfoList = __GetCostProfitCfg(curPlayer)
    if not actionAwardInfoList:
        GameWorld.DebugLog("__SendCostProfitRepairMail() no configuration")
        return
    awardNum = len(actionAwardInfoList)
    
    gotState = __GetPlayerTeHuiDictValue(curPlayer, ChConfig.Def_PDict_TeHui_CostAwardState)
    if gotState >= pow(2, awardNum + 1) - 1:
        GameWorld.DebugLog("__SendCostProfitRepairMail() reward got finish")
        return
    
    curGoldNum = __GetPlayerTeHuiDictValue(curPlayer, ChConfig.Def_PDict_TeHui_CostTotalGold)
    
    for i in range(awardNum):
        if gotState & pow(2, i):
            continue
        
        actionAwardInfo = actionAwardInfoList[i]
        itemInfoList = actionAwardInfo[CostProfit_ItemList]
        costGoldNum = actionAwardInfo[CostProfit_GoldNum]
        if curGoldNum < costGoldNum:
            GameWorld.DebugLog("__SendCostProfitRepairMail() cost(%s) gold no enough(%s)"
                               % (curGoldNum, costGoldNum))
            return
        
        mailTitle = mailInfo[0]
        mailDay = mailInfo[1]
        mailContent = mailInfo[2] % costGoldNum
        playerIdList = [curPlayer.GetPlayerID()]
        if not PlayerControl.SendMail(mailTitle, mailContent, mailDay, playerIdList, itemInfoList):
            GameWorld.ErrLog("__SendCostProfitRepairMail() repair(%s) mail send fail" % i)
    return
 
## »ñÈ¡Ïû·Ñ·µÀûÅäÖÃÐÅÏ¢
#  @param None
#  @return ÅäÖÃÐÅÏ¢Áбí
def __GetCostProfitCfg(curPlayer):
    costProfitDict = ReadChConfig.GetEvalChConfig("TeHuiAction_CostProfitAward")
    lastCostIndex = __GetPlayerTeHuiDictValue(curPlayer, ChConfig.Def_PDict_TeHui_LastCostIndex)
    actionAwardInfoList = costProfitDict.get(lastCostIndex, [])
    if not actionAwardInfoList:
        GameWorld.DebugLog("__GetCostProfitCfg() no configuration action index(%s)" % lastCostIndex)
        
    return actionAwardInfoList