hxp
2025-05-30 8a445fc0209a334d0d5e263d6986328d965c668f
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
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
#!/usr/bin/python
# -*- coding: GBK -*-
#
# @todo: 
#
# @author: Alee
# @date 2017-12-1 ÏÂÎç01:37:09
# @version 1.0
#
# @note: 
#
#---------------------------------------------------------------------
#µ¼Èë
import PlayerState
import IPY_GameWorld
import GameWorld
import PlayerControl
import GameMap
import ChConfig
import BuffSkill
import PlayerEventCounter
import PlayerTeam
import PlayerHorse
import NPCCommon
import SkillCommon
import FBLogic
import ChItem
import ItemCommon
import ItemControler
import ChEquip
import FunctionNPCCommon
import PlayerGMOper
import ReadChConfig
import PetControl
import OperControlManager
import ShareDefine
import PlayerAutoCheckOnline
import PlayerGameWallow
import NetPackCommon
import ChPyNetSendPack
import Operate_PlayerBuyZhenQi
import DataRecordPack
import PlayerBillboard
import UpdatePlayerName
import PlayerOnlinePrize
import PlayerLVAward
import PlayerGoldGift
import PlayerSignDay
import PlayerPet
import PlayerPrestigeSys
import PlayerFamily
import PlayerLoginDayAward
import PlayerGodWeapon
import PlayerWorldAverageLv
import PlayerGoldInvest
import PlayerActivity
import FBCommon
import BossHurtMng
import PlayerWishingWell
import PlayerAttrFruit
import PlayerSuccess
import PlayerDienstgrad
import PlayerFreeGoods
import PlayerRecover
import GameLogic_IceLode
import GameLogic_SkyTower
import PlayerEquipDecompose
import PlayerGreatMaster
import PlayerGatherSoul
import PlayerGatherTheSoul
import PlayerFairyDomain
import PlayerCrossRealmPK
import PlayerCrossChampionship
import PlayerCrossBattlefield
import GameFuncComm
import PlayerMagicWeapon
import GameLogic_FamilyBoss
import GameLogic_TrialTower
import GameLogic_FamilyWar
import PlayerBossReborn
import PlayerWeekParty
import PlayerFeastWeekParty
import PlayerFeastTravel
import PlayerFeastLogin
import PlayerFeastWish
import PlayerActLogin
import PlayerTreasure
import GameLogic_GodArea
import PlayerRune
import PlayerFamilyRedPacket
import IpyGameDataPY
import EventReport
import OpenServerCampaign
import PlayerVip
import PlayerRefineStove
import PassiveBuffEffMng
import GameLogic_XMZZ
import PlayerFlashSale
import PlayerFlashGiftbag
import PlayerDailyGiftbag
import PlayerCostRebate
import PlayerActBuyOne
import PlayerActGrowupBuy
import PlayerActCollectWords
import PlayerActTotalRecharge
import PlayerActRechargePrize
import PlayerActGarbageSorting
import PlayerActXianXiaMJ
import PlayerActGubao
import PlayerActHorsePetTrain
import PlayerActLianqi
import PlayerActGodGift
import PlayerActFamilyCTGAssist
import PlayerActRechargeRebateGold
import PlayerActManyDayRecharge
import PlayerActSingleRecharge
import PlayerActHorsePetFeast
import PlayerActBossTrial
import PlayerSpringSale
import PlayerFairyCeremony
import PlayerNewFairyCeremony
import GY_Query_BossFirstKill
import PlayerCrossYaomoBoss
import PlayerFeastRedPacket
import PlayerLuckyCloudBuy
import PlayerLuckyTreasure
import Item_ResetAttrPoint
import CrossActCTGBillboard
import CrossActAllRecharge
import PlayerFuncSysPrivilege
import PlayerActTurntable
import PlayerTongTianLing
import CrossRealmPlayer
import ChNetSendPack
import FamilyRobBoss
import FBHelpBattle
import PlayerAssist
import PlayerArena
import PyGameData
import PlayerCoin
import PlayerCharm
import PlayerDogz
import PlayerCoat
import PlayerFB
import PlayerFaQi
import SkillShell
import PlayerGubao
import PlayerShentong
import PlayerCustomAward
import PlayerZhanling
import PlayerTree
import PlayerLianTi
import PlayerTask
import PlayerYinji
import PlayerLove
import GameObj
import PlayerChangeJob
import PlayerGuaji
import PlayerFace
import PlayerChatBox
import PlayerXiangong
import PlayerMineArea
import PlayerActLoginNew
import PlayerActBuyCountGift
import PlayerActLunhuidian
import PlayerActFamilyGCZ
import PlayerActYunshi
import PlayerActTask
import PlayerMail
import DBDataMgr
import GameServerRefresh
import IPY_ServerDefine
import CommFunc
from PyMongoDB import RecvPackToMapDB
import PlayerTalk
 
import datetime
import time
import math
import re
import base64
#---------------------------------------------------------------------
 
#---------------------------------------------------------------------
##C++µ÷Ó÷â°ü, µØÍ¼¿ªÆô³É¹¦, ³õʼ»¯ÐÅÏ¢
#@param tick Ê±¼ä´Á
#@return ·µ»ØÖµÎÞÒâÒå
#@remarks µØÍ¼¿ªÆô³É¹¦, ³õʼ»¯ÐÅÏ¢
def InitPlayer(tick):
    return 
 
#---------------------------------------------------------------------
##Íæ¼ÒµÇ½ÓÎÏ·³õʼ»¯
#@param curPlayer Íæ¼ÒʵÀý
#@param tick Ê±¼ä´Á
#@return ·µ»ØÖµÎÞÒâÒå
#@remarks Íæ¼ÒµÇ½ÓÎÏ·³õʼ»¯
def InitLoginPlayer(curPlayer, tick):
    #³õʼ»¯Íæ¼ÒµÄʱÖÓ¸öÊý
    if curPlayer.GetTickTypeCount() == 0:
        curPlayer.SetTickTypeCount(ChConfig.TYPE_Player_Tick_Count)
    return
#---------------------------------------------------------------------
##C++·â°üGameServer_InitOK ´¦Àí
#@param curPlayer Íæ¼ÒʵÀý
#@param tick Ê±¼ä´Á
#@return ·µ»ØÖµÎÞÒâÒå
#@remarks ×Ô¶¨Ò庯Êý, C++·â°üGameServer_InitOK ´¦Àí
def OnAllServerInitOK(curPlayer, tick):
    if FBLogic.PlayerLoginInFBCheck(curPlayer, tick):
        #Íæ¼ÒÊǵÚÒ»´ÎµÇ¼, ²¢ÇÒÍæ¼ÒÐèÒªÌß»ØÔ­À´µØÍ¼
        return
    
    #Ë¢ÐÂÈËÎïÈÕÆÚ״̬
    #GameWorld.Log('PlayerEventCounter.UpdatePlayerLoginTime')
    PlayerEventCounter.UpdatePlayerLoginTime(curPlayer)
    return
 
#// A1 20 »õ±Ò¶Ò»» #tagCMMoneyExchange
#
#struct    tagCMMoneyExchange
#{
#    tagHead         Head;
#    BYTE        SrcMoneyType;    // Ô´»õ±ÒÀàÐÍ
#    BYTE        TagMoneyType;    // Ä¿±ê»õ±ÒÀàÐÍ
#    DWORD        ExchangeValue;    // ¶Ò»»ÊýÁ¿£¨ÏûºÄÔ´»õ±ÒµÄÊýÁ¿£©
#};
def OnMoneyExchange(index, clientData, tick):
    curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
    srcMoneyType = clientData.SrcMoneyType
    tagMoneyType = clientData.TagMoneyType
    exchangeValue = clientData.ExchangeValue
    
    exchangeMoneyInfo = IpyGameDataPY.GetFuncEvalCfg("EqualValueMoney", 1, {})
    if str(srcMoneyType) not in exchangeMoneyInfo:
        return
    exchangeInfo = exchangeMoneyInfo[str(srcMoneyType)]
    if tagMoneyType != exchangeInfo[0]:
        return
    multiple = exchangeInfo[1]
    if exchangeValue <= 0:
        return
    
    if not PlayerControl.PayMoney(curPlayer, srcMoneyType, exchangeValue, "MoneyExchange"):
        return
    
    tagMoneyAdd = exchangeValue * multiple
    PlayerControl.GiveMoney(curPlayer, tagMoneyType, tagMoneyAdd, "MoneyExchange")
    GameWorld.Log("»õ±Ò¶Ò»»: srcMoneyType=%s,exchangeValue=%s,tagMoneyType=%s,tagMoneyAdd=%s" 
                  % (srcMoneyType, exchangeValue, tagMoneyType, tagMoneyAdd), curPlayer.GetPlayerID())
    return
 
#// A1 21 ×ªÖ°Òµ #tagCMChangeJob
#
#struct    tagCMChangeJob
#{
#    tagHead        Head;
#    BYTE        TagJob;
#};
def OnChangeJob(index, clientData, tick):
    curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
    PlayerChangeJob.DoChangeJob(curPlayer, curPlayer.GetJob(), clientData.TagJob)
    return
 
#// A1 08 Ë¢ÐÂÖ÷·þ½ÇÉ«ÐÅÏ¢ #tagCMRefreshMainServerRole
#
#struct tagCMRefreshMainServerRole
#{
#    tagHead        Head;
#};
def OnRefreshMainServerRole(index, clientData, tick):
    curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
    
    Sync_DBPlayer(curPlayer)
    
    # ËÀÍö¸´»î
    if GameObj.GetHP(curPlayer) <=0 or curPlayer.GetPlayerAction() == IPY_GameWorld.paDie:
        PlayerRebornByType(curPlayer, ChConfig.rebornType_System, tick)
        
    # Ç¿Ë¢Ò»´ÎÊôÐÔ£¬Ë¢Ö®Ç°ÖØÖû¹Ã»Í¬²½¹ýËùÓÐÊôÐÔ
    curPlayer.SetDict(ChConfig.Def_PlayerKey_NotifyAllAttrState, 0)
    playerControl = PlayerControl.PlayerControl(curPlayer)
    playerControl.ReCalcAllState()
    
    # Í¬²½ËùÓÐbuff
    __Sync_ClientBuff(curPlayer)
    
    PlayerState.Sync_PKBossState(curPlayer)
    
    if PlayerControl.GetCrossMapID(curPlayer):
        CrossRealmPlayer.DoExitCrossRealm(curPlayer)
        
    if curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_ClientCustomScene):
        PlayerFB.DoExitCustomScene(curPlayer)
        
    PetControl.DoLogic_PetLoadMapOK(curPlayer)
    
    # »Ö¸´ÊÓÒ°£¬Ë¢ÐÂ×Ô¼ºµÄÊÓÒ°
    curPlayer.SetVisible(True)
    PlayerControl.SetSight(curPlayer, 0)
    curPlayer.RefreshView()
    PlayerControl.SetSight(curPlayer, ChConfig.Def_PlayerSight_Default)
    curPlayer.RefreshView()
    
    msgInfo = ""
    GameWorld.GetPlayerManager().GameServer_QueryPlayerResult(curPlayer.GetPlayerID(), 0, 0, "RefreshMainServerRole", msgInfo, len(msgInfo))
    return
 
def Sync_DBPlayer(curPlayer):
    ## Í¬²½DBPlayerÐÅÏ¢£¬Í¬0102·â°ü
    dbPlayer = ChPyNetSendPack.tagMCDBPlayer()
    dbPlayer.AccID = curPlayer.GetAccID()
    dbPlayer.PlayerID = curPlayer.GetPlayerID()
    dbPlayer.PlayerName = curPlayer.GetPlayerName()
    dbPlayer.AccState = curPlayer.GetAccState()
    dbPlayer.GMLevel = curPlayer.GetGMLevel()
    dbPlayer.Sex = curPlayer.GetSex()
    dbPlayer.Job = curPlayer.GetJob()
    dbPlayer.ReincarnationLv = curPlayer.GetReincarnationLv()
    dbPlayer.LV = curPlayer.GetLV()
    dbPlayer.LVEx = curPlayer.GetLVEx()
    dbPlayer.LV2 = curPlayer.GetLV2()
    dbPlayer.ExpPoint = curPlayer.GetExpPoint()
    dbPlayer.TotalExp = curPlayer.GetTotalExp()
    dbPlayer.Family = curPlayer.GetFamilyID()
    dbPlayer.FamilyName = curPlayer.GetFamilyName()
    dbPlayer.TeamHornor = curPlayer.GetTeamHornor()
    dbPlayer.FamilyHornor = curPlayer.GetFamilyHornor()
    dbPlayer.FamilyActiveValue = curPlayer.GetFamilyActiveValue()
    dbPlayer.LastWeekFamilyActiveValue = curPlayer.GetLastWeekFamilyActiveValue()
    dbPlayer.CountryHornor = curPlayer.GetCountryHornor()
    dbPlayer.CountryLastWeekHornor = curPlayer.GetCountryLastWeekHornor()
    dbPlayer.Mate = curPlayer.GetMate()
    dbPlayer.Gold = curPlayer.GetGold()
    dbPlayer.GoldPaper = curPlayer.GetGoldPaper()
    dbPlayer.Silver = curPlayer.GetSilver()
    dbPlayer.SilverPaper = curPlayer.GetSilverPaper()
    dbPlayer.FightPoint = curPlayer.GetFightPoint()
    dbPlayer.HappyPoint = curPlayer.GetHappyPoint()
    dbPlayer.LineID = curPlayer.GetLineID()
    dbPlayer.MapID = curPlayer.GetMapID() # Íæ¼ÒÉíÉϵĠGetMapID ·µ»ØµÄ¾ÍÊÇ GetDataMapID
    dbPlayer.PosX = curPlayer.GetPosX()
    dbPlayer.PosY = curPlayer.GetPosY()
    dbPlayer.RebornMapID = curPlayer.GetRebornMapID()
    dbPlayer.RebornPosX = curPlayer.GetRebornPosX()
    dbPlayer.RebornPosY = curPlayer.GetRebornPosY()
    dbPlayer.State = curPlayer.GetState()
    dbPlayer.HP = curPlayer.GetHP()
    dbPlayer.HPEx = curPlayer.GetHPEx()
    dbPlayer.XP = curPlayer.GetXP()
    dbPlayer.HPRestoreSetting = curPlayer.GetHPRestoreSetting()
    dbPlayer.MPRestoreSetting = curPlayer.GetMPRestoreSetting()
    dbPlayer.FreePoint = curPlayer.GetFreePoint()
    dbPlayer.FreeSkillPoint = curPlayer.GetFreeSkillPoint()
    dbPlayer.BaseSTR = curPlayer.GetBaseSTR()
    dbPlayer.BasePNE = curPlayer.GetBasePNE()
    dbPlayer.BasePHY = curPlayer.GetBasePHY()
    dbPlayer.BaseCON = curPlayer.GetBaseCON()
    dbPlayer.STR = curPlayer.GetSTR()
    dbPlayer.PNE = curPlayer.GetPNE()
    dbPlayer.PHY = curPlayer.GetPHY()
    dbPlayer.CON = curPlayer.GetCON()
    #dbPlayer.Setting = curPlayer.GetSetting() # Ã»ÓÐ
    dbPlayer.PKValue = curPlayer.GetPKValue()
    #dbPlayer.ActiveValue = curPlayer.GetActiveValue() # Ã»ÓÐ
    dbPlayer.BackpackLV = curPlayer.GetBackpackLV()
    dbPlayer.WarehouseLV = curPlayer.GetWarehouseLV()
    dbPlayer.TeamID = curPlayer.GetTeamID()
    dbPlayer.UseGoldType = curPlayer.GetUseGoldType()
    dbPlayer.UseSilverType = curPlayer.GetUseSilverType()
    dbPlayer.AttackMode = curPlayer.GetAttackMode()
    dbPlayer.LastWeekOnlineTime = curPlayer.GetLastWeekOnlineTime()
    dbPlayer.FBID = curPlayer.GetClientLineID()
    dbPlayer.FamilyLV = curPlayer.GetFamilyLV()
    dbPlayer.FriendFavor = curPlayer.GetFriendFavor()
    dbPlayer.Energy = curPlayer.GetEnergy()
    dbPlayer.EquipShowSwitch = curPlayer.GetEquipShowSwitch()
    dbPlayer.LuckValue = curPlayer.GetLuckValue()
    dbPlayer.ExAttr1 = curPlayer.GetExAttr1()
    dbPlayer.ExAttr2 = curPlayer.GetExAttr2()
    dbPlayer.ExAttr3 = curPlayer.GetExAttr3()
    dbPlayer.ExAttr4 = curPlayer.GetExAttr4()
    dbPlayer.ExAttr5 = curPlayer.GetExAttr5()
    dbPlayer.Faction = curPlayer.GetFaction()
    dbPlayer.InfamyValue = curPlayer.GetInfamyValue()
    dbPlayer.OfficialRank = curPlayer.GetOfficialRank()
    dbPlayer.ChangeCoinPointTotal = curPlayer.GetChangeCoinPointTotal()
    dbPlayer.VIPLv = curPlayer.GetVIPLv()
    dbPlayer.VIPLvForPhone = curPlayer.GetVIPLvForPhone()
    dbPlayer.ExAttr6 = curPlayer.GetExAttr6()
    dbPlayer.ExAttr7 = curPlayer.GetExAttr7()
    dbPlayer.ExAttr8 = curPlayer.GetExAttr8()
    dbPlayer.ExAttr9 = curPlayer.GetExAttr9()
    dbPlayer.ExAttr10 = curPlayer.GetExAttr10()
    dbPlayer.ModelMark = curPlayer.GetModelMark()
    dbPlayer.ExAttr11 = curPlayer.GetExAttr11()
    dbPlayer.ExAttr12 = curPlayer.GetExAttr12()
    dbPlayer.ExAttr13 = curPlayer.GetExAttr13()
    dbPlayer.ExAttr14 = curPlayer.GetExAttr14()
    dbPlayer.OperateInfo = curPlayer.GetOperateInfo()
    dbPlayer.Operate = curPlayer.GetOperate()
    dbPlayer.ServerID = curPlayer.GetServerID()
    dbPlayer.ExAttr15 = curPlayer.GetExAttr15()
    dbPlayer.ExAttr16 = curPlayer.GetExAttr16()
    dbPlayer.ExAttr17 = curPlayer.GetExAttr17()
    dbPlayer.ExAttr18 = curPlayer.GetExAttr18()
    dbPlayer.ExAttr19 = curPlayer.GetExAttr19()
    dbPlayer.ExAttr20 = curPlayer.GetExAttr20()
    dbPlayer.Face = curPlayer.GetFace()
    dbPlayer.FacePic = curPlayer.GetFacePic()
    dbPlayer.RoleType = curPlayer.GetRoleType()
    NetPackCommon.SendFakePack(curPlayer, dbPlayer)
    return
 
#---------------------------------------------------------------------
'''
µÇ¼Á÷³Ì
UserCrtlDB
    onAuthentication  Íæ¼ÒµÇ¼ £ºÑéÖ¤Õ˺Å-ÈôûÓнÇÉ«Ôò´´½Ç-·µ»Ø½ÇÉ«ÐÅÏ¢-֪ͨMap C++
    Map C++µ÷ÓàPlayerLogin
MapServer
    ChPlayer:def PlayerLogin(index, tick)
        DoPlayerLogin
            curPlayer.Sync_ClientPlayerLogin()  #01 02 Íæ¼Ò³õʼ»¯#tagCDBPlayer
            curPlayer.BalanceServer_PlayerLoginInitOK() #ÏòrouteÉèÖÃÍæ¼ÒÔÚmapÖеÄË÷Òý
            
            curPlayer.SendToBServerServerInitOK()   #֪ͨrouteµÇ¼³É¹¦ £¬routeÏò¿Í»§¶Ë·¢ËÍ//01 09 ·þÎñÆ÷×¼±¸¾ÍÐ÷#tagServerPrepareOK
            ChPlayer:def OnAllServerInitOK(curPlayer, tick)
 
            ChPlayer:def __Func_LoadMapOK(curPlayer, tick)  #£¡£¡£¡Ö±½Óµ÷Óò»µÈ´ý¿Í»§¶Ë·â°ü //01 07 µØÍ¼¶ÁÈ¡OK#tagCInitMapOK
            curPlayer.SetMapLoadOK(True)
            curPlayer.SetInitOK(True)
            curPlayer.EndLoadMap()  #֪ͨ¿Í»§¶Ë 04 03 Íæ¼ÒµÇ¼Êý¾Ý·¢ËÍÍê±ÏOK#tagPlayerLoginLoadOK
 
            GameServerRefresh:GameSever_PlayerInitOK
            curPlayer.SetGameServerInitOK(True)
 
            ChPlayer:def DoPlayerRealLoginOK(curPlayer, tick) Íæ¼ÒÕæÕýµÇ¼³É¹¦´¦Àí£¬ÓÃÓÚÌæ»»  __DoPlayerLoginServer  ÖеŦÄܵǼÂß¼­
 
'''
 
##Íæ¼ÒµÇ½ÓÎÏ·Âß¼­´¦Àí
#@param curPlayer Íæ¼ÒʵÀý
#@param tick Ê±¼ä´Á
#@return ·µ»ØÖµÎÞÒâÒå
#@remarks Íæ¼ÒµÇ½ÓÎÏ·Âß¼­´¦Àí
def DoPlayerLogin(curPlayer, tick):
    #ÕâÀïÖ»×ö³õʼ»¯Âß¼­
    curPlayer.SetDict(ChConfig.Def_PlayerKey_LoadMapIsLogin, 1)
    
    #֪ͨʱ¼ä
    Sync_PyServerDataTimeToClient(curPlayer)
    Sync_OpenServerDay(curPlayer)
    #Í¨ÖªÍæ¼Ò»ù±¾ÐÅÏ¢
    curPlayer.Sync_ClientPlayerLogin()  #01 02 Íæ¼Ò³õʼ»¯#tagCDBPlayer
    
    # ÆÁ±Î¿ç·þϹرպÍ×Ó·þÖØ¸´µÄÊý¾ÝµÄ·¢ËÍ pushsend½Ó¿Ú£¬ notifyallÕý³£·¢ËÍ
    # £¡£¡£¡±ØÒª·¢Ë͵ÄÊý¾ÝҪעÒâλÖÃ
    if GameWorld.IsCrossServer():
        curPlayer.SetForbiddenSyncClientState(True)
    
    __DoPlayerLoginServer(curPlayer, tick)
    
    # ÆÁ±Î¿ç·þϹرպÍ×Ó·þÖØ¸´µÄÊý¾ÝµÄ·¢ËÍ pushsend½Ó¿Ú£¬ notifyallÕý³£·¢ËÍ
    # £¡£¡£¡±ØÒª·¢Ë͵ÄÊý¾ÝҪעÒâλÖÃ
    if GameWorld.IsCrossServer():
        curPlayer.SetForbiddenSyncClientState(False)
        PlayerControl.SetCrossMapID(curPlayer, curPlayer.GetMapID()) # ÒòΪÖ÷·þÉÏ´«Êý¾Ý֮ǰ¸ÃֵΪ0£¬ËùÒԵǼ¿ç·þºóÔÚ¿ç·þ·þÎñÆ÷ÒªÉèÖÃΪ¶ÔÓ¦µØÍ¼
        
    #֪ͨÔËÐгɹ¦
    curPlayer.BalanceServer_PlayerLoginInitOK() #ÏòrouteÉèÖÃÍæ¼ÒÔÚmapÖеÄË÷Òý
    return
 
def __DoPlayerLoginServer(curPlayer, tick):
    ''' Íæ¼ÒµÇ¼ÐèÒª´¦ÀíµÄÄÚÈÝ£¬±¾·þ¼°¿ç·þ·þÎñÆ÷·Ö¿ª
    '''
    
    #ÉèÖÃÉÏÏßʱ¼ä
    curPlayer.SetLoginTime(GameWorld.GetCurrentDataTimeStr())
    #³õʼ»¯Íæ¼Ò±³°ü
    InitPlayerPack(curPlayer)
    #Í¨ÖªÍæ¼ÒÎïÆ·ÐÅÏ¢
    __Sync_PackDetel(curPlayer)
    
    if GameWorld.IsCrossServer():
        SkillCommon.PlayerLoginMergeServerSkillLogic(curPlayer, tick)
        # ÖØÖÃËùÓм¼ÄÜCD
        
        DoPlayerLoginInMap(curPlayer, tick)
        
        DataRecordPack.DR_PlayerLogin(curPlayer)
        EventReport.WriteEvent_login(curPlayer)
        #---Íæ¼ÒÉÏÏß, ³èÎïÂß¼­´¦Àí---
        PetControl.DoLogic_PetInfo_OnLogin(curPlayer, tick)
        
        PlayerTeam.OnPlayerLoginCrossServer(curPlayer)
        return
    
    leaveServerSecond = PlayerControl.GetPlayerLeaveServerSecond(curPlayer)
    if leaveServerSecond > ChConfig.Def_PlayerOfflineProtectTime / 1000:
        # ÀëÏß³¬¹ýÀëÏß±£»¤ÖØÖÃÇÐÏßÁÙʱ±£´æµÄÏà¹Ø¼Ç¼ֵ
        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_PlayChangeLineID, 0)
        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FuncChangeLineID, 0)
        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_HighChangeLineID, 0)
        #GameWorld.DebugLog("ÀëÏß³¬¹ý10ÃëÖØÖÃÇÐÏßÁÙʱ±£´æµÄÏà¹Ø¼Ç¼ֵ!leaveServerSecond=%s" % leaveServerSecond, curPlayer.GetPlayerID())
        # ÀëÏß¹ý¾Ã»Ö¸´Îª·Ç¿ç·þ״̬
        if PlayerControl.GetCrossMapID(curPlayer):
            PlayerControl.SetCrossMapID(curPlayer, 0)
        
    SyncGuideState(curPlayer)
    
    #ÉÏÏß¼ì²éÒ»´Î×°±¸ÊôÐÔ
    ItemControler.OnPlayerLogin(curPlayer)  
    #¸üзþÎñÆ÷×éID
    PlayerControl.UpdPlayerServerGroupID(curPlayer)
    
    #ÉÏÏßѧϰ¼¼ÄÜ
    SkillCommon.PlayerLoginCheckLearnSkill(curPlayer)
    
    #ˢм¼ÄÜCD
    SkillCommon.PlayerLoginUpdateSkillCD(curPlayer, tick)
    
    #Í¨ÖªÍæ¼Ò¼¼ÄÜÐÅÏ¢
    __Sync_ClientSkill(curPlayer)
    #Çå³ýVIPbuff
    #BuffSkill.DelBuffBySkillID(curPlayer, ChConfig.Def_VIPExp_SkillTypeID, tick)
    
    #Í¨ÖªÍæ¼ÒµÄbuff
    __Sync_ClientBuff(curPlayer)
    
    #³õʼ»¯ÏÖʵʱ¼äÎïÆ·
    InitRealityTimeItem(curPlayer, tick)
    
    #---Ë¢ÐÂÁËÍæ¼ÒÊôÐÔ, µÇ½ֻˢÐÂÒ»´Î£¬ÆäËûµØ·½²»ÓÃË¢
    DoPlayerLoginInMap(curPlayer, tick)
    
    PlayerControl.SyncOnLineTimeTotal(curPlayer)
    #PlayerControl.SyncOnLineTimeLastOpenPack(curPlayer, IPY_GameWorld.rptItem)
    PlayerControl.SyncTrainRealmLV(curPlayer)
    PlayerGodWeapon.OnLogin(curPlayer)
    PlayerPrestigeSys.OnLogin(curPlayer)
    #DataRecordPack.DR_PlayerLogin(curPlayer)
    EventReport.WriteEvent_login(curPlayer)
    
    __FirstLoginOnEnter(curPlayer)
    
    # ºÏ·þÊ׵Ǵ¦Àí
    __DoMixServerFirstLogin(curPlayer)
    PlayerBillboard.BillboardOnLogin(curPlayer)
    
    #ÉÏÏßʱ֪ͨÍÑ»ú¹Òʱ±»»÷ɱµÄÀëÏßʱ¼ä
    __Sync_PlayerOffline(curPlayer, tick)
    
    #Íæ¼ÒÀ©Õ¹ÐÅÏ¢
    __SyncPlayerInfoEx(curPlayer)
    
    #²¹¶¡°üÏÂÔØ½±Àø
    GiveDownloadPatchAward(curPlayer)
    
    #PKģʽ
    SyncPKModel(curPlayer)
        
    #×°±¸Ïà¹ØÐÅÏ¢
    ChEquip.OnPlayerEquipLoginLogic(curPlayer)
    
    #´óʦ
    PlayerGreatMaster.MasterOnLogin(curPlayer)
    
    #֪ͨVIP
    PlayerVip.DoOnLogin(curPlayer, tick)
    
    #֪ͨ·¨±¦¾«Á¶µÈ¼¶
    PlayerRefineStove.DoOnLogin(curPlayer, tick)
    
    #---Íæ¼ÒÉÏÏß, ³èÎïÂß¼­´¦Àí---
    PetControl.DoLogic_PetInfo_OnLogin(curPlayer, tick)
    PlayerPet.OnPlayerPetLogin(curPlayer)
    
    #Çå¿ÕÍæ¼ÒÍòÄܱ³°üÖеÄÈÎÎñÎïÆ·
    ItemControler.ClearPackEventItem(curPlayer, IPY_GameWorld.rptAnyWhere)
    
    #PlayerLoginNotify(curPlayer, tick)
    
    #·À³ÁÃÔ¼ÆËãÏÂÏßÀÛ»ýʱ¼ä
    PlayerGameWallow.Calc_Wallow_OfflineTime(curPlayer, tick)
    
    # Í¨ÖªµÈ¼¶½±ÀøÁìÈ¡¼Ç¼
    PlayerLVAward.Sync_LVAwardGetRecordInfo(curPlayer)
    
    PlayerCoin.OnLogin(curPlayer)
    # Ê׳ä/ÌìÌìÊ׳ä/³äÖµºÀÀñ
    PlayerGoldGift.OnLogin(curPlayer)
    
    #֪ͨ¹ºÂò¹¦ÄÜÖи÷¹ºÂòÀàÐ͵ÄÒѹºÂòºÍ¿É¹ºÂò´ÎÊý
    Operate_PlayerBuyZhenQi.DoPlayerLogin(curPlayer)
#    
#    #֪ͨ¹¦ÄÜÊ״δ¥·¢Çé¿ö
    GameFuncComm.Sync_FuncOpenState(curPlayer)
