hxp
2024-11-11 9f30bc4785beb84ff4ab1504a2279b4a82f9ebd1
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
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
5196
5197
5198
5199
5200
5201
5202
5203
5204
5205
5206
5207
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
5250
5251
5252
5253
5254
5255
5256
5257
5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
5269
5270
5271
5272
5273
5274
5275
5276
5277
5278
5279
5280
5281
5282
5283
5284
5285
5286
5287
5288
5289
5290
5291
5292
5293
5294
5295
5296
5297
5298
5299
5300
5301
5302
5303
5304
5305
5306
5307
5308
5309
5310
5311
5312
5313
5314
5315
5316
5317
5318
5319
5320
5321
5322
5323
5324
5325
5326
5327
5328
5329
5330
5331
5332
5333
5334
5335
5336
5337
5338
5339
5340
5341
5342
5343
5344
5345
5346
5347
5348
5349
5350
5351
5352
5353
5354
5355
5356
5357
5358
5359
5360
5361
5362
5363
5364
5365
5366
5367
5368
5369
5370
5371
5372
5373
5374
5375
5376
5377
5378
5379
5380
5381
5382
5383
5384
5385
5386
5387
5388
5389
5390
5391
5392
5393
5394
5395
5396
5397
5398
5399
5400
5401
5402
5403
5404
5405
5406
5407
5408
5409
5410
5411
5412
5413
5414
5415
5416
5417
5418
5419
5420
5421
5422
5423
5424
5425
5426
5427
5428
5429
5430
5431
5432
5433
5434
5435
5436
5437
5438
5439
5440
5441
5442
5443
5444
5445
5446
5447
5448
5449
5450
5451
5452
5453
5454
5455
5456
5457
5458
5459
5460
5461
5462
5463
5464
5465
5466
5467
5468
5469
5470
5471
5472
5473
5474
5475
5476
5477
5478
5479
5480
5481
5482
5483
5484
5485
5486
5487
5488
5489
5490
5491
5492
5493
5494
5495
5496
5497
5498
5499
5500
5501
5502
5503
5504
5505
5506
5507
5508
5509
5510
5511
5512
5513
5514
5515
5516
5517
5518
5519
5520
5521
5522
5523
5524
5525
5526
5527
5528
5529
5530
5531
5532
5533
5534
5535
5536
5537
5538
5539
5540
5541
5542
5543
5544
5545
5546
5547
5548
5549
5550
5551
5552
5553
5554
5555
5556
5557
5558
5559
5560
5561
5562
5563
5564
5565
5566
5567
5568
5569
5570
5571
5572
5573
5574
5575
5576
5577
5578
5579
5580
5581
5582
5583
5584
5585
5586
5587
5588
5589
5590
5591
5592
5593
5594
5595
5596
5597
5598
5599
5600
5601
5602
5603
5604
5605
5606
5607
5608
5609
5610
5611
5612
5613
5614
5615
5616
5617
5618
5619
5620
5621
5622
5623
5624
5625
5626
5627
5628
5629
5630
5631
5632
5633
5634
5635
5636
5637
5638
5639
5640
5641
5642
5643
5644
5645
5646
5647
5648
5649
5650
5651
5652
5653
5654
5655
5656
5657
5658
5659
5660
5661
5662
5663
5664
5665
5666
5667
5668
5669
5670
5671
5672
5673
5674
5675
5676
5677
5678
5679
5680
5681
5682
5683
5684
5685
5686
5687
5688
5689
5690
5691
5692
5693
5694
5695
5696
5697
5698
5699
5700
5701
5702
5703
5704
5705
5706
5707
5708
5709
5710
5711
5712
5713
5714
5715
5716
5717
5718
5719
5720
5721
5722
5723
5724
5725
5726
5727
5728
5729
5730
5731
5732
5733
5734
5735
5736
5737
5738
5739
5740
5741
5742
5743
5744
5745
5746
5747
5748
5749
5750
5751
5752
5753
5754
5755
5756
5757
5758
5759
5760
5761
5762
5763
5764
5765
5766
5767
5768
5769
5770
5771
5772
5773
5774
5775
5776
5777
5778
5779
5780
5781
5782
5783
5784
5785
5786
5787
5788
5789
5790
5791
5792
5793
5794
5795
5796
5797
5798
5799
5800
5801
5802
5803
5804
5805
5806
5807
5808
5809
5810
5811
5812
5813
5814
5815
5816
5817
5818
5819
5820
5821
5822
5823
5824
5825
5826
5827
5828
5829
5830
5831
5832
5833
5834
5835
5836
5837
5838
5839
5840
5841
5842
5843
5844
5845
5846
5847
5848
5849
5850
5851
5852
5853
5854
5855
5856
5857
5858
5859
5860
5861
5862
5863
5864
5865
5866
5867
5868
5869
5870
5871
5872
5873
5874
5875
5876
5877
5878
5879
5880
5881
5882
5883
5884
5885
5886
5887
5888
5889
5890
5891
5892
5893
5894
5895
5896
5897
5898
5899
5900
5901
5902
5903
5904
5905
5906
5907
5908
5909
5910
5911
5912
5913
5914
5915
5916
5917
5918
5919
5920
5921
5922
5923
5924
5925
5926
5927
5928
5929
5930
5931
5932
5933
5934
5935
5936
5937
5938
5939
5940
5941
5942
5943
5944
5945
5946
5947
5948
5949
5950
5951
5952
5953
5954
5955
5956
5957
5958
5959
5960
5961
5962
5963
5964
5965
5966
5967
5968
5969
5970
5971
5972
5973
5974
5975
5976
5977
5978
5979
5980
5981
5982
5983
5984
5985
5986
5987
5988
5989
5990
5991
5992
5993
5994
5995
5996
5997
5998
5999
6000
6001
6002
6003
6004
6005
6006
6007
6008
6009
6010
6011
6012
6013
6014
6015
6016
6017
6018
6019
6020
6021
6022
6023
6024
6025
6026
6027
6028
6029
6030
6031
6032
6033
6034
6035
6036
6037
6038
6039
6040
6041
6042
6043
6044
6045
6046
6047
6048
6049
6050
6051
6052
6053
6054
6055
6056
6057
6058
6059
6060
6061
6062
6063
6064
6065
6066
6067
6068
6069
6070
6071
6072
6073
6074
6075
6076
6077
6078
6079
6080
6081
6082
6083
6084
6085
6086
6087
6088
6089
6090
6091
6092
6093
6094
6095
6096
6097
6098
6099
6100
6101
6102
6103
6104
6105
6106
6107
6108
6109
6110
6111
6112
6113
6114
6115
6116
6117
6118
6119
6120
6121
6122
6123
6124
6125
6126
6127
6128
6129
6130
6131
6132
6133
6134
6135
6136
6137
6138
6139
6140
6141
6142
6143
6144
6145
6146
6147
6148
6149
6150
6151
6152
6153
6154
6155
6156
6157
6158
6159
6160
6161
6162
6163
6164
6165
6166
6167
6168
6169
6170
6171
6172
6173
6174
6175
6176
6177
6178
6179
6180
6181
6182
6183
6184
6185
6186
6187
6188
6189
6190
6191
6192
6193
6194
6195
6196
6197
6198
6199
6200
6201
6202
6203
6204
6205
6206
6207
6208
6209
6210
6211
6212
6213
6214
6215
6216
6217
6218
6219
6220
6221
6222
6223
6224
6225
6226
6227
6228
6229
6230
6231
6232
6233
6234
6235
6236
6237
6238
6239
6240
6241
6242
6243
6244
6245
6246
6247
6248
6249
6250
6251
6252
6253
6254
6255
6256
6257
6258
6259
6260
6261
6262
6263
6264
6265
6266
6267
6268
6269
6270
6271
6272
6273
6274
6275
6276
6277
6278
6279
6280
6281
6282
6283
6284
6285
6286
6287
6288
6289
6290
6291
6292
6293
6294
6295
6296
6297
6298
6299
6300
6301
6302
6303
6304
6305
6306
6307
6308
6309
6310
6311
6312
6313
6314
6315
6316
6317
6318
6319
6320
6321
6322
6323
6324
6325
6326
6327
6328
6329
6330
6331
6332
6333
6334
6335
6336
6337
6338
6339
6340
6341
6342
6343
6344
6345
6346
6347
6348
6349
6350
6351
6352
6353
6354
6355
6356
6357
6358
6359
6360
6361
6362
6363
6364
6365
6366
6367
6368
6369
6370
6371
6372
6373
6374
6375
6376
6377
6378
6379
6380
6381
6382
6383
6384
6385
6386
6387
6388
6389
6390
6391
6392
6393
6394
6395
6396
6397
6398
6399
6400
6401
6402
6403
6404
6405
6406
6407
6408
6409
6410
6411
6412
6413
6414
6415
6416
6417
6418
6419
6420
6421
6422
6423
6424
6425
6426
6427
6428
6429
6430
6431
6432
6433
6434
6435
6436
6437
6438
6439
6440
6441
6442
6443
6444
6445
6446
6447
6448
6449
6450
6451
6452
6453
6454
6455
6456
6457
6458
6459
6460
6461
6462
6463
6464
6465
6466
6467
6468
6469
6470
6471
6472
6473
6474
6475
6476
6477
6478
6479
6480
6481
6482
6483
6484
6485
6486
6487
6488
6489
6490
6491
6492
6493
6494
6495
6496
6497
6498
6499
6500
6501
6502
6503
6504
6505
6506
6507
6508
6509
6510
6511
6512
6513
6514
6515
6516
6517
6518
6519
6520
6521
6522
6523
6524
6525
6526
6527
6528
6529
6530
6531
6532
6533
6534
6535
6536
6537
6538
6539
6540
6541
6542
6543
6544
6545
6546
6547
6548
6549
6550
6551
6552
6553
6554
6555
6556
6557
6558
6559
6560
6561
6562
6563
6564
6565
6566
6567
6568
6569
6570
6571
6572
6573
6574
6575
6576
6577
6578
6579
6580
6581
6582
6583
6584
6585
6586
6587
6588
6589
6590
6591
6592
6593
6594
6595
6596
6597
6598
6599
6600
6601
6602
6603
6604
6605
6606
6607
6608
6609
6610
6611
6612
6613
6614
6615
6616
6617
6618
6619
6620
6621
6622
6623
6624
6625
6626
6627
6628
6629
6630
6631
6632
6633
6634
6635
6636
6637
6638
6639
6640
6641
6642
6643
6644
6645
6646
6647
6648
6649
6650
6651
6652
6653
6654
6655
6656
6657
6658
6659
6660
6661
6662
6663
6664
6665
6666
6667
6668
6669
6670
6671
6672
6673
6674
6675
6676
6677
6678
6679
6680
6681
6682
6683
6684
6685
6686
6687
6688
6689
6690
6691
6692
6693
6694
6695
6696
6697
6698
6699
6700
6701
6702
6703
6704
6705
6706
6707
6708
6709
6710
6711
6712
6713
6714
6715
6716
6717
6718
6719
6720
6721
6722
6723
6724
6725
6726
6727
6728
6729
6730
6731
6732
6733
6734
6735
6736
6737
6738
6739
6740
6741
6742
6743
6744
6745
6746
6747
6748
6749
6750
6751
6752
6753
6754
6755
6756
6757
6758
6759
6760
6761
6762
6763
6764
6765
6766
6767
6768
6769
6770
6771
6772
6773
6774
6775
6776
6777
6778
6779
6780
6781
6782
6783
6784
6785
6786
6787
6788
6789
6790
6791
6792
6793
6794
6795
6796
6797
6798
6799
6800
6801
6802
6803
6804
6805
6806
6807
6808
6809
6810
6811
6812
6813
6814
6815
6816
6817
6818
6819
6820
6821
6822
6823
6824
6825
6826
6827
6828
6829
6830
6831
6832
6833
6834
6835
6836
6837
6838
6839
6840
6841
6842
6843
6844
6845
6846
6847
6848
6849
6850
6851
6852
6853
6854
6855
6856
6857
6858
6859
6860
6861
6862
6863
6864
6865
6866
6867
6868
6869
6870
6871
6872
6873
6874
6875
6876
6877
6878
6879
6880
6881
6882
6883
6884
6885
6886
6887
6888
6889
6890
6891
6892
6893
6894
6895
6896
6897
6898
6899
6900
6901
6902
6903
6904
6905
6906
6907
6908
6909
6910
6911
6912
6913
6914
6915
6916
6917
6918
6919
6920
6921
6922
6923
6924
6925
6926
6927
6928
6929
6930
6931
6932
6933
6934
6935
6936
6937
6938
6939
6940
6941
6942
6943
6944
6945
6946
6947
6948
6949
6950
6951
6952
6953
6954
6955
6956
6957
6958
6959
6960
6961
6962
6963
6964
6965
6966
6967
6968
6969
6970
6971
6972
6973
6974
6975
6976
6977
6978
6979
6980
6981
6982
6983
6984
6985
6986
6987
6988
6989
6990
6991
6992
6993
6994
6995
6996
6997
6998
6999
7000
7001
7002
7003
7004
7005
7006
7007
7008
7009
7010
7011
7012
7013
7014
7015
7016
7017
7018
7019
7020
7021
7022
7023
7024
7025
7026
7027
7028
7029
7030
7031
7032
7033
7034
7035
7036
7037
7038
7039
7040
7041
7042
7043
7044
7045
7046
7047
7048
7049
7050
7051
7052
7053
7054
7055
7056
7057
7058
7059
7060
7061
7062
7063
7064
7065
7066
7067
7068
7069
7070
7071
7072
7073
7074
7075
7076
7077
7078
7079
7080
7081
7082
7083
7084
7085
7086
7087
7088
7089
7090
7091
7092
7093
7094
7095
7096
7097
7098
7099
7100
7101
7102
7103
7104
7105
7106
7107
7108
7109
7110
7111
7112
7113
7114
7115
7116
7117
7118
7119
7120
7121
7122
7123
7124
7125
7126
7127
7128
7129
7130
7131
7132
7133
7134
7135
7136
7137
7138
7139
7140
7141
7142
7143
7144
7145
7146
7147
7148
7149
7150
7151
7152
7153
7154
7155
7156
7157
7158
7159
7160
7161
7162
7163
7164
7165
7166
7167
7168
7169
7170
7171
7172
7173
7174
7175
7176
7177
7178
7179
7180
7181
7182
7183
7184
7185
7186
7187
7188
7189
7190
7191
7192
7193
7194
7195
7196
7197
7198
7199
7200
7201
7202
7203
7204
7205
7206
7207
7208
7209
7210
7211
7212
7213
7214
7215
7216
7217
7218
7219
7220
7221
7222
7223
7224
7225
7226
7227
7228
7229
7230
7231
7232
7233
7234
7235
7236
7237
7238
7239
7240
7241
7242
7243
7244
7245
7246
7247
7248
7249
7250
7251
7252
7253
7254
7255
7256
7257
7258
7259
7260
7261
7262
7263
7264
7265
7266
7267
7268
7269
7270
7271
7272
7273
7274
7275
7276
7277
7278
7279
7280
7281
7282
7283
7284
7285
7286
7287
7288
7289
7290
7291
7292
7293
7294
7295
7296
7297
7298
7299
7300
7301
7302
7303
7304
7305
7306
7307
7308
7309
7310
7311
7312
7313
7314
7315
7316
7317
7318
7319
7320
7321
7322
7323
7324
7325
7326
7327
7328
7329
7330
7331
7332
7333
7334
7335
7336
7337
7338
7339
7340
7341
7342
7343
7344
7345
7346
7347
7348
7349
7350
7351
7352
7353
7354
7355
7356
7357
7358
7359
7360
7361
7362
7363
7364
7365
7366
7367
7368
7369
7370
7371
7372
7373
7374
7375
7376
7377
7378
7379
7380
7381
7382
7383
7384
7385
7386
7387
7388
7389
7390
7391
7392
7393
7394
7395
7396
7397
7398
7399
7400
7401
7402
7403
7404
7405
7406
7407
7408
7409
7410
7411
7412
7413
7414
7415
7416
7417
7418
7419
7420
7421
7422
7423
7424
7425
7426
7427
7428
7429
7430
7431
7432
7433
7434
7435
7436
7437
7438
7439
7440
7441
7442
7443
7444
7445
7446
7447
7448
7449
7450
7451
7452
7453
7454
7455
7456
7457
7458
7459
7460
7461
7462
7463
7464
7465
7466
7467
7468
7469
7470
7471
7472
7473
7474
7475
7476
7477
7478
7479
7480
7481
7482
7483
7484
7485
7486
7487
7488
7489
7490
7491
7492
7493
7494
7495
7496
7497
7498
7499
7500
7501
7502
7503
7504
7505
7506
7507
7508
7509
7510
7511
7512
7513
7514
7515
7516
7517
7518
7519
7520
7521
7522
7523
7524
7525
7526
7527
7528
7529
7530
7531
7532
7533
7534
7535
7536
7537
7538
7539
7540
7541
7542
7543
7544
7545
7546
7547
7548
7549
7550
7551
7552
7553
7554
7555
7556
7557
7558
7559
7560
7561
7562
7563
7564
7565
7566
7567
7568
7569
7570
7571
7572
7573
7574
7575
7576
7577
7578
7579
7580
7581
7582
7583
7584
7585
7586
7587
7588
7589
7590
7591
7592
7593
7594
7595
7596
7597
7598
7599
7600
7601
7602
7603
7604
7605
7606
7607
7608
7609
7610
7611
7612
7613
7614
7615
7616
7617
7618
7619
7620
7621
7622
7623
7624
7625
7626
7627
7628
7629
7630
7631
7632
7633
7634
7635
7636
7637
7638
7639
7640
7641
7642
7643
7644
7645
7646
7647
7648
7649
7650
7651
7652
7653
7654
7655
7656
7657
7658
7659
7660
7661
7662
7663
7664
7665
7666
7667
7668
7669
7670
7671
7672
7673
7674
7675
7676
7677
7678
7679
7680
7681
7682
7683
7684
7685
7686
7687
7688
7689
7690
7691
7692
7693
7694
7695
7696
7697
7698
7699
7700
7701
7702
7703
7704
7705
7706
7707
7708
7709
7710
7711
7712
7713
7714
7715
7716
7717
7718
7719
7720
7721
7722
7723
7724
7725
7726
7727
7728
7729
7730
7731
7732
7733
7734
7735
7736
7737
7738
7739
7740
7741
7742
7743
7744
7745
7746
7747
7748
7749
7750
7751
7752
7753
7754
7755
7756
7757
7758
7759
7760
7761
7762
7763
7764
7765
7766
7767
7768
7769
7770
7771
7772
7773
7774
7775
7776
7777
7778
7779
7780
7781
7782
7783
7784
7785
7786
7787
7788
7789
7790
7791
7792
7793
7794
7795
7796
7797
7798
7799
7800
7801
7802
7803
7804
7805
7806
7807
7808
7809
7810
7811
7812
7813
7814
7815
7816
7817
7818
#!/usr/bin/python
# -*- coding: GBK -*-
#-------------------------------------------------------------------------------
#
#-------------------------------------------------------------------------------
##@package PlayerControl
# @todo: Íæ¼Ò¿ØÖÆÆ÷
#
# @author Alee
# @date 2010-02-20 16:30
# @version 1.0
#
#---------------------------------------------------------------------
#"""Version = 2017-07-17 15:00"""
#---------------------------------------------------------------------
import GameWorld
import ChEquip
import SkillShell
import ChConfig
import EventShell
import EffGetSet
import PlayerHorse
import PlayerTruck
import PlayerTrade
import PlayerTeam
import SkillCommon
import MirrorAttack
import GameMap
import FBLogic
import GameWorldProcess
import NPCCommon
import ItemCommon
import ReadChConfig
import PlayerGMOper
import BuffSkill
import PetControl
import OperControlManager
import PlayerFamily
import ShareDefine
import PlayerBillboard
import GameServerRefresh
import IPY_GameWorld
import PlayerGameWallow
import ChPyNetSendPack
import NetPackCommon
import DataRecordPack
import CalcNoLineEffect
import CalcLineEffect
import PlayerEquipDecompose
import FormulaControl
import PlayerDienstgrad
import PlayerPrestigeSys
import OpenServerCampaign
import PlayerGodWeapon
import PlayerExpandPackCfgMgr
import PlayerWorldAverageLv
import PlayerActivity
import FBCommon
import PlayerViewCacheTube
import PassiveBuffEffMng
import PlayerGameEvent
import EventReport
import PlayerGatherSoul
import PlayerGatherTheSoul
import PlayerSuccess
import PlayerPet
import PlayerGreatMaster
import ItemControler
import GameFuncComm
import IpyGameDataPY
import PlayerRune
import GameLogic_DuJie
import PyGameData
import PlayerMagicWeapon
import PlayerFeastTravel
import PlayerActTurntable
import GameLogic_SealDemon
import GameLogic_ZhuXianBoss
import GameLogic_CrossDemonKing
import PlayerTJG
import PlayerVip
import PlayerRefineStove
import PlayerFamilyTech
import PlayerFamilyZhenfa
import PlayerCostRebate
import PlayerActLunhuidian
import PlayerActGarbageSorting
import GY_Query_CrossRealmReg
import PlayerTongTianLing
import PlayerCrossRealmPK
import FunctionNPCCommon
import PlayerGoldInvest
import IPY_PlayerDefine
import CrossRealmPlayer
import CrossPlayerData
import NPCHurtManager
import ChNetSendPack
import PlayerLianTi
import PlayerCoat
import PlayerAssist
import PlayerState
import QuestCommon
import PlayerDogz
import PlayerFaQi
import PlayerLove
import PlayerGubao
import PlayerShentong
import PlayerCharm
import PlayerFace
import ChPlayer
import GMShell
import GameObj
 
import random
import types
import math
import time
import json
#---------------------------------------------------------------------
#ÐÅÏ¢ÌáʾÁбí
NotifyCodeList = IPY_GameWorld.IPY_NotifyCodeList()
 
#buff×Ö¶ÎDieContinueλ±íʾ±êʶ
Def_Buff_Clear_Die = 0x1  # ËÀÍöÇå³ýbuff
Def_Buff_Clear_Disconnect = 0x2  # ÏÂÏßÇå³ýbuff
 
#---------------------------------------------------------------------
##¿Í»§¶Ë·¢ËÍÒÆ¶¯·â°ü¼ì²é
# @param curPlayer Íæ¼ÒʵÀý
# @param clientWorldTick ÉÏ´ÎÒÆ¶¯Ê±¼ä´Á
# @return ·µ»ØÖµÕæ, ¿ÉÒÔÒÆ¶¯
# @remarks ¿Í»§¶Ë·¢ËÍÒÆ¶¯·â°ü¼ì²é
def PlayerMoveCheckClientWorldTick(curPlayer, clientWorldTick, sendPack_PosX, sendPack_PosY):
    gameWorldTick = GameWorld.GetGameWorld().GetTick()
    Def_Max_Move_Tick = 5000
 
    if abs(gameWorldTick - clientWorldTick) >= Def_Max_Move_Tick:
        curPlayer.Sync_ClientTick()
        #ʱ¼äÏà²î¹ý´ó£¬¿ÉÄÜÒòÍøÂçÒýÆð£¬À­»Ø
        GameWorld.DebugLog("PlayerMoveCheckClientWorldTick -- ·þÎñÆ÷tick %s-¿Í»§¶Ë%sʱ¼äÏà²î¹ý´ó£¬¿ÉÄÜÒòÍøÂçÒýÆð£¬À­»Ø" % (
                            gameWorldTick, clientWorldTick), curPlayer.GetID())
        return False
    
    if gameWorldTick - curPlayer.GetDictByKey("CheckTick") > 60000:
        # 1·ÖÖÓ¾ÀÕýÒ»´Îtick,ͬʱÓÃÓÚÕ½¶·ºÍÒÆ¶¯µÄ¼ì²é
        curPlayer.SetMoveCount(0)
        curPlayer.SetDict("CheckTick", gameWorldTick)
    
    lastMoveTick = curPlayer.GetClientMoveTick()
    if clientWorldTick < lastMoveTick:
        #and GameWorld.GetGameWorld().GetTick() - curPlayer.GetLoginTick() > 15000:
        #Íæ¼ÒµÇÈëʱ¼ä´óÓÚ15Ãë, ²Å»áÌß³öÍæ¼Ò
        #2009.4.16. bug:
        #Íæ¼ÒÇл»µØÍ¼, ·þÎñÆ÷»º´æ×ß··â°ü, µ½´ïеØÍ¼, »º´æÖеķâ°üÊÕµ½, ½á¹ûÌß³öÁËÍæ¼Ò
        GameWorld.DebugLog('---clientWorldTick < lastMoveTick: %s, TickÌ«Âý' % curPlayer.GetAccID())
        #curPlayer.Kick(IPY_GameWorld.disTickError)
        errCnt = curPlayer.GetMoveCount()
        curPlayer.SetMoveCount(errCnt + 1)
        if errCnt > 5:
            return False
    
    # ÑéÖ¤Á½´Îtick¼ä¿ÉÄܲúÉúµÄ×ø±ê²î
    dist = GameWorld.GetDist(curPlayer.GetPosX(), curPlayer.GetPosY(), sendPack_PosX, sendPack_PosY)
    canMoveDist = math.ceil((clientWorldTick - lastMoveTick) / float(curPlayer.GetSpeed())) + 2
    #if clientWorldTick - curPlayer.GetPlayerAttackTick() < GetAtkInterval(curPlayer):
    #    # ¹¥»÷²úÉúµÄÎ»ÒÆ¿ÉÄÜÒòΪ¹¥»÷ËÙ¶È¸Ä±ä¶ø±ä¿ì£¬¹¥»÷ÆÚ¼äµÄÒÆ¶¯°üÔÊÐí¶àÒÆ¶¯1Ã×µÄËÙ¶È
    #    canMoveDist += 2
        
    if dist > canMoveDist:
        GameWorld.DebugLog("¾àÀë²î%s ×ø±êS/C:%s---ÑéÖ¤Á½´Îtick¼ä¿ÉÄܲúÉúµÄ×ø±ê²î%s %s - %s" % (dist, [curPlayer.GetPosX(),
                            curPlayer.GetPosY(), sendPack_PosX, sendPack_PosY], canMoveDist, clientWorldTick, lastMoveTick))
        errCnt = curPlayer.GetMoveCount()
        curPlayer.SetMoveCount(errCnt + 1)
        if errCnt > 5:
            return False
    
    #ʱ¼ä²î
#    curPlayer.UpdatePosByTick(gameWorldTick - clientWorldTick + gameWorldTick)
    #curPlayer.UpdatePos()
    return True
 
 
# notifyCnt ´ú±í¹ã²¥ÖÜÎ§Íæ¼ÒµÄÊýÁ¿£¬0Ϊȫ²¿¹ã²¥ -1Ϊָ¶¨ÁбíËæ»ú£¬ ÆäËûÊý×ÖΪָ¶¨Ö¸
def PyNotifyAll(curPlayer, sendPack, notifySelf=True, notifyCnt=0):
    if notifyCnt == -1:
        notifyCnt = 8
    #GameWorld.DebugLog("PyNotifyAll %s"%notifyCnt)
 
    curPlayer.NotifyAll(sendPack.GetBuffer(), sendPack.GetLength(), notifySelf, notifyCnt)
    
    
#---------------------------------------------------------------------
##Ö´ÐÐÍæ¼ÒÔÚÕϰ­µãÂß¼­
# @param curPlayer Íæ¼ÒʵÀý
# @return ²¼¶ûÖµ, FlaseÎªÍæ¼Ò²»ÔÚÕϰ­µãÖÐ
# @remarks Ö´ÐÐÍæ¼ÒÔÚÕϰ­µãÂß¼­
def DoLogic_PlayerInBarrierPoint(curPlayer):
    curPlayerPosX = curPlayer.GetPosX()
    curPlayerPosY = curPlayer.GetPosY()
    curPlayerID = curPlayer.GetID()
    
    #---Íæ¼Ò²»ÔÚÕϰ­µãÖÐ---
    if GameWorld.GetMap().CanMove(curPlayerPosX, curPlayerPosY):
        return False
    
    #---Íæ¼ÒÔÚÕϰ­µãÖÐ---
    
    #ÔÚÕϰ­µã¸½¼þ2¸ñѰÕÒºÏÊÊλÖÃ
    curFindPos = GameMap.GetEmptyPlaceInArea(curPlayerPosX, curPlayerPosY, 3)
    curFindPosX = curFindPos.GetPosX()
    curFindPosY = curFindPos.GetPosY()
    
    #Íæ¼ÒÎÞ·¿É×ß
    if curFindPosX == curPlayerPosX and curFindPosY == curPlayerPosY:
        curPlayer.StopMove()
#===============================================================================
#            playerControl = PlayerControl(curPlayer)
#            playerControl.SetToBornPlace()
#===============================================================================
        GameWorld.Log("Íæ¼ÒÎÞ·¿É×ß, ´ò»ØÖØÉúµã!(%d,%d)" % (curPlayerPosX, curPlayerPosY), curPlayerID)
    #Õϰ­µãÖܱ߿ÉÒÔÒÆ¶¯, ½«Íæ¼ÒÖÃλ
    else:
        curPlayer.ResetPos(curFindPosX, curFindPosY)
        curPlayer.StopMove()
        GameWorld.Log("Íæ¼ÒÕ¾ÔÚÕϰ­µãÖÐ, Í£Ö¹Òƶ¯ (%d,%d)" % (curPlayerPosX, curPlayerPosY), curPlayerID)
        
    return True
#---------------------------------------------------------------------
## ÏûÏ¢Ìáʾ
#  @param curPlayer ÌáʾµÄÍæ¼Ò
#  @param msgMark ÌáʾÐÅÏ¢Mark
#  @param msgParamList ÐÅÏ¢²ÎÊýÁбí
#  @return ÎÞ·µ»ØÖµ
#  @remarks 
def NotifyCode(curPlayer, msgMark, msgParamList=[]):
    if curPlayer == None:
        GameWorld.ErrLog('NotifyCode Player = None')
        return
      
    curPlayer.NotifyCode(msgMark, __GetNotifyCodeList(msgParamList))
    return
    
## ÊÀ½ç¹ã²¥
#  @param country ÌáʾµÄ¹ú¼Ò
#  @param msgMark ÌáʾÐÅÏ¢Mark
#  @param msgParamList ÐÅÏ¢²ÎÊýÁбí
#  @param lineID:Ïß·ID£¨Ä¬ÈÏ0£¬±íʾȫ·þ¹ã²¥£©
#  @param mergeMinOSD ¸ÃÌáʾÕë¶Ô¿ç·þ×Ó·þÓÐЧµÄ×îС¿ª·þÌì, >=0ʱÓÐÏÞÖÆ
#  @param mergeMaxOSD ¸ÃÌáʾÕë¶Ô¿ç·þ×Ó·þÓÐЧµÄ×î´ó¿ª·þÌì, >=0ʱÓÐÏÞÖÆ
#  @param mergeMapInfo ¸ÃÌáʾËùÊôµÄ¿ç·þ»î¶¯µØÍ¼ÐÅÏ¢, Ö÷ÒªÓÃÓÚ²»Í¬×Ó·þ¶ÔÓ¦Ëù¿çµÄ»î¶¯µØÍ¼ID
#  @return ÎÞ·µ»ØÖµ
def WorldNotify(country, msgMark, msgParamList=[], lineID=0, mergeMinOSD=-1, mergeMaxOSD=-1, mergeMapInfo=[]):
    GameWorld.GetPlayerManager().BroadcastCountry_NotifyCode(country, 0, msgMark, __GetNotifyCodeList(msgParamList), lineID)
    return
 
def GetCrossWorldNotifyInfo(country, msgMark, msgParamList=[]):
    return {"Type":ShareDefine.CrossNotify_World, "Params":[country, msgMark, msgParamList]}
 
def GetCrossFamilyNotifyInfo(familyID, msgMark, msgParamList=[]):
    return {"Type":ShareDefine.CrossNotify_Family, "Params":[familyID, msgMark, msgParamList]}
 
def CrossNotify(serverGroupIDList, crossNotifyList):
    ''' ¿ç·þ¹ã²¥ÐÅÏ¢Ìáʾ£¬Ö§³Öͬ²½¶àÌõ£¬Í¬Ê±Ò²½¨Òé¶àÌõÒ»Æðͬ²½
    @param serverGroupIDList: ÐèҪͬ²½µ½µÄÄ¿±ê·þÎñÆ÷×éIDÁбí
    @param crossNotifyList: ÐÅÏ¢ÌáʾÁÐ±í£¬Í¨¹ý GetCrossWorldNotifyInfo GetCrossFamilyNotifyInfo º¯Êý»ñµÃ·µ»ØÖµÌí¼Óµ½Áбí
    '''
    sendMsg = str([serverGroupIDList, crossNotifyList])
    GameWorld.GetPlayerManager().GameServer_QueryPlayerResult(0, 0, 0, "CrossNotify", sendMsg, len(sendMsg))
    return
 
#---------------------------------------------------------------------
## ¼Ò×å¹ã²¥
#  @param familyID ÌáʾµÄ¼Ò×åID
#  @param msgMark ÌáʾÐÅÏ¢Mark
#  @param msgParamList ÐÅÏ¢²ÎÊýÁбí
#  @return ÎÞ·µ»ØÖµ
#  @remarks 
def FamilyNotify(familyID, msgMark, msgParamList=[]):
    GameWorld.GetPlayerManager().BroadcastCountry_NotifyCode(0, familyID, msgMark, __GetNotifyCodeList(msgParamList))
    return
 
#---------------------------------------------------------------------
##±¾µØÍ¼ÄÚµÄ֪ͨ
#  @param msgMark ÌáʾÐÅÏ¢Mark
#  @param msgParamList ÐÅÏ¢²ÎÊýÁбí
#  @return ÎÞ·µ»ØÖµ
#  @remarks 
def FBNotify(msgMark, msgParamList=[]):
    GameWorld.GetMapCopyPlayerManager().BroadcastFB_NotifyCode(msgMark, __GetNotifyCodeList(msgParamList))
    return
 
def FBFactionNotifySelf(faction, msgMark, msgParamList=[]):
    ## ¸±±¾×Ô¼ºÕóÓª¹ã²¥
    copyMapPlayerManager = GameWorld.GetMapCopyPlayerManager()
    for i in xrange(copyMapPlayerManager.GetPlayerCount()):
        curPlayer = copyMapPlayerManager.GetPlayerByIndex(i)
        if curPlayer == None or curPlayer.IsEmpty():
            continue
        if curPlayer.GetFaction() == faction:
            NotifyCode(curPlayer, msgMark, msgParamList)
    return
 
def FBFactionNotifyOther(faction, msgMark, msgParamList=[]):
    ## ¸±±¾ÆäËûÕóÓª¹ã²¥
    copyMapPlayerManager = GameWorld.GetMapCopyPlayerManager()
    for i in xrange(copyMapPlayerManager.GetPlayerCount()):
        curPlayer = copyMapPlayerManager.GetPlayerByIndex(i)
        if curPlayer == None or curPlayer.IsEmpty():
            continue
        if curPlayer.GetFaction() != faction:
            NotifyCode(curPlayer, msgMark, msgParamList)
    return
 
def FBFactionNotify(faction, selfMsgMark, selfMsgParamList, otherMsgMark, otherMsgParamList):
    ## ¸±±¾¹ã²¥×Ô¼º¼°ÆäËûÕóÓª£¬Çø·Ö¹ã²¥ÐÅÏ¢
    copyMapPlayerManager = GameWorld.GetMapCopyPlayerManager()
    for i in xrange(copyMapPlayerManager.GetPlayerCount()):
        curPlayer = copyMapPlayerManager.GetPlayerByIndex(i)
        if curPlayer == None or curPlayer.IsEmpty():
            continue
        if curPlayer.GetFaction() == faction:
            NotifyCode(curPlayer, selfMsgMark, selfMsgParamList)
        else:
            NotifyCode(curPlayer, otherMsgMark, otherMsgParamList)
    return
 
## ¶ÓÎé¹ã²¥
#  @param teamID ¶ÓÎéID
#  @param msgMark ÌáʾÐÅÏ¢Mark
#  @param msgParamList ÐÅÏ¢²ÎÊýÁбí
#  @return ÎÞ·µ»ØÖµ
def TeamNotify(teamID, msgMark, msgParamList=[]):
    if teamID == 0:
        return
    
    sendMsg = '("%s", %s)' % (msgMark, msgParamList)
    GameWorld.GetPlayerManager().GameServer_QueryPlayerResult(0, 0, teamID, 'TeamNotify', sendMsg, len(sendMsg))
    return
 
#---------------------------------------------------------------------
def SendMailBatch(mailTypeKey, batchPlayerIDList, batchAddItemList=[], batchParamList=[], batchGold=[], batchGoldPaper=[], batchSilver=[], batchDetail=[], moneySource=ChConfig.Def_GiveMoney_Mail, crossMail=False):
    '''ÅúÁ¿·¢ËÍÓʼþ, ÓÃÓÚ˲¼äÐèÒª·¢ËͶà·â£¨´óÁ¿£©ÓʼþµÄ£¬±ÈÈçһЩ¹«¹²¸±±¾»î¶¯µÈ½áËãʱ
    @param mailTypeKey: ÓʼþÄ£°åkey
    @param batchPlayerIDList: [playerIDList, playerIDList, ...]
    @param batchAddItemList: [addItemList, addItemList, ...]
    @param batchParamList: [paramList, paramList, ...]
    @param batchGold: [batchGold, batchGold, ...]
    @param batchGoldPaper: [batchGoldPaper, batchGoldPaper, ...]
    @param batchSilver: [batchSilver, batchSilver, ...]
    @param batchDetail: [¼Ç¼ÓʼþÁ÷ÏòÓÃ, ...]
    @param moneySource: »õ±ÒÀ´Ô´
    '''
    
    copyMapPlayerManager = GameWorld.GetMapCopyPlayerManager()
    for i, playerIDList in enumerate(batchPlayerIDList):
        for playerID in playerIDList[::-1]:
            curPlayer = copyMapPlayerManager.FindPlayerByID(playerID)
            if curPlayer and not curPlayer.GetGameServerInitOK():
                bAddItemList = [batchAddItemList[i]] if len(batchAddItemList) > i else []
                bParamList = [batchParamList[i]] if len(batchParamList) > i else []
                bGold = [batchGold[i]] if len(batchGold) > i else []
                bGoldPaper = [batchGoldPaper[i]] if len(batchGoldPaper) > i else []
                bSilver = [batchSilver[i]] if len(batchSilver) > i else []
                bDetail = [batchDetail[i]] if len(batchDetail) > i else []
                AddUnLoginOKPlayerMailCache(playerID, "ByMailTemplate", [mailTypeKey, bAddItemList, bParamList, bGold, bGoldPaper, bSilver, bDetail, moneySource, crossMail])
                playerIDList.pop(playerIDList.index(playerID))
                continue
            
    msgInfo = str([mailTypeKey, batchPlayerIDList, batchAddItemList, batchParamList, batchGold, batchGoldPaper, batchSilver, batchDetail, moneySource, crossMail])
    GameWorld.GetPlayerManager().GameServer_QueryPlayerResult(0, 0, 0, "SendMailBatch", msgInfo, len(msgInfo))
    GameWorld.Log("SendMailBatch %s, batchPlayerIDList=%s, batchAddItemList=%s, batchParamList=%s, batchGold=%s, batchGoldPaper=%s, batchSilver=%s" 
                  % (mailTypeKey, batchPlayerIDList, batchAddItemList, batchParamList, batchGold, batchGoldPaper, batchSilver))
    return
 
def SendMailByKey(mailTypeKey, playerIDList, addItemList, paramList=[], gold=0, goldPaper=0, silver=0, detail="", moneySource=ChConfig.Def_GiveMoney_Mail, crossMail=False):
    '''
    @param detail: ¼Ç¼ÓʼþÁ÷ÏòÓÃ
    '''
    if not mailTypeKey:
        mailTypeKey = ShareDefine.DefaultLackSpaceMailType
    
    content = "<MailTemplate>%s</MailTemplate>%s" % (mailTypeKey, json.dumps(paramList, ensure_ascii=False))
    SendMail("", content, 30, playerIDList, addItemList, gold, goldPaper, silver, detail, moneySource, crossMail)
    return
 
def SendCrossMail(serverGroupID, mailTypeKey, playerIDList, addItemList, paramList=[]):
    ## ·¢ËÍ¿ç·þÓʼþ
    if not serverGroupID:
        return
    dataMsg = {"MailTypeKey":mailTypeKey, "Player":playerIDList}
    if addItemList:
        dataMsg["Item"] = CombineMailItem(addItemList)
    if paramList:
        dataMsg["Param"] = paramList
    GameWorld.SendMsgToClientServer(ShareDefine.CrossServerMsg_SendMail, dataMsg, [serverGroupID])
    return
 
def SendEntireMail(mailTypeKey, getDays, limitLV, limitLVType, addItemList=[], paramList=[], \
                   gold=0, goldPaper=0, silver=0, detail="", moneySource=ChConfig.Def_GiveMoney_Mail):
    ''' ·¢ËÍÈ«·þÓʼþ
    @param mailTypeKey: ÓʼþÄ£°åkey
    @param getDays: ÓÐЧÌìÊý
    @param limitLV: ÁìÈ¡×îµÍµÈ¼¶ÏÞÖÆ
    @param limitLVType: µÈ¼¶²»×ãµÄÉý¼¶ºóÊÇ·ñ¿ÉÁì 0-²»¿É£¬1-¿ÉÒÔ
    '''
    
    # ÓÐЧÌìÊýÏÞÖÆ
    if not mailTypeKey or getDays <= 0:
        return
    
    # ¿ç·þ·þÎñÆ÷²»ÔÊÐí·¢ËÍÓʼþ
    if GameWorld.IsCrossServer():
        return
    
    combineItemList = CombineMailItem(addItemList)
    cmdList = [mailTypeKey, getDays, limitLV, limitLVType, combineItemList, paramList, gold, goldPaper, silver, detail, moneySource]
    GameWorld.GetPlayerManager().GameServer_QueryPlayerResult(0, 0, 0, "SendEntireMail", '%s' % (cmdList), len(str(cmdList)))
    GameWorld.Log("·¢ËÍÈ«·þÓʼþ: %s,getDays=%s,limitLV=%s,limitLVType=%s,combineItemList=%s,paramList=%s,gold=%s,goldPaper=%s,silver=%s,detail=%s,moneySource=%s" % 
                  (mailTypeKey, getDays, limitLV, limitLVType, combineItemList, paramList, gold, goldPaper, silver, detail, moneySource))
    return
 
## ¹¦ÄÜ·¢·ÅÎïÆ·²¹³¥/½±ÀøÓʼþ
#  @param addItemList [(itemID, itemCnt, ÊÇ·ñÅÄÆ·), {»òÎïÆ·ÐÅÏ¢×Öµä}, ...]
#  @return
def SendMail(title, content, getDays, playerIDList, addItemList, gold=0, goldPaper=0, silver=0, detail="", moneySource=ChConfig.Def_GiveMoney_Mail, crossMail=False):
    if not playerIDList:
        return
    
#    if not addItemList:
#        return
    
    # ÓÐЧÌìÊýÏÞÖÆ
    if getDays <= 0:
        return
    
    # ¿ç·þ·þÎñÆ÷²»ÔÊÐí·¢ËÍÓʼþ
    if GameWorld.IsCrossServer() and not crossMail:
        return
    
    sendPlayerIDList = []
    copyMapPlayerManager = GameWorld.GetMapCopyPlayerManager()
    for playerID in playerIDList:
        curPlayer = copyMapPlayerManager.FindPlayerByID(playerID)
        if curPlayer and not curPlayer.GetGameServerInitOK():
            AddUnLoginOKPlayerMailCache(playerID, "ByMailContent", [title, content, getDays, addItemList, gold, goldPaper, silver, detail, moneySource])
            continue
        sendPlayerIDList.append(playerID)
        
    combineItemList = CombineMailItem(addItemList)
    cmdList = [title, content, getDays, sendPlayerIDList, combineItemList, gold, goldPaper, silver, detail, moneySource, crossMail]
    GameWorld.GetPlayerManager().GameServer_QueryPlayerResult(0, 0, 0, "SendMail", '%s' % (cmdList), len(str(cmdList)))
    return True
 
def AddUnLoginOKPlayerMailCache(playerID, cacheType, mailInfo):
    ''' Ìí¼ÓδµÇ¼³É¹¦µÄÍæ¼Ò¸öÈËÓʼþ·¢ËÍ»º´æ
    '''
    if playerID not in PyGameData.g_unLoginOKPlayerMailInfo:
        PyGameData.g_unLoginOKPlayerMailInfo[playerID] = []
    mailList = PyGameData.g_unLoginOKPlayerMailInfo[playerID]
    if [cacheType, mailInfo] in mailList:
        GameWorld.Log("###ÖØ¸´Ìí¼ÓGetGameServerInitOKδµÇ¼³É¹¦µÄÍæ¼Ò¸öÈËÓʼþ·¢ËÍ»º´æ! ²»Ìí¼Ó! mailCount=%s, mailInfo=%s" 
                      % (len(mailList), str(mailInfo)), playerID)
        return
    if len(mailList) >= 30: # ×ö¸öÏÞÖÆ£¬·ÀÖ¹³öÎÊÌâË¢Óʼþ
        GameWorld.Log("###ÏÞÖÆÌí¼ÓGetGameServerInitOKδµÇ¼³É¹¦µÄÍæ¼Ò¸öÈËÓʼþ·¢ËÍ»º´æ! ³¬³ö×î´ó¿ÉÌí¼ÓÊý£¬²»Ìí¼Ó! mailCount=%s, mailInfo=%s" 
                      % (len(mailList), str(mailInfo)), playerID)
        return
    mailList.append([cacheType, mailInfo])
    # curPlayer.GetGameServerInitOK()
    GameWorld.Log("Ìí¼ÓGetGameServerInitOKδµÇ¼³É¹¦µÄÍæ¼Ò¸öÈËÓʼþ·¢ËÍ»º´æ! µÈ´ý·¢ËÍ! mailCount=%s, mailInfo=%s" 
                  % (len(mailList), str(mailInfo)), playerID)
    return
 
def SendUnLoginOKPlayerMailCache(curPlayer):
    ## Î´µÇ¼³É¹¦µÄÍæ¼Ò¸öÈËÓʼþ·¢ËÍ»º´æ  - µÇ¼³É¹¦ºó´¦Àí
    if not curPlayer.GetGameServerInitOK():
        return
    playerID = curPlayer.GetPlayerID()
    if playerID not in PyGameData.g_unLoginOKPlayerMailInfo:
        return
    mailList = PyGameData.g_unLoginOKPlayerMailInfo.pop(playerID)
    for cacheType, mailInfo in mailList:
        playerIDList = [playerID]
        GameWorld.Log("·¢ËÍδµÇ¼³É¹¦Ê±»º´æµÄ´ý·¢ËÍÓʼþ! cacheType=%s, mailInfo=%s" % (cacheType, str(mailInfo)), playerID)
        if cacheType == "ByMailContent":
            title, content, getDays, addItemList, gold, goldPaper, silver, detail, moneySource = mailInfo
            SendMail(title, content, getDays, playerIDList, addItemList, gold, goldPaper, silver, detail, moneySource)
        elif cacheType == "ByMailTemplate":
            mailTypeKey, bAddItemList, bParamList, bGold, bGoldPaper, bSilver, bDetail, moneySource, crossMail = mailInfo
            SendMailBatch(mailTypeKey, [playerIDList], bAddItemList, bParamList, bGold, bGoldPaper, bSilver, bDetail, moneySource, crossMail)
    return
 
def CombineMailItem(addItemList):
    ## ºÏ²¢ÓʼþÎïÆ·
    itemCountDict = {}
    combineItemList = [] # ºÏ²¢ºóµÄÎïÆ·Áбí
    for mailItem in addItemList:
        if isinstance(mailItem, dict):
            combineItemList.append(mailItem)
            continue
        
        if len(mailItem) != 3:
            continue
        
        itemID, itemCnt, isAuctionItem = mailItem
        
        if ItemControler.GetAppointItemRealID(itemID):
            # ¶¨ÖÆÎïÆ·×ª»¯ÎªÎïÆ·ÐÅÏ¢×Öµä
            appointItemObj = ItemControler.GetItemByData(ItemControler.GetAppointItemDictData(itemID, isAuctionItem))
            if not appointItemObj:
                GameWorld.ErrLog("Óʼþ¶¨ÖÆÎïÆ·×ª»¯Ê§°Ü£¡itemID, itemCnt, isAuctionItem" % (itemID, itemCnt, isAuctionItem))
                continue
            combineItemList.append(ItemCommon.GetMailItemDict(appointItemObj))
            appointItemObj.Clear()
        elif isAuctionItem:
            combineItemList.append((itemID, itemCnt, isAuctionItem))
        else:
            key = (itemID, isAuctionItem)
            itemCountDict[key] = itemCountDict.get(key, 0) + itemCnt
            
    for key, itemCnt in itemCountDict.items():
        itemID, isAuctionItem = key
        combineItemList.append((itemID, itemCnt, isAuctionItem))
    return combineItemList
 
## ¹¹½¨ÏµÍ³Ìáʾ²ÎÊýÁбí
#  @param msgParamList ÐÅÏ¢²ÎÊýÁбí
#  @return ÏµÍ³Ìáʾ²ÎÊýÁбí IPY_NotifyCodeList
#  @remarks 
def __GetNotifyCodeList(msgParamList):
    #ÏûÏ¢ÌáʾÁбí, ÏÈÇåÔÚÌí¼Ó
    global NotifyCodeList
    NotifyCodeList.Clear()
    
    if not msgParamList:
        return NotifyCodeList
    
    for msg in msgParamList:
        itemPythonType = type(msg)
        
        if itemPythonType is types.IntType:
            #PythonÒªÑéÖ¤ÕûÐͺͳ¤ÕûÐÍ
            NotifyCodeList.AddInt(msg)
        elif itemPythonType is types.LongType:
            NotifyCodeList.AddStr(str(msg))
        else:
            NotifyCodeList.AddStr(msg)
 
    return NotifyCodeList
#---------------------------------------------------------------------
##»ñµÃÍæ¼Òµ±Ç°ÀۼƵÄÀëÏß·ÖÖÓÊý
# @param curPlayer Íæ¼ÒʵÀý
# @return ÀۼƵķÖÖÓÊý
# @remarks ¿Í»§¶Ë·â°üÏìÓ¦
def GetPlayerLeaveServerMinute(curPlayer):
    #µ±Ç°ÀëÏßʱ¼ä×Ö·û´«
    logoffTimeStr = curPlayer.GetLogoffTime()
 
    if logoffTimeStr == "" or logoffTimeStr == '0':
        return 0
 
    logoffTime = GameWorld.GetDateTimeByStr(logoffTimeStr)
    loginTime = GameWorld.GetDateTimeByStr(GameWorld.GetCurrentDataTimeStr())
 
    return GameWorld.GetDiff_Minute(loginTime, logoffTime)
 
##»ñµÃÍæ¼Òµ±Ç°ÀۼƵÄÀëÏßÃëÊý
# @param curPlayer Íæ¼ÒʵÀý
# @return ÀۼƵÄÃëÊý
# @remarks ¿Í»§¶Ë·â°üÏìÓ¦
def GetPlayerLeaveServerSecond(curPlayer):
    #µ±Ç°ÀëÏßʱ¼ä×Ö·û´«
    logoffTimeStr = curPlayer.GetLogoffTime()
 
    if logoffTimeStr == "" or logoffTimeStr == '0':
        return 0
 
    logoffTime = GameWorld.GetDateTimeByStr(logoffTimeStr)
    loginTime = GameWorld.GetDateTimeByStr(GameWorld.GetCurrentDataTimeStr())
 
    diff_Time = loginTime - logoffTime
    #ÌìÊý * 24Сʱ * 60 ·ÖÖÓ + Ãë
    return diff_Time.days * 24 * 60 * 60 + diff_Time.seconds
 
 
##»ñµÃÍæ¼Òµ±Ç°Ê±¼ä¾àÀëÉÏ´ÎÀëÏßʱ¼äµÄÌìÊý
# @param curPlayer Íæ¼ÒʵÀý
# @return 
def GetPlayerLastLeaveServerPastDay(curPlayer):
    #µ±Ç°ÀëÏßʱ¼ä×Ö·û´«
    logoffTimeStr = curPlayer.GetLogoffTime()
 
    if logoffTimeStr == "" or logoffTimeStr == '0':
        return 0
    
    logoffTimeStr = logoffTimeStr.split()[0]
    loginTimeStr = GameWorld.GetCurrentDataTimeStr().split()[0]
    
    logoffTime = GameWorld.GetDateTimeByStr(logoffTimeStr, ChConfig.TYPE_Time_Format_Day)
    loginTime = GameWorld.GetDateTimeByStr(loginTimeStr, ChConfig.TYPE_Time_Format_Day)
    
    diffTime = loginTime - logoffTime
    
    return diffTime.days
    
#---------------------------------------------------------------------
## ¼ì²éÍæ¼Ò״̬ÊÇ·ñ¿ÉÒÔ´«ËÍ
#  @param curPlayer µ±Ç°Íæ¼Ò
#  @return ²¼¶ûÖµ
#  @remarks ¼ì²éÍæ¼Ò״̬ÊÇ·ñ¿ÉÒÔ´«ËÍ
def CheckPlayerTransport(curPlayer):
    #ËÀÍö²»¿ÉʹÓÃ
    if GameObj.GetHP(curPlayer) <= 0:
        return False
    
#    if curPlayer.GetPKValue() > 0:
#        #PK_lhs_161795
#        NotifyCode(curPlayer, "PK_lhs_161795")
#        return False
    
    #¼ì²éÍæ¼Ò״̬
    if not CheckTransState(curPlayer):
        return False
    
#    #Ñ£ÔÎʱ£¬²»¿É´«ËÍ
#    if curPlayer.GetAbnormalState() == IPY_GameWorld.sctFaint:
#        return False
    
    #=========================================================================================================
    # #À­ïÚ³µÖУ¬È˲»ÔÚïÚ³µÖÐÒ²²»ÄÜ´«ËÍ
    # if curPlayer.GetTruck() != None:
    #    NotifyCode(curPlayer, "HaveTruck_No_Trans")
    #    return False
    #=========================================================================================================
    
#    #±»¹¥»÷ʱºò, ÎÞ·¨Ê¹ÓÃ
#    if curPlayer.IsBattleState():
#        NotifyCode(curPlayer, "CannotAtk09")
#        return False
#    
#    #¶ÔÖÅÖÐ, ÎÞ·¨Ê¹ÓÃ
#    if curPlayer.GetIsConfronting():
#        NotifyCode(curPlayer, "CannotAtk09")
#        return False
    
    #¼ì²éÍæ¼ÒÊÇ·ñÔÚÆÕͨµØÍ¼
    if GameWorld.GetMap().GetMapFBType() != IPY_GameWorld.fbtNull:
        #²¿·Ö¸±±¾ÔÊÐí´«ËͳöÈ¥
        if GameWorld.GetMap().GetMapID() not in IpyGameDataPY.GetFuncEvalCfg('DungeonDeliver', 1):
            NotifyCode(curPlayer, "Carry_lhs_844170") 
            return False
        
    if not GameWorld.IsCrossServer() and GetCrossMapID(curPlayer):
        NotifyCode(curPlayer, "CrossMap10") 
        return False
    
    if curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_ClientCustomScene):
        GameWorld.Log("¿Í»§¶Ë×Ô¶¨Ò峡¾°ÏÂÎÞ·¨´«ËÍ!", curPlayer.GetPlayerID())
        return False
    
    return True
 
 
##µØÍ¼ÌØÊâÏÞÖÆ¼ì²é, ×°±¸¼ì²é
# @param curPlayer
# @return bool
def CheckEquipCanTrans(curPlayer, destMapID):
    if destMapID != 10060:
        return True
    
    #Óгá°ò¿ÉÒÔÉÏÌì¿Õ
    playerEquip = curPlayer.GetItemManager().GetPack(IPY_GameWorld.rptEquip)
    curEquip = playerEquip.GetAt(IPY_GameWorld.retWing)
    if curEquip and not curEquip.IsEmpty():
        return True
    
    #GeRen_lhs_861048
    NotifyCode(curPlayer, "GeRen_lhs_861048", [destMapID])
    return False
 
#---------------------------------------------------------------------
##֪ͨ¿Í»§¶Ë, Íæ¼ÒLoading¿ªÊ¼
# @param curPlayer Íæ¼ÒʵÀý
# @param prepareTime Loadingʱ¼ä
# @param prepareType LoadingÀàÐÍ
# @param prepareID LoadingNPCID, Ä¬ÈÏΪ0, ²»ÉèÖÃ
# @return ·µ»ØÖµÎÞÒâÒå
# @remarks Í¨Öª¿Í»§¶Ë, Íæ¼ÒLoading¿ªÊ¼
# ÌØÊâ˵Ã÷ChangePlayerAction -> SetPlayerAction ÖРÔÚÀ­Ìõ״̬»á֪ͨ Sync_PrepareEnd£¬Ä¬ÈϽø¶ÈÌõÀàÐÍ
# Sync_PrepareEnd Í¨Öª0²ÅËã½ø¶ÈÌõ³É¹¦£¬ÆäËûΪʧ°Ü£¬×Ôµ÷ÓÃÂß¼­Ê±Çë×¢Òâ
def Sync_PrepareBegin(curPlayer, prepareTime, prepareType, prepareID=0):
    #ÖжÏÕ½¶·¶ÔÖÅ
    ExitPlayerConfronting(curPlayer)
    #´ò¶ÏÒÆ¶¯
    curPlayer.StopMove()
    #ÉèÖü¤»îÍæ¼Ò
    SetIsNeedProcess(curPlayer, True)
    #¿ªÊ¼Í¨ÖªLoading
    curPlayer.SetPrepareTime(prepareTime)
    curPlayer.SetPrepareState(prepareType)
    curPlayer.SetPrepareID(prepareID)
    curPlayer.Sync_PrepareBegin()
    
    #¿ÕÏÐת±äΪÆäËû״̬Ôòɾ³ýÓÐÏÞÎÞµÐBUFF
    tick = GameWorld.GetGameWorld().GetTick()
    DelLimitSuperBuff(curPlayer, tick)
    return
 
#---------------------------------------------------------------------
##Íæ¼Ò״̬¸Ä±ä
# @param curPlayer Íæ¼ÒʵÀý
# @param changeAction Çл»µÄ״̬
# @param forceChange ÊÇ·ñÇ¿ÖÆ×ª»»
# @return ·µ»ØÖµÎÞÒâÒå
# @remarks Íæ¼Ò״̬¸Ä±ä
def ChangePlayerAction(curPlayer, changeAction, forceChange=False):
    curPlayerAction = curPlayer.GetPlayerAction()
    
    if curPlayerAction == changeAction:
        return
    
    #״̬±ä¸üҪ֪ͨվÁ¢
    DoPlayerStand(curPlayer)
    
    #ÖжÏÕ½¶·¶ÔÖÅ
    if changeAction in ChConfig.Def_PlayerCancelConfronting:
        ExitPlayerConfronting(curPlayer)
    
    #ʼþ״̬²»Çл», ±ÜÃâ¶Ô»°¿¨×¡
    if curPlayerAction == IPY_GameWorld.paEvent and not forceChange:
        if changeAction in [IPY_GameWorld.paNull, IPY_GameWorld.paAttack]:
            GameWorld.DebugLog("²»Ç¿ÖÆ×ª»»×´Ì¬ %s" % changeAction, curPlayer.GetID())
            return
    
    # ²É¼¯Çл»
    if curPlayerAction == IPY_GameWorld.paPreparing:
        DoExitPreparing(curPlayer)
    
    curPlayer.SetPlayerAction(changeAction)
    
    if changeAction == IPY_GameWorld.paNull:
        return
    
    #¿ÕÏÐת±äΪÆäËû״̬Ôòɾ³ýÓÐÏÞÎÞµÐBUFF
    tick = GameWorld.GetGameWorld().GetTick()
    DelLimitSuperBuff(curPlayer, tick)
    
    return
 
##Í˳ö²É¼¯
# @param curPlayer Íæ¼ÒʵÀý
# @return ·µ»ØÖµÎÞÒâÒå
def DoExitPreparing(curPlayer):
    NPCCommon.ClearCollectNPC(curPlayer)
    tagObj = curPlayer.GetActionObj()
    
    if tagObj == None:
        #ûÓÐÄ¿±ê
        GameWorld.Log("DoExitPreparing -> Ã»ÓÐÄ¿±ê", curPlayer.GetPlayerID())
        return
            
    if tagObj.GetGameObjType() != IPY_GameWorld.gotNPC:
        #̸»°¶ÔÏó²»¶Ô
        GameWorld.Log("DoExitPreparing -> ²É¼¯¶ÔÏó²»¶Ô", curPlayer.GetPlayerID())
        return
    
    curNPC = GameWorld.GetNPCManager().GetNPCByIndex(tagObj.GetIndex())
    if curNPC == None:
        #ûÓÐÕâ¸öNPC
        GameWorld.Log("DoExitPreparing ->ûÓÐÕâ¸öNPC", curPlayer.GetPlayerID())
        return
    
    curNPC_HurtList = curNPC.GetPlayerHurtList()
    curNPC_HurtList.Clear()
    return
 
## Íæ¼Ò״̬¸Ä±ä(½Å±¾×Ô¶¨Òåö¾Ù)
#  @param curPlayer Íæ¼ÒʵÀý
#  @param changeAction Çл»µÄ״̬
#  @return None
def ChangePyPlayerAction(curPlayer, changeAction):
    if GetPyPlayerAction(curPlayer, changeAction):
        #ÒѾ­ÊÇÕâ¸ö״̬
        return
    
    state = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_PyPlayerAction)
    state = state | pow(2, changeAction)
    
    NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_PyPlayerAction, state)
    return
 
 
## »ñÈ¡ÊÇ·ñÓиÃ״̬
#  @param curPlayer Íæ¼ÒʵÀý
#  @param changeAction Çл»µÄ״̬
#  @return ÊÇ·ñÓиÃ״̬
def GetPyPlayerAction(curPlayer, action):
    receiveState = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_PyPlayerAction)
    
    state = receiveState & pow(2, action) 
    #GameWorld.DebugLog("receiveState = %s, state = %s" % (receiveState, state))
    return state != 0
 
 
#---------------------------------------------------------------------
##ÉèÖÃÍæ¼ÒÊÇ·ñ¼¤»î
# @param curPlayer Íæ¼ÒʵÀý
# @param isNeedProcess ÊÇ·ñ¼¤»î
# @return ·µ»ØÖµÎÞÒâÒå
# @remarks ÉèÖÃÍæ¼ÒÊÇ·ñ¼¤»î
def SetIsNeedProcess(curPlayer, isNeedProcess):
    curPlayerIsNeedProcess = curPlayer.GetIsNeedProcess()
    
    if curPlayerIsNeedProcess == isNeedProcess:
        return
    
    curPlayer.SetIsNeedProcess(isNeedProcess)
    GameWorld.GodLog(curPlayer, 'ÉèÖÃÍæ¼ÒÊÇ·ñ¼¤»î:%s' % isNeedProcess)
    return
 
#---------------------------------------------------------------------
##Íæ¼ÒÊÇ·ñÔÚÕ½¶·×´Ì¬.
# @param curPlayer Íæ¼ÒʵÀý
# @return ²¼¶ûÖµ
# @remarks Íæ¼ÒÊÇ·ñÔÚÕ½¶·×´Ì¬
def IsPlayerInFight(curPlayer):
#    #Ö÷¶¯¶ÔÖÅÖÐ
#    if curPlayer.GetIsConfronting():
#        return True
    
    # ¹¥»÷ÖÐ
    if curPlayer.GetPlayerAction() == IPY_GameWorld.paAttack:
        return True
    
#    # ½øÈëÕ½¶·×´Ì¬
#    if curPlayer.IsBattleState():
#        return True
 
    return False
#---------------------------------------------------------------------
##×Ô¶¯½øÈëÕ½¶·¶ÔÖÅ //ÕâÀï²»¼ÓÏêϸÑéÖ¤
# @param curPlayer Íæ¼ÒʵÀý
# @return ·µ»ØÖµÎÞÒâÒå
# @remarks ×Ô¶¯½øÈëÕ½¶·¶ÔÖÅ //ÕâÀï²»¼ÓÏêϸÑéÖ¤
def AutoEnterPlayerConfronting(curPlayer):
#    
#    if curPlayer.GetIsConfronting():
#        return
#    
#    actObj = curPlayer.GetActionObj()
#    
#    if not actObj:
#        return
#    
#    curPlayer.SetIsConfronting(True)
#    #֪ͨ¿Í»§¶Ë //0½øÈë;ÆäËûÍ˳ö
#    curPlayer.View_PlayerBattle(actObj.GetID(), actObj.GetGameObjType(), 0)
#    
#    #Ìí¼Ó²âÊÔÐÅÏ¢
#    GameWorld.GodLog(curPlayer, 'Server×Ô¶¯½øÈëÕ½¶·¶ÔÖųɹ¦')
    return
 
#---------------------------------------------------------------------
##//¶ÔÍâ½Ó¿Ú, Öж϶ÔÖÅ
# @param curPlayer Íæ¼ÒʵÀý
# @return ·µ»ØÖµÎÞÒâÒå
# @remarks //¶ÔÍâ½Ó¿Ú, Öж϶ÔÖÅ
def ExitPlayerConfronting(curPlayer):
#    if not curPlayer.GetIsConfronting():
#        return
#    
#    #Í˳ö¶ÔÖÅ
#    curPlayer.SetIsConfronting(False)
#    #֪ͨ¿Í»§¶Ë //0½øÈë;ÆäËûÍ˳ö
#    curPlayer.View_PlayerBattle(0, 0, 1)
#    
#    #Çå³ýÕ½³è³ðºÞ
#    PetControl.ClearFightPetAngry(curPlayer)
#    
#    #Ìí¼Ó²âÊÔÐÅÏ¢
#    GameWorld.GodLog(curPlayer, 'Í˳öÕ½¶·¶ÔÖųɹ¦')
    return
 
#---------------------------------------------------------------------
##²É¼¯´ò¶Ï
# @param curPlayer Íæ¼ÒʵÀý
# @return ·µ»ØÖµÎÞÒâÒå
# @remarks ²É¼¯´ò¶Ï
def BreakPlayerCollect(curPlayer):
#    #²É¼¯¶¼²»´ò¶Ï
#    return
    
    if curPlayer.GetPlayerAction() != IPY_GameWorld.paPreparing:
        return
    #GameWorld.Log('    ²É¼¯´ò¶Ï curPlayer.GetPrepareState()=%s'%curPlayer.GetPrepareState())
    if curPlayer.GetPrepareState() not in [IPY_GameWorld.pstMissionCollecting, ShareDefine.Def_PstProduce]:
        #¼´²»ÊÇÈÎÎñ²É¼¯Ò²²»ÊÇÉú²ú²É¼¯
        return
    
    #¸±±¾Öв»´ò¶Ï
    #if GameWorld.GetMap().GetMapFBType() != IPY_GameWorld.fbtNull:
    #    return
    
    tagObj = curPlayer.GetActionObj()
    
    if tagObj == None:
        #ûÓÐÄ¿±ê
        #GameWorld.Log("BreakPlayerCollect -> Ã»ÓÐÄ¿±ê", curPlayer.GetPlayerID())
        return
            
    if tagObj.GetGameObjType() != IPY_GameWorld.gotNPC:
        #²É¼¯¶ÔÏó²»¶Ô
        #GameWorld.Log("BreakPlayerCollect -> ²É¼¯¶ÔÏó²»¶Ô", curPlayer.GetPlayerID())
        return
    
    curNPC = GameWorld.GetNPCManager().GetNPCByIndex(tagObj.GetIndex())
    if curNPC == None:
        #ûÓÐÕâ¸öNPC
        #GameWorld.Log("BreakPlayerCollect ->ûÓÐÕâ¸öNPC", curPlayer.GetPlayerID())
        return
    
    npcID = curNPC.GetNPCID()
    collectNPCIpyData = IpyGameDataPY.GetIpyGameDataNotLog("CollectNPC", npcID)
    if not collectNPCIpyData:
        return
    
    if not collectNPCIpyData.GetCanBreakCollect():
        return
    
    #È¡Ïû²É¼¯×´Ì¬
    ChangePlayerAction(curPlayer, IPY_GameWorld.paNull)
    
    if curPlayer.GetActionObj() != None:
        curPlayer.SetActionObj(None)
    return
 
#---------------------------------------------------------------------
##Íæ¼Ò´ò×ø
# @param curPlayer Íæ¼ÒʵÀý
# @param tick Ê±¼ä´Á
# @return ·µ»ØÖµÎÞÒâÒå
# @remarks Íæ¼Ò´ò×ø
def DoPlayerSit(curPlayer, tick):
    #ÒѾ­ÔÚ´ò×ø×´Ì¬ÁË
    if curPlayer.GetPlayerAction() == IPY_GameWorld.paSit:
        return
    
    #Í¨ÖªÍ£Ö¹ÒÆ¶¯
    curPlayer.StopMove()
    #¼¤»îÍæ¼Ò״̬, »Ø¸´CDÊÇ3Ãë, Íæ¼Ò´ôÖÍΪ5Ãë, Òª¼¤»îÒ»ÏÂ
    SetIsNeedProcess(curPlayer, True)
    #Íæ¼Ò×øÏÂ
    curPlayer.Sit()
    
    #ÉèÖÃÕæÆø¿ªÊ¼»Ö¸´Ê±¼ä
    #curPlayer.SetDict(ChConfig.Def_PlayerKey_SitForZhenQi, tick)
    #ÉèÖøßЧÁ·¹¦¿ªÊ¼Ê±¼ä
    #curPlayer.SetDict(ChConfig.Def_PlayerKey_EfficientSit, tick)
    return
 
#---------------------------------------------------------------------
##Íæ¼ÒÕ¾Æð
# @param curPlayer Íæ¼ÒʵÀý
# @return ·µ»ØÖµÎÞÒâÒå
# @remarks Íæ¼ÒÕ¾Æð
def DoPlayerStand(curPlayer):
    #²»ÔÚ´ò×ø×´Ì¬
    if curPlayer.GetPlayerAction() != IPY_GameWorld.paSit:
        return
    
    curPlayer.Stand()
    
    
    return
#---------------------------------------------------------------------
##Íæ¼Ò²¥·Å±íÇé
# @param curPlayer Íæ¼ÒʵÀý
# @return ·µ»ØÖµÎÞÒâÒå
# @remarks Íæ¼Ò²¥·Å±íÇé
def DoPlayerShowPlayerFace(curPlayer, faceType):
    #Çå¿ÕÍæ¼Òµã»÷
    curPlayer.SetActionObj(None)
    #֪ͨÖжÏÕ½¶·¶ÔÖÅ
    ExitPlayerConfronting(curPlayer)
    #Í¨ÖªÍ£Ö¹ÒÆ¶¯
    curPlayer.StopMove()
    #֪ͨ¿Í»§¶Ë²¥·Å±íÇé
    curPlayer.View_ShowPlayerFace(faceType)
    return
 
#---------------------------------------------------------------------
##Íæ¼ÒËÀÍö
# @param curPlayer Íæ¼ÒʵÀý
# @return ·µ»ØÖµÎÞÒâÒå
# @remarks Íæ¼ÒËÀÍö
def DoPlayerDead(curPlayer):
    
    #Í¨ÖªÍ£Ö¹ÒÆ¶¯
    curPlayer.StopMove()
 
    #Íæ¼ÒËÀÍö
    curPlayer.SetDead(curPlayer.GetDictByKey(ChConfig.Def_NPCDead_KillerID),
                      curPlayer.GetDictByKey(ChConfig.Def_NPCDead_KillerType))
    return
#---------------------------------------------------------------------
##Íæ¼ÒË¢ÐÂ×ø±ê
# @param curPlayer Íæ¼ÒʵÀý
# @param checkObj ¼ì²é¶ÔÏó
# @param posX Æðµã×ø±êX
# @param posY Æðµã×ø±êY
# @param canChangeClientPos ÊÇ·ñÖØÖõ½¿Í»§¶Ë×ø±êµã
# @return ·µ»ØÖµÕæ, Ë¢Ð³ɹ¦
# @remarks Íæ¼ÒË¢ÐÂ×ø±ê
def PlayerRefreshPos(curPlayer, checkObj, posX, posY, canChangeClientPos=True):
    if not curPlayer.GetMapLoadOK():
        #Ë¢ÐÂʧ°Ü
        #×¢Òâ: Ò»¶¨ÒªÅжÏ, ÒòΪÔÚÍæ¼ÒʹÓü¼ÄܵÄʱºò»áË¢ÐÂÕâÀï
        #Èç¹ûÍæ¼Ò¶ÁȡûÓгɹ¦, ¾Í²»´¦ÀíÕâ¸ö·â°ü
        GameWorld.Log('µØÍ¼Ã»ÓжÁÈ¡³É¹¦, Ë¢ÐÂʧ°Ü', curPlayer.GetPlayerID())
        return False
    
    if not curPlayer.GetSpeed():
        GameWorld.Log("ûÓÐËٶȲ»ÄÜË¢ÐÂ×ø±ê!", curPlayer.GetPlayerID())
        return False
    
    curMap = GameWorld.GetMap()
    
    #¼ì²éÍæ¼ÒͣϵÄ×ø±êÊÇ·ñÕýÈ·
    needResetPos = False
    
    if curMap.CanMove(posX, posY) != True:
        #ÌßÍæ¼ÒÏÂÏß
        #curPlayer.Kick(IPY_GameWorld.disPlayerPosError)
        #°ÑÍæ¼Ò´ò»ØÖØÉúµã
#        playerControl = PlayerControl(curPlayer)
#        playerControl.SetToBornPlace()
        #ÒÔÉÏ´¦ÀíÌ«¹ýÑϸñ, Ä¿Ç°²»Åж¨
        #-----------------------------------------
        #ÔÚÍæ¼ÒÖÜΧÕÒµ½Ò»¸ö¿É×ߵĵã, °ÑËû·Å¹ýÈ¥
        resultPos = GameMap.GetEmptyPlaceInArea(posX, posY, ChConfig.Def_DropItemDist)
 
        if resultPos.GetPosX() == posX and resultPos.GetPosY() == posY:
            #Íæ¼ÒÖØÖÃλÖÃʧ°Ü
            GameWorld.Log('Íæ¼ÒÖØÖÃλÖÃʧ°Ü, °ÑÍæ¼Ò´ò»ØÖØÉúµã posX = %s posY = %s' \
                          % (posX, posY), curPlayer.GetPlayerID())
#===============================================================================
#            playerControl = PlayerControl(curPlayer)
#            playerControl.SetToBornPlace()
#===============================================================================
            #ÔÝʱÍêÈ«ÐÅÈοͻ§¶Ë×ø±ê£¬±ÜÃâ±ßÔµ»¯ÎÞ·¨¹¥»÷ÎÊÌâ
            return False
        
        GameWorld.Log("×ø±ê´íÎ󣬼ì²éÍæ¼ÒͣϵÄ×ø±êÊÇ·ñÕýÈ· posX = %d, posY = %d, ÖØÖÃλÖÃ:posX = %d, posY = %d" \
                      % (posX, posY, resultPos.GetPosX(), resultPos.GetPosY()), curPlayer.GetPlayerID())
        
        posX = resultPos.GetPosX()
        posY = resultPos.GetPosY()
        
        #±ßÔµÕϰ­µãÈÿͻ§¶ËÐÐ×ߣ¬·þÎñ¶Ë¸Ä±äλÖò»Í¨Öª
        #needResetPos = True
        #checkObj.ResetPos(posX, posY)
    
    #µ±Ç°¶ÔÏó×ø±ê
    objPosX = checkObj.GetPosX()
    objPosY = checkObj.GetPosY()
#    objDestPosX = checkObj.GetDestPosX()
#    objDestPosY = checkObj.GetDestPosY()
#    objStartX = checkObj.GetStartPosX()
#    objStartY = checkObj.GetStartPosY()
    #¼ÆËãÍæ¼Ò·¢¹ýÀ´µÄֹͣλÖúͷþÎñÆ÷ÒÑÓÐ×ø±êµÄ¾àÀë
    dist = GameWorld.GetDist(posX, posY, objPosX, objPosY)
    
    #ÒÆ¶¯µÄÌØµã£º¿Í»§¶ËÒÆ¶¯Îª1Ã×С¼ä¸ô·¢°ü£¬·þÎñ¶ËµÄUpdatePos ¾­³£ Î´Ö´Ðе¼ÖÂÎÞ·¨Òƶ¯£¬Òƶ¯ÐÐΪ±ä³É  __FixPlayerPos-¡·ChangePos¿ØÖÆ
    #Íâ²ãÒÆ¶¯tick ¿ØÖƼä¸ô·ÀÖ¹Íâ¹Ò°ü
    if dist <= 3:
        #µÚÒ»ÖÖÇé¿ö:¿Í»§¶ËºÍ·þÎñÆ÷¶Ë¾àÀë²î¾à·ûºÏÒªÇó
        #λÖÿÉÒÔ½ÓÊÜ
        __FixPlayerPos(checkObj, posX, posY, needResetPos, canChangeClientPos)
        return True
    else:
        #¾àÀëÆ«²îÌ«´ó£¬À­»ØÎ»Öò»×öÌßÈËÂß¼­
        needResetPos = True
        GameWorld.DebugLog('Client=(%s,%s), Server=(%s,%s), ²îÒì¾àÀë=%s' \
                     % (posX, posY, objPosX, objPosY, dist))
        posX = objPosX
        posY = objPosY
        __FixPlayerPos(checkObj, posX, posY, needResetPos, canChangeClientPos)
        return False
    
    # Êµ¼Ê´Ëº¯ÊýÔÚ¶Ô»°  ¹¥»÷ Òƶ¯¶¼»á×ß½øÀ´Åж¨
    #===========================================================================
    # curPlayer.SetMoveCount(curPlayer.GetMoveCount() + 1)
    # if curPlayer.GetMoveCount() >= 10:
    #    curPlayer.SetMoveCount(0)
    #    curPlayer.SetMoveDistDiff(0)
    #    needResetPos = True
    #    
    # if curPlayer.GetMoveDistDiff() >= 30:
    #    curPlayer.SetMoveCount(0)
    #    curPlayer.SetMoveDistDiff(0)
    #    needResetPos = True
    #===========================================================================
    __FixPlayerPos(checkObj, posX, posY, needResetPos, canChangeClientPos)
 
    return True
#    curPlayer.SetMoveCount(curPlayer.GetMoveCount() + 1)
#    
#    #Def_PlayerMoveCheckClearCount:
#    #Íæ¼ÒÒÆ¶¯¶àÉÙ´ÎÇå¿ÕÕâ¸öÀۼƴíÎó        
#    if curPlayer.GetMoveCount() >= ReadChConfig.GetEvalChConfig('Def_PlayerMoveCheckClearCount'):
#        curPlayer.SetMoveCount(0)
#        curPlayer.SetMoveDistDiff(0)
#    
#    #¾àÀë(Æðµã-¿Í»§¶ËλÖÃ-·þÎñÆ÷¶ËλÖÃ-ÖÕµã)
#    severDist = GameWorld.GetDist(objPosX, objPosY, objDestPosX, objDestPosY)
#    severTotalDist = GameWorld.GetDist(objStartX, objStartY, objDestPosX, objDestPosY)
#    clientDist = GameWorld.GetDist(posX, posY, objDestPosX, objDestPosY)
#    
#    clientSlow = False
#    
#    if clientDist >= severDist and clientDist <= severTotalDist:
#        #·½Ïò
#        severDir = GameWorld.GetAngle(objStartX, objStartY, objDestPosX, objDestPosY) 
#        clientDir = GameWorld.GetAngle(posX, posY, objDestPosX, objDestPosY)
#    
#        clientSlow = True    
##===============================================================================
##        #2011-1-19 ´ËÖÖÇé¿öÒ²Òª¼ÆËãÎó²î
##        #Èç¹û½Ç¶È²î±ð10¶È, ÔòÈÏΪ¿ÉÒÔ½ÓÊÜ
##        dirDiff = 10
##        dirDiffValue = abs(severDir - clientDir)
##        
##        if dirDiffValue <= dirDiff:
##            #µÚ¶þÖÖÇé¿ö:·þÎñÆ÷±È¿Í»§¶Ë¿ì
##            #¿ÉÒÔ½ÓÊÜ
##            __FixPlayerPos(checkObj, posX, posY, needResetPos, canChangeClientPos)
##            return True
##===============================================================================
#    #·þÎñÆ÷±È¿Í»§¶ËÂý#ChConfig.Def_AcceptPlayerStopPlaceDist:
#    if dist > ReadChConfig.GetEvalChConfig('Def_AcceptPlayerStopPlaceDist'):
#        return False
#        #ÌßÍæ¼ÒÏÂÏß
#        if clientSlow:
#            GameWorld.ErrLog("³¬´óÎó²î, ¿Í»§¶Ë±È·þÎñÆ÷Âý %d" % dist, curPlayer.GetPlayerID())
#        else:
#            GameWorld.ErrLog("³¬´óÎó²î, ·þÎñÆ÷±È¿Í»§¶ËÂý %d" % dist, curPlayer.GetPlayerID())
#            #·þÎñÆ÷¶Ë±È¿Í»§¶ËÂý¿ÉÒÔ½ÓÊÜ
#            return False
#        
#        #GameWorld.GodLog(curPlayer, '³¬´óÎó²î, Ôݲ»´¦Àí, clientSlow = %s, dist = %s'%(clientSlow, dist))
#        
#        #³¬´óÎó²î·âÍ£Õ˺Åʱ¼ä
#        closeAccIDTime = ReadChConfig.GetEvalChConfig('Def_BigErrorDistCloseAccTime')
#    
#        if closeAccIDTime > 0:
#            #³¬´óÎó²î·âÍ£Íæ¼Ò
#            PlayerGMOper.ClosePlayerByAccID(curPlayer, closeAccIDTime, 'BigErrorDist = %s Kick' % (dist))
#        else:
#            #³¬´óÎó²îÌß³öÍæ¼Ò
#            curPlayer.Kick(IPY_GameWorld.disPlayerMoveToFar)
#    
#        return False
#    
#    #ֹͣλÖÿɽÓÊÜ,µ±Ðè¼Ç¼
#    curMoveDistDiff = curPlayer.GetMoveDistDiff() + dist
#    curPlayer.SetMoveDistDiff(curMoveDistDiff)
#    
#    #ÐÂÔöÒÆ¶¯×ø±ê²îÖµDebugÌáʾÐÅÏ¢,·½±ã¿Í»§¶Ë²éѯ
#    GameWorld.GodLog(curPlayer, 'Client=(%s,%s), Server=(%s,%s), ÀÛ¼Ó¾àÀë=%s, ÀÛ¼Ó×ÜÖµ=%s' \
#                     % (posX, posY, objPosX, objPosY, dist, curPlayer.GetMoveDistDiff()))
#    
#    #Íæ¼ÒÒÆ¶¯100´Î¼ì²éÒ»´Î
#    if curPlayer.GetMoveCount() >= ReadChConfig.GetEvalChConfig('Def_PlayerMoveCheckCount'):
#        maxMoveDistDiff = ReadChConfig.GetEvalChConfig('Def_PlayerMoveCheckDist')
#        #2009/07/15 Òò¸±±¾À­ÈË˲¼ä¾àÀë¹ý´ó£¬¸±±¾Åж¨¾àÀëË«±¶
#        if GameWorld.GetMap().GetMapFBType() != IPY_GameWorld.fbtNull:
#            maxMoveDistDiff = maxMoveDistDiff * 2
#        
#        if curMoveDistDiff >= maxMoveDistDiff:
#            return False
#            GameWorld.Log("Íæ¼ÒÒÆ¶¯´íÎó´ÎÊý = %s, Òƶ¯ÀۼƾàÀë = %s, ÌßÍæ¼ÒÏÂÏß" \
#                          % (curPlayer.GetMoveCount(), curMoveDistDiff), curPlayer.GetPlayerID())
#            
#            closeAccIDTime = ReadChConfig.GetEvalChConfig('Def_MoveDistErrorCloseAccTime')
#            
#            if closeAccIDTime > 0:
#                PlayerGMOper.ClosePlayerByAccID(curPlayer, closeAccIDTime, 'MoveCheckKick, ErrDist = %s' \
#                                                % (curMoveDistDiff))
#            else:
#                curPlayer.Kick(IPY_GameWorld.disPlayerMoveAddUpError)
#
#            return False
#
#    #µÚ3ÖÖÇé¿ö:¼Ç¼²¢½ÃÕý×ø±ê
#    __FixPlayerPos(checkObj, posX, posY, needResetPos, canChangeClientPos)
#    return True
 
#---------------------------------------------------------------------
##½ÃÕýÍæ¼Ò×ø±ê
# @param checkObj ¼ì²éµÄ¶ÔÏó
# @param changePosX ½ÃÕýµÄ×ø±êX
# @param changePosY ½ÃÕýµÄ×ø±êY
# @param needResetServerPos  ÊÇ·ñ°´·þÎñÆ÷λÖÃÖØÖÃ
# @param needChangeClientPos ÊÇ·ñ°´¿Í»§¶ËλÖÃÖØÖÃ
# @return ·µ»ØÖµÎÞÒâÒå
# @remarks ½ÃÕýÍæ¼Ò×ø±ê
def __FixPlayerPos(checkObj, changePosX, changePosY, needResetServerPos, needChangeClientPos):
    #---°´·þÎñÆ÷λÖÃÖØÖÃ---
    if needResetServerPos:
        checkObj.ResetPos(changePosX, changePosY)
        return
    
    #---°´¿Í»§¶ËλÖÃÖØÖÃ---
    if needChangeClientPos:
        checkObj.ChangePos(changePosX, changePosY)
        return
    
    return
#---------------------------------------------------------------------
def OnDelayDeleteMirror(curPlayer, tick):
    addTick = curPlayer.GetDictByKey("DelayDeleteMirror")
    if not addTick:
        return
    if tick - addTick < 10000: # 10sºó»ØÊÕ
        return
    DeleteMirror(curPlayer, False)
    return True
 
def DeleteMirror(curPlayer, isDelay=False):
    ''' »ØÊÕ¾µÏñÍæ¼Ò
    '''
    if not curPlayer.GetRealPlayerID():
        return
    playerID = curPlayer.GetPlayerID()
    if isDelay:
        #ÓÉÓÚϵͳ³¡´Î¿ìËÙÕ½¶·Ô­Òò£¬Èç¹ûÁ¢Âí»ØÊÕ¿ÉÄܵ¼ÖÂij¸ö¹¦ÄܳöÏÖÎÊÌâ
        #Èç±»¶¯¼¼ÄÜЧ¹û£¬Ö´ÐÐ˳ÐòµÄÔ­Òò£¬Èç»÷ɱºó -> ½áËã -> »ØÊÕÍæ¼Ò -> ´¥·¢±»¶¯¼¼ÄÜ£¬µ¼ÖÂÒì³£
        GameWorld.DebugLog("¾µÏñÍæ¼ÒÉèÖÃÑÓ³Ù»ØÊÕ!", playerID)
        SetPlayerSightLevel(curPlayer, playerID)
        tick = GameWorld.GetGameWorld().GetTick()
        curPlayer.SetDict("DelayDeleteMirror", tick)
        return
    GameWorld.DebugLog("¾µÏñÍæ¼Ò»ØÊÕ!", playerID)
    #ɱËÀËùÓÐÕÙ»½µÄÁé
    KillPlayerSummonNPC(curPlayer)
    #ÕÙ»½»Ø³öÕ½µÄ³èÎï
    PetControl.ReCallFightPet(curPlayer)
    curPlayer.DeleteMirror()
    return
 
##ɱËÀÍæ¼ÒËùÓеÄÕÙ»½ÊÞËÀÍö
# @param curPlayer Íæ¼ÒʵÀý
# @return ·µ»ØÖµÎÞÒâÒå
# @remarks É±ËÀÍæ¼ÒËùÓеÄÕÙ»½ÊÞËÀÍö
def KillPlayerSummonNPC(curPlayer):
    #½«Éæ¼°µ½C++ÖÐÁбíɾ³ýµÄ¹¦ÄÜ,ͳһ¸Ä³É -> ¸´ÖÆPyÁбíºó,È»ºó½øÐÐɾ³ýÂß¼­ (ÒòWhileÓм¸Âʽ«µ¼ÖÂËÀËø)
    summon_List = []
    for index in range(curPlayer.GetSummonCount()):
        curSummonNPC = curPlayer.GetSummonNPCAt(index)
        summon_List.append(curSummonNPC)
    
    for summonNPC in summon_List:
        NPCCommon.SetDeadEx(summonNPC)    
    return
#---------------------------------------------------------------------
##¼ì²éÍæ¼ÒͨÓõÄ״̬ת»»
# @param curPlayer Íæ¼ÒʵÀý
# @return ·µ»ØÖµÕæ, ÔÊÐíÇл»×´Ì¬
# @remarks ¼ì²éÍæ¼ÒͨÓõÄ״̬ת»»
def PlayerCanStateTransfer(curPlayer):
    curPlayerAction = curPlayer.GetPlayerAction()
    #Èç¹ûÍæ¼ÒÊÇ×øÏÂ״̬, ×Ô¶¯×ª»»ÎªÕ¾Á¢×´Ì¬
    #DoPlayerStand(curPlayer)
        
    return (curPlayerAction in ChConfig.Def_Player_Can_Transfer_State)
 
#------------------------------Íæ¼ÒÀ뿪·þÎñÆ÷µÄÂß¼­------------------------------------
#---------------------------------------------------------------------
##ïÚ³µÏÂÏßÂß¼­
# @param curPlayer Íæ¼ÒʵÀý
# @return ·µ»ØÖµÎÞÒâÒå
# @remarks ïÚ³µÏÂÏßÂß¼­
def __TruckPlayerDisconnect(curPlayer):
    return
 
    #ÔÚïÚ³µ
    if PlayerTruck.GetHaveAutoTruck(curPlayer):
        curPlayerTruck = curPlayer.GetTruck()
        curPlayerTruck.SetOwner(None)
        PlayerTruck.PlayerTruckDown(curPlayer, curPlayerTruck)
        
    return
#---------------------------------------------------------------------
##ÆïÂíÏÂÏßÂß¼­
# @param curPlayer Íæ¼ÒʵÀý
# @return ·µ»ØÖµÎÞÒâÒå
# @remarks ÆïÂíÏÂÏßÂß¼­
def __RidingHorsePlayerDisconnect(curPlayer):
    #ÔÚÆïÂí
    if curPlayer.GetPlayerVehicle() == IPY_GameWorld.pvHorse:
        #Ö´ÐÐÏÂÂíÂß¼­
        PlayerHorse.PlayerRideHorseDown(curPlayer, False)
        
    return
#---------------------------------------------------------------------
##Íæ¼ÒÏÂÏß/Íæ¼ÒÇл»µØÍ¼¹«ÓÃÂß¼­
# @param curPlayer Íæ¼ÒʵÀý
# @param tick Ê±¼ä´Á
# @return ·µ»ØÖµÎÞÒâÒå
# @remarks Íæ¼ÒÏÂÏß/Íæ¼ÒÇл»µØÍ¼¹«ÓÃÂß¼­
def __PlayerLeaveServerLogic(curPlayer, tick, isDisconnect):
    #¸øÓèÍæ¼Ò²¹³¥
    #PlayerExpiation.GivePlayerExpiation(curPlayer, tick)
    
    #ÔËÐÐÀëÏßxml
    EventShell.EventResponse_OnLeaveMap(curPlayer)
    
    #Èç¹ûÍæ¼ÒÓÐæô³µ, °Ñæô³µµÄÖ÷ÈËÉèÖÃΪNone
    curPlayerTruck = curPlayer.GetTruck()
    
    if curPlayerTruck != None:
        curPlayerTruck.SetOwner(None)
 
    #ˢм¼ÄÜÊ£Óàʱ¼ä
    SkillCommon.RefreshAllSkillRemainTime(curPlayer, tick)
    
    #Èç¹ûÔÚ½»Ò×״̬,È¡Ïû½»Ò×Ë«·½µÄ½»Ò×״̬²¢½â³ý½»Ò×À¸ÖÐÎïÆ·Ëø¶¨×´Ì¬
    PlayerTrade.LeaveTrade(curPlayer, 0)
    
    #¶ÓÎéÍæ¼ÒÍ˳öµØÍ¼
    PlayerTeam.TeamPlayerLeaveMap(curPlayer, tick, isDisconnect)
 
    #Í˳ö²É¼¯
    NPCCommon.ClearCollectNPC(curPlayer)
    #½áÊøÊ¼þ
    EventShell.DoExitEvent(curPlayer)
 
    #ÉèÖÃÍæ¼ÒµÄµØÍ¼Î»ÖÃ, Èç¹ûÊǸ±±¾, À뿪¸±±¾
#    ¸±±¾¹æÔò:
#    1. Ò»¸ö¶ÓÎéÖ»ÓÐÒ»¸ö¸±±¾, Èç¹ûÓжÓÔ±µÄ¸±±¾ºÍ¶ÓÎ鸱±¾²»Ò»ÖÂ, Ôò´Ó¸±±¾ÖÐÌß³ö´Ë¶ÓÔ±
#    2. Íæ¼ÒÏÂÏßÔÙÉÏ, ¾ÍÀ뿪¸±±¾
#    3. Èç¹ûûÓÐÍæ¼Ò´æÔÚ, ¸±±¾»ØÊÕ
    if GameWorld.GetMap().GetMapFBType() != 0:
        #À뿪¸±±¾
        fbIndex = GameWorld.GetGameWorld().GetCurGameWorldIndex()
        exitFBType = 1 if isDisconnect else 2
        PyGameData.g_lastExitFBType[fbIndex] = [exitFBType, tick]
        #GameWorld.DebugLog("Íæ¼ÒÀ뿪¸±±¾£ºfbIndex=%s,exitFBType=%s, %s" % (fbIndex, exitFBType, PyGameData.g_lastExitFBType), curPlayer.GetPlayerID())
        FBLogic.DoExitFBLogic(curPlayer, tick)
    
    #Çå¿ÕËùÓв»ÊôÓÚ×Ô¼ºµÄ¹â»·
    #__ClearNoMeAuraBuff(curPlayer)
    
    #Çå¿ÕËùÓÐÀ뿪µØÍ¼²»ÐèÒª±£´æµÄBuff
    __ClearLeaveNoSaveBuff(curPlayer)
    
    #---±£´æÍæ¼ÒÔÚÏßʱ¼ä(°´ÃëËã)---
    UpdateOnLineTime(curPlayer, tick)
    
    PassiveBuffEffMng.OnPlayerLeaveMap(curPlayer)
    
    MirrorAttack.OnPlayerLeaveMap(curPlayer)
    
    #À뿪µØÍ¼Çå¿Õ¶ñÒâ¹¥»÷×Ô¼ºÍæ¼ÒÐÅÏ¢
    if curPlayer.GetPlayerID() in PyGameData.g_maliciousAttackDict:
        PyGameData.g_maliciousAttackDict.pop(curPlayer.GetPlayerID())
        
    PyGameData.g_needRefreshMapServerState = True # ÓÐÍæ¼ÒÀ뿪µØÍ¼ÉèÖÃÐèҪˢÐÂ
    
    PlayerSuccess.FinishDelayAddSuccessProgress(curPlayer, tick)
    playerID = curPlayer.GetPlayerID()
    if not isDisconnect:
        CrossPlayerData.ClearCrossSyncDataCache(curPlayer)
        PyGameData.g_fbBuyBuffTimeDict.pop(playerID, None)
    #Çå³ýµØÍ¼Íæ¼Ò»º´æ
    PyGameData.g_playerFuncAttrDict.pop(playerID, None)
    PyGameData.g_playerEquipPartAttrDict.pop(playerID, None)
    PyGameData.g_equipChangeClassLVInfo.pop(playerID, None)
    NPCCommon.ClearPriWoodPile(curPlayer)
    #ÒÆ³ýµØÍ¼»º´æµÄ¾³½çÄѶÈÍæ¼ÒIDÐÅÏ¢
    for playerIDList in PyGameData.g_realmDiffPlayerDict.values():
        if playerID in playerIDList:
            playerIDList.remove(playerID)
    return
 
##¸üб£´æÍæ¼ÒÔÚÏßʱ¼ä
# @param curPlayer Íæ¼ÒʵÀý
# @param tick Ê±¼ätick
# @return 
def UpdateOnLineTime(curPlayer, tick):
    #---±£´æÍæ¼ÒÔÚÏßʱ¼ä(°´ÃëËã)---
    lastCalcTick = curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_CalcOLTimeTick)
    if lastCalcTick <= 0:
        curPlayer.SetDict(ChConfig.Def_PlayerKey_CalcOLTimeTick, tick)
        return
    
    curPlayer.SetDict(ChConfig.Def_PlayerKey_CalcOLTimeTick, tick)
    
    diffSec = (tick - lastCalcTick) / 1000
    if diffSec > 0:
        curPlayer.SetWeekOnlineTime(curPlayer.GetWeekOnlineTime() + diffSec)
        curPlayer.SetOnlineTime(curPlayer.GetOnlineTime() + diffSec)
        SyncOnLineTimeTotal(curPlayer)
        
    return
 
##ͬ²½ÔÚÏßʱ¼ä
# @param curPlayer Íæ¼ÒʵÀý
# @return 
def SyncOnLineTimeTotal(curPlayer):
    sendPack = ChPyNetSendPack.tagMCOnLineTimeTotal()
    sendPack.Clear()
    sendPack.OnLineTimeTotal = curPlayer.GetOnlineTime()
    NetPackCommon.SendFakePack(curPlayer, sendPack)
    return
 
##ͬ²½×îºóÒ»´Î±³°ü¿ª¸ñÔÚÏßʱ¼ä
# @param curPlayer Íæ¼ÒʵÀý
# @param packType ±³°üÀàÐÍ
# @return 
def SyncOnLineTimeLastOpenPack(curPlayer, packType):
    return
    sendPack = ChPyNetSendPack.tagMCOnlineTimeLastOpenPack()
    sendPack.Clear()
    sendPack.PackType = packType
    sendPack.LastOnLineTime = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_LastAutoOpenPackTick % packType)
    NetPackCommon.SendFakePack(curPlayer, sendPack)
    return
 
##À뿪µØÍ¼Çå¿Õ²»±£´æµÄBuff
# @param curPlayer Íæ¼ÒʵÀý
# @return ·µ»ØÖµÎÞÒâÒå
# @remarks À뿪µØÍ¼Çå¿Õ²»±£´æµÄBuff
def __ClearLeaveNoSaveBuff(curPlayer):
    #×°±¸BuffºÍ±»¶¯BuffÕâÀï²»Çå, Çл»µØÍ¼ºó»áÖØÐ¼ÆËã
    
    #Çå¿ÕËùÓг¡¾°ÀàBuff
    curPlayer.GetMapBuff().Clear()
    
    #2011-01-28 ÐÞ¸ÄΪ¿É±£´æ£¬¹Ê´Ë´¦²»É¾³ý
    #Çå¿ÕËùÓпØÖÆÀàBUFF
    #BUG: ¿ØÖÆÀàBUFF²»´æÊý¾Ý¿â£¬ÇеØÍ¼ºó²»Í¨ÖªÏûʧ£¬¿Í»§¶ËÎÞ·¨É¾³ý
    #curPlayer.GetActionBuffManager().Clear()
    return
 
 
## Çå³ýÏÂÏßÏûʧµÄbuff, ÔÚ¸üÐÂÅÅÐаñ֮ǰ
#  @param curPlayer: Íæ¼ÒʵÀý
#  @return 
def __DisconnectClearBuff(curPlayer, tick):
 
    #ÐèÒª¿¼ÂÇbuff,deBuff,aura,incBuff,mapBuff,³ýÁËequipBuff²»¿¼ÂÇ
    PlayerClearBuff_Single(curPlayer, curPlayer.GetBuffState(), ClearBuffByDisconnect, tick)
    PlayerClearBuff_Single(curPlayer, curPlayer.GetDeBuffState(), ClearBuffByDisconnect, tick)
    PlayerClearBuff_Single(curPlayer, curPlayer.GetAura(), ClearBuffByDisconnect, tick)
    PlayerClearBuff_Single(curPlayer, curPlayer.GetIncBuff(), ClearBuffByDisconnect, tick)
    PlayerClearBuff_Single(curPlayer, curPlayer.GetMapBuff(), ClearBuffByDisconnect, tick)
    PlayerClearBuff_Single(curPlayer, curPlayer.GetActionBuffManager(), ClearBuffByDisconnect, tick)
    PlayerClearBuff_Single(curPlayer, curPlayer.GetProcessBuffState(), ClearBuffByDisconnect, tick)
    PlayerClearBuff_Single(curPlayer, curPlayer.GetProcessDeBuffState(), ClearBuffByDisconnect, tick)
    
    #BUFFЧ¹ûÔÚÍâ²ã¼ÆËã
    #SkillShell.RefreshPlayerBuffOnAttrAddEffect(curPlayer)
    return
 
#---------------------------------------------------------------------
##Íæ¼ÒÀ뿪·þÎñÆ÷
# @param curPlayer Íæ¼ÒʵÀý
# @param tick Ê±¼ä´Á
# @return ·µ»ØÖµÎÞÒâÒå
# @remarks Íæ¼ÒÀ뿪·þÎñÆ÷
def PlayerLeaveServer(curPlayer, tick):
    #³èÎïÏÂÏßÂß¼­, ÕâÀïÒª½øÐÐÅÅÐаñ, ÓÅÏÈ×ö, ±ÜÃâÍæ¼Ò¹â»·µÈÊôÐÔÓ°Ïì³èÎïÊôÐÔʧЧ
    PetControl.DoLogic_PetInfo_OnLeaveServer(curPlayer, tick)
    
    #Çå³ýÏÂÏßÏûʧµÄbuff, ÔÚ¸üÐÂÅÅÐаñ֮ǰ
    __DisconnectClearBuff(curPlayer, tick)
    
    #Çå³ý»ØÊÕÕ½
    #DelRecylcePack(curPlayer)
    
    #ÖØÐÂˢнÇÉ«ÊôÐÔ
    playerControl = PlayerControl(curPlayer)
    playerControl.RefreshAllState()
            
    #Íæ¼ÒÏÂÏ߸üÐÂÅÅÐаñ
    PlayerBillboard.UpdatePlayerBillboardOnLeaveServer(curPlayer) #ÅÅÐаñÒÑʵʱ¸üУ¬¹ÊÏÂÏß²»ÔÙͬ²½
    
    #Íæ¼ÒÏÂÏß֪ͨgameserver¼Ç¼»º´æ£¨·ÅÔÚÏÂÏ߸üÐÂÅÅÐаñÖ®ºó£¬·½±ãGameserverÅжÏÊÇ·ñÐèÒª´æÈëÊý¾Ý¿âÖУ©
    PlayerViewCacheTube.OnPlayerLogOut(curPlayer, tick)
    
    #Íæ¼ÒÏÂÏß/Íæ¼ÒÇл»µØÍ¼¹«ÓÃÂß¼­
    __PlayerLeaveServerLogic(curPlayer, tick, True)
    #ÆïÂíÍæ¼ÒÏÂÏßÂß¼­
    __RidingHorsePlayerDisconnect(curPlayer)
    #ïÚ³µÏÂÏßÂß¼­
    __TruckPlayerDisconnect(curPlayer)
    #ÕÙ»½ÊÞËÀÍö
    KillPlayerSummonNPC(curPlayer)
    #¸üдӱ¾µØÍ¼ÀëÏßÐÅÏ¢
    PyGameData.g_disconnectPlayer[curPlayer.GetPlayerID()] = [tick, curPlayer.GetPosX(), curPlayer.GetPosY()]
    GameWorld.DebugLog("Íæ¼Ò´Ó±¾µØÍ¼ÀëÏß: %s" % PyGameData.g_disconnectPlayer, curPlayer.GetPlayerID())
    return
 
def GetPlayerLeaveServerTick(playerID):
    # »ñÈ¡Íæ¼Ò´Ó±¾µØÍ¼ÖÐÀëÏßʱµÄtick, ×î´óÖ§³Ö1Сʱ, Èç¹ûÓÐÐèÒª´óÓÚ1СʱµÄÇëµ÷Õû³¬Ê±ÏÞÖÆ
    # ×¢: ·µ»ØÖµÎª0ʱ£¬Ö»ÄÜ´ú±íÍæ¼Ò²»ÊÇÔÚ±¾µØÍ¼ÀëÏß1СʱÄÚ£¬²¢²»ÄÜ´ú±íÍæ¼Òµ±Ç°ÊÇ·ñÔÚÏß״̬£¬¿ÉÄÜÔÚÆäËûµØÍ¼
    if playerID not in PyGameData.g_disconnectPlayer:
        return 0
    return PyGameData.g_disconnectPlayer[playerID][0]
 
def GetPlayerLeaveServerPos(playerID):
    # »ñÈ¡Íæ¼Ò´Ó±¾µØÍ¼ÖÐÀëÏßʱµÄ×ø±ê
    # ×¢£ºÊ¹Óñ¾º¯Êýʱ£¬Ò»¶¨ÒªÏÈʹÓú¯Êý GetPlayerLeaveServerTick È·±£ÊÇ´Ó±¾µØÍ¼ÖÐÀëÏߵIJſÉʹÓÃ
    # @return: posX, posY
    if playerID not in PyGameData.g_disconnectPlayer:
        return 0, 0
    return PyGameData.g_disconnectPlayer[playerID][1:3]
 
def RemoveTimeoutLeaveServerPlayerInfo(tick):
    # Ôݶ¨Ã¿ÌìÁ賿5µãÖ´ÐÐÒ»´Î
    for playerID, leaveInfo in PyGameData.g_disconnectPlayer.items():
        leaveTick = leaveInfo[0]
        if tick - leaveTick > 3600000: # Çå³ý³¬Ê±1СʱµÄ¼Ç¼
            PyGameData.g_disconnectPlayer.pop(playerID)
    return
 
def RemoveLeaveServerPlayerInfo(playerID):
    # ÉÏÏßÒÆ³ýÔÚ±¾µØÍ¼ÏÂÏߵļǼ
    if playerID in PyGameData.g_disconnectPlayer:
        PyGameData.g_disconnectPlayer.pop(playerID)
        GameWorld.DebugLog("½øÈë±¾µØÍ¼£¬ÒƳýÉÏ´ÎÔÚ±¾µØÍ¼ÀëÏ߼Ǽ!", playerID)
    return
 
 
##Çå³ý»ØÊÕÕ½
# @param None
# @return None
def DelRecylcePack(curPlayer):
    backPack = curPlayer.GetItemManager().GetPack(IPY_GameWorld.rptRecycle)
    
    for i in range(backPack.GetCount()):
        curItem = backPack.GetAt(i)
        
        if not curItem or curItem.IsEmpty():
            continue
        
        curItem.Clear()
    
    NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_DelPackIndex, 0)
    return
 
 
##Çл»µØÍ¼ïÚ³µÉ趨
# @param curPlayer Íæ¼ÒʵÀý
# @return ·µ»ØÖµÕæ,¿ÉÒÔ´øÉÏïÚ³µÇл»µØÍ¼
# @remarks Çл»µØÍ¼ïÚ³µÉ趨
def __GetCanChangeMapSetTruck(curPlayer):
    curTruck = curPlayer.GetTruck()
    #GameWorld.Log("Íæ¼Ò æô³µ Çл»µØÍ¼Âß¼­")
    if curTruck == None:
        #GameWorld.Log("Íæ¼Ò Ã»ÓРæô³µ")
        return False
    
    dist = GameWorld.GetDist(curTruck.GetPosX(), curTruck.GetPosY(),
                             curPlayer.GetPosX(), curPlayer.GetPosY())
    if dist > ChConfig.Def_PlayerTruckEventDist:
        #GameWorld.Log("Íæ¼ÒºÍæô³µ¾àÀë¹ýÔ¶, æô³µ²»Çл»  %d" %dist)
        return False
    
#    #Íæ¼ÒÏÂæô³µ
#    if curPlayer.GetPlayerVehicle() == IPY_GameWorld.pvTruck :
#        PlayerTruck.PlayerTruckDown(curPlayer,curTruck)
    #GameWorld.Log("Íæ¼ÒºÍæô³µÒ»ÆðÇл»µØÍ¼")
    #1. ÔÚ¶Ô·½µØÍ¼´´½¨æô³µ
    #curTruck.ResetWorldPos(mapID, targetPosX, targetPosY)
    #2. Ïûʧ±¾µØÍ¼æô³µ
    
    return True
 
#---------------------------------------------------------------------
##Íæ¼Ò¿ªÊ¼Çл»µØÍ¼
# @param curPlayer Íæ¼ÒʵÀý
# @param tick Ê±¼ä´Á
# @return ·µ»ØÖµÎÞÒâÒå
# @remarks Íæ¼Ò¿ªÊ¼Çл»µØÍ¼
def DoPlayerResetWorldPos(curPlayer, tick):
    NotifyStartChangeMap(curPlayer) # Í¨Öª¿ªÊ¼Çл»µØÍ¼
    #Ôڴ˺¯ÊýÖв»¿ÉÖжÏ, Ò»¶¨Òªµ÷ÓÃDoResetWorldPosAndClearº¯Êý
    #·ñÔò, »áÔÚBalanceServerÖп¨×¡
    takeTruck = curPlayer.GetChangeMapTakeTruck()
    
    #Èç¹ûÓÐæô³µ, ´øÉÏæô³µ
    if takeTruck == True:
        if not __GetCanChangeMapSetTruck(curPlayer):
            takeTruck = False
            
    #Èç¹û²»Èôøæô³µ, ²¢ÇÒÍæ¼ÒÔÚÈËïÚºÏһ״̬, ÄÇôÈÃÍæ¼Òϳµ
    if takeTruck == False and curPlayer.GetPlayerVehicle() == IPY_GameWorld.pvTruck:
        curTruck = curPlayer.GetTruck()
        if curTruck:
            PlayerTruck.PlayerTruckDown(curPlayer, curTruck)
        
    curPlayer.SetChangeMapTakeTruck(takeTruck)
    
    #À뿪µØÍ¼·þÎñÆ÷
    __PlayerLeaveServerLogic(curPlayer, tick, False)
    
    FBLogic.DoPlayerChangeMapLogic(curPlayer, tick)
    #summonList = list()
    #ÕٻسèÎï
    PetControl.ReCallFightPet(curPlayer)
    #1. É¾³ý×Ô¼º²»ÐèÒªµÄÕÙ»½ÊÞ(»ðÑæÖ®ÁéµÈ)
    #±ØÐëÓÃwhile, ÒòΪÔÚÑ­»·ÖÐҪɾ³ý
    # ÕÙ»½ÊÞÇеØÍ¼²»´ø¹ýÈ¥
    while curPlayer.GetSummonCount():
        summonNPC = curPlayer.GetSummonNPCAt(0)
        NPCCommon.SetDeadEx(summonNPC)
 
#    summonIndex = 0
#    while summonIndex < curPlayer.GetSummonCount():
#        summonNPC = curPlayer.GetSummonNPCAt(summonIndex)
#        
#        #2009.4.21, Èç¹ûÕÙ»½ÊÞµÄËÙ¶ÈΪ0, ´ú±íÕâ¸öÕÙ»½ÊÞΪÕÈ×Ó
#        #Çл»µØÍ¼²»¿É´ø¹ýÈ¥
#        #֮ǰÓÃÓ²Åж¨µÄ
#        if summonNPC.GetSpeed() == 0:
#            #Çл»µØÍ¼²»ÄÜ´ø¹ýÈ¥
#            NPCCommon.SetDeadEx(summonNPC)
#            continue
#            
#        #Çл»µØÍ¼¿ÉÒÔ´ø¹ýÈ¥ , Çå¿ÕÕÙ»½ÊÞ³ðºÞ,ÉËѪÁбí
#        summonNPCControl = NPCCommon.NPCControl(summonNPC)
#        summonNPCControl.ClearNPCAngry()
#        summonNPCControl.ClearNPCHurtList()
#        summonList.append(summonNPC)
#        summonIndex += 1
        
    changeMapID = curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_ChangeMapID)
    # ¸üÐÂ×îºóÒ»´ÎÀ뿪µÄ·ÇÖÐÁ¢³£¹æµØÍ¼, ´ÓÖÐÁ¢µØÍ¼Í˳öʱÐèÒª»Øµ½¸ÃµØ·½£¬±ØÐëÔÚ DoResetWorldPosAndClear Ö®Ç°¸üÐÂ
    if GameWorld.GetMap().GetMapFBType() == IPY_GameWorld.fbtNull and curPlayer.GetMapID() not in IpyGameDataPY.GetFuncEvalCfg("MapLine", 4):
        mapID = curPlayer.GetMapID()
        posX = curPlayer.GetPosX()
        posY = curPlayer.GetPosY()
        lineID = curPlayer.GetClientLineID() # ³£¹æµØÍ¼Ó÷ÖÏßID
        NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FromMapID, mapID)
        NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FromPosX, posX)
        NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FromPosY, posY)
        NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FromLineID, lineID)
        GameWorld.DebugLog("×îºóÒ»´ÎÀ뿪µÄ·ÇÖÐÁ¢³£¹æµØÍ¼¸üÐÂ!mapID=%s,lineID=%s,Pos(%s,%s)" % (mapID, lineID, posX, posY))
    # µ±Ç°Êǿɷµ»ØµÄ¸±±¾µØÍ¼ ÇÒ Ä¿±êµØÍ¼Îª¸±±¾
    elif curPlayer.GetMapID() in ChConfig.Def_CanBackFBMap and curPlayer.GetMapID() != changeMapID \
        and GameWorld.GetMap().GetMapFBTypeByMapID(changeMapID) != IPY_GameWorld.fbtNull:
        mapID = curPlayer.GetMapID()
        posX = curPlayer.GetPosX()
        posY = curPlayer.GetPosY()
        lineID = GetFBFuncLineID(curPlayer) # ¸±±¾Óù¦ÄÜÏß·ID
        NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FromFBMapID, mapID)
        NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FromFBPosX, posX)
        NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FromFBPosY, posY)
        NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FromFBLineID, lineID)
        GameWorld.DebugLog("½øÈ븱±¾Ê±£¬×îºóÒ»´ÎÀ뿪µÄ¿É·µ»ØµÄ¸±±¾ID¸üÐÂ!mapID=%s,lineID=%s,Pos(%s,%s)" % (mapID, lineID, posX, posY))
        
    # À뿪µØÍ¼
    PlayerAssist.OnPlayerLeaveMap(curPlayer)
    
    # ´Ó¸±±¾ÖÐÇÐͼ
    if GameWorld.GetMap().GetMapFBType() != IPY_GameWorld.fbtNull:
        #ĬÈÏ»ØÂúѪ
        if GameObj.GetHP(curPlayer) > 0 and curPlayer.GetPlayerAction() != IPY_GameWorld.paDie and GameObj.GetHP(curPlayer) < GameObj.GetMaxHP(curPlayer):
            GameObj.SetHPFull(curPlayer)
            
    #2. µ÷ÓÃÇл»µØÍ¼½Ó¿Ú
    curPlayer.DoResetWorldPosAndClear()
    
    #3. Íæ¼ÒÒѾ­´«Ë͹ýÈ¥ÁË, É¾³ýÕâ¸öÍæ¼ÒµÄ¸½¼ÓÕÙ»½ÊÞ(æô³µ, »òÕß»ÆÈªÊ¹Õß)
    #for curSummon in summonList:
    #    NPCCommon.SetDeadEx(curSummon)
        
    if takeTruck == True:
        curTruck = curPlayer.GetTruck()
        
        if curTruck != None:
            curPlayer.SetTruck(None)
            curTruck.Disappear()
            
    return
 
#---------------------------------------------------------------------
##Íæ¼ÒÀ뿪¸±±¾
# @param curPlayer Íæ¼ÒʵÀý
# @return ·µ»ØÖµÎÞÒâÒå
# @remarks Íæ¼ÒÀ뿪¸±±¾
def PlayerLeaveFB(curPlayer):
    if not curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_RouteServerInitOK):
        #RouteServerδ³õʼ»¯²»ÔÊÐíÇл»µØÍ¼, »º´æ´¦Àí
        GameServerRefresh.Set_PlayerRouteServerInitOK_OnLeaveFB(curPlayer, 1)
        return
    
    GameWorld.Log("PlayerLeaveFB...", curPlayer.GetPlayerID())
    if GameWorld.IsCrossServer():
        CrossRealmPlayer.PlayerExitCrossServer(curPlayer)
        return
    
    funcLineID = 0
    enterFBFree = False
    #ÖÐÁ¢µØÍ¼»Øµ½ÉÏÒ»´Î·ÇÖÐÁ¢³£¹æµØÍ¼    
    if curPlayer.GetMapID() in IpyGameDataPY.GetFuncEvalCfg("MapLine", 4) or curPlayer.GetMapID() in ChConfig.Def_CanBackFBMap:
        mapID = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FromMapID)
        posX = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FromPosX)
        posY = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FromPosY)
        lineID = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FromLineID)
        # ÖØÖÃ
        NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FromMapID, 0)
        # ÀϺÅÖ§³Ö£¬±¾À´¾ÍÔÚÖÐÁ¢µØÍ¼µÄ£¬·µ»ØÐÂÊÖ´å
        if not mapID:
            # {Ö°Òµ:[dataMapID,posX,posY], ...}
            createRoleMapDict = IpyGameDataPY.GetFuncEvalCfg("CreateRoleMap", 1, {})
            if not createRoleMapDict:
                return
            job = curPlayer.GetJob()
            lineID = 0
            if job in createRoleMapDict:
                mapID, posX, posY = createRoleMapDict[job]
            else:
                mapInfoList = createRoleMapDict.values()
                mapID, posX, posY = mapInfoList[0]
    #À뿪¸±±¾
    else:
        fromFBMapID = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FromFBMapID)
        # »Øµ½ÉÏÒ»´Î¿É·µ»ØµÄ¸±±¾Àï
        if fromFBMapID:
            mapID = fromFBMapID
            posX = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FromFBPosX)
            posY = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FromFBPosY)
            lineID = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FromFBLineID)
            funcLineID = lineID # »Ø¸±±¾µÄÒªÖ¸¶¨¹¦ÄÜÏß·ID
            enterFBFree = True # ·µ»ØµÄÃâ·Ñ½øÈë
            # ÖØÖÃ
            NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FromFBMapID, 0)
            GameWorld.DebugLog("À뿪¸±±¾£¬·µ»Ø¿É֮ǰ¿É·µ»ØµÄ¸±±¾! fromFBMapID=%s,lineID=%s,posXY(%s,%s)" % (mapID, lineID, posX, posY))
        else:
            mapID = curPlayer.GetFromMapID()
            posX = curPlayer.GetFromPosX()
            posY = curPlayer.GetFromPosY()
            lineID = curPlayer.GetFromLineID()
            
    if mapID == curPlayer.GetMapID():
        # Èç¹ûÔÚͬһÕŵØÍ¼, È¡DBÖØÉúµã, ÆÕͨµØÍ¼ÏÂÏßÖØÉÏʱFromMapID»á±»ÉèÖÃΪ±¾µØÍ¼
        gameMap = GameWorld.GetMap()
        mapID, posX, posY = gameMap.GetRebornMapID(), gameMap.GetRebornMapX(), gameMap.GetRebornMapY()
        #posX, posY = GameMap.GetNearbyPosByDis(posX, posY, ChConfig.Def_RebornPos_Area_Range)
        
    #copyMapID = curPlayer.GetCopyMapID()
    GameWorld.Log("PlayerLeaveFB MapID = %d, PosX = %d, PosY = %d" % (mapID, posX, posY), curPlayer.GetPlayerID())
    
    if GameWorldProcess.IsNoPlayerNeedCloseFB() and GameWorld.GetGameWorld().GetMapCopyPlayerManager().GetPlayerCount() == 1:
        #Èç¹û¸±±¾ÖÐÖ»ÓÐÕâÒ»¸öÈË, ÄÇô°ÑÕâ¸ö¸±±¾ÉèÖÃÎªÍæ¼Ò°²È«ÏÂÏß, ¹Ø±Õ¸±±¾
        gameFB = GameWorld.GetGameFB()
        gameFB.SetIsSafeClose(1)
    
    #===============================================================================================
    # #Èç¹ûÍæ¼ÒÊÇËÀÍö״̬£¬ÔòÏȸ´»î£¬ÊÖÓβ߻®²»Ï븴»îÍ˳ö
    # if curPlayer.GetPlayerAction() == IPY_GameWorld.paDie:
    #    curPlayer.Reborn(ChConfig.rebornType_System)
    #    GameObj.SetHPFull(curPlayer)
    #    ChangePlayerAction(curPlayer, IPY_GameWorld.paNull)
    #===============================================================================================
    
    PlayerResetWorldPosFB(curPlayer, mapID, posX, posY, False, lineID, funcLineID=funcLineID, enterFBFree=enterFBFree)
    
    #ÔÚ¿ÕÏлòÕßÒÆ¶¯×´Ì¬ÏÂ,²ÅÄÜËøËÀÍæ¼Ò
    if curPlayer.GetPlayerAction() in [IPY_GameWorld.paNull] or curPlayer.IsMoving():
        #°ÑÍæ¼ÒËøËÀ
        curPlayer.BeginEvent()
    
    return
 
#---------------------------------------------------------------------
 
def PlayerEnterCrossServer(curPlayer, mapID, lineID):
    playerID = curPlayer.GetPlayerID()
    GameWorld.Log("Íæ¼ÒÇëÇó½øÈë¿ç·þµØÍ¼: mapID=%s,lineID=%s" % (mapID, lineID), playerID)
    if mapID not in ChConfig.Def_CrossMapIDList:
        return
    
    tick = GameWorld.GetGameWorld().GetTick()
    lastRequestTick = curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_RequestEnterCrossServerTick)
    if lastRequestTick and tick - lastRequestTick < 5000:
        GameWorld.DebugLog("    ÇëÇó½øÈë¿ç·þCDÖÐ!", playerID)
        NotifyCode(curPlayer, "RequestEnterCrossServerCD")
        return
    
    crossRegisterMap = curPlayer.NomalDictGetProperty(ChConfig.Def_PlayerKey_CrossRegisterMap)
    if crossRegisterMap:
        GameWorld.ErrLog("¿ç·þÒѾ­ÔÚÉÏ´«Êý¾Ý£¬²»Öظ´Ìá½»!crossRegisterMap=%s,mapID=%s" % (crossRegisterMap, mapID), playerID)
        return
    
    if GameWorld.IsCrossServer():
        GameWorld.DebugLog("¿ç·þ·þÎñÆ÷²»ÔÊÐí¸Ã²Ù×÷!")
        return
    
    if GetCrossMapID(curPlayer):
        GameWorld.ErrLog("Íæ¼Òµ±Ç°Îª¿ç·þ״̬£¬²»ÔÊÐíÔÙ´ÎÇëÇó½øÈë¿ç·þ!", curPlayer.GetPlayerID())
        return
    
    if not CrossRealmPlayer.IsCrossServerOpen():
        NotifyCode(curPlayer, "CrossMatching18")
        return
    
    if GameObj.GetHP(curPlayer) <= 0:
        NotifyCode(curPlayer, "CrossMap4")
        return
    
    if PlayerCrossRealmPK.GetIsCrossPKMatching(curPlayer):
        NotifyCode(curPlayer, "CrossMap3")
        return
    
    if PlayerState.IsInPKState(curPlayer):
        NotifyCode(curPlayer, "SingleEnterPK", [mapID])
        return
    
    fbIpyData = FBCommon.GetFBIpyData(mapID)
    if fbIpyData:
        fbLineIpyData = FBCommon.GetFBLineIpyData(mapID, lineID, False)
        if not fbLineIpyData:
            GameWorld.DebugLog("¸±±¾±íÕÒ²»µ½¸±±¾¶ÔÓ¦¹¦ÄÜÏß·!mapID=%s,lineID=%s" % (mapID, lineID))
            return
        ret = FBCommon.CheckCanEnterFBComm(curPlayer, mapID, lineID, fbIpyData, fbLineIpyData)
        if ret != ShareDefine.EntFBAskRet_OK:
            return
        
        if not FBLogic.OnEnterFBEvent(curPlayer, mapID, lineID, tick):
            GameWorld.DebugLog("    OnEnterFBEvent False!", curPlayer.GetPlayerID())
            if mapID in [ChConfig.Def_FBMapID_CrossBattlefield]:
                NotifyCode(curPlayer, "GeRen_chenxin_268121")
            else:
                NotifyCode(curPlayer, "SingleEnterDefaul")
            return
        
    # ÐèÒª¶¯Ì¬·Ö²¼Ïß·µÄµØÍ¼£¬·¢Ë͵½¿ç·þ·þÎñÆ÷½øÐзÖÅä
    if mapID in ChConfig.Def_CrossDynamicLineMap:
        extendInfo = {}
        if mapID == ChConfig.Def_FBMapID_CrossDemonKing:
            bossID = GameLogic_CrossDemonKing.GetCurFBLineBOSSID(mapID, lineID)
            if not bossID:
                return
            extendInfo["BossID"] = bossID
            
        msgDict = {"PlayerID":curPlayer.GetPlayerID(), "MapID":mapID, "FuncLineID":lineID, "LV":curPlayer.GetLV()}
        if extendInfo:
            msgDict.update(extendInfo)
        GameWorld.SendMsgToCrossServer(ShareDefine.ClientServerMsg_EnterFB, msgDict)
    else:
        isSend = GY_Query_CrossRealmReg.RegisterEnterCrossServer(curPlayer, mapID, lineID=lineID)
        if not isSend:
            return
    curPlayer.SetDict(ChConfig.Def_PlayerKey_RequestEnterCrossServerTick, tick)
    return
 
##Íæ¼Ò½øÈ븱±¾
# @param curPlayer Íæ¼ÒʵÀý
# @param mapID µØÍ¼ID
# @param posX ×ø±êX
# @param posY ×ø±êY
# @return ·µ»ØÖµÎÞÒâÒå
# @remarks Íæ¼Òµ¥¶À½øÈ븱±¾
def PlayerEnterFB(curPlayer, mapID, lineID, posX=0, posY=0):
    mapID = FBCommon.GetRecordMapID(mapID)
    GameWorld.Log("Íæ¼ÒÇëÇó½øÈ븱±¾! mapID=%s,lineID=%s,posX=%s,posY=%s" 
                  % (mapID, lineID, posX, posY), curPlayer.GetPlayerID())
    
    # µ±ÈÕ»»Õ½Ã˲»¿É½øÈëµÄµØÍ¼, ¸ÄΪ°´Ð¡Ê±Ëã
    #if mapID in ChConfig.Def_ChangeFamilyCanNotEnterMap:
    #    if PlayerFamily.GetPlayerChangeFamilyPastHour(curPlayer) < 24:
    #        NotifyCode(curPlayer, 'jiazu_xyj_671654')
    #        return
        
#    #¿ç·þ»î¶¯ÈËÊý·ÖÁ÷´¦Àí
#    if GameWorld.IsCrossServer():
#        reqMapID = mapID
#        mapID = __GetMergeFBPlayerMapID(curPlayer, reqMapID)
#        if not mapID:
#            GameWorld.ErrLog("ÕÒ²»µ½¿É·ÖÅä½øÈëµÄ¿ç·þ»î¶¯µØÍ¼ID! reqMapID=%s" % reqMapID)
#            return
      
    #¹ýÂË·â°üµØÍ¼ID
    if not GameWorld.GetMap().IsMapIDExist(mapID):
        GameWorld.ErrLog('###·Ç·¨µØÍ¼Êý¾Ý£¬mapID: %s' % (mapID), curPlayer.GetID())
        return
 
#    if not GameWorld.GetMap().CanMove(curPlayer.GetPosX(), curPlayer.GetPosY()):
#        # ×ø±ê²»¿ÉÒÆ¶¯Ôò²»ÄÜ´«ËÍ£¬²»È»»áµ¼ÖÂÍ˳ö¸±±¾ÎÞ·¨ÍË»ØÀ´Ô´µØ
#        GameWorld.ErrLog("Ô­Õϰ­µãÎÞ·¨Çл»µØÍ¼ %s" % ([curPlayer.GetPosX(), curPlayer.GetPosY()]))
#        return
 
    #½øÈ븱±¾Í¨Óüì²é
    fbIpyData = FBCommon.GetFBIpyData(mapID)
    fbLineIpyData = FBCommon.GetFBLineIpyData(mapID, lineID)
    sceneMapID = mapID if not fbLineIpyData else fbLineIpyData.GetMapID()
    tick = GameWorld.GetGameWorld().GetTick()
    if CheckMoveToFB(curPlayer, mapID, lineID, fbIpyData, fbLineIpyData, tick) != ShareDefine.EntFBAskRet_OK:
        return
#    if mapID == ChConfig.Def_FBMapID_XMZZ:
#        #ÏÉħ֮Õù
#        GameLogic_XMZZ.XMZZStartFight(curPlayer)
#        return
    if posX == 0 and posY == 0:
        ipyEnterPosInfo = FBCommon.GetFBLineEnterPosInfo(mapID, lineID, fbLineIpyData)
        retPos = FBLogic.OnGetFBEnterPos(curPlayer, mapID, lineID, ipyEnterPosInfo, tick)
        
        if not retPos:
            GameWorld.ErrLog("δÕÒµ½½øÈ븱±¾×ø±ê£¡mapID=%s,lineID=%s" % (mapID, lineID))
            return
        
        posX, posY = retPos
        
    #===============================================================================================
    # if not EventShell.DoLogic_EnterFbGameEvent(curPlayer, mapID, tick):
    #    GameWorld.Log("DoLogic_EnterFbGameEvent False£¡mapID=%s,lineID=%s" % (mapID, lineID))
    #    return 
    #===============================================================================================
    
    if curPlayer.IsMoving():
        curPlayer.StopMove()
    
    fbID = 0 # ºó¶ËµÄÐéÄâÏß·
    isSendToGameServer = False
    mapFBType = GameWorld.GetMap().GetMapFBTypeByMapID(sceneMapID) # ÅжÏÊÇ·ñ×é¶Ó±¾ÐèÒªÒÔ³¡¾°µØÍ¼Åжϣ¬ÒòΪ²ß»®¿ÉÄÜÉ趨²»Í¬¹¦ÄÜÏß·IDµÄ¸±±¾ÀàÐͲ»Ò»Ñù£¬±ÈÈçС¾³½ç¡¢´ó¾³½ç
    if mapFBType == IPY_GameWorld.fbtTeam and curPlayer.GetTeamID():
        if curPlayer.GetTeamLV() != IPY_GameWorld.tmlLeader:
            GameWorld.Log("·Ç¶Ó³¤£¬ÎÞ·¨·¢Æð½øÈë×é¶Ó¸±±¾ÇëÇó!", curPlayer.GetPlayerID())
            return
        isSendToGameServer = True
    if isSendToGameServer or mapID in ChConfig.Def_MapID_SendToGameServer \
        or mapID in ReadChConfig.GetEvalChConfig("MapID_SendToGameServer"):
        extendParamList = []
        if mapID == ChConfig.Def_FBMapID_SealDemon:
            newbielineList = IpyGameDataPY.GetFuncEvalCfg('SealDemonNewbieLine', 1)
            # ÐÂÊÖÏßÂ·ÌØÊâ´¦Àí£¬Ö±½Ó½øÈë
            if lineID in newbielineList:
                GameWorld.DebugLog("·âħ̳ÐéÄâÏß·ֻÄÜͨ¹ý×Ô¶¨Ò峡¾°½øÈëÌôÕ½£¡")
                #PlayerResetWorldPosFB(curPlayer, mapID, posX, posY, False, fbID, funcLineID=lineID)
                return
            else:
                bossID = GameLogic_SealDemon.CurFBLineBOSSID(lineID)
                extendParamList = [bossID]
        elif mapID == ChConfig.Def_FBMapID_ZhuXianBoss:
            bossID = GameLogic_ZhuXianBoss.CurFBLineBOSSID(lineID)
            extendParamList = [bossID, -1]
            enterCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_EnterFbCntDay % ChConfig.Def_FBMapID_ZhuXianBoss)
            if enterCnt >= FBCommon.GetEnterFBMaxCnt(curPlayer, ChConfig.Def_FBMapID_ZhuXianBoss):
                if curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ZhuXianBossHelpCnt):
                    extendParamList = [bossID, curPlayer.GetFamilyID()]
        elif mapID == ChConfig.Def_FBMapID_DemonKing:
            bossID = GameLogic_CrossDemonKing.GetCurFBLineBOSSID(mapID, lineID)
            extendParamList = [bossID]
        elif mapID in ChConfig.Def_MapID_LineIDToPropertyID:
            enterCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_EnterFbCntDay % mapID)
            extendParamList = [enterCnt]
        SendToGameServerEnterFB(curPlayer, mapID, lineID, tick, extendParamList)
        return
    
    PlayerResetWorldPosFB(curPlayer, mapID, posX, posY, False, fbID, funcLineID=lineID)
    return
 
##·¢Ë͵½GameServerÇëÇó½øÈ븱±¾
#@param curPlayer Íæ¼Ò
#@param mapID µØÍ¼id
#@param lineID Ïß·id
#@param tick Ê±¼ä´Á
#@return ·µ»ØÖµÎÞÒâÒå
def SendToGameServerEnterFB(curPlayer, mapID, lineID, tick, extendParamList=[]):
    #lineID = FBLogic.GetPlayerFBLineID(curPlayer, mapID, tick)
    
    GameWorld.Log("SendToGameServerEnterFB mapID=%s,lineID=%s,extendParamList=%s" 
                  % (mapID, lineID, extendParamList), curPlayer.GetID())
    # »ñÈ¡Íæ¼ÒËùÊô·ÖÏß
    if lineID == None:
        lineID = FBLogic.GetPlayerFBLineID(curPlayer, mapID, tick)
        
    #GameWorld.DebugLog("send GameServer_QueryPlayerByID")
    # ÇëÇóGameServerÄ¿±ê¸±±¾GameWorldË÷Òý
    sendMsg = [mapID, lineID]
    sendMsg.extend(extendParamList)
    sendMsg = "%s" % sendMsg
    curPlayer.GameServer_QueryPlayerByID(ChConfig.queryType_EnterFB, 0, 'EnterFB', sendMsg, len(sendMsg))
    return
    
##¼ì²éÍæ¼Ò״̬ÊÇ·ñ¿ÉÒÔÒÆ¶¯µ½¸±±¾
#@param curPlayer Íæ¼ÒʵÀý
#@return ·µ»ØÖµÎÞÒâÒå
#@remarks ¼ì²éÍæ¼Ò״̬ÊÇ·ñ¿ÉÒÔÒÆ¶¯µ½¸±±¾
def CheckMoveToFB(curPlayer, mapID, lineID, fbIpyData, fbLineIpyData, tick, isNotify=True, isTeamAsk=False):
    '''ÅжϿɷñ½øÈ븱±¾£¬°üº¬ÊÖ¶¯¼°Æ¥Åä
    @param isTeamAsk: ÊÇ·ñÊǶÓÎé½øÈëÇëÇóµÄ£¬Ò»°ãÊǶÓÎé״̬Ï£¬¶Ó³¤·¢Æð½øÈ븱±¾£¬ÐèÒª¼ì²é¶ÓÔ±¿É·ñ½øÈ룬´ËʱΪTrue£¬¿É×öһЩ¸½¼Ó´¦Àí
    @note: ²ß»®ÒªÇóÌáʾ°´ÓÅÏȼ¶À´£¬¸±±¾×ÔÉíµÄÌõ¼þÏÞÖÆÓÅÏÈÌáʾ£¬ÆäËû¸½¼ÓÌáʾÓÅÏȼ¶½ÏµÍ
    '''
    ret = FBCommon.CheckCanEnterFBComm(curPlayer, mapID, lineID, fbIpyData, fbLineIpyData, 1, isNotify, isTeamAsk)
    if ret != ShareDefine.EntFBAskRet_OK:
        return ret
    
    if GameObj.GetHP(curPlayer) <= 0:
        GameWorld.Log("Íæ¼ÒÒѾ­ËÀÍö, ÎÞ·¨½øÈ븱±¾!")
        return ShareDefine.EntFBAskRet_Dead
    
    if PlayerTJG.GetIsTJG(curPlayer):
        if isNotify:
            NotifyCode(curPlayer, "SingleEnterDefaul", [mapID])
        return ShareDefine.EntFBAskRet_TJG
    
    ## ¶ÓÎé¼ì²éµÄÇé¿ö£¬¶Ó³¤²»´¦Àí£¬Ö»´¦Àí¶ÓÔ±
    if isTeamAsk and curPlayer.GetTeamLV() != IPY_GameWorld.tmlLeader:
        # ºó¶ËÖ»×öboss״̬Ï£¬±»¶¯½øÈ븱±¾ÏÞÖÆ£¬·ÀÖ¹´òbossÖб»À­½øÈ¥¸±±¾
        # boss״̬µÄÆäËû´«ËÍÏÞÖÆÓÉǰ¶Ë¿ØÖÆ£¬ÒòΪ²ß»®Òª¸ù¾Ý½çÃæÀ´´¦Àí£¬ÓÐЩ½çÃæÔÊÐí´«ËÍ£¬ÓÐЩ²»ÔÊÐí
        if PlayerState.IsInBossState(curPlayer):
            return ShareDefine.EntFBAskRet_BossState
        
    ## PK״̬¼ì²é
    if PlayerState.IsInPKState(curPlayer):
        if isNotify:
            NotifyCode(curPlayer, "SingleEnterPK", [mapID])
        return ShareDefine.EntFBAskRet_PKState
    
    ## ¿ç·þPKÆ¥ÅäÖÐ
    if PlayerCrossRealmPK.GetIsCrossPKMatching(curPlayer):
        if isNotify:
            NotifyCode(curPlayer, "CrossMatching8", [mapID])            
        return ShareDefine.EntFBAskRet_CrossPKMatching
    
    ## ¿ç·þµØÍ¼ÖÐ
    if GetCrossMapID(curPlayer) and mapID not in ChConfig.Def_CrossMapIDList:
        if isNotify:
            NotifyCode(curPlayer, "CrossMap5", [mapID])
        return ShareDefine.EntFBAskRet_InCrossMap
    
    #===============================================================================================
    # # ÕâÀï²»×ö״̬ÏÞÖÆ£¬ÓÉǰ¶Ë´¦Àí£¬ÒòΪ²ß»®Òª¸ù¾Ý½çÃæÀ´´¦Àí£¬Í¬Ò»´«Ë͹¦ÄÜÓпÉÄÜÔÚ²»Í¬½çÃæ
    # # PK״̬¼ì²é
    # if PlayerState.IsInPKState(curPlayer):
    #    if isNotify:
    #        NotifyCode(curPlayer, "SingleEnterPK", [mapID])
    #    return ShareDefine.EntFBAskRet_PKState
    # 
    # # ´òboss״̬¼ì²é
    # if PlayerState.IsInBossState(curPlayer):
    #    if isNotify:
    #        NotifyCode(curPlayer, "SingleEnterBoss", [mapID])
    #    return ShareDefine.EntFBAskRet_BossState
    #===============================================================================================
    
    playerAction = curPlayer.GetPlayerAction()
    if playerAction == IPY_GameWorld.paPreparing:
        if isNotify:
            NotifyCode(curPlayer, "SingleEnterGather", [mapID])
        return ShareDefine.EntFBAskRet_Preparing
    
    if playerAction == IPY_GameWorld.paSit:
        if isNotify:
            NotifyCode(curPlayer, "Carry_lhs_697674")
        return ShareDefine.EntFBAskRet_Sit
    
    if curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_ClientCustomScene):
        if isNotify:
            NotifyCode(curPlayer, "Carry_lhs_697674")
        GameWorld.Log("¿Í»§¶Ë×Ô¶¨Ò峡¾°ÏÂÎÞ·¨½øÈ븱±¾!", curPlayer.GetPlayerID())
        return ShareDefine.EntFBAskRet_Other
    
    if playerAction in ChConfig.Def_Player_Cannot_TransState:
        #Carry_lhs_697674£ºÄúµ±Ç°Ëù´¦µÄ״̬²»ÄܽøÐд«ËÍ!
        if isNotify:
            NotifyCode(curPlayer, "Carry_lhs_697674")
        return ShareDefine.EntFBAskRet_Other
    
    for index in ChConfig.Def_Player_NotCan_EnterFbPyGameEvenState:
        if GetPyPlayerAction(curPlayer, index):
            #Carry_lhs_697674£ºÄúµ±Ç°Ëù´¦µÄ״̬²»ÄܽøÐд«ËÍ!
            if isNotify:
                NotifyCode(curPlayer, "Carry_lhs_697674")
            return ShareDefine.EntFBAskRet_Other
        
    #ÒÆ¶¯Öв»Ö´Ðд˲Ù×÷
#    if curPlayer.IsMoving():
#        #NotifyCode(curPlayer, "GeRen_lhs_0")
#        return False
 
#    #À­ïÚÖÐÎÞ·¨´«Ë͵½¸±±¾
#    if curPlayer.GetTruck():
#        #NotifyCode(curPlayer, "Convey_Duplicate_Lost01")
#        return False
 
    #Õ½¶·×´Ì¬ÖÐÎÞ·¨´«Ë͵½¸±±¾
    #if curPlayer.IsBattleState():
    #    NotifyCode(curPlayer, "Carry_lhs_202580")
    #    return False
 
    #µ±Ç°µØÍ¼²»ÊÇÆÕͨµØÍ¼
    if GameWorld.GetMap().GetMapFBType() != IPY_GameWorld.fbtNull:
        canFBMoveToOther = False
        fbEnableTransportMap = ReadChConfig.GetEvalChConfig("FBEnableTransportMap")
        curMapID = GameWorld.GetMap().GetMapID()
        if curMapID in fbEnableTransportMap and mapID in fbEnableTransportMap[curMapID]:
            canFBMoveToOther = True
        if curMapID in ChConfig.Def_CanBackFBMap:
            canFBMoveToOther = True
        toMapFBType = GameWorld.GetMap().GetMapFBTypeByMapID(mapID)
        if toMapFBType == IPY_GameWorld.fbtNull:
            if curMapID in IpyGameDataPY.GetFuncEvalCfg('DungeonDeliver', 1):
                canFBMoveToOther = True
        elif FBCommon.GetRecordMapID(curMapID) == FBCommon.GetRecordMapID(mapID):
            if FBLogic.CanChangeSameDataMapFB(curPlayer, mapID, lineID):
                canFBMoveToOther = True
                
        if not canFBMoveToOther:
            if isNotify:
                NotifyCode(curPlayer, "SingleEnterDungeon", [mapID])
            return ShareDefine.EntFBAskRet_InFB
    
    if not FBLogic.OnEnterFBEvent(curPlayer, mapID, lineID, tick):
        GameWorld.DebugLog("    OnEnterFBEvent False!", curPlayer.GetPlayerID())
        if isNotify:
            NotifyCode(curPlayer, "SingleEnterDefaul")
        return ShareDefine.EntFBAskRet_Other
    
    return ShareDefine.EntFBAskRet_OK
#---------------------------------------------------------------------
##Ë¢ÐÂÍæ¼ÒʱÖÓ£¬ÇеØÍ¼Íæ¼ÒʱÖӼǼÇå¿Õ£¬´¦ÀíÏàÓ¦Âß¼­
# @param curPlayer Íæ¼Ò
# @return ÎÞÒâÒå
# @remarks Ë¢ÐÂÍæ¼ÒʱÖÓ£¬ÇеØÍ¼Íæ¼ÒʱÖӼǼÇå¿Õ£¬´¦ÀíÏàÓ¦Âß¼­
def RefreshPlayerTick(curPlayer):
    tick = GameWorld.GetGameWorld().GetTick()
    
    #·À³ÁÃÔÇÐÏßʱ¼ä
    PlayerGameWallow.DoLogic_WallowOnlineTime(curPlayer, tick)
    return
 
 
#---------------------------------------------------------------------
 
def PlayerResetWorldPosFBLineID(curPlayer, mapID, posX, posY, funcLineID):
    '''Íæ¼ÒÇл»µ½Ö¸¶¨¸±±¾¶ÔÓ¦µÄ¹¦ÄÜÏß·ID£¬ÊÊÓÃÓڶೡ¾°ºÏ²¢Ò»ÕŵØÍ¼µÄÇé¿ö£¬ºó¶ËÐèÔÚͬһÕÅÎïÀíµØÍ¼²ÅÄÜʹÓøú¯Êý
    ÓÉÓÚǰ¶ËµØÍ¼ºÏ²¢µÄ³¡¾°¼ÓÔØÊÇ·Ö¿ªµÄ£¬ËùÒÔÔÚÇг¡¾°µÄʱºò²»ÄÜÖ±½ÓÉèÖÃ×ø±ê£¬ÒòΪǰ¶Ëʵ¼ÊÉϲ»´æÔÚ¸Ã×ø±ê
    Íæ¼ÒÖ±½ÓÔÚµØÍ¼ÖÐÇл»¹¦ÄÜÏß·ID£¬´Ëʱǰ¶ËÐèÒª×ßÕý³£µÄÇÐͼÁ÷³Ì²ÅÄܼÓÔØÄ¿±ê¹¦ÄÜÏß·ID¶ÔÓ¦µÄ³¡¾°
    ¹ÊÕâÀï×ö¸öÐé¼ÙÇÐͼÁ÷³Ì
    '''
    if curPlayer.GetMapID() != mapID:
        return
    
    NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_ReqFBFuncLine, funcLineID)
    GameWorld.Log("Íæ¼Ò¸±±¾Öбä¸ü¹¦ÄÜÏß·ÐéÄâÇеØÍ¼: mapID=%s,posX=%s,posY=%s,funcLineID=%s" 
                  % (mapID, posX, posY, funcLineID), curPlayer.GetPlayerID())
    curPlayer.SetDict(ChConfig.Def_PlayerKey_ChangeMapID, mapID)
    curPlayer.SetDict(ChConfig.Def_PlayerKey_ResetFBLinePosX, posX)
    curPlayer.SetDict(ChConfig.Def_PlayerKey_ResetFBLinePosY, posY)
    
    NotifyPrepareChangeMap(curPlayer, mapID, funcLineID)
    NotifyStartChangeMap(curPlayer)
    
    ## ·¢ËÍ 04 01 ÈËÎïËùÔڵij¡¾°³õʼ»¯#tagPlayerMapInit
    playerMapInit = ChNetSendPack.tagPlayerMapInit()
    playerMapInit.Clear()
    playerMapInit.MapID = mapID
    playerMapInit.PosX = posX
    playerMapInit.PosY = posY
    NetPackCommon.SendFakePack(curPlayer, playerMapInit)
    
    curPlayer.SetSight(0) # ÊÓÒ°ÖÃ0£¬Çгɹ¦ºó»Ö¸´ÊÓÒ°£¬·ÀÖ¹½ÓÏÂÀ´ÌáǰÉèÖÃ×ø±êµ¼ÖÂǰ¶ËÊÓÒ°Ë¢ÐÂÒì³£
    curPlayer.ResetPos(posX, posY) # ÕâÀïÖ±½ÓÉèÖÃ×ø±ê£¬·Àֹǰ¶Ëδ¼ÓÔØ³¡¾°³É¹¦µôÏßµ¼ÖÂÖØµÇºó×ø±ê´íÎó
    SetFBFuncLineID(curPlayer, funcLineID) # ÕâÀïÖ±½ÓÉèÖóÉÄ¿±ê¹¦ÄÜÏß·ID£¬·Àֹǰ¶Ëδ¼ÓÔØ³¡¾°³É¹¦µôÏßµ¼ÖÂÖØµÇºó¼ÓÔØ³¡¾°Òì³£
    
    ## ·¢ËÍ 01 09 ·þÎñÆ÷×¼±¸¾ÍÐ÷#tagServerPrepareOK
    prepareOK = ChNetSendPack.tagServerPrepareOK()
    prepareOK.Clear()
    NetPackCommon.SendFakePack(curPlayer, prepareOK)
    return
 
 
##Íæ¼ÒÇл»µ½Ö¸¶¨¸±±¾ID
# @param curPlayer Íæ¼ÒʵÀý
# @param mapID µØÍ¼ID
# @param posX ×ø±êX
# @param posY ×ø±êY
# @param takeTruck ÊÇ·ñ´øïÚ³µ
# @param FBID ¸±±¾ID, ÐéÄâÏß·ID
# @param msg Ð¯´ýÐÅÏ¢
# @param canLock ÊÇ·ñËø¶¨Íæ¼Ò
# @param funcLineID ¸±±¾¹¦ÄÜÏß·ID£¬ÓÉǰ¶ËÇëÇó
# @return ·µ»ØÖµÎÞÒâÒå
# @remarks Íæ¼ÒÇл»µ½Ö¸¶¨¸±±¾ID
def PlayerResetWorldPosFB(curPlayer, mapID, posX, posY, takeTruck, fbID=0, msg='', canLock=True, funcLineID=0, enterFBFree=False):
    '''
    ²ÎÊý˵Ã÷:
        @param fbID:
            ´óÓÚ0µÄÕûÊý:
                Èç¹û²ÎÊýmapIDÖ¸¶¨µÄµØÍ¼´æÔÚfbIDÖ¸¶¨µÄ·ÖÏߣ¬ÔòÖ±½Ó´«Ë͵½²ÎÊýmapIDËùÖ¸¶¨µÄµØÍ¼µÄfbIDËùÖ¸¶¨µÄ·ÖÏߣ¬·ñÔòÔÚËùÓдæÔڵķÖÏßÖУ¬Ëæ»úѡһÌõ·ÖÏß´«Èë¡£fbIDµÄ¼ÆËã¼ûÏÂÃæfbID=-1µÄ˵Ã÷¡£
            -1£º
                ½Ó¿ÚÄÚ²¿×Ô¶¯Ìæ»»³Éµ±Ç°fbID£¬´«Èë²ÎÊýmapIDËùÖ¸¶¨µÄµØÍ¼£¨ÕâÀï²ÎÊýmapIDÆäʵÊÇDataMapID£©µÄͬһfbIDµÄµØÍ¼(Èç¹ûÓУ¬Ã»ÓÐÔòËæ»ú)¡£
                Ï־͵±Ç°fbIDµÄ¼ÆËã,¾ÙÀý˵Ã÷,¼ÙÉèµØÍ¼AºÍµØÍ¼BÔÚMapID.txtÅäÖÃÈçÏ£º
                MapName     MapID   DataMapID FBCount
                µØÍ¼A         101     101     3
                µØÍ¼B         102     101     3 
                ¼´µØÍ¼AºÍµØÍ¼BÓй²Í¬µÄDataMapID,ÄÇôµØÍ¼B½ø³ÌÄÚ²¿µÄµÚÒ»Ìõ·ÖÏߵĿͻ§¶ËID¾ÍÊÇ3(ËùÓзÖÏߵĿͻ§¶Ë·ÖÏßID:0¡¢1¡¢2¡¢3¡¢4¡¢5)
            -2£º
                Ö±½ÓËæ»ú´«µ½²ÎÊýmapIDËùÖ¸¶¨µÄµØÍ¼µÄijһÄÚ²¿·ÖÏߣ¬ÕâÀïµÄijһÄÚ²¿·ÖÏßÏÞÓÚMapID.txtÖÐmapIDΪ´«Èë²ÎÊýmapIDµÄµØÍ¼½ø³ÌµÄ·ÖÏß¡£
    
        @param funcLineID: ¹¦ÄÜÏß·ID
    '''
    tick = GameWorld.GetGameWorld().GetTick()
    lastTransTick = curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_TransTick)
    #Ôݶ¨1Ãë
    if tick - lastTransTick < 1000:
        GameWorld.Log("Íæ¼ÒÇÐͼCDÖÐ: mapID=%s,posX=%s,posY=%s,takeTruck=%s,fbID=%s,msg=%s,funcLineID=%s,tick=%s,lastTransTick=%s" 
                      % (mapID, posX, posY, takeTruck, fbID, msg, funcLineID, tick, lastTransTick), curPlayer.GetPlayerID())
        NotifyCode(curPlayer, "MapMoveCD")
        return
    curPlayer.SetDict(ChConfig.Def_PlayerKey_TransTick, tick)
    
    sceneMapID = mapID
    if GameWorld.GetMap().GetMapFBTypeByMapID(mapID) != IPY_GameWorld.fbtNull:
        # ¸±±¾¹¦Äܳ¡¾°µØÍ¼
        mapID = FBCommon.GetRecordMapID(mapID)
        fbLineIpyData = FBCommon.GetFBLineIpyData(mapID, funcLineID)
        if fbLineIpyData:
            sceneMapID = fbLineIpyData.GetMapID()
            
    # µØÍ¼·ÖÁ÷, ¼õÉÙµ¥µØÍ¼Ñ¹Á¦
    FBMapShuntDict = ReadChConfig.GetEvalChConfig("FBMapShunt")
    if mapID in FBMapShuntDict:
        shuntList = FBMapShuntDict[mapID]
        if shuntList:
            sceneMapID = random.choice(shuntList)
            GameWorld.DebugLog("µ¥È˵ØÍ¼·ÖÁ÷ sceneMapID=%s" % sceneMapID)
            
    #´«ËÍʱ, Ëø¶¨Íæ¼Ò, ´«Ëͳɹ¦, ÔÚÄ¿±êµØÍ¼½âËø, ´«ËÍʧ°Ü, ÔÚ´«Ëͻص÷º¯ÊýPlayerChangeMapFailCallbackÖнâËø
    if canLock:
        curPlayer.BeginEvent()
    
    if not takeTruck:
        #È¡Ïû×Ô¶¯ÔËïÚ
        PlayerTruck.SetAutoTruckState(curPlayer, ShareDefine.Def_Out_Truck)
    #GameWorld.Log(1, "SetXP=%s"%(curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_RecordXPValue)))
    #curPlayer.SetXP(curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_RecordXPValue))
    #»ñÈ¡¸±±¾´«È븱±¾ÐèҪЯ´øµÄÐÅÏ¢
    msg = FBLogic.GetPlayerResetWorldPosFBMsg(curPlayer, mapID, funcLineID)
    
    NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_ReqFBFuncLine, funcLineID)
    GameWorld.Log("Íæ¼ÒÇëÇó¿ªÊ¼ÇÐͼ: sceneMapID=%s,posX=%s,posY=%s,takeTruck=%s,fbID=%s,msg=%s,funcLineID=%s,tick=%s,lastTransTick=%s" 
                  % (sceneMapID, posX, posY, takeTruck, fbID, msg, funcLineID, tick, lastTransTick), curPlayer.GetPlayerID())
    if enterFBFree:
        NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_EnterFBFree, 1)
        GameWorld.DebugLog("    ±¾´ÎÃâ·Ñ½øÈ븱±¾!")
    curPlayer.ResetWorldPosReq(sceneMapID, posX, posY, takeTruck, fbID, msg)
    curPlayer.SetDict(ChConfig.Def_PlayerKey_ChangeMapID, sceneMapID)
    curPlayer.SetDict(ChConfig.Def_PlayerKey_ChangeLineID, max(0, fbID))
    
    #ÇеØÍ¼´¦ÀíÍæ¼ÒʱÖÓ¾ÀÕýÎÊÌ⣨ÐèҪһֱͨ¹ýÍæ¼ÒʱÖÓ¼ÆËãµÄ£©
    RefreshPlayerTick(curPlayer)
    NotifyPrepareChangeMap(curPlayer, sceneMapID, funcLineID)
    return
 
# Í¨Öª×¼±¸Çл»µØÍ¼
def NotifyPrepareChangeMap(curPlayer, sceneMapID, funcLineID):
    curPlayer.SetVisible(False)
    sendPack = ChPyNetSendPack.tagMCPrepareChangeMap()
    sendPack.Clear()
    sendPack.MapID = GameWorld.GetMapDataMapID(sceneMapID)
    sendPack.FuncLineID = funcLineID
    
    NetPackCommon.SendFakePack(curPlayer, sendPack)
    GameWorld.Log("×¼±¸Çл»µØÍ¼", curPlayer.GetID())
    return
 
# Í¨Öª¿ªÊ¼Çл»µØÍ¼
def NotifyStartChangeMap(curPlayer):
    sendPack = ChPyNetSendPack.tagMCStartChangeMap()
    sendPack.Clear()
    sendPack.MapID = GameWorld.GetMapDataMapID(curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_ChangeMapID))
    sendPack.FuncLineID = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_ReqFBFuncLine)
    NetPackCommon.SendFakePack(curPlayer, sendPack)
    
    GameWorld.Log("֪ͨ¿ªÊ¼Çл»µØÍ¼", curPlayer.GetID())
    return
 
#---------------------------------------------------------------------
##Íæ¼Ò»»Ïß
# @param curPlayer Íæ¼ÒʵÀý
# @param changLineID Ïß·ID
# @return ·µ»ØÖµÎÞÒâÒå
# @remarks Íæ¼Ò»»Ïß
def PlayerChangeLine(curPlayer, changLineID):
    #---µØÍ¼·ÖÏß¼ì²é---
    if GameWorld.GetGameWorld().GetLineID() == changLineID:
        GameWorld.ErrLog('changLineID SameLine = %s' % (changLineID))
        return
    
    #---µØÍ¼ÊôÐÔ¼ì²é---
    gameMap = GameWorld.GetMap()
    
    #1. Ö»ÓÐÆÕͨµØÍ¼²ÅÄÜ»»Ïß
    if gameMap.GetMapFBType() != IPY_GameWorld.fbtNull:
        #GeRen_liubo_180377    <n color="0,255,0">¶Ô²»Æð£¬Ä¿Ç°¸ÃµØÍ¼Ã»Óпª·Å·ÖÁ÷£¬ÎÞ·¨Çл»Ïß·!</n>  256 -
        NotifyCode(curPlayer, "GeRen_liubo_180377")
        return
    
    #2. »»ÏßµÄÄ¿µÄµØ±ØÐë´æÔÚ
    if changLineID >= gameMap.GetMaxFbCount():
        GameWorld.ErrLog("»»ÏßµÄÄ¿µÄµØ²»´æÔÚ = %s, %s" % (changLineID, gameMap.GetMaxFbCount()), curPlayer.GetID())
        return
    NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_PlayChangeLineID, changLineID + 1)
    NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FuncChangeLineID, 0)
    NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_HighChangeLineID, 0)
    
    #---¿ªÊ¼Çл»Ïß·---
    PlayerResetWorldPosFB(curPlayer, curPlayer.GetMapID(), curPlayer.GetPosX(), curPlayer.GetPosY(), False, changLineID)
    
    GameWorld.Log('Íæ¼Ò = %s Çл»·ÖÏß = %s, Ëø×¡' % (curPlayer.GetName(), changLineID), curPlayer.GetID())
    return
 
#---------------------------------------------------------------------
##Íæ¼ÒÇл»µØÍ¼
# @param curPlayer Íæ¼ÒʵÀý
# @param mapID µØÍ¼ID
# @param posX ×ø±êX
# @param posY ×ø±êY
# @param takeTruck ÊÇ·ñЯ´øïÚ³µ
# @param lineID Ïß·ID -1´ú±íµ±Ç°Ïß
# @param msg Çл»µØÍ¼Ð¯´øµÄÐÅÏ¢
# @param canLock ÊÇ·ñ¿ÉÒÔËø¶¨Íæ¼Ò(´«Ë͵㲻¿ÉËø¶¨, ÒòΪҪ¿çµØÍ¼Ñ°Â·)
# @return ·µ»ØÖµÎÞÒâÒå
# @remarks Íæ¼ÒÇл»µØÍ¼
def PlayerResetWorldPos(curPlayer, mapID, posX, posY, takeTruck, lineID=-1, msg='', canLock=True, exData1=0):
    #¸ü¸Ä: ËÀÍöÔÊÐíÇл»µØÍ¼, ÔÚ¸±±¾Öб»¹Ö´òËÀ, ¸±±¾Ê±¼äµ½, »ØÊÕ¸±±¾
#    if GameObj.GetHP(curPlayer) <= 0 :
#        GameWorld.Log("ËÀÍöÎÞ·¨Çл»µØÍ¼")
#        return
    
    gameWorld = GameWorld.GetGameWorld()
    shuntLineID = GetResetWorldPosShuntLineID(curPlayer, gameWorld.GetMapID(), gameWorld.GetLineID(), mapID, lineID, exData1) # ·ÖÁ÷Ïß·ID
    GameWorld.DebugLog("·ÖÁ÷ mapID=%s,lineID=%s,shuntLineID=%s" % (mapID, lineID, shuntLineID), curPlayer.GetPlayerID())
    
    #---ͬµØÍ¼ID, Í¬·ÖÏß, ½öÇл»×ø±ê---
    #lingID = -1, ´ú±íĬÈϵ±Ç°Ïß, ÈçÖ÷³Ç2´«Ëͽ£×Ú, µ½´ï½£×Ú2
    if gameWorld.GetMapID() == mapID and (shuntLineID == -1 or gameWorld.GetLineID() == shuntLineID):
        if exData1:
            #bossµÄÓÃmove£¬Í¨ÖªÇ°¶Ë£¬ÓÉǰ¶Ë·¢Æðmove
            ChPlayer.NotifyPlayerMove(curPlayer, posX, posY, exData1)
        else:
            #ÖØÖÃ×ø±ê
            GameWorld.ResetPlayerPos(curPlayer, posX, posY)
        #@bug: ÔÚ°ÚÌ¯Çø¿ìËÙ´«ËÍÖÁ·Ç°ÚÌ¯Çø, ¿ÉÒÔ°Ú̯, ÕâÀïË¢ÐÂһϳ¡¾°Buff
        SkillShell.ProcessMapBuff(curPlayer, GameWorld.GetGameWorld().GetTick())
        return
    
    #---²»Í¬µØÍ¼IDÇл»µØÍ¼---
    PlayerResetWorldPosFB(curPlayer, mapID, posX, posY, takeTruck, shuntLineID, msg, canLock)
    
    #Èç¹ûÊÇ·þÎñÆ÷ÖÐ×îºóÒ»¸öÈËÀ뿪, Ôò¹Øµô¸±±¾
    GameWorldProcess.OnPlayerLeaveMapCloseFB()
    return
 
def GetResetWorldPosShuntLineID(curPlayer, curMapID, curLineID, tagMapID, tagLineID, bossID=0):
    '''»ñÈ¡ÇÐͼÏß·ID
    ÇÐÏßÓÐÈýÖÖÇé¿ö
    1. Íæ¼ÒÊÖ¶¯Çл»Ïß·£¬ÓÅÏȼ¶×î¸ß
            ¼Ç¼key  Def_Player_Dict_PlayChangeLineID£¬ ÀëÏß³¬¹ý±£»¤Ê±¼äºóÖØÖã¬È·±£¶ÏÏßÖØÁ¬Õý³£¼´¿É
            
    2. ¹¦ÄÜÇл»µ½Ö¸¶¨Ïß·£¬Èç´òboss¡¢´«Ë͵½Ä¿±êÍæ¼ÒÏß·£¨±»»÷ɱÇйýÈ¥°ï棩
            ¼Ç¼key  Def_Player_Dict_FuncChangeLineID£¬ ÀëÏß³¬¹ý±£»¤Ê±¼äºóÖØÖã¬È·±£¶ÏÏßÖØÁ¬Õý³£¼´¿É
            
    3. ³£¹æÇÐͼ
            Ïß·ѡÔñÓÅÏȼ¶: ÊÖ¶¯ÇÐÏ߼Ǽ > ¹¦ÄÜÇÐÏ߼Ǽ > ¸ßµÍÇÐÏ߼Ǽ > ÏµÍ³·ÖÁ÷ÇÐÏß¹æÔò
            
            ÏµÍ³·ÖÁ÷ÇÐÏß¹æÔò: µ±Ç°µØÍ¼Ïß· ¶ÔÓ¦ Ä¿±êµØÍ¼Ïß·ÈËÊý Èç¹ûµ½´ï¶î¶¨Öµ²Å½øÐзÖÁ÷£¬·ÖÁ÷µ½ÈËÊý½ÏÉÙµÄÏß·
            
        ÌØÊâboss·ÖÁ÷: 
        @param bossID: ·ÖÁ÷bossID
    '''
    if PlayerTJG.GetIsTJG(curPlayer):
        GameWorld.DebugLog("ÍÑ»úµÄÍæ¼Ò²»´¦Àí·ÖÁ÷£¡", curPlayer.GetPlayerID())
        return tagLineID
    if GameWorld.IsCrossServer():
        return tagLineID
    # ·Ç³£¹æµØÍ¼Ö®¼äµÄÇл»²»´¦Àí
    if curMapID not in PyGameData.g_commMapLinePlayerCountDict or tagMapID not in PyGameData.g_commMapLinePlayerCountDict:
        return tagLineID
    tagLinePlayerCountDict = PyGameData.g_commMapLinePlayerCountDict[tagMapID] # ´Ë·ÖÏß°üº¬ËùÓзÖÏߣ¬º¬Î´¿ª·ÅµÄ¼°»î¶¯·ÖÏß
    
    if bossID and tagMapID != ChConfig.Def_FBMapID_BossHome:
        tagLineID = 0 # BossµÄ»°Î´·ÖÁ÷ǰÏÈÇ¿ÖÆ1Ïߣ¬¼´Îª0
    playerID = curPlayer.GetPlayerID()
    playChangeLineID = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_PlayChangeLineID)
    funcChangeLineID = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FuncChangeLineID)
    highChangeLineID = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_HighChangeLineID)
    
    GameWorld.DebugLog("´¦Àí·ÖÁ÷,curMapID=%s,curLineID=%s,tagMapID=%s,tagLineID=%s,bossID=%s" 
                       % (curMapID, curLineID, tagMapID, tagLineID, bossID), playerID)
    # ÓÐÖ¸¶¨Ïß·£¬Ö±½Ó·µ»Ø£¬²»·ÖÁ÷
    if tagLineID != -1:
        # »¹Ã»Ö¸¶¨·ÖÏ߼ǼµÄÔòÒª¼Ç¼£¬ÒѾ­¼Ç¼¹ýµÄ²»Öظ´¼Ç¼£¬Ö±µ½Ï´λص½Ô­Ïß·ºó²ÅÖØÖÃ0
        if not playChangeLineID and not funcChangeLineID and not highChangeLineID:
            NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FuncChangeLineID, curLineID + 1)
            GameWorld.DebugLog("¹¦ÄÜÖ¸¶¨Çл»Ä¿±êÏß·£¬¼Ç¼µ±Ç°Ïß·ºóÐøÇÐÏß±¸ÓÃ! curLineID=%s,tagLineID=%s" % (curLineID, tagLineID), playerID)
            
        if bossID and NPCCommon.IsMapNeedBossShunt(tagMapID):
            bossShuntLineID = __GetBossShuntLineID(curPlayer, curMapID, curLineID, tagMapID, bossID, tagLinePlayerCountDict.keys())
            if bossShuntLineID != -1:
                tick = GameWorld.GetGameWorld().GetTick()
                GameWorld.DebugLog("·ÖÁ÷boss, bossID=%s,bossShuntLineID=%s" % (bossID, bossShuntLineID), playerID)
                NPCCommon.AddBossShuntRelatedPlayer(curPlayer, tagMapID, bossShuntLineID, bossID, tick)
                return bossShuntLineID
        return tagLineID
    
    if curMapID == tagMapID:
        GameWorld.DebugLog("ͬµØÍ¼Çл»×ø±ê²»´¦Àí·ÖÁ÷£¡", playerID)
        return tagLineID
    
    # ¿ÉÒÔÓÃÀ´³£¹æ·ÖÁ÷µÄÏß·ÈËÊý×ÖµäÐÅÏ¢, ²¢²»ÊÇËùÓÐÏß·¶¼¿ÉÒÔÓÃÀ´×öÈËÊý·ÖÁ÷µÄ£¬±ÈÈçÖÐÁ¢µØÍ¼ÓжàÌõÏßÓÃÀ´·ÖÁ÷boss£¬µ«ÊÇÖ»ÓÐ1ÌõÏß¿ÉÓÃÀ´×ö³£¹æµÄÈËÊý·ÖÁ÷
    mapLineDict = IpyGameDataPY.GetFuncCfg("MapLine", 1)
    if tagMapID in mapLineDict:
        tagMapMaxLine = mapLineDict[tagMapID]
        tagLinePlayerCountShuntDict = {}
        for k, v in tagLinePlayerCountDict.items():
            if k >= tagMapMaxLine:
                continue
            tagLinePlayerCountShuntDict[k] = v
    else:
        tagLinePlayerCountShuntDict = tagLinePlayerCountDict
        tagMapMaxLine = len(tagLinePlayerCountShuntDict)
    GameWorld.DebugLog("Ä¿±êµØÍ¼¿ÉÓ÷ÖÁ÷Ïß·ÈËÊýÐÅÏ¢: tagMapID=%s,%s" % (tagMapID, tagLinePlayerCountShuntDict))
    
    # ÓÐÖ÷¶¯Çл»¹ý
    if playChangeLineID and playChangeLineID <= len(tagLinePlayerCountShuntDict):
        GameWorld.DebugLog("ÓÐÖ÷¶¯Çл»¹ýÏß·!playChangeLineID=%s" % playChangeLineID, playerID)
        return playChangeLineID - 1
    
    # ¹¦ÄÜÓÐÖ¸¶¨Ïß·¹ý
    if funcChangeLineID and funcChangeLineID <= len(tagLinePlayerCountShuntDict):
        GameWorld.DebugLog("¹¦ÄÜÓÐÖ¸¶¨¹ýÏß·ÀúÊ·Ïß·,funcChangeLineID=%s" % funcChangeLineID, playerID)
        NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FuncChangeLineID, 0) # ´¥·¢»ØÔ­Ïß·ºóÖØÖÃ
        return funcChangeLineID - 1
    
    # ÓиßÏßÇеÍÏ߼Ǽ
    if highChangeLineID and highChangeLineID <= len(tagLinePlayerCountShuntDict):
        GameWorld.DebugLog("ÓиßÏßÇеÍÏßÀúÊ·Ïß·,highChangeLineID=%s" % highChangeLineID, playerID)
        NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_HighChangeLineID, 0) # ´¥·¢»ØÔ­Ïß·ºóÖØÖÃ
        return highChangeLineID - 1
    
    if curLineID not in tagLinePlayerCountShuntDict:
        GameWorld.DebugLog("Ä¿±êµØÍ¼²»´æÔÚ¸ÃÏß·,curLineID=%s" % curLineID, playerID)
        shuntLineID = __GetShuntLineID(curPlayer, tagMapID, tagLinePlayerCountShuntDict)
        
        # Èç¹ûûÓд¥·¢·ÖÁ÷£¬ÔòÐè¼ÇÂ¼Íæ¼Ò´Ó¸ßÏß·µØÍ¼Çл»µ½µÍÏß·µØÍ¼Ê±µÄ¸ßÏß·ID
        if shuntLineID == -1 and not playChangeLineID and not funcChangeLineID and not highChangeLineID:
            NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_HighChangeLineID, curLineID + 1)
            GameWorld.DebugLog("¸ßÏßÇеÍÏߣ¬¼Ç¼µ±Ç°Ïß·ºóÐøÇÐÏß±¸ÓÃ! curLineID=%s,tagLineID=%s" % (curLineID, tagLineID), playerID)
            
    else:
        shuntLineID = __GetShuntLineID(curPlayer, tagMapID, tagLinePlayerCountShuntDict, curLineID)
        
    if shuntLineID == -1 and (curLineID + 1) > tagMapMaxLine:
        shuntLineID = tagMapMaxLine - 1
        GameWorld.DebugLog("³£¹æ·ÖÁ÷ºóµÄlineIDΪ-1£¬µ«ÊÇÄ¿±êµØÍ¼µ±Ç°Ïß·²»¿ÉÓ㡲»¿É´«Ë͵½¸ÃÏß·£¡curLineID=%s + 1 > tagMapMaxLine(%s), Ç¿ÖÆ·ÖÁ÷µ½Ïß·(shuntLineID=%s)" 
                           % (curLineID, tagMapMaxLine, shuntLineID))
        
    return shuntLineID
 
def __GetShuntLineID(curPlayer, tagMapID, tagLinePlayerCountShuntDict, curLineID=None):
    # ÒÔÏÂ×ßϵͳ×Ô¶¯·ÖÁ÷Âß¼­
    playerID = curPlayer.GetPlayerID()
    if curPlayer.GetLV() > IpyGameDataPY.GetFuncCfg("SetWorldPosShunt", 2):
        GameWorld.DebugLog("³¬¹ýÖ¸¶¨µÈ¼¶²»·ÖÁ÷", playerID)
        return -1
    
    mapShuntDict = IpyGameDataPY.GetFuncEvalCfg("SetWorldPosShunt", 1) # {mapID:ÈËÊý, ...}
    if tagMapID not in mapShuntDict:
        GameWorld.DebugLog("Ä¿±êµØÍ¼²»ÐèÒª·ÖÁ÷", playerID)
        return -1
    lineMaxPlayerCount = mapShuntDict[tagMapID]
    
    if curLineID != None:
        tagLinePlayerCount = tagLinePlayerCountShuntDict[curLineID]
        if tagLinePlayerCount < lineMaxPlayerCount:
            GameWorld.DebugLog("δ´ïµ½¶î¶¨ÈËÊýÖµ,²»Ó÷ÖÁ÷,curLineID=%s,Ä¿±êµØÍ¼µ±Ç°Ïß·ÈËÊý: %s/%s" 
                               % (curLineID, tagLinePlayerCount, lineMaxPlayerCount), playerID)
            return -1
        
    # ·ÖÁ÷µ½ÈËÊý½ÏÉÙµÄÏß·
    linePlayerList = [[playerCount, lineID] for lineID, playerCount in tagLinePlayerCountShuntDict.items()]
    linePlayerList.sort() # ÉýÐòÅÅ, ÔòË÷Òý0µÄÏß·Ϊ×î¼ÑÑ¡Ôñ
    shuntLineID = linePlayerList[0][1]
    GameWorld.DebugLog("·ÖÁ÷µ½ÈËÊý½ÏÉÙµÄÏß·,tagMapID=%s,linePlayerList[count,lineID]=%s" % (tagMapID, linePlayerList), playerID)
    return shuntLineID
 
def __GetBossShuntLineID(curPlayer, curMapID, curLineID, tagMapID, npcID, lineIDList):
    '''»ñȡĿ±êµØÍ¼boss·ÖÁ÷Ïß·
                ¸ù¾ÝÈËÊý·ÖÁ÷Íæ¼Ò£¬ÓÅÏÈ·ÖÅäµ½»î×ŵÄÏß·
                ¶ÓÎéĬÈÏ·ÖÅäµ½¶ÓÎé¶ÓÔ±¶àµÄÄÇÌõÏß
                Ð­ÖúĬÈÏ·ÖÅ䵽Ŀ±êÍæ¼ÒÏß·£¬ÓÅÏȼ¶×î¸ß
                      
                Ç°¶Ë£º
        1.ÔÚÖÐÁ¢µØÍ¼µÄʱºò£¬ÏÔʾµ±Ç°Ïß·BOSSµÄ״̬
        2.ÔÚ³£¹æµØÍ¼µÄʱºò£¬ÏÔÊ¾Íæ¼Ò»÷ɱBOSSµÄCDʱ¼ä
        3.±¾µØÍ¼²»»»Ïߣ¬60Ãë¹æÔò±£³Ö²»±ä
        4.½øÈëBOSSÇøÓòÀˢÐÂBOSS״̬
        
                Íæ¼ÒÔÚ·ÇÖÐÁ¢µØÍ¼£º
                ±¾µØÍ¼²»»»Ïߣ¬60Ãë¹æÔò±£³Ö²»±ä£¨£©
                
                Íæ¼ÒÔÚÖÐÁ¢µØÍ¼
                Ã»ÓÐ60Ãë¹æÔò
                Ö±½Ó·¢´«ËͰü£¬Óɺó¶Ë¾ö¶¨£¨ÓжÓÔ±ÔÚ²»Í¬Ïß·´òͬһֻboss£¬Ôò´«ËÍ£¬·ñÔòmove£©
    '''
    playerID = curPlayer.GetPlayerID()
    playerTeamID = curPlayer.GetTeamID()
    
    hurtTeamLineID = -1
    hurtTeamMemCount = -1
    
    bossLinePlayerDict = {1:[-1, []], 0:[-1, []]} # {ÊÇ·ñ±»»÷ɱ:[¸Ã״̬ÈËÊý¿ÕµÄÏß·, [[Íæ¼ÒÊý, Ïß·], ...]], ...}
    
    bossLineStateDict = PyGameData.g_bossShuntLineState.get(npcID, {})
    
    haveAliveLine = False # ÊÇ·ñÓлî×ŵÄÏß·
    activityMapLineDict = IpyGameDataPY.GetFuncEvalCfg("MapLine", 2, {})
    
    GameWorld.DebugLog("Íæ¼Òboss·ÖÁ÷: playerTeamID=%s,tagMapID=%s,npcID=%s,lineIDList=%s,bossLineStateDict=%s,g_bossShuntPlayerInfo=%s" 
                       % (playerTeamID, tagMapID, npcID, lineIDList, bossLineStateDict, PyGameData.g_bossShuntPlayerInfo), playerID)
    if tagMapID in activityMapLineDict:
        activityLineID = max(0, activityMapLineDict[tagMapID] - 1)
        # ·Ç1ÏߵĻÏß·²»²ÎÓë·ÖÁ÷
        if activityLineID != 0 and activityLineID in lineIDList:
            lineIDList.remove(activityLineID)
            GameWorld.DebugLog("    ·Ç1ÏߵĻÏß·²»²ÎÓë·ÖÁ÷: activityLineID=%s,lineIDList=%s" % (activityLineID, lineIDList), playerID)
            
    assistTagPlayerID = GetAssistTagPlayerID(curPlayer)
    for lineID in lineIDList:
        key = (tagMapID, lineID)
        # boss·ÖÁ÷Íæ¼ÒÐÅÏ¢{(mapID, lineID):{playerID:[bossID, teamID, relatedTick], ...}, ...}
        shuntPlayerDict = PyGameData.g_bossShuntPlayerInfo.get(key, {})
        if assistTagPlayerID and assistTagPlayerID in shuntPlayerDict:
            GameWorld.DebugLog("    ·ÖÁ÷µ½Ð­ÖúÄ¿±êÍæ¼ÒÏß· assistTagPlayerID=%s,lineID=%s" % (assistTagPlayerID, lineID), playerID)
            return lineID
        playerCount = 0
        teamPlayerCount = 0
        for shuntPlayerID, shuntInfo in shuntPlayerDict.items():
            bossID = shuntInfo[0]
            if npcID != bossID:
                continue
            playerCount += 1
            shuntTeamID = shuntInfo[1]
            if playerTeamID and playerTeamID == shuntTeamID and shuntPlayerID != playerID:
                teamPlayerCount += 1
        
        if teamPlayerCount and teamPlayerCount > hurtTeamMemCount:
            hurtTeamMemCount = teamPlayerCount
            hurtTeamLineID = lineID
            
        lineIsAlive = bossLineStateDict.get(lineID, 0)
        lineBossIsDead = 1 if not lineIsAlive else 0 # µ±Ç°Ïß·bossÊÇ·ñËÀÍö
        emptyLineID, linePlayerCountList = bossLinePlayerDict[lineBossIsDead]
        if not playerCount and emptyLineID == -1:
            emptyLineID = lineID
        linePlayerCountList.append([playerCount, lineID])
        bossLinePlayerDict[lineBossIsDead] = [emptyLineID, linePlayerCountList]
        
        if not lineBossIsDead:
            haveAliveLine = True
            
        GameWorld.DebugLog("    lineID=%s,lineBossIsDead=%s,playerCount=%s,teamPlayerCount=%s,hurtTeamMemCount=%s,hurtTeamLineID=%s" 
                           % (lineID, lineBossIsDead, playerCount, teamPlayerCount, hurtTeamMemCount, hurtTeamLineID), playerID)
        
    if hurtTeamLineID >= 0:
        GameWorld.DebugLog("    ·ÖÁ÷µ½¶ÓÓÑÈËÊý¶àµÄÏß· hurtTeamLineID=%s" % hurtTeamLineID, playerID)
        return hurtTeamLineID
    
    if curMapID == tagMapID and curMapID in IpyGameDataPY.GetFuncEvalCfg("MapLine", 4):
        GameWorld.DebugLog("    ÖÐÁ¢µØÍ¼ÔÚ±¾µØÍ¼ÖÐĬÈϵ±Ç°Ïß· curLineID=%s" % curLineID, playerID)
        return curLineID
    
    shuntBossIsDead = 0 if haveAliveLine else 1 # ÓÅÏÈ·ÖÁ÷µ½»î×ŵÄÏß·
    GameWorld.DebugLog("    boss״̬¶ÔÓ¦Ïß·ÈËÊý: haveAliveLine=%s, ×´Ì¬key0Ϊ»î×Å: %s" % (haveAliveLine, bossLinePlayerDict))
    emptyLineID, linePlayerCountList = bossLinePlayerDict[shuntBossIsDead]
    linePlayerCountList.sort() # ÉýÐò
    playerCount, minPlayerCntLineID = linePlayerCountList[0]
    bossShuntPlayerCountMax = IpyGameDataPY.GetFuncCfg("BossShunt", 2)
    if playerCount >= bossShuntPlayerCountMax and emptyLineID >= 0:
        GameWorld.DebugLog("    ·ÖÁ÷µ½¿ÕÐÂÏß· shuntBossIsDead=%s,emptyLineID=%s" % (shuntBossIsDead, emptyLineID), playerID)
        return emptyLineID
    
    GameWorld.DebugLog("    ·ÖÁ÷µ½ÈËÊý×îÉÙµÄÏß· shuntBossIsDead=%s,minPlayerCntLineID=%s,linePlayerCountList=%s" 
                       % (shuntBossIsDead, minPlayerCntLineID, linePlayerCountList), playerID)
    return minPlayerCntLineID
 
#---------------------------------------------------------------------
##È¡ºÏ·¨ÖØÉúµã
# @param curPlayer Íæ¼ÒʵÀý
# @param posX ÖØÉúµãx×ø±ê
# @param posy ÖØÉúµãy×ø±ê
# @param round ÖØÉúµã·¶Î§
# @return ÖØÉúµã(×ø±êx£¬ ×ø±êy)
# @remarks 
def __GetLegitRebornPoint(curPlayer, posX, posY, round):
    rebornPosX = 0
    rebornPosY = 0
    
    curMapID = curPlayer.GetMapID()
    
    gameMap = GameWorld.GetMap()
    
    #Ìí¼Ó×ø±êµãÒì³£¼ì²é(ÖØÉúµã×ø±ê³¬¹ýµØÍ¼±ß½ç)
    if not gameMap.IsValidPos(posX, posY):
        GameWorld.ErrLog('ÖØÉúµãÒì³££¬³¬¹ýµØÍ¼(%s)±ß½ç posX = %s, posY = %s, round = %s' \
                         % (curMapID, posX, posY, round))
    
    else:
        # Ëæ»úÈ¡µ½·ÇÕϰ­µã
        rebornPosX, rebornPosY = GameMap.GetNearbyPosByDis(posX, posY, round)
            
        #²¼µÄÖØÉúµã·¶Î§ÄÚÕÒ²»µ½·ÇÕϰ­µã
        if rebornPosX <= 0 or rebornPosY <= 0:
            GameWorld.Log("ÖØÉúµã·¶Î§ÄÚÕÒ²»µ½¸ÃµØÍ¼(%s)µÄ·ÇÕϰ­ÖØÉúµã posX = %s, posY = %s, round = %s" % \
                          (curMapID, posX, posY, round), curPlayer.GetPlayerID())
    
    return (rebornPosX, rebornPosY)
 
                    
#---------------------------------------------------------------------
##Ë¢ÐÂÍæ¼ÒµÄÖØÉúµãÐÅÏ¢
# @param curPlayer Íæ¼ÒʵÀý
# @param tick Ê±¼ä´Á
# @return ·µ»ØÖµÎÞÒâÒå
# @remarks Ë¢ÐÂÍæ¼ÒµÄÖØÉúµãÐÅÏ¢
def RefreshRebornPoint(curPlayer, tick):
    #---¸´»îµãË¢ÐÂÅжÏ˳Ðò1.µØÍ¼²¼¸´»îµã 2.tagChinMap.txtÄÚ¸´»îµã 3.´´½¨½ÇÉ«³õʼ³öÉúµã---
    
    gameMap = GameWorld.GetMap()
    
    # ³õʼ»¯ÖØÉúµØÍ¼Îªµ±Ç°Íæ¼ÒËùÔÚµØÍ¼
    rebornMapID = curPlayer.GetMapID()
    rebornPosX = curPlayer.GetRebornPosX()
    rebornPosY = curPlayer.GetRebornPosY()
    
    #---µØÍ¼Éϲ¼µÄÖØÉúµãÅжÏ---
    
    # µØÍ¼ÉÏÊÇ·ñÓв¼¸´»îˢеã
    hasBornRefreshPoint = True
    
    gameData = GameWorld.GetGameData()
    bornRefreshCount = gameData.GetBornRefreshCount()
 
    #Ò»°ãµØÍ¼²¼µÄÖØÉúµãÁбí,¸ù¾Ý¹ú¼®É¸Ñ¡
    bornList = []
    #¸±±¾µØÍ¼²¼µÄÖØÉúµãÁбí,²»É¸Ñ¡
    fbBornList = []
    
    # Ã»Óв¼ÖØÉúµã
    if not bornRefreshCount:
        GameWorld.Log("´ËµØÍ¼Ã»ÓÐÖØÉúµã", curPlayer.GetPlayerID())
        hasBornRefreshPoint = False
    else:
        #´´½¨ÖØÉúµãÁбí
        for i in range(0, bornRefreshCount):
            bornRefreshPoint = gameData.GetBornRefreshByIndex(i)
            fbBornList.append(i)
            
            if GameWorld.IsSameCountry(curPlayer, bornRefreshPoint):
                bornList.append(i)
    
        if not bornList:
            GameWorld.Log("´ËµØÍ¼Ã»ÓкÏÊÊÍæ¼ÒµÄÖØÉúµã", curPlayer.GetPlayerID())
            hasBornRefreshPoint = False
 
    #---¸ÃµØÍ¼Óв¼ÖØÉúˢеã---
    if hasBornRefreshPoint:
        # Ëæ»ú»ñÈ¡ÖØÉúˢеã
        bornIndex = random.choice(bornList)
        bornRefreshPoint = gameData.GetBornRefreshByIndex(bornIndex)
        
        bRP_PosX = bornRefreshPoint.GetPosX()
        bRP_PosY = bornRefreshPoint.GetPosY()
        bRP_RoundPos = bornRefreshPoint.GetRound()
        
        rebornPosX, rebornPosY = __GetLegitRebornPoint(curPlayer, bRP_PosX, bRP_PosY, bRP_RoundPos)
        
        #²¼µÄÖØÉúµã·¶Î§ÄÚÕÒ²»µ½ºÏ·¨ÖØÉúµã
        if rebornPosX <= 0 or rebornPosY <= 0 or rebornMapID <= 0:
            GameWorld.Log("µØÍ¼Éϲ¼µÄÖØÉúµã·¶Î§ÄÚÕÒ²»µ½¸ÃµØÍ¼(%s)µÄºÏ·¨ÖØÉúµã" \
                          % curPlayer.GetMapID(), curPlayer.GetPlayerID())
            # Òì³££¬Éè±ê־ΪFalse,´ÓtagChinMap.txt±íÄÚÕÒ¸´»îµã
            hasBornRefreshPoint = False
    
    # ÔÚtagChinMap.txt±íÄÚÊÇ·ñÄÜÕÒµ½¸´»îµã
    hasBornPointInTxt = True  
    
    #---¸ÃµØÍ¼Ã»ÓÐÖØÉúˢе㣬´ÓtagChinMap.txt±íÄÚÕÒ¸´»îµã---    
    if not hasBornRefreshPoint:
        rebornMapID = gameMap.GetRebornMapID()
        rebornPosX = gameMap.GetRebornMapX()
        rebornPosY = gameMap.GetRebornMapY()
        
        #ÑéÖ¤ÊÇ·ñ±¾µØÍ¼¸´»îµã ½øÐÐÂß¼­´¦Àí, ·Ç±¾µØÍ¼¸´»îµãÎÞ·¨Åжϣ¬ ÒªÇó²ß»®Ò»¶¨ÅäÖÃÕýÈ·
        if gameMap.GetMapID() == rebornMapID:
            # Ëæ»úÈ¡µ½·ÇÕϰ­µã
            rebornPosX, rebornPosY = __GetLegitRebornPoint(curPlayer, \
                                                           rebornPosX, rebornPosY, ChConfig.Def_RebornPos_Area_Range)
 
        #tagChinMap.txt±íÉÏÕÒ²»µ½ºÏ·¨ÖØÉúµã
        if rebornPosX <= 0 or rebornPosY <= 0 or rebornMapID <= 0:
            GameWorld.Log("tagChinMap.txtÄÚÕÒ²»µ½¸ÃµØÍ¼(%s)µÄºÏ·¨ÖØÉúµã" \
                          % curPlayer.GetMapID(), curPlayer.GetPlayerID())
            hasBornPointInTxt = False
            
    #---ÔÚtagChinMap.txt±íÄÚÒ²ÕÒ²»µ½¸´»îµã,Ö±½ÓÖØÖõ½´´½¨½ÇɫʱµÄ³õʼµã---
    if not hasBornPointInTxt:
        curPlayerJob = curPlayer.GetJob()
        
        #´´½¨Íæ¼ÒλÖöÁ±í{ Ö°Òµ:[(map,x,y),(map1,x1,y1)..] }
        posList = ReadChConfig.GetEvalChConfig('Player_Reborn_Place')
        
        pos = random.choice(posList[curPlayerJob])
        rebornMapID = pos[0]
        bornRange = 1
        rebornPosX = pos[2] + random.randint(-bornRange, bornRange)
        rebornPosY = pos[3] + random.randint(-bornRange, bornRange)
        GameWorld.Log("""tagBornRefresh.txtºÍtagChinMap.txtÄÚ¶¼ÕÒ²»µ½¸ÃµØÍ¼(%s)
µÄºÏ·¨ÖØÉúµã£¬ÉèÖÃÍæ¼ÒÖØÉúµãΪ´´½¨½ÇɫʱµÄ³õʼµã%s-(%s,%s)""" % \
                      (curPlayer.GetMapID(), rebornMapID, rebornPosX, rebornPosY), curPlayer.GetPlayerID())        
                                
    #Íæ¼Ò²»ÔÚ¸±±¾ÖÐ
    if gameMap.GetMapFBType() == IPY_GameWorld.fbtNull:
        # ÉèÖÃÒ»°ãµØÍ¼ÖØÉúµã
        curPlayer.SetRebornMapID(rebornMapID)
        curPlayer.SetRebornPosX(rebornPosX)
        curPlayer.SetRebornPosY(rebornPosY)
        GameWorld.Log("Íæ¼Ò%s,ÉèÖÃĬÈÏÖØÉúµãÍê±Ï mapID = %s-(%s,%s)" % (curPlayer.GetPlayerName(), rebornMapID, rebornPosX, rebornPosY), curPlayer.GetPlayerID())
        return
 
#===============================================================================
#        #´å³¤¼ÒµÄµØÍ¼ID
#        cunZhangJiaMapID = 21
#    
#        #ÓÐÖØÉúµã
#        #ÐÂÊÖ³¡ÅÂÍæ¼Ò¿¨ËÀÕϰ­µã£¬ÉèÖÃΪµ±Ç°×ø±ê
#        if curPlayerMapID == cunZhangJiaMapID:
#            curPlayer.SetRebornMapID( curPlayerMapID )
#            curPlayer.SetRebornPosX( curPlayer.GetPosX() )
#            curPlayer.SetRebornPosY( curPlayer.GetPosY() )
#            return
#        
#        #À뿪ÐÂÊÖ³¡¾°ºó£¬ÖØÖÃÒ»´ÎÖØÉúµã£¬·ÀÖ¹Íæ¼ÒÔٻص½ÐÂÊÖ³¡¾°
#        if curPlayerRebornMapID == cunZhangJiaMapID:
#            curPlayer.SetRebornMapID( curPlayerMapID )
#            curPlayer.SetRebornPosX( bornX )
#            curPlayer.SetRebornPosY( bornY )
#            return
#===============================================================================
    
    #ÏÈÉèÖÃĬÈϵĸ±±¾ÖØÉúµã
    curPlayer.SetFBRebornMapID(rebornMapID)
    curPlayer.SetFBRebornPosX(rebornPosX)
    curPlayer.SetFBRebornPosY(rebornPosY)
    GameWorld.Log("Íæ¼Ò%s,ÉèÖø±±¾Ä¬ÈÏÖØÉúµãÍê±Ï mapID = %s-(%s,%s)" % (curPlayer.GetPlayerName(), rebornMapID, rebornPosX, rebornPosY), curPlayer.GetPlayerID())
    
    # ÌØÊ⸱±¾¸´»îµãÂß¼­
    FBLogic.OnRebornPlace(curPlayer, fbBornList)
    return
 
#---------------------------------------------------------------------
##»ñÈ¡¾ôλ
# @param curLV µÈ¼¶
# @return ·µ»ØÖµ, ¾ôλµÈ¼¶
# @remarks »ñÈ¡¾ôλ
def GetRank(curLV):
    if curLV > 0 and curLV < 21:
        return 1
    else:
        return (curLV - 1) / 10
 
#---------------------------------------------------------------------
##»ñµÃÖ¸¶¨·½Î»ÄÚ¶ÓÎé³ÉÔ±Áбí
# @param curTeam ¶ÓÎéʵÀý
# @param centerX ÆðµãX
# @param centerY ÆðµãY
# @param area ·¶
# @return ·µ»ØÖµ, ³ÉÔ±Áбí
# @remarks »ñµÃÖ¸¶¨·½Î»ÄÚ¶ÓÎé³ÉÔ±Áбí
def GetAreaTeamMember(curTeam, centerX, centerY, area=ChConfig.Def_Team_GetExpScreenDist, isLog=False):   
    playerlist = list()
 
    if curTeam == None:
        GameWorld.ErrLog("»ñÈ¡¶ÓÎéÇøÓò³ÉÔ±£¬¶ÓÎé²»´æÔÚ£¡")
        return playerlist
    
    playerIDList = []
    #if isLog:
    #    GameWorld.Log("GetAreaTeamMember,teamID=%s,centerX=%s,centerY=%s,area=%s" % (curTeam.GetTeamID(), centerX, centerY, area))
        
    #±éÀú¶ÓÎé,°ë¾¶ÎªÒ»ÆÁ°ëµÄ¾àÀëÄÚµÄËùÓжÓÎé/ÍŶӳÉÔ±£¬¿ÉÒÔ»ñµÃ¾­Ñé
    for i in range(0, curTeam.GetMemberCount()):
        curTeamPlayer = curTeam.GetMember(i)
        if curTeamPlayer == None or curTeamPlayer.GetPlayerID() == 0:
            #if isLog:
            #    GameWorld.Log("    i=%s,³ÉÔ±²»´æÔÚ!" % (i))
            continue
        
        if GameObj.GetHP(curTeamPlayer) <= 0:
            #if isLog:
            #    GameWorld.Log("    i=%s,³ÉԱѪÁ¿Îª0!playerID=%s" % (i, curTeamPlayer.GetPlayerID()))
            continue
        
        #===========================================================================================
        # # ¶ÓÎéÒÑÓÉÿÌõÐéÄâÏß·¶À×Ô¹ÜÀí£¬´Ë´¦¿É²»ÔÙÅжÏ
        # if curTeamPlayer.GetCopyMapID() != GameWorld.GetGameWorld().GetCopyMapID():
        #    if isLog:
        #        GameWorld.Log("    i=%s,³ÉÔ±ÐéÄâÏß·²»Í¬!playerID=%s,copyMapID=%s,mapCopyMapID=%s" 
        #                      % (i, curTeamPlayer.GetPlayerID(), curTeamPlayer.GetCopyMapID(), GameWorld.GetGameWorld().GetCopyMapID()))
        #    #¸±±¾ID²»Í¬
        #    continue
        #===========================================================================================
        
        if GameWorld.GetDist(centerX, centerY, curTeamPlayer.GetPosX(),
                             curTeamPlayer.GetPosY()) > area:
            #if isLog:
            #    GameWorld.Log("    i=%s,³ÉÔ±²»ÔÚ·¶Î§ÄÚ!playerID=%s,centerPos(%s,%s),playerPos=(%s,%s),area=%s" 
            #                  % (i, curTeamPlayer.GetPlayerID(), centerX, centerY, curTeamPlayer.GetPosX(), curTeamPlayer.GetPosY(), area))
            continue
        
        playerlist.append(curTeamPlayer)
        playerIDList.append(curTeamPlayer.GetPlayerID())
        
    #if isLog:
    #    GameWorld.Log("    teamAreaPlayerIDList=%s" % (playerIDList))
    return playerlist
 
def GetMapTeamMember(curTeam):
    ''' »ñȡͬµØÍ¼ÖеĶÓÔ± '''
    
    playerlist = list()
    if curTeam == None:
        return playerlist
    
    for i in xrange(curTeam.GetMemberCount()):
        curTeamPlayer = curTeam.GetMember(i)
        if curTeamPlayer == None or curTeamPlayer.GetPlayerID() == 0:
            continue
        playerlist.append(curTeamPlayer)
        
    return playerlist
 
#---------------------------------------------------------------------
##»ñÈ¡Íæ¼Ò»õ±ÒÊý
# @param curPlayer Íæ¼ÒʵÀý
# @param TYPE_Price ,»õ±ÒÀàÐÍ
# @return
def GetMoney(curPlayer, TYPE_Price):
    
    #½ð×Ó
    if TYPE_Price == IPY_GameWorld.TYPE_Price_Gold_Money:
        return curPlayer.GetGold()
        
    #½ðƱ
    elif TYPE_Price == IPY_GameWorld.TYPE_Price_Gold_Paper:
        return curPlayer.GetGoldPaper()
       
    #Òø×Ó
    elif TYPE_Price == IPY_GameWorld.TYPE_Price_Silver_Money:
        return GetSilver(curPlayer)
        
    #񿮱
    elif TYPE_Price == IPY_GameWorld.TYPE_Price_Silver_Paper:
        return curPlayer.GetSilverPaper()
    
    #´ú±Ò
    elif TYPE_Price == ShareDefine.TYPE_Price_PayCoin:
        return GetPayCoin(curPlayer)
    
    #×Ô¶¨Òå»õ±Ò
    elif TYPE_Price in ShareDefine.TYPE_Price_CurrencyDict:
        return GetPlayerCurrency(curPlayer, TYPE_Price)
    
    return 0
 
def GetMoneyReal(curPlayer, moneyType):
    ## »ñÈ¡»õ±Òʵ¼ÊÖµ£¬Ö§³Ö¸ºÖµ
    moneyMinus = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_MoneyMinus % moneyType)
    if moneyMinus != 0:
        return -moneyMinus
    return GetMoney(curPlayer, moneyType)
 
def SetMoney(curPlayer, moneyType, value):
    ## ÉèÖûõ±ÒÖµ£¬Ö§³Ö¸ºÖµ
    if moneyType in ShareDefine.MoneyMinusRefreshDict:
        moneyMinus = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_MoneyMinus % moneyType)
        if value < 0:
            if moneyMinus != value:
                SetMoneyMinus(curPlayer, moneyType, value)
            value = 0
        else:
            if moneyMinus != 0:
                SetMoneyMinus(curPlayer, moneyType, 0)
                
    #½ð×Ó
    if moneyType == IPY_GameWorld.TYPE_Price_Gold_Money:
        curPlayer.SetGold(value)
        
    #½ðƱ
    elif moneyType == IPY_GameWorld.TYPE_Price_Gold_Paper:
        curPlayer.SetGoldPaper(value)
        
    #Òø×Ó
    elif moneyType == IPY_GameWorld.TYPE_Price_Silver_Money:
        SetSilver(curPlayer, value)
        
    #񿮱
    elif moneyType == IPY_GameWorld.TYPE_Price_Silver_Paper:
        curPlayer.SetSilverPaper(value)
        
    #´ú±Ò
    elif moneyType == ShareDefine.TYPE_Price_PayCoin:
        SetPayCoin(curPlayer, value)
        
    #×Ô¶¨Òå»õ±Ò
    elif moneyType in ShareDefine.TYPE_Price_CurrencyDict:
        SetPlayerCurrency(curPlayer, moneyType, value)
        
    return
 
def SetMoneyMinus(curPlayer, moneyType, value):
    value = abs(value) # ´æÖµ¼°Í¨ÖªÊ¹ÓÃÕýÊý
    NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_MoneyMinus % moneyType, value)
    #֪ͨ¿Í»§¶Ë
    if moneyType not in ShareDefine.MoneyMinusRefreshDict:
        return
    refreshType = ShareDefine.MoneyMinusRefreshDict[moneyType]
    if refreshType != None:
        SendPropertyRefresh(curPlayer, refreshType, value)
    return
 
## »ñÈ¡Íæ¼Ò²Ö¿â½ðÇ®Êý
#  @param curPlayer: Íæ¼ÒʵÀý
#  @param moneyType: ½ðÇ®ÀàÐÍ
#  @return: Íæ¼ÒÉíÉϽðÇ®Êý
def GetWarehouseMoney(curPlayer, moneyType):
    if moneyType == IPY_GameWorld.TYPE_Price_Gold_Money:
        return curPlayer.GetWarehouseGold()
    
    if moneyType == IPY_GameWorld.TYPE_Price_Gold_Paper:
        return curPlayer.GetWarehouseGoldPaper()
    
    if moneyType == IPY_GameWorld.TYPE_Price_Silver_Money:
        return curPlayer.GetWarehouseSilver()
    
    if moneyType == IPY_GameWorld.TYPE_Price_Silver_Paper:
        return curPlayer.GetWarehouseSilverPaper()
    
    GameWorld.ErrLog("GetWarehouseMoney, moneyType:%d Err" % (moneyType))
    return 0
 
## »ñµÃ×Ô¶¨Òå»õ±Ò£¨»ý·Ö£©
#  @param curPlayer Íæ¼ÒʵÀý
#  @return
def GetPlayerCurrency(curPlayer, currencyType):
    return curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_Currency % currencyType)
 
## ÉèÖÃ×Ô¶¨Òå»õ±Ò£¨»ý·Ö£©
#  @param curPlayer Íæ¼ÒʵÀý
#  @return
def SetPlayerCurrency(curPlayer, currencyType, value):
    NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_Currency % currencyType, value)
    #֪ͨ¿Í»§¶Ë
    NotifyPlayerCurrency(curPlayer, currencyType, value)
    return
 
def NotifyPlayerCurrency(curPlayer, currencyType, value=-1):
    if currencyType not in ShareDefine.TYPE_Price_CurrencyDict:
        return
    refreshType = ShareDefine.TYPE_Price_CurrencyDict[currencyType]
    if refreshType == None:
        # ²»ÐèҪ֪ͨ¿Í»§¶Ë
        return
    if value < 0:
        value = GetPlayerCurrency(curPlayer, currencyType)
    SendPropertyRefresh(curPlayer, refreshType, value)
    return
 
# Í¨ÖªÍæ¼ÒËùÓÐ×Ô¶¨Òå»õ±Ò
def NotifyPlayerAllCurrency(curPlayer):
    notifyList = []
    for currencyType in ShareDefine.TYPE_Price_CurrencyDict:
        refreshType = ShareDefine.TYPE_Price_CurrencyDict[currencyType]
        if refreshType == None:
            # ²»ÐèҪ֪ͨ¿Í»§¶Ë
            continue
        
        #´Ë´¦¸ù¾ÝÐèÇóÈôValueΪ0 ¿É²»Í¨Öª¿Í»§¶Ë£¬¾ßÌ幦ÄÜÖÆ×÷Õß¾ö¶¨
        value = GetPlayerCurrency(curPlayer, currencyType)
        notifyStruct = ChPyNetSendPack.tagRefreshType()
        notifyStruct.RefreshType = refreshType
        notifyStruct.Value = value
        notifyList.append(notifyStruct)
        
    # ¸ºÖµ»õ±Ò
    for moneyType, refreshType in ShareDefine.MoneyMinusRefreshDict.items():
        if refreshType == None:
            # ²»ÐèҪ֪ͨ¿Í»§¶Ë
            continue
        value = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_MoneyMinus % moneyType)
        if not value:
            continue
        notifyStruct = ChPyNetSendPack.tagRefreshType()
        notifyStruct.RefreshType = refreshType
        notifyStruct.Value = value
        notifyList.append(notifyStruct)
        
    #ÊôÐÔ×éºÏ°ü Í¨Öª×Ô¼º
    sendPack = ChPyNetSendPack.tagObjInfoListRefresh()
    sendPack.Clear()
    sendPack.ObjID = curPlayer.GetID()
    sendPack.ObjType = curPlayer.GetGameObjType()
    sendPack.Count = len(notifyList)
    sendPack.RefreshType = notifyList
    NetPackCommon.SendFakePack(curPlayer, sendPack)
    return
 
def NotifyUseMoneyTotal(curPlayer, moneyTypeList=None):
    if moneyTypeList:
        notifyMoneyTypeList = moneyTypeList
    else:
        notifyMoneyTypeList = ShareDefine.UseTotalPriceTypeList
        
    infoList = []
    for moneyType in notifyMoneyTypeList:
        useTotal = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_UseMoneyTotal % moneyType)
        if not useTotal and moneyTypeList == None:
            continue
        info = ChPyNetSendPack.tagMCUseMoneyTotal()
        info.MoneyType = moneyType
        info.UseTotal = useTotal
        infoList.append(info)
            
    if not infoList:
        return
    
    clientPack = ChPyNetSendPack.tagMCUseMoneyTotalInfo()
    clientPack.Clear()
    clientPack.InfoList = infoList
    clientPack.Count = len(clientPack.InfoList)
    NetPackCommon.SendFakePack(curPlayer, clientPack)
    return
 
##Íæ¼ÒÊÇ·ñÓÐÇ®¿î
# @param curPlayer Íæ¼ÒʵÀý
# @param TYPE_Price ,»õ±ÒÀàÐÍ
# @param Price ,»õ±Ò¼Û¸ñ
# @return ·µ»ØÖµÕæ, Í¨¹ý
# @remarks Íæ¼ÒÊÇ·ñÓÐÇ®¿î
def HaveMoney(curPlayer, TYPE_Price, Price, needNotify=True):
    if Price < 0:
        return False
    
    needMoneyCount = 0
    notifyCode = ''
    #½ð×ÓÖ§¸¶
    if TYPE_Price == IPY_GameWorld.TYPE_Price_Gold_Money:
        needMoneyCount = curPlayer.GetGold()
        notifyCode = "GoldErr"
        
    #½ðƱ֧¸¶
    elif TYPE_Price == IPY_GameWorld.TYPE_Price_Gold_Paper:
        needMoneyCount = curPlayer.GetGoldPaper()
        notifyCode = "GoldPaperErr"
       
    #Òø×ÓÖ§¸¶
    elif TYPE_Price == IPY_GameWorld.TYPE_Price_Silver_Money:
        needMoneyCount = GetSilver(curPlayer)
        notifyCode = "SilverErr"
        
    #ÒøÆ±Ö§¸¶
    elif TYPE_Price == IPY_GameWorld.TYPE_Price_Silver_Paper:
        needMoneyCount = curPlayer.GetSilverPaper()
        notifyCode = "SilverPaperErr"
        
    #´ú±ÒÖ§¸¶
    elif TYPE_Price == ShareDefine.TYPE_Price_PayCoin:
        needMoneyCount = GetPayCoinTotal(curPlayer)
        
    #×Ô¶¨Òå»õ±Ò
    elif TYPE_Price in ShareDefine.TYPE_Price_CurrencyDict:
        needMoneyCount = GetPlayerCurrency(curPlayer, TYPE_Price)
    else:
        GameWorld.Log("¸¶·Ñ½ðÇ®Òì³£ TYPE_Price = %s" % (TYPE_Price), curPlayer.GetPlayerID())
        return False   
    
    if needMoneyCount < Price:
        lackPrice = Price - needMoneyCount # »¹È±¶àÉÙÇ®
        tagMoneyInfo = GetEqualMoneyInfo(TYPE_Price, lackPrice)
        if tagMoneyInfo:
            tagMoneyType, tagMoneyValue = tagMoneyInfo
            if HaveMoney(curPlayer, tagMoneyType, tagMoneyValue, False):
                GameWorld.DebugLog("HaveMoney¿ÉʹÓõȼۻõ±Ò²¹×ã¿Û³ý: TYPE_Price=%s, Price=%s, lackPrice=%s, tagMoneyType=%s, tagMoneyValue=%s" 
                                   % (TYPE_Price, Price, lackPrice, tagMoneyType, tagMoneyValue), curPlayer.GetPlayerID())
                return True
            
    #---Ç®²»¹» ·µ»Ø¼ÙÈç¹ûÐèÒªÌáʾµÄ»° ÌáʾÐÅÏ¢---
    if needMoneyCount < Price:
        if needNotify and notifyCode:
            NotifyCode(curPlayer, notifyCode)
        GameWorld.DebugLog("»õ±Ò²»×ã: TYPE_Price=%s, Price=%s, curMoneyCount=%s" % (TYPE_Price, Price, needMoneyCount))
        return False
    
    return True
 
def GetEqualMoneyInfo(moneyType, needValue):
    equalMoneyInfo = IpyGameDataPY.GetFuncEvalCfg("EqualValueMoney", 2, {})
    if str(moneyType) not in equalMoneyInfo:
        return
    tagMoneyType = equalMoneyInfo[str(moneyType)]
    exchangeMoneyInfo = IpyGameDataPY.GetFuncEvalCfg("EqualValueMoney", 1, {})
    if str(tagMoneyType) not in exchangeMoneyInfo:
        return
    exchangeInfo = exchangeMoneyInfo[str(tagMoneyType)]
    if moneyType != exchangeInfo[0]:
        return
    multiple = exchangeInfo[1]
    tagMoneyValue = int(math.ceil(needValue / float(multiple)))
    #GameWorld.DebugLog("µÈ¼Û»õ±ÒÐÅÏ¢: moneyType=%s,needValue=%s,multiple=%s,tagMoneyType=%s,tagMoneyValue=%s" 
    #                   % (moneyType, needValue, multiple, tagMoneyType, tagMoneyValue))
    return tagMoneyType, tagMoneyValue
 
#---------------------------------------------------------------------
##Íæ¼ÒÊÇ·ñÓÐÇ®¿î
# @param curPlayer Íæ¼ÒʵÀý
# @param TYPE_Price ,»õ±ÒÀàÐÍ
# @param Price ,»õ±Ò¼Û¸ñ
# @return ·µ»ØÖµ[[type1,price1], [type2,price2]]
# @remarks Íæ¼ÒÊÇ·ñÓÐÇ®¿î
def HaveMoneyEx(curPlayer, TYPE_Price, Price, needNotify=True):
    if Price < 0:
        return []
    if TYPE_Price == ShareDefine.TYPE_Price_Gold_Paper_Money:
        TYPE_Price = IPY_GameWorld.TYPE_Price_Gold_Money #аæÎÞ°óÓñ£¬Ô­ÏȰóÓñÔÙÏÉÓñµÄ¿Û·¨¸Ä³É ¿ÛÏÉÓñ 2019/3/26
        #âýÓ¢°æ£º »Ö¸´°óÓñ£¬µ«ÊDz»Ê¹ÓÃÏȰóÓñÔÙÏÉÓñµÄ¹æÔò£¬Ô­À´ÏȰóÓñÔÙÏÉÓñµÄ¹æÔòÒ»ÑùΪĬÈÏ¿ÛÏÉÓñ 2019/10/8
        
    if TYPE_Price in [IPY_GameWorld.TYPE_Price_Gold_Money, IPY_GameWorld.TYPE_Price_Gold_Paper,
                      IPY_GameWorld.TYPE_Price_Silver_Money, IPY_GameWorld.TYPE_Price_Silver_Paper]:
        if HaveMoney(curPlayer, TYPE_Price, Price, needNotify):
            return [[TYPE_Price, Price]]
        return []
    
    #ÏÈÀñȯÔÙÔª±¦
    elif TYPE_Price == ShareDefine.TYPE_Price_Gold_Paper_Money:
        goldPaper = curPlayer.GetGoldPaper() # Àñȯ
        gold = curPlayer.GetGold() # Ôª±¦
        
        if goldPaper + gold < Price: # Ç®²»¹»
            if needNotify:
                NotifyCode(curPlayer, "GoldErr")
            return []
            
        if goldPaper >= Price: # Ö»ÓÃÀñȯ¾Í¹»ÁË
            return [[IPY_GameWorld.TYPE_Price_Gold_Paper, Price]]
        needGold = Price - goldPaper # ÓÃÍêÀñȯ£¬»¹ÐèÒªÔª±¦
        return [[IPY_GameWorld.TYPE_Price_Gold_Paper, goldPaper], [IPY_GameWorld.TYPE_Price_Gold_Money, needGold]]
#    #ÓÃÕ½Ã˹±Ï×¶È
#    elif TYPE_Price == ShareDefine.TYPE_Price_Family_Contribution:
#        return []
    else:
        GameWorld.Log("¸¶·Ñ½ðÇ®Òì³£ TYPE_Price = %s" % (TYPE_Price), curPlayer.GetPlayerID())
        return []   
    
    return []
 
 
#---------------------------------------------------------------------
##Íæ¼Ò¸¶¿î
# @param curPlayer Íæ¼ÒʵÀý
# @param type_Price ,»õ±ÒÀàÐÍ
# @param price ,»õ±Ò¼Û¸ñ
# @param costType ,Ïû·ÑµãÀàÐÍ
# @param infoDict ,À©Õ¹ÐÅÏ¢, ×ÓÏû·Ñ¶ÔÏó¿ÉÒÔͨ¹ýÉèÖÃChConfig.Def_Cost_Reason_SonKey keyÖµ
# @param quantity ,ÊýÁ¿
# @param isMinus ,ÊÇ·ñÔÊÐí¿Û³É¸ºÖµ
# @return ·µ»ØÖµÕæ, ¸¶¿î³É¹¦
# @remarks Íæ¼Ò¸¶¿î
def PayMoney(curPlayer, type_Price, price, costType=ChConfig.Def_Cost_Unknown, infoDict={}, quantity=1, costVIPGold= -1, isNotify=True, isMinus=False):
    if price == 0:
        return True
    if price < 0:
        GameWorld.Log('###---¿ÛÇ®Òì³£ = %s' % (price), curPlayer.GetPlayerID())
        return False
    lostMoney = price
    
    #20190917 »Ö¸´°óÓñ
#    if type_Price == IPY_GameWorld.TYPE_Price_Gold_Paper:
#        type_Price = IPY_GameWorld.TYPE_Price_Gold_Money #аæÎÞ°óÓñ£¬Ô­ÏȰóÓñÔÙÏÉÓñµÄ¿Û·¨¸Ä³É ¿ÛÏÉÓñ 2019/6/3
        
    #½ð×ÓÖ§¸¶
    if type_Price == IPY_GameWorld.TYPE_Price_Gold_Money:
        curPlayerGold = GetMoneyReal(curPlayer, type_Price)
        if curPlayerGold < price and not isMinus:
            NotifyCode(curPlayer, "GoldErr")
            return False
        updPlayerGold = curPlayerGold - price
        SetMoney(curPlayer, type_Price, updPlayerGold)
        
        curBourseMoney = GetMoney(curPlayer, ShareDefine.TYPE_Price_BourseMoney)
        updBourseMoney = curBourseMoney
        #µ±Êǽ»Ò×Ëù¿Û·Ñ¡¢×êʯºì°üʱ£¬Ôò±Ø¶¨¿Û³ý½»Ò×¶î¶È
        if costType in ChConfig.UnUseInner_CostType:
            updBourseMoney = max(0, curBourseMoney - price)
        #ÆäËûÈç¹ûµ±Ç°½ð×ӱȽ»Ò×¶î¶È»¹ÉÙ£¬ÔòÇ¿ÖÆµ÷Õû½»Ò×¶î¶ÈΪµ±Ç°½ð×ÓÊý(ÕâÖÖÇé¿öÒ»°ãÊǷǽ»Ò×ËùÏû·ÑµÄ£¬ÐèҪͬ²½¿Û³ý½»Ò×Ëù¿É¹ºÂò¶î¶È)
        elif updPlayerGold < updBourseMoney:
            updBourseMoney = updPlayerGold
        updBourseMoney = max(0, updBourseMoney)
        if updBourseMoney != curBourseMoney:
            SetPlayerCurrency(curPlayer, ShareDefine.TYPE_Price_BourseMoney, updBourseMoney)
        infoDict["BourseMoney"] = updBourseMoney
        
    #½ðƱ֧¸¶
    elif type_Price == IPY_GameWorld.TYPE_Price_Gold_Paper:
        curPlayerGoldPaper = GetMoneyReal(curPlayer, type_Price)
        if curPlayerGoldPaper < price and not isMinus:
            NotifyCode(curPlayer, "GoldPaperErr")
            return False
        updGoldPaper = curPlayerGoldPaper - price
        SetMoney(curPlayer, type_Price, updGoldPaper)
        
    #Òø×ÓÖ§¸¶
    elif type_Price == IPY_GameWorld.TYPE_Price_Silver_Money:
        curPlayerSilver = GetSilver(curPlayer)
        if curPlayerSilver < price:
            NotifyCode(curPlayer, "SilverErr")
            return False
        #ÓÐ×ã¹»µÄǮ֧¸¶
        SetSilver(curPlayer, curPlayerSilver - price)
        
    #ÒøÆ±Ö§¸¶
    elif type_Price == IPY_GameWorld.TYPE_Price_Silver_Paper:
        curPlayerSilverPaper = curPlayer.GetSilverPaper()
        if curPlayerSilverPaper < price:
            NotifyCode(curPlayer, "SilverPaperErr")
            return False
        #ÓÐ×ã¹»µÄǮ֧¸¶
        curPlayer.SetSilverPaper(curPlayerSilverPaper - price)
        
    #´ú±ÒÖ§¸¶
    elif type_Price == ShareDefine.TYPE_Price_PayCoin:
        curPlayerPayCoin = GetPayCoin(curPlayer)
        curPayCoinDay = GetPlayerCurrency(curPlayer, ShareDefine.TYPE_Price_PayCoinDay)
        payCoinTotal = curPlayerPayCoin + curPayCoinDay
        if payCoinTotal < price:
            return False
        #ÓÐ×ã¹»µÄǮ֧¸¶
        costPayCoinDay = price if (curPayCoinDay >= price) else curPayCoinDay
        costPayCoin = price
        if costPayCoinDay:
            GameWorld.DebugLog("Ïȿ۴ú±ÒʱЧ: curPayCoinDay=%s,price=%s,costPayCoinDay=%s" % (curPayCoinDay, price, costPayCoinDay))
            SetPlayerCurrency(curPlayer, ShareDefine.TYPE_Price_PayCoinDay, curPayCoinDay - costPayCoinDay)
            costPayCoin -= costPayCoinDay
            GameWorld.DebugLog("ÔÙ¿Û´ú±Ò: costPayCoin=%s" % (costPayCoin))
        #ʱЧ²»¹»¿Û³ý£¬ÔÙ¿Û·ÇʱЧ
        if costPayCoin > 0:
            SetPayCoin(curPlayer, curPlayerPayCoin - costPayCoin)
            
    #×Ô¶¨Òå»õ±Ò
    elif type_Price in ShareDefine.TYPE_Price_CurrencyDict:
        curCurrency = GetPlayerCurrency(curPlayer, type_Price)
        if curCurrency < price:
            lostMoney = curCurrency
            lackPrice = price - curCurrency # »¹È±¶àÉÙÇ®
            tagMoneyInfo = GetEqualMoneyInfo(type_Price, lackPrice)
            if tagMoneyInfo:
                tagMoneyType, tagMoneyValue = tagMoneyInfo
                if not PayMoney(curPlayer, tagMoneyType, tagMoneyValue, costType, infoDict, quantity, costVIPGold, isNotify, isMinus):
                    #GameWorld.Log("µÈ¼Û»õ±ÒÒ²²»×ã")
                    return False
                GameWorld.Log("µÈ¼Û»õ±Ò²¹×ã¿Û³ý: type_Price%s, price=%s, curCurrency=%s, lackPrice=%s, tagMoneyType=%s, tagMoneyValue=%s" 
                                   % (type_Price, price, curCurrency, lackPrice, tagMoneyType, tagMoneyValue), curPlayer.GetPlayerID())
            else:
                #GameWorld.Log("ûÓеȼۻõ±Ò£¬ÎÞ·¨¿Û³ý")
                return False
        #ÓÐ×ã¹»µÄǮ֧¸¶
        SetPlayerCurrency(curPlayer, type_Price, curCurrency - lostMoney)
    else:
        GameWorld.Log("¸¶·Ñ½ðÇ®Òì³£ type_Price = %s" % (type_Price), curPlayer.GetPlayerID())
        return False
    
    #¸¶¿îÒÔºóºóÐø²Ù×÷
    __PayMoneyAfter(curPlayer, type_Price, lostMoney, costType, infoDict, quantity, costVIPGold)
    
    #֪ͨ¿Í»§¶Ëʧȥ½ðÇ®
    if isNotify:
        if type_Price == ShareDefine.TYPE_Price_PayCoin:
            NotifyCode(curPlayer, "LostMoney", [type_Price, lostMoney/100])
        else:
            NotifyCode(curPlayer, "LostMoney", [type_Price, lostMoney])
    return True
 
## ¸¶¿îÒÔºóºóÐø²Ù×÷
#  @param curPlayer Íæ¼ÒʵÀý
#  @param type_Price ,»õ±ÒÀàÐÍ
#  @param price ,»õ±Ò¼Û¸ñ
#  @param costType ,Ïû·ÑÀàÐÍ
#  @param infoDict ,À©Õ¹ÐÅÏ¢
#  @param quantity Ïû·ÑÊýÁ¿
#  @return None
def __PayMoneyAfter(curPlayer, type_Price, price, costType, infoDict, quantity, costVIPGold):
    if type_Price in ShareDefine.UseTotalPriceTypeList:
        useTotal = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_UseMoneyTotal % type_Price)
        useTotal = min(useTotal + price, ChConfig.Def_UpperLimit_DWord)
        NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_UseMoneyTotal % type_Price, useTotal)
        NotifyUseMoneyTotal(curPlayer, [type_Price])
    
    #½ð×ÓÖ§¸¶
    if type_Price == IPY_GameWorld.TYPE_Price_Gold_Money:
        __PayMoneyAfterByGoldMoney(curPlayer, type_Price, price, costType, infoDict, costVIPGold)
            
    #½ðƱ֧¸¶
    elif type_Price == IPY_GameWorld.TYPE_Price_Gold_Paper:
        __PayMoneyAfterByGoldPaper(curPlayer, price, costType, infoDict)
    
    #Òø×ÓÖ§¸¶
    elif type_Price == IPY_GameWorld.TYPE_Price_Silver_Money:
        __PayMoneyAfterBySilverMoney(curPlayer, price)
    
    #ÒøÆ±Ö§¸¶
    elif type_Price == IPY_GameWorld.TYPE_Price_Silver_Paper:
        __PayMoneyAfterBySilverPaper(curPlayer, price)
    
    EventShell.EventRespons_OnMoneyChange(curPlayer, type_Price)
    
    #»îÔ¾¶È´¦Àí
    PlayerActivity.OnPayMoneyActivity(curPlayer, type_Price, price)
    #תÅ̻
    PlayerActTurntable.OnPlayerUseGold(curPlayer, type_Price, price)
    #Âֻصî
    PlayerActLunhuidian.AddLunhuidianValue(curPlayer, PlayerActLunhuidian.AwardType_PayMoney, type_Price, price)
    
    unitPrice = price if quantity == 1 else int(math.ceil(price * 1.0 / quantity)) # µ¥¼Û
    #reason_name = "Unknown" if not costType else costType
    reason_name = costType
    eventName = reason_name
    if costType in ChConfig.Def_CostType_Dict:
        eventName = ChConfig.Def_CostType_Dict[costType]
    #===========================================================================
    # isDivSonKey = False # ÊÇ·ñÇø·ÖÏû·Ñ¶ÔÏó
    # if costType in ChConfig.Def_CostType_Dict:
    #    eventName, reason_name, isDivSonKey = ChConfig.Def_CostType_Dict[costType]
    #    if costType in ChConfig.CostGroupToGoldShop:
    #        reason_name = ChConfig.Def_CostType_Dict[ChConfig.Def_Cost_BuyStoreItem][1]
    #    
    # if isDivSonKey and isinstance(infoDict, dict) and ChConfig.Def_Cost_Reason_SonKey in infoDict:
    #    reasonSon = infoDict[ChConfig.Def_Cost_Reason_SonKey]
    # else:
    #    reasonSon = reason_name
    # # Í³Ò»¸ñʽ: ¡¸Ïû·Ñ×é:Ïû·Ñ¶ÔÏó¡¹ ; Ã»ÓÐÉèÖÃÏû·Ñ¶ÔÏóµÄĬÈÏΪÏû·Ñ×é
    # reason_name = "%s:%s" % (reason_name, reasonSon)
    #===========================================================================
    
    # ³ý×êʯ¼°°ó×êÍ⣬δָ¶¨²Ù×÷ÀàÐ͵IJ»¼Ç¼
    if type_Price not in [IPY_GameWorld.TYPE_Price_Gold_Money, IPY_GameWorld.TYPE_Price_Gold_Paper, ShareDefine.TYPE_Price_PayCoin] \
        and costType == ChConfig.Def_Cost_Unknown:
        #GameWorld.DebugLog("¸Ã»õ±ÒûÓÐÖ¸¶¨Ïû·ÑÀàÐͲ»¼Ç¼!type_Price=%s,costType=%s" % (type_Price, costType))
        return
    if type_Price == ShareDefine.TYPE_Price_PayCoin:
        playerID = curPlayer.GetPlayerID()
        nowMoney = GetMoneyReal(curPlayer, type_Price)
        payCoinDay = GetMoney(curPlayer, ShareDefine.TYPE_Price_PayCoinDay)
        infoDict["PlayerMoneyCount2"] = payCoinDay
        orderInfo = infoDict.get("orderInfo", "")
        GameWorld.Log("¼Ç¼ÏûºÄ´ú±Ò: eventName=%s,price=%s,nowMoney=%s,payCoinDay=%s,orderInfo=%s" % (eventName, price, nowMoney, payCoinDay, orderInfo), playerID)
        GameWorld.AddPlayerRec(playerID, ShareDefine.Def_PlayerRecType_PayCoin, [2, price, nowMoney, payCoinDay], orderInfo, 1)
    # Á÷ÏòÓàeventName
    #if eventName:
    DataRecordPack.DR_UseMoney(curPlayer, eventName, type_Price, price, infoDict) # Á÷Ïò
    EventReport.WriteEvent_virtual_resource(curPlayer, type_Price, reason_name, quantity,
                                            unitPrice, ShareDefine.Def_UserAction_Money_Use, infoDict)
    #===========================================================================
    # if type_Price == IPY_GameWorld.TYPE_Price_Gold_Money:
    #    EventReport.WriteEvent_virtual_cost(curPlayer, quantity, unitPrice, reason_name)
    # elif type_Price in [IPY_GameWorld.TYPE_Price_Gold_Paper, IPY_GameWorld.TYPE_Price_Silver_Money]:
    #    
    #    # ½ð±Òδָ¶¨Ïû·ÑÀàÐ͵IJ»¼Ç¼
    #    if type_Price == IPY_GameWorld.TYPE_Price_Silver_Money and costType == ChConfig.Def_Cost_Unknown:
    #        return
    #    EventReport.WriteEvent_virtual_resource(curPlayer, type_Price, reason_name, quantity, 
    #                                            unitPrice, ShareDefine.Def_UserAction_Money_Use)
    #    
    # # ×Ô¶¨Òå¼Ç¼
    # priceNameDict = {IPY_GameWorld.TYPE_Price_Gold_Money:["×êʯ", "GetGold", 0],
    #                 IPY_GameWorld.TYPE_Price_Gold_Paper:["°ó×ê", "GetGoldPaper", 0],
    #                 IPY_GameWorld.TYPE_Price_Silver_Money:["½ð±Ò", "GetSilver", ChConfig.Def_DRRecord_Min_Silver],
    #                 }
    # if type_Price in priceNameDict:
    #    typeName, moneyFuncName, minPrice = priceNameDict[type_Price]
    #    if minPrice <= 0 or price >= minPrice: 
    #        EventReport.WriteEvent_pay_money(curPlayer, reason_name, typeName, price, getattr(curPlayer, moneyFuncName)())
    #===========================================================================
    return
 
## ¸¶¿îÒÔºóºóÐø²Ù×÷(½ð×Ó)
#  @param curPlayer Íæ¼ÒʵÀý
#  @param price ,»õ±Ò¼Û¸ñ
#  @return None
def __PayMoneyAfterByGoldMoney(curPlayer, type_Price, price, costType, infoDict, costVIPGold):
        
    
    # ³äÖµ»î¶¯Íæ¼ÒÏûºÄÔª±¦´¦Àí
    #PlayerGoldAction.PlayerUseGold(curPlayer, price)
    
    # Ïû·Ñ·µÀû
    if costType not in ChConfig.CostRebate_DisableType:
        PlayerCostRebate.AddCostRebateGold(curPlayer, costType, price, infoDict)
        PlayerFeastTravel.AddFeastTravelTaskValue(curPlayer, ChConfig.Def_FeastTravel_UseGold, price)
        PlayerActGarbageSorting.AddActGarbageTaskProgress(curPlayer, ChConfig.Def_GarbageTask_UseGold, price)
    else:
        GameWorld.DebugLog("²»¼ÆÈëÏû·Ñ»î¶¯µÄÏû·ÑÀàÐÍ!costType=%s" % costType, curPlayer.GetPlayerID())
        
    # Ê¼þ»ã±¨
    #===========================================================================
    # if costType == ChConfig.Def_Cost_BourseBuy:
    #    # ½»Ò×Ëù¹ºÂòÎïÆ·£¬»ã±¨½»Ò××êʯ
    #    playerName = curPlayer.GetPlayerName()
    #    leftGold = curPlayer.GetGold()
    #    eventParam = "RoleID=%s,Price=%s,TradeType=Lost,LeftGold=%s" \
    #                    % (playerName, price, leftGold)
    #    EventReport.EventReport(ShareDefine.Def_UserAction_TradeGold, eventParam, curPlayer)
    # else:
    #    playerName = curPlayer.GetPlayerName()
    #    leftGold = curPlayer.GetGold()
    #    eventParam = "RoleID=%s,CostType=%s,ItemID=%s,Price=%s,LeftGold=%s" \
    #                    % (playerName, costType, infoDict, price, leftGold)
    #    EventReport.EventReport(ShareDefine.Def_UserAction_UseGold, eventParam, curPlayer)
    #===========================================================================
    
    # Í¨ÖªÔª±¦Ïû·Ñ¼Ç¼
    #__Sync_GoldCostReport(curPlayer, costType, price, expandValue)
    return
 
 
## Í¨ÖªÔª±¦Ïû·Ñ¼Ç¼
#  @param curPlayer: Íæ¼ÒʵÀý
#  @param costType: Ïû·ÑµãÀàÐÍ
#  @param price: Ïû·Ñ¶î¶È
#  @param itemID: ÎïÆ·id£¬Ïû·ÑÀàÐÍΪÎïÆ·Ê±¿ÉÌî
#  @return None
def __Sync_GoldCostReport(curPlayer, costType, price, itemID=0):
    sendPack = ChPyNetSendPack.tagMCGoldCostReport()
    sendPack.Clear()
    sendPack.CostType = costType
    sendPack.Price = price
    sendPack.ItemID = itemID
    NetPackCommon.SendFakePack(curPlayer, sendPack)
    return
 
 
## ¸¶¿îÒÔºóºóÐø²Ù×÷(½ðƱ)
#  @param curPlayer Íæ¼ÒʵÀý
#  @param price ,»õ±Ò¼Û¸ñ
#  @return None
def __PayMoneyAfterByGoldPaper(curPlayer, price, costType, infoDict):    
    
    # Ê¼þ»ã±¨
    #===========================================================================
    # playerName = curPlayer.GetPlayerName()
    # leftGoldPaper = curPlayer.GetGoldPaper()
    # eventParam = "RoleID=%s,CostType=%s,ItemID=%s,Price=%s,LeftGoldPaper=%s" \
    #                % (playerName, costType, infoDict, price, leftGoldPaper)
    # EventReport.EventReport(ShareDefine.Def_UserAction_UseGoldPaper, eventParam, curPlayer)
    #===========================================================================
    return
 
 
## ¸¶¿îÒÔºóºóÐø²Ù×÷(½ðƱ)
#  @param curPlayer Íæ¼ÒʵÀý
#  @param price ,»õ±Ò¼Û¸ñ
#  @return None
def __PayMoneyAfterBySilverMoney(curPlayer, price):    
    return
 
 
## ¸¶¿îÒÔºóºóÐø²Ù×÷(½ðƱ)
#  @param curPlayer Íæ¼ÒʵÀý
#  @param price ,»õ±Ò¼Û¸ñ
#  @return None
def __PayMoneyAfterBySilverPaper(curPlayer, price):    
    return
 
#---------------------------------------------------------------------
##Íæ¼Ò»ñµÃ½ðÇ®
# @param curPlayer Íæ¼ÒʵÀý
# @param value ,»õ±Ò¼Û¸ñ
# @param priceType ,»õ±ÒÀàÐÍ
# @return ·µ»ØÖµÕæ, ¸øÇ®³É¹¦
# @param isSysHint ÊÇ·ñϵͳÌáʾ£¨Ä¬ÈÏÊÇ£©
# @remarks Íæ¼Ò»ñµÃ½ðÇ®
def GiveMoney(curPlayer, priceType, value, giveType=ChConfig.Def_GiveMoney_Unknown, addDataDict={}, isSysHint=True, isGiveBourseMoney=True):
    if value == 0:
        return True
    
    if value < 0:
        GameWorld.Log('Íæ¼Ò»ñµÃ½ðÇ®Òì³£ £¬ value = %s , priceType = %s ,' % (value, priceType))
        return
    
    if GameWorld.IsCrossServer():
        serverGroupID = GetPlayerServerGroupID(curPlayer)
        msgInfo = {"PlayerID":curPlayer.GetPlayerID(), "MoneyType":priceType, "Value":value, "GiveType":giveType, "AddDataDict":addDataDict}
        GameWorld.SendMsgToClientServer(ShareDefine.CrossServerMsg_GiveMoney, msgInfo, [serverGroupID])
        return True
        
    if priceType == IPY_GameWorld.TYPE_Price_Gold_Money:
        updPlayerGold = GetMoneyReal(curPlayer, priceType) + value
        if updPlayerGold > ChConfig.Def_PlayerTotalMoney_Gold:
            #³¬¹ý½ðÇ®ÉÏÏÞ
            NotifyCode(curPlayer, "MoneyIsFull", [priceType])
            return
        SetMoney(curPlayer, priceType, updPlayerGold)
        
        if isGiveBourseMoney and updPlayerGold > 0:
            GiveMoney(curPlayer, ShareDefine.TYPE_Price_BourseMoney, min(value, updPlayerGold))
        addDataDict["BourseMoney"] = GetMoney(curPlayer, ShareDefine.TYPE_Price_BourseMoney)
        
    elif priceType == IPY_GameWorld.TYPE_Price_Gold_Paper:
        updPlayerGoldPaper = GetMoneyReal(curPlayer, priceType)  + value
        if updPlayerGoldPaper > ChConfig.Def_PlayerTotalMoney_Gold:
            #³¬¹ý½ðÇ®ÉÏÏÞ
            NotifyCode(curPlayer, "MoneyIsFull", [priceType])
            return
        SetMoney(curPlayer, priceType, updPlayerGoldPaper)
        
    elif priceType == IPY_GameWorld.TYPE_Price_Silver_Money:
        # ½ðǮ֧³Ö³¬¹ý20ÒÚ, Ôݲ»×öÉÏÏÞ¿ØÖÆ
#        if curSilver + value > ChConfig.Def_PlayerTotalMoney_Silver:
#            #³¬¹ý½ðÇ®ÉÏÏÞ
#            NotifyCode(curPlayer, "MoneyIsFull", [priceType])
#            return
        SetSilver(curPlayer, GetSilver(curPlayer) + value)
       
        
    elif priceType == IPY_GameWorld.TYPE_Price_Silver_Paper:
        if curPlayer.GetSilverPaper() + value > ChConfig.Def_PlayerTotalMoney_Silver:
            #³¬¹ý½ðÇ®ÉÏÏÞ
            NotifyCode(curPlayer, "MoneyIsFull", [priceType])
            return
        
        curPlayer.SetSilverPaper(curPlayer.GetSilverPaper() + value)
        
    elif priceType == ShareDefine.TYPE_Price_PayCoin:
        SetPayCoin(curPlayer, GetPayCoin(curPlayer) + value)
        
    #×Ô¶¨Òå»õ±Ò
    elif priceType in ShareDefine.TYPE_Price_CurrencyDict:
        curCurrency = GetPlayerCurrency(curPlayer, priceType)
        if curCurrency >= ChConfig.Def_UpperLimit_DWord:
            return
        updValue = min(ChConfig.Def_UpperLimit_DWord, curCurrency + value)
        SetPlayerCurrency(curPlayer, priceType, updValue)
        if priceType == ShareDefine.TYPE_Price_RealmPoint:
            PlayerSuccess.DoAddSuccessProgress(curPlayer, ShareDefine.SuccType_GetRealmPoint, value)
            EventShell.EventRespons_GetRealmPoint(curPlayer)
    else:
        GameWorld.ErrLog("½ðÇ®ÀàÐÍ´íÎó, priceType=%s,value=%s,giveType=%s" % (priceType, value, giveType), curPlayer.GetPlayerID())
        DataRecordPack.DR_GiveMoneyError(curPlayer, priceType, value, giveType, addDataDict)
        return
    
    # Ê±Ð§´ú±ÒºóÐø´¦Àí¾ùÊÓΪ´ú±Ò£¬°üº¬ÏµÍ³Ìáʾ¡¢¼Ç¼¡¢Á÷ÏòµÈ
    if priceType == ShareDefine.TYPE_Price_PayCoinDay:
        priceType = ShareDefine.TYPE_Price_PayCoin
        
    if isSysHint and priceType != ShareDefine.TYPE_Price_BourseMoney:
        #֪ͨ¿Í»§¶ËµÃµ½½ðÇ®
        if priceType == ShareDefine.TYPE_Price_PayCoin:
            NotifyCode(curPlayer, "GetMoney", [priceType, value/100])
        else:
            NotifyCode(curPlayer, "GetMoney", [priceType, value])
    __GiveMoneyAfter(curPlayer, priceType, value, giveType, addDataDict)
    
    return True
 
def __GiveMoneyAfter(curPlayer, priceType, value, giveType, addDataDict):
    # ³ý×êʯ¼°°ó×êÍ⣬δָ¶¨²Ù×÷ÀàÐ͵IJ»¼Ç¼
    
    EventShell.EventRespons_OnMoneyChange(curPlayer, priceType)
    
    if priceType not in [IPY_GameWorld.TYPE_Price_Gold_Money, IPY_GameWorld.TYPE_Price_Gold_Paper, ShareDefine.TYPE_Price_PayCoin] \
        and giveType == ChConfig.Def_GiveMoney_Unknown:
        #GameWorld.DebugLog("¸Ã»õ±ÒûÓÐÖ¸¶¨À´Ô´ÀàÐͲ»¼Ç¼!priceType=%s,giveType=%s" % (priceType, giveType))
        return
    eventName = giveType
    if giveType in ChConfig.Def_GetType_Dict:
        eventName = ChConfig.Def_GetType_Dict[giveType]
        addDataDict["eventName"] = eventName
        
    if priceType == ShareDefine.TYPE_Price_PayCoin:
        playerID = curPlayer.GetPlayerID()
        nowMoney = GetMoneyReal(curPlayer, priceType)
        payCoinDay = GetMoney(curPlayer, ShareDefine.TYPE_Price_PayCoinDay)
        addDataDict["PlayerMoneyCount2"] = payCoinDay
        orderInfo = addDataDict.get("orderInfo", "")
        GameWorld.Log("¼Ç¼»ñµÃ´ú±Ò: eventName=%s,value=%s,nowMoney=%s,payCoinDay=%s,orderInfo=%s" % (eventName, value, nowMoney, payCoinDay, orderInfo), playerID)
        GameWorld.AddPlayerRec(playerID, ShareDefine.Def_PlayerRecType_PayCoin, [1, value, nowMoney, payCoinDay], orderInfo, 1)
        
    DataRecordPack.DR_GiveMoney(curPlayer, eventName, priceType, value, addDataDict)
    EventReport.WriteEvent_virtual_resource(curPlayer, priceType, giveType, 1, value,
                                            ShareDefine.Def_UserAction_Money_Get, addDataDict)
    
#===============================================================================
#    reason_name = "Unknown" if not giveType else giveType
#    eventName = reason_name
#    if giveType in ChConfig.Def_GetType_Dict:
#        eventName, reason_name = ChConfig.Def_GetType_Dict[giveType][:2]
#    if isinstance(addDataDict, dict) and ChConfig.Def_Give_Reason_SonKey in addDataDict:
#        reasonSon = addDataDict[ChConfig.Def_Give_Reason_SonKey]
#    else:
#        reasonSon = reason_name
#    # Í³Ò»¸ñʽ: ¡¸»ñµÃ×é:»ñµÃÔ­Òò¡¹
#    reason_name = "%s:%s" % (reason_name, reasonSon)
#            
#    # Á÷ÏòÓàeventName
#    if eventName:
#        DataRecordPack.DR_GiveMoney(curPlayer, eventName, priceType, value, addDataDict)
#        
#    if priceType == IPY_GameWorld.TYPE_Price_Gold_Money:
#        playerName = curPlayer.GetPlayerName()
#        eventParam = "RoleID=%s,AddGold=%s,LeftGold=%s,AddDataDict=%s" \
#                    % (playerName, value, curPlayer.GetGold(), addDataDict)
#        EventReport.EventReport(ShareDefine.Def_UserAction_GameMakeGold, eventParam, curPlayer)
#        
#    elif priceType == IPY_GameWorld.TYPE_Price_Gold_Paper:
#        playerName = curPlayer.GetPlayerName()
#        eventParam = "RoleID=%s,AddGoldPaper=%s,LeftGoldPaper=%s,AddDataDict=%s" \
#                        % (playerName, value, curPlayer.GetGoldPaper(), addDataDict)
#        EventReport.EventReport(ShareDefine.Def_UserAction_GameMakeGoldPaper, eventParam, curPlayer)
#    
#    if priceType == IPY_GameWorld.TYPE_Price_Gold_Money: #and eventName != "CoinToGold":
#        EventReport.WriteEvent_virtual_reward(curPlayer, value, reason_name)
#    # ¶þ¼¶»õ±Ò²ú³ö¼Ç¼, ÔÝÖ»¼Ç¼°ó×ê¡¢½ð±Ò
#    elif priceType in [IPY_GameWorld.TYPE_Price_Gold_Paper, IPY_GameWorld.TYPE_Price_Silver_Money]:
#        EventReport.WriteEvent_virtual_resource(curPlayer, priceType, reason_name, 1, value,
#                                                ShareDefine.Def_UserAction_Money_Get)
#        
#    # ×Ô¶¨Òå¼Ç¼
#    priceNameDict = {IPY_GameWorld.TYPE_Price_Gold_Money:["×êʯ", "GetGold", 0],
#                     IPY_GameWorld.TYPE_Price_Gold_Paper:["°ó×ê", "GetGoldPaper", 0],
#                     IPY_GameWorld.TYPE_Price_Silver_Money:["½ð±Ò", "GetSilver", ChConfig.Def_DRRecord_Min_Silver],
#                     }
#    if priceType in priceNameDict:
#        typeName, moneyFuncName, minPrice = priceNameDict[priceType]
#        if minPrice <= 0 or value >= minPrice: 
#            EventReport.WriteEvent_give_money(curPlayer, reason_name, typeName, value, getattr(curPlayer, moneyFuncName)())
#===============================================================================
        
    return
 
 
#---------------------------------------------------------------------
##Íæ¼ÒÄÜ·ñ»ñµÃ½ðÇ®
# @param curPlayer Íæ¼ÒʵÀý
# @param value ,»õ±Ò¼Û¸ñ
# @param type ,»õ±ÒÀàÐÍ
# @return ·µ»ØÖµÕæ, Í¨¹ý
# @remarks Íæ¼ÒÄÜ·ñ»ñµÃ½ðÇ®
def CanGiveMoney(curPlayer, priceType, value):
    if value == 0:
        return True
    
    if priceType == IPY_GameWorld.TYPE_Price_Gold_Money:
        if curPlayer.GetGold() + value > ChConfig.Def_PlayerTotalMoney_Gold:
            #³¬¹ý½ðÇ®ÉÏÏÞ
            NotifyCode(curPlayer, "MoneyIsFull", [priceType])
            return False 
    elif priceType == IPY_GameWorld.TYPE_Price_Gold_Paper:
        if curPlayer.GetGoldPaper() + value > ChConfig.Def_PlayerTotalMoney_Gold:
            #³¬¹ý½ðÇ®ÉÏÏÞ
            NotifyCode(curPlayer, "MoneyIsFull", [priceType])
            return False
    elif priceType == IPY_GameWorld.TYPE_Price_Silver_Money:
        #½ð±ÒÖ§³Ö³¬¹ý20ÒÚ£¬Ôݲ»×öÉÏÏÞ¿ØÖÆ
        pass
#        if GetSilver(curPlayer) + value > ChConfig.Def_PlayerTotalMoney_Silver:
#            #³¬¹ý½ðÇ®ÉÏÏÞ
#            NotifyCode(curPlayer, "MoneyIsFull", [priceType])
#            return False
    elif priceType == IPY_GameWorld.TYPE_Price_Silver_Paper:
        if curPlayer.GetSilverPaper() + value > ChConfig.Def_PlayerTotalMoney_Silver:
            #³¬¹ý½ðÇ®ÉÏÏÞ
            NotifyCode(curPlayer, "MoneyIsFull", [priceType])
            return False
    elif priceType == ShareDefine.TYPE_Price_PayCoin:
        pass
    elif priceType in ShareDefine.TYPE_Price_CurrencyDict:
        curCurrency = GetPlayerCurrency(curPlayer, priceType)
        if curCurrency + value > ChConfig.Def_UpperLimit_DWord:
            return False
    else:
        
        GameWorld.Log("½ðÇ®ÀàÐÍ = %sÌî´íÀ²" % (priceType), curPlayer.GetPlayerID())
        return False 
    
    return True
 
#---------------------------------------------------------------------
##Íæ¼Ò×Ô¶¯»ØÑª
# @param curPlayer Íæ¼ÒʵÀý
# @param tick Ê±¼ä´Á
# @return ·µ»ØÖµÎÞÒâÒå
# @remarks Íæ¼Ò×Ô¶¯»ØÑª
def PlayerAutoRestoreHP(curPlayer, tick):
    return
    
#---------------------------------------------------------------------
##Íæ¼Ò×Ô¶¯»ØÄ§
# @param curPlayer Íæ¼ÒʵÀý
# @param tick Ê±¼ä´Á
# @return ·µ»ØÖµÎÞÒâÒå
# @remarks Íæ¼Ò×Ô¶¯»ØÄ§
def PlayerAutoRestoreMP(curPlayer, tick):
    return
 
 
##»ñµÃµ±Ç°Íæ¼ÒµÄ²Î¿¼¾­Ñé
# @param curPlayer Íæ¼ÒʵÀý
# @return ·µ»ØÖµ, ²Î¿¼¾­Ñé
# @remarks »ñµÃµ±Ç°Íæ¼ÒµÄ²Î¿¼¾­Ñé
def GetPlayerReExp(curPlayer):
    lvIpyData = GetPlayerLVIpyData(curPlayer.GetLV())
    if not lvIpyData:
        return 0
    return lvIpyData.GetReExp()
 
## »ñµÃµ±Ç°Íæ¼ÒµÄ²Î¿¼½ðÇ®
#  @param curPlayer Íæ¼ÒʵÀý
#  @return
def GetPlayerReMoney(curPlayer):
    return 0
 
#---------------------------------------------------------------------
##Ôö¼ÓÍæ¼ÒµÄPKÖµ
# @param curPlayer Íæ¼ÒʵÀý
# @param tick Ê±¼ä´Á
# @return ·µ»ØÖµÎÞÒâÒå
# @remarks Ôö¼ÓÍæ¼ÒµÄPKÖµ
def AddPlayerPKValue(curPlayer, tick):
    curPlayerPKValue = curPlayer.GetPKValue()
    maxPKValue = GetMaxPKValue()
    if curPlayerPKValue >= maxPKValue:
        #µ±Ç°PKÖµÒѵ½ÉÏÏÞ,²»Ìí¼Ó
        return
    
    #Ìí¼ÓµãÊý
    addPoint = 1
    changePKValue = ChangePKValue(curPlayer, addPoint, tick)
    
    if changePKValue >= maxPKValue:
        #PK_wll_0: ÄúɱÄõ¹ýÖØ£¬ÔÚºìÃû״̬ÏûʧǰÄú½«²»ÄܼÌÐø¶øÒѹ¥»÷ËûÈË
        NotifyCode(curPlayer, "PK_lhs_202580")
        
    #Íæ¼ÒïÚ³µÉíÉϼÇÂ¼Íæ¼ÒÃû×ÖÑÕÉ«ÐÅÏ¢(±ØÐëÔÚÉèÖúìÃûÒÔºó)
    #PlayerTruck.ChangeTruckNoteInfo(curPlayer)
    return
 
def ChangePKValue(curPlayer, addValue, tick):
    '''¸ü¸ÄPKÖµ'''
    curPlayerPKValue = curPlayer.GetPKValue()
    maxPKValue = GetMaxPKValue()
    newPKValue = max(0, min(maxPKValue, curPlayerPKValue + addValue))
    if newPKValue == curPlayerPKValue:
        return newPKValue
    
    GameWorld.DebugLog("¸üÐÂPKÖµ: curPlayerPKValue=%s,newPKValue=%s,addValue=%s" % (curPlayerPKValue, newPKValue, addValue), curPlayer.GetPlayerID())
    if newPKValue == 0:
        ClearPKValue(curPlayer)
    else:
        addBuffID = ChConfig.Def_SkillID_Red
        curPlayer.SetPKValue(newPKValue)
        findBuffInfo = SkillCommon.FindBuffByID(curPlayer, addBuffID)
        redBuff = findBuffInfo[0]
        addTimeValue = newPKValue - curPlayerPKValue
        if not redBuff:
            SkillCommon.AddBuffBySkillType_NoRefurbish(curPlayer, addBuffID, tick)
            if newPKValue > 1:
                findBuffInfo = SkillCommon.FindBuffByID(curPlayer, addBuffID)
                redBuff = findBuffInfo[0]
                addTimeValue = newPKValue - 1
                
        if addTimeValue and redBuff:
            __AddPKValueRedBuffTime(curPlayer, redBuff, addTimeValue)
    return newPKValue
 
def __AddPKValueRedBuffTime(curPlayer, redBuff, addTimeValue):
    '''Ôö¼ÓPKÖµ¶ÔÓ¦buffʱ³¤
    @param addTimeValue: Ôö¼ÓµÄbuffµ¥Î»Ê±³¤´ÎÊý, Ö§³ÖÕý¸º
    '''
    buffSkill = redBuff.GetSkill()
    if not buffSkill:
        return
    buffType = SkillCommon.GetBuffType(buffSkill)
    addTime = buffSkill.GetLastTime() * addTimeValue # ÓÐÕý¸º
    remainTime = redBuff.GetRemainTime()
    resultTime = min(max(0, remainTime + addTime), ChConfig.Def_Max_Buff_RemainTime)
    redBuff.SetRemainTime(resultTime)
    BuffSkill.PYSync_RefreshBuff(curPlayer, redBuff, buffType)
    GameWorld.DebugLog("    Ôö¼ÓºìÃûbuffʱ³¤: addTimeValue=%s,remainTime=%s,addTime=%s,resultTime=%s" 
                       % (addTimeValue, remainTime, addTime, resultTime), curPlayer.GetPlayerID())
    return
 
def RefreshPKValueByRedBuff(curPlayer):
    ## Ë¢ÐºìÃû¶ÔÓ¦PKValue
    curPKValue = curPlayer.GetPKValue()
    if not curPKValue:
        return
    if PlayerTJG.GetIsTJG(curPlayer):
        return
    redBuff = SkillCommon.FindBuffByID(curPlayer, ChConfig.Def_SkillID_Red)[0]
    if not redBuff:
        curPlayer.SetPKValue(0)
        return
    buffSkill = redBuff.GetSkill()
    if not buffSkill:
        return
    remainTime = redBuff.GetRemainTime()
    perPKValueTime = buffSkill.GetLastTime()
    pkValue = int(math.ceil(remainTime / float(perPKValueTime)))
    if curPKValue != pkValue:
        curPlayer.SetPKValue(pkValue)
        GameWorld.DebugLog("¸üÐÂÍæ¼ÒPKÖµ: remainTime=%s,pkValue=%s" % (remainTime, pkValue), curPlayer.GetPlayerID())
    return
 
def ClearPKValue(curPlayer):
    '''Çå³ýPKÖµ'''
    curPlayer.SetPKValue(0)
    tick = GameWorld.GetGameWorld().GetTick()
    BuffSkill.DelBuffBySkillID(curPlayer, ChConfig.Def_SkillID_Red, tick)
    return
 
def GetMaxPKValue():
    '''»ñÈ¡×î´óPKÖµ'''
    return IpyGameDataPY.GetFuncCfg("PKConfig", 2)
 
#---------------------------------------------------------------------
##»ñµÃÍæ¼ÒÉý¼¶, »ñµÃµÄÊôÐÔµã
# @param curPlayer Íæ¼ÒʵÀý
# @return ·µ»ØÖµ, »ñµÃµÄÊôÐÔµã
# @remarks »ñµÃÍæ¼ÒÉý¼¶, »ñµÃµÄÊôÐÔµã
def GetLvUp_AddPoint(curPlayer):
    curPlayerID = curPlayer.GetID()
    curLV = curPlayer.GetLV() # µ±Ç°µÈ¼¶
    
    addPointDict = IpyGameDataPY.GetFuncEvalCfg("LVUPAddPoint", 1, {})
    addPoint = GameWorld.GetDictValueByRangeKey(addPointDict, curLV, 0)
    
    if addPoint == None:
        raise Exception('Íæ¼Ò»ñµÃÉý¼¶ÊôÐÔµãÒì³£, curLV = %s PlayerID = %s' % (curLV, curPlayerID))
        return
    return int(addPoint+ GetFabaoAddPoint(curPlayer) + GetTitleAddExtraPoint(curPlayer))
 
def GetAllPointByLV(curPlayer):
    ##»ñÈ¡µ±Ç°µÈ¼¶¿ÉµÃµ½ÊôÐÔµãÊý
    openLV = GameFuncComm.GetFuncLimitLV(ShareDefine.GameFuncID_AddPoint)
    curLV = curPlayer.GetLV()
    if curLV < openLV:
        return 0
    # ³õʼµã+(Éý¼¶µã+·¨±¦Ð§¹û)*³ÆºÅЧ¹û±¶Êý+¾³½çµã
    setFreePoint = IpyGameDataPY.GetFuncCfg("LVUPAddPoint", 2)
    fabaoAddPoint = GetFabaoAddPoint(curPlayer)
    titleAddPoint = GetTitleAddExtraPoint(curPlayer)
    addPointDict = IpyGameDataPY.GetFuncEvalCfg("LVUPAddPoint", 1, {})
    for rangLVs, point in addPointDict.items():
        if curLV < rangLVs[0]:
            continue
        setFreePoint += (point + fabaoAddPoint + titleAddPoint) * (min(curLV, rangLVs[1]) - rangLVs[0] + 1)
    
    #¾³½çÌáÉýµãÊý
    setFreePoint += curPlayer.GetOfficialRank() * IpyGameDataPY.GetFuncCfg("LVUPAddPoint", 3)
    return setFreePoint
 
def GetTitleAddExtraPoint(curPlayer):
    # ³ÆºÅ¶îÍâÔö¼ÓÍæ¼Òÿ¼¶»ñµÃµÄÁé¸ùµã
    titleID = IpyGameDataPY.GetFuncCfg("TitleAddPoint")
    if titleID and curPlayer.GetDienstgradManager().GetDienstgrad(titleID):
        return IpyGameDataPY.GetFuncCfg("TitleAddPoint", 2)
    return 0
 
def GetFabaoAddPoint(curPlayer):
    #·¨±¦¶îÍâÔö¼ÓÍæ¼Òÿ¼¶»ñµÃµÄÁé¸ùµã
    mwID = IpyGameDataPY.GetFuncCfg('FabaoAddPoint', 1)
    if not PlayerMagicWeapon.GetIsActiveMagicWeapon(curPlayer, mwID, lv=1):
        return 0
    return IpyGameDataPY.GetFuncCfg('FabaoAddPoint', 2)
 
def DoAddPointOpen(curPlayer):
    '''¼Óµã¹¦ÄÜ¿ªÆô'''
    beforeFreePoint = curPlayer.GetFreePoint()
    
    setFreePoint = GetAllPointByLV(curPlayer)
    curLV = curPlayer.GetLV()
    addDataDict = {'beforeFreePoint':beforeFreePoint}
    curPlayer.SetFreePoint(setFreePoint)
    DataRecordPack.DR_Freepoint(curPlayer, "AddPointOpen", setFreePoint, addDataDict)
    GameWorld.DebugLog('    ¼Óµã¹¦ÄÜ¿ªÆô´¦Àí  beforeFreePoint=%s,curLV=%s, setFreePoint=%s'%(beforeFreePoint, curLV, setFreePoint), curPlayer.GetID())
    return
 
    
#---------------------------------------------------------------------
 
## ¹¦ÄÜÄ£¿éÕ½¶·Á¦Àà
#
#  ·ÖÄ£¿é¼ÆËãÕ½¶·Á¦
class ModuleFightPower():
    
    __AttrName = "%s" # ²ÎÊýΪChConfig.Def_Calc_AllAttrType_MAX¶ÔÓ¦ËùÓÐÊôÐÔÁбíË÷Òý
    __AttrNameNoline = "Noline_%s" # ²ÎÊýΪChConfig.Def_Calc_AllAttrType_MAX¶ÔÓ¦ËùÓÐÊôÐÔÁбíË÷Òý
    __NolineAttrList = [ChConfig.TYPE_Calc_AttrSpeed] # ÐèÒª¼Ç¼µÄ·ÇÏßÐÔÕ½¶·ÊôÐÔ
    
    ## ³õʼ»¯
    #  @param self ÀàʵÀý
    #  @return ·µ»ØÖµÎÞÒâÒå
    #  @remarks ³õʼ»¯
    def __init__(self, mfpType):
        self.mfpType = mfpType
        self.ClearAttr()
        return
            
    ## ÖØÖÃËùÓÐÊôÐÔ
    #  @param self ÀàʵÀý
    #  @return ·µ»ØÖµÎÞÒâÒå
    def ClearAttr(self):
        for attrIndex in xrange(1, ChConfig.Def_Calc_AllAttrType_MAX):
            value = 0
            setattr(self, self.__AttrName % attrIndex, value)
        for attrIndex in self.__NolineAttrList:
            setattr(self, self.__AttrNameNoline % attrIndex, 0)            
        return
            
    ## ¸ù¾ÝÕ½¶·ÊôÐÔÁбíÉèÖüÆËãÕ½¶·Á¦ÊôÐÔ
    #  @param self ÀàʵÀý
    #  @return ·µ»ØÖµÎÞÒâÒå
    def SetCalcMFPBattleAttr(self, allAttrList):
        battleAttrDict = allAttrList[ChConfig.CalcAttr_Battle]
        # ÉèÖñ¾Ä£¿éÔö¼ÓµÄÏßÐÔÕ½¶·ÊôÐÔ£¬·ÇÏßÐÔÕ½¶·ÊôÐÔÔö¼ÓµÄÔÚË¢ÊôÐÔʱÀÛ¼ÓÉÏÈ¥
        for attrIndex, value in battleAttrDict.items():
            self.AddCalcMFPAttr(attrIndex, value)
            
        # ·ÇÏßÐÔÕ½¶·ÊôÐÔ½öÉèÖÃʱ¼Ç¼¼´¿É
        battleNolineAttrDict = allAttrList[ChConfig.CalcAttr_BattleNoline]
        for attrIndex, value in battleNolineAttrDict.items():
            if attrIndex in self.__NolineAttrList:
                setattr(self, self.__AttrNameNoline % attrIndex, value)
        return
    
    ## ÉèÖüÆËãÕ½¶·Á¦ÊôÐÔÖµ
    def SetCalcMFPAttr(self, attrIndex, value):
        if 1 <= attrIndex < ChConfig.Def_Calc_AllAttrType_MAX:
            attrName = self.__AttrName % attrIndex
            setattr(self, attrName, value)
        return
            
    ## Ôö¼Ó¼ÆËãÕ½¶·Á¦ÊôÐÔ
    #  @param self ÀàʵÀý
    #  @param key ¼ÆËãÊôÐÔÀàÐÍ
    #  @param value ¼ÆËãÊôÐÔÊýÖµ
    #  @return ·µ»ØÖµÎÞÒâÒå
    def AddCalcMFPAttr(self, attrIndex, value):
        # Èç¹ûÓдæÔÚ¼ÆËãÕ½¶·Á¦ËùÐèµÄ²ÎÊýkeyÖµ£¬ÔòÔö¼ÓÉÏÈ¥
        if 1 <= attrIndex < ChConfig.Def_Calc_AllAttrType_MAX:
            attrName = self.__AttrName % attrIndex
            setattr(self, attrName, getattr(self, attrName) + value)
    
    def GetModuleFightPower(self, fpParam, curPlayer):
        MaxHP = getattr(self, self.__AttrName % ChConfig.TYPE_Calc_AttrMaxHP) # ×î´óѪÁ¿
        MinAtk = getattr(self, self.__AttrName % ChConfig.TYPE_Calc_AttrATKMin) # ×îС¹¥»÷
        MaxAtk = getattr(self, self.__AttrName % ChConfig.TYPE_Calc_AttrATKMax) # ×î´ó¹¥»÷
        Def = getattr(self, self.__AttrName % ChConfig.TYPE_Calc_AttrDEF) # Îï·À
        Hit = getattr(self, self.__AttrName % ChConfig.TYPE_Calc_AttrHit) * fpParam.GetCftHit() # ÃüÖÐÖµ
        Miss = getattr(self, self.__AttrName % ChConfig.TYPE_Calc_AttrMiss) * fpParam.GetCftMiss() # ÉÁ±ÜÖµ
        AtkSpeed = getattr(self, self.__AttrName % ChConfig.TYPE_Calc_AttrAtkSpeed) # ¹¥»÷ËÙ¶È£¨ÊýÖµ·Ç¹¥»÷¼ä¸ô£©
        SuperHitRate = getattr(self, self.__AttrName % ChConfig.TYPE_Calc_SuperHitRate) * fpParam.GetCftSuperHitRate() # ±©»÷ÂÊ
        SuperHitRateReduce = getattr(self, self.__AttrName % ChConfig.TYPE_Calc_SuperHitRateReduce) * fpParam.GetCftSuperHitRateReduce() # ±©»÷¸ÅÂÊ¿¹ÐÔ
        SuperHit = getattr(self, self.__AttrName % ChConfig.TYPE_Calc_SuperHit) # ±©»÷É˺¦¹Ì¶¨Öµ
        SuperHitReduce = getattr(self, self.__AttrName % ChConfig.TYPE_Calc_SuperHitReduce) # ±©»÷¹Ì¶¨¼õÉË
        LuckyHitRate = getattr(self, self.__AttrName % ChConfig.TYPE_Calc_LuckyHitRate) * fpParam.GetCftLuckyHitRate() # »áÐÄÒ»»÷
        LuckyHitRateReduce = getattr(self, self.__AttrName % ChConfig.TYPE_Calc_LuckyHitRateReduce) * fpParam.GetCftLuckyHitRateReduce() # »áÐÄÒ»»÷¸ÅÂÊ¿¹ÐÔ
        LuckyHit = getattr(self, self.__AttrName % ChConfig.TYPE_Calc_LuckyHit) # »áÐÄÒ»»÷É˺¦¹Ì¶¨Öµ
        LuckyHitReduce = getattr(self, self.__AttrName % ChConfig.TYPE_Calc_LuckyHitReduce) # »áÐÄÒ»»÷É˺¦¹Ì¶¨¼õÉË
        SkillAtkRate = getattr(self, self.__AttrName % ChConfig.TYPE_Calc_SkillAtkRate) * fpParam.GetCftSkillAtkRate() # ¼¼Äܹ¥»÷±ÈÀý¼Ó³É
        SkillAtkRateReduce = getattr(self, self.__AttrName % ChConfig.TYPE_Calc_SkillAtkRateReduce) * fpParam.GetCftSkillAtkRateReduce() # ¼¼Äܹ¥»÷±ÈÀý¼õÉÙ
        DamagePVP = getattr(self, self.__AttrName % ChConfig.TYPE_Calc_DamagePVP)  # PVP¹Ì¶¨É˺¦
        DamagePVPReduce = getattr(self, self.__AttrName % ChConfig.TYPE_Calc_DamagePVPReduce)  # PVP¹Ì¶¨¼õÉË
        DamagePVE = getattr(self, self.__AttrName % ChConfig.TYPE_Calc_DamagePVE)  # PVE¹Ì¶¨É˺¦
        HPRestore = getattr(self, self.__AttrName % ChConfig.TYPE_Calc_HPRestorePer) # ×Ô¶¯»Ø¸´ÑªÁ¿£¬¹Ì¶¨Öµ
        DamBackPer = getattr(self, self.__AttrName % ChConfig.TYPE_Calc_DamBackPer) * fpParam.GetCftDamBackPer() # ·´É˰ٷֱÈ
        SpeedValue = getattr(self, self.__AttrName % ChConfig.TYPE_Calc_AttrSpeed) # Òƶ¯ËÙ¶ÈÖµ
        SpeedPer = 0#getattr(self, self.__AttrNameNoline % ChConfig.TYPE_Calc_AttrSpeed) * fpParam.GetCftSpeedPer() # Òƶ¯ËٶȰٷֱÈϵÊý
        PetMinAtk = getattr(self, self.__AttrName % ChConfig.TYPE_Calc_PetMinAtk) # ³èÎï×îС¹¥»÷
        PetMaxAtk = getattr(self, self.__AttrName % ChConfig.TYPE_Calc_PetMaxAtk) # ³èÎï×î´ó¹¥»÷
        PetDamPer = getattr(self, self.__AttrName % ChConfig.TYPE_Calc_PetDamPer) # ³èÎïÉ˺¦°Ù·Ö±ÈÌáÉý
        IceAtk = getattr(self, self.__AttrName % ChConfig.TYPE_Calc_AttrIceAtk) # ±ù¹¥, ÔªËع¥»÷
        IceDef = getattr(self, self.__AttrName % ChConfig.TYPE_Calc_AttrIceDef) # ±ù·À, ÔªËØ·ÀÓù
        IgnoreDefRate = getattr(self, self.__AttrName % ChConfig.TYPE_Calc_IgnoreDefRate) * fpParam.GetCftIgnoreDefRate() # ÎÞÊÓ·ÀÓù¼¸ÂÊ
        IgnoreDefRateReduce = getattr(self, self.__AttrName % ChConfig.TYPE_Calc_IgnoreDefRateReduce) * fpParam.GetCftIgnoreDefRateReduce() # ÎÞÊÓ·ÀÓù¸ÅÂÊ¿¹ÐÔ
        DamChanceDef = getattr(self, self.__AttrName % ChConfig.TYPE_Calc_DamChanceDef) * fpParam.GetCftDamChanceDef() # 20%µÄ¸ÅÂʵÖÓùÉ˺¦±ÈÂÊ
        BleedDamage = 0#getattr(self, self.__AttrName % ChConfig.TYPE_Calc_BleedDamage) * fpParam.GetCftBleedDamage() # Á÷ѪÉ˺¦
        AtkBackHP = getattr(self, self.__AttrName % ChConfig.TYPE_Calc_AtkBackHPPer) # ¹¥»÷»Ø¸´ÑªÁ¿
        FaintRate = getattr(self, self.__AttrName % ChConfig.TYPE_Calc_FaintRate) * fpParam.GetCftFaintRate() # ´¥·¢»÷ÔÎ
        FaintDefRate = getattr(self, self.__AttrName % ChConfig.TYPE_Calc_FaintDefRate) * fpParam.GetCftFaintDefRate() # »÷Ôεֿ¹
        FinalHurt = getattr(self, self.__AttrName % ChConfig.TYPE_Calc_FinalHurt) # ×îÖչ̶¨É˺¦Ôö¼Ó
        FinalHurtReduce = getattr(self, self.__AttrName % ChConfig.TYPE_Calc_FinalHurtReduce) # ×îÖչ̶¨É˺¦¼õÉÙ
        BossFinalHurtPer = getattr(self, self.__AttrName % ChConfig.TYPE_Calc_BossFinalHurtPer) * fpParam.GetCftBossFinalHurtPer() # Boss×îÖÕÉ˺¦Íò·ÖÂÊ
        FinalHurtPer = getattr(self, self.__AttrName % ChConfig.TYPE_Calc_FinalHurtPer) * fpParam.GetCftFinalHurtPer() # ×îÖÕÉ˺¦Íò·ÖÂÊ
        FinalHurtReducePer = getattr(self, self.__AttrName % ChConfig.TYPE_Calc_FinalHurtReducePer) * fpParam.GetCftFinalHurtReducePer() # ×îÖÕÉ˺¦¼õÉÙÍò·ÖÂÊ
        DamagePerPVP = getattr(self, self.__AttrName % ChConfig.TYPE_Calc_DamagePerPVP) * fpParam.GetCftDamagePerPVP() # É˺¦Êä³ö¼ÆËã°Ù·Ö±ÈPVP
        DamagePerPVPReduce = getattr(self, self.__AttrName % ChConfig.TYPE_Calc_DamagePerPVPReduce) * fpParam.GetCftDamagePerPVPReduce() # É˺¦Êä³ö¼ÆËã°Ù·Ö±ÈPVP¼õÉÙ
        JobAHurtAddPer = getattr(self, self.__AttrName % ChConfig.TYPE_Calc_JobAHurtAddPer) * fpParam.GetCftJobAHurtAddPer() # ¶ÔÄ¿±êսʿÉ˺¦¼Ó³É
        JobBHurtAddPer = getattr(self, self.__AttrName % ChConfig.TYPE_Calc_JobBHurtAddPer) * fpParam.GetCftJobBHurtAddPer() # ¶ÔÄ¿±ê·¨Ê¦É˺¦¼Ó³É
        JobCHurtAddPer = getattr(self, self.__AttrName % ChConfig.TYPE_Calc_JobCHurtAddPer) * fpParam.GetCftJobCHurtAddPer() # ¶ÔÄ¿±ê¹­¼ýÉ˺¦¼Ó³É
        JobAAtkReducePer = getattr(self, self.__AttrName % ChConfig.TYPE_Calc_JobAAtkReducePer) * fpParam.GetCftJobAAtkReducePer() # Õ½Ê¿¹¥»÷É˺¦¼õÃâ
        JobBAtkReducePer = getattr(self, self.__AttrName % ChConfig.TYPE_Calc_JobBAtkReducePer) * fpParam.GetCftJobBAtkReducePer() # ·¨Ê¦¹¥»÷É˺¦¼õÃâ
        JobCAtkReducePer = getattr(self, self.__AttrName % ChConfig.TYPE_Calc_JobCAtkReducePer) * fpParam.GetCftJobCAtkReducePer() # ¹­¼ý¹¥»÷É˺¦¼õÃâ
        AffairSpeedPer = getattr(self, self.__AttrName % ChConfig.TYPE_Calc_AffairSpeedPer) * fpParam.GetCftAffairSpeedPer() # ÏÉÃËÊÂÎñËٶȼӳÉ
        FamilyBossHurtPer = getattr(self, self.__AttrName % ChConfig.TYPE_Calc_FamilyBossHurtPer) * fpParam.GetCftFamilyBossHurtPer() # ÏÉÃËBOSSÉ˺¦¼Ó³É
        FamilyWarHPPer = getattr(self, self.__AttrName % ChConfig.TYPE_Calc_FamilyWarHPPer) * fpParam.GetCftFamilyWarHPPer() # ÏÉÃËÁªÈüÉúÃü¼Ó³É
        FamilyWarAtkPer = getattr(self, self.__AttrName % ChConfig.TYPE_Calc_FamilyWarAtkPer) * fpParam.GetCftFamilyWarAtkPer() # ÏÉÃËÁªÈü¹¥»÷¼Ó³É
        FamilySitExpPer = getattr(self, self.__AttrName % ChConfig.TYPE_Calc_FamilySitExpPer) * fpParam.GetCftFamilySitExpPer() # ÏÉÃË´ò×ø¾­Ñé¼Ó³É
        
        NormalHurt = getattr(self, self.__AttrName % ChConfig.TYPE_Calc_NormalHurt) 
        NormalHurtPer = getattr(self, self.__AttrName % ChConfig.TYPE_Calc_NormalHurtPer) * fpParam.GetCftNormalHurtPer() # ÆÕͨ¸½¼ÓÉ˺¦¼Ó³É
        FabaoHurt = getattr(self, self.__AttrName % ChConfig.TYPE_Calc_FabaoHurt)
        FabaoHurtPer = getattr(self, self.__AttrName % ChConfig.TYPE_Calc_FabaoHurtPer) * fpParam.GetCftFabaoHurtPer() # ·¨±¦¸½¼ÓÉ˺¦¼Ó³É
        Luck = getattr(self, self.__AttrName % ChConfig.TYPE_Calc_Luck)
        
        ComboRate = getattr(self, self.__AttrName % ChConfig.TYPE_Calc_ComboRate) # Á¬»÷¼¸ÂÊ
        ComboDamPer = getattr(self, self.__AttrName % ChConfig.TYPE_Calc_ComboDamPer) # Á¬»÷É˺¦
        #MaxProDef = getattr(self, self.__AttrName % ChConfig.TYPE_Calc_MaxProDef) # ×î´ó·À»¤Öµ
        #ProDefAbsorb = getattr(self, self.__AttrName % ChConfig.TYPE_Calc_ProDefAbsorb) # ·À»¤ÖµÎüÊÕÉ˺¦±ÈÂÊ
        ProDefPer = getattr(self, self.__AttrName % ChConfig.TYPE_Calc_ProDefHPPer) # ·À»¤×ª»¯°Ù·Ö±È
        
        OnlyFinalHurt = getattr(self, self.__AttrName % ChConfig.TYPE_Calc_OnlyFinalHurt) # ¶îÍâÊä³öÉ˺¦
        PVPAtkBackHP = getattr(self, self.__AttrName % ChConfig.TYPE_Calc_PVPAtkBackHP) # PVP¹¥»÷»ØÑª
        NPCHurtAddPer = getattr(self, self.__AttrName % ChConfig.TYPE_Calc_NPCHurtAddPer) * fpParam.GetCftNPCHurtAddPer() # ¶Ô¹ÖÎïÉ˺¦¼Ó³É
        
        #ÆäËûÐè×÷Ϊ¹«Ê½²ÎÊýµÄϵÊý
        AtkSpeedParameter = fpParam.GetCftAtkSpeed()
        LuckyHitParameter = 0#fpParam.GetCftLuckyHit()
        
        #È¡×ÜÊôÐÔµÄ
        SuperHitRateTotal = curPlayer.GetSuperHitRate()
        LuckyHitRateTotal = curPlayer.GetLuckyHitRate()
        
        job = curPlayer.GetJob()
        diffAttrDict = self.__GetAttrFightPowerParamDiff(job)
        for paramName, diffValue in diffAttrDict.items():
            exec("%s = max(0, %s - %s)" % (paramName, paramName, diffValue))
            
        #»ñÈ¡²ß»®ÅäÖõıí¸ñ
        FightpowerFormula = IpyGameDataPY.GetFuncCfg("FightpowerFormula")
        totalFightPower = eval(FormulaControl.GetCompileFormula("FightpowerFormula", FightpowerFormula))
        
        #GameWorld.DebugLog("MfpType=%s,FightPower=%s, %s" % (self.mfpType, totalFightPower, self.GetMFPAttrStr()))
        if totalFightPower > ShareDefine.Def_UpperLimit_DWord:
            GameWorld.ErrLog("Ä£¿éÕ½Á¦³¬¹ýÊýÖµÉÏÏÞ, MfpType=%s,fightPower=%s, %s" % (self.mfpType, totalFightPower, self.GetMFPAttrStr()))
            totalFightPower = ShareDefine.Def_UpperLimit_DWord
        return totalFightPower
        
    def __GetAttrFightPowerParamDiff(self, job):
        ## Õ½Á¦¼ÆËãÊôÐÔ²ÎÊýÓëʵ¼ÊÊôÐÔ²îÖµ
        
        #½ÇÉ«»ù´¡Ä£¿éijЩÊôÐÔ²»¼ÆËãÕ½Á¦
        if self.mfpType != ShareDefine.Def_MFPType_Role:
            return {}
        
        roleBaseAttrDict = IpyGameDataPY.GetFuncEvalCfg("CreatRoleBaseAttr", 1)
        notFightPowerEffIDNameDict = IpyGameDataPY.GetFuncEvalCfg("CreatRoleBaseAttr", 2)
        if job not in roleBaseAttrDict:
            return {}
        
        diffAttrDict = {}
        jobBaseAttrDict = roleBaseAttrDict[job]
        for attrID, paramName in notFightPowerEffIDNameDict.items():
            if attrID not in jobBaseAttrDict:
                continue
            diffAttrDict[paramName] = jobBaseAttrDict[attrID]
        return diffAttrDict
    
    def GetMFPAttrStr(self):
        attrStr = ""
        for attrIndex in xrange(1, ChConfig.Def_Calc_AllAttrType_MAX):
            attrName = self.__AttrName % attrIndex
            attrValue = getattr(self, attrName)
            if attrValue <= 0:
                continue
            
            attrStr += "%s=%s," % (attrName, attrValue)
            
        for attrIndex in self.__NolineAttrList:
            attrName = self.__AttrNameNoline % attrIndex
            attrValue = getattr(self, attrName)
            if attrValue <= 0:
                continue
            
            attrStr += "%s=%s," % (attrName, attrValue)
        return attrStr
 
###############################################################
#ÈËÎï¿ØÖÆÀà
 
## ÈËÎï¿ØÖÆÀà
#
#  ÈËÎïËÀÍöµÈÂß¼­´¦Àí
class PlayerControl:
    __Player = None
    __fpTypeObjDict = {}
    #---------------------------------------------------------------------
    ## ³õʼ»¯
    #  @param self ÀàʵÀý
    #  @param iPlayer Íæ¼ÒʵÀý
    #  @return ·µ»ØÖµÎÞÒâÒå
    #  @remarks ³õʼ»¯
    def __init__(self, iPlayer):
        self.__Player = iPlayer
    
    ## »ñȡģ¿éÕ½¶·Á¦¶ÔÏó
    #  @param self ÀàʵÀý
    #  @param fpType Õ½¶·Á¦ÀàÐÍ
    #  @return ·µ»ØÕ½¶·Á¦¶ÔÏó
    def GetModuleFightPowerObj(self, fpType):
        fpObj = self.__fpTypeObjDict.get(fpType)
        if not fpObj:
            fpObj = ModuleFightPower(fpType)
            self.__fpTypeObjDict[fpType] = fpObj
        return fpObj
    
    ## »ñȡģ¿éÕ½¶·Á¦¶ÔÏó
    #  @param self ÀàʵÀý
    #  @return ·µ»ØÕ½¶·Á¦¶ÔÏó
    def ResetFightPowerObj(self):
        for obj in self.__fpTypeObjDict.values():
            obj.ClearAttr()
    
    #---------------------------------------------------------------------
    ## Íæ¼ÒÉý¼¶¼Óµã¼Ó¼¼Äܠǰ20¼¶×Ô¶¯¼Óµã 20¼¶ºó ÒÔǰÊǼӼ¼ÄܵãÏָijÉÖ±½ÓÉý¼¶ºó¶Á±í¼Ó¼¼ÄÜ
    #  @param self ÀàʵÀý
    #  @return None
    #  @remarks Íæ¼ÒÉý¼¶ ¼Óµã 2010-05-26 adawsÐ޸ĠԭÀ´ÓмӼ¼Äܵã ÏÖ½«Éý¼¶¼Ó¼¼ÄÜÌá³ö 
    def __DoLVUPAddPoint(self):
        curPlayer = self.__Player
        if not GameFuncComm.GetFuncCanUse(curPlayer, ShareDefine.GameFuncID_AddPoint):
            # Î´¿ªÆôǰ²»¿É¼Óµã£¬ÒòΪDoAddPointOpen»áÒ»´ÎÐÔ²¹Æë£¬±ÜÃâÒâÍâÇé¿ö¶à¼ÓÁ˵ãÊý
            return
 
        curFreePoint = curPlayer.GetFreePoint()
        addPoint = GetLvUp_AddPoint(curPlayer)
        if addPoint != 0:
            setFreePoint = curFreePoint + addPoint
            #NotifyCode(curPlayer, "ObtainAttributeDot", [addPoint])
            
            DataRecordPack.DR_Freepoint(curPlayer, "LvUP", addPoint)
            curPlayer.SetFreePoint(setFreePoint)
 
        return
    #---------------------------------------------------------------------
    ## ¼ì²éÍæ¼ÒÊÇ·ñÐèÒª·â¾ô
    #  @param self ÀàʵÀý
    #  @param curPlayer Íæ¼ÒʵÀý
    #  @param curLV µ±Ç°µÈ¼¶
    #  @return ·µ»ØÖµÕæ, ÐèÒª
    #  @remarks ¼ì²éÍæ¼ÒÊÇ·ñÐèÒª·â¾ô
    def __LVUpDoInvestiture(self, curPlayer, curLV):
#===============================================================================
#        ´ËÂß¼­²»ÄÜÓàGetTotalExp, 
#        ¸Ä¶¯ÇëÉ÷ÖØ!
#===============================================================================
        #1. ¼ì²éÍæ¼ÒÊÇ·ñÔÚ·â¾ôµÈ¼¶
        if curLV < 20 or curLV % 10 != 0:
            return False
        
        curMission = curPlayer.FindMission(curLV * 100)
        if curMission != None and curMission.GetState() == ChConfig.Def_Mission_State_Over:
            #ÈÎÎñÍê³É
            return False
            
        if curMission == None:
            #2. Èç¹ûÔÚ·â¾ôµÈ¼¶, ²¢ÇÒ¼´½«Éýµ½ÏÂÒ»¼¶, ´¥·¢·â¾ôÈÎÎñ
            if EventShell.EventResponse_LVFull(curPlayer) != True:
                GameWorld.Log("´¥·¢·â¾ôÈÎÎñʧ°Ü", curPlayer.GetPlayerID())
                return False
            
        return True
    
    #---------------------------------------------------------------------
    
    ## ¼Ó¾­ÑéÖµ 
    #  @param self ÀàʵÀý
    #  @param addExp Ìí¼ÓµÄ¾­Ñé
    #  @param exp_rate ¾­Ñé±¶ÂÊ
    #  @param expViewType ¾­Ñé»ñµÃµÄÇþµÀ
    #  @param isSysHint ÊÇ·ñϵͳÌáʾ£¨Ä¬ÈÏÊÇ£©
    #  @return ²¼¶ûÖµ
    def AddExp(self, addExp, expViewType=ShareDefine.Def_ViewExpType_Mission, isSysHint=True, addSkillID=0, expRateEx=0):
        curPlayer = self.__Player
        finalAddExp, expNotifyType = self.__AddExp(curPlayer, addExp, expViewType, isSysHint, addSkillID, expRateEx)
        
        # Í¨Öª¿Í»§¶Ë¾­ÑéÀ´Ô´
        if finalAddExp:
            sendPack = ChPyNetSendPack.tagMCAddExp()
            sendPack.ExpPoint = finalAddExp / ChConfig.Def_PerPointValue
            sendPack.Exp = finalAddExp % ChConfig.Def_PerPointValue
            sendPack.Source = expNotifyType # ¿Í»§¶ËչʾÓÃ
            NetPackCommon.SendFakePack(curPlayer, sendPack)
            
        #¸±±¾»ñµÃ¾­Ñé, ÎÞÂÛ»ñµÃ¶àÉÙ¾­Ñé¾ùÐè֪ͨ, ÓÐЩ¸±±¾Âß¼­ÐèҪͨ¹ý»ñµÃ¾­Ñéʱ»ú´¦Àí
        if GameWorld.GetMap().GetMapFBType() != IPY_GameWorld.fbtNull:
            FBLogic.OnGetExp(curPlayer, finalAddExp, expViewType)
            
        return finalAddExp
    
    # ²ÎÊý addSkillID ±íʾÒòʲô¼¼ÄÜɱËÀNPC»ñµÃ¾­Ñé
    def __AddExp(self, curPlayer, addExp, expViewType, isSysHint, addSkillID=0, expRateEx=0):
        if addExp == 0:
            # ²»½øÈë¼ÆËã
            return addExp, expViewType
        
        #È¡µÃÈËÎﵱǰ¾­Ñé
        #curTotalExp = GetPlayerTotalExp(curPlayer)
        curTotalExp = curPlayer.GetExpPoint() * ChConfig.Def_PerPointValue + curPlayer.GetTotalExp()
 
        maxLV = IpyGameDataPY.GetFuncCfg("PlayerMaxLV", 1)
        maxLVExpStore = IpyGameDataPY.GetFuncCfg("MaxLVExpStore", 1)
        
        curLV = curPlayer.GetLV()            
#        # ¼ì²éתÉúµÈ¼¶
#        if curLV >= nextReinLV and curTotalExp >= maxLVExpStore:
#            self.__NotifyExpFull(curPlayer, "GeRen_liubo_260986")
#            GameWorld.DebugLog("¾­ÑéÒÑÂú£¡ÐèÏÈתÉú£¡curLV=%s,reinLV=%s" % (curLV, nextReinLV), curPlayer.GetPlayerID())
#            return 0
 
        # ¼ì²é×î´óµÈ¼¶
        if curLV >= maxLV and curTotalExp >= maxLVExpStore:
            self.__NotifyExpFull(curPlayer, "GeRen_admin_825676")
            #GameWorld.DebugLog("¾­ÑéÒÑÂú£¡ÒÑÂú¼¶£¡curLV=%s" % (curLV), curPlayer.GetPlayerID())
            return 0, expViewType
        
        # É±¹Ö
        if expViewType == ShareDefine.Def_ViewExpType_KillNPC:
            exp_rate = curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_TotalExpRate)
            superRate = PassiveBuffEffMng.GetPassiveSkillValueByTriggerType(curPlayer, None, None, ChConfig.TriggerType_AddExpRate)
            if superRate:
                # Áú·ïïí ¾­Ñé
                expViewType = ShareDefine.Def_ViewExpType_KillNPCSuper
            if addSkillID == ChConfig.Def_SkillID_LXHY_AddExpRate:
                addSkill = GameWorld.GetGameData().GetSkillBySkillID(addSkillID)
                hasEffect = SkillCommon.GetSkillEffectByEffectID(addSkill, ChConfig.Def_Skill_Effect_AddExpRate)
                if hasEffect:
                    #ÁÒÑæÕ½Éñ ¾­Ñé
                    superRate += hasEffect.GetEffectValue(0)
                    expViewType = ShareDefine.Def_ViewExpType_LYZS
            exp_rate += superRate
                
        elif expViewType in [ShareDefine.Def_ViewExpType_GameEvent, ShareDefine.Def_ViewExpType_Sit]:
            exp_rate = curPlayer.GetGameEventExpRate()
            exp_rate += GetFamilySitExpPer(curPlayer)
        else:
            exp_rate = max(GameWorld.GetGameWorld().GetExpRate(), ChConfig.Def_MaxRateValue)
                        
        exp_rate += expRateEx
        #ÊäÈëµÄ¾­ÑéÓпÉÄÜΪlongÐÍ
        addExp = int(addExp * exp_rate / float(ChConfig.Def_MaxRateValue))
        
        #·À³ÁÃÔ¼ÆËã
        addExp = PlayerGameWallow.ChangeExpByWallow(curPlayer, addExp)
        
        #===========================================================================================
        # #ÌØÊâµØÍ¼É±¹Ö¾­ÑéÍâ²ã¼Ó³É
        # if expViewType == ShareDefine.Def_ViewExpType_KillNPC:
        #    #mapID = GameWorld.GetMap().GetMapID()
        #    #if mapID in ChConfig.Def_FBMapID_BZZDAll:
        #    #    nobleVIPOuterRate = ...
        #    #    #nobleVIPAddExp += 0 if not nobleVIPOuterRate else int(addExp * nobleVIPOuterRate / float(ChConfig.Def_MaxRateValue))
        #    #    nobleVIPAddExp += nobleVIPOuterRate
        #    
        #    outerExpRate = FBLogic.OnGetOuterExpRate(curPlayer)
        #    if outerExpRate > 0:
        #        addExp = int(addExp * outerExpRate / float(ChConfig.Def_MaxRateValue))
        #===========================================================================================
        
        # ²»¿ÉÔÙÉý¼¶Ê±£¬Ôö¼ÓºóµÄ¾­Ñé²»¿É³¬¹ý×î´ó¿É´æ´¢¾­Ñé
        #if curLV >= nextReinLV or curLV >= maxLV:
        if curLV >= maxLV:
            addExp = min(addExp, max(0, maxLVExpStore - curTotalExp))
 
        if addExp <= 0:
            #ÎÞ·¨»ñµÃ¾­Ñé
            GameWorld.DebugLog("ÎÞ·¨»ñµÃ¾­Ñé")
            return 0, expViewType
        
        #addExp = min(addExp, ChConfig.Def_UpperLimit_DWord) # µ¥´Î¼Ó¾­Ñé²»³¬¹ý20ÒÚ
 
        #»º´æ»ñÈ¡µÄ¾­ÑéÖµ, ÓÃÓÚ¶Ò»»¼Ò×åÈÙÓþ
        #if curPlayer.GetFamilyID() != 0:
        #    curPlayer.SetPerExp(min(curPlayer.GetPerExp() + addExp, ChConfig.Def_UpperLimit_DWord))
 
        #ÈËÎïÍ·¶¥Ìáʾ
        #=======================================================================
        # viewExpCnt = min(2, addExp / ChConfig.Def_UpperLimit_DWord) # ×î¶àÆ®Á½´Î20ÒÚµÄ
        # viewExp = addExp % ChConfig.Def_UpperLimit_DWord
        # for _ in range(viewExpCnt):
        #    curPlayer.Notify_GetExpView(ChConfig.Def_UpperLimit_DWord, expViewType)
        # if viewExp:
        #    curPlayer.Notify_GetExpView(viewExp, expViewType)
        # 
        # if isSysHint:
        #    # É±¹Ö¸½¼Ó¼Ó³ÉÏÔʾ
        #    if expViewType == ShareDefine.Def_ViewExpType_KillNPC:
        #        nobleVIPAddExp = int(nobleVIPAddExp / 100.0)
        #        #NotifyCode(curPlayer, "GeRen_liubo_74717", [addExp, nobleVIPAddExp])
        #    elif expViewType in [ShareDefine.Def_ViewExpType_GameEvent,
        #                         ShareDefine.Def_ViewExpType_Sit]:
        #        #СÓÎϷʼþÌØÊâÌáʾ,´ò×ø»ñÈ¡¾­Ñé
        #        NotifyCode(curPlayer, "ObtainExperience", [addExp])
        #    elif expViewType == ShareDefine.Def_ViewExpType_MousePos:
        #        #Êó±êλÖÃÌáʾ»ñµÃ¾­Ñé
        #        NotifyCode(curPlayer, "GeRen_admin_887936", [addExp])
        #    else:
        #        #Õý³£ÐÅÏ¢Ìáʾ
        #        NotifyCode(curPlayer, "GeRen_lhs_0", [addExp])
        #=======================================================================
                
        #¸øÈËÎï¾­Ñé ÏÈÉè¾­ÑéºóÉý¼¶
        #SetPlayerTotalExp(curPlayer, curTotalExp + addExp)
        totalExp = curTotalExp + addExp
        curExp = totalExp % ChConfig.Def_PerPointValue
        expPoint = totalExp / ChConfig.Def_PerPointValue
        
        if curPlayer.GetExpPoint() != expPoint:
            curPlayer.SetExpPoint(expPoint)
        if curPlayer.GetTotalExp() != curExp:
            curPlayer.SetTotalExp(curExp)
        
        #GameWorld.Log("Íæ¼Ò = %s µÃµ½¾­Ñé = %s ,µ±Ç°¾­Ñé±¶ÂÊ = %s"%(curPlayer.GetName(), addExp,expRate ))
        #СÓÚתÉúµÈ¼¶²Å¿ÉÉý¼¶
        #if curLV < nextReinLV and curLV < maxLV:
        if curLV < maxLV:
            self.PlayerLvUp()
        
        #Ìí¼Ó¾­Ñé³É¹¦
        return addExp, expViewType
    
    ## ¾­ÑéÂúÌáʾ
    def __NotifyExpFull(self, curPlayer, expFullNotifyMark):
        expFullNotifyState = curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_ExpFullNotify)
        if not expFullNotifyState:
            NotifyCode(curPlayer, expFullNotifyMark)
            curPlayer.SetDict(ChConfig.Def_PlayerKey_ExpFullNotify, 1)
        return
    
    ## ÈËÎïÉý¼¶ »ØÂúѪ »ØÂúħ£¬´¥·¢Ìí¼Ó¼¼ÄÜ£¬ÈÎÎñ£¬¼ÓÊôÐԵ㣨ԭÀ´²¿·Öº¯Êý²Ù×÷·ÅÔÚ¼Ó¾­ÑéÖРÏÖÔÚÌá³öÀ´£©
    #  @param handLvUp: ÊÇ·ñÊÇÊÖ¶¯Éý¼¶
    #  @return: None
    #  @remarks: Èç¹ûÊÇ×Ô¶¯Éý¼¶²»¸ø²ÎÊý ¶øÈç¹ûÊÇÊÖ¶¯Éý¼¶ÐèÒª¸ø²ÎÊý ÊÇÊÖ¶¯Éý¼¶ True 
    #  1-20¼¶×Ô¶¯Éý¼¶Ö±½Ó¼Óµã Ö®ºó±ØÐëÊÖ¶¯Éý¼¶ ¸ø×ÔÓÉÊôÐÔµã
    def PlayerLvUp(self, handLvUp=False):
        curPlayer = self.__Player
        
        if GameObj.GetHP(curPlayer) <= 0:
            #Íæ¼ÒËÀÍö²»¿ÉÉý¼¶
            return
        
        #lvIpyData = GetPlayerLVIpyData(curPlayer.GetLV())
        lvIpyData = IpyGameDataPY.GetIpyGameData("PlayerLV", curPlayer.GetLV())
        if not lvIpyData:
            GameWorld.ErrLog("¾­Ñé±íÒì³£  lv= %s" % curPlayer.GetLV())
            return
        
        #lvUpNeedExp = GetLVUPTotalExpNeed(lvIpyData)
        lvUpNeedExp = lvIpyData.GetExpPoint() * ChConfig.Def_PerPointValue + lvIpyData.GetExp()
        
        if lvUpNeedExp <= 0:
            return
        
        #Ôö¼Ó¾­Ñé
        #curTotalExp = GetPlayerTotalExp(curPlayer)
        curTotalExp = curPlayer.GetExpPoint() * ChConfig.Def_PerPointValue + curPlayer.GetTotalExp()
        #δ´ïµ½Éý¼¶¾­Ñé
        if curTotalExp < lvUpNeedExp:
            return
        needSyncTalentPoint = False
        playerNeedDoLVUp = False
        curLV = curPlayer.GetLV()
        maxLV = IpyGameDataPY.GetFuncCfg("PlayerMaxLV", 1)
        
        curPlayer.BeginRefreshState()
        #befXP = curPlayer.GetXP()
        befLV = curPlayer.GetLV()
        befFreePoint = curPlayer.GetFreePoint()
        befBaseSTR = curPlayer.GetBaseSTR()
        befBasePNE = curPlayer.GetBasePNE()
        befBasePHY = curPlayer.GetBasePHY()
        befBaseCON = curPlayer.GetBaseCON()
        
        #Éý¼¶Ç°µÄÊÀ½çµÈ¼¶¾­Ñé
        #beforeExpRate = PlayerWorldAverageLv.GetWorldAverageLvExpRate(curPlayer)
        
        while curTotalExp >= lvUpNeedExp and curLV < maxLV:
            
            playerNeedDoLVUp = True
            
            #---ÈËÎïÉý¼¶³É¹¦---
            curLV = curLV + 1
            
            isNotifyServer = True
            if curLV < 50:
                # ¼õÉÙǰÆÚµÄ¹ã²¥£¬³ÌÐò¿ØÖÆ
                isNotifyServer = False
            
            curPlayer.SetLV(curLV, isNotifyServer)
            EventReport.WriteEvent_level_up(curPlayer)
                       
            # ¼ÇÂ¼Íæ¼ÒÉý¼¶
            DataRecordPack.DR_PlayerUpgrade(curPlayer, curPlayer.GetLV(), GetPlayerTotalExp(curPlayer), lvUpNeedExp)
            DataRecordPack.Cache_FightPowerChangeInfo(curPlayer, ChConfig.PowerDownType_LVUP, {'lv':curLV})
            self.__GiveLVMailAward(curLV)
            self.__DoLVUPAddPoint()  # Éý¼¶¼Óµã
            #self.__DoLvUpAddSkill()  # Éý¼¶¼Ó¼¼ÄÜ
            
            lvIpyData = GetPlayerLVIpyData(curPlayer.GetLV())
            # ´óʦÌ츳µã
            if lvIpyData:
                addTalentPoint = lvIpyData.GetTalentPoint()
                if addTalentPoint:
                    needSyncTalentPoint = True
                    PlayerGreatMaster.AddGreatMasterSkillPointByLV(curPlayer, addTalentPoint)
            
            EventShell.EventResponse_LVUp(curPlayer)  # Éý¼¶´¥·¢Ê¼þ
            
            PlayerTongTianLing.AddTongTianTaskValue(curPlayer, ChConfig.TTLTaskType_LVUp, 1)
            #---ÊÇ·ñ¼ÌÐøÑ­»·---
            curTotalExp = curTotalExp - lvUpNeedExp
            
            #»ñµÃÏÂÒ»¼¶µÄ¾­Ñé±í
            lvUpNeedExp = GetLVUPTotalExpNeed(lvIpyData)
            
            if lvUpNeedExp <= 0:
                break
            
        curPlayer.EndRefreshState() # ½áÊøË¢Ðºó£¬Óбä¸üµÄÊôÐÔҪ֪ͨ¿Í»§¶ËµÄÐèÖØÐÂÉèÖÃÒ»´Î
        #---------------------------------------------------
        #ÓÐÉý¼¶, ×ªÉúʱ¸ÕºÃÊÇתÉúµÈ¼¶»áĬÈÏ+1¼¶
        if playerNeedDoLVUp:
            aftLV = curPlayer.GetLV()
            aftFreePoint = curPlayer.GetFreePoint()
            aftBaseSTR = curPlayer.GetBaseSTR()
            aftBasePNE = curPlayer.GetBasePNE()
            aftBasePHY = curPlayer.GetBasePHY()
            aftBaseCON = curPlayer.GetBaseCON()
            if aftLV > befLV:
                curPlayer.SetLV(aftLV, False) # ÕâÀï²»ÔÙ֪ͨGameServer
                PlayerSuccess.UptateSuccessProgress(curPlayer, ShareDefine.SuccType_HeroLV, aftLV)
                PlayerActivity.DoAddActivityByLV(curPlayer, befLV, aftLV)
                
            if aftFreePoint > befFreePoint:
                curPlayer.SetFreePoint(aftFreePoint)
                #NotifyCode(curPlayer, "ObtainAttributeDot", [aftFreePoint - befFreePoint])
            if aftBaseSTR > befBaseSTR:
                curPlayer.SetBaseSTR(aftBaseSTR)
            if aftBasePNE > befBasePNE:
                curPlayer.SetBasePNE(aftBasePNE)
            if aftBasePHY > befBasePHY:
                curPlayer.SetBasePHY(aftBasePHY)
            if aftBaseCON > befBaseCON:
                curPlayer.SetBaseCON(aftBaseCON)
            PlayerGubao.DoGubaoAddFreePoint(curPlayer)
            #===================================================================
            # if curPlayer.GetXP() != befXP:
            #    curPlayer.SetXP(curPlayer.GetXP())
            #===================================================================
                
            #ÏíÊÜÊÀ½çµÈ¼¶
            #===================================================================
            #curExpRate = PlayerWorldAverageLv.GetWorldAverageLvExpRate(curPlayer)
            #if beforeExpRate <= 0 and curExpRate > 0:
            #    NotifyCode(curPlayer, "GeRen_liubo_127574")
            
            #===================================================================
            # Ì츳µã֪ͨ
            if needSyncTalentPoint:
                PlayerGreatMaster.Sync_GreatMasterFreeSkillPoint(curPlayer)
            # Éý¼¶ÐèÒªÖ´ÐеÄÓÎÏ·¹¦ÄÜ´¦Àí
            GameFuncComm.DoFuncOpenLogic(curPlayer)
            ChEquip.RefreshPlayerLingQiEquipAttr(curPlayer) # ÁéÆ÷ÊôÐÔ»áËæµÈ¼¶³É³¤
            if aftLV%10 == 0:
                # ¿ØÖÆÏÂˢдÎÊý
                PlayerPet.CalcPetItemAddPlayerAttr(curPlayer)   # ³èÎïÓÐËæµÈ¼¶±ä»¯µÄ¼¼ÄÜ
            
            self.RefreshPlayerAttrState(billboardFunc=PlayerBillboard.UpdatePlayerLVBillboard)
            #·ÅÔÚ¹¦ÄÜ¿ªÆôºóÃæ
            PlayerWorldAverageLv.UpdatePlayerWorldAverageLv(curPlayer)
            #½«ÑªÉèÖÃΪ×î´ó
            GameObj.SetHPFull(curPlayer)
            if curPlayer.GetMaxMP() > 0:
                curPlayer.SetMP(curPlayer.GetMaxMP())
            
            FBLogic.OnPlayerLVUp(curPlayer)
            # ¼Ç¼¿ª·þ»î¶¯³å¼¶Êý¾Ý
            #OpenServerCampaign.UpdOpenServerCampaignRecordData(curPlayer, ShareDefine.Def_Campaign_Type_LV, curPlayer.GetLV())
            #ÉñÃØÏÞ¹º
            FunctionNPCCommon.MysticalLimitShopOpen(curPlayer, befLV, aftLV)
 
        #²»ÐèÒª×öÉý¼¶ÈÎÎñ, ÉèÖÃÍæ¼Ò¾­Ñé
        SetPlayerTotalExp(curPlayer, curTotalExp) 
        return
    
    def __GiveLVMailAward(self, curLV):
        # ¸øµÈ¼¶Óʼþ½±Àø
        mailLVAwardDict = IpyGameDataPY.GetFuncEvalCfg("MailLVAward", 1, {})
        if curLV not in mailLVAwardDict:
            return
        mailTypeKey, mailItemList = mailLVAwardDict[curLV]
        curPlayer = self.__Player
        SendMailByKey(mailTypeKey, [curPlayer.GetPlayerID()], mailItemList, [curLV])
        return
    
    #---------------------------------------------------------------------
 
    def CalcRoleBaseAttr(self, curPlayer):
        # ¼ÆËãÍæ¼Ò½ÇÉ«»ù´¡ÊôÐÔÖµ
        
        curPlayerID = curPlayer.GetID()
        job = curPlayer.GetJob()
        
        lvAttrDict = IpyGameDataPY.GetFuncEvalCfg("LVUPAttr%s" % job, 1)
        
        if not lvAttrDict:
            GameWorld.ErrLog('ÎÞ´ËÖ°ÒµµÈ¼¶Ë¢ÊôÐÔÅäÖÃ!job=%s' % (job), curPlayerID)
            return
        
        allAttrList = [{} for _ in range(4)]
        
        # Ö°Òµ³õʼÊôÐÔ
        roleBaseAttrDict = IpyGameDataPY.GetFuncEvalCfg("CreatRoleBaseAttr", 1)
        if job in roleBaseAttrDict:
            for roleBaseAttrID, value in roleBaseAttrDict[job].items():
                CalcAttrDict_Type(roleBaseAttrID, value, allAttrList)
        #GameWorld.DebugLog("³õʼ¼ÓÊôÐÔ: %s" % allAttrList)
                
        # µÈ¼¶³É³¤ÊôÐÔ
        LV = curPlayer.GetLV()
        for lvAttrID, formula in lvAttrDict.items():
            calcValue = eval(FormulaControl.GetCompileFormula("LVUPAttr%s_%s" % (job, lvAttrID), formula))
            CalcAttrDict_Type(lvAttrID, calcValue, allAttrList)
            #GameWorld.DebugLog("    lvAttrID=%s,calcValue=%s" % (lvAttrID, calcValue))
        #GameWorld.DebugLog("µÈ¼¶¼ÓÊôÐÔ: %s" % allAttrList)
        
        # ÊôÐÔµãÊôÐÔ
        hadRefreshAttr = curPlayer.GetDictByKey(ChConfig.Def_Player_HadRefreshAttr) # ±¾µØÍ¼ÊÇ·ñˢйýÊôÐÔ
        pointFightPowerEx = 0
        pointValueInfo = {ShareDefine.Def_Effect_Metal:[lambda curObj:GetMetal(curObj), lambda curObj, value:SetMetalQualityLV(curObj, value), lambda curObj:GetMetalQualityLV(curObj)],
                          ShareDefine.Def_Effect_Wood:[lambda curObj:GetWood(curObj), lambda curObj, value:SetWoodQualityLV(curObj, value), lambda curObj:GetWoodQualityLV(curObj)],
                          ShareDefine.Def_Effect_Water:[lambda curObj:GetWater(curObj), lambda curObj, value:SetWaterQualityLV(curObj, value), lambda curObj:GetWaterQualityLV(curObj)],
                          ShareDefine.Def_Effect_Fire:[lambda curObj:GetFire(curObj), lambda curObj, value:SetFireQualityLV(curObj, value), lambda curObj:GetFireQualityLV(curObj)],
                          ShareDefine.Def_Effect_Earth:[lambda curObj:GetEarth(curObj), lambda curObj, value:SetEarthQualityLV(curObj, value), lambda curObj:GetEarthQualityLV(curObj)],
                          }
        hasChange_Qualitylv = False #Áé¸ùÆ·¼¶ÊÇ·ñÓбä¸ü
        lingGenQualityAttrList = [{} for _ in range(4)]
        for pointAttrID, pointFuncInfo in pointValueInfo.items():
            pointValue = pointFuncInfo[0](curPlayer)
            befPQLV = pointFuncInfo[2](curPlayer)
            pointFuncInfo[1](curPlayer, 0)
            if not pointValue:
                if 0 != befPQLV:
                    hasChange_Qualitylv = True
                continue
            ipyData = IpyGameDataPY.GetIpyGameData("RolePoint", pointAttrID)
            if not ipyData:
                continue
            # Ã¿µãÊôÐÔ
            perPointAddAttrDict = ipyData.GetAddAttrInfoPerPoint() # {"Ö°Òµ":[[ÿXµã,ÊôÐÔID,Öµ], ...], ..}
            addAttrList = perPointAddAttrDict.get(str(job), [])
            for needPoint, pointAddAttrID, pointAddAttrValue in addAttrList:
                pointAddValueTotal = pointAddAttrValue * (pointValue / needPoint)
                CalcAttrDict_Type(pointAddAttrID, pointAddValueTotal, allAttrList)
                #GameWorld.DebugLog("    ÊôÐÔµã(%s)¼ÓÊôÐÔ: pointValue=%s,pointAddAttrID=%s,pointAddValueTotal=%s" % (pointAttrID, pointValue, pointAddAttrID, pointAddValueTotal))
                
            pointFightPowerEx += (ipyData.GetFightPowerPerPoint() * pointValue)
            
            # µãÊýÆ·ÖÊÊôÐÔ
            curPQLV = 0
            pqIntervalList = ipyData.GetPointQualityIntervalList()
            for pqLV, pqValue in enumerate(pqIntervalList, 1): # Áé¸ùÆ·¼¶´Ó1¿ªÊ¼
                if pointValue >= pqValue:
                    curPQLV = pqLV
                else:
                    break
            pointFuncInfo[1](curPlayer, curPQLV)
            if curPQLV != befPQLV:
                hasChange_Qualitylv = True
            if not curPQLV:
                continue
            pqAttrInfoDict = ipyData.GetPointQualityAttrDict().get(str(curPlayer.GetJob()), {})
            for pqAttrID, pqAttrValueList in pqAttrInfoDict.items():
                pqAttrValue = 0 if curPQLV > len(pqAttrValueList) else pqAttrValueList[curPQLV - 1]
                CalcAttrDict_Type(int(pqAttrID), pqAttrValue, lingGenQualityAttrList)
            #GameWorld.DebugLog("        ÊôÐÔµã(%s)Æ·½×µÈ¼¶ÊôÐÔ: befPQLV=%s,curPQLV=%s,pqAttrInfoDict=%s" % (pointAttrID, befPQLV, curPQLV, pqAttrInfoDict))
            if hadRefreshAttr and befPQLV < curPQLV:
                for pqlv in xrange(befPQLV+1, curPQLV+1):
                    EventShell.EventRespons_LingGenQualityUP(curPlayer, pointAttrID, pqlv)
                
        #GameWorld.DebugLog("µÈ¼¶ÊôÐÔµã¼ÓÊôÐÔ: %s" % allAttrList)
        #GameWorld.DebugLog("Áé¸ùÆ·½×µÈ¼¶ÊôÐÔ: %s" % lingGenQualityAttrList)
        #GameWorld.DebugLog("Áé¸ùµãÊý¸½¼ÓÕ½Á¦: %s" % pointFightPowerEx)
        curPlayer.SetDict(ChConfig.Def_PlayerKey_MFPEx % ShareDefine.Def_MFPType_Role, pointFightPowerEx) 
        SetCalcAttrListValue(curPlayer, ChConfig.Def_CalcAttrFunc_RoleBase, allAttrList)
        SetCalcAttrListValue(curPlayer, ChConfig.Def_CalcAttrFunc_LingGenQuailty, lingGenQualityAttrList)
        return hasChange_Qualitylv
    
    #---------------------------------------------------------------------
    def NotifyAllState(self, playerStateDict):
        curPlayer = self.__Player
        notifySelfList = []
        notifyAllList = []
        notifyAllAttrState = curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_NotifyAllAttrState)
        
        #ÔÚ´Ë´¦°ÑËùÓÐÊôÐԵIJ»Í¬Í¨Öª¸ø¿Í»§¶Ë
        for index, value in playerStateDict.items():
            
            curPlayerState, attrType, notifySelf, notifyAll = EffGetSet.GetValueByEffIndexEx(curPlayer, index)
            
            if not attrType:
                continue
            
            if notifyAllAttrState and curPlayerState == value:
                #GameWorld.Log("µÚ%d¸ö£¬Ô­Öµ%dµÈÓÚÏÖÖµ%d£¬²»·¢¸ø¿Í»§¶Ë"%( index, value, curPlayerState ) )
                continue
            notifyStruct = ChPyNetSendPack.tagRefreshType()
            notifyStruct.RefreshType = attrType
            if attrType in [IPY_PlayerDefine.CDBPlayerRefresh_HP, IPY_PlayerDefine.CDBPlayerRefresh_MaxHP]:
                notifyStruct.Value = curPlayerState % ShareDefine.Def_PerPointValue
                notifyStruct.ValueEx = curPlayerState / ShareDefine.Def_PerPointValue
            else:
                notifyStruct.Value = curPlayerState               
            if notifySelf:
                notifySelfList.append(notifyStruct)
            if notifyAll:
                notifyAllList.append(notifyStruct)
        
        #ÊôÐÔ×éºÏ°ü
        #֪ͨ×Ô¼º
        if notifySelfList:
            sendPack = ChPyNetSendPack.tagObjInfoListRefresh()
            sendPack.Clear()
            sendPack.ObjID = curPlayer.GetID()
            sendPack.ObjType = curPlayer.GetGameObjType()
            sendPack.Count = len(notifySelfList)
            sendPack.RefreshType = notifySelfList
            NetPackCommon.SendFakePack(curPlayer, sendPack)
            
        if len(notifyAllList) != 0:
            #¹ã²¥ÖÜÎ§Íæ¼Ò
            sendPack = ChPyNetSendPack.tagObjInfoListRefresh()
            sendPack.Clear()
            sendPack.ObjID = curPlayer.GetID()
            sendPack.ObjType = curPlayer.GetGameObjType()
            sendPack.Count = len(notifyAllList)
            sendPack.RefreshType = notifyAllList
            PyNotifyAll(curPlayer, sendPack, False, -1)
            
        if not notifyAllAttrState:
            curPlayer.SetDict(ChConfig.Def_PlayerKey_NotifyAllAttrState, 1)
        return
    
    ## Ë¢ÐÂÍæ¼ÒËùÓÐ״̬
    #  @param self ÀàʵÀý
    #  @param isForce ÊÇ·ñÇ¿ÖÆË¢ÐÂ
    #  @return ·µ»ØÖµÎÞÒâÒå
    #  @remarks Ë¢ÐÂÍæ¼ÒËùÓÐ״̬
    def RefreshAllState(self, isSyncBuff=False, billboardFunc=None, isForce=False):
        curPlayer = self.__Player
        playerID = curPlayer.GetPlayerID()
        GameWorld.DebugLog("Start RefreshAllState!!!", playerID)
        
        self.RefreshPlayerActionState()
        self.RefreshPlayerAttrState(billboardFunc, isForce)
        return
    
    
    ## ÖؼÆË㲢ˢÐÂÍæ¼ÒËùÓÐ״̬, Ä¿Ç°Ö»ÓÃÓëÇл»µØÍ¼
    #  @param self ÀàʵÀý
    #  @return ·µ»ØÖµÎÞÒâÒå
    #  @remarks Ë¢ÐÂÍæ¼ÒËùÓÐ״̬
    def ReCalcAllState(self):
        curPlayer = self.__Player
        playerID = curPlayer.GetPlayerID()
        GameWorld.DebugLog("Start ReCalcAllState!!!", playerID)
        
        for funcIndex in ChConfig.CalcAttrFuncList:
            ClearCalcAttrListValue(curPlayer, funcIndex)
            
        #ÏÈѹÈëBUFFµÄЧ¹ûÖµ¼°¼¼ÄÜÕ½¶·Á¦
        self.RefreshAllSkill()
        ChEquip.RefreshPlayerEquipAttribute(curPlayer)
        ChEquip.RefreshPlayerLingQiEquipAttr(curPlayer)
        #SkillShell.RefreshPlayerBuffOnAttrAddEffect(curPlayer)
        PlayerHorse.CalcHorseAttrEx(curPlayer)
        PlayerPrestigeSys.CalcOfficialRankAttr(curPlayer)
        PlayerGodWeapon.CalcGodWeaponAttr(curPlayer)
        PlayerDienstgrad.CalcAllDienstgradAttr(curPlayer)
        PlayerPet.CalcPetItemAddPlayerAttr(curPlayer)
        PlayerRune.RefreshRuneAttr(curPlayer)
        PlayerMagicWeapon.CalcMagicWeaponAttr(curPlayer)
        PlayerSuccess.CalcSuccessAttr(curPlayer)
        PlayerVip.CalcVIPAttr(curPlayer)
        PlayerRefineStove.CalcStoveAttr(curPlayer)
        PlayerFamilyTech.CalcFamilyTechAttr(curPlayer)
        PlayerEquipDecompose.RefreshEDAttr(curPlayer)
        PlayerDogz.RefreshDogzAttr(curPlayer)
        PlayerGatherSoul.RefreshGatherSoulAttr(curPlayer)
        PlayerGatherTheSoul.CalcSoulAttr(curPlayer)
        PlayerCoat.CalcClothesCoatSkinAttr(curPlayer)
        PlayerFaQi.CalcFaQiAttr(curPlayer)
        PlayerLove.CalcLoveAttr(curPlayer)
        PlayerCharm.CalcCharmAttr(curPlayer)
        PlayerLianTi.CalcLianTiAttr(curPlayer)
        PlayerShentong.CalcShentongAttr(curPlayer)
        PlayerFamilyZhenfa.CalcZhenfaAttr(curPlayer)
        PlayerFace.CalcFaceAttr(curPlayer)
        PlayerFace.CalcFacePicAttr(curPlayer)
        self.RefreshAllState(isForce=True)
        GameWorld.DebugLog("End ReCalcAllState!!!", playerID)
        return
    
    
    # BUFF²ãµ¥¶ÀË¢ÐÂÊôÐÔ£¬¹¦ÄÜÊôÐÔÈ¡»º´æ---------------------------------------------
    def RefreshPlayerAttrByBuff(self, isForce=False):
        curPlayer = self.__Player
        curPlayer.SetDict(ChConfig.Def_Player_RefreshAttrByBuff, 1)
        
        if isForce:
            self.RefreshPlayerAttrByBuffEx()
        return True
    
    # BUFF²ãµ¥¶ÀË¢ÐÂÊôÐÔ
    def RefreshPlayerAttrByBuffEx(self):
        
        curPlayer = self.__Player
        if curPlayer.GetDictByKey(ChConfig.Def_Player_RefreshAttrByBuff) != 1:
            return
        
        playerID = curPlayer.GetPlayerID()
        GameWorld.DebugLog("Start RefreshPlayerAttrByBuffEx!!!", playerID)
        beforeMaxHP = GameObj.GetMaxHP(curPlayer)
        beforeMoveSpeedValue = GetSpeedValue(curPlayer)
        #¹¹½¨Íæ¼ÒË¢ÐÂ֪ͨ¿Í»§¶Ë×Öµä, »º´æ[Ë÷Òý, ÊýÖµ]
        playerStateDict = {}
        for index in xrange(1, ChConfig.Def_Calc_AllAttrType_MAX):
            playerStateDict.update({index:EffGetSet.GetValueByEffIndex(curPlayer, index)})
        #GameWorld.DebugLog("Ë¢ÊôÐÔǰ=%s" % playerStateDict, playerID)
        #self.PrintAttr(curPlayer, "ˢ֮ǰ")
        #---------------------------¿ªÊ¼¼ÆËã-------------------------------------
        curPlayer.BeginRefreshState()
        # »Ö¸´¹¦ÄÜÊýÖµ  ²»Äܵ÷Óú¯Êýself.InitPlayerState()
        EffGetSet.RestorePlayerFuncAttr(curPlayer)
        
        # 6.¼ÆËãbuffÊôÐÔ, buff²ã¼¶µÄ²»ËãÈçÕ½¶·Á¦
        self.__RefreshBuffAttr()
        
        # 7.Ë¢ÍêÊôÐÔºóÐèÒª´¦ÀíµÄÂß¼­
        self.__DoRefreshAttrAfterLogic(beforeMaxHP, beforeMoveSpeedValue, playerStateDict)
        
        curPlayer.SetDict(ChConfig.Def_Player_RefreshAttrByBuff, 0)
        GameWorld.DebugLog("End RefreshPlayerAttrByBuffEx!!!", playerID)
        return
    
    
    #===========================================================================
    # #×°±¸ºÍBUFF Ð§¹ûµÄ¼ÆËãÒÆµ½Íâ²ã
    # #RefreshPlayerBuffOnAttrAddEffect
    # #RefreshPlayerEquipAttribute(curPlayer)
    #===========================================================================
    ## Ë¢ÐÂÍæ¼ÒÊôÐÔµ÷Óô˺¯Êý£¬Á¢¼´Ë¢Ð¸ÄΪ֪ͨˢУ¬ÓÉProcessStatueͳһˢÐÂÒ»´Î
    ## ÅÅÐаñÀàµÄË¢ÐÂisForceÐèҪΪTrue
    #  @param self ÀàʵÀý
    #  @return ·µ»ØÖµÎÞÒâÒå
    def RefreshPlayerAttrState(self, billboardFunc=None, isForce=False):
        curPlayer = self.__Player
        curPlayer.SetDict(ChConfig.Def_Player_RefreshAttr, 1)
            
        if billboardFunc and billboardFunc not in PyGameData.g_refreshAttrBillboardFunc:
            PyGameData.g_refreshAttrBillboardFunc.append(billboardFunc)
            
        if isForce:
            self.RefreshPlayerAttrStateEx()
            
        return
    
    def PrintAttr(self, curPlayer, mark):
        attrInfo = ""
        for index in xrange(1, ChConfig.Def_Calc_AllAttrType_MAX):
            value = EffGetSet.GetValueByEffIndex(curPlayer, index)
            if value:
                attrInfo = "%s,%s=%s" % (attrInfo, index, value)
        GameWorld.DebugLog("%s AttrInfo=%s" % (mark, attrInfo))
        return
    
    def RefreshPlayerAttrStateEx(self):
        ''' ±¾ÏîĿˢÊôÐÔ¹æÔò
                    ÊôÐÔ£º
            1.¹Ì¶¨ÊôÐÔ£ºÈç¹¥»÷+100
            2.°Ù·Ö±ÈÊôÐÔ£º Èç¹¥»÷+5%£¬°Ù·Ö±È¼Ó³É»ùÖµ½öΪ¹Ì¶¨ÊôÐÔ£¬°Ù·Ö±È¼Ó³ÉÊôÐÔÖµ²»±»³ýbuff°Ù·Ö±ÈÍâµÄÈκΰٷֱÈÊôÐÔ¶þ´Î¼Ó³É
            
                    ²ã¼¶£º
            1.ÊôÐԲ㼶£ºËùÓй¦ÄÜͬһ²ã¼¶
            2.buff²ã¼¶£º°Ù·Ö±È¿É¶Ô¹¦ÄܰٷֱȼӳɵÄÊôÐÔ½øÐжþ´Î¼Ó³É
            
                    ¹¦ÄÜÄ£¿é£º¶¨ÒåÒ»¸ö¹¦ÄÜ£¬±ÈÈçÁé¸ùÄ£¿é£¬Ò»¸öÄ£¿é¿ÉÄܰüº¬¶à¸ö¹¦Äܵã
                    ¹¦Äܵ㣺ij¸öÄ£¿éϵĸ÷¸öÊôÐÔ¹¦Äܵ㣬ÈçÁé¸ùÄ£¿é¿ÉÄܰüº¬ Áé¸ù»ù´¡¡¢Áé¸ùÆ·ÖÊ Á½¸ö¹¦ÄܵãÊôÐÔ
        
                    °Ù·Ö±È¼Ó³ÉÖµ£º°Ù·Ö±È¼Ó³ÉÊôÐÔÖµ²»±»³ýbuff°Ù·Ö±ÈÍâµÄÈκΰٷֱÈÊôÐÔ2´Î¼Ó³É
            1.¹¦ÄÜÄÚ²¿ÊôÐ԰ٷֱȼӳɣº¹¦ÄܰٷֱÈÊôÐÔ¶Ô×Ô¼º¹¦Ä̶ܹ¨Öµ¼Ó³É
            2.¹¦Äܽ»²æÊôÐ԰ٷֱȼӳɣº¹¦ÄܰٷֱÈÊôÐÔ¶ÔÆäËû¹¦Ä̶ܹ¨Öµ¼Ó³É
            3.¹¦Ä̶ܹ¨ÊôÐ԰ٷֱȼӳɣº¹¦ÄܰٷֱÈÊôÐÔ¶ÔËùÓй¦Ä̶ܹ¨Öµ¼Ó³É
            4.buff²ã¼¶°Ù·Ö±È£º¶ÔËùÓÐÊôÐÔ½øÐжþ´Î¼Ó³É
            
                    ¼¼ÄÜÊôÐÔ£º¹Ì¶¨Öµ²»ÏíÊ̶ܹ¨°Ù·Ö±È¼Ó³É
                    
        buff²ã¼¶£º
            1.²»ËãÕ½Á¦
            2.ÏÈËã°Ù·Ö±È¼Ó³ÉÔټӹ̶¨Öµ
            
                    ÊôÐÔËã·¨£º
                       Ä£¿é¹Ì¶¨ÊôÐÔ    = ¹¦ÄܵãA¹Ì¶¨Öµ + ¹¦ÄܵãB¹Ì¶¨Öµ + ...
                        ¹Ì¶¨×ÜÊôÐÔ        = Ä£¿éA¹Ì¶¨Öµ + Ä£¿éB¹Ì¶¨Öµ + ...
                        ÎÞbuff×ÜÊôÐÔ  = ¹Ì¶¨×ÜÊôÐÔ + ÄÚ²¿°Ù·Ö±È¼Ó³ÉÖµ + ½»²æ°Ù·Ö±È¼Ó³É  + ¹Ì¶¨×ÜÊôÐ԰ٷֱȼӳɠ  + ¼¼ÄܰٷֱȶԹ̶¨ÊôÐԼӳɠ + ¼¼Ä̶ܹ¨Öµ
                        º¬buff×ÜÊôÐÔ  = ÎÞbuff×ÜÊôÐÔ * buff°Ù·Ö±È¼Ó³É  +  buff¹Ì¶¨Öµ
        '''
        curPlayer = self.__Player
        
        if curPlayer.GetDictByKey(ChConfig.Def_Player_RefreshAttr) != 1:
            return False
        
        PlayerGubao.CalcGubaoAttr(curPlayer) # ¹Å±¦¶¨Î»Îª¶Ô¹áͨËùÓÐÓÎÏ·¹¦ÄÜϵͳµÄÊôÐÔÍæ·¨£¬ËùÒÔÿ´Î¶¼ÖØÐÂË¢ÐÂ
        
        playerID = curPlayer.GetPlayerID()
        GameWorld.DebugLog("Start RefreshPlayerAttrStateEx!!!", playerID)
        
        #beforeAtkInterval = curPlayer.GetAtkInterval()
        beforeMaxHP = GameObj.GetMaxHP(curPlayer)
        beforeMoveSpeedValue = GetSpeedValue(curPlayer)
        beforeMaxProDef = GetMaxProDef(curPlayer)
        #[½ðľˮ»ðÍÁ]
        beforePointList = [GetMetal(curPlayer), GetWood(curPlayer), GetWater(curPlayer), GetFire(curPlayer), GetEarth(curPlayer)]
        #¹¹½¨Íæ¼ÒË¢ÐÂ֪ͨ¿Í»§¶Ë×Öµä, »º´æ[Ë÷Òý, ÊýÖµ]
        playerStateDict = {}
        for index in xrange(1, ChConfig.Def_Calc_AllAttrType_MAX):
            playerStateDict.update({index:EffGetSet.GetValueByEffIndex(curPlayer, index)})
        #GameWorld.DebugLog("Ë¢ÊôÐÔǰ=%s" % playerStateDict, playerID)
        #self.PrintAttr(curPlayer, "ˢ֮ǰ")
        #---------------------------¿ªÊ¼¼ÆËã-------------------------------------
        curPlayer.BeginRefreshState()
        self.ResetFightPowerObj()
        #self.PrintAttr(curPlayer, "ÖØÖúó")
        notAttrList = [{} for _ in range(4)]
        
        # 1.³õʼ»¯ÈËÎï¸÷Ïî״̬¼°ÊôÐÔ
        self.InitPlayerState()
        #self.PrintAttr(curPlayer, "³õʼ»¯")
        
        # ¹¦ÄÜÊôÐԲ㼶һ...
        # 2.¼ÆËã»ù´¡ÊôÐÔ
        #    2.1 »ñÈ¡ËùÓй¦ÄܼÆËãµã¼ÆËãµÄÊôÐÔÖµ, Í³¼Æ»ù´¡ÊôÐÔÀÛ¼Ó
        baseAttrDict = {}
        baseAttrNolineDict = {}
        funcAttrLen = len(ChConfig.CalcAttrFuncList)
        funcAttrInfoList = [[{} for _ in range(4)]] * funcAttrLen
        funcInsidePerAttrList = [{}] * funcAttrLen # ¹¦ÄÜÄÚ²¿°Ù·Ö±È¸½¼ÓÊôÐÔ
        for funcIndex in ChConfig.CalcAttrFuncList:
            # »ù´¡ÊôÐԵȹ¦ÄÜ»ã×ÜÍêºóͳһˢУ¬ÒòΪ¸÷¹¦ÄÜ¿ÉÄÜ»á¼ÓÊôÐÔµãÊý
            if funcIndex in [ChConfig.Def_CalcAttrFunc_RoleBase, ChConfig.Def_CalcAttrFunc_LingGenQuailty]:
                continue
            attrInfo, insidePerAttrDict = GetCalcAttrListValue(curPlayer, funcIndex)[:2]
            if attrInfo == notAttrList and not insidePerAttrDict:
                continue
            GameWorld.DebugLog("¹¦ÄܵãÊôÐÔ: %s(%s), %s, ÄÚ²ã°Ù·Ö±È¸½¼Ó: %s" % (funcIndex, ChConfig.FuncIndexName.get(funcIndex, ""), attrInfo, insidePerAttrDict), playerID)
            funcAttrInfoList[funcIndex] = attrInfo
            funcInsidePerAttrList[funcIndex] = insidePerAttrDict
            # ²»Í¬¹¦Äܵã¼äµÄÊýÖµÀÛ¼Ó£¬ÐèʹÓÃÖ§³ÖË¥¼õµÝÔöµÄ¼ÆË㷽ʽ
            AddAttrDictValue(baseAttrDict, attrInfo[ChConfig.CalcAttr_Base])
            AddAttrDictValue(baseAttrNolineDict, attrInfo[ChConfig.CalcAttr_BaseNoline])
            
        #    2.2 ½«»ù´¡ÊôÐÔÀÛ¼Óµ½Íæ¼ÒÉíÉÏ
        if baseAttrDict or baseAttrNolineDict:
            # ÒòΪ»ù´¡ÊôÐÔ»áÓ°ÏìÕ½¶·ÊôÐÔ¼ÆË㣬ËùÒÔÏÈͳ¼ÆÔö¼Ó»ù´¡ÊôÐÔ
            GameWorld.DebugLog("¹¦Äܸ½¼Óµã: baseAttrDict=%s,baseAttrNolineDict=%s" % (baseAttrDict, baseAttrNolineDict), playerID)
            CalcLineEffect.ChangePlayerAttrInLineEffectList(curPlayer, baseAttrDict)
            CalcNoLineEffect.ChangePlayerAttrInNoLineEffectList(curPlayer, baseAttrNolineDict)
            
        # ¹¦ÄÜÓмӻù´¡ÊôÐÔÖµ£¬ÕâÀïÔÙÖØÐÂË¢ÐÂһϻù´¡ÊôÐÔ, »ù´¡ÊôÐÔ»áÓ°ÏìÕ½¶·ÊôÐÔ, Ã¿´Î¶¼Ë¢Ð½ÇÉ«»ù´¡ÊôÐÔ
        hasChange_Qualitylv = self.CalcRoleBaseAttr(curPlayer)
        roleBaseAttrInfo, roleInsidePerAttrDict = GetCalcAttrListValue(curPlayer, ChConfig.Def_CalcAttrFunc_RoleBase)[:2]
        lingGenQualityAttrList, lingGenQualityInsidePerAttrDict = GetCalcAttrListValue(curPlayer, ChConfig.Def_CalcAttrFunc_LingGenQuailty)[:2]
        funcAttrInfoList[ChConfig.Def_CalcAttrFunc_RoleBase] = roleBaseAttrInfo
        funcInsidePerAttrList[ChConfig.Def_CalcAttrFunc_RoleBase] = roleInsidePerAttrDict
        funcAttrInfoList[ChConfig.Def_CalcAttrFunc_LingGenQuailty] =  lingGenQualityAttrList
        funcInsidePerAttrList[ChConfig.Def_CalcAttrFunc_LingGenQuailty] =  lingGenQualityInsidePerAttrDict
        GameWorld.DebugLog("¹¦ÄܵãÊôÐÔ: %s(%s), %s, ÄÚ²ã°Ù·Ö±È¸½¼Ó: %s" 
                           % (ChConfig.Def_CalcAttrFunc_RoleBase, ChConfig.FuncIndexName.get(ChConfig.Def_CalcAttrFunc_RoleBase, ""), roleBaseAttrInfo, roleInsidePerAttrDict), playerID)
        GameWorld.DebugLog("¹¦ÄܵãÊôÐÔ: %s(%s), %s, ÄÚ²ã°Ù·Ö±È¸½¼Ó: %s" 
                           % (ChConfig.Def_CalcAttrFunc_LingGenQuailty, ChConfig.FuncIndexName.get(ChConfig.Def_CalcAttrFunc_LingGenQuailty, ""), lingGenQualityAttrList, lingGenQualityInsidePerAttrDict), playerID)
        
        #self.PrintAttr(curPlayer, "»ù´¡ºó", playerID)
        
        # 3.¼ÆËãÕ½¶·ÊôÐÔ
        #    3.1 Õ½¶·ÊôÐԲ㼶½»²æÓ°Ïì»ùÖµÊýÖµ»ã×Ü
        #        »ù´¡²ã¼¶(½ÇÉ«»ù´¡ÊôÐÔ)
        baseAttrList = AddAttrListValue([funcAttrInfoList[ChConfig.Def_CalcAttrFunc_RoleBase],
                                         funcAttrInfoList[ChConfig.Def_CalcAttrFunc_LingGen],
                                         funcAttrInfoList[ChConfig.Def_CalcAttrFunc_LingGenQuailty],
                                         ])
        #GameWorld.DebugLog("»ù´¡²ã¼¶: %s" % baseAttrList, playerID)
        
        #        ¹¦Äܵ㽻²æÓ°Ïì·ÇÏßÐÔ²ã¶ÔÓ¦ÊôÐÔ»ùÖµÁбí
        funcAttrPerInfo = {ChConfig.TYPE_Calc_BaseAtkAddPer:baseAttrList,
                           ChConfig.TYPE_Calc_BaseMaxHPAddPer:baseAttrList,
                           ChConfig.TYPE_Calc_BaseDefAddPer:baseAttrList,
                           ChConfig.TYPE_Calc_BaseHitAddPer:baseAttrList,
                           ChConfig.TYPE_Calc_BaseMissAddPer:baseAttrList,
                           ChConfig.TYPE_Calc_FaQiMaxHPPer:funcAttrInfoList[ChConfig.Def_CalcAttrFunc_FaQi],
                           ChConfig.TYPE_Calc_FaQiAtkPer:funcAttrInfoList[ChConfig.Def_CalcAttrFunc_FaQi],
                           ChConfig.TYPE_Calc_FaQiDefPer:funcAttrInfoList[ChConfig.Def_CalcAttrFunc_FaQi],
                           ChConfig.TYPE_Calc_GodWeaponMaxHPPer:funcAttrInfoList[ChConfig.Def_CalcAttrFunc_GodWeapon],
                           ChConfig.TYPE_Calc_GodWeaponAtkPer:funcAttrInfoList[ChConfig.Def_CalcAttrFunc_GodWeapon],
                           ChConfig.TYPE_Calc_StoneMaxHPPer:funcAttrInfoList[ChConfig.Def_CalcAttrFunc_Stone],
                           ChConfig.TYPE_Calc_StoneAtkPer:funcAttrInfoList[ChConfig.Def_CalcAttrFunc_Stone],
                           ChConfig.TYPE_Calc_StoneBasePer:funcAttrInfoList[ChConfig.Def_CalcAttrFunc_Stone],
                           ChConfig.TYPE_Calc_RealmBasePer:funcAttrInfoList[ChConfig.Def_CalcAttrFunc_Prestige],
                           ChConfig.TYPE_Calc_HorseAtkPer:funcAttrInfoList[ChConfig.Def_CalcAttrFunc_Horse],
                           ChConfig.TYPE_Calc_HorseMaxHPPer:funcAttrInfoList[ChConfig.Def_CalcAttrFunc_Horse],
                           ChConfig.TYPE_Calc_HorseTrainAttrPer:funcAttrInfoList[ChConfig.Def_CalcAttrFunc_HorseTarin],
                           ChConfig.TYPE_Calc_PetTrainAttrPer:funcAttrInfoList[ChConfig.Def_CalcAttrFunc_PetTarin],
                           ChConfig.TYPE_Calc_GuardTrainAttrPer:funcAttrInfoList[ChConfig.Def_CalcAttrFunc_GuardTarin],
                           ChConfig.TYPE_Calc_WingTrainAttrPer:funcAttrInfoList[ChConfig.Def_CalcAttrFunc_WingTarin],
                           ChConfig.TYPE_Calc_PeerlessWeaponTrainAttrPer:funcAttrInfoList[ChConfig.Def_CalcAttrFunc_PeerlessWeaponTrain],
                           ChConfig.TYPE_Calc_PeerlessWeapon2TrainAttrPer:funcAttrInfoList[ChConfig.Def_CalcAttrFunc_PeerlessWeapon2Train],
                           ChConfig.TYPE_Calc_LianTiAttrPer:funcAttrInfoList[ChConfig.Def_CalcAttrFunc_LianTi],
                           }
        #    3.2 Í³¼Æ¸÷¹¦ÄÜÖ®¼ä·ÇÏßÐÔÊôÐÔ½»²æÓ°ÏìÀÛ¼Ó
        funcCrossAttrPerInfoDict = {} # °Ù·Ö±È½»²æÓ°ÏìËùÌáÉýµÄÊôÐÔÖµ {¹¦ÄÜÊôÐÔ±àºÅ:{ÌáÉýµÄÊôÐÔÀàÐÍ:ÊýÖµ, ...}, ...}
        for i, funcAttrList in enumerate(funcAttrInfoList):
            battleNoLineAttrDict = funcAttrList[ChConfig.CalcAttr_BattleNoline] # ÔÝдËÀֻȡս¶··ÇÏßÐÔµÄ
            if not battleNoLineAttrDict:
                continue
            addAttrDict = {}
            #GameWorld.DebugLog("½»²æ¹¦Äܵã: i=%s,%s" % (i,battleNoLineAttrDict), playerID)
            for noLineAttrType, addAttrPer in battleNoLineAttrDict.items():
                if noLineAttrType not in funcAttrPerInfo or noLineAttrType not in ChConfig.FuncNoLinearAttrDict:
                    continue
                # Ê¹ÓõĻùֵĿ±ê¹¦ÄÜË÷Òý
                attrRate = addAttrPer / float(ChConfig.Def_MaxRateValue)
                addAttrTypeList = ChConfig.FuncNoLinearAttrDict[noLineAttrType]
                useAttrDict = funcAttrPerInfo[noLineAttrType][ChConfig.CalcAttr_Battle] # Ä¬ÈÏÔö¼ÓµÄÊÇÕ½¶·ÏßÐÔ
                for attrType in addAttrTypeList:
                    # Ä¬ÈÏÌáÉýµÄÊôÐÔÔÚÏßÐÔÕ½¶·ÊôÐÔÀï
                    if attrType not in useAttrDict:
                        continue
                    baseValue = useAttrDict[attrType] # Ö»ÊÇÓõ½Ä¿±ê¹¦ÄܵĻùÖµ
                    addValue = int(baseValue * attrRate)
                    addAttrDict[attrType] = addAttrDict.get(attrType, 0) + addValue
                    #GameWorld.DebugLog("    attrID=%s,per=%s,rate=%s,baseValue=%s,attrType=%s,addValue=%s" % (noLineAttrType, addAttrPer, attrRate, baseValue, attrType, addValue), playerID)
                    
            if addAttrDict:
                # Ôö¼ÓµÄÊýֵͳ¼Æµ½°Ù·Ö±ÈÊôÐÔËùÊô¹¦Äܵã
                # Èç·ûÎÄÓиöÎäÆ÷¹¥»÷°Ù·Ö±ÈÔö¼ÓÊôÐÔ£¬Ôö¼ÓµÄÊýÖµÊôÓÚ·ûÎŦÄÜ£¬²»ÊôÓÚÎäÆ÷¹¦ÄܵãµÄ£¬Ö»ÊÇ»ùֵʹÓÃÁËÎäÆ÷¹¥»÷     
                funcCrossAttrPerInfoDict[i] = addAttrDict # Ïȶ¼Í³¼ÆÍêºóÔÙÀÛ¼Óµ½¶ÔÓ¦¹¦ÄÜÊôÐÔÀ²»È»¿ÉÄܻᵼÖ¹¦ÄÜ»ùÖµ±ä¸ü
                
        GameWorld.DebugLog("½»²æÓ°ÏìÊôÐÔ: %s" % funcCrossAttrPerInfoDict, playerID)
        
        #    3.3 Í³¼ÆËùÓй¦Ä̶ܹ¨ÊôÐÔÓ°ÏìÀÛ¼Ó
        allFixAttrDict = {} # ¹Ì¶¨ÊôÐԲ㼶×ÜÊôÐÔ»ùÖµ
        for funcIndex, funcAttrList in enumerate(funcAttrInfoList):
            # ¼¼ÄÜÄ£¿é²»¼ÆÈ빦Ä̶ܹ¨ÊôÐÔ¡¢²»¼ÆÕ½Á¦
            if funcIndex in ChConfig.CalcAttrFuncSkillList:
                continue
            AddAttrDictValue(allFixAttrDict, funcAttrList[ChConfig.CalcAttr_Battle])
            
        fixAttrPerAddExDict = {} # ¹Ì¶¨×ÜÊôÐÔ°Ù·Ö±ÈÓ°ÏìËùÌáÉýµÄÊôÐÔÖµ {¹¦ÄÜÊôÐÔ±àºÅ:{ÌáÉýµÄÊôÐÔÀàÐÍ:ÊýÖµ, ...}, ...}
        for funcIndex, funcAttrList in enumerate(funcAttrInfoList):
            fixAddPerDict = funcAttrList[ChConfig.CalcAttr_BattleNoline]
            if not fixAddPerDict:
                continue
            addValueExDict = {}
            for fixAttrType, addPer in fixAddPerDict.items():
                if fixAttrType not in allFixAttrDict:
                    continue
                curFixValue = allFixAttrDict[fixAttrType]
                addValueEx = int(curFixValue * addPer / 10000.0)
                addValueExDict[fixAttrType] = addValueEx
            fixAttrPerAddExDict[funcIndex] = addValueExDict
            
        GameWorld.DebugLog("¹Ì¶¨ÊôÐÔ×ܺÍ: %s" % allFixAttrDict, playerID)
        GameWorld.DebugLog("¹Ì¶¨°Ù·Ö±È¸½¼ÓÊôÐÔ: %s" % fixAttrPerAddExDict, playerID)
        
        # 4. ¼ÆËãÊôÐÔ¼°Õ½Á¦, ÐèÔÚ¼ÆËãbuff²ã֮ǰ¼ÆËã
        curLV = curPlayer.GetLV()
        fpParam = IpyGameDataPY.GetIpyGameData("FightPowerParam", curLV)
        mfpDict = {} # Ä£¿éÕ½¶·Á¦
        mfpObjDict = {}
        for mfpType, attrFuncIndexList in ChConfig.MFPTypeAttrFuncIndexDict.items():
            mfpAttrList = [{} for _ in range(4)]
            mfpAttrExDict = {}
            for funcIndex in attrFuncIndexList:
                if funcIndex in ChConfig.CalcAttrFuncSkillList:
                    # ¼¼ÄÜÄ£¿é²»¼ÆÈ빦Ä̶ܹ¨ÊôÐÔ¡¢²»¼ÆÕ½Á¦
                    continue
                funcAttrList = funcAttrInfoList[funcIndex]
                funcInsidePerAttrDict = funcInsidePerAttrList[funcIndex] # ¹¦ÄܵãÄÚ²¿°Ù·Ö±È¼Ó³ÉÊôÐÔ
                funcCrossPerAttrDict = funcCrossAttrPerInfoDict.get(funcIndex, {}) # ¹¦Äܵ㽻²æ°Ù·Ö±È¼Ó³ÉÊôÐÔ
                fixPerAttrDict = fixAttrPerAddExDict.get(funcIndex, {}) # ¹¦ÄÜ×̶ܹ¨ÊôÐ԰ٷֱȼӳÉÊôÐÔ
                
                CalcLineEffect.ChangePlayerAttrInLineEffectList(curPlayer, funcAttrList[ChConfig.CalcAttr_Battle])
                CalcLineEffect.ChangePlayerAttrInLineEffectList(curPlayer, funcInsidePerAttrDict)
                CalcLineEffect.ChangePlayerAttrInLineEffectList(curPlayer, funcCrossPerAttrDict)
                CalcLineEffect.ChangePlayerAttrInLineEffectList(curPlayer, fixPerAttrDict)
                # ²»ËãÕ½Á¦µÄ
                if funcIndex in ChConfig.CalcAttrFuncNoFightPowerList:
                    continue
                mfpAttrList = AddAttrListValue([mfpAttrList, funcAttrList])
                AddAttrDictValue(mfpAttrExDict, funcInsidePerAttrDict)
                AddAttrDictValue(mfpAttrExDict, funcCrossPerAttrDict)
                AddAttrDictValue(mfpAttrExDict, fixPerAttrDict)
                
            mfpObj = self.GetModuleFightPowerObj(mfpType)
            mfpObj.SetCalcMFPBattleAttr(mfpAttrList)
            for attrIndex, value in mfpAttrExDict.items():
                mfpObj.AddCalcMFPAttr(attrIndex, value)
            mfpObjDict[mfpType] = mfpObj
            
        # ÒòΪ¼ÆËãÕ½Á¦ÐèҪȡµ½×ÜÊôÐÔ£¬ËùÒԵȸ÷¹¦ÄܵãÊôÐÔÀÛ¼ÓÍêºóÔÙ¼ÆËã
        for mfpType, mfpObj in mfpObjDict.items():
            mfpValue = 0 if not fpParam else mfpObj.GetModuleFightPower(fpParam, curPlayer)
            mfpSkill = curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_MFPSkill % mfpObj.mfpType)
            mfpEx = curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_MFPEx % mfpObj.mfpType)
            mfpEx = GetMFPExFightPower(curPlayer, mfpType)
            mfpTotal = mfpValue + mfpSkill + mfpEx
            mfpDict[mfpObj.mfpType] = min(mfpTotal, ChConfig.Def_UpperLimit_DWord)
            
            if mfpType == ShareDefine.Def_MFPType_Plus:
                OpenServerCampaign.UpdOpenServerCampaignRecordData(curPlayer, ShareDefine.Def_Campaign_Type_Plus, mfpTotal)
            elif mfpType == ShareDefine.Def_MFPType_Horse:
                OpenServerCampaign.UpdOpenServerCampaignRecordData(curPlayer, ShareDefine.Def_Campaign_Type_Horse, mfpTotal)
            elif mfpType == ShareDefine.Def_MFPType_Wash:
                OpenServerCampaign.UpdOpenServerCampaignRecordData(curPlayer, ShareDefine.Def_Campaign_Type_Wash, mfpTotal)
                
        #GameWorld.DebugLog("ÕûÌå²ã¼¶ÏßÐÔÊôÐÔ: %s" % allAttrList, playerID)
        
        # 5.±»¶¯¼¼Äܸ½¼ÓÊôÐÔ£¬²»ËãÕ½Á¦
        passiveSkillAttrList = [{} for _ in range(4)]
        SkillShell.CalcPassiveAttr_Effect(curPlayer, passiveSkillAttrList)  # ÊôÐÔÀ༼ÄÜÓëbuffͬ²ã
        for funcIndex in ChConfig.CalcAttrFuncSkillList:
            passiveSkillAttrList = AddAttrListValue([passiveSkillAttrList, funcAttrInfoList[funcIndex]])    
        GameWorld.DebugLog("ÎÞÕ½Á¦±»¶¯ÊôÐÔ: %s" % passiveSkillAttrList, playerID)
        
        skillFixAttrExDict = {}
        skillFixAddPerDict = passiveSkillAttrList[ChConfig.CalcAttr_BattleNoline]
        for fixAttrType, addPer in skillFixAddPerDict.items():
            if fixAttrType not in allFixAttrDict:
                continue
            curFixValue = allFixAttrDict[fixAttrType]
            addValueEx = int(curFixValue * addPer / 10000.0)
            skillFixAttrExDict[fixAttrType] = addValueEx
        CalcLineEffect.ChangePlayerAttrInLineEffectList(curPlayer, passiveSkillAttrList[ChConfig.CalcAttr_Battle])
        CalcLineEffect.ChangePlayerAttrInLineEffectList(curPlayer, skillFixAttrExDict)
                
        #ÌØÊâÖ¸¶¨ÊôÐÔ¹«Ê½
        GameMap.SpecialMapSetAttrValueByFormat(curPlayer)
        
        #»¤¶ÜֵˢÐÂ
        self.__RefreshMaxProDef(beforeMaxProDef)
        
        # ¡¾µ½´ËËùÓй¦ÄÜÊôÐÔ¶¼ÒÑˢд¦ÀíÍê±Ï£¬¸´ÖÆÒ»·Ý ¹¦ÄÜÊôÐÔµÄˢнá¹û£¬ÓÃÓÚBUFFÊôÐÔµ¥¶ÀˢС¿
        EffGetSet.CopyPlayerFuncAttr(curPlayer)
        
        # 6.¼ÆËãbuffÊôÐÔ, buff²ã¼¶µÄ²»ËãÈçÕ½¶·Á¦
        self.__RefreshBuffAttr()
        
        # 7.Ë¢ÍêÊôÐÔºóÐèÒª´¦ÀíµÄÂß¼­
        self.__DoRefreshAttrAfterLogic(beforeMaxHP, beforeMoveSpeedValue, playerStateDict)
        
        #֪ͨ»ù´¡ÊôÐÔ
        self.__SyncBaseAttr(curPlayer, baseAttrList)
        #ÎåÐÐÁé¸ù±ä¸üÐèÒª´¦ÀíµÄÂß¼­
        afterPointList = [GetMetal(curPlayer), GetWood(curPlayer), GetWater(curPlayer), GetFire(curPlayer), GetEarth(curPlayer)]
        if beforePointList != afterPointList:
            diffPointAttrList = []
            for i, attrID in enumerate([ShareDefine.Def_Effect_Metal, ShareDefine.Def_Effect_Wood, ShareDefine.Def_Effect_Water,
                           ShareDefine.Def_Effect_Fire, ShareDefine.Def_Effect_Earth]):
                if beforePointList[i] != afterPointList[i]:
                    diffPointAttrList.append(attrID)
            SkillShell.RefreshElementSkillByAttr(curPlayer, diffPointAttrList)
#        if hasChange_Qualitylv:
#            #Áé¸ùÆ·¼¶±ä»¯´¦Àí
#            ChEquip.ChangeEquipfacadeByLingGen(curPlayer)
            
        # ¸üпª·þ»î¶¯Áé¸ùÊý¾Ý
        OpenServerCampaign.UpdOpenServerCampaignLingGenData(curPlayer)
        
        # Í¬²½Ç°¶ËÕ½Á¦£¬ÒòΪÓРSetFightPower ËùÒÔÀÛ¼ÓÕ½Á¦·ÅÔÚÕâÀïËùÓÐˢм°¼ÆËã´¦ÀíÍêºó²Å´¦Àí£¬²ÅÄÜÕý³£´¥·¢setͬ²½Ç°¶Ë
        self.SendModuleFightPowerPack(curPlayer, mfpDict)
        billFuncCnt = len(PyGameData.g_refreshAttrBillboardFunc) # Ö»´¦Àí¹Ì¶¨´ÎÊý£¬·ÀÖ¹ËÀÑ­»·
        while billFuncCnt > 0 and PyGameData.g_refreshAttrBillboardFunc:
            billFuncCnt -= 1
            billboardFunc = PyGameData.g_refreshAttrBillboardFunc.pop(0)
            GameWorld.DebugLog("»Øµ÷ÅÅÐаñ: %s" % billboardFunc, playerID)
            billboardFunc(curPlayer, isForceUpdate=True)
            
        # ÔÝͣˢÐÂÊôÐÔ±êÖ¾£¬±ØÐë±»µ÷ÓÃ
        curPlayer.SetDict(ChConfig.Def_Player_RefreshAttr, 0)
        curPlayer.SetDict(ChConfig.Def_Player_RefreshAttrByBuff, 0)
        curPlayer.SetDict(ChConfig.Def_Player_HadRefreshAttr, 1)
        GameWorld.DebugLog("End RefreshPlayerAttrStateEx!!!", playerID)
        return True
    
    
    # ÉúÃüת»¯Îª·À»¤Öµ
    def __RefreshMaxProDef(self, beforeMaxProDef):
        curPlayer = self.__Player
        if GetProDefHPPer(curPlayer) == 0:
            return
        maxHP = GameObj.GetMaxHP(curPlayer)
        proDefPer = GetProDefHPPer(curPlayer)
        
        #»ñÈ¡²ß»®ÅäÖõıí¸ñ
        GodWeapon4 = IpyGameDataPY.GetFuncCfg("GodWeapon4", 2)
        maxProDef = eval(FormulaControl.GetCompileFormula("GodWeapon4", GodWeapon4))
        maxProDef = min(maxProDef, ChConfig.Def_UpperLimit_DWord)
        
        SetMaxProDef(curPlayer, int(maxProDef))
        
        afterMaxProDef = GetMaxProDef(curPlayer)
        addValue = max(0, afterMaxProDef - beforeMaxProDef)
        curProDef = GetProDef(curPlayer)
        
        if beforeMaxProDef > 0 and addValue > 0 and curPlayer.GetPlayerAction() != IPY_GameWorld.paDie:
            # Í¬²½Ôö¼Ó (ËÀÍö״̬ϲ»Ë¢)
            SetProDef(curPlayer, min(curProDef + addValue, afterMaxProDef))
        elif curProDef > afterMaxProDef:
            # ×öÒ»´Î·À·¶¾ÀÕý
            SetProDef(curPlayer, min(curProDef, afterMaxProDef))
            
        return
    
    def __RefreshBuffAttr(self):
        ## Ë¢ÐÂbuff²ãÊôÐÔ£¬¸Ã²ãÊôÐÔÖ»»á¸Ä±äÍæ¼Ò×îÖÕÊôÐÔ£¬²»»áÓ°ÏìÕ½Á¦µÈ
        curPlayer = self.__Player
        playerID = curPlayer.GetPlayerID()
        allAttrListBuffs = [{} for _ in range(4)]
        # 6.¼ÆËãbuffÊôÐÔ, buff²ã¼¶µÄ²»ËãÈçÕ½¶·Á¦
        #        ËãÕ½¶·Á¦×Üֵʱ¸Ã²ãÓ°ÏìµÄÊýÖµ²»Í³¼Æ£¬µ«Ë¢ÊôÐÔʱÐè¼ÆËã
        SkillShell.CalcBuffers_Effect(curPlayer, allAttrListBuffs)
        # ¶É½Ù¸±±¾»¤·¨ÊôÐÔ¼Ó³É
        GameLogic_DuJie.CalcDujieFBAttrAdd(curPlayer, allAttrListBuffs)
            
        #        ²ã·ÇÏßÐÔÕ½¶·ÊôÐÔÀÛ¼Ó
        battleNolineAttrBuff = allAttrListBuffs[ChConfig.CalcAttr_BattleNoline]
        CalcNoLineEffect.AddPlayerMapAttrNolineEffect(curPlayer, battleNolineAttrBuff)
        CalcNoLineEffect.ChangePlayerAttrInNoLineEffectList(curPlayer, battleNolineAttrBuff, isBuffAttr=True)
        
        battleAttrBuff = allAttrListBuffs[ChConfig.CalcAttr_Battle]
        CalcLineEffect.ChangePlayerAttrInLineEffectList(curPlayer, battleAttrBuff, isBuffAttr=True)
        
        #        ËÙ¶ÈÌØÊâ´¦Àí ¼ÆËãÒ»´Î
        self.__RefreshMoveSpeed(allAttrListBuffs)
        
        # GM²âÊÔÊôÐÔÌØÊâÂß¼­
        self.__DoRefreshGMAttr()
        
        #        Ë¢Ð¹¥»÷ËÙ¶È
        self.__SetAtkInterval()
        GameWorld.DebugLog("Buff²ãÊôÐÔ: %s" % allAttrListBuffs, playerID)
        return
    
    def __DoRefreshGMAttr(self):
        ## Ë¢ÐÂGM²âÊÔÊôÐÔ
        curPlayer = self.__Player
        platform = GameWorld.GetPlatform()
        if platform not in GMShell.TestPlatformList:
            return
        if curPlayer.GetGMLevel() != ChConfig.Def_GM_LV_God:
            return
        
        ipyDataMgr = IpyGameDataPY.IPY_Data()
        if not ipyDataMgr.GetGMAttrCount():
            return
        
        playerAccID = GameWorld.GetPlatformAccID(curPlayer.GetAccID())
        gmIpyData = None
        commIpyData = None
        for i in xrange(ipyDataMgr.GetGMAttrCount()):
            ipyData = ipyDataMgr.GetGMAttrByIndex(i)
            if not ipyData.GetIsValid():
                continue
            gmMaxLV = ipyData.GetGMMaxLV()
            if curPlayer.GetLV() > gmMaxLV:
                continue
            gmAccID = ipyData.GetGMAccID()
            if gmAccID == playerAccID:
                gmIpyData = ipyData
                break
            
            if not gmAccID and not commIpyData:
                commIpyData = ipyData
                
        if not gmIpyData:
            if not commIpyData:
                return
            gmIpyData = commIpyData
            
        setAttrDict = {}
        specAttrDict = gmIpyData.GetAttrSpecDict()
        attrLV = gmIpyData.GetAttrLV()
        attrPer = gmIpyData.GetAttrPer()
        if attrLV:
            if attrLV == 1:
                attrLV = curPlayer.GetLV()
            lvIpyData = GetPlayerLVIpyData(attrLV)
            if lvIpyData:
                setAttrDict[ChConfig.AttrName_MaxHP] = int(lvIpyData.GetReMaxHP() * attrPer) # ×î´óÉúÃüÖµ
                setAttrDict[ChConfig.AttrName_Atk] = int(lvIpyData.GetReAtk() * attrPer) # ¹¥»÷£¨×îС¡¢×î´ó¹¥»÷£©
                setAttrDict[ChConfig.AttrName_Def] = int(lvIpyData.GetReDef() * attrPer) # ·ÀÓù
                setAttrDict[ChConfig.AttrName_Hit] = int(lvIpyData.GetReHit() * attrPer) # ÃüÖÐ
                setAttrDict[ChConfig.AttrName_DefRate] = int(lvIpyData.GetReMiss() * attrPer) # ÉÁ±Ü
                setAttrDict[ChConfig.AttrName_AtkSpeed] = int((lvIpyData.GetReAtkSpeed() + 10000) * attrPer) # ¹¥»÷ËÙ¶È, ²ß»®µÈ¼¶±íÅäÖõÄÊǸ½¼ÓÖµ£¬ËùÒÔÕâÀïÒª¼Ó
                setAttrDict[ChConfig.AttrName_SkillAtkRate] = int(max(0, lvIpyData.GetReSkillAtkRate() - 10000) * attrPer) # ¼¼ÄÜÉ˺¦±ÈÀý, ²ß»®µÈ¼¶±íÅäÖõÄÊÇ×îÖÕÖµ£¬³õʼֵÊÇ0£¬ËùÒÔÕâÀïÒª¼õ
                setAttrDict[ChConfig.AttrName_DamagePVP] = int(lvIpyData.GetReDamagePer() * attrPer) # PVP¹Ì¶¨É˺¦
                setAttrDict[ChConfig.AttrName_DamagePVPReduce] = int(lvIpyData.GetReDamReduce() * attrPer) # PVP¹Ì¶¨¼õÉË
                setAttrDict[ChConfig.AttrName_IgnoreDefRate] = int(lvIpyData.GetReIgnoreDefRate() * attrPer) # ÎÞÊÓ·ÀÓù±ÈÀý
                setAttrDict[ChConfig.AttrName_LuckyHitRate] = int(lvIpyData.GetReLuckyHitRate() * attrPer) # »áÐÄÒ»»÷ÂÊ
                setAttrDict[ChConfig.AttrName_LuckyHit] = int(lvIpyData.GetReLuckyHit() * attrPer) # »áÐÄÒ»»÷É˺¦
                setAttrDict[ChConfig.AttrName_BleedDamage] = int(lvIpyData.GetReBleedDamage() * attrPer) # Á÷ѪÉ˺¦Ôö¼Ó
                setAttrDict[ChConfig.AttrName_IceAtk] = int(lvIpyData.GetReIceAtk() * attrPer) # ÕæÊµÉ˺¦
                setAttrDict[ChConfig.AttrName_IceDef] = int(lvIpyData.GetReIceDef() * attrPer) # ÕæÊµµÖÓù
                setAttrDict[ChConfig.AttrName_PetAtk] = int(lvIpyData.GetRePetAtk() * attrPer) # Áé³è¹¥»÷
                setAttrDict[ChConfig.AttrName_PetSkillAtkRate] = int(max(0, lvIpyData.GetRePetSkillAtkRate() - 10000) * attrPer) # Áé³è¼¼ÄÜ, ²ß»®µÈ¼¶±íÅäÖõÄÊÇ×îÖÕÖµ£¬³õʼֵÊÇ0£¬ËùÒÔÕâÀïÒª¼õ
                setAttrDict[ChConfig.AttrName_PetDamPer] = int(lvIpyData.GetRePetDamPer() * attrPer) # Áé³èÉ˺¦Ôö¼Ó
                setAttrDict[ChConfig.AttrName_FinalHurt] = int(lvIpyData.GetReFinalHurt() * attrPer) # ¹Ì¶¨É˺¦Ôö¼Ó
                setAttrDict[ChConfig.AttrName_FinalHurtReduce] = int(lvIpyData.GetReFinalHurtReduce() * attrPer) # ¹Ì¶¨É˺¦¼õÉÙ
                
        # ÌØÊâÊôÐÔµÄÖ±½ÓÓÅÏȼ¶×î¸ß£¬Ö±½Ó¸²¸Ç
        for attrType, attrValue in specAttrDict.items():
            setAttrDict[attrType] = attrValue
            
        gmAttrSetInfo = [{} for _ in range(4)]
        for attrType, attrValue in setAttrDict.items():
            if not attrValue:
                setAttrDict.pop(attrType)
                continue
            CalcAttrDict_Type(attrType, attrValue, gmAttrSetInfo)
            
        # Ö±½ÓÉèÖõÄÊôÐÔ
        if gmAttrSetInfo:
            for key, value in gmAttrSetInfo[ChConfig.CalcAttr_Battle].items():
                EffGetSet.SetValueByEffIndex(curPlayer, key, value)
                
        # ¸½¼ÓÊôÐÔ
        attrExDict = gmIpyData.GetAttrExDict()
        gmAttrExInfo = [{} for _ in range(4)]
        for attrType, attrValue in attrExDict.items():
            CalcAttrDict_Type(attrType, attrValue, gmAttrExInfo)
        CalcLineEffect.ChangePlayerAttrInLineEffectList(curPlayer, gmAttrExInfo[ChConfig.CalcAttr_Battle])
        
        GameWorld.DebugLog("GM²âÊÔÉèÖÃÊôÐÔ: GMAttrID=%s,playerAccID=%s" % (gmIpyData.GetGMAttrID(), playerAccID))
        GameWorld.DebugLog("    GMµÈ¼¶ÊôÐÔ: GMAttrLV=%s,attrPer=%s,setAttrDict=%s,specAttrDict=%s,%s" 
                           % (attrLV, attrPer, setAttrDict, specAttrDict, gmAttrSetInfo))
        GameWorld.DebugLog("    GM¸½¼ÓÊôÐÔ: attrExDict=%s,%s" % (attrExDict, gmAttrExInfo))
        return
    
    def __DoRefreshAttrAfterLogic(self, beforeMaxHP, beforeMoveSpeedValue, playerStateDict):
        '''Ë¢Íê×ÜÊôÐÔ(¹¦ÄÜÊôÐÔ + buffÊôÐÔ) ºóÐèÒª´¦ÀíµÄÂß¼­
            °üº¬Ò»Ð©ÊýÖµ¾ÀÕý¡¢ÊôÐÔ±ä¸ü֪ͨµÈ
            @attention: ´Ëº¯ÊýΪˢ ¹¦ÄÜÊôÐÔ ¼° buffÊôÐԠͨÓÃÂß¼­£¬ËùÒÔ²»ÊÇÊÜbuffÓ°ÏìµÄÏà¹Ø´¦ÀíÇë²»Òª·ÅÕâÀ±ÈÈçÕ½¶·Á¦µÈ
        '''
        curPlayer = self.__Player
        #------------------------------¼ÆËãÍê±Ï--------------------------------
        afterMaxHP = GameObj.GetMaxHP(curPlayer)
        addMaxHP = max(0, afterMaxHP - beforeMaxHP)
        if beforeMaxHP > 0 and addMaxHP > 0 and curPlayer.GetPlayerAction() != IPY_GameWorld.paDie:
            # ×î´óѪÁ¿Ôö¼Óʱ£¬Í¬²½Ôö¼ÓµÈÁ¿µÄµ±Ç°ÑªÁ¿ (ËÀÍö״̬ϲ»Ë¢µ±Ç°ÑªÁ¿)
            GameObj.SetHP(curPlayer, min(GameObj.GetHP(curPlayer) + addMaxHP, afterMaxHP))
        #self.PrintAttr(curPlayer, "×îÖÕµÄ")
        curPlayer.EndRefreshState() # Í³Ò»ÔÚË¢ÊôÐÔ½áÊøÂß¼­Öе÷ÓÃ
        #---------------------------------------------------------------------
        #°ÑÊôÐԺϲ¢Í¨Öª
        self.NotifyAllState(playerStateDict)
        
        #ÒÆ¶¯ËٶȲ»Í¬Ôò֪ͨ¸ø¿Í»§¶Ë, ¹¦Äܲ㴦ÀíµÄÊÇ SpeedNotBuff , Í¨Öª¿Í»§¶ËµÄÐèÒªÊÇ×îÖյĠSpeedValue
        if beforeMoveSpeedValue != GetSpeedValue(curPlayer):
            SetSpeedValue(curPlayer, GetSpeedValue(curPlayer))
            
        #¾ÀÕýµ±Ç°ÑªÄ§Á¿²»³¬¹ý×î´óÖµ
        self.__RestoreHPMP()
        
        #֪ͨ¿Í»§¶ËÍæ¼Òµ±Ç°¾­Ñé±¶ÂÊ
        Sync_ExpRateChange(curPlayer)
        return
    
    def __SyncBaseAttr(self, curPlayer, baseAttrList):
        baseBattleAttrDict = baseAttrList[ChConfig.CalcAttr_Battle]
        attrTypeKeyDict = {ChConfig.TYPE_Calc_AttrATKMin:[ChConfig.Def_PlayerKey_BaseAtkMin, ShareDefine.CDBPlayerRefresh_BaseAtkMin],
                           ChConfig.TYPE_Calc_AttrATKMax:[ChConfig.Def_PlayerKey_BaseAtkMax, ShareDefine.CDBPlayerRefresh_BaseAtkMax],
                           ChConfig.TYPE_Calc_AttrMaxHP:[ChConfig.Def_PlayerKey_BaseMaxHP, ShareDefine.CDBPlayerRefresh_BaseMaxHP],
                           ChConfig.TYPE_Calc_AttrDEF:[ChConfig.Def_PlayerKey_BaseDef, ShareDefine.CDBPlayerRefresh_BaseDef],
                           ChConfig.TYPE_Calc_AttrHit:[ChConfig.Def_PlayerKey_BaseHit, ShareDefine.CDBPlayerRefresh_BaseHit],
                           ChConfig.TYPE_Calc_AttrMiss:[ChConfig.Def_PlayerKey_BaseMiss, ShareDefine.CDBPlayerRefresh_BaseMiss],
                           }
        
        notifySList = []
        for attrType, attrInfo in attrTypeKeyDict.items():
            attrKey, refreshType = attrInfo
            baseValue = baseBattleAttrDict.get(attrType, 0)
            curBaseValue = curPlayer.GetDictByKey(attrKey)
            if baseValue != curBaseValue:
                curPlayer.SetDict(attrKey, baseValue)
                
                notifyStruct = ChPyNetSendPack.tagRefreshType()
                notifyStruct.RefreshType = refreshType
                notifyStruct.Value = baseValue
                notifySList.append(notifyStruct)
                
        # Í¨Öª»ù´¡ÊôÐÔ
        if notifySList:
            sendPack = ChPyNetSendPack.tagObjInfoListRefresh()
            sendPack.Clear()
            sendPack.ObjID = curPlayer.GetID()
            sendPack.ObjType = curPlayer.GetGameObjType()
            sendPack.Count = len(notifySList)
            sendPack.RefreshType = notifySList
            NetPackCommon.SendFakePack(curPlayer, sendPack)
        return
    
    #---------------------------------------------------------------------
    
    ## Ë¢ÐÂÍæ¼Ò¼¼ÄÜÕ½¶·Á¦
    #  @param self ÀàʵÀý
    #  @return ·µ»ØÖµÎÞÒâÒå
    #  @remarks Ë¢ÐÂÍæ¼Ò±»¶¯¼¼ÄÜBuff
    def RefreshAllSkill(self):
        curPlayer = self.__Player
        
        skillManager = curPlayer.GetSkillManager()
        
        # ÖØÖÃÄ£¿é¼¼ÄÜÕ½¶·Á¦
        for mfpType in ShareDefine.ModuleFightPowerTypeList:
            curPlayer.SetDict(ChConfig.Def_PlayerKey_MFPSkill % mfpType, 0)
        
        for i in range(0, skillManager.GetSkillCount()):
            curSkill = skillManager.GetSkillByIndex(i)
 
            mfpType = ChConfig.Def_SkillFuncType_MFPType.get(curSkill.GetFuncType(), ShareDefine.Def_MFPType_Role)
 
            skillMFP = curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_MFPSkill % mfpType)
            curPlayer.SetDict(ChConfig.Def_PlayerKey_MFPSkill % mfpType, skillMFP + curSkill.GetFightPower())
        
        return
    
    ## ¼¼ÄÜÉý¼¶Ë¢ÊôÐÔÕ½¶·Á¦´¦Àí
    def RefreshSkillFightPowerEx(self, skillID, beforeFightPower, isRefreshState=True):
        curPlayer = self.__Player
        # Ð¼¼ÄÜÕ½Á¦-¾É¼¼ÄÜÕ½Á¦ÎªÔö¼ÓµÄ¼¼ÄÜÕ½Á¦
        curSkill = GameWorld.GetGameData().GetSkillBySkillID(skillID)
        if not curSkill:
            return
        
        mfpType = ChConfig.Def_SkillFuncType_MFPType.get(curSkill.GetFuncType(), ShareDefine.Def_MFPType_Role)
        addFightPower = curSkill.GetFightPower() - beforeFightPower
        skillMFP = curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_MFPSkill % mfpType)
        curPlayer.SetDict(ChConfig.Def_PlayerKey_MFPSkill % mfpType, max(0, skillMFP + addFightPower))
        GameWorld.DebugLog("ˢм¼Äܸ½¼ÓÕ½¶·Á¦: skillID=%s,beforeFightPower=%s,mfpType=%s,skillMFP=%s,updMFP=%s" 
                           % (skillID, beforeFightPower, mfpType, skillMFP, skillMFP + addFightPower), curPlayer.GetPlayerID())
        
        if isRefreshState:
            # Èç¹ûÐèҪͬ²½ÅÅÐаñµÄ»°ÏÈÇ¿ÖÆË¢ÊôÐÔ
            self.RefreshPlayerAttrState()
            
        return
    
    def RefreshSkillFightPowerByDel(self, delSkillID, isRefreshState=True):
        curPlayer = self.__Player
        # Ð¼¼ÄÜÕ½Á¦-¾É¼¼ÄÜÕ½Á¦ÎªÔö¼ÓµÄ¼¼ÄÜÕ½Á¦
        curSkill = GameWorld.GetGameData().GetSkillBySkillID(delSkillID)
        if not curSkill:
            return
        delFightPower = curSkill.GetFightPower()
        mfpType = ChConfig.Def_SkillFuncType_MFPType.get(curSkill.GetFuncType(), ShareDefine.Def_MFPType_Role)
        skillMFP = curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_MFPSkill % mfpType)
        curPlayer.SetDict(ChConfig.Def_PlayerKey_MFPSkill % mfpType, max(0, skillMFP - delFightPower))
        GameWorld.DebugLog("ˢм¼Äܸ½¼ÓÕ½¶·Á¦: delSkillID=%s,mfpType=%s,skillMFP=%s,delFightPower=%s" 
                           % (delSkillID, mfpType, skillMFP, delFightPower), curPlayer.GetPlayerID())
        
        if isRefreshState:
            # Èç¹ûÐèҪͬ²½ÅÅÐаñµÄ»°ÏÈÇ¿ÖÆË¢ÊôÐÔ
            self.RefreshPlayerAttrState()
            
        return
    
    ## ¼ÆËã±»¶¯buffÊôÐÔ¼Ó³É
    #  @param self ÀàʵÀý
    #  @return 
    def CalcPassiveBuffAttr(self):
        #=======================================================================
        # curPlayer = self.__Player
        # allAttrListPassive = [{} for i in range(4)]
        # SkillShell.CalcCurBuffer_Effect(curPlayer.GetPassiveBuf(), curPlayer, allAttrListPassive)
        # SetCalcAttrListValue(curPlayer, ChConfig.Def_CalcAttrFunc_PassiveBuf, allAttrListPassive)
        #=======================================================================
        return
    
    ## //A3 A1 ¸÷¹¦ÄÜÄ£¿éÕ½¶·Á¦ÐÅÏ¢ #tagMCModuleFightPowerInfo
    #  @param curPlayer Íæ¼Ò
    #  @return None
    def SendModuleFightPowerPack(self, curPlayer, mfpDict):
        mfpDataList = []
        totalFightPower = 0
        playerID = curPlayer.GetPlayerID()
        GameWorld.DebugLog("Õ½Á¦¹¦Äܵã: %s" % ChConfig.MFPTypeAttrFuncIndexDict, playerID)
        GameWorld.DebugLog("Ä£¿éÕ½Á¦: %s" % mfpDict, playerID)
        for mfpType, fightPower in mfpDict.items():
            SetMFPFightPower(curPlayer, mfpType, fightPower)
            mfpData = ChPyNetSendPack.tagMCModuleFightPower()
            mfpData.Clear()
            mfpData.MfpType = mfpType
            mfpData.FightPower = fightPower # µ±Ç°Ä£¿éÕ½¶·Á¦ÊýÖµ
            mfpDataList.append(mfpData)
            totalFightPower += fightPower # ÀÛ¼Ó×ÜÕ½¶·Á¦
            
        # //A3 A1 ¸÷¹¦ÄÜÄ£¿éÕ½¶·Á¦ÐÅÏ¢ #tagMCModuleFightPowerInfo
        mfpInfo = ChPyNetSendPack.tagMCModuleFightPowerInfo()
        mfpInfo.Clear()
        
        mfpInfo.TotalFightPower = totalFightPower % ChConfig.Def_PerPointValue
        mfpInfo.TotalFightPoweEx = totalFightPower / ChConfig.Def_PerPointValue
        mfpInfo.MFPCnt = len(mfpDataList)
        mfpInfo.MFPList = mfpDataList
        NetPackCommon.SendFakePack(curPlayer, mfpInfo)
        beforeFightPower = GetFightPower(curPlayer)
        SetFightPower(curPlayer, totalFightPower)
        if totalFightPower < beforeFightPower:
            DataRecordPack.DR_FightPowerChangeInfo(curPlayer, beforeFightPower)
        highestFightPower = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FightPower_Highest, 0,
                                                           ChConfig.Def_PDictType_FightPower)
        highestFightPower += curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FightPower_HighestEx, 0, 
                                                            ChConfig.Def_PDictType_FightPower) * ChConfig.Def_PerPointValue
        if totalFightPower > highestFightPower:
            highestFightPower = totalFightPower
            NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FightPower_Highest, highestFightPower % ChConfig.Def_PerPointValue,
                                 ChConfig.Def_PDictType_FightPower)
            NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FightPower_HighestEx, highestFightPower / ChConfig.Def_PerPointValue,
                                 ChConfig.Def_PDictType_FightPower)
        GameWorld.DebugLog("×ÜÕ½Á¦: %s, ÀúÊ·×î¸ßÕ½Á¦: %s, beforeFightPower=%s" % (totalFightPower, highestFightPower, beforeFightPower), playerID)
        PlayerBillboard.UpdatePlayerFPTotalBillboard(curPlayer)
        # ¼Ç¼¿ª·þ»î¶¯Êý¾Ý£¬¿ª·þ»î¶¯Ç°XÌìÀíÂÛÉϲ»»á³¬¹ý20E£¬Ôݲ»´¦Àí
        OpenServerCampaign.UpdOpenServerCampaignRecordData(curPlayer, ShareDefine.Def_Campaign_Type_FightPower, min(totalFightPower, ChConfig.Def_UpperLimit_DWord))
        if beforeFightPower != totalFightPower:
            CrossPlayerData.OnPlayerFightPowerChange(curPlayer)
        return
    
    def __RefreshMoveSpeed(self, allAttrListBuffs):
        ## Ë¢ÐÂÒÆ¶¯ËÙ¶È
        curPlayer = self.__Player
        playerID = curPlayer.GetPlayerID()
        
        moveSpeedFormat = IpyGameDataPY.GetFuncCfg("MoveSpeed")
        
        if PlayerTruck.GetHaveAutoTruck(curPlayer):
            speed = IpyGameDataPY.GetFuncCfg("MoveSpeed", 3)
            GameWorld.DebugLog("ÔËïڹ̶¨ËÙ¶ÈÖµ: speed=%s" % speed, playerID)
        else:
            speed = GetSpeedNotBuff(curPlayer)
            GameWorld.DebugLog("¹¦ÄÜÒÆ¶¯ËÙ¶ÈÖµ: speed=%s" % speed, playerID)
            
            # Æï³Ë״̬¼ÓÉÏÆï³Ë¸½¼ÓËÙ¶È
            if curPlayer.GetPlayerVehicle() == IPY_GameWorld.pvHorse:
                speedHorse = curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_SpeedHorse)
                speed += speedHorse
                GameWorld.DebugLog("    Æï³Ë״̬¸½¼ÓÖµ: %s, speed=%s" % (speedHorse, speed), playerID)
            
                
            buffBattleAttr = allAttrListBuffs[ChConfig.CalcAttr_Battle]
            buffBattleNolineAttr = allAttrListBuffs[ChConfig.CalcAttr_BattleNoline]
            #buffËٶȼӳɠ    
            buffSpeed = buffBattleAttr.get(ChConfig.TYPE_Calc_AttrSpeed, 0)
            buffSpeedPer = buffBattleNolineAttr.get(ChConfig.TYPE_Calc_AttrSpeed, 0)
            
            if buffSpeed or buffSpeedPer:
                speed = int(speed * (ShareDefine.Def_MaxRateValue + buffSpeedPer) / float(ShareDefine.Def_MaxRateValue) + buffSpeed)
                GameWorld.DebugLog("    buffÓ°ÏìºóËÙ¶ÈÖµ: speed=%s,buffSpeedPer=%s,buffSpeed=%s" % (speed, buffSpeedPer, buffSpeed), playerID)
                
            speed = max(speed, 0)   #·ÀСÓÚ0´íÎó
        if GetSpeedValue(curPlayer) != speed:
            SetSpeedValue(curPlayer, speed)
            moveSpeed = eval(FormulaControl.GetCompileFormula("MoveSpeed", moveSpeedFormat))
            curPlayer.SetSpeed(moveSpeed)
            GameWorld.DebugLog("¹«Ê½¼ÆËãºóÒÆ¶¯ÆµÂÊ: moveSpeed=%s ºÁÃë/¸ñ" % moveSpeed, playerID)
            
            fightPet = curPlayer.GetPetMgr().GetFightPet()
            #ÎÞ³öÕ½³èÎï
            if fightPet:
                fightPet.SetSpeed(moveSpeed)
                
        return
 
    ##ˢй¥»÷¼ä¸ô
    # @param self ÀàʵÀý
    # @return None
    def __SetAtkInterval(self):
        curPlayer = self.__Player
        
        atkSpeed = GetAtkSpeed(curPlayer)
        
        formula = IpyGameDataPY.GetFuncCfg("AtkInterval")
        atkInterval = 0 if not formula else eval(FormulaControl.GetCompileFormula("AtkInterval", formula))
        curPlayer.SetAtkInterval(atkInterval)
        return
    
    
    ## Ë¢ÐÂÍæ¼ÒËùÓÐÐÐΪBUFF״̬
    #  @param self ÀàʵÀý
    #  @return ·µ»ØÖµÎÞÒâÒå
    #  @remarks Ë¢ÐÂÍæ¼ÒËùÓÐÐÐΪBUFF״̬
    def RefreshPlayerActionState(self):
        curPlayer = self.__Player
        playerID = curPlayer.GetPlayerID()
        GameWorld.DebugLog("Start RefreshPlayerActionState!!!", playerID)
        #curTime = time.clock()
        
        #ÏÈÇå³ýËùÓÐ״̬
        OperControlManager.ClearObjActionState(curPlayer)
        
        #ÔÙ¸ù¾ÝBUFF ¼ÓÉÏ״̬
        SkillShell.CalcBuffer_ActionState(curPlayer)
    
    #---------------------------------------------------------------------
    ## Ë¢ÐÂѪÁ¿ºÍħ
    #  @param self ÀàʵÀý
    #  @return ·µ»ØÖµÎÞÒâÒå
    #  @remarks Ë¢ÐÂѪÁ¿ºÍħ
    def __RestoreHPMP(self):
        curPlayer = self.__Player
        
        if not curPlayer.GetInitOK():
            #Íæ¼Òδ³õʼ»¯³É¹¦, ²»ÐÞÕýѪÁ¿ºÍħ·¨Öµ, Òò´ËʱÓпÉÄÜÒòΪijЩӰÏìÖ÷½ÇµÄÎïÆ·Î´³õʼ»¯Íê±Ï(Èç³èÎï×°±¸)
            return
        
        curPlayerHP = GameObj.GetHP(curPlayer)
        curPlayerMaxHP = GameObj.GetMaxHP(curPlayer)
        #=======================================================================
        # curPlayerMP = curPlayer.GetMP()
        # curPlayerMaxMP = curPlayer.GetMaxMP()
        #=======================================================================
        
        if curPlayerHP > curPlayerMaxHP:
            GameObj.SetHPFull(curPlayer)
        
        #=======================================================================
        # if curPlayerMP > curPlayerMaxMP:
        #    curPlayer.SetMP(curPlayerMaxMP)
        #=======================================================================
 
        return
    #---------------------------------------------------------------------
    ## ³õʼ»¯Íæ¼Ò»ù±¾×´Ì¬ ÕâÀï²»¶Ô£¨ ¼ÆËãÏÖÓÐÕ½¶·ÊôÐÔÖеÄÔªËØ½øÐд¦Àí £©
    #  @param self ÀàʵÀý
    #  @return ·µ»ØÖµÎÞÒâÒå
    #  @remarks ³õʼ»¯Íæ¼Ò»ù±¾×´Ì¬ ÕâÀï²»¶Ô£¨ ¼ÆËãÏÖÓÐÕ½¶·ÊôÐÔÖеÄÔªËØ½øÐд¦Àí £©
    def InitPlayerState(self):
        curPlayer = self.__Player
        #Çå¿ÕÕ½¶·ÊôÐÔ //Õ½¶·ÊôÐÔÉèÖÃÊýֵΪ0µÄ, ÓÉC++´¦Àí ÈçÔªËØÊôÐÔ,ÃüÖеÈ
        curPlayer.ClearBattleEffect()
        
        initAttrDict = {
                        #ChConfig.TYPE_Calc_AttrCurSTR:curPlayer.GetBaseSTR(),
                        #ChConfig.TYPE_Calc_AttrCurPNE:curPlayer.GetBasePNE(),
                        #ChConfig.TYPE_Calc_AttrCurPHY:curPlayer.GetBasePHY(),
                        #ChConfig.TYPE_Calc_AttrCurCON:curPlayer.GetBaseCON(),
                        #ChConfig.TYPE_Calc_AttrSpeed:curPlayer.GetBaseSpeed(),
                        ChConfig.TYPE_Calc_AttrAtkSpeed:ChConfig.Def_BaseAtkSpeed,
                        ChConfig.TYPE_Calc_AttrFightExpRate:GameWorld.GetGameWorld().GetExpRate(),
                        ChConfig.TYPE_Calc_AttrGameExpRate:GameWorld.GetGameWorld().GetExpRate(),
                        ChConfig.TYPE_Calc_AttrPetExpRate:GameWorld.GetGameWorld().GetExpRate(),
                        ChConfig.TYPE_Calc_HitSucessRate:ChConfig.Def_MaxRateValue,
                        ChConfig.TYPE_Calc_CurePer:ChConfig.Def_MaxRateValue,
                        ChConfig.TYPE_Calc_YinjiTime:IpyGameDataPY.GetFuncCfg('Yinji', 1),  # Ã¿XÃë×Ô¶¯Ïûʧһ¸öÓ¡¼Ç
                        }
        
        for i in xrange(1, ChConfig.Def_Calc_AllAttrType_MAX):
            if i in [ChConfig.TYPE_Calc_AttrHP, ChConfig.TYPE_Calc_AttrMP, ChConfig.TYPE_Calc_ProDef]:
                continue
            value = 0 if i not in initAttrDict else initAttrDict[i]
            EffGetSet.SetValueByEffIndex(curPlayer, i, value)
            
        #³õʼ»¯Ê°È¡¾àÀë
        if curPlayer.GetPickupDist() != ChConfig.Def_RolePickupItemDist:
            curPlayer.SetPickupDist(ChConfig.Def_RolePickupItemDist)
            
        #Íæ¼Ò³õʼ»¯¿É¹¥»÷
        if not curPlayer.GetCanAttack():
            curPlayer.SetCanAttack(True)
            
        #³õʼ»¯Áé¸ù
        SetMetal(curPlayer, curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_AddPointValue % ShareDefine.Def_Effect_Metal))
        SetWood(curPlayer, curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_AddPointValue % ShareDefine.Def_Effect_Wood))
        SetWater(curPlayer, curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_AddPointValue % ShareDefine.Def_Effect_Water))
        SetFire(curPlayer, curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_AddPointValue % ShareDefine.Def_Effect_Fire))
        SetEarth(curPlayer, curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_AddPointValue % ShareDefine.Def_Effect_Earth))
        return True
    
    #---------------------------------------------------------------------
    ## ³õʼ»¯³¡¾°buff
    #  @param self ÀàʵÀý
    #  @return ·µ»ØÖµÎÞÒâÒå
    #  @remarks ³õʼ»¯³¡¾°buff
    def InitMapBuffState(self):
        curPlayer = self.__Player
        
        #³õʼ»¯ÇøÓò, Ä¬ÈÏΪÆÕÍ¨ÇøÓò
        if GameMap.GetAreaTypeByMapPos(curPlayer.GetPosX(), curPlayer.GetPosY()) != IPY_GameWorld.gatNormal:
            curPlayer.SetAreaType(IPY_GameWorld.gatNormal)
            
        return
    
    #---------------------------------------------------------------------
    ## ½«Íæ¼ÒÉèÖõ½ÖØÉúµã
    #  @param self ÀàʵÀý
    #  @return ·µ»ØÖµÎÞÒâÒå
    #  @remarks ½«Íæ¼ÒÉèÖõ½ÖØÉúµã
    def SetToBornPlace(self):
        curPlayer = self.__Player
        mapFBType = GameWorld.GetMap().GetMapFBType()
        #Íæ¼Ò²»ÔÚ¸±±¾ÖÐ
        if mapFBType == IPY_GameWorld.fbtNull:
#            gameMap = GameWorld.GetMap()
#            rebornMapID = gameMap.GetRebornMapID()
#            rebornPosX = gameMap.GetRebornMapX()
#            rebornPosY = gameMap.GetRebornMapY()
#            
#            #ÑéÖ¤ÊÇ·ñ±¾µØÍ¼¸´»îµã ½øÐÐÂß¼­´¦Àí
#            if gameMap.GetMapID() == rebornMapID:
#                posX, posY = GameMap.GetNearbyPosByDis(rebornPosX, rebornPosY, ChConfig.Def_RebornPos_Area_Range)
#            else:
#                posX, posY = rebornPosX, rebornPosY
#                
#            #ÕÒ²»µ½·ÇÕϰ­µã¸´»î£¬ÔòÉèÎªÍæ¼ÒµÄÖØÉúµã¸´»î
#            if posX <= 0 or posY <= 0 or rebornMapID <= 0:
#                rebornMapID = curPlayer.GetRebornMapID()
#                posX = curPlayer.GetRebornPosX()
#                posY = curPlayer.GetRebornPosY()
            rebornMapID = curPlayer.GetRebornMapID()
            rebornPosX = curPlayer.GetRebornPosX()
            rebornPosY = curPlayer.GetRebornPosY()
 
        #Íæ¼ÒÔÚ¸±±¾ÖÐ
        else:
            rebornMapID = curPlayer.GetFBRebornMapID()
            rebornPosX = curPlayer.GetFBRebornPosX()
            rebornPosY = curPlayer.GetFBRebornPosY()
        
        if rebornMapID == 0:
            NotifyCode(curPlayer, "ObjectMapNonentity")
            GameWorld.Log("ÈËÎïÖØÉúµØÍ¼ID = %sÒì³£!" % (rebornMapID) , curPlayer.GetPlayerID())
            return
        
        if rebornMapID == curPlayer.GetMapID():
            GameWorld.ResetPlayerPos(curPlayer, rebornPosX, rebornPosY)
            return
        
        #°ÑÈËÎïÉèÖûØÖØÉúµã
        PlayerResetWorldPos(curPlayer, rebornMapID, rebornPosX, rebornPosY, False)
        return
    
    #---------------------------------------------------------------------
    ## Íæ¼ÒËÀÍöÂß¼­
    #  @param self ÀàʵÀý
    #  @return ·µ»ØÖµÎÞÒâÒå
    #  @remarks Íæ¼ÒËÀÍöÂß¼­
    def SetDead(self):
        #Ö÷½ÇÉèÖÃΪËÀÍö״̬
        curPlayer = self.__Player
        
        #֪ͨ¸±±¾Íæ¼ÒËÀÍö
        FBLogic.DoPlayerDead(curPlayer)
        
        #Íæ¼Ò״̬´¦Àí
        ReSetPlayerState(curPlayer)
        
        #Çå¿ÕËùÓÐËÀÍö²»±£ÁôµÄbuff
        self.__PlayerDeadClearBuff()
 
        #ɱËÀËùÓÐÕÙ»½µÄÁé
        KillPlayerSummonNPC(curPlayer)
        
        #ÕÙ»½»Ø³öÕ½µÄ³èÎï
        PetControl.ReCallFightPet(curPlayer)
        
        #À­ïÚÍæ¼ÒËÀÍö´¦Àí
        PlayerTruck.DoPlayerDead(curPlayer)
        #Çå¿ÕʹÓü¼ÄܼǼ
        curPlayer.ClearUseSkillRec()
        
        #¸ÄΪ¸´»îµÄʱºòË¢ÐÂ״̬
#===============================================================================
#        #Ë¢ÐÂ״̬
#        self.RefreshAllState()
#===============================================================================
        
        if GameObj.GetHP(curPlayer) != 0:
            GameObj.SetHP(curPlayer, 0)
        
        #Çå¿ÕÒÆ¶¯´íÎó¾àÀë
        GameWorld.ClearPlayerPosCount(curPlayer)
        
        #¼Ç¼Ö÷½ÇËÀÍö´ÎÊýºÍËÀÍöʱ¼ä
        self.SetPlayerDeadCnt(curPlayer)
        
        #ËÀÍö´¥·¢¼¼ÄÜ
        tick = GameWorld.GetGameWorld().GetTick()
        
        #֪ͨËÀÍö
        DoPlayerDead(curPlayer)
        
        #PlayerTJG.PlayerTJGReborn(curPlayer, tick)
        GameObj.ClearPyPlayerState(curPlayer)
        
        MirrorAttack.OnPlayerDead(curPlayer)
        return
    
    
    ## ¼Ç¼Ö÷½ÇËÀÍö´ÎÊý
    #  @param self ÀàʵÀý
    #  @return ·µ»ØÖµÎÞÒâÒå
    def SetPlayerDeadCnt(self, curPlayer):
        #playerLv = curPlayer.GetLV()
        #¼Ç¼ËÀÍöʱ¼ä
        NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_DeadTime, int(time.time()))
        #ÉíÉÏÓÐ5²ã¸´»îÆ£ÀÍbuffʱÔټǼ
        findBuff = SkillCommon.FindBuffByID(curPlayer, ChConfig.Def_SkillID_ReviveTired)[0]
        if not (findBuff and findBuff.GetSkill().GetSkillLV() == findBuff.GetSkill().GetSkillMaxLV()):
            return
        
#        if playerLv < int(ReadChConfig.GetEvalChConfig('BeginRecordDeadCntLV')):
#            return
        
        #ÉϴμǼµÄÍæ¼ÒËÀÍö´ÎÊý
#         lastDeadCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_PlayerDeadCnt)
#         #GameWorld.Log("ÉÏ´ÎÍæ¼ÒËÀÍö´ÎÊý=%s"%lastDeadCnt)
#         
#         #ËÀÍö´ÎÊý×î´óÀÛ¼ÓÖµ
#         maxDeadCnt = int(ReadChConfig.GetEvalChConfig('PlayerDeadMaxCnt'))
#         
#         #»ñÈ¡ÉÏ´ÎËÀÍöʱ¼ä
#         lastDeadTimeTick = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_DeadTime)
#         #GameWorld.Log("»ñÈ¡ÉÏ´ÎËÀÍöʱ¼ä=%s"%lastDeadTimeTick)
#         
#         #ÿ¸ô¼¸ºÁÃë¼õÒ»´ÎËÀÍö´ÎÊý
#         timeSpace = int(ReadChConfig.GetEvalChConfig('DelDeadCntTime')) 
#         
#         #µ±Ç°Ê±¼ä
#         curGameWorldTick = int(time.time())
#         delCnt = max(curGameWorldTick - lastDeadTimeTick, 0) / timeSpace
#         
#         #GameWorld.Log("###delCnt=%s"%delCnt)
#         #µ±Ç°ËÀÍö´ÎÊý(°üÀ¨Õâ´ÎËÀµÄ)
#         curDeadCnt = min(max(lastDeadCnt - delCnt, 0) + 1, maxDeadCnt)
#         
#         #GameWorld.Log("###curDeadCnt=%s"%curDeadCnt)
#         #GameWorld.Log("###curTimeTick=%s"%curGameWorldTick)
#         #¼Ç¼µ±Ç°ËÀÍö´ÎÊý
#         NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_PlayerDeadCnt, curDeadCnt)
        
        #֪ͨËÀÍöʱ¼ä
        self.NotifyPlayerDeadTime(curPlayer)
        return
    
    ## Í¨ÖªÉÏ´ÎËÀÍöʱ¼ä
    #  @param self ÀàʵÀý
    #  @return ·µ»ØÖµÎÞÒâÒå
    #  @remarks Íæ¼ÒËÀÍöÂß¼­, ºìÃûµôÂä
    def NotifyPlayerDeadTime(self, curPlayer):
        #Èç¹ûÓÐ5²ã¸´»îÆ£ÀÍbuff ²¢ÇÒÊDZ»Íæ¼ÒɱËÀµÄÔò֪ͨ
        findBuff = SkillCommon.FindBuffByID(curPlayer, ChConfig.Def_SkillID_ReviveTired)[0]
        if findBuff and findBuff.GetSkill().GetSkillLV() == findBuff.GetSkill().GetSkillMaxLV():
            if curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_IsAddReviveTired):
                lastDeadTimeTick = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_DeadTime)
                packData = ChPyNetSendPack.tagMCPlayerDeadTime()
                packData.DeadTime = lastDeadTimeTick
                NetPackCommon.SendFakePack(curPlayer, packData)
        return
    
    #---------------------------------------------------------------------
    ## Çå¿ÕËùÓеĿÉÒÔɾ³ýµÄbuff
    #  @param self ÀàʵÀý
    #  @return ·µ»ØÖµÎÞÒâÒå
    #  @remarks Çå¿ÕËùÓеĿÉÒÔɾ³ýµÄbuff
    def __PlayerDeadClearBuff(self):
        curPlayer = self.__Player
        tick = GameWorld.GetGameWorld().GetTick()
        
        #ÐèÒª¿¼ÂÇbuff,deBuff,aura,incBuff,mapBuff,³ýÁËequipBuff²»¿¼ÂÇ
        PlayerClearBuff_Single(curPlayer, curPlayer.GetBuffState(), ClearBuffByDie, tick)
        PlayerClearBuff_Single(curPlayer, curPlayer.GetDeBuffState(), ClearBuffByDie, tick)
        PlayerClearBuff_Single(curPlayer, curPlayer.GetAura(), ClearBuffByDie, tick)
        PlayerClearBuff_Single(curPlayer, curPlayer.GetIncBuff(), ClearBuffByDie, tick)
        PlayerClearBuff_Single(curPlayer, curPlayer.GetMapBuff(), ClearBuffByDie, tick)
        PlayerClearBuff_Single(curPlayer, curPlayer.GetActionBuffManager(), ClearBuffByDie, tick)
        PlayerClearBuff_Single(curPlayer, curPlayer.GetProcessBuffState(), ClearBuffByDie, tick)
        PlayerClearBuff_Single(curPlayer, curPlayer.GetProcessDeBuffState(), ClearBuffByDie, tick)
        
        return
    
#---------------------------------------------------------------------
## Çå¿Õbuff(²ÎÊý -> buff¹ÜÀíÆ÷)
#  @param curPlayer Íæ¼ÒʵÀý
#  @param buffState buff¹ÜÀíÆ÷
#  @param tick Ê±¼ä´Á
#  @return ·µ»ØÖµÎÞÒâÒå
#  @remarks Çå¿Õbuff(²ÎÊý -> buff¹ÜÀíÆ÷)
def PlayerClearBuff_Single(curPlayer, buffState, funcClearBuff, tick):
 
    curPlayerID = curPlayer.GetPlayerID()
    index = 0
    buffSkillIDList = []
    
    passiveEff = PassiveBuffEffMng.GetPassiveEffManager().GetPassiveEff(curPlayer)
    while index < buffState.GetBuffCount():
        curBuff = buffState.GetBuff(index)
        #Òì³£
        if not curBuff:
            GameWorld.Log("###Íæ¼ÒÇå¿Õbuffʧ°Ü,Ë÷Òý = %s" % (index), curPlayerID)
            index += 1
            continue
        
        #buff²»Ïûʧ
        if funcClearBuff and funcClearBuff(curBuff):
            index += 1
            continue
        
        #BuffSkill.DoBuffDisApper(curPlayer, curBuff, tick)
        #buffSkillIDList.append([curBuff.GetSkill().GetSkillID(), curBuff.GetOwnerID(), curBuff.GetOwnerType()])
        buffSkillIDList.append(curBuff.GetSkill().GetSkillID())
        #GameWorld.DebugLog("ËÀÍöÇåÀí-----%s"%curBuff.GetSkill().GetSkillID())
        if passiveEff:
            passiveEff.DelBuffInfo(curBuff.GetSkill())
            
        #ɾ³ýÕâ¸öbuff
        buffState.DeleteBuffByIndex(index)
        
        
    SkillShell.ClearBuffEffectBySkillIDList(curPlayer, buffState, buffSkillIDList)
    return
 
 
## ËÀÍöbuffÊÇ·ñÏûʧ
#  @param curBuff: buffʵÀý
#  @return: ËÀÍöbuffÊÇ·ñÏûʧ
def ClearBuffByDie(curBuff):
    skill = curBuff.GetSkill()
    return skill.GetDieContinue() & Def_Buff_Clear_Die > 0
 
 
## ÏÂÏßbuffÊÇ·ñÏûʧ
#  @param curBuff: buffʵÀý
#  @return: ËÀÍöbuffÊÇ·ñÏûʧ
def ClearBuffByDisconnect(curBuff):
    skill = curBuff.GetSkill()
    return skill.GetDieContinue() & Def_Buff_Clear_Disconnect > 0
            
#---------------------------------------------------------------------
##´«Ëͼì²é(ÊÇ·ñ·Ç·¨µØÍ¼)
# @param curPlayer Íæ¼ÒʵÀý
# @param destMapID Ä¿±êµØÍ¼ID
# @return ·µ»ØÖµÕæ, Í¨¹ý
# @remarks ´«Ëͼì²é
def CheckTagCountry(curPlayer, destMapID):
    gameMap = GameWorld.GetMap()
    
    if not gameMap.IsMapIDExist(destMapID):
        GameWorld.ErrLog('###·Ç·¨µØÍ¼Êý¾Ý£¬mapID: %s' % (destMapID), curPlayer.GetPlayerID())
        NotifyCode(curPlayer, "ObjectMapNonentity")
        return False
    
#===============================================================================
#    #ÐÂÊִ峡¾°²»ÔÊÐí½øÈëºÍ´«³ö
#    if GameWorld.GetMap().GetMapID() == 21 or destMapID == 21:
#        NotifyCode(curPlayer, "CS_VillageHead_Fail")
#        return 
#===============================================================================
    
    #¼ì²éÍæ¼ÒÊÇ·ñ´«Ë͵йú×ø±ê
    mapCountry = gameMap.GetCountryByMapID(destMapID)
    
    if not GameWorld.IsSameCountry_Name(mapCountry, curPlayer.GetCountry()):
        NotifyCode(curPlayer, "Enemy_State_No_Trans")
        return False
    
    #¼ì²é´«ËÍÖÁµÄµØÍ¼ÊÇ·ñÊÇÆÕͨµØÍ¼
    if gameMap.GetMapFBTypeByMapID(destMapID) != IPY_GameWorld.fbtNull:
        #¸±±¾ºÍ»î¶¯³¡¾°ÎÞ·¨´«ËÍ
        NotifyCode(curPlayer, "Carry_lhs_306641")
        return False
    
    #¼ì²éÍæ¼ÒµÈ¼¶ÊÇ·ñ×ã¹»½øÈë´ËµØÍ¼
    if not CanEnterMap(curPlayer, destMapID):
        return False
    
    #¼ì²é´ËµØÍ¼ÊÇ·ñΪָ¶¨·ÖÁ÷ÓµÓеÄ
    mapLineID = GetPlayerLineID(curPlayer)
    
    mapLineCheckDict = ReadChConfig.GetEvalChConfig('TransportMapLineCheck')
    canEnterLineID = 0
    
    for lineID, mapIDList in mapLineCheckDict.items():
        if destMapID not in mapIDList:
            continue
        
        if mapLineID == lineID:
            #´Ë·ÖÁ÷¿ÉÒÔ½øÈë
            return True
 
        #¼Ç¼һÏ¿ÉÒÔ½øÈëµÄÏß·
        canEnterLineID = lineID
 
    if canEnterLineID > 0:
        #´Ë·ÖÁ÷²»¿É½øÈë
        NotifyCode(curPlayer, "Carry_yeqian_0", [destMapID, canEnterLineID])
        return False
 
    #¿ÉÒÔ½øÈë
    return True
#---------------------------------------------------------------------
##²éÍæ¼ÒµÈ¼¶ÊÇ·ñ×ã¹»½øÈë´ËµØÍ¼
# @param curPlayer Íæ¼ÒʵÀý
# @param destMapID Ä¿±êµØÍ¼ID
# @return ·µ»ØÖµÕæ, Í¨¹ý
# @remarks ²éÍæ¼ÒµÈ¼¶ÊÇ·ñ×ã¹»½øÈë´ËµØÍ¼
def CanEnterMap(curPlayer, destMapID, isShowSys=True):
    #µØÍ¼ÌØÊâ¼ì²é
    #if not CheckEquipCanTrans(curPlayer, destMapID):
        #return False
    
    if not CheckLVCanEnterMap(curPlayer, destMapID, isShowSys):
        return False
    
    return True
 
    
##²éÍæ¼ÒµÈ¼¶ÊÇ·ñ×ã¹»½øÈë´ËµØÍ¼
# @param curPlayer Íæ¼ÒʵÀý
# @param destMapID Ä¿±êµØÍ¼ID
# @return ·µ»ØÖµÕæ, Í¨¹ý
def CheckLVCanEnterMap(curPlayer, destMapID, isShowSys=True):
    mapData = GameWorld.GetGameData().GetChinMap().GetMapByID(destMapID)
    if not mapData:
        return 
    enterLV = mapData.GetLV()
 
    if curPlayer.GetLV() < enterLV:
        #¶Ô²»Æð£¬¸Ã³¡¾°ÐèÒªXX¼¶²ÅÄܽøÈë!
        if isShowSys:
            NotifyCode(curPlayer, "Carry_hwj35_0", [enterLV])
        return False
    openMapStep = mapData.GetTreasureID() #ÐèÒªÍê³ÉµÄÖ÷ÏßÈÎÎñID
    if openMapStep and not IsMapOpen(curPlayer, openMapStep):
        #GameWorld.DebugLog('¶Ô²»Æð£¬¸Ã³¡¾°destMapID=%sÐèÒªÍê³ÉÖ÷ÏßÈÎÎñ%s²ÅÄܽøÈë!' % (destMapID, openMapStep))
        return False
    return True
 
 
def IsMapOpen(curPlayer, openMapStep):
    # Ö÷ÏßÈÎÎñÍê³Éʱ»áÉèÖñêÖ¾¿É½øµØÍ¼±êÖ¾
    mission_1 = QuestCommon.GetCommonMission(curPlayer)
    if not mission_1:
        return False
    if openMapStep > mission_1.GetProperty("OpenMap"):
        return False
    return True
 
#---------------------------------------------------------------------
##¹ØÓÚ´«ËÍ ÑéÖ¤Íæ¼Ò״̬
# @param curPlayer Íæ¼ÒʵÀý
# @return ·µ»ØÖµÕæ, Í¨¹ý
# @remarks ¹ØÓÚ´«ËÍ ÑéÖ¤Íæ¼Ò״̬
def CheckTransState(curPlayer):
    #¿ÉÒÔ½øÈë´«Ë͵Ä״̬
    playerAction = curPlayer.GetPlayerAction()
    if playerAction in ChConfig.Def_Player_Cannot_TransState:
        #Carry_lhs_697674£ºÄúµ±Ç°Ëù´¦µÄ״̬²»ÄܽøÐд«ËÍ!
        NotifyCode(curPlayer, "Carry_lhs_697674")
        return False
    
    #ÒÆ¶¯Öв»Ö´Ðд˲Ù×÷
    if curPlayer.IsMoving():
        curPlayer.StopMove()
    
    
    if playerAction == IPY_GameWorld.paSit:
        DoPlayerStand(curPlayer)
    
    #ÇëÇó´«ËÍ״̬, ÅжϷþÎñ¶ËÏÞÖÆ
    if not OperControlManager.IsObjCanDoAction(
                                        curPlayer,
                                        ChConfig.Def_Obj_ActState_ServerAct,
                                        IPY_GameWorld.oalTransmit
                                        ):
        return False
    
    return True 
#---------------------------------------------------------------------
##Çå³ýÓÐÏÞÎÞµÐBUF
# @param curPlayer Íæ¼ÒʵÀý
# @param tick Ê±¼ä´Á
# @return ·µ»ØÖµÎÞÒâÒå
# @remarks Çå³ýÓÐÏÞÎÞµÐBUF
def DelLimitSuperBuff(curPlayer, tick):
    if curPlayer.GetCanAttack():
        return
    
    if not tick:
        tick = GameWorld.GetGameWorld().GetTick()
        
    if BuffSkill.DelBuffBySkillID(curPlayer, ChConfig.Def_SkillID_LimitSuperBuff, tick):
    
        PlayerControl(curPlayer).RefreshPlayerAttrByBuff()
    
#---------------------------------------------------------------------
##ÌØÊâ״̬´¦Àí
# @param curPlayer Íæ¼ÒʵÀý
# @return ·µ»ØÖµÎÞÒâÒå
# @remarks ÌØÊâ״̬´¦Àí
def ReSetPlayerState(curPlayer):
    tick = GameWorld.GetGameWorld().GetTick()
    
    #---Íæ¼Ò״̬´¦Àí---
    curPlayerAction = curPlayer.GetPlayerAction()
    
    #Íæ¼Ò½»Ò×ÖÐ, À뿪½»Ò×
    if curPlayerAction == IPY_GameWorld.paTrade:
        PlayerTrade.LeaveTrade(curPlayer, 0)
                    
    #Íæ¼Òʼþ״̬ÖÐ, Í˳öʼþ
    elif curPlayerAction == IPY_GameWorld.paEvent:
        EventShell.DoExitEvent(curPlayer)
        
    elif curPlayerAction == IPY_GameWorld.paGameEvent:
        PlayerGameEvent.StopGameEvent(curPlayer, tick)
        
    if curPlayerAction == IPY_GameWorld.paPreparing:
        DoExitPreparing(curPlayer)
    
    #---Íæ¼Ò½»Í¨¹¤¾ß´¦Àí---
    curPlayerVehicle = curPlayer.GetPlayerVehicle()
    
    #Íæ¼ÒÆïÂíÖÐ, ÏÂÂí
    if curPlayerVehicle == IPY_GameWorld.pvHorse:
        #Ö´ÐÐÏÂÂíÂß¼­
        PlayerHorse.PlayerRideHorseDown(curPlayer, False)
        
    #Íæ¼ÒïÚ³µÖÐ, Ï³µ
    elif curPlayerVehicle == IPY_GameWorld.pvTruck:
        PlayerTruck.PlayerTruckDown(curPlayer, curPlayer.GetTruck())
    
    #---ÆäËûϵͳ´¦Àí---
    
    #ÖжÏÕ½¶·¶ÔÖÅ
    ExitPlayerConfronting(curPlayer)
    
    #Çå¿Õµ±Ç°¹¥»÷¶ÔÏó
    curPlayer.SetActionObj(None)
    return
#---------------------------------------------------------------------
##³õʼ»¯Öк͵ØÍ¼¶Áȡʱ²»À­»Ø
# @param curPlayer Íæ¼ÒʵÀý
# @return ·µ»ØÖµÎÞÒâÒå
# @remarks ³õʼ»¯Öк͵ØÍ¼¶Áȡʱ²»À­»Ø
def __CanPullPlayer(curPlayer):
    if not curPlayer.GetInitOK():
        return False
    
    if curPlayer.GetIsLoginOff():
        return False
    
    return True
#------------------------------------------------------------------------------------ 
##·µ»ØÍæ¼Òµ±Ç°ÊÇ·ñÔÚ¿ÕÏÐ״̬
# @param curPlayer Íæ¼ÒʵÀý
# @return ÊÇ·ñÔÚ¿ÕÏÐ״̬
# @remarks ·µ»ØÍæ¼Òµ±Ç°ÊÇ·ñÔÚ¿ÕÏÐ״̬£¨²ß»®²ãÃæÉϵĿÕÏУ©
def IsPlanStateNull(curPlayer):
    
    #·Ç¿ÕÏÐ״̬
    if curPlayer.GetPlayerAction() != IPY_GameWorld.paNull:
        return False
    
    #ÒÆ¶¯ÖÐ
    if curPlayer.IsMoving():
        return False
    
    #Õ½¶·ÖÐ
    if curPlayer.IsBattleState():
        return False
    
#    #¶ÔÖÅÖÐ
#    if curPlayer.GetIsConfronting():
#        return False
    
#    #Ñ£ÔÎÖÐ
#    if curPlayer.GetAbnormalState() == IPY_GameWorld.sctFaint:
#        return False
    
    return True
#------------------------------------------------------------------------------------
##³õʼ»¯Íæ¼Ò±³°ü.
# @param curPlayer Íæ¼ÒʵÀý
# @return ·µ»ØÖµÎÞÒâÒå
# @remarks ³õʼ»¯Íæ¼Ò±³°ü
def Init_ItemPack(curPlayer):
    packType = IPY_GameWorld.rptItem
    
    #³õʼ»¯Íæ¼Ò±³°ü
    if packType not in ChConfig.Def_Type_CanBuyPack_PlayerDict.keys():
        return
    
    #»ñÈ¡Íæ¼Ò±³°ü
    curPack = curPlayer.GetItemManager().GetPack(packType)
    
    #ĬÈÏ14¸ñ×Ó + ¿ªÆôµÄ
    keyName = ChConfig.Def_Type_CanBuyPack_PlayerDict.get(packType)[ChConfig.Def_PlayerPackDict_Index_Key]
    count = ChConfig.Def_PlayerFirstLoginOpenBackCnt + curPlayer.NomalDictGetProperty(keyName)
    curPack.SetCount(count)
        
    #֪ͨ¿Í»§¶Ë±³°ü¸ñ×ÓÊýÄ¿
#    curPlayer.Sync_ItemCount(curPack.GetCount())
    curPack.Sync_PackCanUseCount()
    return
 
#------------------------------------------------------------------------------------
##³õʼ»¯Íæ¼Ò²Ö¿â.
# @param curPlayer Íæ¼ÒʵÀý
# @return ·µ»ØÖµÎÞÒâÒå
# @remarks ³õʼ»¯Íæ¼Ò²Ö¿â
def Init_Warehouse(curPlayer):
    
    packType = IPY_GameWorld.rptWarehouse
    
    #³õʼ»¯Íæ¼Ò±³°ü
    if packType not in ChConfig.Def_Type_CanBuyPack_PlayerDict.keys():
        return
    
    #»ñÈ¡Íæ¼Ò±³°ü
    curPack = curPlayer.GetItemManager().GetPack(packType)
    
    #ĬÈÏ42¸ñ×Ó + ¿ªÆôµÄ
    keyName = ChConfig.Def_Type_CanBuyPack_PlayerDict.get(packType)[ChConfig.Def_PlayerPackDict_Index_Key]
    count = ChConfig.Def_FirstLogin_OpenWareHouseCnt + curPlayer.NomalDictGetProperty(keyName)
    
    curPack.SetCount(count)
    
    #֪ͨ¿Í»§¶Ë
    curPack.Sync_PackCanUseCount()
    return
    
 
 
 
##³õʼ»¯Ñ°±¦±³°ü
# @param curPlayer Íæ¼ÒʵÀý
# @return None
def Init_TreasurePack(curPlayer):
    curPack = curPlayer.GetItemManager().GetPack(ShareDefine.rptTreasure)
    curPack.SetCount(ChConfig.Def_PackCnt_Treasure)
    
    #֪ͨ¿Í»§¶Ë
    curPack.Sync_PackCanUseCount()
    return
 
##³õʼ»¯Íæ¼ÒÊÕÄɹñ
# @param curPlayer Íæ¼ÒʵÀý
# @param packType ±³°üÀàÐÍ
# @return ·µ»ØÖµÎÞÒâÒå
def Init_CabinetCountByType(curPlayer, packType):
    keyName = ChConfig.Def_Type_CanBuyPack_PlayerDict.get(packType)[ChConfig.Def_PlayerPackDict_Index_Key]
    if keyName == None:
        GameWorld.ErrLog("Init_Pack Error type=%s" % packType)
        return
    
    #³õʼ»¯Ê±×°ÎäÆ÷±³°ü
    curPack = curPlayer.GetItemManager().GetPack(packType)
    #ĬÈÏ14¸ñ×Ó + ¿ªÆôµÄ
    count = ChConfig.Def_PackCnt_WeaponCoat + curPlayer.NomalDictGetProperty(keyName)
    curPack.SetCount(count)
    
    #֪ͨ¿Í»§¶Ë
    curPack.Sync_PackCanUseCount()
    return
 
#---------------------------------------------------------------------
def IsInOperationAction(curPlayer, actName, actIDKey, crossActName="", crossActIDKey=""):
    ## Íæ¼ÒÊÇ·ñÓÐÕýÔÚ½øÐÐÖÐÔËÓª»î¶¯£¬²»º¬²ÎÓë½áÊø½×¶Î
    
    if crossActName and crossActIDKey:
        playerActID = curPlayer.NomalDictGetProperty(crossActIDKey)
        actInfo = CrossRealmPlayer.GetPlayerCrossActInfo(curPlayer, crossActName)
        actID = actInfo.get(ShareDefine.ActKey_ID, 0)
        cfgID = actInfo.get(ShareDefine.ActKey_CfgID, 0)
        state = actInfo.get(ShareDefine.ActKey_State, 0)
        stateJoin = actInfo.get(ShareDefine.ActKey_StateJoin, 0)
        if state and stateJoin != ShareDefine.ActStateJoin_End and actID == playerActID:
            GameWorld.DebugLog("%s»î¶¯Íæ¼ÒÕýÔÚ²ÎÓëÖÐ! cfgID=%s,actID=%s,stateJoin=%s" 
                               % (crossActName, cfgID, actID, stateJoin), curPlayer.GetPlayerID())
            return True
        
    for actInfo in PyGameData.g_operationActionDict.get(actName, {}).values():
        actNum = actInfo.get(ShareDefine.ActKey_ActNum, 0)
        actID = actInfo.get(ShareDefine.ActKey_ID, 0)
        state = actInfo.get(ShareDefine.ActKey_State, 0)
        stateJoin = actInfo.get(ShareDefine.ActKey_StateJoin, 0)
        playerActID = curPlayer.NomalDictGetProperty(actIDKey % actNum)
        if state and stateJoin != ShareDefine.ActStateJoin_End and actID == playerActID:
            GameWorld.DebugLog("%sÍæ¼ÒÕýÔÚ²ÎÓëÖÐ! actNum=%s,actID=%s,stateJoin=%s" 
                               % (actName, actNum, actID, stateJoin), curPlayer.GetPlayerID())
            return True
        
    return False
 
def RefreshOperationAction_ExpRate():
    playerManager = GameWorld.GetPlayerManager()
    for i in xrange(playerManager.GetPlayerCount()):
        curPlayer = playerManager.GetPlayerByIndex(i)
        if curPlayer == None or not curPlayer.GetInitOK():
            continue
        Sync_ExpRateChange(curPlayer)
    return
 
##Í¨ÖªÍæ¼Ò¾­Ñé±¶ÂÊ
# @param curPlayer Íæ¼ÒʵÀý
# @return ·µ»ØÖµÎÞÒâÒå
# @remarks Í¨ÖªÍæ¼Ò¾­Ñé±¶ÂÊ
def Sync_ExpRateChange(curPlayer):
    totalExpRate = GetPlayerExpRate(curPlayer)
    fightExpRate = curPlayer.GetFightExpRate() # ÏµÍ³¼°¹¦ÄÜÀÛ¼Ó
    fightExpRate += PlayerWorldAverageLv.GetWorldAverageLvExpRate(curPlayer) # ÊÀ½çµÈ¼¶
    fightExpRate += PlayerVip.GetPrivilegeValue(curPlayer, ChConfig.VIPPrivilege_FightExpRate) # VIP¼Ó³É
    fightExpRate += PlayerGoldInvest.GetAddFightExpRate(curPlayer)
    
    actExpRateInfo = PyGameData.g_operationActionDict.get(ShareDefine.OperationActionName_ExpRate, {})# ¶à±¶¾­Ñé»î¶¯¼Ó³É
    if not PlayerTJG.GetIsTJG(curPlayer) and actExpRateInfo.get(ShareDefine.ActKey_State):
        actExpIpyData = IpyGameDataPY.GetIpyGameData("ActExpRate", actExpRateInfo.get(ShareDefine.ActKey_CfgID))
        if actExpIpyData and curPlayer.GetLV() >= actExpIpyData.GetLVLimit():
            fightExpRate += actExpIpyData.GetAddExpRate()
            
    if curPlayer.GetMapID() not in [ChConfig.Def_FBMapID_FamilyInvade]: #ÊØÎÀÈ˻ʲ»¼Ó×é¶Ó¼Ó³É
        fightExpRate += curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_TeamExpRate) # ×é¶Ó
    
    #µØÍ¼¶à±¶¾­Ñé¼Ó³É£¬Ä¬ÈÏÊÇ1±¶²»¼Ó³É
    mapExpAddMultiple = max(0, FBCommon.GetAreaRewardMultiple(curPlayer) - 1)
    fightExpRate += mapExpAddMultiple * ChConfig.Def_MaxRateValue
    
    if totalExpRate != fightExpRate:
        curPlayer.SetDict(ChConfig.Def_PlayerKey_TotalExpRate, fightExpRate)
        curPlayer.Sync_CurExpRate(fightExpRate)
    return
 
##»ñÈ¡Íæ¼ÒµÄ¾­Ñé±¶ÂÊ
def GetPlayerExpRate(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_TotalExpRate)
def GetLimitExpRate(curPlayer, limitType=None):
    ''' »ñÈ¡ÊÜÏÞ¹¦ÄÜ×ܾ­Ñé±¶ÂÊ
    @param limitType: ÊÜÏ޵ŦÄÜÀàÐÍ
    '''
    totalExpRate = GetPlayerExpRate(curPlayer)
    if limitType == None:
        return totalExpRate
    
    # ¿Û³ýÔöÖµbuffÖжÔÓ¦ÏÞÖÆµÄ¼Ó³É
    buffState = curPlayer.GetIncBuff()
    for i in xrange(buffState.GetBuffCount()):
        curBuff = buffState.GetBuff(i)
        buffSkill = curBuff.GetSkill()
        for j in range(buffSkill.GetEffectCount()):
            curEffect = buffSkill.GetEffect(j)
            effectID = curEffect.GetEffectID()
            if effectID == 0:
                break
            
            if effectID != ChConfig.TYPE_Calc_AttrFightExpRate:
                continue
            
            effExpRate = curEffect.GetEffectValue(0)
            calcType = curEffect.GetEffectValue(1)
            limitTypeValue = curEffect.GetEffectValue(2) # °´Î»¼ÆËã
            
            if calcType != ChConfig.EffCalcType_LinePlus or not limitTypeValue:
                continue
            
            if limitTypeValue & pow(2, limitType):
                totalExpRate -= effExpRate
                
    return totalExpRate
 
##¼ÇÂ¼Íæ¼Òʧȥ½ðÇ®µÄÁ÷Ïò¼Ç¼£¬ÏûÏ¢Öлá¼ÇÂ¼Íæ¼ÒÓµÓеĽðÇ®ÐÅÏ¢
# @param curPlayer Íæ¼ÒʵÀý
# @param moneyType ½ðÇ®ÀàÐÍ
# @param logIndex Á÷Ïò¼Ç¼Ë÷Òý
# @param tagID ÔÚ´ËÓÃÓÚ¼ÇÂ¼ÌØ±ð±êʶ(ÎïÆ·ID£©
# @param par ÔÚ´ËÓÃÓڼǼ½ð¶î
# @param msg ¼ÇÂ¼ÌØ±ðµÄÐÅÏ¢
# @return None 
def DataServerMoneyLog(curPlayer, moneyType, logIndex, tagID=0, par=0, msg=""):
    return
 
#===============================================================================
#---Íæ¼ÒÀ©Õ¹×Ö¶Î---
 
#---À©Õ¹×Ö¶Î2,3,5,9,12,13,14---
#---À©Õ¹×Ö¶Î1-Ö°Òµ½×¼¶£»4-µ±Ç°·À»¤Öµ£»6-Í­Ç®µã£»7-SPÕæÆøÖµ£»8-SPÕæÆøÖµÀ©Õ¹µã£»10-¿ç·þÔ¤ÈüÅÅλ£»11-¹Ù¾ôÐǼ¶£»---
# SetExAttr1 ~ SetExAttr14(DWORD uiExAttr10, bool bNotifyAll = false, bool bNotifyGameServer = false)
# @param bNotifyAll: ÊÇ·ñ¹ã²¥ËùÖÜÎ§Íæ¼Ò£¬Ä¬ÈÏfalse£¬Ö»»á·¢¸ø×Ô¼º
# @param bNotifyGameServer: ÊÇ·ñͬ²½GameServer£¬Ä¬ÈÏfalse
# SetExAttr15 ~ SetExAttr20(DWORD uiExAttr15) 
#     15~20À©Õ¹ÊôÐÔͬ²½·â°ü£º0309 Ñ¡½ÇµÇ¼¼ò¶ÌÐÅÏ¢¡¢0434 ÖÜÎ§Íæ¼Ò³öÏÖ¡¢0102 µÇ¼µØÍ¼Íæ¼ÒÐÅÏ¢£»
#     Í¬²½Ç°¶Ë¼°GameServerÐèÒª×Ô¼ºÐ´Í¨Öª£¬ÉèÖú¯Êý×ÔÉí²»´øÍ¨Öª²ÎÊý
#
# ·¢ËÍ0418°ü
# SendPropertyRefresh(int inputType, int inputValue, int inputValueEx, bool boardCast, bool includeSelf = true)
# @param : boardCast-ÊÇ·ñ¹ã²¥ÖÜÎ§Íæ¼Ò£»includeSelf-ÊÇ·ñ°üº¬×Ô¼º
#
# Í¨ÖªGsmeServer; 
# SendGameServerRefreshState(int inputType, int inputValue, int inputValueEx)
 
def SendPropertyRefresh(curPlayer, inputType, value, boardCast=False):
    ''' ·¢ËÍ0418°ü
    @param boardCast: ÊÇ·ñ¹ã²¥ÖÜÎ§Íæ¼Ò£¬Ò»¶¨»á·¢¸ø×Ô¼º
    '''
    curPlayer.SendPropertyRefresh(inputType, value % ShareDefine.Def_PerPointValue, value / ShareDefine.Def_PerPointValue, boardCast)
    return
 
def SendGameServerRefreshState(curPlayer, inputType, value):
    ## Í¬²½ÊôÐÔµ½GameServer IPY_GRefreshPlayerProperty
    curPlayer.SendGameServerRefreshState(inputType, value % ShareDefine.Def_PerPointValue, value / ShareDefine.Def_PerPointValue)
    return
 
# ½ûÑԠ֪ͨgameServer
def SetGMForbidenTalk(curPlayer, value):
    ''' ÉèÖÃÊÇ·ñ½ûÑÔ
    @param value: 0-½â½û£»1-½ûÑÔ£»2-½ûÉ豸£»3-½âÉ豸
    
    ½ûÉ豸Á÷³Ì
    1.ÏÈÉèÖÃ2֪ͨǰ¶ËдÈë½ûÉ豸¼Ç¼£¨Ç°¶Ë´¦Àíµ±Îª2ʱ±¾µØÉ豸±ê¼ÇΪ½ûÉ豸£© 
    2.ÔÙÉèÖÃ1£¬´Ëʱǰºó¶Ë״̬¾ùΪ1£¬¼´½ÇÉ«½ûÑÔ
    
    ½â½ûÉ豸Á÷³Ì
    1.ÏÈÉèÖÃ3֪ͨǰ¶Ëɾ³ý½ûÉ豸¼Ç¼
    2.ÔÙÉèÖÃ0£¬´Ëʱǰºó¶Ë״̬¾ùΪ1£¬¼´½ÇÉ«½â½û
    '''
    __SetGMForbidenTalkValue(curPlayer, value)
    
    #ͬ²½ÉèÖÃÀëÏßDBÍæ¼ÒÕ˺Å״ֵ̬
    accState = curPlayer.GetAccState()
    if value == 2:
        accState = accState | pow(2, ChConfig.Def_PysForbidTalkDevice)
        accState = accState | pow(2, ChConfig.Def_PysForbidTalk)
    elif value == 1:
        accState = accState | pow(2, ChConfig.Def_PysForbidTalk)
    elif value == 3:
        if (accState & pow(2, ChConfig.Def_PysForbidTalkDevice)):
            accState = accState ^ pow(2, ChConfig.Def_PysForbidTalkDevice)
        if (accState & pow(2, ChConfig.Def_PysForbidTalk)):
            accState = accState ^ pow(2, ChConfig.Def_PysForbidTalk)
    elif (accState & pow(2, ChConfig.Def_PysForbidTalk)) > 0:
        accState = accState ^ pow(2, ChConfig.Def_PysForbidTalk)
    SetPlayerAccState(curPlayer, accState)
    return
 
def __SetGMForbidenTalkValue(curPlayer, value):
    curPlayer.SetGMForbidenTalk(value)
    SendGameServerRefreshState(curPlayer, ShareDefine.CDBPlayerRefresh_ForbidenTalk, value)
    SendPropertyRefresh(curPlayer, ShareDefine.CDBPlayerRefresh_ForbidenTalk, value)
    GameWorld.DebugLog("__SetGMForbidenTalkValue %s" % value, curPlayer.GetPlayerID())
    return
 
def SetPlayerAccState(curPlayer, accState):
    curPlayer.SetAccState(accState)
    curPlayer.SetExAttr17(accState) # Í¬²½ÉèÖøÃÖµ 0309 ·â°üµÇ¼ʱÐèÒªÓõ½
    SendGameServerRefreshState(curPlayer, ShareDefine.CDBPlayerRefresh_ExAttr17, accState)
    SendPropertyRefresh(curPlayer, ShareDefine.CDBPlayerRefresh_ExAttr17, accState)
    GameWorld.DebugLog("SetPlayerAccState %s" % (accState), curPlayer.GetPlayerID())
    return
 
def DoGMForbidenTalkOnLogin(curPlayer):
    ## ÀëÏßʱ±»½ûÑÔ£¬´ËʱDBµÄÕ˺Å״ֵ̬Ϊ½ûÑÔ״̬£¬µ«ÊÇGMOperÔÝʱûÓнûÑÔ²Ù×÷ÃüÁ¹ÊÉÏÏßʱ¼ì²éÉèÖÃÏÂÀëÏß½ûÑÔ״̬
    ## Ä¿Ç°ÀëÏßʱ±»½ûÑԵģ¬ÔÝʱֻ´¦ÀíAccState ExAttr17, GMOperÃüÁîÔݲ»´¦Àí£¬ËùÒÔΪÓÀ¾Ã½ûÑÔ
    
    if curPlayer.GetAccState() & pow(2, ChConfig.Def_PysForbidTalkDevice):
        GameWorld.Log("ÉÏÏßʱ½ÇɫΪ±»É豸½ûÑÔ״̬!", curPlayer.GetPlayerID())
        __SetGMForbidenTalkValue(curPlayer, 2)
        __SetGMForbidenTalkValue(curPlayer, 1)
    elif curPlayer.GetAccState() & pow(2, ChConfig.Def_PysForbidTalk):
        GameWorld.Log("ÉÏÏßʱ½ÇɫΪ±»½ûÑÔ״̬!", curPlayer.GetPlayerID())
        __SetGMForbidenTalkValue(curPlayer, 1)
    else:
        SendPropertyRefresh(curPlayer, ShareDefine.CDBPlayerRefresh_ForbidenTalk, 0)
    return
 
## Ð­ÖúÄ¿±êÍæ¼ÒID
def SetAssistTagPlayerID(curPlayer, value):
    curPlayer.SetExAttr1(value, True, False) # ²»Í¨ÖªGameServer
    NPCHurtManager.OnSetAssistTagPlayerID(curPlayer, value)
    return
def GetAssistTagPlayerID(curPlayer): return curPlayer.GetExAttr1()
 
## ¶ÓÎéÏà¹ØÉóºË¿ª¹Ø×´Ì¬, joinReqCheck-Èë¶ÓÉêÇëÊÇ·ñÐèÒªÉóºË; inviteCheck-×é¶ÓÑûÇëÊÇ·ñÐèÒªÉóºË;
def SetTeamCheckStateEx(curPlayer, joinReqCheck, inviteCheck): return SetTeamCheckState(curPlayer, joinReqCheck * 10 + inviteCheck)
def SetTeamCheckState(curPlayer, checkState): return curPlayer.SetExAttr2(checkState, False, True)
def GetTeamCheckState(curPlayer): return curPlayer.GetExAttr2()
 
## ¸±±¾¹¦ÄÜÏß·ID, ÕâÀï×ödb´æ´¢£¬·ÀÖ¹Ôںϲ¢µØÍ¼¸±±¾ÖеôÏßÖØÉÏʱǰ¶ËÎÞ·¨¼ÓÔØÕýÈ·µÄ³¡¾°×ÊÔ´£¬µÇ¼¼ÓÔØ³¡¾°Ê±»úΪ0102°ü
def SetFBFuncLineID(curPlayer, funcLineID): return curPlayer.SetExAttr3(funcLineID, False, True)
def GetFBFuncLineID(curPlayer): return curPlayer.GetExAttr3()
 
## ¿ç·þ״̬ËùÔÚµØÍ¼ID: 0-·Ç¿ç·þ״̬£¬·Ç0-¿ç·þ״̬¶ÔÓ¦µÄµØÍ¼ID
def GetCrossMapID(curPlayer): return curPlayer.GetExAttr5()
def SetCrossMapID(curPlayer, value):
    curPlayer.SetExAttr5(value, False, True)
    if not value:
        CrossPlayerData.ClearCrossSyncDataCache(curPlayer)
    return
 
## Ç°¶Ë×Ô¶¨Ò峡¾°
def GetCustomMapID(curPlayer): return curPlayer.GetExAttr14() / 1000
def GetCustomLineID(curPlayer): return curPlayer.GetExAttr14() % 1000
## ×Ô¶¨Ò峡¾°ºó¶ËÅжÏÒѽáËãºóÐèÖ±½ÓÖØÖÃΪ0£¬·Àֹǰ¶ËûÓÐÍ˳ö³¡¾°Ö±½ÓÏÂÏßµ¼ÖÂÊý¾ÝûÓÐÖØÖ㬿ÉÄÜÒý·¢¿ÉÒÔÖØ¸´½ø
def SetCustomMap(curPlayer, mapID, lineID):
    value = mapID * 1000 + lineID
    if value != curPlayer.GetExAttr14():
        curPlayer.SetExAttr14(value, False, True)
    return
 
## Í­Ç®µã, Ö§³ÖÍ­Ç®³¬20ÒÚ
def GetSilver(curPlayer): return curPlayer.GetExAttr6() * ChConfig.Def_PerPointValue + curPlayer.GetSilver()
def SetSilver(curPlayer, totalSilver):
    silver = totalSilver % ChConfig.Def_PerPointValue
    silverPoint = min(totalSilver / ChConfig.Def_PerPointValue, ChConfig.Def_UpperLimit_DWord)
    if silver != curPlayer.GetSilver():
        curPlayer.SetSilver(silver)
    if silverPoint != curPlayer.GetExAttr6():
        curPlayer.SetExAttr6(silverPoint)
    return
 
##VIPµ½ÆÚʱ¼ä, ÐèҪͬ²½GameServer
def GetVIPExpireTime(curPlayer): return 0
def SetVIPExpireTime(curPlayer, expireTime): return
 
##×î½üÒ»´ÎÌáÉýVIPµÈ¼¶Ê±¼ä
def GetVIPLVUpTime(curPlayer): return curPlayer.GetExAttr9()
def SetVIPLVUpTime(curPlayer, lvUpTime): return curPlayer.SetExAttr9(lvUpTime, False, True)
 
##ÁÄÌìÆøÅÝ¿ò
def GetChatBubbleBox(curPlayer): return curPlayer.GetExAttr10()
def SetChatBubbleBox(curPlayer, value): return curPlayer.SetExAttr10(value, False, True)
 
##ÓÎÏ·³äÖµÖ§¸¶´ú±Ò
def GetPayCoinTotal(curPlayer): return GetPayCoin(curPlayer) + GetPlayerCurrency(curPlayer, ShareDefine.TYPE_Price_PayCoinDay)
def GetPayCoin(curPlayer): return curPlayer.GetExAttr11()
def SetPayCoin(curPlayer, value): return curPlayer.SetExAttr11(min(value, ChConfig.Def_UpperLimit_DWord), False, False)
def PayCoinOnDay(curPlayer):
    # Ã¿ÈÕ¹ýÌìÇå³ýʱЧ´ú±Ò
    payCoinDay = GetPlayerCurrency(curPlayer, ShareDefine.TYPE_Price_PayCoinDay)
    if payCoinDay > 0:
        PayMoney(curPlayer, ShareDefine.TYPE_Price_PayCoin, payCoinDay, "PayCoinOnDay")
    return
 
## »ñÈ¡Åå´÷µÄ³ÆºÅID
def GetTitleID(curPlayer):
    curDienstgradMgr = curPlayer.GetDienstgradManager()
    return curDienstgradMgr.GetCurGradID()
 
##°éÂÂ
def GetCoupleID(curPlayer):
    coupleInfo = GetCoupleInfo(curPlayer.GetPlayerID())
    return coupleInfo[0] if coupleInfo else 0
def GetCoupleName(curPlayer):
    coupleInfo = GetCoupleInfo(curPlayer.GetPlayerID())
    return coupleInfo[1] if coupleInfo else ""
def GetCoupleJob(curPlayer):
    coupleInfo = GetCoupleInfo(curPlayer.GetPlayerID())
    return coupleInfo[2] if coupleInfo else 1
def GetBridePriceMaxID(curPlayer):
    coupleInfo = GetCoupleInfo(curPlayer.GetPlayerID())
    return coupleInfo[3] if coupleInfo else 0
def GetCoupleInfo(playerID):
    if playerID not in PyGameData.g_coupleInfo:
        return
    return PyGameData.g_coupleInfo[playerID]
def SetCoupleInfo(playerID, coupleInfo):
    if not coupleInfo:
        PyGameData.g_coupleInfo.pop(playerID, None)
    else:
        PyGameData.g_coupleInfo[playerID] = coupleInfo
    return
 
## Íæ¼ÒËùÊô·þÎñÆ÷×éID
def GetPlayerServerGroupID(curPlayer): return curPlayer.GetExAttr13()
def UpdPlayerServerGroupID(curPlayer):
    # ¸üÐÂ×Ô¼ºµÄ·þÎñÆ÷×éID, ¿ç·þ·þÎñÆ÷²»´¦Àí
    if GameWorld.IsCrossServer():
        return
    serverGroupID = GameWorld.GetServerGroupID()
    if not serverGroupID:
        return
    playerServerGroupID = curPlayer.GetExAttr13()
    if playerServerGroupID != serverGroupID:
        curPlayer.SetExAttr13(serverGroupID, False, True)
        GameWorld.DebugLog("¸üÐÂÍæ¼ÒËùÊô·þÎñÆ÷×éID: serverGroupID=%s" % serverGroupID)
    return
 
##Ó°ÏìÍâ¹ÛµÄ3²¿Î»Ë÷Òý¼Ç¼ 123456789  123:ÎäÆ÷¸ñ×ÓË÷Òý 456£º¸±ÊÖ  789£ºÒ·þ
def GetFaceEquipIndexList(curPlayer):
    attr15 = curPlayer.GetExAttr15()
    return [attr15%1000, attr15/1000%1000, attr15/1000000]
def SetFaceEquipIndex(curPlayer, value): return curPlayer.SetExAttr15(value)
 
# ·µ»Ø×î´óµÄÁé¸ùϵ
def GetLingGenMaxIndex(curPlayer):
    return curPlayer.GetExAttr16()
 
def SetLingGenMaxIndex(curPlayer):
    indexList = [
                    ShareDefine.Def_Effect_Metal, # ½ð
                    ShareDefine.Def_Effect_Wood, # Ä¾
                    ShareDefine.Def_Effect_Water, # Ë®
                    ShareDefine.Def_Effect_Fire, # »ð
                    ShareDefine.Def_Effect_Earth, # ÍÁ
                ]
    
    
    tempList = [curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_AddPointValue % attrID) for attrID in indexList]
    
    curPlayer.SetExAttr16(indexList[tempList.index(max(tempList))])
 
# ¾³½çÄѶȵȼ¶
def GetRealmDifficulty(curPlayer): return curPlayer.GetExAttr18()
def SetRealmDifficulty(curPlayer, realmDifficulty):
    ''' ÉèÖþ³½çÄѶȵȼ¶£¬ÈκεØÍ¼¾ù¿ÉÑ¡Ôñ
    '''
    playerID = curPlayer.GetPlayerID()
    
    if realmDifficulty:
        needRealmLV = GetDifficultyRealmLV(realmDifficulty)
        curRealmLV = curPlayer.GetOfficialRank()
        if curRealmLV < needRealmLV:
            GameWorld.DebugLog("µ±Ç°¾³½çµÍÓÚ¾³½çÄѶȣ¬ÎÞ·¨Ñ¡Ôñ! curRealmLV(%s) < %s" % (curRealmLV, needRealmLV), playerID)
            return
        
        difficultyRealmList = IpyGameDataPY.GetFuncEvalCfg("RealmDifficulty", 2)
        if needRealmLV not in difficultyRealmList:
            GameWorld.ErrLog("realmDifficulty(%s) needRealmLV(%s) not in difficultyRealmList(%s)" 
                             % (realmDifficulty, needRealmLV, difficultyRealmList), playerID)
            return
        
    GameWorld.DebugLog("SetRealmDifficulty: realmDifficulty=%s" % realmDifficulty, playerID)
    realmMapIDList = IpyGameDataPY.GetFuncEvalCfg("RealmDifficulty", 1)
    mapID = curPlayer.GetMapID()
    if mapID in realmMapIDList:
        # ÏÈÒÆ³ý֮ǰѡµÄÄѶÈ
        for playerIDList in PyGameData.g_realmDiffPlayerDict.values():
            if playerID in playerIDList:
                playerIDList.remove(playerID)
                
        # ¼ÓÈëÐÂÄѶȣ¬0ÄѶȲ»´¦Àí
        if realmDifficulty:
            if realmDifficulty not in PyGameData.g_realmDiffPlayerDict:
                PyGameData.g_realmDiffPlayerDict[realmDifficulty] = []
            playerIDList = PyGameData.g_realmDiffPlayerDict[realmDifficulty]
            if playerID not in playerIDList:
                playerIDList.append(playerID)
                
        SetPlayerSightLevel(curPlayer, realmDifficulty)
        
    if curPlayer.GetExAttr18() != realmDifficulty:
        curPlayer.SetExAttr18(realmDifficulty)
        SendPropertyRefresh(curPlayer, ShareDefine.CDBPlayerRefresh_ExAttr18, realmDifficulty)
    return
def GetDifficultyRealmLV(realmDifficulty): return realmDifficulty - 100
def GetMapRealmDifficulty(curPlayer):
    ## »ñÈ¡Íæ¼ÒÔÚ±¾µØÍ¼Öеľ³½çÄѶȲ㼶£¬±ØÐëÔÚ¾³½çµØÍ¼ÇÒÓÐÑ¡Ôñ¾³½çÄѶȲÅË㣬·ñÔòΪĬÈÏ0£»¸ÃÄѶÈֵͬʱҲÊÇÊÓÒ°²ã¼¶
    realmDifficulty = GetRealmDifficulty(curPlayer)
    if not realmDifficulty:
        return 0
    mapID = curPlayer.GetMapID()
    realmMapIDList = IpyGameDataPY.GetFuncEvalCfg("RealmDifficulty", 1)
    if mapID not in realmMapIDList:
        return 0
    return realmDifficulty
 
##Íæ¼ÒÀ뿪ÏÉÃËʱ¼ä£¨Ö÷¶¯»ò±»Ìß¶¼Ë㣩
def GetLeaveFamilyTimeEx(curPlayer):return curPlayer.GetExAttr19()
def SetLeaveFamilyTimeEx(curPlayer, value):
    curPlayer.SetExAttr19(value)
    SendGameServerRefreshState(curPlayer, ShareDefine.CDBPlayerRefresh_ExAttr19, value)
    SendPropertyRefresh(curPlayer, ShareDefine.CDBPlayerRefresh_ExAttr19, value)
    return
 
##»ñµÃÍæ¼ÒÍþÍûÖµ
def GetPrestige(curPlayer): return 0
def SetPrestige(curPlayer, value): return
 
##×ÜÕ½¶·Á¦£¬Ö§³Ö³¬¹ý20E
def GetFightPower(curPlayer): return curPlayer.GetFightPowerEx() * ChConfig.Def_PerPointValue + curPlayer.GetFightPower()
def SetFightPower(curPlayer, value):
    curPlayer.SetFightPower(value % ChConfig.Def_PerPointValue, value / ChConfig.Def_PerPointValue, False) # ²»Í¨ÖªGameServer bNotifyGameServer False
    return
 
## ÉèÖÃÄ£¿éÕ½¶·Á¦£¬×î´ó20E
def SetMFPFightPower(curPlayer, mfpType, fightPower):
    curPlayer.SetDict(ChConfig.Def_PlayerKey_MFPFightPower % mfpType, min(fightPower, ChConfig.Def_UpperLimit_DWord))
    return
 
## »ñȡģ¿éÕ½¶·Á¦
def GetMFPFightPower(curPlayer, mfpType):
    return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_MFPFightPower % mfpType)
 
## ÉèÖÃÄ£¿é¸½¼ÓÕ½¶·Á¦£¬Ö§³Ö³¬¹ý20E
def SetMFPExFightPower(curPlayer, mfpType, fightPower):
    curPlayer.SetDict(ChConfig.Def_PlayerKey_MFPEx % mfpType, fightPower % ChConfig.Def_PerPointValue)
    curPlayer.SetDict(ChConfig.Def_PlayerKey_MFPExPoint % mfpType, fightPower / ChConfig.Def_PerPointValue)
    return
 
## »ñȡģ¿é¸½¼ÓÕ½¶·Á¦
def GetMFPExFightPower(curPlayer, mfpType):
    return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_MFPExPoint % mfpType) * ChConfig.Def_PerPointValue + \
        curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_MFPEx % mfpType)
#===============================================================================
##»ñÈ¡Íæ¼Ò·ÖÏßÐÅÏ¢
# @param curPlayer Íæ¼ÒʵÀý
# @return Íæ¼Òµ±Ç°·ÖÏßID
# @remarks 
def GetPlayerLineID(curPlayer):
    return curPlayer.GetLineID() + 1
 
 
##ÊÓÒ°ÑéÖ¤, Íâ¹ÒÊÓÒ°±äС²»»Ö¸´
# @param curPlayer Íæ¼ÒʵÀý
# @param sight ÊÓÒ°·¶Î§
# @return ÎÞÒâÒå
def SetSight(curPlayer, sight):
    import QuestCommon
    firstMission = QuestCommon.GetCommonMission(curPlayer)
    if firstMission and firstMission.GetProperty(QuestCommon.Def_NewGuyNoSight) == 1:
        curPlayer.SetSight(0)
        return
    
    #Íâ¹ÒºÅ ÊÓÒ°ÑéÖ¤
    if curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_AutoCheckHack_State) \
                                      == ChConfig.Def_AutoCheck_State_Danger:
        
        if curPlayer.GetSight() > sight:
            curPlayer.SetSight(sight)
        
        return
    
    curPlayer.SetSight(sight)
 
##»ñÈ¡¹¥»÷¼ä¸ô
# @param curPlayer Íæ¼ÒʵÀý
# @return ¹¥»÷¼ä¸ô
def GetAtkInterval(curPlayer):
    atkInterval = curPlayer.GetAtkInterval()
    
    #Íâ¹ÒºÅ ¹¥»÷¼ä¸ôÑéÖ¤
    if curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_AutoCheckHack_State) \
                                      == ChConfig.Def_AutoCheck_State_Danger:
        atkInterval *= 100
    
    return atkInterval
 
def AddZhenQiByKillNPC(curPlayer, npcSP, killCount=1):
    ## É±¹Ö¼ÓÕæÆø
    if not npcSP:
        return
    addSPValue = npcSP * killCount
    npcSPRate = PlayerVip.GetPrivilegeValue(curPlayer, ChConfig.VIPPrivilege_NPCSPRate)
    
    if npcSPRate:
        npcHPRate = ChConfig.Def_MaxRateValue + npcSPRate
        addSPValue = int(addSPValue * npcHPRate / float(ChConfig.Def_MaxRateValue))
    PlayerAddZhenQi(curPlayer, addSPValue)
    return
 
##Íæ¼ÒÔö¼ÓÕæÆø
# @param curPlayer Íæ¼Ò
# @param value Ôö¼ÓÊýÖµ
# @param canOverbrim ¿É·ñÒç³ö(ĬÈϲ»ÐÐ) 
# @param isSysMsg ÊÇ·ñϵͳÌáʾ(ĬÈÏÐèÒª) 
# @return None
def PlayerAddZhenQi(curPlayer, addValue, canOverbrim=False, isSysMsg=True, eventName="unknown", eventData=""):
    if addValue <= 0:
        return True
    
    curZhenQi = GetZhenQi(curPlayer)  # µ±Ç°ÕæÆø
    
    value = curZhenQi + addValue
    
    if value == curZhenQi:
        #ÕæÆøÖµÃ»Óиıä
        return False
    
    #===============================================================================================
    # if isSysMsg:
    #    #GeRen_chenxin_254483:»ñµÃÕæÆøÖµXXµã
    #    NotifyCode(curPlayer, "GeRen_chenxin_254483", [addValue])
    #===============================================================================================
    
    SetZhenQi(curPlayer, value)
    #EventReport.WriteEvent_add_zhenqi(curPlayer, eventName, eventData, addValue, value)
    return True
 
 
##Íæ¼Ò¼õÉÙÕæÆø
# @param curPlayer Íæ¼Ò
# @param lostValue ¼õÉÙÊýÖµ
# @return None
def PlayerLostZhenQi(curPlayer, lostValue, eventName="unknown", eventData=""):
    if lostValue <= 0:
        return True
    
    curZhenQi = GetZhenQi(curPlayer)  # µ±Ç°ÕæÆø
    
    value = max(0, curZhenQi - lostValue)
    if value < 0:
        GameWorld.ErrLog("curZhenQi = %s, lostValue = %s" % (curZhenQi, lostValue))
        return False
    
    #GeRen_chenxin_365899:ÏûºÄÕæÆøÖµXXµã.
    #NotifyCode(curPlayer, "GeRen_chenxin_365899", [lostValue])
    
    SetZhenQi(curPlayer, value)
    
    #EventReport.WriteEvent_lost_zhenqi(curPlayer, eventName, eventData, lostValue, value)
    return True
 
## SPÕæÆøÖµ - ÔÝ·ÏÆú ExAttr7¡¢ExAttr8 ¸ÄΪר¾«Ñ¡Ôñ֪ͨ£¬ÓÃÓÚǰ¶Ë±íÏÖÆäËûÍæ¼ÒµÄ²»Í¬×¨¾«ÌØÐ§
def GetZhenQi(curPlayer): return 0 #curPlayer.GetExAttr8() * ChConfig.Def_PerPointValue + curPlayer.GetExAttr7()
def SetZhenQi(curPlayer, totalZhenQi):
#    zhenQi = totalZhenQi % ChConfig.Def_PerPointValue
#    zhenQiPoint = min(totalZhenQi / ChConfig.Def_PerPointValue, ChConfig.Def_UpperLimit_DWord)
#    # Íæ¼Òµ¥¶À֪ͨ£¬²»¹ã²¥; c++½Ó¿ÚĬÈϹ㲥£¬¹ÊÕâÀïÉèÖÃFalse
#    if zhenQi != curPlayer.GetExAttr7():
#        curPlayer.SetExAttr7(zhenQi)
#    if zhenQiPoint != curPlayer.GetExAttr8():
#        curPlayer.SetExAttr8(zhenQiPoint)
    return
 
#===============================================================================
# #@warning: ExAttr6~ExAttr10, ÐÂÔö2¸ö²¼¶ûĬÈϲÎÊý, ÊÇ·ñ֪ͨ¿Í»§¶Ë, ÊÇ·ñ֪ͨGameServer, Ä¬ÈÏֵΪFalse
#===============================================================================
#---------------------------------------------------------------------------
 
##»ñÈ¡¿ÉÃâ·Ñ¿ªÆôµÄ¸ñ×ÓÊý
# @param curPlayer Íæ¼Ò¶ÔÏó
# @param packType ±³°üÀàÐÍ
# @param openCnt Êµ¼ÊÒª¿ªÆôµÄ¸ñ×ÓÊý
# @return »ñÈ¡¿ÉÃâ·Ñ¿ªÆôµÄ¸ñ×ÓÊý
def GetCanAutoOpenPackCount(curPlayer, packType, openCnt, tick):
    if packType not in [IPY_GameWorld.rptItem, IPY_GameWorld.rptWarehouse]:
        return 0
    cfgObj = PlayerExpandPackCfgMgr.GetExpandPackCfg(curPlayer, packType)
    #ÕÒ²»µ½ÕâÖÖ±³°üµÄÅäÖÃÐÅÏ¢¶ÔÏó
    if not cfgObj:
        return 0
    #ÒѹºÂò»ò×Ô¶¯¿ªÆôµÄ¸ñ×ÓÊý
    keyName = ChConfig.Def_Type_CanBuyPack_PlayerDict[packType][ChConfig.Def_PlayerPackDict_Index_Key]
    curCount = curPlayer.NomalDictGetProperty(keyName)
    
#    nextCountIndex = curCount + 1
#    infoObj = cfgObj.GetAttrInfoByInex(nextCountIndex)
#    if None == infoObj:
#        return 0
#    #¸üÐÂÏÂÍæ¼ÒµÄÔÚÏßʱ¼ä
#    UpdateOnLineTime(curPlayer, tick)
#    onlineTime = curPlayer.GetOnlineTime()
#    #ÐèÒªµÄʱ¼ä
#    needOnlineTime = infoObj["OnlineTime"]
#    #×îºóÒ»´Î×Ô¶¯¿ªÆô±³°üµÄÔÚÏßʱ¼ätick
#    lastAutoOpenPackTick = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_LastAutoOpenPackTick)
#    if onlineTime - lastAutoOpenPackTick > needOnlineTime:
#        return 1
#    return 0
    
    #×î´ó¿ÉÔö¼ÓµÄ±³°üÊý
    maxCanAddCount = cfgObj.GetCanAddCount()
    forCount = min(openCnt, maxCanAddCount - curCount)
    
    #¿ÉÒÔÔÙÔö¼ÓµÄ¸ñ×ÓÊý
    count = 0
    #±éÀú¿ÉÔö¼ÓµÄ±³°ü¸ñ×ÓÊý
    UpdateOnLineTime(curPlayer, tick)
    onlineTime = curPlayer.GetOnlineTime()
    lastAutoOpenPackTick = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_LastAutoOpenPackTick % packType)
    lastInfoObj = cfgObj.GetTotalAddAttrInfoByCount(curCount)
    notOnlineTime = 0
    if lastInfoObj:
        notOnlineTime = lastInfoObj["OnlineTime"]
#    GameWorld.Log("get online time = %s"%onlineTime)
    for i in range(forCount):
        nextCount = curCount + i + 1
        infoObj = cfgObj.GetTotalAddAttrInfoByCount(nextCount)
        if None == infoObj:
            break
        # (СÓÚ0µÄ²»¾ßÓÐÃâ·Ñ¿ªÆô¹¦ÄÜ)
        if infoObj["OnlineTime"] < 0:
            continue
        needOnlineTime = infoObj["OnlineTime"] - notOnlineTime
#        GameWorld.Log("get need online time = %s"%needOnlineTime)
        #ÒªÇóµÄÔÚÏßʱ¼ä,´óÓÚµ±Ç°µÄÔÚÏßʱ¼ä,û°ì·¨¼Ó±³°ü¸ñ×Ó
        if needOnlineTime > onlineTime - lastAutoOpenPackTick:
            break
        count += 1
    return count
 
 
 
## »ñÈ¡½Ú¼ÙÈÕ¾­Ñé¼Ó³É
#  @param curPlayer: Íæ¼ÒʵÀý
#  @return: ½Ú¼ÙÈÕ¾­Ñé¼Ó³É
def GetHolidayExpRate(curPlayer):
    return 0
 
 
## »ñÈ¡ÊÀ½çboss¾­Ñé¼Ó³É
#  @param curPlayer: Íæ¼ÒʵÀý
#  @return: ÊÀ½çboss¾­Ñé¼Ó³É
def GetWorldBossExpRate(curPlayer):
    return 0
 
## »ñÈ¡Íæ¼Òµ±Ç°µÈ¼¶Éý¼¶ËùÐè×ܾ­Ñé
#  @param playerLv Íæ¼ÒµÈ¼¶
#  @return ·µ»ØÖµ, Éý¼¶ÐèÒªµÄ×ܾ­Ñé
def GetLVUPTotalNeedExp(curPlayer):
    curLV = curPlayer.GetLV()
    #if curLV >= IpyGameDataPY.GetFuncCfg("PlayerMaxLV") and PlayerGreatMaster.IsGreatMasterOpen(curPlayer):
    #    return PlayerGreatMaster.GetTotalExpByGreatMasterLV(curPlayer.GetLV2())
    
    return GetTotalExpByPlayerLv(curLV)
 
## ¸ù¾ÝµÈ¼¶»ñµÃÉý¼¶ÐèÒªµÄ×ܾ­Ñé
#  @param playerLv Íæ¼ÒµÈ¼¶
#  @return ·µ»ØÖµ, Éý¼¶ÐèÒªµÄ×ܾ­Ñé
def GetTotalExpByPlayerLv(playerLV):
    lvIpyData = GetPlayerLVIpyData(playerLV)
    if not lvIpyData:
        return 0
    return GetLVUPTotalExpNeed(lvIpyData)
 
def GetPlayerLVIpyData(playerLV):
    lvIpyData = IpyGameDataPY.GetIpyGameData("PlayerLV", playerLV)
    if not lvIpyData:
        GameWorld.ErrLog("¾­Ñé±íÒì³£  lv= %s" % playerLV)
        return
    return lvIpyData
 
def GetLVUPTotalExpNeed(lvIpyData):
    if not lvIpyData:
        return 0
    return lvIpyData.GetExpPoint() * ChConfig.Def_PerPointValue + lvIpyData.GetExp()
 
## »ñµÃÍæ¼Òʵ¼ÊµÈ¼¶
#  @param curPlayer Íæ¼Ò
#  @return Íæ¼Òʵ¼ÊµÈ¼¶
def GetRealPlayerLv(curPlayer):
    #µ±Ç°µÈ¼¶
    realPlayerLv = curPlayer.GetLV()
    #µ±Ç°Íæ¼Ò×ܾ­Ñé
    curTotalExp = GetPlayerTotalExp(curPlayer)
    return GetRealPlayerLvEx(realPlayerLv, curTotalExp)
 
## »ñµÃÍæ¼Òʵ¼ÊµÈ¼¶
#  @param realPlayerLv µ±Ç°µÈ¼¶
#  @param curTotalExp ×ܾ­Ñé
#  @return Íæ¼Òʵ¼ÊµÈ¼¶
def GetRealPlayerLvEx(realPlayerLv, curTotalExp):
    #Éý¼¶ËùÐè×ܾ­Ñé
    needTotalExp = GetTotalExpByPlayerLv(realPlayerLv)
    if not needTotalExp:
        return realPlayerLv
    
    #Ä£ÄâÉý¼¶,»ñµÃʵ¼ÊµÈ¼¶
    while curTotalExp >= needTotalExp:
        realPlayerLv += 1
        curTotalExp -= needTotalExp
        needTotalExp = GetTotalExpByPlayerLv(realPlayerLv)
        if not needTotalExp:
            break
    return realPlayerLv
 
## »ñÈ¡Íæ¼Òµ±Ç°×ܾ­Ñé
def GetPlayerTotalExp(curPlayer):
    totalExp = curPlayer.GetTotalExp() # Î´ÂúÒ»¸ö¾­ÑéµãµÄ¾­Ñ飬·ÇÍæ¼Òʵ¼Ê×ܾ­Ñé
    expPoint = curPlayer.GetExpPoint()
    totalMasterExp = expPoint * ChConfig.Def_PerPointValue + totalExp
    return totalMasterExp
 
## ÉèÖÃÍæ¼Òµ±Ç°×ܾ­Ñé, ×ª»¯Îª¾­Ñéµã¼°¾­Ñé
def SetPlayerTotalExp(curPlayer, totalExp):
    curExp = totalExp % ChConfig.Def_PerPointValue
    expPoint = totalExp / ChConfig.Def_PerPointValue
    
    if curPlayer.GetExpPoint() != expPoint:
        curPlayer.SetExpPoint(expPoint)
    if curPlayer.GetTotalExp() != curExp:
        curPlayer.SetTotalExp(curExp)
    #GameWorld.DebugLog("SetPlayerTotalExp totalExp=%s,expPoint=%s,curExp=%s" 
    #                   % (totalExp, expPoint, curExp), curPlayer.GetPlayerID())
    
    return
 
#------------------------------------------------------------------------------ 
 
## Í¨ÖªÑ¡ÖÐÄ¿±ê
#  @param curPlayer: Íæ¼ÒʵÀý
#  @return None
def Sync_SelectObj(curPlayer, objType, objID, isSelect):
    selectObj = ChPyNetSendPack.tagMCNotifySelectObj()
    selectObj.Clear()
    selectObj.Type = objType
    selectObj.ID = objID
    selectObj.isSelect = isSelect
    NetPackCommon.SendFakePack(curPlayer, selectObj)
    return
 
 
## Í³¼ÆÍæ¼ÒÊôÐÔ£¬ÀÛ¼Ó
#  @param attrType ÊôÐÔÀàÐÍ£¬Ð§¹ûID»òÕß×Ö·û´®
#  @param value ÊôÐÔÖµ
#  @param allAttrList ÊôÐÔÁбí
#  @return None
def CalcAttrDict_Type(attrType, value, allAttrList):
    if value == 0:
        return
    
    #[ÊôÐÔË÷Òý, ÊÇ·ñ»ù´¡ÊôÐÔ£¬(·Ç)ÏßÐÔ]
    attrInfo = ChConfig.ItemEffect_AttrDict.get(attrType, [])
    if attrInfo == []:
        return
    
    index = ChConfig.Def_CalcAttrIndexDict[(attrInfo[1], attrInfo[2])]
    
    attrDict = allAttrList[index]
    for i in attrInfo[0]:
        GameWorld.AddDictValue(attrDict, {i:value})
    return
 
def CalcAttrDict_TypeEx(attrType, value, allAttrDict):
    ## Í³¼ÆÍæ¼ÒÊôÐÔ£¬ÀÛ¼Ó
    if value == 0:
        return
    
    #[ÊôÐÔË÷Òý, ÊÇ·ñ»ù´¡ÊôÐÔ£¬(·Ç)ÏßÐÔ]
    attrInfo = ChConfig.ItemEffect_AttrDict.get(attrType, [])
    if attrInfo == []:
        return
    for i in attrInfo[0]:
        GameWorld.AddDictValue(allAttrDict, {i:value})
    return
 
#===============================================================================
# CalcAttr_Base,
# CalcAttr_BaseNoline,
# CalcAttr_Battle,
# CalcAttr_BattleNoline,
#===============================================================================
 
# ´ÓsrcAttrList¼ÆËã³öaddAttrList´øÀ´µÄ¹Ì¶¨ÊôÐÔ£¬ÓÃÓÚºóÐø¼ÆËãʹÓÃ
#===============================================================================
# def CalcAddFuncAttrByAttrList(srcAttrList, addAttrList):
#    for addKey, addValue in addAttrList[ChConfig.CalcAttr_BaseNoline].items():
#        value = srcAttrList[ChConfig.CalcAttr_Base].get(addKey, 0)
#        if value == 0:
#            continue
#        
#        addAttrList[ChConfig.CalcAttr_Base][addKey]  = addAttrList[ChConfig.CalcAttr_Base].get(addKey, 0)\
#                                                         + value*addValue / ChConfig.Def_MaxRateValue
#    addAttrList[ChConfig.CalcAttr_BaseNoline] = {}
#    for addKey, addValue in addAttrList[ChConfig.CalcAttr_BattleNoline].items():
#        value = srcAttrList[ChConfig.CalcAttr_Battle].get(addKey, 0)
#        if value == 0:
#            continue
#        
#        addAttrList[ChConfig.CalcAttr_Battle][addKey]  = addAttrList[ChConfig.CalcAttr_Battle].get(addKey, 0)\
#                                                         + value*addValue / ChConfig.Def_MaxRateValue
#    addAttrList[ChConfig.CalcAttr_BattleNoline] = {}
#    return addAttrList
#===============================================================================
## ÅàÑø¾³½çµÈ¼¶
def GetTrainRealmLVReal(curPlayer, funcType):
    trainRealmLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TrainRealmLV % funcType)
    return max(trainRealmLV, curPlayer.GetOfficialRank())
def SetTrainRealmLV(curPlayer, funcType, trainRealmLV):
    NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TrainRealmLV % funcType, trainRealmLV)
    SyncTrainRealmLV(curPlayer, funcType)
    return
def SyncTrainRealmLV(curPlayer, funcType=None):
    if funcType == None:
        syncFuncTypeList = range(1, 1 + 10)
    else:
        syncFuncTypeList = [funcType]
    infoList = []
    for fType in syncFuncTypeList:
        trainRealmLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TrainRealmLV % fType)
        if not trainRealmLV and funcType == None:
            continue
        lvInfo = ChPyNetSendPack.tagMCTrainRealmLV()
        lvInfo.FuncType = fType
        lvInfo.TrainRealmLV = trainRealmLV
        infoList.append(lvInfo)
    if not infoList:
        return
    clientPack = ChPyNetSendPack.tagMCTrainRealmLVInfo()
    clientPack.InfoList = infoList
    clientPack.Count = len(clientPack.InfoList)
    NetPackCommon.SendFakePack(curPlayer, clientPack)
    return
 
## ÷ÈÁ¦µÈ¼¶
def GetCharmLV(curPlayer): return curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CharmLV)
def SetCharmLV(curPlayer, charmLV):
    NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CharmLV, charmLV)
    SendPropertyRefresh(curPlayer, ShareDefine.CDBPlayerRefresh_CharmLV, charmLV)
    return
 
def GetTotalLingGenPoint(curPlayer):
    # ×ÜÁé¸ùµãÊý(½ðľˮ»ðÍÁ+×ÔÓɵãÊý)
    attrIDList = [ShareDefine.Def_Effect_Metal, ShareDefine.Def_Effect_Wood, ShareDefine.Def_Effect_Water, ShareDefine.Def_Effect_Fire, ShareDefine.Def_Effect_Earth]
    curTotalPoint = 0
    for attrID in attrIDList:
        curTotalPoint += curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_AddPointValue % attrID)
    curTotalPoint += curPlayer.GetFreePoint()
    return curTotalPoint
 
# Áé¸ù - ½ðľˮ»ðÍÁ
def GetMetal(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_Metal)
def SetMetal(curPlayer, value): curPlayer.SetDict(ChConfig.Def_PlayerKey_Metal, value)
def GetWood(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_Wood)
def SetWood(curPlayer, value): curPlayer.SetDict(ChConfig.Def_PlayerKey_Wood, value)
def GetWater(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_Water)
def SetWater(curPlayer, value): curPlayer.SetDict(ChConfig.Def_PlayerKey_Water, value)
def GetFire(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_Fire)
def SetFire(curPlayer, value): curPlayer.SetDict(ChConfig.Def_PlayerKey_Fire, value)
def GetEarth(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_Earth)
def SetEarth(curPlayer, value): curPlayer.SetDict(ChConfig.Def_PlayerKey_Earth, value)
# Áé¸ùÆ·¼¶ - ½ðľˮ»ðÍÁ
def GetMetalQualityLV(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_MetalQualityLV)
def SetMetalQualityLV(curPlayer, value): curPlayer.SetDict(ChConfig.Def_PlayerKey_MetalQualityLV, value)
def GetWoodQualityLV(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_WoodQualityLV)
def SetWoodQualityLV(curPlayer, value): curPlayer.SetDict(ChConfig.Def_PlayerKey_WoodQualityLV, value)
def GetWaterQualityLV(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_WaterQualityLV)
def SetWaterQualityLV(curPlayer, value): curPlayer.SetDict(ChConfig.Def_PlayerKey_WaterQualityLV, value)
def GetFireQualityLV(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_FireQualityLV)
def SetFireQualityLV(curPlayer, value): curPlayer.SetDict(ChConfig.Def_PlayerKey_FireQualityLV, value)
def GetEarthQualityLV(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_EarthQualityLV)
def SetEarthQualityLV(curPlayer, value): curPlayer.SetDict(ChConfig.Def_PlayerKey_EarthQualityLV, value)
 
#---Íæ¼ÒÀ©Õ¹½Ó¿Ú, Õ½¶·ÊôÐÔ£¬²»´æÊý¾Ý¿â£¬Ö»Í¨Öª±¾ÈË---
 
##Íæ¼ÒÒÆ¶¯ËÙ¶ÈÖµ, ²»º¬buff¶ÔËٶȵÄÓ°Ï죻 ¹¦ÄܵȶÔËٶȵÄÓ°ÏìÖ±½Ó¸Ä±ä´ËÖµ
def GetSpeedNotBuff(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_SpeedValueNotBuff)
def SetSpeedNotBuff(curPlayer, value): curPlayer.SetDict(ChConfig.Def_PlayerKey_SpeedValueNotBuff, value)
##Íæ¼ÒÒÆ¶¯ËÙ¶ÈÖµ, º¬buff¶ÔËٶȵÄÓ°Ï죻 ´ËÊýÖµ²»ÊÇÕæÕýµÄÒÆ¶¯ËÙ¶È£¬Ö»ÊÇÓÃÓÚ¼ÆËãÒÆ¶¯ËٶȵIJÎÊýÖµ
def GetSpeedValue(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_SpeedValue)
def SetSpeedValue(curPlayer, value):
    curPlayer.SetDict(ChConfig.Def_PlayerKey_SpeedValue, value)
    SendPropertyRefresh(curPlayer, ShareDefine.CDBPlayerRefresh_SpeedValue, value, True) # Òƶ¯ËÙ¶ÈÖµÔݶ¨¹ã²¥ÖÜÎ§Íæ¼Ò
 
##»ñÈ¡Íæ¼Ò¹¥»÷ËÙ¶È£¬ÓÃÓÚ¼ÆËã¹¥»÷¼ä¸ô
# @param curPlayer Íæ¼ÒʵÀý
# @return Íæ¼Ò¹¥»÷ËÙ¶È
def GetAtkSpeed(curPlayer):
    return curPlayer.GetBattleValEx1()
 
##ÉèÖÃÍæ¼Ò¹¥»÷ËÙ¶È£¬ÓÃÓÚ¼ÆËã¹¥»÷¼ä¸ô
# @param curPlayer Íæ¼ÒʵÀý
# @return None
def SetAtkSpeed(curPlayer, value):
    curPlayer.SetBattleValEx1(value, True)
    
#---¹¥»÷»Ø¸´ÑªÁ¿±ÈÂÊ----
## »ñÈ¡Íæ¼Ò¹¥»÷»Ø¸´ÑªÁ¿±ÈÂÊ
#  @param curPlayer Íæ¼ÒʵÀý
#  @return 
def GetAtkBackHPPer(curPlayer):
    return curPlayer.GetBattleValEx2()
 
 
## ÉèÖÃÍæ¼Ò¹¥»÷»Ø¸´ÑªÁ¿±ÈÂÊ
#  @param curPlayer Íæ¼ÒʵÀý
#  @return None
def SetAtkBackHPPer(curPlayer, value):
    curPlayer.SetBattleValEx2(value)
 
## »ñÈ¡Íæ¼Ò¹¥»÷»Ø¸´À¶Á¿±ÈÂÊ
def GetAtkBackMPPer(curPlayer): return 0
def SetAtkBackMPPer(curPlayer, value): return
 
## Íæ¼Ò¼õ¼¼ÄÜCD±ÈÀý
def GetReduceSkillCDPer(curPlayer): return curPlayer.GetBattleValEx3()
def SetReduceSkillCDPer(curPlayer, reducePer): return curPlayer.SetBattleValEx3(reducePer)
 
## ³£¹æµØÍ¼¾­Ñé±¶ÂʼӳÉ
def GetCommMapExpRate(curPlayer):
    if GameWorld.GetMap().GetMapFBType() == IPY_GameWorld.fbtNull:
        return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_CommMapExpRate)
    return 0
def SetCommMapExpRate(curPlayer, expRate): return curPlayer.SetDict(ChConfig.Def_PlayerKey_CommMapExpRate, expRate)
 
## ¶Ô¹ÖÎïÉ˺¦¼Ó³É
def GetNPCHurtAddPer(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_NPCHurtAddPer)
def SetNPCHurtAddPer(curPlayer, value):
    curPlayer.SetDict(ChConfig.Def_PlayerKey_NPCHurtAddPer, value)
    SendPropertyRefresh(curPlayer, ShareDefine.CDBPlayerRefresh_NPCHurtAddPer, value)
    
#---Ö°ÒµÉ˺¦¼Ó³É---
## Ä¿±êսʿÉ˺¦¼Ó³É
def GetJobAHurtAddPer(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_JobAHurtAddPer)
def SetJobAHurtAddPer(curPlayer, value): curPlayer.SetDict(ChConfig.Def_PlayerKey_JobAHurtAddPer, value)
## Ä¿±ê·¨Ê¦É˺¦¼Ó³É
def GetJobBHurtAddPer(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_JobBHurtAddPer)
def SetJobBHurtAddPer(curPlayer, value): curPlayer.SetDict(ChConfig.Def_PlayerKey_JobBHurtAddPer, value)
## Ä¿±ê¹­ÊÖÉ˺¦¼Ó³É
def GetJobCHurtAddPer(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_JobCHurtAddPer)
def SetJobCHurtAddPer(curPlayer, value): curPlayer.SetDict(ChConfig.Def_PlayerKey_JobCHurtAddPer, value)
 
#---É˺¦¼õÃâ---
## NPC¹¥»÷É˺¦¼õÃâ
def GetNPCAtkReducePer(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_NPCAtkReducePer)
def SetNPCAtkReducePer(curPlayer, value): curPlayer.SetDict(ChConfig.Def_PlayerKey_NPCAtkReducePer, value)
## Õ½Ê¿¹¥»÷É˺¦¼õÃâ
def GetJobAAtkReducePer(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_JobAAtkReducePer)
def SetJobAAtkReducePer(curPlayer, value): curPlayer.SetDict(ChConfig.Def_PlayerKey_JobAAtkReducePer, value)
## ·¨Ê¦¹¥»÷É˺¦¼õÃâ
def GetJobBAtkReducePer(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_JobBAtkReducePer)
def SetJobBAtkReducePer(curPlayer, value): curPlayer.SetDict(ChConfig.Def_PlayerKey_JobBAtkReducePer, value)
## ¹­ÊÖ¹¥»÷É˺¦¼õÃâ
def GetJobCAtkReducePer(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_JobCAtkReducePer)
def SetJobCAtkReducePer(curPlayer, value): curPlayer.SetDict(ChConfig.Def_PlayerKey_JobCAtkReducePer, value)
 
#---ÌØÊâÉ˺¦¼õÃâ---
## »áÐÄÒ»»÷É˺¦¼õÃâ¹Ì¶¨Öµ
def GetLuckyHitReduce(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_LuckyHitReduce)
def SetLuckyHitReduce(curPlayer, value): 
    curPlayer.SetDict(ChConfig.Def_PlayerKey_LuckyHitReduce, value)
    SendPropertyRefresh(curPlayer, ShareDefine.CDBPlayerRefresh_LuckyHitReduce, value)
    
## ×¿Ô½Ò»»÷É˺¦¼õÃâ
def GetGreatHitReducePer(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_GreatHitReducePer)
def SetGreatHitReducePer(curPlayer, value): curPlayer.SetDict(ChConfig.Def_PlayerKey_GreatHitReducePer, value)
## ±©»÷É˺¦¼õÃâ
def GetSuperHitReduce(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_SuperHitReduce)
def SetSuperHitReduce(curPlayer, value):
    curPlayer.SetDict(ChConfig.Def_PlayerKey_SuperHitReduce, value)
    SendPropertyRefresh(curPlayer, ShareDefine.CDBPlayerRefresh_SuperHitReduce, value)
## ÎÞÊÓ·ÀÓùÉ˺¦¼õÃâ
def GetIgnoreDefReducePer(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_IgnoreDefReducePer)
def SetIgnoreDefReducePer(curPlayer, value): curPlayer.SetDict(ChConfig.Def_PlayerKey_IgnoreDefReducePer, value)
 
#---¿¹ÌØÊâÉ˺¦¸ÅÂÊ---
## ¿¹»áÐÄÒ»»÷¸ÅÂÊ
def GetLuckyHitRateReduce(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_LuckyHitRateReduce)
def SetLuckyHitRateReduce(curPlayer, value):
    curPlayer.SetDict(ChConfig.Def_PlayerKey_LuckyHitRateReduce, value)
    SendPropertyRefresh(curPlayer, ShareDefine.CDBPlayerRefresh_LuckyHitRateReduce, value)
## ¿¹×¿Ô½Ò»»÷¸ÅÂÊ
def GetGreatHitRateReduce(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_GreatHitRateReduce)
def SetGreatHitRateReduce(curPlayer, value): curPlayer.SetDict(ChConfig.Def_PlayerKey_GreatHitRateReduce, value)
## ¿¹±©»÷¸ÅÂÊ
def GetSuperHitRateReduce(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_SuperHitRateReduce)
def SetSuperHitRateReduce(curPlayer, value): 
    curPlayer.SetDict(ChConfig.Def_PlayerKey_SuperHitRateReduce, value)
    SendPropertyRefresh(curPlayer, ShareDefine.CDBPlayerRefresh_SuperHitRateReduce, value)
## ¿¹ÎÞÊÓ·ÀÓù¸ÅÂÊ
def GetIgnoreDefRateReduce(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_IgnoreDefRateReduce)
def SetIgnoreDefRateReduce(curPlayer, value):
    curPlayer.SetDict(ChConfig.Def_PlayerKey_IgnoreDefRateReduce, value)
    SendPropertyRefresh(curPlayer, ShareDefine.CDBPlayerRefresh_IgnoreDefRateReduce, value)
    
#---ÌØÊâÉ˺¦¸ÅÂÊ---
## ¸»ºÀÒ»»÷¸ÅÂÊ
def GetFuhaoHitRate(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_FuhaoHitRate)
def SetFuhaoHitRate(curPlayer, value): curPlayer.SetDict(ChConfig.Def_PlayerKey_FuhaoHitRate, value)
 
## Á÷ѪÉ˺¦
def GetBleedDamage(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_BleedDamage)
def SetBleedDamage(curPlayer, value):
    curPlayer.SetDict(ChConfig.Def_PlayerKey_BleedDamage, value)
    SendPropertyRefresh(curPlayer, ShareDefine.CDBPlayerRefresh_BleedDamage, value)
    
## Boss×îÖÕÉ˺¦°Ù·Ö±È
def GetBossFinalHurtPer(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_BossFinalHurtPer)
def SetBossFinalHurtPer(curPlayer, value):
    curPlayer.SetDict(ChConfig.Def_PlayerKey_BossFinalHurtPer, value)
    SendPropertyRefresh(curPlayer, ShareDefine.CDBPlayerRefresh_BossFinalHurtPer, value)
    
## ×îÖÕÉ˺¦°Ù·Ö±È
def GetFinalHurtPer(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_FinalHurtPer)
def SetFinalHurtPer(curPlayer, value):
    curPlayer.SetDict(ChConfig.Def_PlayerKey_FinalHurtPer, value)
    SendPropertyRefresh(curPlayer, ShareDefine.CDBPlayerRefresh_FinalHurtPer, value)
    
## ×îÖÕÉ˺¦¼õÃâ°Ù·Ö±È
def GetFinalHurtReducePer(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_FinalHurtReducePer)
def SetFinalHurtReducePer(curPlayer, value):
    curPlayer.SetDict(ChConfig.Def_PlayerKey_FinalHurtReducePer, value)
    SendPropertyRefresh(curPlayer, ShareDefine.CDBPlayerRefresh_FinalHurtReducePer, value)
    
## ×îÖչ̶¨É˺¦Ôö¼Ó
def GetFinalHurt(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_FinalHurt)
def SetFinalHurt(curPlayer, value):
    curPlayer.SetDict(ChConfig.Def_PlayerKey_FinalHurt, value)
    SendPropertyRefresh(curPlayer, ShareDefine.CDBPlayerRefresh_FinalHurt, value)
## ×îÖչ̶¨É˺¦¼õÉÙ
def GetFinalHurtReduce(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_FinalHurtReduce)
def SetFinalHurtReduce(curPlayer, value):
    curPlayer.SetDict(ChConfig.Def_PlayerKey_FinalHurtReduce, value)
    SendPropertyRefresh(curPlayer, ShareDefine.CDBPlayerRefresh_FinalHurtReduce, value)
## ¶ÔÖ¸¶¨bossÉ˺¦¼Ó³É¹Ì¶¨Öµ
def GetBossIDHurt(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_BossIDHurt)
def SetBossIDHurt(curPlayer, value): curPlayer.SetDict(ChConfig.Def_PlayerKey_BossIDHurt, value)
## ¶ÔÖ¸¶¨bossÉ˺¦¼Ó³É±¶ÂÊ
def GetBossIDHurtAddPer(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_BossIDHurtAddPer)
def SetBossIDHurtAddPer(curPlayer, value): curPlayer.SetDict(ChConfig.Def_PlayerKey_BossIDHurtAddPer, value)
## ×°±¸µôÂäÖ´ÐдÎÊý¼Ó³ÉÍò·ÖÂÊ
def GetDropEquipDoCount(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_DropEquipDoCount)
def SetDropEquipDoCount(curPlayer, value): curPlayer.SetDict(ChConfig.Def_PlayerKey_DropEquipDoCount, value)
 
# »ù´¡¹¥»÷°Ù·Ö±È
def GetBaseAtkAddPer(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_BaseAtkAddPer)
def SetBaseAtkAddPer(curPlayer, value): curPlayer.SetDict(ChConfig.Def_PlayerKey_BaseAtkAddPer, value)
# »ù´¡ÉúÃü°Ù·Ö±È
def GetBaseMaxHPAddPer(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_BaseMaxHPAddPer)
def SetBaseMaxHPAddPer(curPlayer, value): curPlayer.SetDict(ChConfig.Def_PlayerKey_BaseMaxHPAddPer, value)
# »ù´¡·ÀÓù°Ù·Ö±È
def GetBaseDefAddPer(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_BaseDefAddPer)
def SetBaseDefAddPer(curPlayer, value): curPlayer.SetDict(ChConfig.Def_PlayerKey_BaseDefAddPer, value)
# »ù´¡ÃüÖаٷֱÈ
def GetBaseHitAddPer(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_BaseHitAddPer)
def SetBaseHitAddPer(curPlayer, value): curPlayer.SetDict(ChConfig.Def_PlayerKey_BaseHitAddPer, value)
# »ù´¡ÉÁ±Ü°Ù·Ö±È
def GetBaseMissAddPer(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_BaseMissAddPer)
def SetBaseMissAddPer(curPlayer, value): curPlayer.SetDict(ChConfig.Def_PlayerKey_BaseMissAddPer, value)
# ·¨Æ÷ÉúÃü°Ù·Ö±È
def GetFaQiMaxHPPer(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_FaQiMaxHPPer)
def SetFaQiMaxHPPer(curPlayer, value): curPlayer.SetDict(ChConfig.Def_PlayerKey_FaQiMaxHPPer, value)
# ·¨Æ÷¹¥»÷°Ù·Ö±È
def GetFaQiAtkPer(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_FaQiAtkPer)
def SetFaQiAtkPer(curPlayer, value): curPlayer.SetDict(ChConfig.Def_PlayerKey_FaQiAtkPer, value)
# ·¨Æ÷·ÀÓù°Ù·Ö±È
def GetFaQiDefPer(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_FaQiDefPer)
def SetFaQiDefPer(curPlayer, value): curPlayer.SetDict(ChConfig.Def_PlayerKey_FaQiDefPer, value)
# Éñ±øÉúÃü°Ù·Ö±È
def GetGodWeaponMaxHPPer(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_GodWeaponMaxHPPer)
def SetGodWeaponMaxHPPer(curPlayer, value): curPlayer.SetDict(ChConfig.Def_PlayerKey_GodWeaponMaxHPPer, value)
# Éñ±ø¹¥»÷°Ù·Ö±È
def GetGodWeaponAtkPer(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_GodWeaponAtkPer)
def SetGodWeaponAtkPer(curPlayer, value): curPlayer.SetDict(ChConfig.Def_PlayerKey_GodWeaponAtkPer, value)
# ±¦Ê¯ÉúÃü°Ù·Ö±È
def GetStoneMaxHPPer(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_StoneMaxHPPer)
def SetStoneMaxHPPer(curPlayer, value): curPlayer.SetDict(ChConfig.Def_PlayerKey_StoneMaxHPPer, value)
# ±¦Ê¯¹¥»÷°Ù·Ö±È
def GetStoneAtkPer(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_StoneAtkPer)
def SetStoneAtkPer(curPlayer, value): curPlayer.SetDict(ChConfig.Def_PlayerKey_StoneAtkPer, value)
# ÑªÆ¿»Ö¸´Ð§¹û
def GetHPCureEnhance(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_HPCureEnhance)
def SetHPCureEnhance(curPlayer, value): curPlayer.SetDict(ChConfig.Def_PlayerKey_HPCureEnhance, value)
 
# ¶îÍâÊä³öÉ˺¦
def GetOnlyFinalHurt(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_OnlyFinalHurt)
def SetOnlyFinalHurt(curPlayer, value):
    curPlayer.SetDict(ChConfig.Def_PlayerKey_OnlyFinalHurt, value)
    SendPropertyRefresh(curPlayer, ShareDefine.CDBPlayerRefresh_OnlyFinalHurt, value)
    return
 
# PVP¹¥»÷»ØÑª
def GetPVPAtkBackHP(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_PVPAtkBackHP)
def SetPVPAtkBackHP(curPlayer, value): curPlayer.SetDict(ChConfig.Def_PlayerKey_PVPAtkBackHP, value)
 
# ÃüÖгɹ¦ÂÊ
def GetHitSucessRate(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_HitSucessRate)
def SetHitSucessRate(curPlayer, value): curPlayer.SetDict(ChConfig.Def_PlayerKey_HitSucessRate, value)
 
# ÉÁ±Ü³É¹¦ÂÊ
def GetMissSucessRate(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_MissSucessRate)
def SetMissSucessRate(curPlayer, value): curPlayer.SetDict(ChConfig.Def_PlayerKey_MissSucessRate, value)
 
# ÖÎÁƼӳɠĬÈϰٷְÙ
def GetCurePer(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_CurePer)
def SetCurePer(curPlayer, value): curPlayer.SetDict(ChConfig.Def_PlayerKey_CurePer, value)
 
# ¼ÓÉîÊܵ½É˺¦°Ù·Ö±È
def GetBeHurtPer(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_BeHurtPer)
def SetBeHurtPer(curPlayer, value): curPlayer.SetDict(ChConfig.Def_PlayerKey_BeHurtPer, value)
 
# ×øÆï¹¥»÷°Ù·Ö±È
def GetHorseAtkPer(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_HorseAtkPer)
def SetHorseAtkPer(curPlayer, value): curPlayer.SetDict(ChConfig.Def_PlayerKey_HorseAtkPer, value)
 
# ×øÆïÉúÃü¼Ó³É
def GetHorseMaxHPPer(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_HorseMaxHPPer)
def SetHorseMaxHPPer(curPlayer, value): curPlayer.SetDict(ChConfig.Def_PlayerKey_HorseMaxHPPer, value)
 
# Áé³è¹¥»÷¼Ó³É
def GetPetAtkPer(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_PetAtkPer)
def SetPetAtkPer(curPlayer, value): curPlayer.SetDict(ChConfig.Def_PlayerKey_PetAtkPer, value)
 
# ×øÆïÅàÑøÊôÐÔ¼Ó³É
def GetHorseTrainAttrPer(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_HorseTrainAttrPer)
def SetHorseTrainAttrPer(curPlayer, value): curPlayer.SetDict(ChConfig.Def_PlayerKey_HorseTrainAttrPer, value)
 
# Áé³èÅàÑøÊôÐÔ¼Ó³É
def GetPetTrainAttrPer(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_PetTrainAttrPer)
def SetPetTrainAttrPer(curPlayer, value): curPlayer.SetDict(ChConfig.Def_PlayerKey_PetTrainAttrPer, value)
 
# ÊØ»¤ÅàÑøÊôÐÔ¼Ó³É
def GetGuardTrainAttrPer(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_GuardTrainAttrPer)
def SetGuardTrainAttrPer(curPlayer, value): curPlayer.SetDict(ChConfig.Def_PlayerKey_GuardTrainAttrPer, value)
 
# ³á°òÅàÑøÊôÐÔ¼Ó³É
def GetWingTrainAttrPer(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_WingTrainAttrPer)
def SetWingTrainAttrPer(curPlayer, value): curPlayer.SetDict(ChConfig.Def_PlayerKey_WingTrainAttrPer, value)
 
# ÃðÊÀÅàÑøÊôÐÔ¼Ó³É
def GetPeerlessWeaponTrainAttrPer(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_PeerlessWeaponTrainAttrPer)
def SetPeerlessWeaponTrainAttrPer(curPlayer, value): curPlayer.SetDict(ChConfig.Def_PlayerKey_PeerlessWeaponTrainAttrPer, value)
 
# ß±ÉñÅàÑøÊôÐÔ¼Ó³É
def GetPeerlessWeapon2TrainAttrPer(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_PeerlessWeapon2TrainAttrPer)
def SetPeerlessWeapon2TrainAttrPer(curPlayer, value): curPlayer.SetDict(ChConfig.Def_PlayerKey_PeerlessWeapon2TrainAttrPer, value)
 
# Á¶ÌåÊôÐÔÊôÐÔ¼Ó³É
def GetLianTiAttrPer(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_LianTiAttrPer)
def SetLianTiAttrPer(curPlayer, value): curPlayer.SetDict(ChConfig.Def_PlayerKey_LianTiAttrPer, value)
 
def GetAttr160(curPlayer): return 0
def SetAttr160(curPlayer, value): pass
 
# ÏÉÃË»ÕÕÂID
def GetFamilyEmblemID(curPlayer): return curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FamilyEmblemID)
def SetFamilyEmblemID(curPlayer, emblemID): NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FamilyEmblemID, emblemID)
 
# ÏÉÃËÊÂÎñËٶȼӳÉ
def GetAffairSpeedPer(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_AffairSpeedPer)
def SetAffairSpeedPer(curPlayer, value): curPlayer.SetDict(ChConfig.Def_PlayerKey_AffairSpeedPer, value)
 
# ÏÉÃËBOSSÉ˺¦¼Ó³É
def GetFamilyBossHurtPer(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_FamilyBossHurtPer)
def SetFamilyBossHurtPer(curPlayer, value): curPlayer.SetDict(ChConfig.Def_PlayerKey_FamilyBossHurtPer, value)
 
# ÏÉÃËÁªÈüÉúÃü¼Ó³É
def GetFamilyWarHPPer(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_FamilyWarHPPer)
def SetFamilyWarHPPer(curPlayer, value): curPlayer.SetDict(ChConfig.Def_PlayerKey_FamilyWarHPPer, value)
 
# ÏÉÃËÁªÈü¹¥»÷¼Ó³É
def GetFamilyWarAtkPer(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_FamilyWarAtkPer)
def SetFamilyWarAtkPer(curPlayer, value): curPlayer.SetDict(ChConfig.Def_PlayerKey_FamilyWarAtkPer, value)
 
# ÏÉÃË´ò×ø¾­Ñé¼Ó³É
def GetFamilySitExpPer(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_FamilySitExpPer)
def SetFamilySitExpPer(curPlayer, value): curPlayer.SetDict(ChConfig.Def_PlayerKey_FamilySitExpPer, value)
 
# ±¦Ê¯»ù´¡ÊôÐÔ°Ù·Ö±È
def GetStoneBasePer(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_StoneBasePer)
def SetStoneBasePer(curPlayer, value): curPlayer.SetDict(ChConfig.Def_PlayerKey_StoneBasePer, value)
 
# ¾³½ç»ù´¡ÊôÐÔ°Ù·Ö±È
def GetRealmBasePer(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_RealmBasePer)
def SetRealmBasePer(curPlayer, value): curPlayer.SetDict(ChConfig.Def_PlayerKey_RealmBasePer, value)
 
# ³á°òÉúÃü°Ù·Ö±È
def GetWingHPPer(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_WingHPPer)
def SetWingHPPer(curPlayer, value): curPlayer.SetDict(ChConfig.Def_PlayerKey_WingHPPer, value)
 
# Ì××°»ù´¡ÊôÐÔ°Ù·Ö±È
def GetSuiteBasePer(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_SuiteBasePer)
def SetSuiteBasePer(curPlayer, value): curPlayer.SetDict(ChConfig.Def_PlayerKey_SuiteBasePer, value)
 
# Ç¿»¯»ù´¡¹¥»÷°Ù·Ö±È
def GetPlusBaseAtkPer(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_PlusBaseAtkPer)
def SetPlusBaseAtkPer(curPlayer, value): curPlayer.SetDict(ChConfig.Def_PlayerKey_PlusBaseAtkPer, value)
 
## ÔÝÎÞÓÃ
#  @param curPlayer Íæ¼ÒʵÀý
#  @return 
def GetAddBackHPPer(curPlayer):
    return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_AddBackHPPer)
 
## ÔÝÎÞÓÃ
#  @param curPlayer Íæ¼ÒʵÀý
#  @return None
def SetAddBackHPPer(curPlayer, value):
    curPlayer.SetDict(ChConfig.Def_PlayerKey_AddBackHPPer, value)
    
#---½µµÍÉúÃü»Ö¸´Ð§¹û----
## »ñÈ¡½µµÍÉúÃü»Ö¸´Ð§¹ûÍò·ÖÂÊ
#  @param curPlayer Íæ¼ÒʵÀý
#  @return 
def GetReduceBackHPPer(curPlayer):
    return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_ReduceBackHPPer)
 
## ÉèÖýµµÍÉúÃü»Ö¸´Ð§¹ûÍò·ÖÂÊ
#  @param curPlayer Íæ¼ÒʵÀý
#  @return None
def SetReduceBackHPPer(curPlayer, value):
    curPlayer.SetDict(ChConfig.Def_PlayerKey_ReduceBackHPPer, value)
 
#---´¥·¢»÷ÔÎ----
def GetFaintRate(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_AttrFaintRate)
def SetFaintRate(curPlayer, value):
    curPlayer.SetDict(ChConfig.Def_PlayerKey_AttrFaintRate, value)
    SendPropertyRefresh(curPlayer, ShareDefine.CDBPlayerRefresh_FaintRate, value)
#---»÷Ôεֿ¹----
def GetFaintDefRate(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_AttrFaintDefRate)
def SetFaintDefRate(curPlayer, value):
    curPlayer.SetDict(ChConfig.Def_PlayerKey_AttrFaintDefRate, value)
    SendPropertyRefresh(curPlayer, ShareDefine.CDBPlayerRefresh_FaintDefRate, value)
    
#---´¥·¢¶¨Éí----
def GetAtkerFreezed(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_AttrAtkerFreezed)
def SetAtkerFreezed(curPlayer, value): curPlayer.SetDict(ChConfig.Def_PlayerKey_AttrAtkerFreezed, value)
    
#---Ôö¼Ó³ðºÞ----
def GetAddAngry(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_AttrAddAngry)
def SetAddAngry(curPlayer, value): curPlayer.SetDict(ChConfig.Def_PlayerKey_AttrAddAngry, value)
 
#---Á¬»÷¼¸ÂÊ----
def GetComboRate(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_AttrComboRate)
def SetComboRate(curPlayer, value):
    curPlayer.SetDict(ChConfig.Def_PlayerKey_AttrComboRate, value)
    SendPropertyRefresh(curPlayer, ShareDefine.CDBPlayerRefresh_ComboRate, value)
#---Á¬»÷É˺¦----
def GetComboDamPer(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_AttrComboDamPer)
def SetComboDamPer(curPlayer, value):
    curPlayer.SetDict(ChConfig.Def_PlayerKey_AttrComboDamPer, value)
    SendPropertyRefresh(curPlayer, ShareDefine.CDBPlayerRefresh_ComboDamPer, value)
    
#---¼¼Äܹ¥»÷±ÈÀý¼õÉÙ----
def GetSkillAtkRateReduce(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_SkillAtkRateReduce)
def SetSkillAtkRateReduce(curPlayer, value):
    curPlayer.SetDict(ChConfig.Def_PlayerKey_SkillAtkRateReduce, value)
    SendPropertyRefresh(curPlayer, ShareDefine.CDBPlayerRefresh_SkillAtkRateReduce, value)
#---PVP¹Ì¶¨É˺¦----
def GetDamagePVP(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_AttrDamagePVP)
def SetDamagePVP(curPlayer, value):
    curPlayer.SetDict(ChConfig.Def_PlayerKey_AttrDamagePVP, value)
    SendPropertyRefresh(curPlayer, ShareDefine.CDBPlayerRefresh_DamagePVP, value)
#---PVP¹Ì¶¨É˺¦¼õÉÙ----
def GetDamagePVPReduce(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_AttrDamagePVPReduce)
def SetDamagePVPReduce(curPlayer, value):
    curPlayer.SetDict(ChConfig.Def_PlayerKey_AttrDamagePVPReduce, value)
    SendPropertyRefresh(curPlayer, ShareDefine.CDBPlayerRefresh_DamagePVPReduce, value)
#---É˺¦Êä³ö¹Ì¶¨Öµ¼ÆËã¶ÔNPC¸½¼Ó----
def GetDamagePVE(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_AttrDamagePVE)
def SetDamagePVE(curPlayer, value): 
    curPlayer.SetDict(ChConfig.Def_PlayerKey_AttrDamagePVE, value)
    SendPropertyRefresh(curPlayer, ShareDefine.CDBPlayerRefresh_DamagePVE, value)
    
#---É˺¦Êä³ö¼ÆËã°Ù·Ö±È¶ÔÍæ¼Ò¸½¼Ó----
def GetDamagePerPVP(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_AttrDamagePerPVP)
def SetDamagePerPVP(curPlayer, value):
    curPlayer.SetDict(ChConfig.Def_PlayerKey_AttrDamagePerPVP, value)
    SendPropertyRefresh(curPlayer, ShareDefine.CDBPlayerRefresh_DamagePerPVP, value)
def GetDamagePerPVPReduce(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_AttrDamagePerPVPReduce)
def SetDamagePerPVPReduce(curPlayer, value):
    curPlayer.SetDict(ChConfig.Def_PlayerKey_AttrDamagePerPVPReduce, value)
    SendPropertyRefresh(curPlayer, ShareDefine.CDBPlayerRefresh_DamagePerPVPReduce, value)
    
#---ÊÜÉ˼ÆËã°Ù·Ö±È----
def GetHurtPer(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_AttrHurtPer)
def SetHurtPer(curPlayer, value): curPlayer.SetDict(ChConfig.Def_PlayerKey_AttrHurtPer, value)
  
#---×Ô¶¯»Ö¸´XPÖµ±ÈÂÊ----
def GetXPRestorePer(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_AttrXPRestorePer)
def SetXPRestorePer(curPlayer, value): curPlayer.SetDict(ChConfig.Def_PlayerKey_AttrXPRestorePer, value)
 
#---ħ·¨¶ÜÉ˺¦ÎüÊÕÀ¶ºÄ±ÈÂÊ----
def GetShieldMPCostRate(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_AttrShieldMPCostRate)
def SetShieldMPCostRate(curPlayer, value): curPlayer.SetDict(ChConfig.Def_PlayerKey_AttrShieldMPCostRate, value)
  
#---20%µÄ¸ÅÂʵÖÓùÉ˺¦±ÈÂÊ----
def GetDamChanceDef(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_AttrDamChanceDef)
def SetDamChanceDef(curPlayer, value):
    curPlayer.SetDict(ChConfig.Def_PlayerKey_AttrDamChanceDef, value)
    SendPropertyRefresh(curPlayer, ShareDefine.CDBPlayerRefresh_DamChanceDef, value)
    
#---µ±Ç°·À»¤Öµ£¬Ðè´æDB----
def GetProDef(curPlayer): return curPlayer.GetExAttr4()
def SetProDef(curPlayer, value):
    if GameWorld.IsCrossServer():
        curPlayer.SetExAttr4(value, True) # ¿ç·þ·þÎñÆ÷ÐèÒª¹ã²¥ÖÜÎ§Íæ¼Ò
    else:
        curPlayer.SetExAttr4(value)
    
#---×î´ó·À»¤Öµ----
def GetMaxProDef(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_AttrMaxProDef)
def SetMaxProDef(curPlayer, value):
    curPlayer.SetDict(ChConfig.Def_PlayerKey_AttrMaxProDef, value)
    SendPropertyRefresh(curPlayer, ShareDefine.CDBPlayerRefresh_MaxProDef, value) # ÖÜÎ§Íæ¼ÒÐèҪ֪ͨ
    
#---ÉúÃüÉÏÏÞ»»ËãΪ·À»¤ÖµµÄ°Ù·Ö±È----
def GetProDefHPPer(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_AttrProDefHPPer)
def SetProDefHPPer(curPlayer, value):
    curPlayer.SetDict(ChConfig.Def_PlayerKey_AttrProDefHPPer, value)
    #SendPropertyRefresh(curPlayer, ShareDefine.CDBPlayerRefresh_ProDefHPPer, value)
    
#---·À»¤ÖµÎüÊÕÉ˺¦±ÈÂÊ----
def GetProDefAbsorb(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_AttrProDefAbsorb)
def SetProDefAbsorb(curPlayer, value):
    curPlayer.SetDict(ChConfig.Def_PlayerKey_AttrProDefAbsorb, value)
    #SendPropertyRefresh(curPlayer, ShareDefine.CDBPlayerRefresh_ProDefAbsorb, value)
    
#---³èÎï¹¥»÷ÌáÉýÖµ----
def GetPetMinAtk(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_AttrPetMinAtk)
def SetPetMinAtk(curPlayer, value): curPlayer.SetDict(ChConfig.Def_PlayerKey_AttrPetMinAtk, value)
def GetPetMaxAtk(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_AttrPetMaxAtk)
def SetPetMaxAtk(curPlayer, value): curPlayer.SetDict(ChConfig.Def_PlayerKey_AttrPetMaxAtk, value)
 
#---³èÎïÉ˺¦°Ù·Ö±ÈÌáÉý----ÒÆµ½GameObjÏÂ
#===============================================================================
# def GetPetDamPer(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_AttrPetDamPer)
# def SetPetDamPer(curPlayer, value): 
#    curPlayer.SetDict(ChConfig.Def_PlayerKey_AttrPetDamPer, value)
#    SendPropertyRefresh(curPlayer, ShareDefine.CDBPlayerRefresh_PetDamPer, value)
#===============================================================================
#---³èÎï¼¼ÄÜÉ˺¦°Ù·Ö±ÈÌáÉý----
def GetPetSkillAtkRate(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_PetSkillAtkRate)
def SetPetSkillAtkRate(curPlayer, value): curPlayer.SetDict(ChConfig.Def_PlayerKey_PetSkillAtkRate, value)
    
#---ÿ1¼¶+%s¹¥»÷, ÊýֵȡÍò·ÖÂÊ£¬Ö§³ÖСÊýËã·¨----
def GetPerLVAtk(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_AttrPerLVAtk)
def SetPerLVAtk(curPlayer, value): curPlayer.SetDict(ChConfig.Def_PlayerKey_AttrPerLVAtk, value)
#---ÿ1¼¶+%sÉúÃü, ÊýֵΪ¹Ì¶¨Öµ----
def GetPerLVMaxHP(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_AttrPerLVMaxHP)
def SetPerLVMaxHP(curPlayer, value): curPlayer.SetDict(ChConfig.Def_PlayerKey_AttrPerLVMaxHP, value)
 
#---×°±¸µôÂÊ----
def GetDropEquipPer(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_AttrDropEquipPer)
def SetDropEquipPer(curPlayer, value): curPlayer.SetDict(ChConfig.Def_PlayerKey_AttrDropEquipPer, value)
 
#---¹¦Äܲã·ÀÓùÖµ----
def GetFuncDef(curPlayer): return EffGetSet.GetCopyFuncAttrValue(curPlayer, ChConfig.TYPE_Calc_AttrDEF)
def SetFuncDef(curPlayer, value): EffGetSet.SetCopyFuncAttrValue(curPlayer, ChConfig.TYPE_Calc_AttrDEF, value)
 
#ÆÕͨ¹¥»÷ÔöÉË£ºÆÕͨ¹¥»÷¸½¼ÓµÄ¹Ì¶¨ÖµÉ˺¦
def GetNormalHurt(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_NormalHurt)
def SetNormalHurt(curPlayer, value): curPlayer.SetDict(ChConfig.Def_PlayerKey_NormalHurt, value)
#ÆÕͨ¹¥»÷¼Ó³É£ºÆÕͨ¹¥»÷¸½¼ÓµÄÉ˺¦°Ù·Ö±È
def GetNormalHurtPer(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_NormalHurtPer)
def SetNormalHurtPer(curPlayer, value): curPlayer.SetDict(ChConfig.Def_PlayerKey_NormalHurtPer, value)
#·¨±¦¼¼ÄÜÔöÉË£º·¨±¦¼¼Äܹ¥»÷¸½¼ÓµÄ¹Ì¶¨ÖµÉ˺¦
def GetFabaoHurt(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_FabaoHurt)
def SetFabaoHurt(curPlayer, value): curPlayer.SetDict(ChConfig.Def_PlayerKey_FabaoHurt, value)
#·¨±¦¼¼Äܼӳɣº·¨±¦¼¼Äܹ¥»÷¸½¼ÓµÄÉ˺¦°Ù·Ö±È
def GetFabaoHurtPer(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_FabaoHurtPer)
def SetFabaoHurtPer(curPlayer, value): curPlayer.SetDict(ChConfig.Def_PlayerKey_FabaoHurtPer, value)
 
# Ã¿XÃë×Ô¶¯Ïûʧһ¸öÓ¡¼Ç£¬ ºÁÃë¼Ç¼
def GetLostYinjiTime(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_LostYinjiTime)
def SetLostYinjiTime(curPlayer, value): 
    curPlayer.SetDict(ChConfig.Def_PlayerKey_LostYinjiTime, value)
    SendPropertyRefresh(curPlayer, ShareDefine.CDBPlayerRefresh_YinjiTime, value)
 
# µ±Ç°Ó¡¼ÇÊý
def GetYinjiCnt(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_YinjiCnt)
def SetYinjiCnt(curPlayer, value): 
    curPlayer.SetDict(ChConfig.Def_PlayerKey_YinjiCnt, value)
    SendPropertyRefresh(curPlayer, ShareDefine.CDBPlayerRefresh_YinjiCnt, value)
 
# ¼õÉÙÖ¸¶¨¼¼ÄÜ×éCD XX%
def GetTheFBSkillsCD(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_TheFBSkillsCD)
def SetTheFBSkillsCD(curPlayer, value): curPlayer.SetDict(ChConfig.Def_PlayerKey_TheFBSkillsCD, value)
# ×ÆÉչ̶¨É˺¦
def GetBurnValue(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_BurnValue)
def SetBurnValue(curPlayer, value): curPlayer.SetDict(ChConfig.Def_PlayerKey_BurnValue, value)
# ÑÓ³¤×ÆÉÕʱ¼ä°Ù·Ö±È
def GetBurnTimePer(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_BurnTimePer)
def SetBurnTimePer(curPlayer, value): curPlayer.SetDict(ChConfig.Def_PlayerKey_BurnTimePer, value)
# ¼õÒÆ¶¯ËٶȰٷֱÈ
def GetSubSpeedPer(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_SubSpeedPer)
def SetSubSpeedPer(curPlayer, value): curPlayer.SetDict(ChConfig.Def_PlayerKey_SubSpeedPer, value)
 
# ¼¼ÄÜÉ˺¦ÔöÇ¿
def GetSkillAddPer1(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_SkillAddPer1)
def SetSkillAddPer1(curPlayer, value): curPlayer.SetDict(ChConfig.Def_PlayerKey_SkillAddPer1, value)
def GetSkillAddPer2(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_SkillAddPer2)
def SetSkillAddPer2(curPlayer, value): curPlayer.SetDict(ChConfig.Def_PlayerKey_SkillAddPer2, value)
def GetSkillAddPer3(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_SkillAddPer3)
def SetSkillAddPer3(curPlayer, value): curPlayer.SetDict(ChConfig.Def_PlayerKey_SkillAddPer3, value)
def GetSkillAddPer4(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_SkillAddPer4)
def SetSkillAddPer4(curPlayer, value): curPlayer.SetDict(ChConfig.Def_PlayerKey_SkillAddPer4, value)
def GetSkillAddPer5(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_SkillAddPer5)
def SetSkillAddPer5(curPlayer, value): curPlayer.SetDict(ChConfig.Def_PlayerKey_SkillAddPer5, value)
def GetSkillAddPer6(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_SkillAddPer6)
def SetSkillAddPer6(curPlayer, value): curPlayer.SetDict(ChConfig.Def_PlayerKey_SkillAddPer6, value)
def GetSkillAddPer7(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_SkillAddPer7)
def SetSkillAddPer7(curPlayer, value): curPlayer.SetDict(ChConfig.Def_PlayerKey_SkillAddPer7, value)
 
# Êܵ½¼¼ÄÜÉ˺¦¼õÉÙ
def GetSkillReducePer1(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_SkillReducePer1)
def SetSkillReducePer1(curPlayer, value): curPlayer.SetDict(ChConfig.Def_PlayerKey_SkillReducePer1, value)
def GetSkillReducePer2(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_SkillReducePer2)
def SetSkillReducePer2(curPlayer, value): curPlayer.SetDict(ChConfig.Def_PlayerKey_SkillReducePer2, value)
def GetSkillReducePer3(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_SkillReducePer3)
def SetSkillReducePer3(curPlayer, value): curPlayer.SetDict(ChConfig.Def_PlayerKey_SkillReducePer3, value)
def GetSkillReducePer4(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_SkillReducePer4)
def SetSkillReducePer4(curPlayer, value): curPlayer.SetDict(ChConfig.Def_PlayerKey_SkillReducePer4, value)
def GetSkillReducePer5(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_SkillReducePer5)
def SetSkillReducePer5(curPlayer, value): curPlayer.SetDict(ChConfig.Def_PlayerKey_SkillReducePer5, value)
def GetSkillReducePer6(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_SkillReducePer6)
def SetSkillReducePer6(curPlayer, value): curPlayer.SetDict(ChConfig.Def_PlayerKey_SkillReducePer6, value)
def GetSkillReducePer7(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_SkillReducePer7)
def SetSkillReducePer7(curPlayer, value): curPlayer.SetDict(ChConfig.Def_PlayerKey_SkillReducePer7, value)
 
#---ÖïÏÉÒ»»÷¸ÅÂÊ---
def GetZhuXianRate(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_ZhuxianRate)
def SetZhuXianRate(curPlayer, value): curPlayer.SetDict(ChConfig.Def_PlayerKey_ZhuxianRate, value)
 
#---ÖïÏÉ»¤Ìå¼õÉË---
def GetZhuXianReducePer(curPlayer): return 0#curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_ZhuXianReducePer)
def SetZhuXianReducePer(curPlayer, value): return #curPlayer.SetDict(ChConfig.Def_PlayerKey_ZhuXianReducePer, value)
 
## ¼ÆË㹦Äܱ³°üÎïÆ·ÊôÐÔ 
#  @param curPlayer µ±Ç°Íæ¼Ò
#  @param packType ±³°üÀàÐÍ
#  @param allAttrListEquip ÊôÐÔÁбí
#  @return None
def CalcFuncPackItem(curPlayer, packType, allAttrListEquip):
    #===========================================================================
    # funcPack = curPlayer.GetItemManager().GetPack(packType)
    # equipPartIndexList = ChConfig.Pack_EquipPart_CanPlusStar.get(packType, [])
    # 
    # #Íæ¼Òµ±Ç°¿É×°±¸µÄ×°±¸ÀàÐÍ
    # for equipIndex in range(0, funcPack.GetCount()):
    #    
    #    curEquip = funcPack.GetAt(equipIndex)
    #    if curEquip.IsEmpty():
    #        continue
    #    
    #    #¼ÆËãЧ¹û
    #    for i in range(0, curEquip.GetEffectCount()):
    #        curEffect = curEquip.GetEffectByIndex(i)
    #        if not curEffect:
    #            break
    #        
    #        effectID = curEffect.GetEffectID()
    #        if effectID == 0:
    #            #×îºóÒ»¸ö
    #            break
    #        
    #        effectValue = curEffect.GetEffectValue(0)
    #        if not effectValue:
    #            continue
    #        
    #        #Ìí¼ÓÎïÆ·Ð§¹ûµÄÊôÐÔÖµ
    #        CalcAttrDict_Type(effectID, effectValue, allAttrListEquip)
    #    
    #    
    #===========================================================================
    return
 
#-------------------------------------------------------------------------------
 
## ÉèÖñ£´æ¹¦ÄÜÊÂÏȼÆËãºÃµÄÊôÐÔÖµ
def SetCalcAttrListValue(curPlayer, funcIndex, allAttrList, insidePerAttrDict=None, customAttrDict=None):
    # ÉèÖÃֵ֮ǰÏÈÇå¿ÕÖØÖÃ
    # @param customAttrDict: ×Ô¶¨ÒåµÄÊôÐÔÐÅÏ¢£¬±ØÐëÊǸñʽ {"×Ô¶¨ÒåÊôÐÔÃèÊöÃûkey":ÊôÐÔÐÅÏ¢, ...}  ×Ô¶¨ÒåÊôÐÔÃèÊöÃûkey - ½¨Ò鲻ͬ¹¦ÄܵãÖ®¼ä²»ÒªÖظ´
    ClearCalcAttrListValue(curPlayer, funcIndex)
    if insidePerAttrDict == None:
        insidePerAttrDict = {}
    if customAttrDict == None:
        customAttrDict = {}
        
    battleAttrDict = allAttrList[ChConfig.CalcAttr_Battle]
    if ChConfig.TYPE_Calc_PerLVAtk in battleAttrDict:
        # Ã¿1¼¶¼ÓµÄ¹¥»÷Á¦²»Ò»¶¨Âú1µã£¬ËùÒÔÕâÀï°´Íò·ÖÂÊÀ´Ë㣬֧³ÖСÊýËã·¨
        addAtk = int(curPlayer.GetLV() * battleAttrDict[ChConfig.TYPE_Calc_PerLVAtk] / float(ShareDefine.Def_MaxRateValue))
        battleAttrDict[ChConfig.TYPE_Calc_AttrATKMin] = battleAttrDict.get(ChConfig.TYPE_Calc_AttrATKMin, 0) + addAtk
        battleAttrDict[ChConfig.TYPE_Calc_AttrATKMax] = battleAttrDict.get(ChConfig.TYPE_Calc_AttrATKMax, 0) + addAtk
        
    if ChConfig.TYPE_Calc_PerLVMaxHP in battleAttrDict:
        # Ã¿1¼¶¼ÓµÄÉúÃüÖµ²»»áÉÙÓÚ1µã£¬ËùÒÔÖ±½Ó³Ë
        addMaxHP = curPlayer.GetLV() * battleAttrDict[ChConfig.TYPE_Calc_PerLVMaxHP]
        battleAttrDict[ChConfig.TYPE_Calc_AttrMaxHP] = battleAttrDict.get(ChConfig.TYPE_Calc_AttrMaxHP, 0) + addMaxHP
        
    playerID = curPlayer.GetPlayerID()
    if playerID not in PyGameData.g_playerFuncAttrDict:
        PyGameData.g_playerFuncAttrDict[playerID] = {}
    funcAttrDict = PyGameData.g_playerFuncAttrDict[playerID]
    funcAttrDict[funcIndex] = [allAttrList, insidePerAttrDict, customAttrDict]
    #GameWorld.DebugLog("±£´æ¹¦ÄܵãÊôÐÔ: funcIndex=%s, %s, %s" % (funcIndex, allAttrList, insidePerAttrDict))
    return
 
def GetCalcAttrListValue(curPlayer, funcIndex):
    ## »ñÈ¡¹¦ÄܵãÔ¤ÏȼÆËãµÄËù¼ÓÊôÐÔÖµ
    attrList = [{} for _ in range(4)]
    insidePerAttrDict = {}
    customAttrDict = {}
    if isinstance(funcIndex, int):
        funcIndexList = [funcIndex]
    elif isinstance(funcIndex, list):
        funcIndexList = funcIndex
    else:
        return attrList, insidePerAttrDict, customAttrDict
    
    playerID = curPlayer.GetPlayerID()
    if playerID not in PyGameData.g_playerFuncAttrDict:
        return attrList, insidePerAttrDict, customAttrDict
    funcAttrDict = PyGameData.g_playerFuncAttrDict[playerID]
    for funcIndex in funcIndexList:
        if funcIndex not in funcAttrDict:
            continue
        funcAttrList, funcInsidePerAttrDict, funcCustomAttrDict = funcAttrDict[funcIndex]
        for i, attrDict in enumerate(attrList):
            curAttrDict = funcAttrList[i]
            AddAttrDictValue(attrDict, curAttrDict)
        customAttrDict.update(funcCustomAttrDict)
        AddAttrDictValue(insidePerAttrDict, funcInsidePerAttrDict)
    return attrList, insidePerAttrDict, customAttrDict
 
## ÖØÖûº´æ
def ClearCalcAttrListValue(curPlayer, funcIndex):
    playerID = curPlayer.GetPlayerID()
    if playerID not in PyGameData.g_playerFuncAttrDict:
        return
    funcAttrDict = PyGameData.g_playerFuncAttrDict[playerID]
    funcAttrDict.pop(funcIndex, None)
    return
 
def AddAttrListValue(attrList):
    addAttrList = [{} for _ in range(4)]
    for aList in attrList:
        for i in ChConfig.CalcAttrIndexList:
            AddAttrDictValue(addAttrList[i], aList[i])
    return addAttrList
 
## ÊôÐÔÖµ×ÖµäÀÛ¼Ó
def AddAttrDictValue(dict1, dict2):
    for key, value in dict2.items():
        if key not in dict1:
            dict1[key] = value
        else:
            aValue = dict1[key]
            if key in ChConfig.TYPE_Calc_DeclineList:
                # ÕâÖÖËã·¨µÄÊôÐÔÒ»°ãÊÇÍò·ÖÂʵģ¬×î´ó²»³¬¹ý°Ù·Ö°Ù£¬¹ÊÔÝĬÈÏÍò·ÖÂÊ, ÈôÓв»ÊÇÍò·ÖÂʵÄÊôÐÔÔÙ×ö´¦Àí
                dict1[key] = 10000 - (10000 - aValue) * (10000 - value)
            else:
                dict1[key] = aValue + value
    return
 
#-------------------------------------------------------------------------------
## ÉèÖÃÍæ¼Ò×ÖµäÖµ, ´æ¿â
def NomalDictSetProperty(curPlayer, key, value, dType=0):
    if CrossPlayerData.IsNeedProcessCrossPlayer(curPlayer) and key not in \
        [ChConfig.Def_PDict_FightPower_Total, ChConfig.Def_PDict_FightPower_TotalEx, ChConfig.Def_PlayerKey_CrossRegisterMap]:
        playerID = curPlayer.GetPlayerID()
        changeDict = PyGameData.g_crossPlayerDictChangeInfo.get(playerID, {})
        changeDict[(key, dType)] = value
        PyGameData.g_crossPlayerDictChangeInfo[playerID] = changeDict
        
    if value == 0:
        curPlayer.NomalDictDelProperty(key, dType)
        return
    # 2^31 - 1
    curPlayer.NomalDictAddProperty(key, min(value, ChConfig.Def_UpperLimit_DWordEx), dType)
    return
 
## Í¨Öª×£¸£Öµ
def Sync_BlessValue(curPlayer, blessType, value, multiple=0):
    itemList = []
 
    valuePack = ChPyNetSendPack.tagMCSyncSingleBlessValue()
    valuePack.Clear()
    valuePack.Type = blessType
    valuePack.Value = value
    valuePack.Multiple = multiple
    itemList.append(valuePack)
    
    sendPack = ChPyNetSendPack.tagMCSyncBlessValue()
    sendPack.Clear()
    sendPack.TypeCnt = len(itemList)
    sendPack.BlessInfo = itemList
    
    #֪ͨ¿Í»§¶Ë
    NetPackCommon.SendFakePack(curPlayer, sendPack)
    return
 
#ͬ²½ÉèÖÃ Íæ¼ÒºÍ³èÎï¼°ÒÑÕÙ»½µÄÕÙ»½ÊÞ ÊÓÒ°²ã
def SetPlayerSightLevel(curPlayer, sightLevel):
    # µ±ÊÓÒ°ÉèÖÃ0ʱ£¬ÔÚ¾³½çµØÍ¼Ôò×Ô¶¯ÉèÖÃÒÑÑ¡ÔñµÄ¾³½çÄѶÈÊÓÒ°
    if sightLevel == 0:
        realmDifficulty = GetMapRealmDifficulty(curPlayer)
        if realmDifficulty:
            sightLevel = realmDifficulty
            GameWorld.DebugLog("¾³½çµØÍ¼×Ô¶¯ÉèÖÃÒÑÑ¡ÔñµÄ¾³½çÄѶÈÊÓÒ°: sightLevel=%s" % sightLevel)
            
    curPlayer.SetSightLevel(sightLevel)
    rolePet = curPlayer.GetPetMgr().GetFightPet()
    #ÎÞ³öÕ½³èÎï
    if rolePet:
        rolePet.SetSightLevel(sightLevel)
    
    for i in range(curPlayer.GetSummonCount()):
        curSummon = curPlayer.GetSummonNPCAt(i)
        if not curSummon:
            continue
        curSummon.SetSightLevel(sightLevel)
    return