#    
#    #֪ͨ¿Í»§¶ËÇ©µ½ÐÅÏ¢
    PlayerSignDay.SignDayOnLogin(curPlayer)
    
    #Í¨ÖªÍæ¼ÒËÀÍöʱ¼ä
    PlayerControl.PlayerControl(curPlayer).NotifyPlayerDeadTime(curPlayer)
    #ClearPlayerDeadInfo(curPlayer)
    
    #³äÖµ»î¶¯Íæ¼ÒµÇÈë´¦Àí
    #PlayerGoldAction.DoLogic_PlayerOnLogin(curPlayer)
    
    # Ìáʾ¹ó±ö¾ãÀÖ²¿ÐÅÏ¢
    #PlayerVip.NoteVIPClubInfo(curPlayer)
    
    #½ÇÉ«¸ÄÃû´ÎÊý
    UpdatePlayerName.Sync_UpdatePlayerNameCount(curPlayer)
    
    # ×øÆïÏà¹ØÍ¨Öª
    PlayerHorse.PlayerHorseLogin(curPlayer)
    
    # ·¨Æ÷
    PlayerFaQi.PlayerFaQiLogin(curPlayer)
    
    # Á¶Ìå
    PlayerLianTi.OnPlayerLogin(curPlayer)
    
    PlayerTreasure.OnTreasureLogin(curPlayer)
    
    # Í¨ÖªÀۼƵǽÀñ
    PlayerLoginDayAward.OnLoginNotifyLoginDayAward(curPlayer)
    
    # ¿ª·þ»î¶¯½±ÀøÐÅÏ¢
    OpenServerCampaign.OnOpenServerCampaignLogin(curPlayer)
 
    # ÊÔÁ¶Ö®Ëþ
    GameLogic_TrialTower.OnFBPlayerLogin(curPlayer)
    # ¹ÅÉñ½ûµØ
    GameLogic_GodArea.GodAreaOnLogin(curPlayer)
    # ²É¼¯NPC´ÎÊý֪ͨ
    NPCCommon.SyncCollNPCTime(curPlayer)
    
    # Ã¿ÈÕ»îÔ¾¶È
    PlayerActivity.OnLogin(curPlayer)
    
    # ¸±±¾½øÈëʱ¼ä
    FBCommon.FBOnLogin(curPlayer)
    
    #ÊÀ½çµÈ¼¶
    PlayerWorldAverageLv.OnLogin(curPlayer)
    
    # Í¶×ÊÀí²Æ
    PlayerGoldInvest.OnLogin(curPlayer)
    
    #ÊôÐÔ¹ûʵʹÓÃÇé¿ö
    PlayerAttrFruit.AttrFruitOnLogin(curPlayer)
    
    #³É¾Í
    PlayerSuccess.SuccOnLogin(curPlayer)
    
    #÷ÈÁ¦
    PlayerCharm.OnPlayerLogin(curPlayer)
    
    #ÇéÔµ
    PlayerLove.DoPlayerLogin(curPlayer)
    
    #ͬ²½×Ô¶¯Õ½¶·ÅäÖüǼ
#    Sync_AutoFightSetting(curPlayer)
    
    PlayerFamily.OnPlayerLogin(curPlayer, tick)
    #¸Äµ½ GameServerRefresh GameSever_PlayerInitOKºó´¦Àí²ÅÄܱ£Ö¤Íæ¼ÒÒѾ­ÔÚGameserver×¢²á
    #PlayerDienstgrad.RefreshBillBoardDienstgrad(curPlayer)
    # ³ÆºÅ
    PlayerDienstgrad.Sync_AllDienstgradOnLogin(curPlayer)
    # ×ÊÔ´ÕÒ»ØOnLogin
    PlayerRecover.RecoverOnLogin(curPlayer)
    
    # Ê±×°
    PlayerCoat.OnLogin_Coat(curPlayer)
    
    # ¿ç·þPK
    PlayerCrossRealmPK.DoPlayerLogin(curPlayer)
    PlayerCrossChampionship.DoPlayerLogin(curPlayer)
    PlayerCrossBattlefield.DoPlayerLogin(curPlayer)
    
    # ÐÒÔËÔÆ¹º
    PlayerLuckyCloudBuy.OnPlayerLogin(curPlayer)
    
    # ¾º¼¼³¡
    PlayerArena.OnLogin(curPlayer)
    
    # ×Ô¶¨Òå»õ±Òֵͬ²½
    PlayerControl.NotifyPlayerAllCurrency(curPlayer)
    PlayerControl.NotifyUseMoneyTotal(curPlayer)
    #֪ͨ»ù´¡ÊôÐÔ
    NotifyPlayerBasePoint(curPlayer)
    
    #¿ç·þ³äÖµÅÅÐÐ
    CrossActCTGBillboard.OnPlayerLogin(curPlayer)
    #¿ç·þÈ«Ãñ³äÖµ
    CrossActAllRecharge.OnPlayerLogin(curPlayer)
    #Ïû·Ñ·µÀû
    PlayerCostRebate.OnPlayerLogin(curPlayer)
    #ÀۼƳäÖµ
    PlayerActTotalRecharge.OnPlayerLogin(curPlayer)
    #ÀۼƳäÖµ·µÀûÏÉÓñ
    PlayerActRechargeRebateGold.OnPlayerLogin(curPlayer)
    #³äÖµ·µÀû
    PlayerActRechargePrize.OnPlayerLogin(curPlayer)
    #³É³¤±ØÂò
    PlayerActGrowupBuy.OnPlayerLogin(curPlayer)
    #ÏÞÊ±ÌØ»Ý
    PlayerSpringSale.OnPlayerLogin(curPlayer)
    #ÏÞʱÀñ°ü
    PlayerFlashGiftbag.OnPlayerLogin(curPlayer)
    #ÿÈÕÀñ°ü
    PlayerDailyGiftbag.OnPlayerLogin(curPlayer)
    #ÏÞʱÇÀ¹º
    PlayerFlashSale.OnPlayerLogin(curPlayer)
    #ÂòÒ»ËͶà»î¶¯
    PlayerActBuyOne.OnPlayerLogin(curPlayer)
    #ÏÉÃ˳äÖµ»¥Öú
    PlayerActFamilyCTGAssist.OnPlayerLogin(curPlayer)
    #¼¯×ֻ
    PlayerActCollectWords.OnPlayerLogin(curPlayer)
    # ÊÀ½çboss
    BossHurtMng.OnLogin(curPlayer)
    ChItem.Sync_ItemDayUseCnt(curPlayer)
    # ·ûÓ¡µÇ¼֪ͨ
    PlayerRune.PlayerRuneLogin(curPlayer)
    # ÏÉÃ˺ì°üµÇ¼֪ͨ
    PlayerFamilyRedPacket.OnPlayerLogin(curPlayer)
    PlayerFeastRedPacket.DoPlayerOnLogin(curPlayer)
    # ·¨±¦µÇ¼֪ͨ
    PlayerMagicWeapon.PlayerMagicWeaponLogin(curPlayer)
    # É̵êÎïÆ·¹ºÂò´ÎÊýµÇ¼֪ͨ
    FunctionNPCCommon.ShopItemOnLogin(curPlayer)
    # Í¨ÖªÉèÖõı»¶¯¹¦·¨
    #PassiveBuffEffMng.OnLoginGFPassive(curPlayer)
    #ÏÉħ֮Õù
    GameLogic_XMZZ.OnXMZZLogin(curPlayer)
    PlayerOnlinePrize.OnPlayerLogin(curPlayer)
    #×°±¸·Ö½â
    PlayerEquipDecompose.PlayerLogin(curPlayer)
    #·À³ÁÃÔ
    PlayerGameWallow.DoLogic_CheckWallow(curPlayer, tick)
    # Ð­Öú
    PlayerAssist.OnPlayerLogin(curPlayer)
    # ¼«Æ·°×ÄÃ
    PlayerFreeGoods.OnLogin(curPlayer)
    # BOSS¸´»î»î¶¯
    PlayerBossReborn.OnLogin(curPlayer)
    # bossÀúÁ·
    PlayerActBossTrial.OnPlayerLogin(curPlayer)
    # Æï³èÊ¢Ñç»î¶¯
    PlayerActHorsePetFeast.OnLogin(curPlayer)
    # ÖÜ¿ñ»¶»î¶¯
    PlayerWeekParty.OnLogin(curPlayer)
    # ¹ºÂò´ÎÊýÀñ°ü»î¶¯
    PlayerActBuyCountGift.OnPlayerLogin(curPlayer)
    # ÈÎÎñ»î¶¯
    PlayerActTask.OnPlayerLogin(curPlayer)
    # ÔËÊÆ»î¶¯
    PlayerActYunshi.OnPlayerLogin(curPlayer)
    # Âֻصî»î¶¯
    PlayerActLunhuidian.OnPlayerLogin(curPlayer)
    # µÇ¼»î¶¯
    PlayerActLoginNew.OnPlayerLogin(curPlayer)
    # ½ÚÈÕѲÀñ»î¶¯
    PlayerFeastWeekParty.OnLogin(curPlayer)
    # ½ÚÈյǼ»î¶¯
    PlayerFeastLogin.OnPlayerLogin(curPlayer)
    # ½ÚÈÕ×£¸£»î¶¯
    PlayerFeastWish.OnPlayerLogin(curPlayer)
    # ½ÚÈÕÓÎÀú»î¶¯
    PlayerFeastTravel.OnPlayerLogin(curPlayer)
    # µÇ¼½±Àø»î¶¯
    PlayerActLogin.OnLogin(curPlayer)
    # À¬»ø·ÖÀà»î¶¯
    PlayerActGarbageSorting.OnPlayerLogin(curPlayer)
    # ÏÉÏ»ÃØ¾³»î¶¯
    PlayerActXianXiaMJ.OnPlayerLogin(curPlayer)
    # ¹Å±¦Ñø³É»î¶¯
    PlayerActGubao.OnPlayerLogin(curPlayer)
    # Æï³èÑø³É»î¶¯
    PlayerActHorsePetTrain.OnPlayerLogin(curPlayer)
    # Á¶Æ÷»î¶¯
    PlayerActLianqi.OnPlayerLogin(curPlayer)
    # ÌìµÛÀñ°ü»î¶¯
    PlayerActGodGift.OnPlayerLogin(curPlayer)
    # ¶àÈÕÁ¬³ä»î¶¯
    PlayerActManyDayRecharge.OnPlayerLogin(curPlayer)
    # µ¥±ÊÀÛ³ä»î¶¯
    PlayerActSingleRecharge.OnPlayerLogin(curPlayer)
    # ×ªÅ̻
    PlayerActTurntable.OnPlayerLogin(curPlayer)
    # ÏɽçÊ¢µä»î¶¯
    PlayerFairyCeremony.OnLogin(curPlayer)
    # ÐÂÏɽçÊ¢µä»î¶¯
    PlayerNewFairyCeremony.OnLogin(curPlayer)
    # ·ÖÖ§ÏÂÔØ½±Àø¼Ç¼֪ͨ
    SyncPackDownloadAward(curPlayer)
    # µÇ¼´¥·¢¹¦ÄÜ¿ªÆô£¨ÀϺŴ¦Àí£©
    GameFuncComm.DoFuncOpenLogic(curPlayer)
    # ÉñÊÞ
    PlayerDogz.OnPlayerLogin(curPlayer)
    # Æï³è
    FamilyRobBoss.OnPlayerLogin(curPlayer)
    # ÐíÔ¸³Ø
    PlayerWishingWell.OnLogin(curPlayer)
    #ÐÒÔ˼ø±¦
    PlayerLuckyTreasure.OnLogin(curPlayer)
    # Ð¡ÖúÊÖ
    SyncLittleHelper(curPlayer)
    # ¸±±¾ÖúÕ½
    FBHelpBattle.DoPlayerLogin(curPlayer)
    # ¾Û»ê
    PlayerGatherSoul.PlayerLogin(curPlayer)
    PlayerGatherTheSoul.OnPlayerLogin(curPlayer)
    #çÎç¿ÏÉÓò
    PlayerFairyDomain.OnLogin(curPlayer)
    PlayerFB.OnLogin(curPlayer)
    #¼¼ÄÜר¾«ÐÅÏ¢
    SkillShell.NotifyElementSkillInfo(curPlayer)
    #BossÊ×ɱ
    GY_Query_BossFirstKill.OnPlayerLogin(curPlayer)
    #ͨÌìÁî
    PlayerTongTianLing.OnPlayerLogin(curPlayer)
    #´´½Ç½±Àø
    Sync_CreateRoleAwardInfo(curPlayer)
    #×Ô¶¨Òå½±Àø
    PlayerCustomAward.OnPlayerLogin(curPlayer)
    #¹¦ÄÜÏµÍ³ÌØÈ¨
    PlayerFuncSysPrivilege.OnPlayerLogin(curPlayer)
    #Íæ·¨Ç°Õ°½±Àø
    gameNoticeAwardState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_GameNoticeAwardState)
    if gameNoticeAwardState:
        Sync_RewardGetRecordInfo(curPlayer, ChConfig.Def_RewardType_GameNotice, gameNoticeAwardState)
    #ÿÈÕ·ÖÏí½±Àø
    shareGameAwardState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ShareGameAwardState)
    if shareGameAwardState:
        Sync_RewardGetRecordInfo(curPlayer, ChConfig.Def_RewardType_ShareGame, shareGameAwardState)
    #ÓÎÏ·ºÃÆÀ½±Àø
    goodGameAwardState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_GoodGameAwardState)
    if goodGameAwardState:
        Sync_RewardGetRecordInfo(curPlayer, ChConfig.Def_RewardType_GoodGame, goodGameAwardState)
    #ÓÎÏ·µãÔÞ½±Àø
    likeGameAwardState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_LikeGameAwardState)
    if likeGameAwardState:
        Sync_RewardGetRecordInfo(curPlayer, ChConfig.Def_RewardType_LikeGame, likeGameAwardState)
    #¿ª·þÿÈÕ½±Àø
    awardState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_OpenSererDailyAward)
    if awardState:
        Sync_RewardGetRecordInfo(curPlayer, ChConfig.Def_RewardType_OpenServerDailyAward, awardState)
    #ÀÛ³äÿÈÕ½±Àø
    awardState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_RechargeDayAward)
    if awardState:
        Sync_RewardGetRecordInfo(curPlayer, ChConfig.Def_RewardType_RechargeDayAward, awardState)
        
    curPlayer.SetState(0)   # ÍÑ»ú¹Ò»Ö¸´ÎªÕý³£ÉÏÏß
    curPlayer.SetCountryLastWeekHornor(0) # Í¨ÖªÊý¾Ý¿âÊÇ·ñ±£´æ»¹ÊÇÏÂÏߣ¬×öÒ»´Î»Ö¸´£¬1Ϊ±£´æ 0ΪÕý³£ÏÂÏß
    
    PlayerControl.DoGMForbidenTalkOnLogin(curPlayer)
    DataRecordPack.DR_PlayerLogin(curPlayer) # ·Å×îºó£¬¼Ç¼µÈ¼¶¡¢¾­ÑéµÈÐÅÏ¢
    return
 
def DoPlayerRealLoginOK(curPlayer, tick):
    ''' Íæ¼Ò×îÖյǼ³É¹¦´¦Àí£¬ ÓÉ  GameServerRefresh GameSever_PlayerInitOK  µ÷ÓÃ
        ¸Ãº¯ÊýΪµØÍ¼×îÖյǼ³É¹¦²Å»áÖ´Ðе½£¬ÒÔºóһЩ¹¦ÄÜÀàµÄµÇ¼´¦Àí½¨Òé¾ùдµ½ÕâÀï
        ¾ÉµÄ¹¦ÄÜÏȲ»¶¯( __DoPlayerLoginServer º¯ÊýÖеŦÄÜ)£¬Èç¹ûÓеǼÏà¹ØµÄbugÔÙ¿¼ÂÇÊÇ·ñÒÆ¶¯µ½´Ëº¯Êý
    '''
    GameWorld.Log("MapServer->DoPlayerRealLoginOK", curPlayer.GetPlayerID())
    
    if GameWorld.IsCrossServer():
        pass
    
    else:
        PlayerMail.OnPlayerLogin(curPlayer)
        PlayerChatBox.OnPlayerLogin(curPlayer)
        PlayerFace.OnPlayerLogin(curPlayer)
        PlayerXiangong.OnPlayerLogin(curPlayer)
        PlayerGubao.OnPlayerLogin(curPlayer)
        PlayerShentong.OnPlayerLogin(curPlayer)
        PlayerZhanling.OnPlayerLogin(curPlayer)
        PlayerTask.OnPlayerLogin(curPlayer)
        PlayerTree.OnPlayerLogin(curPlayer)
        PlayerMineArea.OnPlayerLogin(curPlayer)
        PlayerGuaji.OnPlayerLogin(curPlayer)
        PlayerActFamilyGCZ.OnPlayerLogin(curPlayer)
        PlayerTalk.OnPlayerLogin(curPlayer)
        
        # ÉÏÏß²éѯһ´Î³äÖµ¶©µ¥
        curPlayer.SendDBQueryRecharge()
        
    # Í¨ÖªGameServerµØÍ¼×îÖյǼ³É¹¦ÁË
    isMixServerFirstLogin = curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_MixServerFirstLogin)
    msg = str([isMixServerFirstLogin])
    GameWorld.GetPlayerManager().GameServer_QueryPlayerResult(curPlayer.GetID(), 0, 0, "PlayerRealLoginOK", msg, len(msg))
    return
 
## Íæ¼ÒÀ©Õ¹ÐÅϢͬ²½
#  @param curPlayer
#  @return None
def __SyncPlayerInfoEx(curPlayer):
    playerInfoEx = ChPyNetSendPack.tagMCPlayerInfo()
    playerInfoEx.Clear()
    playerInfoEx.IsAdult = curPlayer.IsAdult()
    playerInfoEx.CreateRoleTime = curPlayer.GetCreateRoleTime()
    
    NetPackCommon.SendFakePack(curPlayer, playerInfoEx)
    return
 
def __FirstLoginOnEnter(curPlayer):
    ## Ê׵Ǵ¦Àí
    
    playerID = curPlayer.GetID()
    if curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FirstLogin):
        return
    
    GameWorld.Log('Íæ¼ÒÊǵÚÒ»´Î½øÈëÓÎÏ·', playerID)
    # ÌØÊâ˵Ã÷£º Èç¹ûµØÍ¼Ã»ÓÐÍêÈ«³õʼ»¯ºÃ£¬¿Í»§¶Ë¶Ï¿ª»òÕßÒì³£µÈÇé¿ö»á´¥·¢RunGateGameServerMapServerKickOutPlayerNoSave
    # ÄÇôÔÚDoPlayerLogin ÖÐÉèÖõÄÊý¾Ý½«²»»á±»±£´æ£¬ Èç»áµ¼ÖµÚÒ»¸öÈÎÎñÖØ¸´´¥·¢ÎÊÌ⣬¼Ç¼¶à´Î·¢ËÍ
    EventReport.WriteEvent_Entry(curPlayer, 4)
    #EventReport.EventReport(ShareDefine.Def_UserAction_FirstLogin, "", curPlayer)
    
    #---²¹ÂúѪÂúħ---
    GameObj.SetHP(curPlayer, GameObj.GetMaxHP(curPlayer))
    curPlayer.SetMP(curPlayer.GetMaxMP())
    
    #ĬÈÏ´¥·¢Ò»´Î¹¦ÄÜ¿ªÆô
    if curPlayer.GetLV() == 1:
        GameFuncComm.DoFuncOpenLogic(curPlayer)
        
    #³õʼ»¯×é¶Ó״̬
    autoJoinReqCheck = IpyGameDataPY.GetFuncCfg("TeamCheckSet", 1)
    autoInviteCheck = IpyGameDataPY.GetFuncCfg("TeamCheckSet", 2)
    PlayerControl.SetTeamCheckStateEx(curPlayer, int(not autoJoinReqCheck), int(not autoInviteCheck))
    
    #Íæ¼ÒĬÈ϶ñÃûÖµ
    curPlayer.SetInfamyValue(ChConfig.Def_FirstLogin_InfamyValue)
    
    #curPlayer.SetDict("ThunderLogin", 1)
    #¼Ç¼µÚÒ»´ÎµÇ½
    DataRecordPack.DR_FirstLogin(curPlayer.GetAccID(), curPlayer.GetIP(), curPlayer)
    
    #Ê×µÇÓʼþ
    mailList = IpyGameDataPY.GetFuncEvalCfg("MailLVAward", 2)
    for mailTypeKey, mailItemList in mailList:
        PlayerControl.SendMailByKey(mailTypeKey, [curPlayer.GetPlayerID()], mailItemList)
        
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FirstLogin, 1)
    return
 
def __DoMixServerFirstLogin(curPlayer):
    ## ºÏ·þÊ׵Ǵ¦Àí
    isMixServer = GameWorld.GetGameWorld().GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_IsMixServer)
    if not isMixServer:
        return
    
    playerID = curPlayer.GetPlayerID()
    lastMixServerDay = GameWorld.GetGameWorld().GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_LastMixServerDay)
    
    playerDay = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_MixLoginDay)
    
    if playerDay == lastMixServerDay:
        GameWorld.DebugLog("±¾´ÎºÏ·þÒѾ­µÇ¼¹ý. lastMixServerDay=%s" % (lastMixServerDay), playerID)
        return
    mixServerWorldLV = GameWorld.GetGameWorld().GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_LastMixServerWorldLV) # ºÏ·þʱµÄÊÀ½çµÈ¼¶
    GameWorld.Log("Íæ¼ÒºÏ·þÊ׵Ǵ¦Àí! lastMixServerDay=%s,mixServerWorldLV=%s" % (lastMixServerDay, mixServerWorldLV), playerID)    
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_MixLoginDay, lastMixServerDay)
    
    if curPlayer.GetLV() <= 1:
        GameWorld.Log("    ÐºŲ»¸øºÏ·þ½±Àø!", playerID)
        return
    
    curPlayer.SetDict(ChConfig.Def_PlayerKey_MixServerFirstLogin, 1)
    
    # ÖØÖÃÊ׳äË«±¶
    PlayerCoin.DoResetCTGCount(curPlayer, "MixServer")
    
    # ÖØÖÃÉ̵깺Âò´ÎÊý£¬Ôݶ¨Ö»ÖØÖÃÀàÐÍ 7 µÄ
    FunctionNPCCommon.ResetShopItemBuyCount(curPlayer, [7])
    
    # ºÏ·þÓʼþ£¬ÃËÖ÷רÊôÓʼþÔÚGameServer´¦Àí
    mailItemList = IpyGameDataPY.GetFuncEvalCfg("MixServerMail", 1)
    worldLVMailItemList = IpyGameDataPY.GetFuncEvalCfg("MixServerMail", 2)
    mailMoneyList = IpyGameDataPY.GetFuncEvalCfg("MixServerMail", 3)
    worldLVDown = IpyGameDataPY.GetFuncCfg("MixServerMail", 5) # µÈ¼¶µ¤Ïà¶ÔºÏ·þÊÀ½çµÈ¼¶²îÖµ
    itemWorldLV = max(150, mixServerWorldLV - worldLVDown)
    gold, silver = mailMoneyList
    worldLVItemList = []
    for itemID, itemCount, isBind in worldLVMailItemList:
        itemData = GameWorld.GetGameData().GetItemByTypeID(itemID)
        if not itemData:
            continue
        curEff = itemData.GetEffectByIndex(0)
        curEffID = curEff.GetEffectID()
        if curEffID != ChConfig.Def_Effect_ItemAddLV:
            continue
        lvLimit = curEff.GetEffectValue(1)
        if not lvLimit:
            continue
        if lvLimit <= itemWorldLV:
            worldLVItemList = [[itemID, itemCount, isBind]]
        else:
            break
    detailDict = {"MixServerWorldLV":mixServerWorldLV, "LastMixServerDay":lastMixServerDay, "ItemWorldLV":itemWorldLV}
    addItemList = mailItemList + worldLVItemList
    GameWorld.Log("    ·¢ËͺϷþ²¹³¥Óʼþ: itemWorldLV=%s,addItemList=%s" % (itemWorldLV, addItemList), playerID)
    PlayerControl.SendMailByKey("MixServer1", [playerID], addItemList, gold=gold, silver=silver, detail=detailDict)
    
    # Í¬²½ÅÅÐаñ
    PlayerBillboard.UpdatePlayerBillboardOnLeaveServer(curPlayer, isAll=True)
    
    # ÌìÐÇËþÈ«·þ¹ý¹Ø¼Ç¼
    GameLogic_SkyTower.OnMixFirstLogin(curPlayer)
    
    # bossƾ֤
    PlayerActBossTrial.OnMixFirstLogin(curPlayer)
    # ÏÉÏ»ÃØ¾³
    PlayerActXianXiaMJ.OnMixFirstLogin(curPlayer)
    # ¹Å±¦Ñø³É
    PlayerActGubao.OnMixFirstLogin(curPlayer)
    # Æï³èÑø³É
    PlayerActHorsePetTrain.OnMixFirstLogin(curPlayer)
    # ÖØÖÃÍæ¼Ò¸ÄÃû´ÎÊý
    #UpdatePlayerName.ResetChangeNameCnt(curPlayer)
    return
#---------------------------------------------------------------------
        
##Çå³ýÍæ¼ÒËÀÍöÐÅÏ¢
# @param curPlayer Ö÷½Ç
# @return None
def ClearPlayerDeadInfo(curPlayer):
    #¼Ç¼µ±Ç°ËÀÍö´ÎÊý£¬Ê±¼ä
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_PlayerDeadCnt, 0)
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_DeadTime, 0)
    return
 
##Íæ¼ÒµÇ½, Ïà¹Ø»î¶¯Í¨Öª
#@param curPlayer Íæ¼ÒʵÀý
#@param tick Ê±¼ä´Á
#@return ·µ»ØÖµÎÞÒâÒå
#@remarks Íæ¼ÒµÇ½, Ïà¹Ø»î¶¯Í¨Öª
def PlayerLoginNotify(curPlayer, tick):
    curTime = GameWorld.GetCurrentTime()
    
    #¶ÁÈ¡ÉÏÏßÌáʾ±í
    notifyByTimeSect = ReadChConfig.GetEvalChConfig('PlayerLoginNotify_TimeSect')     #ijʱ¼ä¶ÎÄÚÉÏÏßÌáʾ
    notifyByDict = ReadChConfig.GetEvalChConfig('PlayerLoginNotify_Dict')             #¸ù¾Ý×ÖµäÖµ¸øÌáʾ
    
    #Ôڹ涨ʱ¼ä¶ÎÄÚÉÏÏ߸øÌáʾ
    DoNotifyByTimeSect(curPlayer, curTime, notifyByTimeSect)
    #Ö¸¶¨×ÖµäÖµÄÚÌáʾ
    DoNotifyByDict(curPlayer, notifyByDict)
    return
#---------------------------------------------------------------------
##Ôڻ¹æ¶¨Ê±¼ä¶ÎÄÚÉÏÏ߸øÌáʾ
#@param curPlayer Íæ¼ÒË÷Òý
#@param curTime ´«Èëʱ¼ä
#@param notifyInfo ÌáʾÐÅÏ¢
#@return ·µ»ØÖµÎÞÒâÒå
#@remarks Ôڻ¹æ¶¨Ê±¼ä¶ÎÄÚÉÏÏ߸øÌáʾ
def DoNotifyByTimeSect(curPlayer, curTime, notifyInfo):
    for curNotify in notifyInfo:
        #ÓÐʱ¼ä¶ÎÏÞÖÆ£¬Ñé֤ʱ¼ä¶Î
        if not GameWorld.IsAtActTime(curTime, curNotify[0]):
            continue
        
        PlayerControl.NotifyCode(curPlayer, curNotify[1], curNotify[2])
 
#---------------------------------------------------------------------
##Ö¸¶¨×ÖµäÖµÄÚÌáʾ
#@param curPlayer Íæ¼ÒʵÀý
#@param notifyInfo ÌáʾÐÅÏ¢
#@return ·µ»ØÖµÎÞÒâÒå
#@remarks Ö¸¶¨×ÖµäÖµÄÚÌáʾ
def DoNotifyByDict(curPlayer, notifyInfo):
    gameWorld = GameWorld.GetGameWorld()
    for curNotify in notifyInfo:
        if gameWorld.GetGameWorldDictByKey(curNotify[0]) in curNotify[1]:
            PlayerControl.NotifyCode(curPlayer, curNotify[2], curNotify[3])
 
 
#---------------------------------------------------------------------
##֪ͨ±³°üÏêϸÐÅÏ¢
#@param curPlayer Íæ¼ÒʵÀý
#@return ·µ»ØÖµÎÞÒâÒå
#@remarks Í¨Öª±³°üÏêϸÐÅÏ¢
def __Sync_PackDetel(curPlayer):
    itemManager = curPlayer.GetItemManager()
    
    for packIndex in ChConfig.Def_PlayerLoginInitPackIndexList:
        rolePack = itemManager.GetPack(packIndex)
        rolePack.Sync_Refresh()
        
        # Ë¢ÏÂ×°±¸ÆÀ·Ö£¬²Ö¿â¿ÉÒÔÔݲ»´¦Àí£¬È¡³ö×°±¸ºóµÇ¼´¥·¢Ë¢ÐÂ
        for i in xrange(rolePack.GetCount()):
            curItem = rolePack.GetAt(i)
            if curItem.IsEmpty():
                continue
            newScore = ItemCommon.CalcEquipGS(curItem)
            hisScore = ItemCommon.GetEquipGearScore(curItem)
            if hisScore != newScore:
                ItemCommon.SetEquipGearScore(curItem, newScore)
                GameWorld.Log("µÇ¼¸üÐÂ×°±¸ÆÀ·Ö: packType=%s,i=%s,hisScore=%s,newScore=%s,itemID=%s,guid=%s" 
                              % (packIndex, i, hisScore, newScore, curItem.GetItemTypeID(), curItem.GetGUID()), curPlayer.GetPlayerID())
                
    for packIndex in ChConfig.Def_VPackCnt_Dict.keys():
        ItemControler.Sync_VPackItem_Refresh(curPlayer, packIndex)
        
#===============================================================================
#    
#    itemManager.GetPack(IPY_GameWorld.rptEquip).Sync_Refresh()
#    itemManager.GetPack(IPY_GameWorld.rptItem).Sync_Refresh()
#    itemManager.GetPack(IPY_GameWorld.rptRecycle).Sync_Refresh()
#    itemManager.GetPack(IPY_GameWorld.rptTitle).Sync_Refresh()
#    #itemManager.GetPack(IPY_GameWorld.rptInvestiture).Sync_Refresh()
#    itemManager.GetPack(IPY_GameWorld.rptHorse).Sync_Refresh()
#    itemManager.GetPack(IPY_GameWorld.rptAnyWhere).Sync_Refresh()
#    #itemManager.GetPack(IPY_GameWorld.rptFabao).Sync_Refresh()
#    #itemManager.GetPack(IPY_GameWorld.rptHorseEquip).Sync_Refresh()
#    #ʱװ±³°ü
#    itemManager.GetPack(IPY_GameWorld.rptCabinetWeaponCoat).Sync_Refresh()
#    itemManager.GetPack(IPY_GameWorld.rptCabinetHorse).Sync_Refresh()
#    itemManager.GetPack(IPY_GameWorld.rptCabinetDressCoat).Sync_Refresh()
#    #³èÎï´¢Îï¹ñ
#    itemManager.GetPack(IPY_GameWorld.rptPetCabinetPet).Sync_Refresh()
#    #´òÔì±³°ü(Òò´òÔì¸ÄΪԶ³Ì´òÔì,ÐèÒªÉÏÏß֪ͨ±³°üÄÚÈÝ)
#    itemManager.GetPack(IPY_GameWorld.rptCompose).Sync_Refresh()
#    itemManager.GetPack(IPY_GameWorld.rptResult).Sync_Refresh()
#    
#    itemManager.GetPack(IPY_GameWorld.rptJewelMerge).Sync_Refresh()
#    itemManager.GetPack(IPY_GameWorld.rptJewelMergeResult).Sync_Refresh()
#    itemManager.GetPack(IPY_GameWorld.rptFineSoulSlot).Sync_Refresh()
#    #itemManager.GetPack(IPY_GameWorld.rptBreakPrepare).Sync_Refresh()
#    #itemManager.GetPack(IPY_GameWorld.rptBreakItem).Sync_Refresh()
#===============================================================================
    return
 
#---------------------------------------------------------------------
##³õʼ»¯ÏÖʵʱ¼äÎïÆ·
#@param curPlayer Íæ¼ÒʵÀý
#@param tick Ê±¼ä´Á
#@return ·µ»ØÖµÎÞÒâÒå
#@remarks ³õʼ»¯ÏÖʵʱ¼äÎïÆ·
def InitRealityTimeItem(curPlayer, tick):
    PlayerState.ProcessTimeEquip(curPlayer, tick)
    return
 
#---------------------------------------------------------------------
##Í¨ÖªÍæ¼Ò¼¼ÄÜÐÅÏ¢
#@param curPlayer Íæ¼ÒʵÀý
#@return ·µ»ØÖµÎÞÒâÒå
#@remarks Í¨ÖªÍæ¼Ò¼¼ÄÜÐÅÏ¢
def __Sync_ClientSkill(curPlayer):
    sendPack = ChPyNetSendPack.tagMCPlayerSkills()
    sendPack.Clear()
    sendPack.Skills = []
    skillManager = curPlayer.GetSkillManager()
    for i in range(skillManager.GetSkillCount()):
        curSkill = skillManager.GetSkillByIndex(i)
        #curSkill.Sync_Skill()
        skillInfo = ChPyNetSendPack.tagPlayerSkill()
        skillInfo.SkillID = curSkill.GetSkillID()
        skillInfo.RemainTime = curSkill.GetRemainTime()
        skillInfo.Proficiency = curSkill.GetProficiency()
        
        sendPack.Skills.append(skillInfo)
 
    sendPack.Count = len(sendPack.Skills)
    NetPackCommon.SendFakePack(curPlayer, sendPack) 
    return
 
#---------------------------------------------------------------------
##Í¨ÖªÍæ¼ÒbuffÐÅÏ¢
#@param curPlayer Íæ¼ÒʵÀý
#@return ·µ»ØÖµÎÞÒâÒå
#@remarks Í¨ÖªÍæ¼ÒbuffÐÅÏ¢
def __Sync_ClientBuff(curPlayer):
    __SyncClearBuff(curPlayer)
    curPlayer.GetBuffState().Sync_Buff()
    curPlayer.GetDeBuffState().Sync_Buff()
    curPlayer.GetAura().Sync_Buff()
    curPlayer.GetIncBuff().Sync_Buff()
    curPlayer.GetProcessBuffState().Sync_Buff()
    curPlayer.GetProcessDeBuffState().Sync_Buff()
    return
 
def __SyncClearBuff(curPlayer):
    clientPack = ChNetSendPack.tagClearObjBuff()
    clientPack.Clear()
    clientPack.ObjType = curPlayer.GetGameObjType()
    clientPack.ObjID = curPlayer.GetID()
    clientPack.BuffType = 99 # 99´ú±íÇåËùÓÐ
    NetPackCommon.SendFakePack(curPlayer, clientPack)    
    return
 
#---------------------------------------------------------------------
##ÉÏÏßʱ֪ͨÀëÏßʱ¼ä£¨ÀëÏß¹Ò»ú¹¦ÄÜ£©
# @param curPlayer Íæ¼ÒʵÀý
# @param tick Ê±¼ä´Á
# @return ·µ»ØÖµÎÞÒâÒå
# @remarks ÉÏÏßʱ֪ͨÀëÏßʱ¼ä£¨ÀëÏß¹Ò»ú¹¦ÄÜ£©
def __Sync_PlayerOffline(curPlayer, tick):
    #---µÈ¼¶ÏÞÖÆ---
    if GameWorld.IsCrossServer():
        return
    
#===============================================================================
#    #---µÈ¼¶ÏÞÖÆ---
#    lvLimit = ReadChConfig.GetEvalChConfig('OfflineSys_LVLimit')
#    if curPlayer.GetLV() < lvLimit:
#        return
#    
#    if GameWorld.IsCrossServer():
#        return
#    
#    #µ±Ç°ÀëÏßʱ¼ä£¨·Ö£©
#    curOfflineMinutes = min(PlayerControl.GetPlayerLeaveServerMinute(curPlayer),
#                            ChConfig.Def_UpperLimit_DWord)
#    
#    #·ÀÖ¹·þÎñÆ÷ʱ¼äÐ޸ĵ½¹ýÈ¥µÃµ½¸ºÖµ
#    if curOfflineMinutes < 0:
#        GameWorld.ErrLog("Login Time Error, outTime: %s - loginTime :%s" % 
#                         (curPlayer.GetLogoffTime(), GameWorld.GetCurrentDataTimeStr()),
#                         curPlayer.GetPlayerID())
#        curOfflineMinutes = 0
#    
#    #ʱ¼äΪ·ÖÖÓ
#    minTimeLimit, maxTimeLimit = ReadChConfig.GetEvalChConfig("OfflineSys_AllTimeUpperLimit")
#    if curOfflineMinutes >= minTimeLimit:
#        #×ÜÀëÏßʱ¼ä£¨·Ö£©
#        allOfflineMinutes = min(curPlayer.GetOfflineMinutes() + curOfflineMinutes, maxTimeLimit)
#        #¼Ç¼ÀëÏß×Üʱ¼ä
#        curPlayer.SetOfflineMinutes(int(allOfflineMinutes))
#        GameWorld.DebugLog("ÉèÖÃÀëÏß½±ÀøÊ±¼ä %s,curOfflineMinutes=%s" % (allOfflineMinutes, curOfflineMinutes), curPlayer.GetPlayerID())
#    else:
#        GameWorld.DebugLog("ÀëÏßʱ¼ä¹ý¶Ì,²»¼ÆÈëÀëÏß½±Àø!curOfflineMinutes=%s" % curOfflineMinutes, curPlayer.GetPlayerID())
#    
#    #֪ͨ¿Í»§¶ËÀëÏßʱ¼ä
# #    curPlayer.Syn_OfflineTimeRefresh(int(curOfflineMinutes))
#    curPlayer.Syn_OfflineTimeQueryResult()
#===============================================================================
    return
 
#---------------------------------------------------------------------
##Íæ¼ÒÔÚµØÍ¼·þÎñÆ÷ÖеǼok,³õʼ»¯×Ô¼º
#@param curPlayer Íæ¼ÒʵÀý
#@param tick Ê±¼ä´Á
#@return ·µ»ØÖµÎÞÒâÒå
#@remarks Íæ¼ÒÔÚµØÍ¼·þÎñÆ÷ÖеǼok,³õʼ»¯×Ô¼º
def DoPlayerLoginInMap(curPlayer, tick):
    #֪ͨGameServerÇл»µØÍ¼¿ªÊ¼
    #curPlayer.GameServer_SetLoadMapState(0)
    #ÔÚÍæ¼ÒÇл»³¡¾°µÄʱºò, ²»»áµ÷Óõ½ÕâÀï
    curPlayer.SetCanMove(False)
    curPlayer.SetInitOK(False)
    #Íæ¼ÒµÇ¼³É¹¦
    curPlayer.SetMapLoadOK(False)
    curPlayer.SetVisible(False)
    curPlayer.SetCanAttack(False)
    
    #ÇеØÍ¼ÒªÇå³ýµÄbuff
    __CheckClearBuffOnMapChange(curPlayer, tick)
            
    if GameWorld.GetMap().GetMapFBType() != IPY_GameWorld.fbtNull:
        #¸±±¾µØÍ¼ÉÏÏßÇл»²Å¼ÓÎÞµÐbuff
        SkillCommon.AddBuffBySkillType_NoRefurbish(curPlayer, ChConfig.Def_SkillID_LimitSuperBuff, tick)
            
    #Ë¢ÐÂÍæ¼ÒµÄÊÓÒ°
    if not GameWorld.IsCrossServer() and (PlayerControl.GetCrossMapID(curPlayer) or PlayerControl.GetCustomMapID(curPlayer)):
        GameWorld.DebugLog("===µÇ¼±¾·þµØÍ¼Ê±£¬´¦ÓÚ¿ç·þ»ò×Ô¶¨Ò峡¾°×´Ì¬£¬²»Ë¢ÐÂÊÓÒ°!", curPlayer.GetPlayerID())
        PlayerControl.SetPlayerSightLevel(curPlayer, curPlayer.GetID())
    elif not GameWorld.IsCrossServer():
        realmDifficulty = PlayerControl.GetMapRealmDifficulty(curPlayer)
        if realmDifficulty:
            GameWorld.DebugLog("===µÇ¼±¾·þµØÍ¼Ê±£¬´¦ÓÚ¾³½çÄѶȵØÍ¼£¬×Ô¶¯ÉèÖÃÄѶÈ! realmDifficulty=%s" % realmDifficulty, curPlayer.GetPlayerID())
            PlayerControl.SetRealmDifficulty(curPlayer, realmDifficulty)
            
    PlayerState.ChangePlayerSigh(curPlayer, tick)
    
    if GameWorld.IsCrossServer():
        curPlayer.SetForbiddenSyncClientState(False)
        
    playerControl = PlayerControl.PlayerControl(curPlayer)
    #Ë¢ÐÂËùÓÐ״̬
    playerControl.ReCalcAllState()
    
    if GameWorld.IsCrossServer():
        curPlayer.SetForbiddenSyncClientState(True)
    
    #Ë¢ÐÂÒÑ·ÖÖÓµ¥Î»ÏûºÄµÄÎïÆ·(²»ÈÃÍæ¼ÒÒ»ÉÏÏ߾͵ôÄ;Ã)
    curPlayer.SetProcessEquipDurgTick(tick)
    
    #³õʼ»¯Íæ¼Òµ±Ç°ÉÏÏßʱ¼ä
    curPlayer.SetLoginTick(tick)
    #µÇ¼ÐµØÍ¼£¬ÖØÖüÆËãÔÚÏßʱ³¤tick
    curPlayer.SetDict(ChConfig.Def_PlayerKey_CalcOLTimeTick, tick)
    
    #³õʼ»¯Íæ¼ÒµÄÖØÉúµã
    PlayerControl.RefreshRebornPoint(curPlayer, tick)
    
    #Ç¿ÖÆ¼ÇÂ¼Íæ¼ÒµÄһЩÐÅÏ¢
    SavePlayerMessionInDataServer(curPlayer)
    
    #¼ì²é¸üÐÂ×ÜÕ½¶·Á¦
    #PlayerBillboard.UpdatePlayerFPTotalBillboard(curPlayer, True)
    EventReport.WriteEvent_FightPower(curPlayer)
    
    #Çå³ýÔÚ±¾µØÍ¼ÀëÏ߼ǼÐÅÏ¢
    PlayerControl.RemoveLeaveServerPlayerInfo(curPlayer.GetPlayerID())
    
    PyGameData.g_needRefreshMapServerState = True # ÓÐÍæ¼ÒµÇ¼µØÍ¼Ê±ÉèÖÃÐèҪˢÐÂ
    return
 
##¼ì²éÇеØÍ¼Çå³ý¸±±¾ÌØÊâbuff
#@param curPlayer Íæ¼ÒʵÀý
#@return 
def __CheckClearBuffOnMapChange(curPlayer, tick):
    curMapID = GameWorld.GetMap().GetMapID()
    fbBuffDict = ReadChConfig.GetEvalChConfig("FBBuff")
    buffIDList = []
    for buffID, mapIDList in fbBuffDict.items():
        
        # ²»ÊǸõØÍ¼µÄbuffÇå³ý
        if not mapIDList or curMapID not in mapIDList:
            if BuffSkill.DelBuffBySkillID(curPlayer, buffID, tick):
                GameWorld.DebugLog("ÇеØÍ¼É¾³ý¶àÓàbuff: %s" % buffID)
                buffIDList.append(buffID)
    
    # Çл»µØÍ¼²»»á´øBUFFeffect£¬ReCalcAllStateͳһ´¦Àí
    for buffID in ChConfig.ClearBuffOnMapChangeList:
        BuffSkill.DelBuffBySkillID(curPlayer, buffID, tick)
    return
 
#---------------------------------------------------------------------
##Ç¿ÖÆ¼ÇÂ¼Íæ¼ÒµÄһЩÐÅÏ¢
#@param curPlayer Íæ¼ÒʵÀý
#@return ·µ»ØÖµÎÞÒâÒå
#@remarks Ç¿ÖƼÇÂ¼Íæ¼ÒµÄһЩÐÅÏ¢
def SavePlayerMessionInDataServer(curPlayer):
    #mapID = curPlayer.GetMapID()
    #lineID = PlayerControl.GetPlayerLineID(curPlayer)
    
    #¼Ç¼µØÍ¼Ïß·£¬µ±Ç°¾­ÑéºÍ½ðÇ®
    
    return
 
#---------------------------------------------------------------------
##C++·â°ü´¥·¢, Íæ¼ÒµÇ½ÓÎÏ·
#@param index Íæ¼ÒË÷Òý
#@param tick Ê±¼ä´Á
#@return ·µ»ØÖµÎÞÒâÒå
#@remarks C++·â°ü´¥·¢, Íæ¼ÒµÇ½ÓÎÏ·
def PlayerLogin(index, tick):
    GameWorld.GetPsycoFunc(__Func_PlayerLogin)(index, tick)
    return
 
#---------------------------------------------------------------------
##C++·â°ü´¥·¢, Íæ¼ÒµÇ½ÓÎÏ·
#@param index Íæ¼ÒË÷Òý
#@param tick Ê±¼ä´Á
#@return ·µ»ØÖµÎÞÒâÒå
#@remarks C++·â°ü´¥·¢, Íæ¼ÒµÇ½ÓÎÏ·
def __Func_PlayerLogin(index, tick):
    #ÕâÀïÖ»×ö³õʼ»¯Âß¼­
    #ÔÚÍæ¼ÒÇл»³¡¾°µÄʱºò, ²»»áµ÷Óõ½ÕâÀï
    curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
    try:
        InitLoginPlayer(curPlayer, tick)
        DoPlayerLogin(curPlayer, tick)
        
        #Ëø×¡Íæ¼Ò, µÈµ½¶ÁÈ¡µØÍ¼³É¹¦, ÔÙ½âËø
        curPlayer.SetCanMove(False)
 
        curPlayer.SendToBServerServerInitOK()   #֪ͨrouteµÇ¼³É¹¦ £¬routeÏò¿Í»§¶Ë·¢ËÍ0109°ü
        OnAllServerInitOK(curPlayer, tick)
        #µ½´Ë´¦ÒѾ­¿ÉÒÔ±£´æÊý¾Ý£¬¼´Ê¹¿Í»§¶Ë²»»Ø°ü¶ÏÏß
        #Ô­ //01 07 µØÍ¼¶ÁÈ¡OK#tagCInitMapOK Âß¼­ Ö±½Óµ÷ÓÃ
        __Func_LoadMapOK(index, tick)
        GameServerRefresh.GameSever_PlayerInitOK(index, tick)
    except:
        curPlayer.Kick(IPY_GameWorld.disWaitForPlayerLoinError)
        import traceback
        GameWorld.RaiseException("Íæ¼ÒÉÏÏßÂß¼­´íÎó\r\n%s" % traceback.format_exc())
    
    return
    
    
#---------------------------------------------------------------------
##C++·â°ü´¥·¢, Íæ¼ÒÇл»µØÍ¼µÄʱºò, ÔÚ±¾µØÍ¼µÇ¼
#@param index Íæ¼ÒË÷Òý
#@param tick Ê±¼ä´Á
#@return ·µ»ØÖµÎÞÒâÒå
#@remarks C++·â°ü´¥·¢, Íæ¼ÒÇл»µØÍ¼µÄʱºò, ÔÚ±¾µØÍ¼µÇ¼
def ChangeMapInit(index, tick):
    GameWorld.GetPsycoFunc(__Func_ChangeMapInit)(index, tick)
    return
 
#---------------------------------------------------------------------
##C++·â°ü´¥·¢, Íæ¼ÒÇл»µØÍ¼µÄʱºò, ÔÚ±¾µØÍ¼µÇ¼
#@param index Íæ¼ÒË÷Òý
#@param tick Ê±¼ä´Á
#@return ·µ»ØÖµÎÞÒâÒå
#@remarks C++·â°ü´¥·¢, Íæ¼ÒÇл»µØÍ¼µÄʱºò, ÔÚ±¾µØÍ¼µÇ¼
def __Func_ChangeMapInit(index, tick):
    curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
    
    InitLoginPlayer(curPlayer, tick)
#===============================================================================
#    #Çл»µØÍ¼£¬
#    #ÖØË¢Íæ¼ÒÊôÐÔ,ÖØÉèѪÁ¿(ÒòÇл»µØÍ¼Ê±,·â°ü¿ÉÄܱ»½Ø¶Ï,µ¼Ö¶ª°ü,ÐèÖØË¢ÊôÐÔ°ü)
#    #ÖØËãÊôÐÔ
#    playerControl = PlayerControl.PlayerControl(curPlayer)
#    playerControl.RefreshAllState()
#===============================================================================
   
    #ÉèÖÃÍæ¼ÒµÄ¼¼ÄÜCD
    SkillCommon.PlayerChangeMapUpdateSkillCD(curPlayer, tick)
    #³õʼ»¯Íæ¼Ò±³°ü
    InitPlayerPack(curPlayer)
    
    #ÔÚÕâ¸öÀïÃæ»áÖØË¢ËùÓÐÊôÐÔ, ±ØÐëÔÚÕÙ»½ÊÞ³öÏÖǰ×ö, ÕâÑùºÍ×°±¸Ïà¹ØµÄ±»¶¯¼¼ÄܲÅÄÜ×÷ÓÃÔÚÕÙ»½ÊÞÉíÉÏ
    DoPlayerLoginInMap(curPlayer, tick)
    
    #----------±ØÐëÔÚÕâ¸öʱºò×ö, ²»ÄÜÔÚÍæ¼Ò·¢À´µØÍ¼¶ÁÈ¡okµÄʱºò×ö, ·ñÔò, Íæ¼ÒÈç¹û²»·¢À´µØÍ¼¶ÁÈ¡³É¹¦·â°ü, ¾Í²»ÄÜ´´½¨ÕâЩ¶«Î÷ÁË
#    -------------------------------------
#    Íæ¼ÒÇл»µØÍ¼³É¹¦Ö®ºó, 
#    1.ҪˢÐÂGameServerÖÐæô³µµÄMapID
#    2.ҪˢÐÂ×Ô¼ºÕÙ»½ÊÞµÄ״̬
#    ------------------------------------------------------
    #Íæ¼ÒÇл»µØÍ¼³É¹¦, ³õʼ»¯Íæ¼ÒµÄ¸½¼ÓÐÅÏ¢(æô³µ, ÕÙ»½ÊÞ)
    curPlayer.InitChangeMapPlayerSummonInfo()
    
    #---³õʼ»¯×Ô¼ºµÄÕÙ»½ÊÞ---
    #===========================================================================
    # for i in range(curPlayer.GetSummonCount()):
    #    curSummon = curPlayer.GetSummonNPCAt(i)
    #    #³õʼ»¯µ±Ç°ÕÙ»½ÊÞ״̬
    #    SkillCommon.SetSummonNPCProperty(curPlayer, curSummon)
    #    summonControl = NPCCommon.NPCControl(curSummon)
    #    #¸üгðºÞ
    #    summonControl.ClearNPCAngry()                        
    #    #Ë¢ÐÂNPC״̬/buff
    #    summonControl.RefreshNPCState()
    #    #Òòµ±Ç°ÑªÁ¿ÏÈË¢,×î´óѪÁ¿ºóË¢£¬ÓпÉÄܵ±Ç°ÑªÁ¿´óÓÚ×î´óѪÁ¿
    #    GameObj.SetHPFull(curSummon)
    #===========================================================================
    
    #³õʼ»¯³èÎï Í¨Öª¿Í»§¶Ë
    PetControl.Sync_PetInfo_ChangeMap(curPlayer, tick)
 
    #֪ͨGameServer×Ô¼ºÏÖÔڵĵØÍ¼
    #curPlayer.Sync_GameServer_MapID()
    
    #Èç¹û±¾µØÍ¼ÊǸ±±¾µÄ»°, Ôò֪ͨGameServerÍæ¼Ò½øÈ븱±¾
    if GameWorld.GetMap().GetMapFBType() == IPY_GameWorld.fbtTeam:
        curPlayer.GameServer_TeamEnterFB(1)
    else:
        curPlayer.GameServer_TeamEnterFB(0)
 
    #֪ͨÔËÐгɹ¦
    curPlayer.BalanceServer_PlayerChangeMapInitOK()
    #Ëø×¡Íæ¼Ò, µÈµ½¶ÁÈ¡µØÍ¼³É¹¦, ÔÙ½âËø
    curPlayer.SetCanMove(False)
 
#---------------------------------------------------------------------
##³õʼ»¯Íæ¼Ò±³°ü
#@param curPlayer Íæ¼ÒʵÀý
#@return ·µ»ØÖµÎÞÒâÒå
#@remarks ³õʼ»¯Íæ¼Ò±³°ü
def InitPlayerPack(curPlayer) :
    itemManager = curPlayer.GetItemManager()
    
    #³õʼ»¯Íæ¼Ò±³°ü
    PlayerControl.Init_ItemPack(curPlayer)
    
    #³õʼ»¯Íæ¼Ò²Ö¿â
    PlayerControl.Init_Warehouse(curPlayer)
    
    #³õʼ»¯Ñ°±¦±³°ü
    PlayerControl.Init_TreasurePack(curPlayer)
    
    #³õʼ»¯ÉñÊÞÎïÆ·±³°ü
    curPack = curPlayer.GetItemManager().GetPack(ShareDefine.rptDogzItem)
    curPack.SetCount(ItemCommon.GetPackInitCount(ShareDefine.rptDogzItem))
    curPack.Sync_PackCanUseCount()
    #³õʼ»¯ÉñÊÞ×°±¸±³°ü
    curPack = curPlayer.GetItemManager().GetPack(ShareDefine.rptDogzEquip)
    curPack.SetCount(ItemCommon.GetPackInitCount(ShareDefine.rptDogzEquip))
    curPack.Sync_PackCanUseCount()
    #³õʼ»¯À¬»ø·ÖÀà±³°ü
    curPack = itemManager.GetPack(ShareDefine.rptGarbage)
    curPack.SetCount(ItemCommon.GetPackInitCount(ShareDefine.rptGarbage))
    curPack.Sync_PackCanUseCount()
    
    #³õʼ»¯ÁÙʱ½»»»±³°ü
    curPack = itemManager.GetPack(ShareDefine.rptTempSwap)
    curPack.SetCount(ChConfig.Def_PackCnt_TempSwap)
    
    #³õʼ»¯ÁÙʱ´æ·Å±³°ü
    curPack = itemManager.GetPack(ShareDefine.rptTempItem)
    curPack.SetCount(ChConfig.Def_PackCnt_TempItem)
 
    #ÉèÖÃ×°±¸Êµ¼Ê¸öÊý
    curPack = itemManager.GetPack(IPY_GameWorld.rptEquip)
    curPack.SetCount(ItemCommon.GetPackInitCount(IPY_GameWorld.rptEquip))
    
    #³õʼ»¯À¬»øÍ°
    #curPack = itemManager.GetPack(IPY_GameWorld.rptRecycle)
    #curPack.SetCount(ChConfig.Def_PackCnt_Recycle)
        
    #³õʼ»¯ÍòÄܱ³°ü
    curPack = itemManager.GetPack(IPY_GameWorld.rptAnyWhere)
    curPack.SetCount(IPY_GameWorld.Def_AnyWherePackCount)
 
    #³õʼ»¯³èÎï±³°ü
    curPack = itemManager.GetPack(ShareDefine.rptPet)
    curPack.SetCount(ItemCommon.GetPackInitCount(ShareDefine.rptPet))
    #curPack.Sync_PackCanUseCount()
    return
 
#---------------------------------------------------------------------
##ÊÇ·ñÓÐÎÞµÐBuff
#@param curPlayer Íæ¼ÒʵÀý
#@return ·µ»ØÖµÕæ, ÓÐÎÞµÐBuff
#@remarks ×Ô¶¨Ò庯Êý, ÊÇ·ñÓÐÎÞµÐBuff
def __CheckLimitSuperBuff(curPlayer):
    skillID = ChConfig.Def_SkillID_LimitSuperBuff
 
    return CheckHasBuffBySkillID(curPlayer, skillID)
 
 
## ÅжÏÊÇ·ñÓÐij¼¼ÄÜbuff
#  @param curPlayer Íæ¼ÒʵÀý
#  @param skillID 
#  @return ·µ»ØÖµÕæ
def CheckHasBuffBySkillID(curPlayer, skillID):
    buffSkill = GameWorld.GetGameData().GetSkillBySkillID(skillID)
    #Òì³£´íÎó
    if not buffSkill:
        GameWorld.Log("Íæ¼ÒÈ¡Ïûbuffʧ°Ü,Êý¾Ý¿âÎÞ´Ëbuff,buffid = %s " % (skillID) , curPlayer.GetPlayerID())
        return False
 
    buffType = SkillCommon.GetBuffType(buffSkill)
    buffTuple = SkillCommon.GetBuffManagerByBuffType(curPlayer, buffType)
    #ͨ¹ýÀàÐÍ»ñȡĿ±êµÄbuff¹ÜÀíÆ÷Ϊ¿Õ£¬ÔòÌø³ö
    if buffTuple == ():
        return False
    
    buffState = buffTuple[0]
    
    #ÅжÏÊÇ·ñ´æÔÚµÄBUFF
    buffSkillTypeID = buffSkill.GetSkillTypeID()
    curBuff = buffState.FindBuff(buffSkillTypeID)
    
    if not curBuff:
        return False
    
    return True
 
#---------------------------------------------------------------------
##C++·â°ü´¥·¢, Çл»µØÍ¼³É¹¦( Ä¿±êµØÍ¼ )
#@param index Íæ¼ÒË÷Òý
#@param tick Ê±¼ä´Á
#@return ·µ»ØÖµÎÞÒâÒå
#@remarks C++·â°ü´¥·¢, Çл»µØÍ¼³É¹¦( Ä¿±êµØÍ¼ )
def __Func_LoadMapOK(index, tick):
    #ÔÚÍæ¼ÒÇл»³¡¾°/µÇ¼µÄʱºò, »áµ÷Óõ½ÕâÀï, µØÍ¼¶ÁÈ¡³É¹¦
    curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
 
    if curPlayer.GetMapLoadOK():
        #Íæ¼ÒÒѾ­¶ÁÈ¡µØÍ¼OK, ÎÞÐèÔÙ³õʼ»¯
        #GameWorld.Log("Íæ¼ÒÒѾ­¶ÁÈ¡µØÍ¼OK, ÎÞÐèÔÙ³õʼ»¯" , curPlayer.GetPlayerID())
        resetFBLinePosX = curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_ResetFBLinePosX)
        resetFBLinePosY = curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_ResetFBLinePosY)
        if resetFBLinePosX and resetFBLinePosY:
            GameWorld.Log("Íæ¼Ò¸±±¾Öбä¸ü¹¦ÄÜÏß·ÐéÄâÇеØÍ¼³É¹¦!!!", curPlayer.GetPlayerID())
            curPlayer.SetDict(ChConfig.Def_PlayerKey_ResetFBLinePosX, 0)
            curPlayer.SetDict(ChConfig.Def_PlayerKey_ResetFBLinePosY, 0)
            
            #curPlayer.ResetPos(resetFBLinePosX, resetFBLinePosY)
            # »Ö¸´ÊÓÒ°£¬Ë¢ÐÂ×Ô¼ºµÄÊÓÒ°
            curPlayer.SetVisible(True)
            PlayerControl.SetSight(curPlayer, ChConfig.Def_PlayerSight_Default)
            curPlayer.RefreshView()
            
            FBLogic.DoEnterFB(curPlayer, tick)
        return
    
    #¼ì²éGMÕʺÅÊÇ·ñÓÐȨÏ޵ǽ
    #if not __CheckGMCanLoadMapOK(curPlayer):
    #    return
    
    
    #¼ì²âÕ˺ÅÊÇ·ñËø¶¨
    if not __CheckForbidLogin(curPlayer):
        return
    
    GameWorld.Log("µØÍ¼¶ÁÈ¡³É¹¦" , curPlayer.GetPlayerID())
    
    #֪ͨGameServerÇл»µØÍ¼Í£Ö¹
    #curPlayer.GameServer_SetLoadMapState(1)
    curPlayer.SetMapLoadOK(True)
    
    #½«Íæ¼Ò·ÅÖÃÔÚÕâ¸öµØÍ¼ÉÏ
    curPlayer.InitPos(curPlayer.GetPosX(), curPlayer.GetPosY())
    
    #Ë¢ÐÂ×Ô¼ºµÄÊÓÒ°
    if not GameWorld.IsCrossServer() and (PlayerControl.GetCrossMapID(curPlayer) or curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_ClientCustomScene)):
        GameWorld.DebugLog("===±¾·þLoadMapOKÊ±Íæ¼Ò´¦ÓÚ¿ç·þ»ò×Ô¶¨Ò峡¾°×´Ì¬£¬²»ÉèÖÿɼû£¡", curPlayer.GetPlayerID())
        PlayerControl.SetPlayerSightLevel(curPlayer, curPlayer.GetID())
    elif not GameWorld.IsCrossServer():
        realmDifficulty = PlayerControl.GetMapRealmDifficulty(curPlayer)
        if realmDifficulty:
            GameWorld.DebugLog("===±¾·þLoadMapOKÊ±Íæ¼Ò´¦ÓÚ¾³½çÄѶȵØÍ¼£¬×Ô¶¯ÉèÖÃÄѶȣ¡realmDifficulty=%s" % realmDifficulty, curPlayer.GetPlayerID())
            PlayerControl.SetRealmDifficulty(curPlayer, realmDifficulty)
            
    curPlayer.RefreshView()
    curPlayer.SetVisible(True)
        
    #Èç¹ûÍæ¼ÒhpΪ0,ÉèÖÃÍæ¼ÒΪËÀÍö״̬
    if GameObj.GetHP(curPlayer) <= 0:
        curPlayer.SetPlayerAction(IPY_GameWorld.paDie)
        #curPlayer.SetDead()
        
    #°ÑÍæ¼ÒÉèÖÃΪ³õʼ»¯³É¹¦×´Ì¬
    curPlayer.SetInitOK(True)
    
    #===========================================================================
    # #bug:GMºÅ·´ÒþÐÎÔÚÍæ¼ÒÇл»µØÍ¼Ö®ºó,½Å±¾Î´ÉèÖÃÍæ¼ÒÊôÐÔ֮ǰ£¬C++֪ͨºÏ²¢·â°üµ¼Ö¿ͻ§¶ËËÀB
    # #½«·´ÒþÐοªÆô×ªÒÆµ½½Å±¾
    # if curPlayer.GetGMLevel():
    #    curPlayer.SetIsDefVisible(True)
    #===========================================================================
    
    #ÓÐÏÞÎÞµÐBuff
    if not __CheckLimitSuperBuff(curPlayer):
        curPlayer.SetCanAttack(True)
        
    #Èç¹ûÔÚʼþ״̬ , ¾Í²»½â³ýËø¶¨ ÈÎÎñ1ËøËÀÁË
    #if curPlayer.GetPlayerAction() != IPY_GameWorld.paEvent:
    curPlayer.SetCanMove(True)
    
    #ͬ²½¿Í»§¶Ëtick
    #Õâ¸ö·â°üÒªÔÚEndLoadMap, ÉÏÂí֮ǰ·¢, ·ñÔò¿Í»§¶Ë´¦Àíʱ»ú²»¶Ô(¿Í»§¶Ë·â°ü»º´æ»úÖÆ)
    #curPlayer.Sync_ClientTick()
    
    #×öÉÏÒ»¸öµØÍ¼µÄÉÏÂí/æô³µÂß¼­
    #»Ö¸´×Ô¼ºµÄ״̬
    playerVehicle = curPlayer.GetLastMapPlayerVehicle()
    if playerVehicle == IPY_GameWorld.pvHorse:
        #Íæ¼ÒÔÚÆïÂíÖÐ
        if not PlayerHorse.PlayerRideHorseUp(curPlayer, False, False):
        #=======================================================================
        #    playerHorseState = curPlayer.GetLastMapPlayerRidehorseState()
        #    if playerHorseState != IPY_GameWorld.prsNormal:
        #        #Çл»µØÍ¼, »Ö¸´¼±ÐÐ״̬
        #        curPlayer.SetPlayerRidehorseState(playerHorseState)
        #        
        #    #Ë¢ÐÂÈËÎïÊôÐÔ ËùÓÐ״̬
        #    playerControl = PlayerControl.PlayerControl(curPlayer)
        #    playerControl.RefreshAllState()
        # else:
        #=======================================================================
            #´ËʱÒѾ­ÊÇÏÂÂí״̬²»ÐèҪˢ״̬ µ«ÊÇÐèҪ֪ͨ¿Í»§¶ËÏÂÂí
            PlayerHorse.PlayerRideHorseDown(curPlayer, False)
        
    PlayerTeam.PlayerLoginSetTeam(curPlayer, tick)
    
    #¼¤»îÍæ¼Ò(±£Ö¤³ÖÐøÐÔBuff´¦Àí¼ä¸ô)
    PlayerControl.SetIsNeedProcess(curPlayer, True)
 
    #³õʼ»¯GM²Ù×÷
    PlayerGMOper.DoGMOperLogic(curPlayer, tick)
    
    #Èç¹ûµÇ¼µÄ¸±±¾,Ö´ÐнøÈ븱±¾Âß¼­, ÒòΪÓÐʱ¼äÏìÓ¦, ±ØÐëÔÚEndLoadMapÖ®ºó...
    FBLogic.DoEnterFBLogic(curPlayer, tick)
    
    #´¥·¢Çл»µØÍ¼³èÎïÂß¼­
    PetControl.DoLogic_PetLoadMapOK(curPlayer)
 
    #---¼ì²éÊÇ·ñ¿¨Õϰ­---
    curMap = GameWorld.GetMap()
    posX = curPlayer.GetPosX()
    posY = curPlayer.GetPosY()
    
    # ¸´»îËæ»úλÖÃ
    if curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_IsReBorn):
        if curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_IsReBorn) == 2:
            PlayerControl.PlayerControl(curPlayer).SetToBornPlace()
        else:
            posX, posY = GameMap.GetNearbyPosByDis(posX, posY, ChConfig.Def_RebornPos_Area_Range)
            curPlayer.ResetPos(posX, posY)
            
        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_IsReBorn, 0)
    
    if GameObj.GetHP(curPlayer) <= 0 or curPlayer.GetPlayerAction() == IPY_GameWorld.paDie:
        #Èç¹ûÍæ¼ÒÉÏÏߺóËÀÍö,»Ø³Ì¸´»î
        isLogin = curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_LoadMapIsLogin)
        rebornType = ChConfig.rebornType_City if isLogin else ChConfig.rebornType_System
        if GameWorld.IsCrossServer():
            rebornType  = ChConfig.rebornType_System
        PlayerRebornByType(curPlayer, rebornType, tick)
        
    elif curMap.CanMove(posX, posY) != True:
        nearPosX, nearPosY = GameMap.GetNearbyPosByDis(posX, posY, ChConfig.Def_RebornPos_Area_Range)
        if nearPosX == 0 and nearPosY == 0:
            GameWorld.Log('Íæ¼ÒµÇÂ¼ÖØÖÃλÖÃʧ°Ü, °ÑÍæ¼Ò´ò»ØÖØÉúµã posX = %s posY = %s' % (posX, posY) , curPlayer.GetPlayerID())
            playerControl = PlayerControl.PlayerControl(curPlayer)
            playerControl.SetToBornPlace()
        else:
            curPlayer.ResetPos(nearPosX, nearPosY)
            GameWorld.Log('Íæ¼ÒµÇÂ¼ÖØÖÃλÖÃʧ°Ü, ÉèÖø½½üµã nearPosX = %s nearPosY = %s' % (nearPosX, nearPosY) , curPlayer.GetPlayerID())
 
    #ÉêÇëµÃµ½½±ÀøÎïÆ·
    #curPlayer.DataServer_CheckPrizeItem()
    
    #·ÀÖ¹Íæ¼Ò¶ÁÈ¡µØÍ¼Ê±Î´´¥·¢OnDay£¬¶ÁÈ¡µØÍ¼ºóÔÙ´ÎÑéÖ¤(2009.9.11)
    PlayerEventCounter.UpdatePlayerLoginTime(curPlayer)
    
    #ÉèÖÃÕóÓª
    if curPlayer.GetFaction() != ChConfig.CampType_Neutral \
                and FBCommon.GetRecordMapID(GameWorld.GetMap().GetMapID()) not in ChConfig.Def_MapID_NeedCamp:
        #ÖØÖÃÕóÓª
        curPlayer.SetFaction(ChConfig.CampType_Neutral)
        BuffSkill.DelBuffBySkillID(curPlayer, ChConfig.Def_SkillID_Justice, tick)
        BuffSkill.DelBuffBySkillID(curPlayer, ChConfig.Def_SkillID_Evil, tick)
    
    
    #ÔÙ´ÎÇëÇóË«±¶¾­ÑéÊÇ·ñÁìÈ¡
    #PlayerDoubleExpSys.ChangeMapAfter_CalcDoubleExpTime(curPlayer, tick)
    
    #PlayerVip.SetStartCalcVIPTick(curPlayer, tick)
    
    #Ç¿ÖÆÇл»PKģʽ
    initAttackModel = curMap.GetInitAttackModel()
    if curPlayer.GetAttackMode() != initAttackModel:
        curPlayer.SetAttackMode(initAttackModel)
        SyncPKModel(curPlayer)
        GameWorld.DebugLog("½øÈëµØÍ¼Ç¿ÖÆÇл»PKģʽ: %s" % initAttackModel)
    
    PassiveBuffEffMng.OnLoadMapGFPassive(curPlayer)
    PlayerYinji.OnLoadMap(curPlayer)
    ItemControler.PlayerItemControler(curPlayer).RefreshStartEquipCount()   # Ë¢ÐÂ×°±¸Õ䯷ÐǼ¶
    
    #EndLoadMapÐè·ÅÔÚ×îºó, 0403 tagPlayerLoginLoadOK
    curPlayer.EndLoadMap()
    return True
 
## Çл»µØÍ¼Í¬²½Ò»´ÎPKģʽ
#  @param curPlayer
#  @return None
def SyncPKModel(curPlayer):
    # Í¬²½¿Í»§¶ËPKģʽ
    sendPack = ChPyNetSendPack.tagMCAttackMode()
    sendPack.Clear()
    sendPack.Mode = curPlayer.GetAttackMode()
    NetPackCommon.SendFakePack(curPlayer, sendPack)
    return
 
#---------------------------------------------------------------------
##¼ì²éGMÊÇ·ñ¿ÉÒԵǽµØÍ¼
#@param curPlayer Íæ¼ÒʵÀý
#@return ·µ»ØÖµÕæ, ¿ÉÒԵǽ
#@remarks ¼ì²éGMÊÇ·ñ¿ÉÒԵǽµØÍ¼
def __CheckGMCanLoadMapOK(curPlayer):
    return True
#    if not curPlayer.GetGMLevel() :
#        #²»ÊÇGM, ¿ÉÒԵǽ
#        return True
#    
#    curPlayerIP = curPlayer.GetIP()
#    
#    if curPlayerIP.find('192.168.') == 0 or curPlayerIP.find('10.30.') == 0:
#        GameWorld.Log('ÄÚÍøGM = %s , %s IP = %s,µÇ½µØÍ¼·þÎñÆ÷, ²»ÑéÖ¤IP' % (curPlayer.GetID() , curPlayer.GetName() , curPlayerIP))
#        return True
#          
#    #GM, IPÑéÖ¤²»Í¨¹ý
#    if not curPlayer.IsPlayerInPermitIP():
#        curPlayer.Kick(IPY_GameWorld.disIPNotPermit)
#        return
#    
#    #IPÑé֤ͨ¹ý
#    return True
 
 
## ¼ì²âÕ˺ÅÊÇ·ñËø¶¨
#@param curPlayer Íæ¼ÒʵÀý
#@return ÊÇ·ñËø¶¨
def __CheckForbidLogin(curPlayer):
    
    if (curPlayer.GetAccState() & pow(2, ChConfig.Def_PysForbidByPy)) <= 0:
        return True
    
    curPlayer.Kick(IPY_GameWorld.disGMKick)
    return
 
#// B2 06 Íæ¼Ò¼Óµã #tagCMAddPoint
#
#struct    tagCMAddPoint
#{
#    tagHead         Head;
#    BYTE        PointAttrIDCount;    // ¼ÓµãÊôÐÔID¸öÊý
#    BYTE        PointAttrIDList[PointAttrIDCount];    // ¼ÓµãÊôÐÔIDÁбí
#    WORD        PointValueList[PointAttrIDCount];    // ¼ÓµãÊôÐÔID¶ÔÓ¦µÄµãÊýÁбí
#};
def OnAddPoint(index, clientData, tick):
    curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
    pointAttrIDList = clientData.PointAttrIDList
    pointValueList = clientData.PointValueList
    if not pointAttrIDList or not pointValueList or len(pointAttrIDList) != len(pointValueList):
        return
    
    needTotalPoint = 0
    for i, attrID in enumerate(pointAttrIDList):
        if not IpyGameDataPY.GetIpyGameData("RolePoint", attrID):
            return
        needTotalPoint += pointValueList[i]
        
    curFreePoint = curPlayer.GetFreePoint()
    if needTotalPoint > curFreePoint:
        GameWorld.DebugLog("Ê£ÓàµãÊý²»×ã! curFreePoint(%s) < needTotalPoint(%s)" % (curFreePoint, needTotalPoint))
        return
    
    curPlayer.SetFreePoint(curFreePoint - needTotalPoint)
    for i, attrID in enumerate(pointAttrIDList):
        addPoint = pointValueList[i]
        curPoint = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_AddPointValue % attrID)
        updPoint = curPoint + addPoint
        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_AddPointValue % attrID, updPoint)
        GameWorld.DebugLog("Íæ¼Ò¼Óµã: attrID=%s,curPoint=%s,addPoint=%s,updPoint=%s" % (attrID, curPoint, addPoint, updPoint))
        
    NotifyPlayerBasePoint(curPlayer, pointAttrIDList)
    playerControl = PlayerControl.PlayerControl(curPlayer)
    playerControl.RefreshPlayerAttrState()
    PlayerControl.SetLingGenMaxIndex(curPlayer)
    return
 
#// B2 07 ÖØÖüӵã #tagCMResetAttrPoint
#struct    tagCMResetAttrPoint
#{
#    tagHead         Head;
#};
def OnResetAttrPoint(index, clientData, tick):
    curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
    ipyDataMgr = IpyGameDataPY.IPY_Data()
    canResetIDList = [ipyDataMgr.GetRolePointByIndex(index).GetAttrID() for index in xrange(ipyDataMgr.GetRolePointCount())]
    canReset = False
    for attrID in canResetIDList:
        curPoint = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_AddPointValue % attrID)
        if curPoint:
            canReset = True
            break
    if not canReset:
        GameWorld.DebugLog('ÖØÖüӵã Ã»ÓеãÊýÐèÒªÖØÖÃ')
        return
    isFree = curPlayer.GetLV() < IpyGameDataPY.GetFuncCfg('LVUPAddPoint', 4)
    if not isFree:
        #ÓÅÏÈʹÓÃÊ£Óàʱ¼ä×î¶ÌµÄʱЧÎïÆ·
        needItemIDList = IpyGameDataPY.GetFuncEvalCfg('LVUPAddPoint', 5)
        itemPack = curPlayer.GetItemManager().GetPack(IPY_GameWorld.rptItem)
        delIndex = -1
        expireTime = 0
        for itemID in needItemIDList:
            hasEnough, itemIndexList = ItemCommon.GetItem_FromPack_ByID(itemID, itemPack, 10)
            if not itemIndexList:
                #GameWorld.DebugLog("ÖØÖüӵã item(%s) isn't enough" % (needItemID))
                continue
            
            for itemIndex in itemIndexList:
                curItem = itemPack.GetAt(itemIndex)
                if not ItemCommon.CheckItemCanUse(curItem):
                    continue
                isExpireItem, remainingTime = ItemCommon.GetItemRemainingTime(curItem)
                if isExpireItem:
                    if remainingTime <= 0:
                        #¹ýÆÚ
                        continue
                    if not expireTime or remainingTime < expireTime:
                        expireTime = remainingTime
                        delIndex = itemIndex
                else:
                    delIndex = itemIndex
                    break
            if delIndex != -1:
                break
        if delIndex is -1:
            return
        ItemCommon.ReduceItem(curPlayer, itemPack, [delIndex], 1, False, ChConfig.ItemDel_ResetAttrPoint)
    
    Item_ResetAttrPoint.DoResetAttrPoint(curPlayer, 0, 0, 0)
    return
 
def NotifyPlayerBasePoint(curPlayer, syncAttrIDList=[]):
    # Í¨Öª»ù´¡ÊôÐԵ㣬ÒÑ·ÖÅäµÄ×ÔÓɵãÊý
    
    if not syncAttrIDList:
        ipyDataMgr = IpyGameDataPY.IPY_Data()
        syncAttrIDList = [ipyDataMgr.GetRolePointByIndex(index).GetAttrID() for index in xrange(ipyDataMgr.GetRolePointCount())]
        
    pointAttrIDList = []
    pointValueList = []
    for attrID in syncAttrIDList:
        curPoint = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_AddPointValue % attrID)
        pointAttrIDList.append(attrID)
        pointValueList.append(curPoint)
        
    pointInfo = ChPyNetSendPack.tagMCRolePointInfo()
    pointInfo.PointAttrIDList = pointAttrIDList
    pointInfo.PointValueList = pointValueList
    pointInfo.PointAttrIDCount = len(pointAttrIDList)
    NetPackCommon.SendFakePack(curPlayer, pointInfo)
    return
 
#===============================================================================
# //B4 14 ¸ù¾ÝÀàÐÍÀ´¾ö¶¨Òƶ¯µÄ·½Ê½ #tagMCMoveByType
# struct    tagMCMoveByType
# {
#    tagHead        Head;
#    DWORD        ID;    //Íæ¼ÒID
#    WORD        PosX;    // Ä¿±êX
#    WORD        PosY;    // Ä¿±êY
#    BYTE        MoveType;    //ÒÆ¶¯·½Ê½
# };
#===============================================================================
def OnMoveByType(index, clientData, tick):
    curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
    
    #Íæ¼ÒÒÆ¶¯Í¨Óüì²é
    if not __CheckPlayerCanMove(curPlayer):
        return
    
    #ÏÈÑé֤Ŀ±êµãÊÇ·ñºÏ·¨
    if not GameWorld.GetMap().CanMove(clientData.PosX, clientData.PosY):
        return
    
    curPlayer.StopMove()
    curPlayer.ChangePos(clientData.PosX, clientData.PosY)
    sendPack = ChPyNetSendPack.tagMCMoveByType()
    sendPack.Clear()
    sendPack.ID = curPlayer.GetID()
    sendPack.ObjType = curPlayer.GetGameObjType()
    sendPack.PosX = clientData.PosX
    sendPack.PosY = clientData.PosY
    sendPack.MoveType = clientData.MoveType
    
    PlayerControl.PyNotifyAll(curPlayer, sendPack, False, -1)
    return
 
#===============================================================================
# //B4 04 Õ½Ç°³å·æ #tagCMRush
# struct    tagCMRush
# {
#    tagHead        Head;
#    DWORD        ObjID;    //·ÇÅä±íNPCID£¬Ä¿Ç°Ö»Ö§³ÖNPC
#    BYTE        PosX;    // Ä¿±êX
#    BYTE        PosY;    // Ä¿±êY
# };
#===============================================================================
# Óë¿Í»§¶ËÔ¼¶¨³å·æµ½Ä¿±êºó·¢°ü Óë¼¼Äܳ巿²»Í¬
def OnPlayerRush(index, clientData, tick):
    curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
    if tick - curPlayer.GetTickByType(ChConfig.TYPE_Player_Tick_Rush) <= ChConfig.TYPE_Player_Tick_Time[ChConfig.TYPE_Player_Tick_Rush]:
        return
    
    curPlayer.SetTickByType(ChConfig.TYPE_Player_Tick_Rush, tick)
    
    #ÎÞ·¨Ñé֤Ŀ±ê
    #===========================================================================
    # curTag = GameWorld.GetObj(clientData.ObjID, IPY_GameWorld.gotNPC)
    # if not curTag or GameObj.GetHP(curTag) ==0:
    #    return
    # 
    # #ÓëÄ¿±êÏà²î̫Զ
    # if GameWorld.GetDist(curTag.GetPosX(), curTag.GetPosY(), clientData.PosX, clientData.PosY) > 6:
    #    return
    #===========================================================================
    
    #³¬³öÊÓÒ°£¬ºó¶Ë²»ÑéÖ¤£¬Ç°¶ËÑéÖ¤¼´¿É£¬·ÀÖ¹±»À­»Ø
    #if curPlayer.GetSight() and GameWorld.GetDist(curPlayer.GetPosX(), curPlayer.GetPosY(), clientData.PosX, clientData.PosY) > curPlayer.GetSight():
    #    return
    
    #Íæ¼ÒÒÆ¶¯Í¨Óüì²é
    if not __CheckPlayerCanMove(curPlayer):
        return
    
    #ÏÈÑé֤Ŀ±êµãÊÇ·ñºÏ·¨
    if not GameWorld.GetMap().CanMove(clientData.PosX, clientData.PosY):
        return
    
    curPlayer.StopMove()
    #GameWorld.DebugLog("սǰ³å·æ %s %s"%([curPlayer.GetPosX(), curPlayer.GetPosY()], [clientData.PosX, clientData.PosY]))
    curPlayer.ChangePos(clientData.PosX, clientData.PosY)
    sendPack = ChPyNetSendPack.tagMCRush()
    sendPack.Clear()
    sendPack.ID = curPlayer.GetID()
    sendPack.ObjType = curPlayer.GetGameObjType()
    sendPack.PosX = clientData.PosX
    sendPack.PosY = clientData.PosY
    
    PlayerControl.PyNotifyAll(curPlayer, sendPack, False, -1)
    return
 
 
#===============================================================================
# //B4 06 Õ½¶·Òƶ¯ # tagCMFightMove
# struct    tagCMFightMove
# {
#    tagHead        Head;
#    WORD        StartX;
#    WORD        StartY;
#    WORD        DestX;
#    WORD        DestY;
#    DWORD        WorldTick;
# };
#===============================================================================
# ÓëÒÆ¶¯µÄÇø±ðÔÚÓÚ²»¹ã²¥
def PlayerFightMove(index, clientData, tick):
    curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
    
    #·ÀÍâ¹Ò ²»¿ÉÒÆ¶¯
    if curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_AutoCheckHack_State) \
                                      == ChConfig.Def_AutoCheck_State_Danger:
        return
    
    
    #²»¿ÉÒÆ¶¯ÐÐΪ״̬, ÅжϿͻ§¶ËÏÞÖÆ
    if not OperControlManager.IsObjCanDoAction(
                                        curPlayer,
                                        ChConfig.Def_Obj_ActState_ServerAct,
                                        IPY_GameWorld.oalMove
                                        ):
        return False
    
    #Íæ¼ÒÒÆ¶¯Í¨Óüì²é
    if not __CheckPlayerCanMove(curPlayer):
        return
    
    #·â°ü²ÎÊý
    sendPack_StartX = clientData.StartX
    sendPack_StartY = clientData.StartY
    sendPack_DestX = clientData.DestX
    sendPack_DestY = clientData.DestY
    sendPack_WorldTick = clientData.WorldTick
 
    #Ïàͬµã²»Òƶ¯
    if (sendPack_StartX == sendPack_DestX) and (sendPack_StartY == sendPack_DestY):
        #GameWorld.ErrLog('PlayerMove Ïàͬµã²»Òƶ¯', curPlayer.GetID())
        return
    
    #ÏÈÑé֤Ŀ±êµãÊÇ·ñºÏ·¨
    if not GameWorld.GetMap().CanMove(sendPack_DestX, sendPack_DestY):
        curPlayer.ResetPos(curPlayer.GetPosX(), curPlayer.GetPosY())
        return
    
    if tick - curPlayer.GetDictByKey("FightMoveTick") < 50:
        #curPlayer.ResetPos(curPlayer.GetPosX(), curPlayer.GetPosY())
        return
    curPlayer.SetDict("FightMoveTick", tick)
    
    #---Õý³£Òƶ¯---
    vehicle = curPlayer.GetPlayerVehicle()
    
    if vehicle not in [IPY_GameWorld.pvNull, IPY_GameWorld.pvHorse]:
        #GameWorld.ErrLog("²»ÄÜÒÆ¶¯, ½»Í¨¹¤¾ß²»Ã÷ %d" % (vehicle), curPlayer.GetID())
        return
 
    curMap = GameWorld.GetMap()
    #УÑé¿Í»§¶Ëʱ¼ä
    #if not PlayerControl.PlayerMoveCheckClientWorldTick(curPlayer, sendPack_WorldTick, sendPack_StartX, sendPack_StartY):
    #    return
    
    #ÒÆ¶¯µã¼ì²é
    if not CheckMovePos(curPlayer, curPlayer, curMap, sendPack_StartX, sendPack_StartY, sendPack_DestX, sendPack_DestY):
        return
    
    if GameWorld.GetDist(sendPack_StartX, sendPack_StartY, sendPack_DestX, sendPack_DestY) > 20:
        curPlayer.ResetPos(curPlayer.GetPosX(), curPlayer.GetPosY())
        return
    
    #ɾ³ýÓÐÏÞÎÞµÐBUFF
    PlayerControl.DelLimitSuperBuff(curPlayer, tick)
    
    curPlayer.ChangePos(sendPack_DestX, sendPack_DestY)
    #curPlayer.SetClientMoveTick(sendPack_WorldTick)
    
    fightPet = curPlayer.GetPetMgr().GetFightPet()
    #ÎÞ³öÕ½³èÎï
    if fightPet == None:
        return
    
    if GameWorld.GetDist(fightPet.GetPosX(), fightPet.GetPosY(), sendPack_DestX, sendPack_DestY) <= 4:
        #Õ½¶·Öв»Æµ·±Òƶ¯
        return
 
    #³öÕ½³èÎïÍ¬Ê±ÒÆ¶¯
    PetControl.FightPetFollowMove(curPlayer, sendPack_StartX, sendPack_StartY)
    
    
    return
 
#---------------------------------------------------------------------
##ÑéÖ¤Íæ¼ÒÊÇ·ñ¿ÉÒÔÒÆ¶¯.
# @param curPlayer Íæ¼ÒʵÀý
# @return ²¼¶ûÖµ
# @remarks ¿Í»§¶Ë·â°üÏìÓ¦
def __CheckPlayerCanMove(curPlayer):
    if not curPlayer.GetMapLoadOK():
        #Íæ¼ÒµØÍ¼¶Áȡδ³É¹¦, Ìß³öÕâÈË
        #curPlayer.Kick(IPY_GameWorld.disPlayerMovedWhenNotPrepare)
        return False
    
    #Ëø¶¨²»¿ÉÒÆ¶¯
    if not curPlayer.GetCanMove():
        return False
    
    #Íæ¼ÒÒѾ­ËÀÍö
    if GameObj.GetHP(curPlayer) <= 0:
        return False
    
#    #Ñ£ÔÎʱ£¬²»¿ÉÒÆ¶¯ zhengyang 2010-6-2
#    if curPlayer.GetAbnormalState() == IPY_GameWorld.sctFaint:
#        return False
    
    #²»¿ÉÒÆ¶¯ÐÐΪ״̬, ÅжϷþÎñ¶ËÏÞÖÆ
    if not OperControlManager.IsObjCanDoAction(
                                        curPlayer,
                                        ChConfig.Def_Obj_ActState_ServerAct,
                                        IPY_GameWorld.oalMove
                                        ):
        return False
    
    #Íæ¼ÒͨÓõÄ״̬ת»»¼ì²é
    if not PlayerControl.PlayerCanStateTransfer(curPlayer):
        return False
    
    return True
 
 
#---------------------------------------------------------------------
##Íæ¼ÒÆÕÍ¨ÒÆ¶¯
#@param curPlayer Íæ¼ÒʵÀý
#@param client_StartX ¿Í»§¶ËÆðµãX
#@param client_StartX ¿Í»§¶ËÆðµãY
#@param client_DestX ¿Í»§¶ËÄ¿±êµãX
#@param client_DestY ¿Í»§¶ËÄ¿±êµãY
#@param tick Ê±¼ä
#@return ·µ»ØÖµÎÞÒâÒå
#@remarks Íæ¼ÒÆÕÍ¨ÒÆ¶¯
def PlayerNormalMove(curPlayer, client_StartX, client_StartY, client_DestX,
                     client_DestY, clientWorldTick, tick) :
    # ·ÏÆú¸Ä³ÉPYÒÆ¶¯
    return
    curMap = GameWorld.GetMap()
    #УÑé¿Í»§¶Ëʱ¼ä
    if not PlayerControl.PlayerMoveCheckClientWorldTick(curPlayer, clientWorldTick, client_StartX, client_StartY):
        curPlayer.Sync_ClientTick()
        return
    
    #ÒÆ¶¯µã¼ì²é
    if not CheckMovePos(curPlayer, curPlayer, curMap, client_StartX, client_StartY, client_DestX, client_DestY):
        return
    
    #2010/04/30 Òƶ¯ÐÞ¸ÄΪȫC++¿ØÖÆ, Python״̬»úÉèÖÃΪ¿ÕÏÐ(Çå¿Õ²É¼¯µÈ״̬)
    PlayerControl.ChangePlayerAction(curPlayer, IPY_GameWorld.paNull)
    #ɾ³ýÓÐÏÞÎÞµÐBUFF
    #PlayerControl.DelLimitSuperBuff(curPlayer, tick)
    
    #GameWorld.DebugLog("ÒÆ¶¯Ç°-----Íæ¼Ò×ø±ê %s-%s  Ä¿µÄµØ%s -%s"%(curPlayer.GetPosX(), curPlayer.GetPosY(), client_DestX, client_DestY))
    # ÔÚUpdatePos µ÷Óüä¸ôÄÚ¶à´Îµ÷ÓÃmove»áʹ m_StartMoveTick ÖØÖ㬵¼ÖÂÎÞ·¨Òƶ¯
    # ¶øÔÚ CheckMovePos -> PlayerRefreshPos -> __FixPlayerPos -> ChangePos Ôì³ÉÒÆ¶¯µÄÏÖÏó
    curPlayer.Move(client_DestX, client_DestY)
 
    #³öÕ½³èÎïÍ¬Ê±ÒÆ¶¯
    #PetControl.FightPetFollowMove(curPlayer, client_DestX, client_DestY, client_StartX, client_StartY)
    return
 
##ÒÆ¶¯µã¼ì²é, checkObj ÊÇÒÆ¶¯¶ÔÏó(ÔÚÈËïÚºÏһ״̬ÏÂ, ÊäÈëΪæô³µ
#@param curPlayer Íæ¼ÒʵÀý
#@param checkObj Òƶ¯¶ÔÏó
#@param curMap µ±Ç°µØÍ¼
#@param startX ¿ªÊ¼Òƶ¯×ø±êX
#@param startY ¿ªÊ¼Òƶ¯×ø±êY
#@param destX Òƶ¯Ä¿±êX
#@param destY Òƶ¯Ä¿±êY
#@param sendPlayerMoveFail ÊÇ·ñ·¢ËÍÒÆ¶¯Ê§°Ü
#@return ·µ»ØÖµÕæ, ¼ì²é³É¹¦
#@remarks Òƶ¯µã¼ì²é, checkObj ÊÇÒÆ¶¯¶ÔÏó(ÔÚÈËïÚºÏһ״̬ÏÂ, ÊäÈëΪæô³µ
def CheckMovePos(curPlayer, checkObj, curMap, startX, startY, destX, destY, sendPlayerMoveFail=True):
    #Æðʼµã,Ä¿±êµã
    #Ë¢ÐÂÍæ¼Òµ±Ç°Î»ÖÃ
    if not PlayerControl.PlayerRefreshPos(curPlayer, checkObj, startX, startY):
        #Íæ¼Òµ±Ç°Î»ÖÃË¢ÐÂʧ°Ü
        #GameWorld.Log("Íæ¼Òµ±Ç°Î»ÖÃË¢ÐÂʧ°Ü" , curPlayer.GetPlayerID())
        if sendPlayerMoveFail and curPlayer.GetID() == checkObj.GetID():
            #Ô˶¯ÕßÊÇÍæ¼Ò, ÄÇÃ´ÖØÖÃÍæ¼ÒλÖÃ
            curPlayer.ResetPos(curPlayer.GetPosX(), curPlayer.GetPosY())
            
        return False
    
    #µ±Ç°¶ÔÏó×ø±ê
    objPosX = checkObj.GetPosX()
    objPosY = checkObj.GetPosY()
    
    #Ä¿µÄµØÊÇ·ñ¿ÉÒÔµ½´ï
    if not curMap.CanMove(destX, destY):
        #µØ·½²»¿É×ß, ÖØÖÃÍæ¼ÒµÄλÖÃ
        #GameWorld.Log("µØ·½²»¿É×ß, ÖØÖÃÍæ¼ÒµÄλÖÃ" , curPlayer.GetPlayerID())
        if sendPlayerMoveFail:
            curPlayer.MoveFail()
            
        return False
        
    #¼ì²éÍæ¼ÒÒÆ¶¯¾àÀëÊÇ·ñ¹ýÔ¶
    moveDist = GameWorld.GetDist(objPosX, objPosY, destX, destY)
    if moveDist > ChConfig.Def_PlayerMaxMoveDist:
        #GameWorld.Log("ÒÆ¶¯Ê§°Ü£¬¼ì²éÍæ¼ÒÒÆ¶¯¾àÀëÊÇ·ñ¹ýÔ¶" , curPlayer.GetPlayerID())
        if sendPlayerMoveFail:
            curPlayer.MoveFail()
            
        return False
    
    return True
 
#===============================================================================
# //03 05Ö÷½Çµã»÷¸´»î#tagCCliectReborn
# tagCCliectReborn       *   GettagCCliectReborn();
# class   IPY_CCliectReborn
# {
# public:
#    int      GetType();
#    //0: ÒøÆ± 1:Òø×Ó
#    int      GetMoneyType();
# };
#===============================================================================
##¿Í»§¶Ë·â°üÏìÓ¦ //03 05Ö÷½Çµã»÷¸´»î#tagCCliectReborn
#@param index Íæ¼ÒË÷Òý
#@param tick Ê±¼ä´Á
#@return ·µ»ØÖµÎÞÒâÒå
#@remarks ¿Í»§¶Ë·â°üÏìÓ¦ //03 05Ö÷½Çµã»÷¸´»î#tagCCliectReborn
def PlayerClickReborn(index, tick):
    #Íæ¼Òµã»÷: ÖØÉú
    curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
    
    #¸ù¾ÝÍæ¼ÒÑ¡ÔñÖØÉúÑ¡ÏîÖØÉú
    sendPack = IPY_GameWorld.IPY_CCliectReborn()
    #¸´»îÀàÐÍ
    rebornType = sendPack.GetType()
    GameWorld.DebugLog("Íæ¼Òµã»÷¸´»î: rebornType=%s" % rebornType, curPlayer.GetPlayerID())
    
    if GameWorld.IsCrossServer():
        GameWorld.DebugLog("¿ç·þ·þÎñÆ÷²»½ÓÊܸ´»îÇëÇó!")
        return
    
    if PlayerControl.GetCrossMapID(curPlayer):
        OnReqCrossServerReborn(curPlayer, rebornType)
        return
    
    #FBÖнûÖ¹¸´»î
    if FBLogic.DoFBForbidReborn(curPlayer, rebornType):
        PlayerControl.NotifyCode(curPlayer, "Reborn_lhs_31379")
        return
    
    #Íæ¼Ò¸´»î
    if PlayerRebornByType(curPlayer, rebornType, tick):
        #Íæ¼Ò¸´»î³É¹¦,ÅжÏÊÇ·ñÔÚ¸±±¾Öи´»î
        PlayerReborn_InFB(curPlayer, rebornType, tick)
        
    return
 
def OnReqCrossServerReborn(curPlayer, rebornType):
    ## ÇëÇó¿ç·þ·þÎñÆ÷¸´»îÍæ¼Ò
    
    crossMapID = PlayerControl.GetCrossMapID(curPlayer)
    if not crossMapID:
        GameWorld.DebugLog("µ±Ç°ÎÞ¿ç·þµØÍ¼!")
        return
    
    if not __CheckCanReborn(curPlayer, rebornType, checkHPState=False):
        return
    
    msgDict = {"PlayerID":curPlayer.GetPlayerID(), "RebornType":rebornType}
    GameWorld.SendMsgToCrossServer(ShareDefine.ClientServerMsg_Reborn, msgDict)
    GameWorld.DebugLog("¿ç·þÖÐÇëÇó¸´»î, crossMapID=%s,msgDict=%s" % (crossMapID, msgDict), curPlayer.GetPlayerID())
    return
 
def ClientServerMsg_Reborn(curPlayer, msgData, serverGroupID, tick):
    ## ÊÕµ½×Ó·þÇëÇó¸´»îÐÅÏ¢
    
    rebornType = msgData["RebornType"]
    gameMap = GameWorld.GetMap()
    if not __CheckCanReborn(curPlayer, rebornType, gameMap):
        return
    
    isAddReviveTired = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_IsAddReviveTired)
    # ¿ç·þ·þÎñÆ÷²»Ö´ÐÐÏûºÄ£¬¸´»îºóͬ²½ÏûÏ¢»ØÖ÷·þ¿Û³ýÏûºÄ
    __DoPlayerReborn(curPlayer, rebornType, tick)
    
    # ·¢Ëͻر¾·þ¸´»î½á¹û
    msgInfo = {"Result":1, "ReviveTired":isAddReviveTired}
    msgInfo.update(msgData)
    GameWorld.SendMsgToClientServer(ShareDefine.CrossServerMsg_RebornRet, msgInfo, [serverGroupID])
    return
 
def CrossServerMsg_RebornRet(curPlayer, msgData, tick):
    ## ÊÕµ½¿ç·þ·þÎñÆ÷¸´»î½á¹û
    
    result = msgData["Result"]
    if result != 1:
        return
    
    rebornType = msgData["RebornType"]
    isAddReviveTired = msgData["ReviveTired"]
    __RebornCost(curPlayer, rebornType, True)
    
    if isAddReviveTired:
        __AddReviveTired(curPlayer, tick)
        
    return
 
def SyncPlayerReborn(curPlayer, rebornType):
    rebornInfo = ChNetSendPack.tagPlayerReborn()
    rebornInfo.Clear()
    rebornInfo.PlayerID = curPlayer.GetPlayerID()
    rebornInfo.Type = rebornType
    rebornInfo.PosX = curPlayer.GetPosX()
    rebornInfo.PosY = curPlayer.GetPosY()
    NetPackCommon.SendFakePack(curPlayer, rebornInfo)    
    return
 
#---------------------------------------------------------------------
##C++·â°ü´¥·¢, Íæ¼ÒÏÂÏß
#@param index Íæ¼ÒË÷Òý
#@param tick Ê±¼ä´Á
#@return ·µ»ØÖµÎÞÒâÒå
#@remarks C++·â°ü´¥·¢, Íæ¼ÒÏÂÏß
def PlayerDisconnect(index, tick):
    GameWorld.GetPsycoFunc(__Func_PlayerDisconnect)(index, tick)
    return
 
##C++·â°ü´¥·¢, Íæ¼ÒÏÂÏß
#@param index Íæ¼ÒË÷Òý
#@param tick Ê±¼ä´Á
#@return ·µ»ØÖµÎÞÒâÒå
#@remarks C++·â°ü´¥·¢, Íæ¼ÒÏÂÏß
def __Func_PlayerDisconnect(index, tick):
    curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
    try:
        # ±ÜÃâÒòÂß¼­´íÎóµ¼ÖÂÏÂÏßʧ°Ü£¬¿ÉÄܵ¼Ö»صµµÄÇé¿ö
        DoPlayerDisconnect(curPlayer, tick)
    except:
        import traceback
        GameWorld.RaiseException("Íæ¼ÒÏÂÏßÂß¼­´íÎó\r\n%s" % traceback.format_exc())
    RecvPackToMapDB.MapCallDB(GetPackSaveData(curPlayer))
    #µ÷ÓõײãÊ¹Íæ¼ÒÏÂÏß
    curPlayer.DoDisconnect(tick)
    
# ¼ò»¯c++µÄ±£´æÊý¾Ý·â°ü
def GetPackSaveData(curPlayer):
    roleSaveData = base64.b64decode(curPlayer.GetPackData())  # base64¼ÓÃÜÁË
    allData = ""
    allData = CommFunc.WriteBYTE(allData, IPY_ServerDefine.gstUpdate)
    allData = CommFunc.WriteString(allData, len(roleSaveData), roleSaveData)
    return  allData
 
 
##Íæ¼ÒÕý³£ÏÂÏß
#@param curPlayer Íæ¼ÒË÷Òý
#@param tick Ê±¼ä´Á
#@return ·µ»ØÖµÎÞÒâÒå
#@remarks C++·â°ü´¥·¢, Íæ¼ÒÏÂÏß
def DoPlayerDisconnect(curPlayer, tick):
    
    GameWorld.Log("PlayerDisconnect!" , curPlayer.GetPlayerID())
    
    #ÏÂÏßÁË£¬½«´æ´¢ÔÚ×ÖµäÖеÄÕæÊµXPÖµ£¬ÉèÖøøÍæ¼Ò£¬Íê³É֪ͨºÍ´æ´¢
    #curPlayer.SetXP(curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_RecordXPValue))
    #######################################################################
    #ÏÂÏßÂß¼­
    PlayerControl.PlayerLeaveServer(curPlayer, tick)
    
    #######################################################################
    #Éè¶¨Íæ¼ÒµÄÏÂÏßʱ¼ä
    curPlayer.SetLogoffTime(GameWorld.GetCurrentDataTimeStr())
    
    #Á÷Ïò¼ÇÂ¼Íæ¼ÒÏÂÏß
    DataRecordPack.DR_PlayerDisconnect(curPlayer)
    
    #VIPʱ¼ä
    #PlayerVip.CalcVIPTimeByTick(curPlayer, tick, False)
    #ÔÚÏßʱ¼ä
    PlayerOnlinePrize.CalcOnlineTime(curPlayer)
    #Ê׳äÌáʾʱ¼ä
    PlayerGoldGift.UpdateFirstGoldTime(curPlayer)
    #Íæ¼Òδ»ØÍ¼ÐÎÑéÖ¤ÂëÏÂÏß½«»á¼Ç¼´íÎó´ÎÊý
    #===========================================================================
    # if curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_Captcha_WaitSign) \
    # == PlayerAutoCheckOnline.Def_Captcha_WaitAnswer:
    #    PlayerAutoCheckOnline.CaptchaAnswerErr(curPlayer, tick, False)
    # 
    #    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_Captcha_WaitSign, PlayerAutoCheckOnline.Def_Captcha_Safe)
    # 
    #===========================================================================
    #@warning: µÈ×Ö¶ÎͳһÐ޸ģ¬É¾³ýË«±¶¾­ÑéBUFF
    #PlayerDoubleExpSys.DeleteDoubleExpBuff(curPlayer, ChConfig.Def_DoubleExpNote_StopOff)
    
    #ÉèÖÃRouteServerInitOK×Öµä
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_RouteServerInitOK, 0)
    
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PlayerKey_CrossRegisterMap, 0)
    
    #ÏÂÏßÕٻسèÎï
    PetControl.ReCallFightPet(curPlayer)
    
    #ÀëÏßsession
    EventReport.WriteEvent_session(curPlayer)
    return
 
#---------------------------------------------------------------------
#===============================================================================
# //03 03 ÉèÖÿì½ÝÀ¸±£´æ#tagCSetShutCutData
# tagCSetShutCutData       *   GettagCSetShutCutData();
# class   IPY_CSetShutCutData
# {
# public:
#    char *      GetSetting();
# };
#===============================================================================
##¿Í»§¶Ë·â°üÏìÓ¦ //03 03 ÉèÖÿì½ÝÀ¸±£´æ#tagCSetShutCutData
#@param index Íæ¼ÒË÷Òý
#@param tick Ê±¼ä´Á
#@return ·µ»ØÖµÎÞÒâÒå
#@remarks ¿Í»§¶Ë·â°üÏìÓ¦ //03 03 ÉèÖÿì½ÝÀ¸±£´æ#tagCSetShutCutData
def SetShutcutSettingHV(index, tick):
    curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
    sendPack = IPY_GameWorld.IPY_CSetShutCutData()
    
    setting = sendPack.GetSetting()
    if not GameWorld.EncodingToUnicode(setting):
        #±àÂë¸ñʽ²»ºÏ·¨
        setting = ""
        GameWorld.ErrLog("SetShutCutData Encoding Err", curPlayer.GetID())
        return
    
    if len(setting) > 100:
        return
    
    curPlayer.SetSetting(setting)
    return
 
#// A2 29 ÉèÖÃСÖúÊÖ #tagCMSetLittleHelper
#
#struct    tagCMSetLittleHelper
#{
#    tagHead         Head;
#    BYTE        SetNum;    // Íйܹ¦ÄÜÉèÖñàºÅ1~20£¬Ã¿¸ö±àºÅ¶ÔÓ¦µÄÍйܹ¦ÄÜǰ¶Ë×Ô¶¨Òå
#    DWORD        Value1;    // ×Ô¶¨ÒåÖµ1
#    DWORD        Value2;    // ×Ô¶¨ÒåÖµ2
#    DWORD        Value3;    // ×Ô¶¨ÒåÖµ3
#    DWORD        Value4;    // ×Ô¶¨ÒåÖµ4
#    DWORD        Value5;    // ×Ô¶¨ÒåÖµ5
#    DWORD        Value6;    // ×Ô¶¨ÒåÖµ6
#};
def OnSetLittleHelper(index, clientData, tick):
    curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
    setNum = clientData.SetNum
    if setNum > ChConfig.LittleHelperSetNumCount:
        GameWorld.ErrLog("СÖúÊÖ²»Ö§³Ö¸ÃÉèÖñàºÅ! setNum=%s" % setNum, curPlayer.GetPlayerID())
        return
    for i in xrange(1, ChConfig.LittleHelperValueCount + 1):
        if not hasattr(clientData, "Value%s" % i):
            GameWorld.ErrLog("СÖúÊÖ²»Ö§³Ö¸ÃÖµ±àºÅÉèÖÃ! setNum=%s,value%s" % (setNum, i), curPlayer.GetPlayerID())
            continue
        value = getattr(clientData, "Value%s" % i)
        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_LittleHelperValue % (setNum, i), value)
        GameWorld.DebugLog("СÖúÊÖÖµÉèÖÃ: setNum=%s,value%s=%s" % (setNum, i, value), curPlayer.GetPlayerID())
    return
 
def SyncLittleHelper(curPlayer):
    ## Í¬²½Ð¡ÖúÊÖÉèÖ㬽öÓÐÖµµÄͬ²½
    funcSetList = []
    for setNum in xrange(ChConfig.LittleHelperSetNumCount + 1):
        funcSet = None
        for i in xrange(1, ChConfig.LittleHelperValueCount + 1):
            value = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_LittleHelperValue % (setNum, i))
            if not value:
                continue
            if not funcSet:
                funcSet = ChPyNetSendPack.tagMCLittleHelperFuncSet()
                funcSet.SetNum = setNum
            if hasattr(funcSet, "Value%s" % i):
                setattr(funcSet, "Value%s" % i, value)
        if funcSet:
            funcSetList.append(funcSet)
            
    if not funcSetList:
        return
    
    setPack = ChPyNetSendPack.tagMCLittleHelperSet()
    setPack.FuncSetList = funcSetList
    setPack.FuncSetCount = len(setPack.FuncSetList)
    NetPackCommon.SendFakePack(curPlayer, setPack)
    return
 
#// A2 22 ÉèÖÃÒýµ¼³É¹¦ #tagCMSetGuideOK
#
#struct    tagCMSetGuideOK
#{
#    tagHead        Head;
#    BYTE        GuideIndex; // ¼Ç¼λË÷Òý, ·¢ËÍ255ʱ,´ú±íÉèÖÃÈ«²¿
#    BYTE        IsOK;
#};
def OnSetGuideOK(index, clientData, tick):
    curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
    guideIndex = clientData.GuideIndex
    isOK = clientData.IsOK
    # È«²¿ÉèÖÃ
    if guideIndex == 255:
        value = 0 if not isOK else (pow(2, 31) - 1)
        for i in xrange(ChConfig.Def_GuideStateKeyCount):
            PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_GuideState % i, value)
        GameWorld.DebugLog("ÉèÖÃÈ«²¿Òýµ¼×´Ì¬: isOK=%s,value=%s" % (isOK, value))
    else:
        if guideIndex >= 31*ChConfig.Def_GuideStateKeyCount:
            GameWorld.ErrLog("ÉèÖÃÒýµ¼Ê§°Ü, ³¬¹ý×î´óÖ§³Ö¼Ç¼λ£¡ guideIndex=%s" % guideIndex)
            return
        GameWorld.DebugLog("ÉèÖÃÒýµ¼³É¹¦ guideIndex=%s,isOK=%s" % (guideIndex, isOK))
        isOK = 1 if isOK else 0
        GameWorld.SetDictValueByBit(curPlayer, ChConfig.Def_Player_Dict_GuideState, guideIndex, isOK)
    # ÕâÀïÖ»¸üÐÂ״ֵ̬
    #SyncGuideState(curPlayer)
    return
 
def SyncGuideState(curPlayer):
    # Í¬²½Òýµ¼×´Ì¬¼Ç¼
    guideStatePack = ChPyNetSendPack.tagMCGuideState()
    guideStatePack.GuideState = []
    for i in xrange(ChConfig.Def_GuideStateKeyCount):
        guideStatePack.GuideState.append(curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_GuideState % i))
    guideStatePack.Count = len(guideStatePack.GuideState)
    NetPackCommon.SendFakePack(curPlayer, guideStatePack)
    return
 
def ShowGuide(curPlayer, guideID):
    # Í¨Öª¿Í»§¶ËÏÔʾÒýµ¼
    showGuide = ChPyNetSendPack.tagMCShowGuide()
    showGuide.GuideID = guideID
    NetPackCommon.SendFakePack(curPlayer, showGuide)
    return
 
## Íæ¼Ò״̬±ä¸ü
#  @param index Íæ¼ÒË÷Òý
#  @param tick µ±Ç°Ê±¼ä
#  @return None
def OnPlayerChangeAction(index, tick):
    curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
    if not curPlayer:
        return
    
    lastAction = curPlayer.GetPlayerLastAction()
    curAction = curPlayer.GetPlayerAction()
    
    if lastAction == curAction:
        return
    
    return
 
#---------------------------------------------------------------------
#===============================================================================
# //03 06 ÉèÖÃÉúÃü»Ö¸´ÊýÖµ#tagCSetHPRestore
# tagCSetHPRestore       *   GettagCSetHPRestore();
# class   IPY_CSetHPRestore
# {
# public:
#    int      GetValue();
# };
#===============================================================================
##¿Í»§¶Ë·â°üÏìÓ¦ //03 06 ÉèÖÃÉúÃü»Ö¸´ÊýÖµ#tagCSetHPRestore
#@param index Íæ¼ÒË÷Òý
#@param tick Ê±¼ä´Á
#@return ·µ»ØÖµÎÞÒâÒå
#@remarks ¿Í»§¶Ë·â°üÏìÓ¦ //03 06 ÉèÖÃÉúÃü»Ö¸´ÊýÖµ#tagCSetHPRestore
def HPRestoreSetting(index, tick):
    curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
    sendPack = IPY_GameWorld.IPY_CSetHPRestore()
    curValue = sendPack.GetValue()
    if curValue < 0 or curValue > 100:
        return
    curPlayer.SetHPRestoreSetting(curValue)
    #Íæ¼Ò»î×ŵÄʱºòµ÷ÓÃ
    if GameObj.GetHP(curPlayer) > 0 :
        #µ÷ÓÃ×Ô¶¯»ØÑª
        PlayerControl.PlayerAutoRestoreHP(curPlayer, tick)
    return
 
#---------------------------------------------------------------------
#===============================================================================
# //03 07 ÉèÖÃħ·¨»Ö¸´ÊýÖµ#tagCSetMPRestore
# tagCSetMPRestore       *   GettagCSetMPRestore();
# class   IPY_CSetMPRestore
# {
# public:
#    int      GetValue();
# };
#===============================================================================
##¿Í»§¶Ë·â°üÏìÓ¦ //03 07 ÉèÖÃħ·¨»Ö¸´ÊýÖµ#tagCSetMPRestore
#@param index Íæ¼ÒË÷Òý
#@param tick Ê±¼ä´Á
#@return ·µ»ØÖµÎÞÒâÒå
#@remarks ¿Í»§¶Ë·â°üÏìÓ¦ //03 07 ÉèÖÃħ·¨»Ö¸´ÊýÖµ#tagCSetMPRestore
def MPRestoreSetting(index, tick):
    curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
    sendPack = IPY_GameWorld.IPY_CSetMPRestore()
    curValue = sendPack.GetValue()
    if curValue < 0 or curValue > 100:
        return
    
    curPlayer.SetMPRestoreSetting(curValue)
    
    #Íæ¼Ò»î×ŵÄʱºòµ÷ÓÃ
    if GameObj.GetHP(curPlayer) > 0 :
        #µ÷ÓÃ×Ô¶¯»ØÄ§
        PlayerControl.PlayerAutoRestoreMP(curPlayer, tick)
        
    return
 
#//03 0A ¸ü¸Ä¹¥»÷ģʽ#tagCChangeAttackMode
##¸Ä±äÍæ¼ÒPKģʽ
#@param curPlayer Íæ¼Ò
#@param attackMode
#@return
def ChangeAttackMode(curPlayer, attackMode):
    
    if attackMode < IPY_GameWorld.amPeace or attackMode >= IPY_GameWorld.amMax:
        GameWorld.DebugLog("±ä¸üPKģʽÒì³££¬²»´æÔÚ¸Ãģʽ!attackMode=%s" % attackMode)
        return
    if curPlayer.GetAttackMode() == attackMode:
        GameWorld.DebugLog("PKģʽÏàͬ£¬²»±ä¸ü!attackMode=%s" % attackMode)
        return
    
    attackModels = GameWorld.GetMap().GetAttackModels()
    if not attackModels & pow(2, attackMode):
        GameWorld.DebugLog("±¾µØÍ¼½ûÖ¹Çл»¸Ãģʽ£¡attackModels=%s,changeMode=%s" % (attackModels, attackMode))
        return
    
    #Èç¹ûÇл»µ½ºÍƽģʽ,Çå¿ÕËùÓÐÕÙ»½Ê޵ijðºÞ
    if attackMode == IPY_GameWorld.amPeace:
        NPCCommon.ClearSummonAngry_Player(curPlayer)
    
    curPlayer.SetAttackMode(attackMode)
    
    # Í¬²½¿Í»§¶ËPKģʽ
    SyncPKModel(curPlayer)
    return
 
#===============================================================================
# //A1 03 ÉèÖÃÊÇ·ñ³ÉÄê #tagCMAdult
# struct tagCMAdult
# {
#    tagHead        Head;
#    BYTE        Adult; 
# };
#===============================================================================
# Ö»Ð޸ĵØÍ¼µÄadult£¬Ï´εǼ»áÔڵǼ°ü·¢£¬×¢Òâ²âÊÔÇл»µØÍ¼
def PySetAdult(index, clientData, tick):
    curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
    adult = 1 if clientData.Adult else 0
    curPlayer.ChangeAdult(adult)
    return
 
#---------------------------------------------------------------------
##¼ì²éÍæ¼ÒÊÇ·ñ¿ÉÒÔÍ£Ö¹ÒÆ¶¯
#@param curPlayer Íæ¼ÒʵÀý
#@return ·µ»ØÖµÎÞÒâÒå
#@remarks ¼ì²éÍæ¼ÒÊÇ·ñ¿ÉÒÔÍ£Ö¹ÒÆ¶¯
def CheckPlayerStopMove(curPlayer):
    if not curPlayer.GetMapLoadOK() :
        #Íæ¼ÒµØÍ¼¶ÁȡΪ³É¹¦, Ìß³öÕâÈË
        #curPlayer.Kick(IPY_GameWorld.disPlayerMovedWhenNotPrepare)
        #GameWorld.Log("Íæ¼ÒµØÍ¼¶ÁȡûÓгɹ¦")
        return
    
    if GameObj.GetHP(curPlayer) == 0:
        #Íæ¼ÒÒѾ­ËÀÍö
        #GameWorld.Log("Íæ¼ÒÍ£Ö¹ÒÆ¶¯,Íæ¼ÒÒѾ­ËÀÍö")
        return
    
    if PlayerControl.PlayerCanStateTransfer(curPlayer) != True:
        #GameWorld.Log("ÒÆ¶¯×´Ì¬´íÎó")
        return
    
    if curPlayer.GetCanMove() != True:
        #GameWorld.Log("Íæ¼Ò²»¿ÉÍ£Ö¹")
        return
    
    return True
 
#---------------------------------------------------------------------
##C++·â°ü´¥·¢, Íæ¼ÒÄܹ»ÖØÖÃ×Ô¼ºµÄλÖà
#@param index Íæ¼ÒË÷Òý
#@param tick Ê±¼ä´Á
#@return ·µ»ØÖµÎÞÒâÒå
#@remarks C++·â°ü´¥·¢, Íæ¼ÒÄܹ»ÖØÖÃ×Ô¼ºµÄλÖà
def PlayerCanResetWorldPos(index, tick):
    GameWorld.GetPsycoFunc(__Func_PlayerCanResetWorldPos)(index, tick)
    return
#---------------------------------------------------------------------
##C++·â°ü´¥·¢, Íæ¼ÒÄܹ»ÖØÖÃ×Ô¼ºµÄλÖà
#@param index Íæ¼ÒË÷Òý
#@param tick Ê±¼ä´Á
#@return ·µ»ØÖµÎÞÒâÒå
#@remarks C++·â°ü´¥·¢, Íæ¼ÒÄܹ»ÖØÖÃ×Ô¼ºµÄλÖà
def __Func_PlayerCanResetWorldPos(index, tick):
    curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
    PlayerControl.DoPlayerResetWorldPos(curPlayer, tick)
    return
 
#---------------------------------------------------------------------
##C++·â°ü´¥·¢, Çл»µØÍ¼Ê§°Ü·â°ü´¥·¢
#@param index Íæ¼ÒË÷Òý
#@param tick Ê±¼ä´Á
#@return ·µ»ØÖµÎÞÒâÒå
#@remarks C++·â°ü´¥·¢, Çл»µØÍ¼Ê§°Ü·â°ü´¥·¢
def PlayerChangeMapFailCallback(index, tick):
    curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
    #´«ËÍʱ, Ëø¶¨Íæ¼Ò, ´«Ëͳɹ¦, ÔÚÄ¿±êµØÍ¼½âËø, ´«ËÍʧ°Ü, ÔÚ´«Ëͻص÷º¯ÊýPlayerChangeMapFailCallbackÖнâËø
    curPlayer.ExitEvent()
    NotifyChangeMapFail(curPlayer)
    return
 
 
# Í¨ÖªÇл»µØÍ¼Ê§°Ü
def NotifyChangeMapFail(curPlayer):
    curPlayer.SetVisible(True)
    sendPack = ChPyNetSendPack.tagMCChangeMapFail()
    sendPack.Clear()
    
    NetPackCommon.SendFakePack(curPlayer, sendPack)
    
    GameWorld.Log("µØÍ¼Çл»Ê§°Ü", curPlayer.GetID())
    return
 
#---------------------------------------------------------------------
#===============================================================================
# //03 10 Í˳ö¸±±¾#tagCExitFB
# tagCExitFB       *   GettagCExitFB();
# class   IPY_CExitFB
# {
# public:
#    //ÎÞÒâÒå
#    int      GetType();
# };
#===============================================================================
##¿Í»§¶Ë·â°üÏìÓ¦ //03 10 Í˳ö¸±±¾#tagCExitFB
#@param index Íæ¼ÒË÷Òý
#@param tick Ê±¼ä´Á
#@return ·µ»ØÖµÎÞÒâÒå
#@remarks ¿Í»§¶Ë·â°üÏìÓ¦ //03 10 Í˳ö¸±±¾#tagCExitFB
def ExitFB(index, tick):
    curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
    __Func_ExitFB(curPlayer, tick)
    return
 
##¿Í»§¶Ë·â°üÏìÓ¦ //03 10 Í˳ö¸±±¾#tagCExitFB
#@param index Íæ¼ÒË÷Òý
#@param tick Ê±¼ä´Á
#@return ·µ»ØÖµÎÞÒâÒå
#@remarks ¿Í»§¶Ë·â°üÏìÓ¦ //03 10 Í˳ö¸±±¾#tagCExitFB
def __Func_ExitFB(curPlayer, tick):
    if GameWorld.GetMap().GetMapFBType() == IPY_GameWorld.fbtNull and curPlayer.GetMapID() not in IpyGameDataPY.GetFuncEvalCfg("MapLine", 4):
        return
    
    GameWorld.Log('Íæ¼Ò = %s , Ö÷¶¯À뿪¸±±¾' % (curPlayer.GetName()) , curPlayer.GetID())
    
    if not FBLogic.CanPlayerLeaveFB(curPlayer):
        return
    
    #Íæ¼ÒÖ÷¶¯Í˳öFB,ÏÈ´¦ÀíFBÏà¹ØÐÅÏ¢£¬ÔÙÈÃÍæ¼ÒÍ˳ö
    FBLogic.DoPlayerLeaveFB(curPlayer, tick)
    
    #Íæ¼ÒÖ÷¶¯À뿪¸±±¾
    PlayerControl.PlayerLeaveFB(curPlayer)
    return
 
#---------------------------------------------------------------------
#===============================================================================
# //01 0B Çл»·ÖÁ÷#tagCChangeLine
# tagCChangeLine       *   GettagCChangeLine();
# class   IPY_CChangeLine
# {
# public:
#    //»»µ½¼¸Ïß
#    int      GetLine();
# };
#===============================================================================
##¿Í»§¶Ë·â°üÏìÓ¦ //01 0B Çл»·ÖÁ÷#tagCChangeLine
#@param index Íæ¼ÒË÷Òý
#@param tick Ê±¼ä´Á
#@return ·µ»ØÖµÎÞÒâÒå
#@remarks ¿Í»§¶Ë·â°üÏìÓ¦ //01 0B Çл»·ÖÁ÷#tagCChangeLine
def ChangeLine(index, tick):
    curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
    
    sendPack = IPY_GameWorld.IPY_CChangeLine()
    changLineID = sendPack.GetLine()
    
    if changLineID < 0:
        GameWorld.ErrLog("ChangeLine -> ·â°ü´íÎó, ÎÞ´ËÏß· = %s" % (changLineID), curPlayer.GetID())
        return
    
    if GameWorld.IsCrossServer():
        # ¿ç·þ·þÎñÆ÷ÎÞ·¨ÇÐÏß
        return
    
    mapID = curPlayer.GetMapID()
    
    activityLineID = 0 # »î¶¯Ïß, Ä¬ÈÏ1Ïß
    activityMapLineDict = IpyGameDataPY.GetFuncEvalCfg("MapLine", 2, {})
    if mapID in activityMapLineDict:
        activityLineID = max(0, activityMapLineDict[mapID] - 1)
        
    mapLineDict = IpyGameDataPY.GetFuncEvalCfg("MapLine", 1)
    if changLineID != activityLineID and mapID in mapLineDict and changLineID >= mapLineDict[mapID]:
        GameWorld.ErrLog("¸ÃµØÍ¼Ã»Óпª·Å´ËÏß·£¬ÎÞ·¨ÊÖ¶¯Çл»£¡mapID=%s,changLineID=%s,maxLine=%s" 
                         % (mapID, changLineID, mapLineDict[mapID]), curPlayer.GetID())
        return
    
    #¼ì²éÊÇ·ñ¿ÉÒÔ»»Ïß
    if not __CheckCanChangLine(curPlayer, tick):
        return
    
    #¿ªÊ¼»»Ïß
    PlayerControl.PlayerChangeLine(curPlayer, changLineID)
    return
 
#---------------------------------------------------------------------
##Çл»·ÖÁ÷¼ì²âº¯Êý
#@param curPlayer Íæ¼ÒʵÀý
#@param tick Ê±¼ä´Á
#@return ²¼¶ûÖµ
#@remarks Çл»·ÖÁ÷¼ì²âº¯Êý
def __CheckCanChangLine(curPlayer, tick):
    #---¼ä¸ô¼ì²é---
    if tick - curPlayer.GetLoginTick() < ChConfig.Def_PlayerChangLine_Tick:
        #PK_liubo_500807   <n color="0,255,0">¶Ô²»Æð£¬ÄúÇл»ÓÎÏ·Ïß·¹ýÓÚÆµ·±£¬ÇëÉÔºóÖØÊÔ!</n>   256 -
        PlayerControl.NotifyCode(curPlayer, "PK_liubo_500807")
        #GameWorld.Log("µÇ¼¼ä¸ôСÓÚ%s,ÎÞ·¨»»Ïß"%ChConfig.Def_PlayerChangLine_Tick)
        return False
    
    #---״̬¼ì²é---
    playerAction = curPlayer.GetPlayerAction()
    
    if playerAction == IPY_GameWorld.paSit:
        PlayerControl.DoPlayerStand(curPlayer)
        
    elif playerAction not in ChConfig.Def_PlayerChangLine_State:
        #GeRen_liubo_71563    <n color="0,255,0">¶Ô²»Æð£¬Äú´¦ÓÚʼþ״̬ÖУ¬ÎÞ·¨Çл»Ïß·!</n> 256 -
        PlayerControl.NotifyCode(curPlayer, "GeRen_liubo_71563")
        #GameWorld.Log("·Ç¿ÕÏÐ״̬ÎÞ·¨»»Ïß")
        return False
    
    #---Õ½¶·ÖÐ---
    if PlayerControl.IsPlayerInFight(curPlayer):
        #GeRen_liubo_850801   <n color="0,255,0">¶Ô²»Æð£¬Äú´¦ÓÚÕ½¶·×´Ì¬ÖУ¬ÎÞ·¨Çл»Ïß·!</n> 256 -
        PlayerControl.NotifyCode(curPlayer, "GeRen_liubo_850801")
        #GameWorld.Log("Õ½¶·ÖÐÎÞ·¨»»Ïß")
        return False
    
    if curPlayer.GetPlayerVehicle() not in ChConfig.Def_PlayerChangLine_Vehicle:
        #GeRen_liubo_760310   <n color="0,255,0">¶Ô²»Æð£¬Äú´¦ÓÚѺÔË״̬ÖУ¬ÎÞ·¨Çл»Ïß·!</n> 256 -
        PlayerControl.NotifyCode(curPlayer, "GeRen_liubo_760310")
        return False
 
    return True
 
def GetRebronTime(curPlayer, rebornType):
    ''' ËÀÍö״̬²ÅÑé֤ʱ¼ä£¬±¾·þ¿ç·þͨÓÃ
            ¿ç·þ·þÎñÆ÷ËÀÍöµÄ¸´»îÒ²ÊÇÏÈ·¢µ½±¾·þ£¬Õý³£Çé¿öϱ¾·þÊÇ»î×ŵģ¬ÎÞ·¨ÑéÖ¤
            ËùÒÔ¿É·ñ¸´»îÓÉ¿ç·þ·þÎñÆ÷ËÀÍö״̬ϵÄÍæ¼ÒʵÀýÅжϣ¬¼òµ¥½²¾ÍÊÇÄĸö·þÎñÆ÷ËÀÍöµÄÄĸö·þÎñÆ÷ÅжÏ
            ËùÒԸú¯Êý¿ÉÒÔÖ±½ÓʹÓÃÍæ¼ÒËùÔڵĵØÍ¼ÅжÏ
    '''
    
    # ·ÇËÀÍö״̬Ï£¬Ò²¾ÍÊÇÄĸö·þÎñÆ÷½ÇÉ«ËÀÍöÓÉÄĸö·þÎñÆ÷ÅжÏ
    if GameObj.GetHP(curPlayer) > 0 and curPlayer.GetPlayerAction() != IPY_GameWorld.paDie:
        return 0
    
    # »Ø³Ç¸´»îµÄ²ÅÐèÒªCD
    if rebornType not in [ChConfig.rebornType_City, ChConfig.rebornType_MainCity]:
        return 0
    
    # ¸±±¾µØÍ¼CD
    mapType = GameWorld.GetMap().GetMapFBType()
    if mapType != IPY_GameWorld.fbtNull:
        fbRebornTimeDict = IpyGameDataPY.GetFuncEvalCfg('DuplicatesRebornTime', 1)
        curMapID = FBCommon.GetRecordMapID(GameWorld.GetMap().GetMapID())
        if curMapID in fbRebornTimeDict:
            return fbRebornTimeDict[curMapID]
        return fbRebornTimeDict.get(0, 0)
    
    if curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_IsAddReviveTired):
        findBuff = SkillCommon.FindBuffByID(curPlayer, ChConfig.Def_SkillID_ReviveTired)[0]
        if findBuff:
            if findBuff.GetSkill().GetSkillLV() == findBuff.GetSkill().GetSkillMaxLV():
                return IpyGameDataPY.GetFuncEvalCfg('RebornArguments', 1)[1]
    return 0
 
## ËÀÍöÀäȴʱ¼äÊÇ·ñÍêÁË
#@param curPlayer Íæ¼ÒʵÀý
#@param rebornTime ËÀÍöÀäȴʱ¼ä
#@return boolean
def CanRebornByTimeOver(curPlayer, rebornTime):
    #ºÁÃë
    playerDeadTimeTick = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_DeadTime)
    curGameWorldTick = int(time.time())
    
    GameWorld.DebugLog("¸´»îÀäȴʱ¼ä=%s,passTime=%s"%(rebornTime, max(0, curGameWorldTick - playerDeadTimeTick)))
    return max(0, curGameWorldTick - playerDeadTimeTick) >= rebornTime
    
 
#---------------------------------------------------------------------
 
def __CheckCanReborn(curPlayer, rebornType, gameMap=None, checkHPState=True):
    ''' ¼ì²é¿É·ñ¸´»î£¬ÎªÁËÂß¼­Í³Ò»£¬ÕâÀï²»ÊÊÓÃÍæ¼ÒËùÔڵĵØÍ¼£¬Ö§³Ö¿ç·þ״̬ÏÂÅжϿç·þµØÍ¼
                ±¾º¯Êý²»ÑéÖ¤Íæ¼ÒËÀÍö״̬µÈ£¬ÒòΪÓпÉÄÜǰºó¶Ë¸´»î״̬²»Ò»Ö£¬Èç¹ûÕâÀïÀ¹×¡¿ÉÄܵ¼ÖÂǰ¶ËÌÉʬ¸´»î²»ÁË
    '''
    
    if checkHPState and GameObj.GetHP(curPlayer) > 0 and curPlayer.GetPlayerAction() != IPY_GameWorld.paDie:
        # µ±ÑªÁ¿´óÓÚ0ÊÕµ½¸´»îÇëÇóʱ£¬Ò»°ãÊÇǰºó¶Ë¸´»î״̬²»Ò»ÖµÄÇé¿öϵ¼ÖµÄ
        # ÓÉÓÚǰ¶ËÐèÒª¸ù¾Ý¸´»î״̬Åжϸ´»î½çÃæÏà¹ØÂß¼­£¬ËùÒÔÕâÀïÐèÒª×öÒ»Ð©ÌØÊâ´¦Àí£¬·ÀֹijЩÇé¿öÏÂǰºó¶Ë¸´»î״̬²»Ò»Öµ¼ÖµÄһЩÒì³£ÎÊÌâ
        # ºó¶Ë·ÇËÀÍö״̬µÄÇé¿ö£¬²¹Í¬²½Ò»´Î¸´»î°ü¸øÇ°¶Ë
        SyncPlayerReborn(curPlayer, rebornType)
        return
    
    if rebornType not in ChConfig.Def_RebornTypeList:
        return
    
    ## ÓÉÓÚ±¾·þ¼°¿ç·þµØÍ¼Êý¾Ý²»»¥Í¨£¬ËùÒÔÕâÀï¸ù¾ÝÊÇ·ñÓеØÍ¼Êý¾Ý½øÐÐÅжϴ¦Àí
    if gameMap:
        playerID = curPlayer.GetPlayerID()
        if rebornType in [ChConfig.rebornType_Health, ChConfig.rebornType_UseItem] and not gameMap.GetLocalReborn():
            GameWorld.ErrLog("¸ÃµØÍ¼²»¿ÉÔ­µØ¸´»î! mapID=%s,rebornType=%s" % (gameMap.GetMapID(), rebornType), curPlayer.GetPlayerID())
            return
        
    # ÑéÖ¤¸´»îCD
    rebornCD = GetRebronTime(curPlayer, rebornType)
    if rebornCD:
        curTime = int(time.time())
        deadTime = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_DeadTime)
        if curTime - deadTime < rebornCD:
            PlayerControl.NotifyCode(curPlayer, "RebornCD")
            GameWorld.Log("¸´»îÀäȴʱ¼äÖУ¬ÎÞ·¨¸´»î! curTime(%s) - deadTime(%s) < rebornCD(%s)" % (curTime, deadTime, rebornCD), playerID)
            return
        
    # ÑéÖ¤¸´»îÏûºÄ£¬ÔÚ±¾·þÑéÖ¤£¬¿ç·þ·þÎñÆ÷Ö»Ñé֤״̬
    if not GameWorld.IsCrossServer():
        if not __RebornCost(curPlayer, rebornType, False):
            return
        
    # ¸±±¾¶îÍâÑéÖ¤
    if not FBLogic.OnCanFBReborn(curPlayer, rebornType):
        return
    
    return True
 
def __RebornCost(curPlayer, rebornType, isDoCost):
    ## ¿Û³ý¸´»îÏûºÄ
    # @param isDoCost: ÊÇ·ñÖ´ÐÐÏûºÄ
    crossMapID = PlayerControl.GetCrossMapID(curPlayer)
    playerID = curPlayer.GetPlayerID()
    if rebornType == ChConfig.rebornType_Health:
        rebornCfg = IpyGameDataPY.GetFuncEvalCfg('RebornArguments', 1)
        moneyPrice = rebornCfg[2]
        costMoneyList = PlayerControl.HaveMoneyEx(curPlayer, ShareDefine.TYPE_Price_Gold_Paper_Money, moneyPrice)
        if not costMoneyList:
            GameWorld.ErrLog("»õ±Ò²»×㣬ÎÞ·¨Ô­µØ¸´»î! moneyPrice=%s" % (moneyPrice), playerID)
            return
        
        if isDoCost:
            for moneyType, moneyCnt in costMoneyList:
                if not PlayerControl.PayMoney(curPlayer, moneyType, moneyCnt, ChConfig.Def_Cost_Revive):
                    return
                
    elif rebornType == ChConfig.rebornType_UseItem:
        if crossMapID == ChConfig.Def_FBMapID_CrossBattlefield:
            rebornItemID = IpyGameDataPY.GetFuncCfg("CrossBattlefieldReborn", 1)
            rebornItem = ItemCommon.FindItemInPackByItemID(curPlayer, rebornItemID, IPY_GameWorld.rptItem)
        else:
            rebornItem = ItemCommon.FindItemInPackByEffectEx(curPlayer, ChConfig.Def_Effect_Reborn)
        if not rebornItem:
            GameWorld.ErrLog("¸´»îµÀ¾ß²»×㣬ÎÞ·¨Ô­µØ¸´»î! ", playerID)                
            return
        
        if isDoCost:
            ItemCommon.DelItem(curPlayer, rebornItem, 1, True, "Reborn")
            
    return True
 
def __DoPlayerReborn(curPlayer, rebornType, tick, mapBornPlace=0, isAddSuperBuff=True):
    ## Ö´ÐÐÍæ¼Ò¸´»îÂß¼­£¬¸Ãº¯ÊýûÓÐÖ´ÐÐÑéÖ¤ÊÇ·ñ¿É¸´»îµÈ£¬²»¿ÉÖ±½Óµ÷ÓÃ
    
    resetHpPercent = ChConfig.Def_MaxRateValue
    isFBReborn = False
    if rebornType == ChConfig.rebornType_City:
        if FBLogic.OnPlayerReborn():
            isFBReborn = True
        else:
            PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_IsReBorn, 1)
            
    elif rebornType == ChConfig.rebornType_MainCity:
        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_IsReBorn, 2)
        
    #֪ͨ¿Í»§¶ËÍæ¼Ò¸´»î³É¹¦
    curPlayer.Reborn(rebornType)
    
    #Ö´ÐÐÍæ¼Ò¸±±¾¸´»î
    if isFBReborn:
        FBLogic.OnResetFBRebornPlacePos(curPlayer, mapBornPlace, tick)
    
    #¸´»î¼ÓÎÞµÐBuff
    if isAddSuperBuff:
        SkillCommon.AddBuffBySkillType_NoRefurbish(curPlayer , ChConfig.Def_SkillID_LimitSuperBuff, tick)
    #¸´»îÆ£ÀÍBUff
    if curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_IsAddReviveTired):
        __AddReviveTired(curPlayer, tick)
        
    #¸´»îºóÇå³ý½ÇÉ«ÉíÉϵĴòBOSSºÍPK״̬
    validTime = IpyGameDataPY.GetFuncCfg("PKConfig", 4) * 1000
    if PlayerState.IsInPKState(curPlayer):
        PlayerState.SetPKStateTick(curPlayer, tick - validTime)
    if PlayerState.IsInBossState(curPlayer):
        PlayerState.SetBossStateTick(curPlayer, tick- validTime)
    
    #ÖØËãÊôÐÔ
    playerControl = PlayerControl.PlayerControl(curPlayer)
    playerControl.RefreshAllState()
    
    #ÉèÖÃѪÁ¿
    GameObj.SetHP(curPlayer, GameObj.GetMaxHP(curPlayer) * resetHpPercent / ChConfig.Def_MaxRateValue)
    #curPlayer.SetMP(curPlayer.GetMaxMP() * resetMpPercent / ChConfig.Def_MaxRateValue)
    #»¤¶Ü
    PlayerControl.SetProDef(curPlayer, PlayerControl.GetMaxProDef(curPlayer))
    
    #Íæ¼Ò¸´»îºó¸±±¾´¦Àí
    FBLogic.OnPlayerRebornOver(curPlayer, rebornType)
    
    gameMap = GameWorld.GetMap()
    #Õϰ­µãÖÐÔ­µØ¸´»î, ´ò»ØÖØÉúµã
    if (rebornType == ChConfig.rebornType_City and not isFBReborn) \
        or not GameWorld.GetMap().CanMove(curPlayer.GetPosX(), curPlayer.GetPosY()) \
        or (rebornType == ChConfig.rebornType_MainCity and gameMap.GetRebornMapID() == curPlayer.GetMapID()):
        #Íæ¼ÒÇл»µ½ÖØÉúµã
        playerControl.SetToBornPlace()        
    elif rebornType == ChConfig.rebornType_MainCity:
        #Ö±½ÓÈ¡dbÖÐÅäÖõĸ´»îµã
        PlayerControl.PlayerResetWorldPos(curPlayer, gameMap.GetRebornMapID(), gameMap.GetRebornMapX(), gameMap.GetRebornMapY())
    #ÖØÐÂÕÙ»½³èÎï
    PlayerPet.AutoSummonPet(curPlayer)
    
    #¸´»î³É¹¦,ÖØÖÃ״̬
    PlayerControl.ChangePlayerAction(curPlayer, IPY_GameWorld.paNull)
    return
 
def __AddReviveTired(curPlayer, tick):
    ## Ôö¼Ó¸´»îÆ£ÀÍ
    findBuff = SkillCommon.FindBuffByID(curPlayer, ChConfig.Def_SkillID_ReviveTired)[0]
    if findBuff:
        buffSkillLV = findBuff.GetSkill().GetSkillLV()
        if findBuff.GetSkill().GetSkillMaxLV() != buffSkillLV:
            buffSkillLV = buffSkillLV + 1
    else:
        buffSkillLV = 1
    SkillCommon.AddBuffBySkillType_NoRefurbish(curPlayer , ChConfig.Def_SkillID_ReviveTired, tick, buffSkillLV)
    GameWorld.DebugLog('    ¸´»îÆ£ÀÍBUff buffSkillLV=%s'%(buffSkillLV))
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_IsAddReviveTired,0)    
    return
 
def PlayerRebornByType(curPlayer, rebornType, tick, mapBornPlace=0, isAddSuperBuff=True):
    ''' Íæ¼Ò¸´»î
    '''
    gameMap = GameWorld.GetMap()
    if not __CheckCanReborn(curPlayer, rebornType, gameMap):
        return
    
    if not GameWorld.IsCrossServer():
        if not __RebornCost(curPlayer, rebornType, True):
            return
        
    __DoPlayerReborn(curPlayer, rebornType, tick, mapBornPlace, isAddSuperBuff)
    return True
 
#---------------------------------------------------------------------
 
##¸±±¾½Ó¿Ú:Íæ¼Ò¸´»î
#@param curPlayer Íæ¼ÒʵÀý
#@param tick Ê±¼ä´Á
#@return ·µ»ØÖµÎÞÒâÒå
#@remarks ¸±±¾½Ó¿Ú:Íæ¼Ò¸´»î
def PlayerReborn_InFB(curPlayer, rebornType, tick):
    mapType = GameWorld.GetMap().GetMapFBType()
    #²»ÔÚ¸±±¾ÖÐ
    if mapType == IPY_GameWorld.fbtNull:
        return
    
    FBLogic.DoFBOnReborn(curPlayer, rebornType, tick)
    return
 
#---------------------------------------------------------------------
#// C1 05 ½øÈë¿ç·þµØÍ¼ #tagCMEnterCrossServer
#
#struct    tagCMEnterCrossServer
#{
#    tagHead        Head;
#    DWORD        DataMapID;
#    WORD        LineID;
#};
def OnEnterCrossServer(index, clientData, tick):
    curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
    PlayerControl.PlayerEnterCrossServer(curPlayer, clientData.DataMapID, clientData.LineID)
    return
    
#===============================================================================
# //03 21 ½øÈ븱±¾»î¶¯#tagCEnterFbGameEvent
# tagCEnterFbGameEvent       *   GettagCEnterFbGameEvent();
# class   IPY_CEnterFbGameEvent
# {
# public:
#    //µØÍ¼ID
#    int      GetMapID();
#    //ÏßID
#    int      GetLineID();
# };
#===============================================================================
##¿Í»§¶Ë·â°üÏìÓ¦ //03 21 ½øÈ븱±¾»î¶¯#tagCEnterFbGameEvent
#@param index Íæ¼ÒË÷Òý
#@param tick Ê±¼ä´Á
#@return ·µ»ØÖµÎÞÒâÒå
#@remarks ¿Í»§¶Ë·â°üÏìÓ¦ //03 21 ½øÈ븱±¾»î¶¯#tagCEnterFbGameEvent
def EnterFbGameEvent(index, tick):
    GameWorld.GetPsycoFunc(__Func_EnterFbGameEvent)(index, tick)
    return
 
##¿Í»§¶Ë·â°üÏìÓ¦ //03 21 ½øÈ븱±¾»î¶¯#tagCEnterFbGameEvent
#@param index Íæ¼ÒË÷Òý
#@param tick Ê±¼ä´Á
#@return ·µ»ØÖµÎÞÒâÒå
#@remarks ¿Í»§¶Ë·â°üÏìÓ¦ //03 21 ½øÈ븱±¾»î¶¯#tagCEnterFbGameEvent
def __Func_EnterFbGameEvent(index, tick):
    curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
    sendPack = IPY_GameWorld.IPY_CEnterFbGameEvent()
    #ÊÕ µØÍ¼ºÍÏß·ID
    mapID = sendPack.GetMapID()
    clientSendLineID = sendPack.GetLineID()
    PlayerControl.PlayerEnterFB(curPlayer, mapID, clientSendLineID)
    return
 
#// B0 05 ¿ªÊ¼ÊÀ½ç´«ËÍ #tagCMWorldTransfer
#
#struct    tagCMWorldTransfer
#{
#    tagHead        Head;
#    BYTE        Type;
#    DWORD        MapID;
#    BYTE        LineID;
#    WORD        PosX;
#    WORD        PosY;
#    DWORD        ExData1;    //À©Õ¹×Ö¶Î1£¬¸÷¸öÏîÄ¿¸ù¾Ý×Ô¼ºµÄÐèÒª¾ö¶¨ÓÃ;
#};
def PYWorldTransPort(index, clientPack, tick):
    curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
    packTransportType = clientPack.Type
    mapID = clientPack.MapID
    lineID = clientPack.LineID
    posX = clientPack.PosX
    posY = clientPack.PosY
    exData1 = clientPack.ExData1
    __Func_WorldTransPort(curPlayer, packTransportType, mapID, posX, posY, tick, lineID, exData1)
    return
 
def __Func_WorldTransPort(curPlayer, packTransportType, mapID, posX, posY, tick, lineID=-1, exData1=0):
    if curPlayer.GetMapID() != mapID:
        #ÑéÖ¤¼ä¸ô
        if tick - curPlayer.GetTickByType(ChConfig.TYPE_Player_Tick_WorldTransport) < ChConfig.TYPE_Player_Tick_Time[ChConfig.TYPE_Player_Tick_WorldTransport]:
            #ûµ½¼ä¸ô
            return
    
        curPlayer.SetTickByType(ChConfig.TYPE_Player_Tick_WorldTransport, tick)
        
    playerID = curPlayer.GetPlayerID()
    GameWorld.DebugLog("WorldTransPort packTransportType=%s,mapID=%s,lineID=%s,exData1=%s" 
                       % (packTransportType, mapID, lineID, exData1), playerID)
    lineID = -1 if lineID == 255 else lineID
    if GameWorld.IsCrossServer():
        if curPlayer.GetMapID() != mapID:
            return
        lineID = -1 # ¿ç·þĬÈÏÖ»Äܱ¾Ïß
        
    #ÊÀ½ç´«ËÍ·â°üÔÊÐíÀàÐÍ£¨ÊÀ½ç£¬´óµØÍ¼£¬ÈÎÎñ£©
    if packTransportType not in ChConfig.Def_PackType_TransportType.keys():
        GameWorld.ErrLog('WorldTransPort packTransportType = %s, NoFind' % (packTransportType), playerID)
        return
 
    transportType = ChConfig.Def_PackType_TransportType.get(packTransportType)
    # ·þÎñ¶ËÔݲ»×öVIPµÈ¼¶´«ËÍÏÞÖÆ£¬Óɿͻ§¶Ë¿ØÖÆ
#    if not TransportVipLvRestrict(curPlayer, transportType):
#        return
    #¼ì²éÍæ¼Ò״̬
    if not PlayerControl.CheckPlayerTransport(curPlayer):
        return
 
    #Ä¿±êµØÍ¼Åжϣ¨´æÔÚ·ñ£¬µÐ¹ú£¬¸±±¾£©
    if not PlayerControl.CheckTagCountry(curPlayer, mapID):
        return
 
    #×ø±êµãÅжÏ
    posX, posY = GetTransportPos(curPlayer, packTransportType, mapID, posX, posY)
    
    if (posX, posY) == (0, 0):
        #04BBF813-7A30-47A8-927DE1ACCC4F378E Ä¿±êµãΪÕϰ­µã
        PlayerControl.NotifyCode(curPlayer, "04BBF813-7A30-47A8-927DE1ACCC4F378E")
        return
 
    #ÊÇÈÎÎñ´«ËÍ£¬VIPµÈ¼¶²»¹»£¬ÇÒ´«ËÍ·û²»×㣬²»´¦Àí
    if transportType == ChConfig.Def_Transport_Type_Mission and \
       not TransportVipLvRestrict(curPlayer, transportType) and \
       not PayForTransport(curPlayer, transportType):
            return
    
    #¿ªÊ¼´«ËÍ
    curPlayer.SetDict(ChConfig.Def_PlayerKey_TransType, transportType)
    #curPlayer.SetDict(ChConfig.Def_PlayerKey_TransAutoBuyItem, isAutoBuy)
    BeginTrans(curPlayer, mapID, posX, posY, lineID=lineID, exData1=exData1)
    return
    
 
## ¿ªÊ¼´«ËÍ
# @param curPlayer Íæ¼ÒʵÀý
# @param mapID µØÍ¼ID
# @param posX ×ø±êX
# @param posY ×ø±êY
# @param lineID Ïß·ID -1´ú±íµ±Ç°Ïß
# @param msg Çл»µØÍ¼Ð¯´øµÄÐÅÏ¢
# @param canLock ÊÇ·ñ¿ÉÒÔËø¶¨Íæ¼Ò(´«Ë͵㲻¿ÉËø¶¨, ÒòΪҪ¿çµØÍ¼Ñ°Â·)
#  @return: ÊÇ·ñÔÚÀ­½ø¶ÈÌõ
def BeginTrans(curPlayer, mapID, posX, posY, lineID= -1, msg='', canLock=True, exData1=0):
    #===========================================================================
    # if PlayerControl.IsPlayerInFight(curPlayer):
    #    #¼Ç¼´«ËÍ×ø±ê, ÓÃÓÚ½ø¶ÈÌõ½áÊøºó´«ËÍ
    #    curPlayer.SetDict(ChConfig.Def_PlayerKey_TransMapId, mapID)
    #    curPlayer.SetDict(ChConfig.Def_PlayerKey_TransPosX, posX)
    #    curPlayer.SetDict(ChConfig.Def_PlayerKey_TransPosY, posY)
    #    
    #    #Õ½¶·×´Ì¬ÖÐÀ­½ø¶ÈÌõ
    #    PlayerControl.Sync_PrepareBegin(curPlayer, ChConfig.Def_TransTime,
    #                                    ShareDefine.Def_PstTrans)
    #    return True
    #===========================================================================
    
    PlayerControl.PlayerResetWorldPos(curPlayer, mapID, posX, posY, lineID, msg, canLock, exData1)
    #PlayerControl.NotifyCode(curPlayer, "Map_Deliver_Succeed", [mapID])
    return False
 
 
##È¡µÃÕýÈ·´«ËÍ×ø±ê
#@param curPlayer Íæ¼ÒʵÀý
#@param transportType ´«ËÍÀàÐÍ
#@param transportMapID ·â°üµØÍ¼ID
#@param posX ·â°üµØÍ¼posX
#@param posY ·â°üµØÍ¼posY
#@return ×ø±êµã
#@remarks È¡µÃÕýÈ·´«ËÍ×ø±ê
def GetTransportPos(curPlayer, transportType, transportMapID, transportPosX, transportPosY):
    #---ÊÀ½ç´«ËÍÂß¼­ÌØÊâ´¦Àí---
    #===========================================================================
    # if transportType == ShareDefine.Def_Transport_World:
    #    cityPosDict = ReadChConfig.GetEvalChConfig('Def_List_City_Pos')
    #    
    #    posInfo = cityPosDict.get(transportMapID)
    #    
    #    if posInfo == None:
    #        #ÎÞ·¨²éÕÒºÏÊʵÄ×ø±ê
    #        return 0, 0
    #    
    #    transportPosX, transportPosY = posInfo
    #===========================================================================
 
    #---¹«ÓÃ×ø±êµã¼ì²âÂß¼­---
    if curPlayer.GetMapID() == transportMapID:
        #±¾µØÍ¼ÐèÒªÑéÖ¤ÊÇ·ñÕϰ­µã
        if not GameWorld.GetMap().CanMove(transportPosX, transportPosY):
            transportPosX, transportPosY = GameMap.GetNearbyPosByDis(transportPosX, transportPosY, ChConfig.Def_RebornPos_Area_Range)
    
    return transportPosX, transportPosY
    
##´«ËÍÏûºÄ´¦Àí
#@param curPlayer Íæ¼Ò
#@param transportType ´«ËÍÀàÐÍ
#@return BOOL Ö§¸¶ÊÇ·ñ³É¹¦
#@remarks ´«ËÍÏûºÄ´¦Àí
def PayForTransport(curPlayer, transportType):
    itemID = IpyGameDataPY.GetFuncCfg('TransportPay')
    if not itemID:
        return True
    useCount = 1    # ÏûºÄÊýÁ¿
    itemPack = curPlayer.GetItemManager().GetPack(IPY_GameWorld.rptItem)
    hasEnough, itemList = ItemCommon.GetItem_FromPack_ByID(itemID, itemPack, useCount)
    if not hasEnough:
        #µÀ¾ß²»¹»Ä¬ÈÏ¿ÛÇ®
        costMoney = IpyGameDataPY.GetFuncCfg('TransportPay', 2)
        if not TransportPayMoney(curPlayer, IPY_GameWorld.TYPE_Price_Gold_Paper, costMoney, transportType):
            GameWorld.DebugLog('    ´«ËÍÏûºÄ´¦Àí ´«Ë͵À¾ß²»×ã itemID=%s, Ç®Ò²²»¹»costMoney=%s'%(itemID, costMoney))
            return False
    else:
        ItemCommon.ReduceItem(curPlayer, itemPack, itemList, useCount, False)
    
    return True
 
## ´«ËÍvipµÈ¼¶ÏÞÖÆ
#  @param curPlayer Íæ¼ÒʵÀý
#  @param transportType ´«ËÍÀàÐÍ
#  @return ÊÇ·ñvipµÈ¼¶ÏÞÖÆ
def TransportVipLvRestrict(curPlayer, transportType):
    return PlayerVip.GetPrivilegeValue(curPlayer, ChConfig.VIPPrivilege_FreeTransport)
 
 
 
#---------------------------------------------------------------------
##´«Ë͸¶·Ñ¼Ç¼
#@param curPlayer Íæ¼ÒʵÀý
#@param moneyType ¸¶·ÑÀàÐÍ
#@param money ¼Û¸ñ
#@param transportType ´«ËÍÀàÐÍ
#@param noteMark ¼Ç¼ÀàÐÍ
#@return ·µ»ØÖµÕæ, ¿Û·Ñ³É¹¦
#@remarks ´«Ë͸¶·Ñ¼Ç¼
def TransportPayMoney(curPlayer, moneyType, money, transportType):
    moneyList = PlayerControl.HaveMoneyEx(curPlayer, moneyType, money)
    if moneyList == []:
        return False
    
    for moneyType, money in moneyList:
        if money > 0:
            PlayerControl.PayMoney(curPlayer, moneyType, money, ChConfig.Def_Cost_Transport, 
                                   {"TransportType":transportType})
            GameWorld.Login_Interface_GoldRec(curPlayer, transportType, 0, 'TransportType',
                                              moneyType, money)
        
    return True
 
#===============================================================================
##//A2 05 ÇëÇó¶Ò»»ÀëÏß¾­Ñé·â°ü#tagPyCMOfflineExpExchange
#@param index Íæ¼ÒË÷Òý
#@param curPackData ·â°ü½á¹¹Ìå
#@param tick Ê±¼ä´Á
#@return ·µ»ØÖµÎÞÒâÒå
#@remarks ÀëÏß¾­Ñé¶Ò»»
def PlayerExpExchange(index, curPackData, tick):
    # ¿ç·þ·þÎñÆ÷¹¦ÄÜÏÞÖÆ
    if GameWorld.IsCrossServer():
        return
        
    #¶Ò»»¹«Ê½×Öµä
    OfflineExpChangeDict = ReadChConfig.GetEvalChConfig("OfflineSys_ExpChange")
    
    curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
    #ÊÕ°ü×Ö¶Î
    mulIndex = curPackData.Index # ¾­Ñé±¶ÂÊË÷Òý
    exchangeTime = curPackData.ExchangeTime #¶Ò»»Ê±¼ä£¨·ÖÖÓ£©
    
    recList = OfflineExpChangeDict.get(int(mulIndex))  # ¸ù¾ÝË÷Òý»ñÈ¡¼Ç¼
    if not recList: # ÕÒ²»µ½¼Ç¼
        GameWorld.ErrLog('ÀëÏß¾­Ñé¶Ò»»Ë÷Òý´íÎóindex=%s' % mulIndex)
        return
    
    #×îСvipµÈ¼¶ÏÞÖÆ
    minVIPLv = recList[0]
    #vipµÈ¼¶
    VIPLv = curPlayer.GetVIPLv()
    #ҪʹÓõÄʱ¼ä
    useMinutes = exchangeTime
    #ÀëÏßÀÛ»ýʱ¼ä
    haveMinutes = curPlayer.GetOfflineMinutes()
    
    if VIPLv < minVIPLv:
        GameWorld.ErrLog("ÀëÏß¹Ò»ú·â°ü¶Ò»»¾­ÑéÒì³££¬Íæ¼ÒvipµÈ¼¶ %s, ÏÔʾµÄvipµÈ¼¶ %s £¬" % (VIPLv, minVIPLv))
        return
    
    if useMinutes > haveMinutes :
        GameWorld.ErrLog("ÀëÏß¹Ò»ú·â°ü¶Ò»»¾­ÑéÒì³££¬¶Ò»»Ê±¼ä %s, ÀÛ»ýʱ¼ä %s £¬" % (useMinutes, haveMinutes))
        return
    
    #²Î¿¼¾­Ñé
    rExp = PlayerControl.GetPlayerReExp(curPlayer)
    reLV = curPlayer.GetLV()                    #²Î¿¼µÈ¼¶
    worldLvExpRate = PlayerWorldAverageLv.GetWorldAverageLvExpRate(curPlayer) #ÊÀ½çµÈ¼¶¾­Ñé¼Ó³É
    
    #¾­Ñ鹫ʽ
    redeemExp = int(eval(recList[1]))
    #»õ±ÒÐÅÏ¢Áбí
    moneyInfoList = recList[2]
    #»õ±ÒÀàÐÍ
    moneyType = int(moneyInfoList[0])
    #ÏûºÄµÄ»õ±Ò¹«Ê½
    costMoney = int(eval(moneyInfoList[1]))
    
    playerControl = PlayerControl.PlayerControl(curPlayer)
#    #³¬¹ý¾­Ñé´¢´æÉÏÏÞ£¬²»Óè¶Ò»»¾­Ñé
#    if redeemExp + curPlayer.GetTotalExp() > ChConfig.Def_UpperLimit_DWord:
#        PlayerControl.NotifyCode(curPlayer, "ExpChange_lhs_31379")
#        return
    
    haveMoneyList = PlayerControl.HaveMoneyEx(curPlayer, moneyType, costMoney)
    
    if not haveMoneyList:#½ðÇ®²»×ã
        return
    
    #¿Û½ðÇ®
    for moneyType, moneyCnt in haveMoneyList:
        if not PlayerControl.PayMoney(curPlayer, moneyType, moneyCnt, ChConfig.Def_Cost_OffLineExp, 
                                      {"ChangeTime":useMinutes, "Index":mulIndex, ChConfig.Def_Cost_Reason_SonKey:mulIndex}): # ½ðÇ®²»×ã
            GameWorld.ErrLog('¸ßЧÁ·¹¦£¬£¬½ðÇ®²»×ã##PlayerControl=%s,,moneyCnt=%s' % (PlayerControl, moneyCnt))
            return
    
    playerControl.AddExp(redeemExp) # ¼Ó¾­Ñé
    
    offlineTime = int(max(haveMinutes - useMinutes, 0)) # ¿ÛÀëÏßʱ¼ä
    curPlayer.SetOfflineMinutes(offlineTime) # ÉèÖÃÀëÏßʱ¼ä
    curPlayer.Syn_OfflineTimeQueryResult() # Í¨Öª¿Í·þ¶ËÀëÏßʱ¼ä
    return
 
 
#//B0 24 ÁìÈ¡¼Ò×åÐüÉͽ±Àø #tagReceiveFamilyArrestAward
#
#struct    tagReceiveFamilyArrestAward
#
#{
#    tagHead        Head;
#    DWORD        ArrestID;        //ÐüÉÍÈÎÎñID
#};
## ÁìÈ¡¼Ò×åÐüÉͽ±Àø
#  @param index: Íæ¼ÒË÷Òý
#  @param clientData: ·â°ü½á¹¹Ìå
#  @param tick: Ê±¼ä´Á
#  @return: None
def ReceiveFamilyArrestAward(index, clientData, tick):
    curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
    arrestID = clientData.ArrestID
    
    bit = ShareDefine.Def_ArrestOverState_BitDic.get(arrestID)
    if bit == None:
        #ûÓÐÕâ¸ö¼Ò×åÐüÉÍÈÎÎñ
        GameWorld.DebugLog("ûÓÐÕâ¸ö¼Ò×åÐüÉÍÈÎÎñ arrestID=%s" % arrestID)
        return
    
    receiveState = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FamilyArrestAwardState)
    
    if receiveState & pow(2, bit):
        #¸ÃÈÎÎñ½±ÀøÒѾ­ÁìÈ¡
        GameWorld.DebugLog("¸ÃÈÎÎñ½±ÀøÒѾ­ÁìÈ¡ arrestID=%s" % arrestID)
        return
    
    if curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_FamilyArrestQueryState) == 1:
        #ÒѾ­ÔÚ²éѯÖÐ, ²»Öظ´²éѯ
        GameWorld.DebugLog("ÒѾ­ÔÚ²éѯÖÐ, ²»Öظ´²éѯ arrestID=%s" % arrestID)
        return
    
    sendMsg = '%s' % arrestID
    
    #ÏòGameServerÇëÇó¸ÃÐüÉÍÈÎÎñÊÇ·ñÒѾ­Íê³É
    curPlayer.GameServer_QueryPlayerByID(ChConfig.queryType_FamilyArrest, 0, 'FamilyArrestAward', sendMsg, len(sendMsg))
    
    #ÉèÖÃ״̬²éѯÖÐ
    curPlayer.SetDict(ChConfig.Def_PlayerKey_FamilyArrestQueryState, 1)
    return
 
 
#//B0 26 ÇëÇó¼Ò×åÐüÉͽ±ÀøÁìÈ¡Çé¿ö #tagQueryFamilyArrestAwardReceiveState
#
#struct    tagQueryFamilyArrestAwardReceiveState
#
#{
#    tagHead        Head;
#};
## ÇëÇó¼Ò×åÐüÉͽ±ÀøÁìÈ¡Çé¿ö
#  @param index: Íæ¼ÒË÷Òý
#  @param clientData: ·â°ü½á¹¹Ìå
#  @param tick: Ê±¼ä´Á
#  @return: None
def QueryFamilyArrestAwardReceiveState(index, clientData, tick):
    curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
    Sync_FamilyArrestAwardReceiveState(curPlayer)
    return
 
 
## Í¨Öª¿Í»§¶Ë¼Ò×åÐüÉÍÈÎÎñ½±ÀøÁìÈ¡Çé¿ö
#  @param curPlayer: Íæ¼ÒʵÀý
#  @return: None
def Sync_FamilyArrestAwardReceiveState(curPlayer):
    awardReceiveState = ChPyNetSendPack.tagFamilyArrestAwardReceiveState()
    awardReceiveState.Clear()
    
    state = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FamilyArrestAwardState)
    awardReceiveState.ReceiveState = state
    NetPackCommon.SendFakePack(curPlayer, awardReceiveState)
    return
 
## ÁìÈ¡½±Àø±í½±Àø
#  @param None None
#  @return None
def ClientPlayerGetReward(index, clientData, tick):
    playerManager = GameWorld.GetPlayerManager()
    curPlayer = playerManager.GetPlayerByIndex(index)
    
    # ±³°ü¿Õ¼ä²»×ã
    if not ItemCommon.CheckPackHasSpace(curPlayer, IPY_GameWorld.rptItem):
        PlayerControl.NotifyCode(curPlayer, "GeRen_chenxin_676165", [IPY_GameWorld.rptItem])
        return
    
    rewardType = clientData.RewardType
    
    #֪ͨGameServerÁìÈ¡½±Àø
    resultName = str(rewardType)
    GameWorld.GetPlayerManager().GameServer_QueryPlayerResult(curPlayer.GetID(), 0, 0, 'PlayerGetReward',
                                                                  resultName, len(resultName))
    return
 
#//A5 04 Íæ¼ÒÁìÈ¡½±Àø #tagCMPlayerGetReward
#
#struct    tagCMPlayerGetReward
#
#{
#    tagHead         Head;
#    BYTE        RewardType;    //½±ÀøÀàÐÍ
#    DWORD        DataEx;        //¸½´øÐÅÏ¢
#    BYTE        DataExStrLen;    //¸½¼Ó×Ö·ûÐÅÏ¢³¤¶È
#    char        DataExStr[DataExStrLen];        //¸½¼Ó×Ö·ûÐÅÏ¢
#};
def PlayerGetReward(index, clientData, tick):
    playerManager = GameWorld.GetPlayerManager()
    curPlayer = playerManager.GetPlayerByIndex(index)
    
    rewardType = clientData.RewardType # ½±ÀøÀàÐÍ
    dataEx = clientData.DataEx # ¸½¼ÓÐÅÏ¢
    dataExStr = clientData.DataExStr # ¸½¼Ó×Ö·ûÐÅÏ¢
    
    GameWorld.DebugLog("PlayerGetReward: rewardType=%s,dataEx=%s,dataExStr=%s" % (rewardType, dataEx, dataExStr))
    
    # »îÔ¾¶È½±Àø
    if rewardType == ChConfig.Def_RewardType_Activity:
        PlayerActivity.GetActivityAward(curPlayer, dataEx)
    # »îÔ¾·ÅÖý±Àø
    elif rewardType == ChConfig.Def_RewardType_ActivityPlace:
        PlayerActivity.GetActivityPlaceReward(curPlayer)
    # ¹Ò»ú½±Àø
    elif rewardType == ChConfig.Def_RewardType_Guaji:
        PlayerGuaji.OnGetGuajiAward(curPlayer, dataEx)
    # Ã¿ÈÕÃâ·ÑÖ±¹ºÀñ°ü
    elif rewardType == ChConfig.Def_RewardType_DayFreeGoldGift:
        PlayerDailyGiftbag.OnGetDailyFreeGiftbag(curPlayer)
    # ÏÉÃËÁªÈü¹Ú¾üÏÉÃËÿÈÕٺ»½±Àø
    elif rewardType == ChConfig.Def_RewardType_ChampionFamilyDailyReward:
        GameLogic_FamilyWar.GetChampionFamilyDailyReward(curPlayer)
    # ÏÉħ֮ÕùʤÀû³¡Êý½±Àø
    elif rewardType == ChConfig.Def_RewardType_XMZZWinCnt:
        GameLogic_XMZZ.GetXMZZWinPrize(curPlayer, dataEx)
    # ÏÉÃËÿÈÕ¸£Àû½±Àø
    elif rewardType == ChConfig.Def_RewardType_FamilyDayAward:
        PlayerFamily.GetFamilyDayAward(curPlayer)
    # Íæ¼ÒµÈ¼¶½±Àø
    elif rewardType == ChConfig.Def_RewardType_LVAward:
        PlayerLVAward.GetPlayerLVAward(curPlayer, dataEx)
    # Ïɱ¦Ñ°Ö÷½±Àø
    elif rewardType == ChConfig.Def_RewardType_XBXZ:
        PlayerMagicWeapon.OnGetXBXZAward(curPlayer, dataEx)
    # Ê׳äÀñ°ü½±Àø
    elif rewardType == ChConfig.Def_RewardType_GoldGiftFirst:
        PlayerGoldGift.GetPlayerGoldGiftFirst(curPlayer, dataEx)
    # ÁìÈ¡¼«Æ·°×ÄÃ
    elif rewardType == ChConfig.Def_RewardType_FreeGoods:
        PlayerFreeGoods.OnGetFreeGoods(curPlayer, dataEx)
    # ÁìÈ¡Ïû·Ñ·µÀû½±Àø
    elif rewardType == ChConfig.Def_RewardType_CostRebate:
        PlayerCostRebate.OnGetCostRebateAward(curPlayer, dataEx, dataExStr)
    # ÁìÈ¡ÀۼƳäÖµ½±Àø
    elif rewardType == ChConfig.Def_RewardType_TotalRecharge:
        PlayerActTotalRecharge.OnGetTotalRechargeAward(curPlayer, dataEx, dataExStr)
    # ÁìÈ¡¶àÈÕÁ¬³äÁìÈ¡
    elif rewardType == ChConfig.Def_RewardType_ManyDayRecharge:
        PlayerActManyDayRecharge.OnGetManyDayRechargeAward(curPlayer, dataEx, dataExStr)
    # ÁìÈ¡µ¥±ÊÀÛ³äÁìÈ¡
    elif rewardType == ChConfig.Def_RewardType_SingleRecharge:
        PlayerActSingleRecharge.OnGetSingleRechargeAward(curPlayer, dataEx, dataExStr)
    # ÁìÈ¡boss¸´»î»î¶¯½±Àø
    elif rewardType == ChConfig.Def_RewardType_BossReborn:
        PlayerBossReborn.GetBossRebornActionAward(curPlayer, dataEx)
    # ÁìÈ¡ÏɽçÊ¢µä³äÖµ´óÀñ
    elif rewardType == ChConfig.Def_RewardType_FCRecharge:
        PlayerFairyCeremony.GetFCRechargeAward(curPlayer)
    # ÁìÈ¡ÏɽçÊ¢µäÈ«ÃñÀ´àË
    elif rewardType == ChConfig.Def_RewardType_FCParty:
        PlayerFairyCeremony.GetFCPartyAward(curPlayer, dataEx)
    # ÁìÈ¡·Ö°üÏÂÔØ½±Àø
    elif rewardType == ChConfig.Def_RewardType_DownLoad:
        GetDownloadAward(curPlayer, dataEx)
    # ÁìÈ¡ÐíÔ¸³Ø½±Àø
    elif rewardType == ChConfig.Def_RewardType_WishingWell:
        PlayerWishingWell.DoGetWishingAward(curPlayer)
    # ¹¦ÄÜ¿ªÆô½±Àø
    elif rewardType == ChConfig.Def_RewardType_OpenFunc:
        GameFuncComm.GetFuncOpenAward(curPlayer, dataEx)
    # ±ù¾§¿óÂöÐǼ¶½±Àø
    elif rewardType == ChConfig.Def_RewardType_IceLodeStar:
        GameLogic_IceLode.GetIceLodeStarAward(curPlayer, dataEx)
    # ÁìÈ¡ÖÜ¿ñ»¶»î¶¯½±Àø
    elif rewardType == ChConfig.Def_RewardType_WeekPartyAct:
        PlayerWeekParty.GetWeekPartyActionAward(curPlayer, dataEx, dataExStr)
    # ÁìÈ¡ÖÜ¿ñ»¶»ý·Ö½±Àø
    elif rewardType == ChConfig.Def_RewardType_WeekPartyPoint:
        PlayerWeekParty.GetWeekPartyPointAward(curPlayer, dataEx, dataExStr)
    # ÁìÈ¡µÇ¼½±Àø»î¶¯½±Àø
    elif rewardType == ChConfig.Def_RewardType_ActLoginAwardAct:
        PlayerActLogin.GetLoginAwardActionAward(curPlayer, dataEx, dataExStr)
    # ÁìÈ¡ÐÂÏɽçÊ¢µä³äÖµ´óÀñ
    elif rewardType == ChConfig.Def_RewardType_NewFairyCRecharge:
        PlayerNewFairyCeremony.GetFCRechargeAward(curPlayer)
    # ÁìÈ¡ÐÂÏɽçÊ¢µäÈ«ÃñÀ´àË
    elif rewardType == ChConfig.Def_RewardType_NewFairyCParty:
        PlayerNewFairyCeremony.GetFCPartyAward(curPlayer, dataEx)
    # ÁìÈ¡½ÚÈÕѲÀñ»î¶¯½±Àø
    elif rewardType == ChConfig.Def_RewardType_FeastWeekPartyAct:
        PlayerFeastWeekParty.GetFeastWeekPartyActionAward(curPlayer, dataEx, dataExStr)
    # ÁìÈ¡½ÚÈÕѲÀñ»ý·Ö½±Àø
    elif rewardType == ChConfig.Def_RewardType_FeastWeekPartyPoint:
        PlayerFeastWeekParty.GetFeastWeekPartyPointAward(curPlayer, dataEx, dataExStr)
    # ÁìÈ¡½ÚÈյǼ½±Àø
    elif rewardType == ChConfig.Def_RewardType_FeastLogin:
        PlayerFeastLogin.GetFeastLoginAward(curPlayer, dataEx)
    # ÁìÈ¡½ÚÈÕÓÎÀú½±Àø
    elif rewardType == ChConfig.Def_RewardType_FeastTravel:
        PlayerFeastTravel.GetFeastTravelAward(curPlayer, dataEx)
    # ÁìÈ¡µÇ¼»î¶¯½±Àø
    elif rewardType == ChConfig.Def_RewardType_ActLoginAwardNew:
        PlayerActLoginNew.OnGetActLoginAward(curPlayer, dataEx, dataExStr)
    # ÁìÈ¡¹ºÂò´ÎÊýÀñ°ü»î¶¯
    elif rewardType == ChConfig.Def_RewardType_ActBuyCountGift:
        PlayerActBuyCountGift.OnGetBuyCountGiftAward(curPlayer, dataEx, dataExStr)
    # ÁìÈ¡ÈÎÎñ»î¶¯½±Àø
    elif rewardType == ChConfig.Def_RewardType_ActTask:
        PlayerActTask.OnGetActTaskAward(curPlayer, dataEx, dataExStr)
    # ÁìÈ¡¿ç·þ³äÖµÅÅÐл´ï±ê½±Àø
    elif rewardType == ChConfig.Def_RewardType_CACTGBillboardDabiao:
        CrossActCTGBillboard.GetDabiaoAward(curPlayer, dataEx)
    # ¿ç·þÈ«Ãñ³äÖµ½±Àø
    elif rewardType == ChConfig.Def_RewardType_CAAllRecharge:
        CrossActAllRecharge.GetCrossActAllRechargeAward(curPlayer, dataEx)
    # ¿ç·þÑýħbossÉ˺¦½±Àø
    elif rewardType == ChConfig.Def_RewardType_CrossYaomoBossHurt:
        PlayerCrossYaomoBoss.GetCrossYaomoBossHurtAward(curPlayer, dataEx, tick)
    # ¹Å±¦ÌØÊâЧ¹ûÎïÆ·½±Àø
    elif rewardType == ChConfig.Def_RewardType_GubaoItemEff:
        PlayerGubao.GetGubaoItemEffAward(curPlayer, dataEx, dataExStr)
    # ³É¾Í»ý·Ö½±Àø
    elif rewardType == ChConfig.Def_RewardType_SuccessScore:
        PlayerSuccess.GetSuccessScoreAward(curPlayer, dataEx)
    # ÂòÒ»ËͶà»î¶¯Ãâ·Ñ½±Àø
    elif rewardType == ChConfig.Def_RewardType_BuyOne:
        PlayerActBuyOne.GetBuyOneFreeAward(curPlayer, dataEx, dataExStr)
    # ÏÉÃ˳äÖµ»¥Öú»î¶¯½±Àø
    elif rewardType == ChConfig.Def_RewardType_FamilyCTGAssist:
        PlayerActFamilyCTGAssist.GetFamilyCTGAssistAward(curPlayer, dataEx, dataExStr)
    # ÏÉÃ˹¥³ÇÕ½»î¶¯½±Àø
    elif rewardType == ChConfig.Def_RewardType_FamilyGCZ:
        PlayerActFamilyGCZ.GetFamilyGCZAward(curPlayer, dataEx, tick)
    # ÌìµÀÊ÷½±Àø
    elif rewardType == ChConfig.Def_RewardType_TiandaoTree:
        PlayerXiangong.GetTiandaoTreeAward(curPlayer, dataEx)
    # Ñ°±¦ÀۼƴÎÊý½±Àø
    elif rewardType == ChConfig.Def_RewardType_TreasureCntAward:
        PlayerTreasure.GetTreasureCntAward(curPlayer, dataEx, dataExStr)
    # ÂֻصÀø
    elif rewardType == ChConfig.Def_RewardType_LunhuidianAward:
        PlayerActLunhuidian.GetLunhuidianAward(curPlayer, dataEx, dataExStr)
    #çÎç¿ÆæÓöÁìÈ¡
    elif rewardType == ChConfig.Def_RewardType_FairyAdventuresAward:
        PlayerFairyDomain.GetFairyAdventuresAward(curPlayer, dataEx, dataExStr)
    #ÀúÊ·ÀۼƳäÖµÁìÈ¡
    elif rewardType == ChConfig.Def_RewardType_HistoryChargeAward:
        PlayerGoldGift.OnGetHistoryRechargeAward(curPlayer, dataEx)
    #ÔÚÏßÌØ»Ý³äÖµ¶îÍâ½±Àø
    elif rewardType == ChConfig.Def_RewardType_OnlineRechargeTH:
        PlayerCoin.OnGetOnlineRechargeTH(curPlayer)
    #ÌìÐÇËþÈ«·þÌôÕ½²ãÁì½±
    elif rewardType == ChConfig.Def_RewardType_SkyTowerServerChallengeReward:
        GameLogic_SkyTower.OnGetSkyTowerServerChallengeReward(curPlayer, dataEx, dataExStr)
    #´´½Ç½±Àø
    elif rewardType == ChConfig.Def_RewardType_CreateRole:
        OnGetCreateRoleAward(curPlayer)
    #×Ô¶¨Òå½±Àø
    elif rewardType == ChConfig.Def_RewardType_CustomAward:
        PlayerCustomAward.OnGetCustomAward(curPlayer, dataEx)
    #¾³½ç¶É½ÙÈÎÎñÌõ¼þ½±Àø
    elif rewardType == ChConfig.Def_RewardType_RealmLVUpTask:
        PlayerPrestigeSys.GetRealmLVUpTaskAward(curPlayer, dataEx)
    #ÏÉÃËbossÉ˺¦½±Àø
    elif rewardType == ChConfig.Def_RewardType_FamilyBossHurt:
        GameLogic_FamilyBoss.GetFamilyBossHurtAward(curPlayer, dataEx, dataExStr)
    #´ò°üÖ±¹ºÀñ°ü½±Àø
    elif rewardType == ChConfig.Def_RewardType_DailyPackBuyGift:
        PlayerGoldGift.GetDailyPackBuyGift(curPlayer, dataEx)
    #ÈÎÎñ½±Àø
    elif rewardType == ChConfig.Def_RewardType_Task:
        PlayerTask.GetTaskAward(curPlayer, dataEx)
    #Õ½Áî½±Àø
    elif rewardType == ChConfig.Def_RewardType_Zhanling:
        PlayerZhanling.GetZhanlingReward(curPlayer, dataEx, dataExStr)
    #¸£µØ¾Û±¦Åè½±Àø
    elif rewardType == ChConfig.Def_RewardType_MineTreasure:
        PlayerMineArea.GetMineTreasureAward(curPlayer, dataEx)
    #Íæ·¨Ç°Õ°½±Àø
    elif rewardType == ChConfig.Def_RewardType_GameNotice:
        OnGiveAwardByClient(curPlayer, rewardType, ChConfig.Def_PDict_GameNoticeAwardState, IpyGameDataPY.GetFuncEvalCfg("GameNoticeReward", 1))
    #ÿÈÕ·ÖÏí½±Àø34
    elif rewardType == ChConfig.Def_RewardType_ShareGame:
        OnGiveAwardByClient(curPlayer, rewardType, ChConfig.Def_PDict_ShareGameAwardState, IpyGameDataPY.GetFuncEvalCfg("ShareGameReward", 1))
    #ÓÎÏ·ºÃÆÀ½±Àø35
    elif rewardType == ChConfig.Def_RewardType_GoodGame:
        OnGiveAwardByClient(curPlayer, rewardType, ChConfig.Def_PDict_GoodGameAwardState, IpyGameDataPY.GetFuncEvalCfg("GoodGameReward", 1))
    #ÓÎÏ·µãÔÞ½±Àø67
    elif rewardType == ChConfig.Def_RewardType_LikeGame:
        OnGiveAwardByClient(curPlayer, rewardType, ChConfig.Def_PDict_LikeGameAwardState, IpyGameDataPY.GetFuncEvalCfg("GoodGameReward", 4))
    #ÁìÈ¡¿ª·þÿÈÕ½±Àø
    elif rewardType == ChConfig.Def_RewardType_OpenServerDailyAward:
        openServerDay = GameWorld.GetGameWorld().GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_ServerDay) + 1
        openServerDayLimit = IpyGameDataPY.GetFuncCfg("OpenServerDailyAward", 1)
        if openServerDay >= openServerDayLimit:
            OnGiveAwardByClient(curPlayer, rewardType, ChConfig.Def_PDict_OpenSererDailyAward, IpyGameDataPY.GetFuncEvalCfg("OpenServerDailyAward", 2), "OpenServerDailyAward")
    #ÀÛ³äÿÈÕ½±Àø
    elif rewardType == ChConfig.Def_RewardType_RechargeDayAward:
        OnGetRechargeDayAward(curPlayer, rewardType)
    return
    
def OnGetRechargeDayAward(curPlayer, rewardType):
    ## ÁìÈ¡ÀÛ³äÿÈÕ½±Àø£¬È¡×î¸ßµµ
    realTotal = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CTGRealTotal)
    awardCoinRecord = awardCoin = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_RechargeDayAward) # ÒÑÁì½±µµÎ»Öµ
    awardItemList = []
    dayAwardDict = IpyGameDataPY.GetFuncEvalCfg("RechargeDayAward", 1, {})
    for needCoinStr, itemList in dayAwardDict.items():
        needCoin = int(needCoinStr)
        if realTotal >= needCoin and needCoin > awardCoin:
            awardCoin = needCoin
            awardItemList = itemList
    GameWorld.DebugLog("ÁìÈ¡ÀÛ³äÿÈÕ×î¸ßµµ½±Àø: awardCoinRecord=%s,realTotal=%s,awardCoin=%s,%s" % (awardCoinRecord, realTotal, awardCoin, awardItemList), curPlayer.GetPlayerID())
    if not awardItemList:
        return
    if not ItemCommon.GiveAwardItem(curPlayer, awardItemList, "RechargeDayAward"):
        return
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_RechargeDayAward, awardCoin)
    Sync_RewardGetRecordInfo(curPlayer, rewardType, awardCoin)
    return
 
## ÁìÈ¡´´½Ç½±Àø
def OnGetCreateRoleAward(curPlayer):
    if curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CreateRoleAwardState):
        GameWorld.DebugLog("ÒÑÁìÈ¡´´½Ç½±Àø!")
        return
    
    if not ItemCommon.GiveAwardItem(curPlayer, IpyGameDataPY.GetFuncEvalCfg("CreateRoleAward")):
        return
    
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CreateRoleAwardState, 1)
    Sync_CreateRoleAwardInfo(curPlayer)
    return
 
## Í¨Öª´´½ÇÁì½±¼Ç¼
def Sync_CreateRoleAwardInfo(curPlayer):
    sendPack = ChPyNetSendPack.tagMCCreateRoleAwardState()
    sendPack.Clear()
    sendPack.GetState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CreateRoleAwardState)
    NetPackCommon.SendFakePack(curPlayer, sendPack)
    return
 
def OnGiveAwardByClient(curPlayer, rewardType, dictKey, awardCfg, eventName=""):
    ## ·¢·Åǰ¶Ë¿ØÖƵĽ±Àø£¬ºó¶ËÖ»¸ºÔ𷢷ޱÀø£¬ÊÇ·ñ¿ÉÁ콱ǰ¶Ë×ÔÐÐÅжÏ
    if curPlayer.NomalDictGetProperty(dictKey):
        GameWorld.DebugLog("ÒÑÁìÈ¡¹ý¸Ã½±Àø! rewardType=%s, dictKey=%s" % (rewardType, dictKey))
        return
    if not ItemCommon.GiveAwardItem(curPlayer, awardCfg, eventName):
        return
    PlayerControl.NomalDictSetProperty(curPlayer, dictKey, 1)
    Sync_RewardGetRecordInfo(curPlayer, rewardType, 1)
    return
 
## Í¨Öª¸÷½±ÀøÁìÈ¡¼Ç¼ÐÅÏ¢
#  @param curPlayer: Íæ¼ÒʵÀý
#  @param rewardType: ½±ÀøÀàÐÍ
#  @param rewardGetRecord: Áì½±¼Ç¼
#  @return None
def Sync_RewardGetRecordInfo(curPlayer, rewardType, rewardGetRecord):
    sendPack = ChPyNetSendPack.tagMCPlayerRewardGetRecord()
    sendPack.Clear()
    sendPack.RewardType = rewardType
    sendPack.RewardGetRecord = rewardGetRecord
    NetPackCommon.SendFakePack(curPlayer, sendPack)
    return
 
##A5 1A Íæ¼Ò×Ô¶¯Õ½¶·ÉèÖÃÐÅÏ¢´¢´æ#tagCMSaveAutoFightSetting
#  @param index, clientData, tick
#  @return None
def OnSaveAutoFightSetting(index, clientData, tick):
    curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
    settingDict = eval(clientData.Data) #×ֵ䱣´æ
    #×Ô¶¯Õ½¶·ÅäÖÃ
    #¼¼ÄÜÊý
    BasicSkillCount, AreaSkillCount, BuffSkillCount = ReadChConfig.GetEvalChConfig("AutoFightSetting")
    
    BasicSkillList = settingDict.get("BasicSkill",[0]*BasicSkillCount)    
    Key = "BasicSkill"
    for ValueIndex, Value in enumerate(BasicSkillList):
        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_AutoFightSetting%(Key, ValueIndex), Value)
        
    AreaSkillList = settingDict.get("AreaSkill",[0]*AreaSkillCount)
    Key = "AreaSkill"
    for ValueIndex, Value in enumerate(AreaSkillList):
        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_AutoFightSetting%(Key, ValueIndex), Value)
        
    BuffSkillList = settingDict.get("BuffSkill",[0]*BuffSkillCount)   
    Key = "BuffSkill"
    for ValueIndex, Value in enumerate(BuffSkillList):
        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_AutoFightSetting%(Key, ValueIndex), Value) 
    
    Key = "HPPackagePercent"
    Value = settingDict.get(Key,0)
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_AutoFightSetting%(Key, 0), Value) 
    return 
 
## Í¨Öª¿Í»§¶Ë×Ô¶¯Õ½¶·ÅäÖÃ
#  @param curPlayer
#  @return None
def Sync_AutoFightSetting(curPlayer):  
    BasicSkillCount, AreaSkillCount, BuffSkillCount = ReadChConfig.GetEvalChConfig("AutoFightSetting")
    settingDict = {}
    
    Key = "BasicSkill"
    BasicSkillList = []
    for ValueIndex in xrange(BasicSkillCount):
        Value = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_AutoFightSetting%(Key, ValueIndex), 0)
        BasicSkillList.append(Value)
    settingDict[Key] = BasicSkillList   
    
    Key = "AreaSkill"
    AreaSkillList = []
    for ValueIndex in xrange(AreaSkillCount):
        Value = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_AutoFightSetting%(Key, ValueIndex), 0)
        AreaSkillList.append(Value)
    settingDict[Key] = AreaSkillList  
    
    Key = "BuffSkill"
    BuffSkillList = []
    for ValueIndex in xrange(BuffSkillCount):
        Value = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_AutoFightSetting%(Key, ValueIndex), 0)
        BuffSkillList.append(Value)   
    settingDict[Key] = BuffSkillList  
     
    Key = "HPPackagePercent"
    Value = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_AutoFightSetting%(Key, 0), 0)
    settingDict[Key] = Value 
    
    #½«ÉèÖÃÄÚÈÝ֪ͨµ½¿Í»§¶Ë
    sendPack = ChPyNetSendPack.tagMCAutoFightSetting()
    sendPack.Clear()
    sendPack.Data = "%s"%settingDict
    sendPack.Size = len(sendPack.Data)
    NetPackCommon.SendFakePack(curPlayer, sendPack) 
    return 
 
## bossÉËѪÁбí·â°ü²éѯ
#  @param curPlayer
#  @return None
def OnQueryBossHurtList(index, clientData, tick):
    curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
    if not curPlayer:
        return
    BossHurtMng.OnQueryBossHurtList(curPlayer, clientData)
    return
 
 
## µØÍ¼NPCÐÅÏ¢²éѯ·â°ü
#  @param curPlayer
#  @return None
def OnQueryMapNPCInfo(index, clientData, tick):
    curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
    if not curPlayer:
        return
    
    # ²éѯ¼ä¸ô¿ØÖÆ
    if not clientData.IsNoTimeLimit:
        tickType = ChConfig.TYPE_Player_Tick_QueryMapNPCInfo
        if tick - curPlayer.GetTickByType(tickType) <= ChConfig.TYPE_Player_Tick_Time[tickType]:
            GameWorld.DebugLog("OnQueryMapNPCInfo ²éѯ¹ýÓÚÆµ·±£¡")
            return
        
        curPlayer.SetTickByType(tickType, tick)
    
    tagMapID = clientData.MapID
    tagLineID = clientData.LineID
    queryNPCStr = clientData.NPCIDList
    npcIDList = []
    if queryNPCStr:
        try:       
            npcIDList = eval(clientData.NPCIDList)
        except BaseException:
            GameWorld.ErrLog("OnQueryMapNPCInfo, npcIDList=%s" % clientData.NPCIDList)
            return
        
        if not isinstance(npcIDList, list):
            GameWorld.ErrLog("OnQueryMapNPCInfo, npcIDList=%s is not list£¡" % str(npcIDList))
            return
    
    GameWorld.DebugLog("OnQueryMapNPCInfo tagMapID=%s,tagLineID=%s,npcIDList=%s" 
                       % (tagMapID, tagLineID, str(npcIDList)))
    
    curMapID = GameWorld.GetMap().GetMapID()
    
    # Èç¹ûÊÇͬÕŵØÍ¼£¬Ö±½Ó²éѯ֪ͨ
    if curMapID == tagMapID:
        npcInfoDict = NPCCommon.GetNPCInfo(npcIDList, tick)
        gameWorld = IPY_GameWorld.IPY_GameWorld(tagLineID)
        playerManager = gameWorld.GetMapCopyPlayerManagerByFbIndex(tagLineID)
        playerCnt = 0
        if playerManager:
            playerCnt = playerManager.GetPlayerCount()
        GameWorld.DebugLog("    Í¬µØÍ¼²éѯcurMapID=%s,tagLineID=%s,playerCnt=%s,npcInfoDict=%s" 
                           % (curMapID, tagLineID, playerCnt, str(npcInfoDict)))
        NPCCommon.SyncNPCInfo(curPlayer, tagMapID, playerCnt, npcInfoDict)
    else:
        # ÇëÇóGameServerÄ¿±êµØÍ¼NPCÐÅÏ¢
        sendMsg = "%s" % str([tagMapID, tagLineID, npcIDList])
        curPlayer.GameServer_QueryPlayerByID(ChConfig.queryType_NPCInfo, 0,
                                 'NPCInfo', sendMsg, len(sendMsg))
    return
 
 
#// A2 27 ²éѯµØÍ¼NPCÊýÁ¿ÐÅÏ¢ #tagCMQueryNPCCntInfo
#
#struct tagCMQueryNPCCntInfo
#{
#    tagHead        Head;
#    DWORD        MapID; // Ä¿±êµØÍ¼ID
#    WORD        LineID; // Ïß·ID
#    BYTE        IsNoTimeLimit;//ÊÇ·ñûÓвéѯʱ¼äÏÞÖÆ,ĬÈÏÓÐÏÞÖÆ
#    BYTE        NPCIDListLen;
#    char        NPCIDList[NPCIDListLen]; // ÐèÒª²éѯµÄNPCIDÁбí
#};
def OnQueryMapNPCCntInfo(index, clientData, tick):
    curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
    if not curPlayer:
        return
    
    # ²éѯ¼ä¸ô¿ØÖÆ
    if not clientData.IsNoTimeLimit:
        if not GameWorld.CheckPlayerTick(curPlayer, ChConfig.TYPE_Player_Tick_QueryMapNPCInfo, tick):
            GameWorld.DebugLog("OnQueryMapNPCCntInfo ²éѯ¹ýÓÚÆµ·±£¡")
            return
       
    tagMapID = clientData.MapID
    tagLineID = clientData.LineID
    queryNPCStr = clientData.NPCIDList
    npcIDList = []
    if queryNPCStr:
        try:       
            npcIDList = eval(clientData.NPCIDList)
        except BaseException:
            GameWorld.ErrLog("OnQueryMapNPCCntInfo, npcIDList=%s" % clientData.NPCIDList)
            return
        
        if not isinstance(npcIDList, list):
            GameWorld.ErrLog("OnQueryMapNPCCntInfo, npcIDList=%s is not list£¡" % str(npcIDList))
            return
    
    GameWorld.DebugLog("OnQueryMapNPCCntInfo tagMapID=%s,tagLineID=%s,npcIDList=%s" 
                       % (tagMapID, tagLineID, str(npcIDList)))
    
    curMapID = GameWorld.GetMap().GetMapID()
    
    # Èç¹ûÊÇͬÕŵØÍ¼£¬Ö±½Ó²éѯ֪ͨ
    if curMapID == tagMapID:
        npcInfoDict = NPCCommon.GetNPCCntInfo(npcIDList, tick)
 
        GameWorld.DebugLog("    Í¬µØÍ¼²éѯcurMapID=%s,tagLineID=%s,npcInfoDict=%s" 
                           % (curMapID, tagLineID, str(npcInfoDict)))
        NPCCommon.SyncNPCCntInfo(curPlayer, tagMapID, npcInfoDict)
    else:
        # ÇëÇóGameServerÄ¿±êµØÍ¼NPCÐÅÏ¢
        sendMsg = "%s" % str([tagMapID, tagLineID, npcIDList])
        curPlayer.GameServer_QueryPlayerByID(ChConfig.queryType_NPCCnt, 0,
                                 'NPCCnt', sendMsg, len(sendMsg))
    return
 
 
# ¸ÄΪ¿Í»§¶ËÖ÷¶¯ÇëÇótick  A1 02
def QueryWorldTick(index, clientData, tick):
    curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
    curPlayer.Sync_ClientTick()
    return
 
 
## Í¬²½Ê±¼ä
#  @param curPlayer 
#  @param tick Ê±¼ä´Á
#  @return None
def Sync_PyServerDataTimeToClient(curPlayer):
    # ·þÎñÆ÷ʱ¼ä
    serverTime = GameWorld.GetCurrentTime()
    if not serverTime:
        return
    
    serverDateTime = ChPyNetSendPack.tagServerDateTime()
    serverDateTime.Clear()
    serverDateTime.Year = serverTime.year
    serverDateTime.Month = serverTime.month
    serverDateTime.Day = serverTime.day
    serverDateTime.Hour = serverTime.hour
    serverDateTime.Minute = serverTime.minute
    serverDateTime.Second = serverTime.second
    serverDateTime.MicSecond = serverTime.microsecond
    serverDateTime.CrossServerTime = GameWorld.GetCrossServerTimeStr()
    
    # Í¨Öª¿Í»§¶Ëͬ²½Ê±¼ä
    NetPackCommon.SendFakePack(curPlayer, serverDateTime)
    return
 
## Í¨Öª¿ª·þÌìÊý
#  @param curPlayer: Íæ¼ÒʵÀý
#  @return: None
def Sync_OpenServerDay(curPlayer):
    serverTime = GameWorld.GetCurrentTime()
    if not serverTime:
        return
    
    clientPack = ChPyNetSendPack.tagMCOpenServerDay()
    clientPack.Day = DBDataMgr.GetEventTrigMgr().GetValue(ShareDefine.Def_ServerDay)
    clientPack.IsMixServer = DBDataMgr.GetEventTrigMgr().GetValue(ShareDefine.Def_IsMixServer)
    clientPack.MixDay = DBDataMgr.GetEventTrigMgr().GetValue(ShareDefine.Def_MixServerDay)
    clientPack.OpenWeekday = DBDataMgr.GetEventTrigMgr().GetValue(ShareDefine.Def_OpenServerWeekday)
    clientPack.NowYear = serverTime.year
    clientPack.NowMonth = serverTime.month
    clientPack.NowDay = serverTime.day
    clientPack.NowHour = serverTime.hour
    clientPack.NowMinute = serverTime.minute
    clientPack.NowSecond = serverTime.second
    clientPack.NowMicSecond = serverTime.microsecond
    clientPack.WeekOfYear = GameWorld.GetWeekOfYear()
    NetPackCommon.SendFakePack(curPlayer, clientPack)
    
    #¾É°üÏȱ£Áô£¬Ö®ºóɾ³ý
    gw = GameWorld.GetGameWorld()
    packData = ChPyNetSendPack.tagOpenServerDay()
    packData.Clear()
    packData.Day = gw.GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_ServerDay)
    packData.IsMixServer = gw.GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_IsMixServer)
    packData.MixDay = gw.GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_MixServerDay)
    packData.OpenWeekday = gw.GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_OpenServerWeekday)
    packData.NowYear = serverTime.year
    packData.NowMonth = serverTime.month
    packData.NowDay = serverTime.day
    packData.NowHour = serverTime.hour
    packData.NowMinute = serverTime.minute
    packData.NowSecond = serverTime.second
    packData.NowMicSecond = serverTime.microsecond
    packData.WeekOfYear = GameWorld.GetWeekOfYear()
    NetPackCommon.SendFakePack(curPlayer, packData)
    return
 
#===============================================================================
# //B4 09 Íæ¼ÒÒÆ¶¯ # tagCMPyMove
# struct    tagCMPyMove
# {
#    tagHead        Head;
#    WORD        Dir;    // ³¯Ïò
#    WORD        ClientPosX;    // ¿Í»§¶Ë×ø±êX ºÁÃ×
#    WORD        ClientPosY;    // ¿Í»§¶Ë×ø±êY 
#    WORD        SeverPosX;    // ·þÎñ¶Ë×ø±êX ¸ñ×Ó
#    WORD        SeverPosY;    // ·þÎñ¶Ë×ø±êY
#    DWORD        WorldTick;
#    BYTE        MoveType;    // 0 Í£Ö¹ 1ÒÆ¶¯
# };
#===============================================================================
 
# python´¦ÀíеÄÒÆ¶¯·½Ê½
def PYPlayerMove(index, clientPack, tick):
    curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
    
    #·ÀÍâ¹Ò ²»¿ÉÒÆ¶¯
    if curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_AutoCheckHack_State) \
                                      == ChConfig.Def_AutoCheck_State_Danger:
        return
 
    if not PYPlayerNormalMove(curPlayer, clientPack, tick):
        posX, posY = curPlayer.GetPosX(), curPlayer.GetPosY()
        
        if GameWorld.GetMap().CanMove(posX, posY) != True:
            resultPos = GameMap.GetEmptyPlaceInArea(posX, posY, 5)
    
            if resultPos.GetPosX() == posX and resultPos.GetPosY() == posY:
                GameWorld.ErrLog("Íæ¼Ò×ø±ê¿¨ËÀ %s %s"%(posX, posY))
                return
            posX = resultPos.GetPosX()
            posY = resultPos.GetPosY() 
            
        curPlayer.ResetPos(posX, posY)
 
MoveDistCalcTick = "PYMoveDistCalcTick"
MoveDistSum = "PYMoveDistSum"
def PYPlayerNormalMove(curPlayer, clientPack, tick) :
    
    #Íæ¼ÒÒÆ¶¯Í¨Óüì²é
    if not __CheckPlayerCanMove(curPlayer):
        return True
    
    #·â°ü²ÎÊý
    moveDir = clientPack.Dir    # Òƶ¯·½Ïò
    clientPosX = clientPack.ClientPosX     #ºÁÃ× Ö»×÷Ϊ»Ø°üÓÃ
    clientPosY = clientPack.ClientPosY
    sendPack_SeverPosX = clientPack.SeverPosX      #¸ñ×Ó
    sendPack_SeverPosY = clientPack.SeverPosY
    sendPack_WorldTick = clientPack.WorldTick
    moveType = clientPack.MoveType
    
    lastMoveTick = curPlayer.GetClientMoveTick()
    
    if moveType != 0 and sendPack_WorldTick - lastMoveTick < 50:
        GameWorld.DebugLog("move ·¢°üÌ«¿ì ÊÕ°ü%s - ÉÏÒ»´Î%s"%(sendPack_WorldTick, lastMoveTick))
        # ·¢°ü¹ý¿ì
        return True
    
    #ÏÈÑé֤Ŀ±êµãÊÇ·ñºÏ·¨
    if not GameWorld.GetMap().CanMove(sendPack_SeverPosX, sendPack_SeverPosY):
        GameWorld.DebugLog("ÒÆ¶¯Õϰ­µã")
        return False
    
    if curPlayer.GetPosX() == sendPack_SeverPosX and curPlayer.GetPosY() == sendPack_SeverPosY:
        curPlayer.SetDict(MoveDistCalcTick, tick)
        curPlayer.SetDict(MoveDistSum, 0)
        if moveType != 0 and sendPack_WorldTick - lastMoveTick < 222:
            # ¼õÉÙͬ²½ÂÊ
            return True
        curPlayer.SetClientMoveTick(sendPack_WorldTick)
        #GameWorld.DebugLog("ûÓиñ×ÓÒÆ¶¯µÄÒ²¹ã²¥")
        # Ã»Óиñ×ÓÒÆ¶¯µÄÒ²¹ã²¥
        PyNotifyPlayerMove(curPlayer, moveDir, clientPosX, clientPosY, sendPack_SeverPosX, sendPack_SeverPosY, moveType)
        return True
    
    
    #---¸±±¾µØÍ¼Òƶ¯¼ì²é---
    if GameWorld.GetMap().GetMapFBType() != IPY_GameWorld.fbtNull:
        if not FBLogic.DoFBCanMove(curPlayer, sendPack_SeverPosX, sendPack_SeverPosY, tick):
            return False
    
    #---Õý³£Òƶ¯---
    vehicle = curPlayer.GetPlayerVehicle()
    
    if vehicle not in [IPY_GameWorld.pvNull, IPY_GameWorld.pvHorse]:
        #GameWorld.ErrLog("²»ÄÜÒÆ¶¯, ½»Í¨¹¤¾ß²»Ã÷ %d" % (vehicle), curPlayer.GetID())
        return False
    
 
    #УÑé¿Í»§¶Ëʱ¼ä
    if not PlayerControl.PlayerMoveCheckClientWorldTick(curPlayer, sendPack_WorldTick, sendPack_SeverPosX, sendPack_SeverPosY):
        curPlayer.Sync_ClientTick()
        return False
 
    dist = GameWorld.GetDist(curPlayer.GetPosX(), curPlayer.GetPosY(), sendPack_SeverPosX, sendPack_SeverPosY)
    if dist > 4:
        # ¶ª°ü À­»Ø
        GameWorld.DebugLog("ÒÆ¶¯¾àÀë¹ý´ó£¬ Íæ¼Ò×ø±ê %s-%s  ÊÕ°ü %s-%s"%(curPlayer.GetPosX(), curPlayer.GetPosY(), 
                                                           sendPack_SeverPosX, sendPack_SeverPosY), curPlayer.GetID())
        return False
    
    calcTick = curPlayer.GetDictByKey(MoveDistCalcTick)
    distSum = min(curPlayer.GetDictByKey(MoveDistSum) + dist, 100000000)
    curPlayer.SetDict(MoveDistSum, distSum)
    if distSum > IpyGameDataPY.GetFuncCfg("PyMoveCheck", 1):
        speed = curPlayer.GetSpeed() # Òƶ¯Ò»¸ñËùÐèºÁÃë
        passCalcTick = tick - calcTick
        needTick = distSum * speed
        checkNeedTick = needTick * IpyGameDataPY.GetFuncCfg("PyMoveCheck", 2) / 100.0
        if passCalcTick < checkNeedTick:
            GameWorld.DebugLog("    dist=%s,distSum=%s,speed=%s,needTick=%s, ËùÐèÒÆ¶¯Ê±¼äÒì³£ passCalcTick(%s) < (%s)" 
                               % (dist, distSum, speed, needTick, passCalcTick, checkNeedTick), curPlayer.GetID())
            return False
        #GameWorld.DebugLog("    dist=%s,distSum=%s,speed=%s,needTick=%s, ÑéÖ¤ÒÆ¶¯Ê±¼äÕý³£  passCalcTick(%s) < (%s)" 
        #                   % (dist, distSum, speed, needTick, passCalcTick, checkNeedTick), curPlayer.GetID())
        curPlayer.SetDict(MoveDistCalcTick, tick)
        curPlayer.SetDict(MoveDistSum, 0)
        
    #2010/04/30 Òƶ¯ÐÞ¸ÄΪȫC++¿ØÖÆ, Python״̬»úÉèÖÃΪ¿ÕÏÐ(Çå¿Õ²É¼¯µÈ״̬)
    PlayerControl.ChangePlayerAction(curPlayer, IPY_GameWorld.paNull)
    #ɾ³ýÓÐÏÞÎÞµÐBUFF
    #PlayerControl.DelLimitSuperBuff(curPlayer, tick)
 
    curPlayer.ChangePos(sendPack_SeverPosX, sendPack_SeverPosY)
    PyNotifyPlayerMove(curPlayer, moveDir, clientPosX, clientPosY, sendPack_SeverPosX, sendPack_SeverPosY, moveType)
    curPlayer.SetClientMoveTick(sendPack_WorldTick)
    
    # ºóÃæ±ØÐë·µ»ØTrue
    fightPet = curPlayer.GetPetMgr().GetFightPet()
    if fightPet:
        #³öÕ½³èÎïÍ¬Ê±ÒÆ¶¯
        if moveType == 0 or tick - fightPet.GetActionTick() > 300:
    
            PetControl.FightPetFollowMove(curPlayer,sendPack_SeverPosX, sendPack_SeverPosY)
            fightPet.SetCurAction(IPY_GameWorld.laNPCNull)
            
    return True
 
 
#===============================================================================
# //B4 0A Íæ¼ÒÒÆ¶¯ #tagMCPYPlayerMove
# struct    tagMCPYPlayerMove
# {
#    tagHead        Head;
#    WORD        Dir;    // ³¯Ïò
#    WORD        ClientPosX;    // ¿Í»§¶Ë×ø±êX ºÁÃ×
#    WORD        ClientPosY;    // ¿Í»§¶Ë×ø±êY
#    WORD        SeverPosX;    // ·þÎñ¶Ë×ø±êX ¸ñ×Ó
#    WORD        SeverPosY;    // ·þÎñ¶Ë×ø±êY
#    DWORD        ObjID;
#    BYTE        ObjType;
#    WORD        Speed;
#    BYTE        MoveType;    // 0 Í£Ö¹ 1ÒÆ¶¯
# };
#===============================================================================
def PyNotifyPlayerMove(curPlayer, moveDir, clientPosX, clientPosY, posX, posY, moveType):
    sendPack = ChPyNetSendPack.tagMCPYPlayerMove()
    
    sendPack.Clear()
    sendPack.ObjID = curPlayer.GetID()
    sendPack.ObjType = IPY_GameWorld.gotPlayer
    sendPack.Dir = moveDir
    sendPack.ClientPosX = clientPosX
    sendPack.ClientPosY = clientPosY
    sendPack.SeverPosX = posX
    sendPack.SeverPosY = posY
    sendPack.Speed = curPlayer.GetSpeed()
    sendPack.MoveType = moveType
    # NotifyAll ×ö¹ýÂË»òÕßÊýÁ¿´¦Àí
    PlayerControl.PyNotifyAll(curPlayer, sendPack, False, 0)
    return
 
def GiveDownloadPatchAward(curPlayer):
    ## ·¢·ÅÏÂÔØ²¹¶¡°ü½±Àø
    playerID = curPlayer.GetPlayerID()
    patchAwardNum = IpyGameDataPY.GetFuncCfg('DownReward', 4)
    curAwardNum = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_DownloadPatchAward)
    if curAwardNum == patchAwardNum:
        GameWorld.DebugLog("ÒÑ·¢·ÅÏÂÔØ²¹¶¡°ü½±Àø! curAwardNum(%s) == patchAwardNum(%s)" % (curAwardNum, patchAwardNum), playerID)
        return
    
    awardItemList = IpyGameDataPY.GetFuncEvalCfg('DownReward', 3)
    if not awardItemList:
        return
    
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_DownloadPatchAward, patchAwardNum)
    GameWorld.DebugLog("·¢·Å²¹¶¡°üÏÂÔØ½±Àø: curAwardNum=%s,patchAwardNum=%s" % (curAwardNum, patchAwardNum), playerID)
    PlayerControl.SendMailByKey("DownloadPatchAward", [playerID], awardItemList)
    return
 
def GetDownloadAward(curPlayer, dataEx):
    ##·Ö°üÏÂÔØ½±Àø dataEx 0Ö±½ÓÁìÈ¡ 1·¢Óʼþ
    playerID = curPlayer.GetPlayerID()
    downloadAwardNum = IpyGameDataPY.GetFuncCfg('DownReward', 5)
    curAwardNum = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_DownloadAwardState)
    if curAwardNum == downloadAwardNum:
        GameWorld.DebugLog("ÒÑÁìÈ¡·Ö°ü½±Àø! curAwardNum(%s) == downloadAwardNum(%s)" % (curAwardNum, downloadAwardNum), playerID)
        return
    
    awardItemList = IpyGameDataPY.GetFuncEvalCfg('DownReward', 1)
    if not awardItemList:
        return
    
    # ¼ì²é±³°ü
    if dataEx == 0:
        needSpace = len(awardItemList)
        packSpace = ItemCommon.GetItemPackSpace(curPlayer, IPY_GameWorld.rptItem, needSpace)
        if needSpace > packSpace:
            PlayerControl.NotifyCode(curPlayer, "GeRen_chenxin_998371")
            return
        
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_DownloadAwardState, downloadAwardNum)
    GameWorld.DebugLog("ÁìÈ¡·Ö°üÏÂÔØ½±Àø: curAwardNum=%s,downloadAwardNum=%s" % (curAwardNum, downloadAwardNum), playerID)
    if dataEx == 1:
        PlayerControl.SendMailByKey('SubpackageDownload', [curPlayer.GetID()], awardItemList)
    else:
        for itemID, itemCnt, isBind in awardItemList:
            ItemControler.GivePlayerItem(curPlayer, itemID, itemCnt, 0, [IPY_GameWorld.rptItem])
    SyncPackDownloadAward(curPlayer)
    return
 
def SyncPackDownloadAward(curPlayer):
    #·Ö°üÏÂÔØ½±Àø¼Ç¼֪ͨ
    downloadAwardNum = IpyGameDataPY.GetFuncCfg('DownReward', 5)
    sendPack = ChPyNetSendPack.tagMCPackDownloadRecord()
    sendPack.Clear()
    sendPack.Record = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_DownloadAwardState) == downloadAwardNum
    NetPackCommon.SendFakePack(curPlayer, sendPack)
    return
 
def NotifyPlayerMove(curPlayer, posX, posY, npcID=0):
    '''֪ͨǰ¶ËÏòij¸öµãÒÆ¶¯
                ÕâÀïǰ¶Ë¿ÉÄÜÐèÒªÕë¶Ôij´ÎÒÆ¶¯×ö¶îÍâ´¦Àí£¬±ÈÈçÒÆ¶¯µ½Ä³¸öµãºóÐèÒª×Ô¶¯Õ½¶·µÈ
                ËùÒÔÕâÀïÖ»×ö֪ͨǰ¶Ë¿ÉÒÔÏòij¸öµãÒÆ¶¯£¬×îÖÕÒÆ¶¯ÓÉǰ¶Ë·¢Æð
    '''
    sendPack = ChPyNetSendPack.tagMCNotifyPlayerMove()
    sendPack.Clear()
    sendPack.PosX = posX
    sendPack.PosY = posY
    sendPack.NPCID = npcID
    NetPackCommon.SendFakePack(curPlayer, sendPack)
    return
 
#// B4 0E Íæ¼ÒµôѪ #tagCMRoleLostHP
#
#struct    tagCMRoleLostHP
#{
#    tagHead        Head;
#    DWORD        LostHP;
#    DWORD        LostHPEx;
#};
def OnRoleLostHP(index, clientData, tick):
    curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
    lostHP = clientData.LostHP + clientData.LostHPEx * ShareDefine.Def_PerPointValue
    curHP = GameObj.GetHP(curPlayer)
    updHP = curHP - lostHP
    if updHP <= 0:
        #Íæ¼ÒÒѾ­ËÀÍö
        playerControl = PlayerControl.PlayerControl(curPlayer)
        playerControl.SetDead()
    else:
        GameObj.SetHP(curPlayer, updHP)
        
    return
 
#// A2 35 Ñ¡Ôñ¾³½çÄѶȲ㼶 #tagCMSelectRealmDifficulty
#
#struct    tagCMSelectRealmDifficulty
#{
#    tagHead        Head;
#    WORD        RealmDifficulty;    //¾³½çÄѶȠ= 1000 + ËùÑ¡¾³½çµÈ¼¶£¬Èç¾³½ç13£¬Ôò·¢1013
#};
def OnSelectRealmDifficulty(index, clientData, tick):
    curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
    PlayerControl.SetRealmDifficulty(curPlayer, clientData.RealmDifficulty)
    return