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
#!/usr/bin/python
# -*- coding: GBK -*-
#-------------------------------------------------------------------------------
#
#-------------------------------------------------------------------------------
#
##@package EventReport
#
# @todo:ʼþ»ã±¨
# @author hxp
# @date 2015-1-14
# @version 2.4
# @Note£º  EventReport_EventReportÓ÷¨ µÚÒ»¸ö²ÎÊý´«postÄÚÈÝurlencode£¬µÚ2,3,4²»Ó㻵ÚÎå¸ö²ÎÊý0´ú±íget£¬1Ϊpost£»µÚÁù¸ö²ÎÊýΪurl
#
# @change: "2015-01-28 22:30" hxp ¹Ø±Õʼþ»ã±¨
# @change: "2015-02-06 20:40" Alee Ê¼þ»ã±¨·¢ËÍÖÁºÏ·þÖ÷·þ
# @change: "2015-06-08 20:30" hxp Ôö¼ÓchannelCode
# @change: "2015-07-13 14:00" hxp Ôö¼ÓpidÐÅÏ¢
# @change: "2016-07-18 19:00" hxp 9377¶À´úʼþ»ã±¨°æ
# @change: "2016-07-27 20:00" Alee Ð޸Ĵò¿ªÎļþ³¬Ê±¹Ø±Õ
# @change: "2016-07-30 11:30" hxp ¹Ø±ÕÎïÆ·¸ú×Ù
# @change: "2016-08-18 16:30" hxp ×Ô¶¨ÒåÈÎÎñʼþ
# @change: "2016-08-30 23:00" hxp ÁÄÌì¼à¿Ø
# @change: "2016-09-10 11:00" hxp ÁÄÌìÄÚÈÝÌæ»»»»ÐÐ
# @change: "2016-11-09 20:00" hxp Ôö¼Ó×Ô¶¨Òå¼Ç¼(×øÆï¡¢³á°ò¡¢³èÎï¡¢»õ±Ò½ø³ö¡¢³È×°)
# @change: "2017-06-08 19:30" hxp Ôö¼Ó×Ô¶¨Òå¼Ç¼(µãȯ¡¢Éñ±ø¡¢·ûÓ¡¡¢¸ÄÃû¡¢ÕæÆø)
# @change: "2017-07-01 15:30" hxp Æ½Ì¨¸ÄΪ´ÓÍæ¼ÒÕ˺ÅÖÐÈ¡£¬Ö§³Ö»ì·þģʽ
# @change: "2017-07-04 15:00" hxp Ôö¼Ó»ì·þģʽÏ¿ÉÇø·Ö¸÷ƽ̨×ÔÉíÇø·þºÏ·þºóµÄƽ̨Ö÷·þID
# ÏêϸÃèÊö: Ê¼þ»ã±¨
#
#---------------------------------------------------------------------
#"""Version = 2017-07-04 15:00"""
#---------------------------------------------------------------------
 
import IpyGameDataPY
import IPY_GameWorld
import DataRecordPack
import PlayerControl
import ReadChConfig
import ShareDefine
import GameWorld
import ChConfig
import CommFunc
import PlayerTJG
 
import datetime
import random
import time
import md5
import os
import re
import json
import urllib
EventFilepath = "D:\\EventServer\\PythonScribe\\EventLog\\" 
 
g_wFileName = ""
g_writeHandle = None  # ²»¿ÉÖ±½Óµ÷ÓÃ
 
Def_Custom_Events_Bug = "Bug" # ÓÎÏ·Bug
Def_Custom_Events_Suggest = "suggest" # ÓÎÏ·½¨Òé
Def_Custom_Events_Item = "Item" # ÎïÆ·¸ú×Ù
Def_Custom_Events_GetMail = "GetMail" # ÓʼþÁìÈ¡
Def_Custom_Events_CommonCard = "CommonCard_%s" # Í¨ÓÃÐÂÊÖ¿¨ÂëʹÓÃ, ²ÎÊýΪͨÓÃÂ뿨ºÅ
Def_Custom_Events_NewbieCard = "NewbieCard_%s" # ³£¹æÐÂÊÖ¿¨Ê¹ÓÃ, ²ÎÊýΪÀñ°üÀàÐÍ
Def_Custom_Events_MediaCard = "MediaCard_%s" # ÐÂýÌ忨ʹÓÃ, ²ÎÊýΪ¿¨ÀàÐÍ
 
g_whStartTime = 0     # ´´½¨Îļþʱ¼ä
Def_WriteTime = 2   # Îļþ³ÖÐøÐ´Èëʱ¼ä£º·ÖÖÓ
 
def OnTimeCloseScribeTxt():
    global g_whStartTime
    global g_writeHandle
    global g_wFileName
    try:
        if g_whStartTime == 0:
            return
        
        #Îļþ´´½¨³¬¹ý
        if time.time() - g_whStartTime < 60*(Def_WriteTime + 1):
            return
        
        if g_writeHandle == None:
            return
        g_writeHandle.close()
        g_wFileName = ""
        g_whStartTime = 0
    except:
        GameWorld.ErrLog("OnTimeCloseScribeTxt ³ö´í")
 
 
 
## ³õʼ»¯Ê¼þ
#  @param None
#  @return ÎÞ·µ»ØÖµ
def InitDllAppID():
 
    appID = "mobile"
    key = "mobile"
 
    GameWorld.GetGameWorld().EventReport_SetEventReportParam(appID, key)
    GameWorld.Log("³õʼ»¯Ê¼þ±¨¸æ: appID=%s,key=%s OK!" % (appID, key))
    return
 
## Ê¼þ±¨¸æ¼Ç¼
#  @param eventActionID Ê¼þid
#  @param eventParam Ê¼þ²ÎÊý
#  @param curPlayer 
#  @return None
def EventReport(eventActionID, eventParam, curPlayer=None, OperatorID=""):
    # ×é³ÉÀý×Ó eventParam µÄ¸ñʽ±ØÐëÊÇ xx=yy&zz=cc
    #  "http://192.168.0.249:12000/event_receiver?EventID=3099&OperatorID=test&PlayerCount=102&Time=2018-02-08 18:30:30&ProductID=snxxz&RegionName=s1"
    
    reportActionIDList = IpyGameDataPY.GetFuncEvalCfg("EventReport", 3)
    if reportActionIDList and eventActionID not in reportActionIDList:
        #GameWorld.DebugLog("·ÇÐèÒª»ã±¨µÄʼþID! %s" % eventActionID)
        return
    if eventActionID in IpyGameDataPY.GetFuncEvalCfg("EventReport", 1):
        #GameWorld.DebugLog("²»ÐèÒª»ã±¨µÄʼþ! %s" % eventActionID)
        return
    
    if not curPlayer and not OperatorID:
        return
 
    ProductID = ReadChConfig.GetPyMongoConfig("EventReport", "ProductID")
    ReportUrl = ReadChConfig.GetPyMongoConfig("EventReport", "ReportUrl")
    
    
    playerInfo = ""
    if curPlayer:
        if not GameWorld.IsNormalPlayer(curPlayer):
            return
        #UTF8 ÐèҪת³Éurl±àÂë²Å¿ÉÓÃ
        playerInfo = urllib.urlencode({"RoleID": curPlayer.GetName(),
                          "AccountID": GameWorld.GetPlatformAccID(curPlayer.GetAccID()),
                          "IP": curPlayer.GetIP(),
                          "Level": curPlayer.GetLV(),
                          "DeviceFlag": curPlayer.GetAccountData().GetDeviceFlag(),
                          "Job": curPlayer.GetJob(),
                          "PlayerID": curPlayer.GetPlayerID(),
                          "CreateRoleTime": curPlayer.GetCreateRoleTime(),
                          }) 
        
        OperatorID = GameWorld.GetPlayerPlatform(curPlayer)
        RegionName = GameWorld.GetPlayerServerSID(curPlayer)
        playerInfo = "&%s"%playerInfo
        
    else:
        # ºÏ·þÇé¿ö£¬Íæ¼ÒÈ¡×Ô¼º·þ·¢ËÍ£¬·ÇÍæ¼ÒÊý¾Ý°´Ö¸¶¨Æ½Ì¨ÅäÖ÷¢
        sid = GameWorld.GetPlayerMainServerID(OperatorID)
        if not sid:
            GameWorld.ErrLog("GetPlayerMainServerID: %s-%s"%(OperatorID, sid))
            return
        RegionName = 's%s'%sid
 
    if eventParam:
        eventParam = "&%s"%eventParam
    
    
    getUrl = "%s?ProductID=%s&OperatorID=%s&RegionName=%s&EventID=%s%s&Time=%s%s"%(\
             ReportUrl, ProductID, OperatorID, RegionName, eventActionID, playerInfo,
             urllib.quote_plus(str(datetime.datetime.today()).split('.')[0]), eventParam)
    GameWorld.DebugLog("EventReport: %s"%getUrl)
    
    # µÚÎå¸ö²ÎÊý0´ú±íget·¢ËÍ  1´ú±ípost
    GameWorld.GetGameWorld().EventReport_EventReport("", "", "", "", 0, getUrl)
    return
 
 
## Ð´Ê¼þ±¨¸æÎļþ
#  @param eventClass 
#  @return None
def WriteEvent(eventClass):
    return
    if GameWorld.IsCrossServer():
        return
    
    if eventClass.GetScribeEventName() not in ReadChConfig.GetEvalChConfig("EventReportID"):
        return
 
    if not os.path.isdir(EventFilepath):
        os.makedirs(EventFilepath)
    
    #³¢ÊÔдµ½Í¬Ò»¸öÎļþµ«ÊÇwindow »áÓÐbug£¬Ö»Äܸ÷×Ô³ÌÐò·Ö¿ªÐ´Èë
    fp_w = GetWriteIO()
    fp_w.write("%s\t%s\n"%(eventClass.GetScribeEventName(), eventClass.GetCurEventStr()))
    fp_w.flush()
    return
 
# ·ÖÖÓ×¼µãУ׼
def FixTime():
    curTime = datetime.datetime.today()
    curTime = curTime + datetime.timedelta(minutes=Def_WriteTime-curTime.minute%Def_WriteTime)
    tmp = str(curTime).split(".")[0][:-3].replace(':', '-')
    return tmp.replace(" ", "_")
 
def GetLogFileName(fileStr):
    sessionid = md5.md5(str(random.random()) + str(time.time())).hexdigest()
    return EventFilepath + sessionid + fileStr + '.log'
 
def GetWriteIO():
    global g_wFileName
    global g_writeHandle
    global g_whStartTime
    
    fileTime = FixTime()
    if g_wFileName and fileTime in g_wFileName:
        #µ±Ç°ÎļþÖ±½Ó·µ»Ø
        return g_writeHandle
    curFileName = GetLogFileName(fileTime)
 
    if g_writeHandle != None:
        #¹Ø±Õ¾ÉÎļþ
        g_writeHandle.close()
    
    g_wFileName = curFileName
    g_writeHandle = open(g_wFileName, 'a+')
    g_whStartTime = time.time()
    return g_writeHandle
 
## =================================================================================================
 
# Ã¿¸ö×ֶζ¼Ó¦¸ÃתΪ×Ö·û´®£¬²»È»join»á±¨´í
 
class ScribeEvent(object):
    def __init__(self):
        #±ØÐë×Ö¶Î
        self.product_slug = 'yhlz'  # ÓÎÏ·±êÖ¾
        self.agent_name = ReadChConfig.GetPyMongoConfig("platform", "PlatformName") # Æ½Ì¨±êÖ¾
        self.gameserver_no = ReadChConfig.GetPyMongoConfig("platform", "ServerID")[1:] # Çø·þ
        self.time = ""    #GameWorld.GetCurrentDataTimeStr()
        
    def SetEventAgentInfo(self, accIDPlatform):
        # ÉèÖôúÀíÔËÓªÉÌÐÅÏ¢
        # @param accIDPlatform: ÕâÀïÈ¡Õ˺ÅËùÊôƽ̨£¬Ö§³Ö»ì·þ, Èç¹ûÈ¡²»µ½£¬ÔòÓÃĬÈÏÅäÖõÄÔËÓªÉÌÐÅÏ¢
        if not accIDPlatform:
            return
        self.agent_name = accIDPlatform
        self.gameserver_no = str(GameWorld.GetPlayerMainServerID(self.agent_name))
        return
    
    #¼´Ê¹ÊǷDZØÐë×Ö¶ÎÒ²Ó¦¸Ã´«ËÍ£¬¸÷×Ö¶ÎÓÃ,·Ö¸ô£¬²¢ÇÒÓÃË«ÒýºÅ°üº¬£¬²Î¿¼¸ñʽ'"1","","","12314"'
    #±ÜÃâÐ޸ĸñʽµÄÇé¿ö£¬ÕâÀïͳһÐ޸ļ´¿É
    def GetEventStr(self, tmpList):
        return '\"%s\"'%'","'.join(tmpList)
    
# 3.3.1. entry£¨ÐÂÍæ¼Òµ¼È룩
class entry(ScribeEvent):
    
    Def_EntryStep_CreatRole = 3
    Def_EntryStep_FirstLogin = 4
    
    def __init__(self):
        #±ØÐë×Ö¶Î
        super(entry, self).__init__()
        self.account_id = "" # Õ˺ŠID£¬Æ½Ì¨ÏÂΨһ£¬ÇÒÖÕÉú²»±ä
        self.step = 0 # ²½ÖèÖµ
        
        #·Ç±ØÐë×Ö¶Î
        self.ip = "" # IP µØÖ·
        self.account_name = "" # Õ˺ŵǼÃû
        self.account_type = 0 # Õ˺ÅÀàÐÍ
        self.browser = "" # Íæ¼ÒʹÓõÄä¯ÀÀÆ÷
        self.resolution = "" # Íæ¼ÒµÄ×ÀÃæ·Ö±æÂÊ£¬¸ñʽΪ¡¸¿í*¸ß¡¹
        self.os = "" # Íæ¼ÒʹÓõIJÙ×÷ϵͳ
        
        #¼´Ê±ÊǷDZØÐë×Ö¶ÎÒ²Ó¦¸Ã´«ËÍ£¬¸÷×Ö¶ÎÓÃ,·Ö¸ô£¬²¢ÇÒÓÃË«ÒýºÅ°üº¬£¬²Î¿¼¸ñʽ'"1","","","12314"'
        return
    
    def GetCurEventStr(self):
        tmpList = [self.product_slug, self.agent_name, self.ip, self.gameserver_no, self.account_id, self.account_name, 
                   str(self.account_type), self.browser, self.resolution, self.os, str(self.step)]
        
        return super(entry, self).GetEventStr(tmpList)
    
    def GetScribeEventName(self): return ShareDefine.Def_UserAction_CreateRole
    
# 3.3.2. login£¨µÇ¼£©
class login(ScribeEvent):
    def __init__(self):
        #±ØÐë×Ö¶Î
        super(login, self).__init__()
        self.account_id = "" # Õ˺ŠID£¬Æ½Ì¨ÏÂΨһ£¬ÇÒÖÕÉú²»±ä
        self.session_id = "" # »á»°ID
        
        #·Ç±ØÐë×Ö¶Î
        self.ip = "" # IP µØÖ·
        self.account_name = "" # Õ˺ŵǼÃû
        self.account_type = 0 # Õ˺ÅÀàÐÍ
        self.browser = "" # Íæ¼ÒʹÓõÄä¯ÀÀÆ÷
        self.resolution = "" # Íæ¼ÒµÄ×ÀÃæ·Ö±æÂÊ£¬¸ñʽΪ¡¸¿í*¸ß¡¹
        self.os = "" # Íæ¼ÒʹÓõIJÙ×÷ϵͳ
        self.chr_name = "" # Íæ¼Ò½ÇÉ«Ãû
        self.chr_level = 0 # Íæ¼Ò½ÇÉ«µÈ¼¶
        
        #¼´Ê±ÊǷDZØÐë×Ö¶ÎÒ²Ó¦¸Ã´«ËÍ£¬¸÷×Ö¶ÎÓÃ,·Ö¸ô£¬²¢ÇÒÓÃË«ÒýºÅ°üº¬£¬²Î¿¼¸ñʽ'"1","","","12314"'
        return
    
    def GetCurEventStr(self):
        if not self.time:
            self.time = GameWorld.GetCurrentDataTimeStr()
        tmpList = [self.product_slug, self.agent_name, self.ip, self.gameserver_no, self.account_id, self.account_name, 
                   str(self.account_type), self.browser, self.resolution, self.os, self.time, self.chr_name, 
                   str(self.chr_level), self.session_id]
        
        return super(login, self).GetEventStr(tmpList)
    
    def GetScribeEventName(self): return ShareDefine.Def_UserAction_Login
    
    
# 3.3.3. session£¨»á»°¼Ç¼£©
# Íæ¼ÒµÇ³ö¡¢ÀëÏßµÄÊý¾Ý£¬ÅäºÏµÇ¼Êý¾ÝÊý¾ÝÖÐÐÄ¿Éͳ¼Æ³öÍæ¼ÒÔÚÏßʱ³¤
class session(ScribeEvent):
    def __init__(self):
        #±ØÐë×Ö¶Î
        super(session, self).__init__()
        self.account_id = "" # Õ˺ŠID£¬Æ½Ì¨ÏÂΨһ£¬ÇÒÖÕÉú²»±ä
        self.session_id = "" # »á»°ID
        
        #·Ç±ØÐë×Ö¶Î
        self.ip = "" # IP µØÖ·
        self.account_name = "" # Õ˺ŵǼÃû
        self.account_type = 0 # Õ˺ÅÀàÐÍ
        self.chr_name = "" # Íæ¼Ò½ÇÉ«Ãû
        self.chr_level = 0 # Íæ¼Ò½ÇÉ«µÈ¼¶
        
        #¼´Ê±ÊǷDZØÐë×Ö¶ÎÒ²Ó¦¸Ã´«ËÍ£¬¸÷×Ö¶ÎÓÃ,·Ö¸ô£¬²¢ÇÒÓÃË«ÒýºÅ°üº¬£¬²Î¿¼¸ñʽ'"1","","","12314"'
        return
    
    def GetCurEventStr(self):
        if not self.time:
            self.time = GameWorld.GetCurrentDataTimeStr()
        tmpList = [self.product_slug, self.agent_name, self.ip, self.gameserver_no, self.account_id, self.account_name, 
                   str(self.account_type), self.time, self.chr_name, str(self.chr_level), self.session_id]
        
        return super(session, self).GetEventStr(tmpList)
    
    def GetScribeEventName(self): return ShareDefine.Def_UserAction_Session
    
# 3.3.5. virtual©\cost£¨ÐéÄâ±ÒÏû·Ñ£©
# Íæ¼Ò²úÉúÏû·Ñ¼Ç¼¼´ÊÕ¼¯£» 
class virtual_cost(ScribeEvent):
    def __init__(self):
        #±ØÐë×Ö¶Î
        super(virtual_cost, self).__init__()
        self.account_id = "" # Õ˺ŠID£¬Æ½Ì¨ÏÂΨһ£¬ÇÒÖÕÉú²»±ä
        self.quantity = 0 # Ïû·ÑÊýÁ¿
        self.price = 0 # Ïû·ÑµãµÄÐéÄâ±Òµ¥¼Û
        self.reason_name = "" # Ïû·ÑµãÃû³Æ
        
        #·Ç±ØÐë×Ö¶Î
        self.ip = "" # IP µØÖ·
        self.account_name = "" # Õ˺ŵǼÃû
        self.account_type = 0 # Õ˺ÅÀàÐÍ
        self.chr_name = "" # Íæ¼Ò½ÇÉ«Ãû
        self.chr_level = 0 # Íæ¼Ò½ÇÉ«µÈ¼¶
        self.balance = 0 # Íæ¼ÒÊ£ÓàÐéÄâ±Ò
        
        #¼´Ê±ÊǷDZØÐë×Ö¶ÎÒ²Ó¦¸Ã´«ËÍ£¬¸÷×Ö¶ÎÓÃ,·Ö¸ô£¬²¢ÇÒÓÃË«ÒýºÅ°üº¬£¬²Î¿¼¸ñʽ'"1","","","12314"'
        return
    
    def GetCurEventStr(self):
        if not self.time:
            self.time = GameWorld.GetCurrentDataTimeStr()
        tmpList = [self.product_slug, self.agent_name, self.ip, self.gameserver_no, self.account_id, self.account_name, 
                   str(self.account_type), self.time, self.chr_name, str(self.chr_level), str(self.quantity), 
                   str(self.price), str(self.balance), self.reason_name]
        
        return super(virtual_cost, self).GetEventStr(tmpList)
    
    def GetScribeEventName(self): return ShareDefine.Def_UserAction_VirtualCost
    
# 3.3.6. virtual©\reward£¨ÐéÄâ±ÒÔùËÍ£©
# Íæ¼Ò»ñµÃÐéÄâ±ÒÔùËÍʱ¼´ÊÕ¼¯£» 
# ³ýÁËÕæÊµ³äÖµ¶©µ¥²úÉúµÄÐéÄâ±ÒÔö¼Ó¶¼Ó¦¸Ã¼ÆÈëµ½ÐéÄâ±ÒÔùËÍ
class virtual_reward(ScribeEvent):
    def __init__(self):
        #±ØÐë×Ö¶Î
        super(virtual_reward, self).__init__()
        self.account_id = "" # Õ˺ŠID£¬Æ½Ì¨ÏÂΨһ£¬ÇÒÖÕÉú²»±ä
        self.virtual_amount = 0 # Ôö¼ÓµÄÐéÄâ±ÒÊýÁ¿
        
        #·Ç±ØÐë×Ö¶Î
        self.ip = "" # IP µØÖ·
        self.account_name = "" # Õ˺ŵǼÃû
        self.account_type = 0 # Õ˺ÅÀàÐÍ
        self.chr_name = "" # Íæ¼Ò½ÇÉ«Ãû
        self.chr_level = 0 # Íæ¼Ò½ÇÉ«µÈ¼¶
        self.balance = 0 # Íæ¼ÒÊ£ÓàÐéÄâ±Ò
        self.source = "" # »ñµÃ½±ÀøµÄ;¾¶
        
        #¼´Ê±ÊǷDZØÐë×Ö¶ÎÒ²Ó¦¸Ã´«ËÍ£¬¸÷×Ö¶ÎÓÃ,·Ö¸ô£¬²¢ÇÒÓÃË«ÒýºÅ°üº¬£¬²Î¿¼¸ñʽ'"1","","","12314"'
        return
    
    def GetCurEventStr(self):
        if not self.time:
            self.time = GameWorld.GetCurrentDataTimeStr()
        tmpList = [self.product_slug, self.agent_name, self.ip, self.gameserver_no, self.account_id, self.account_name, 
                   str(self.account_type), self.time, self.chr_name, str(self.chr_level), str(self.virtual_amount), 
                   str(self.balance), self.source]
        
        return super(virtual_reward, self).GetEventStr(tmpList)
    
    def GetScribeEventName(self): return ShareDefine.Def_UserAction_VirtualReward
    
# 3.3.12. virtual©\resource£¨ÐéÄâ×ÊÔ´²ú³öÓëÏûºÄ£©
# ²úÉúÏàÓ¦ÐéÄâ×ÊÔ´µÄÏû·Ñ¡¢Éú²ú¼Ç¼ʱ¼´ÊÕ¼¯¡£
# ÓÃÓÚͳ¼ÆÈκÎÐéÄâ×ÊÔ´Èç¸÷Àà¶þ¼¶»õ±ÒµÄ²ú³öÓëÏûºÄ
class virtual_resource(ScribeEvent):
    def __init__(self):
        #±ØÐë×Ö¶Î
        super(virtual_resource, self).__init__()
        self.account_id = "" # Õ˺ŠID£¬Æ½Ì¨ÏÂΨһ£¬ÇÒÖÕÉú²»±ä
        self.type_name = "" # ÐéÄâ×ÊÔ´ÀàÐÍÃû³Æ
        self.reason_name = "" # ×ÊÔ´µãÃû³Æ
        self.quantity = 0 # ÐéÄâ×ÊÔ´²ú³ö/ÏûºÄµÄ´ÎÊý
        self.price = 0 # ÐéÄâ×ÊÔ´²ú³ö/ÏûºÄµÄÊýÁ¿£¬Çø·ÖÕý¸º£¬ÕýֵΪ²ú³ö£¬¸ºÖµÎªÏûºÄ
        
        #·Ç±ØÐë×Ö¶Î
        self.ip = "" # IP µØÖ·
        self.account_name = "" # Õ˺ŵǼÃû
        self.account_type = 0 # Õ˺ÅÀàÐÍ
        self.chr_name = "" # Íæ¼Ò½ÇÉ«Ãû
        self.chr_level = 0 # Íæ¼Ò½ÇÉ«µÈ¼¶
        
        #¼´Ê±ÊǷDZØÐë×Ö¶ÎÒ²Ó¦¸Ã´«ËÍ£¬¸÷×Ö¶ÎÓÃ,·Ö¸ô£¬²¢ÇÒÓÃË«ÒýºÅ°üº¬£¬²Î¿¼¸ñʽ'"1","","","12314"'
        return
    
    def GetCurEventStr(self):
        if not self.time:
            self.time = GameWorld.GetCurrentDataTimeStr()
        tmpList = [self.product_slug, self.agent_name, self.ip, self.gameserver_no, self.account_id, self.account_name, 
                   str(self.account_type), self.time, self.chr_name, str(self.chr_level), self.type_name, 
                   self.reason_name, str(self.quantity), str(self.price)]
        
        return super(virtual_resource, self).GetEventStr(tmpList)
    
    def GetScribeEventName(self): return ShareDefine.Def_UserAction_VirtualResource
 
# 3.3.9. custom©\events£¨×Ô¶¨Òåʼþ£©
# ÓÃÓÚͳ¼ÆÈÎºÎÆÚÍûÈ¥¸ú×ÙµÄÊý¾Ý
class custom_events(ScribeEvent):
    def __init__(self):
        #±ØÐë×Ö¶Î
        super(custom_events, self).__init__()
        self.account_id = "" # Õ˺ŠID£¬Æ½Ì¨ÏÂΨһ£¬ÇÒÖÕÉú²»±ä
        self.event_name = "" # Ê¼þÃû³Æ
        self.session_id = "" # »á»°ID
        
        #·Ç±ØÐë×Ö¶Î
        self.ip = "" # IP µØÖ·
        self.account_name = "" # Õ˺ŵǼÃû
        self.account_type = 0 # Õ˺ÅÀàÐÍ
        self.chr_name = "" # Íæ¼Ò½ÇÉ«Ãû
        self.chr_level = 0 # Íæ¼Ò½ÇÉ«µÈ¼¶
        self.comments = "" # ±¸×¢»ò¸½¼ÓÐÅÏ¢ char(255)
 
        #¼´Ê±ÊǷDZØÐë×Ö¶ÎÒ²Ó¦¸Ã´«ËÍ£¬¸÷×Ö¶ÎÓÃ,·Ö¸ô£¬²¢ÇÒÓÃË«ÒýºÅ°üº¬£¬²Î¿¼¸ñʽ'"1","","","12314"'
        return
    
    def GetCurEventStr(self):
        if not self.time:
            self.time = GameWorld.GetCurrentDataTimeStr()
        tmpList = [self.product_slug, self.agent_name, self.ip, self.gameserver_no, self.account_id, self.account_name, 
                   str(self.account_type), self.time, self.chr_name, str(self.chr_level), self.event_name,
                   self.comments, self.session_id]
        
        return super(custom_events, self).GetEventStr(tmpList)
    
    def GetScribeEventName(self): return ShareDefine.Def_UserAction_CustomEvents
 
# 3.3.10. mission©\log£¨ÈÎÎñ¼Ç¼£©
# ¸ú×ÙÍæ¼ÒÈÎÎñ½ÓÈ¡¡¢Íê³É¡¢Ê§°ÜÇé¿ö£¬ÒÔ¼°ÓÃÓÚÁ÷Ê§Íæ¼ÒµÄÈÎÎñ·ÖÎöµÈͳ¼Æ¡£
# ÈÎÎñ½Óȡʱ¼´ÊÕ¼¯ type=0 µÄÊý¾Ý£¬ÈÎÎñ½áÊøÇҳɹ¦Ê±¼´ÊÕ¼¯ type=1¡¢mission_result=1 µÄÊý¾Ý£¬ÈÎÎñ½áÊøÇÒʧ°Üʱ¼´ÊÕ¼¯ type=1¡¢mission_result=0 µÄÊý¾Ý¡£
class missionlog(ScribeEvent):
    def __init__(self):
        #±ØÐë×Ö¶Î
        super(missionlog, self).__init__()
        self.account_id = "" # Õ˺ŠID£¬Æ½Ì¨ÏÂΨһ£¬ÇÒÖÕÉú²»±ä
        self.chr_level = 0 # Íæ¼Ò½ÇÉ«µÈ¼¶
        self.type = 0 # 0 ÈÎÎñ¿ªÊ¼ 1 ÈÎÎñ½áÊø
        self.mission_name = "" # ÈÎÎñÃû
        self.session_id = "" # »á»°ID
        
        #·Ç±ØÐë×Ö¶Î
        self.ip = "" # IP µØÖ·
        self.account_name = "" # Õ˺ŵǼÃû
        self.account_type = 0 # Õ˺ÅÀàÐÍ
        self.chr_name = "" # Íæ¼Ò½ÇÉ«Ãû
        self.mission_result = 0 # µ±ÈÎÎñ½áÊø£¬ÈÎÎñ½á¹û 0£ºÊ§°Ü 1£º³É¹¦
        self.mission_reason = "" # µ±ÈÎÎñ½áÊøÇÒÈÎÎñʧ°ÜʱµÄÔ­Òò
 
        #¼´Ê±ÊǷDZØÐë×Ö¶ÎÒ²Ó¦¸Ã´«ËÍ£¬¸÷×Ö¶ÎÓÃ,·Ö¸ô£¬²¢ÇÒÓÃË«ÒýºÅ°üº¬£¬²Î¿¼¸ñʽ'"1","","","12314"'
        
        self.scribeEventName = ShareDefine.Def_UserAction_MissionLog
        return
    
    def GetCurEventStr(self):
        if not self.time:
            self.time = GameWorld.GetCurrentDataTimeStr()
        tmpList = [self.product_slug, self.agent_name, self.ip, self.gameserver_no, self.account_id, self.account_name, 
                   str(self.account_type), self.time, self.chr_name, str(self.chr_level), str(self.type), self.mission_name,
                   str(self.mission_result), self.mission_reason, self.session_id]
        
        return super(missionlog, self).GetEventStr(tmpList)
    
    def GetScribeEventName(self): return self.scribeEventName
    
# 3.3.11. level©\up£¨Éý¼¶¼Ç¼£©
# ÓÃÓÚÍæ¼ÒÉý¼¶Ê±³¤µÈµÈ¼¶Ïà¹ØÍ³¼Æ¡£
# µÈ¼¶·¢Éú±ä»¯Ê±¼´ÊÕ¼¯£»
# ÒªÍ³¼Æ 2 ¼¶µÄÉý¼¶Ê±³¤±ØÐëÒªÓР1 ¼¶µÄÉý¼¶Êý¾Ý£¬Òò´Ë¸Õ´´½¨Íê½ÇɫʱµÄ 1 ¼¶µÄÊý¾ÝÒ²ÐèÒªÊÕ¼¯¡£
class levelup(ScribeEvent):
    def __init__(self):
        #±ØÐë×Ö¶Î
        super(levelup, self).__init__()
        self.account_id = "" # Õ˺ŠID£¬Æ½Ì¨ÏÂΨһ£¬ÇÒÖÕÉú²»±ä
        self.chr_level = 0 # Íæ¼Ò½ÇÉ«µÈ¼¶
        self.session_id = "" # »á»°ID
        
        #·Ç±ØÐë×Ö¶Î
        self.ip = "" # IP µØÖ·
        self.account_name = "" # Õ˺ŵǼÃû
        self.account_type = 0 # Õ˺ÅÀàÐÍ
        self.chr_name = "" # Íæ¼Ò½ÇÉ«Ãû
 
        #¼´Ê±ÊǷDZØÐë×Ö¶ÎÒ²Ó¦¸Ã´«ËÍ£¬¸÷×Ö¶ÎÓÃ,·Ö¸ô£¬²¢ÇÒÓÃË«ÒýºÅ°üº¬£¬²Î¿¼¸ñʽ'"1","","","12314"'
        return
    
    def GetCurEventStr(self):
        if not self.time:
            self.time = GameWorld.GetCurrentDataTimeStr()
        tmpList = [self.product_slug, self.agent_name, self.ip, self.gameserver_no, self.account_id, self.account_name, 
                   str(self.account_type), self.time, self.chr_name, str(self.chr_level), self.session_id]
        
        return super(levelup, self).GetEventStr(tmpList)
    
    def GetScribeEventName(self): return ShareDefine.Def_UserAction_LVUP
    
# 3.3.13. chat-log £¨ÁÄÌìÏûÏ¢£©
# ÓÃÓÚ¼à¿ØÍæ¼ÒÁÄÌì
class chat_log(ScribeEvent):
    def __init__(self):
        #±ØÐë×Ö¶Î
        super(chat_log, self).__init__()
        self.account_id = "" # Õ˺ŠID£¬Æ½Ì¨ÏÂΨһ£¬ÇÒÖÕÉú²»±ä
        self.chr_name = "" # Íæ¼Ò½ÇÉ«Ãû
        self.content = "" # ÁÄÌìÄÚÈÝ
        self.cmc_name = "" # ÁÄÌìÆµµÀ±êʶ
        
        #·Ç±ØÐë×Ö¶Î
        self.ip = "" # IP µØÖ·
        self.account_name = "" # Õ˺ŵǼÃû
        self.account_type = 0 # Õ˺ÅÀàÐÍ
        self.chr_level = 0 # Íæ¼Ò½ÇÉ«µÈ¼¶
        self.object = "" # Ë½ÁĶÔÏó
        self.addinfo = "" # ¶îÍâÐÅÏ¢
 
        #¼´Ê±ÊǷDZØÐë×Ö¶ÎÒ²Ó¦¸Ã´«ËÍ£¬¸÷×Ö¶ÎÓÃ,·Ö¸ô£¬²¢ÇÒÓÃË«ÒýºÅ°üº¬£¬²Î¿¼¸ñʽ'"1","","","12314"'
        return
    
    def GetCurEventStr(self):
        if not self.time:
            self.time = GameWorld.GetCurrentDataTimeStr()
        tmpList = [self.product_slug, self.agent_name, self.ip, self.gameserver_no, self.account_id, self.account_name, 
                   str(self.account_type), self.time, self.chr_name, str(self.chr_level), self.object, self.content,
                   self.addinfo, self.cmc_name]
        
        return super(chat_log, self).GetEventStr(tmpList)
    
    def GetScribeEventName(self): return ShareDefine.Def_UserAction_ChatLog
    
 
## =================================================================================================
 
#===============================================================================
# def WriteEvent_entry_firstlogin(curPlayer, browser, resolution, pcOS):
#    entryEvent = entry()
#    entryEvent.SetEventAgentInfo(GameWorld.GetPlayerPlatform(curPlayer.GetAccID()))
#    entryEvent.account_id = GameWorld.GetPlatformAccID(curPlayer.GetAccID())
#    entryEvent.step = entryEvent.Def_EntryStep_FirstLogin
#    entryEvent.ip = curPlayer.GetIP()
#    entryEvent.account_name = entryEvent.account_id
#    entryEvent.account_type = GameWorld.GetAccountType(curPlayer)
#    entryEvent.browser = browser
#    entryEvent.resolution = resolution
#    entryEvent.os = pcOS
#    WriteEvent(entryEvent)
#    return
#===============================================================================
 
def WriteEvent_login(curPlayer):
    if curPlayer.GetIP() == "127.0.0.1":
        return
    version = urllib.quote_plus(curPlayer.GetAccountData().GetClientVersion())
    EventReport(ShareDefine.Def_UserAction_Login, "Job=%s&SessionID=%s&Version=%s"%(
                                curPlayer.GetJob(), GameWorld.GetSessionID(curPlayer),
                                version), curPlayer)
 
    return
 
# ÀëÏßÊý¾Ý
def WriteEvent_session(curPlayer):
    seconds = 0
    if PlayerTJG.GetIsTJG(curPlayer):
        return
    else:
        logoffTimeStr = curPlayer.GetLogoffTime().strip()
        loginTimeStr = curPlayer.GetLoginTime().strip()
        if logoffTimeStr and loginTimeStr:
            passTimes = GameWorld.GetDateTimeByStr(logoffTimeStr) - GameWorld.GetDateTimeByStr(loginTimeStr)
            seconds = passTimes.seconds
    EventReport(ShareDefine.Def_UserAction_Session, "OnlineTime=%s&SessionID=%s"%(seconds, GameWorld.GetSessionID(curPlayer)), curPlayer)
    #===========================================================================
    # sessionEvent = session()
    # sessionEvent.SetEventAgentInfo(GameWorld.GetPlayerPlatform(curPlayer.GetAccID()))
    # sessionEvent.account_id = GameWorld.GetPlatformAccID(curPlayer.GetAccID())
    # sessionEvent.session_id = GameWorld.GetSessionID(curPlayer)
    # sessionEvent.ip = curPlayer.GetIP()
    # sessionEvent.account_name = sessionEvent.account_id
    # sessionEvent.account_type = GameWorld.GetAccountType(curPlayer)
    # sessionEvent.chr_name = curPlayer.GetPlayerName()
    # sessionEvent.chr_level = GetScribeEvent_chr_level(curPlayer)
    # WriteEvent(sessionEvent)
    #===========================================================================
    return
 
## Ð´ÐéÄâÔª±¦Ïû·Ñ¼Ç¼
#  @param quantity: Ïû·ÑÊýÁ¿
#  @param price: Ïû·ÑµãµÄÐéÄâ±Òµ¥¼Û
#  @param reason_name: Ïû·ÑµãÃû³Æ
def WriteEvent_virtual_cost(curPlayer, quantity, price, reason_name):
    '''
     ÎÊ£ºÐéÄâÏû·ÑµãµÄÁ£¶È¼¸´óºÃ£¿
        ´ð£ºÊý¾Ý±¨±í¶ÔÐéÄâÏû·ÑµÄͳ¼ÆÖ§³ÖÁ½¼¶£¬¼´Ïû·Ñµã¼°Æä¸¸ÀàÏû·Ñµã·Ö×飬¾Ý´Ë£º
       ¡ñ ½¨ÒéÊÇÏû·Ñ;¾¶¼ÓÉÏÏû·Ñ¶ÔÏ󣬱ÈÈ硸É̵깺Âò£ºÈýʬÄÔÉñµ¤¡¹£¬¶øºó½«¸ÃÏû·ÑµãÔÚÏû·Ñµã·Ö×éÀï¹éΪ¡¸É̵깺Âò¡¹£»
       ¡ñ ²»Òª¼ÓÉÏÏû·ÑÕßÈ硸Ҷ¹Âº®£ºÉ̵깺Âò£ºÈýʬÄÔÉñµ¤¡¹£»
       ¡ñ ²»Òª¼ÓÉÏÏû·Ñ¶ÔÏóµÈ¼¶È硸ǿ»¯£ºÁøÒ¶µ¶ [9¼¶]¡¹¡£
    '''
    #===========================================================================
    # virtualCostEvent = virtual_cost()
    # virtualCostEvent.SetEventAgentInfo(GameWorld.GetPlayerPlatform(curPlayer.GetAccID()))
    # virtualCostEvent.account_id = GameWorld.GetPlatformAccID(curPlayer.GetAccID())
    # virtualCostEvent.quantity = quantity
    # virtualCostEvent.price = price
    # virtualCostEvent.balance = curPlayer.GetGold()
    # virtualCostEvent.reason_name = reason_name
    # virtualCostEvent.ip = curPlayer.GetIP()
    # virtualCostEvent.account_name = virtualCostEvent.account_id
    # virtualCostEvent.account_type = GameWorld.GetAccountType(curPlayer)
    # virtualCostEvent.chr_name = curPlayer.GetPlayerName()
    # virtualCostEvent.chr_level = GetScribeEvent_chr_level(curPlayer)
    # WriteEvent(virtualCostEvent)
    #===========================================================================
    return
 
## Ð´ÐéÄâÔª±¦ÔùËÍ»ñµÃ¼Ç¼,º¬³äÖµ¿É²éµ½Õ˶һ»³ÉÐéÄâ±Òʱ¼ä
#  @param virtual_reward: Ôö¼ÓµÄÐéÄâ±ÒÊýÁ¿
#  @param source: »ñµÃ½±ÀøµÄ;¾¶
def WriteEvent_virtual_reward(curPlayer, virtual_amount, source):
    #===========================================================================
    # virtualRewardEvent = virtual_reward()
    # virtualRewardEvent.SetEventAgentInfo(GameWorld.GetPlayerPlatform(curPlayer.GetAccID()))
    # virtualRewardEvent.account_id = GameWorld.GetPlatformAccID(curPlayer.GetAccID())
    # virtualRewardEvent.virtual_amount = virtual_amount
    # virtualRewardEvent.balance = curPlayer.GetGold()
    # virtualRewardEvent.source = source
    # virtualRewardEvent.ip = curPlayer.GetIP()
    # virtualRewardEvent.account_name = virtualRewardEvent.account_id
    # virtualRewardEvent.account_type = GameWorld.GetAccountType(curPlayer)
    # virtualRewardEvent.chr_name = curPlayer.GetPlayerName()
    # virtualRewardEvent.chr_level = GetScribeEvent_chr_level(curPlayer)
    # WriteEvent(virtualRewardEvent)
    #===========================================================================
    return
 
## Ð´¶þ¼¶»õ±ÒµÄ²ú³öÓëÏûºÄ¼Ç¼
#  @param type_name: ÐéÄâ×ÊÔ´ÀàÐÍÃû³Æ, Èç½ð±Ò
#  @param reason_name: ×ÊÔ´µãÃû³Æ, ÈçË¢ÐÂÈÙÓþÉ̵ê
#  @param quantity: ÐéÄâ×ÊÔ´²ú³ö/ÏûºÄµÄ´ÎÊý
#  @param price: ÐéÄâ×ÊÔ´²ú³ö/ÏûºÄµÄÊýÁ¿µ¥¼Û£¬Çø·ÖÕý¸º£¬ÕýֵΪ²ú³ö£¬¸ºÖµÎªÏûºÄ
#  @param flow  0 ´ú±íÏû·Ñ  1 ´ú±í²ú³ö
def WriteEvent_virtual_resource(curPlayer, type_name, reason_name, quantity, price, flow, extraDict={}):
 
    #±ÜÃâ¼Ç¼̫¶àÐÅÏ¢
    if type_name in [IPY_GameWorld.TYPE_Price_Silver_Money] and abs(quantity * price) < ChConfig.Def_DRRecord_Min_Silver:
        return
    if type_name not in IpyGameDataPY.GetFuncEvalCfg("EventReport", 2):
        #GameWorld.DebugLog("¸Ã»õ±ÒÀàÐͲ»ÐèÒª»ã±¨! type_name=%s" % type_name)
        return
    # ±êʶ´Ë»õ±ÒÊÇ·ñÊÇÒ»¼¶»õ±Ò£¨³äÖµ£©
    Recharged = 1 if type_name == IPY_GameWorld.TYPE_Price_Gold_Money else 0
    #===========================================================================
    # virtualResourceEvent = virtual_resource()
    # virtualResourceEvent.SetEventAgentInfo(GameWorld.GetPlayerPlatform(curPlayer.GetAccID()))
    # virtualResourceEvent.account_id = GameWorld.GetPlatformAccID(curPlayer.GetAccID())
    # virtualResourceEvent.type_name = str(type_name)
    # virtualResourceEvent.reason_name = reason_name
    # virtualResourceEvent.quantity = quantity
    # virtualResourceEvent.price = price
    # virtualResourceEvent.ip = curPlayer.GetIP()
    # virtualResourceEvent.account_name = virtualResourceEvent.account_id
    # virtualResourceEvent.account_type = GameWorld.GetAccountType(curPlayer)
    # virtualResourceEvent.chr_name = curPlayer.GetPlayerName()
    # virtualResourceEvent.chr_level = GetScribeEvent_chr_level(curPlayer)
    # WriteEvent(virtualResourceEvent)
    #===========================================================================
    # OperatorExtra json ¸ñʽ Ïû·Ñ¾ßÌåÔ­Òò
    EventReport(ShareDefine.Def_UserAction_VirtualResource, 
                "Price=%s&Quantity=%s&OperateType=%s&CurrencyType=%s&Recharged=%s&Flow=%s&Balance=%s&OperatorExtra=%s"%(
                price, quantity, reason_name, type_name, Recharged, flow, 
                PlayerControl.GetMoneyReal(curPlayer, type_name), json.dumps(extraDict, ensure_ascii=False)), curPlayer)
    return
 
## Ð´ÈÎÎñʼþ¼Ç¼
#  @param startType: 0 ÈÎÎñ¿ªÊ¼ 1 ÈÎÎñ½áÊø
#  @param isFinish: µ±ÈÎÎñ½áÊø£¬ÈÎÎñ½á¹û 0£ºÊ§°Ü 1£º³É¹¦
#  @param failReason: µ±ÈÎÎñ½áÊøÇÒÈÎÎñʧ°ÜʱµÄÔ­Òò
def WriteEvent_mission_log(curPlayer, missionData, startType, isFinish=0, failReason=""):
    if startType not in [0, 1] or isFinish not in [0, 1]:
        return
    
    if not missionData:
        return
    
    #missionName = "0%s%s" % (missionData.ID, missionData.Name)
    missionName = missionData.ID
    __WriteEvent_mission_log(curPlayer, startType, missionName, isFinish, failReason)
    return
 
def WriteFuncCMEAcceptable(curPlayer, funcID):
    return
    if funcID not in ChConfig.FuncCMEDict:
        return
    WriteEvent_custom_mission_log(curPlayer, ChConfig.FuncCMEDict[funcID], ChConfig.CME_Log_Acceptable)
    return True
 
def WriteEvent_MWSuccess(curPlayer, mwID, succID, logType, isFinish=0):
    '''д×Ô¶¨ÒåÈÎÎñ - ·¨±¦³É¾Íʼþ, Ê¼þID¸ñʽ:  91+·¨±¦ID+ÖÁÉÙ4λµÄ³É¾ÍID
    '''
    cmeType = "91%d%04d" % (mwID, succID)
    WriteEvent_custom_mission_log(curPlayer, cmeType, logType, isFinish)
    return
 
def WriteEvent_FB(curPlayer, mapID, funcLineID, logType, joinType=0, isFinish=0, failReason=""):
    '''д×Ô¶¨ÒåÈÎÎñ - ¸±±¾Ê¼þ, Ê¼þID¸ñʽ: 90+mapID+joinType+funcLineID
    @param joinType: 0-ĬÈÏÎÞ; 1-µ¥ÈË; 2-¶àÈË; 3-ÖúÕ½;   ×¢Òâµ¥È˶ÓÎéËãµ¥ÈË
    '''
    cmeType = "90%d%d%02d" % (mapID, joinType, funcLineID)
    WriteEvent_custom_mission_log(curPlayer, cmeType, logType, isFinish, failReason=failReason)
    return
 
## Ð´×Ô¶¨ÒåÈÎÎñʼþ¼Ç¼
#  @param cmeType: ×Ô¶¨ÒåÀàÐÍ, ¶ÔÓ¦ ChConfig.CME_Type_List
#  @param logType: ¼Ç¼ÀàÐÍ, ¶ÔÓ¦ ChConfig.CME_Log_Type_List
#  @param cmeInfoEx: À©Õ¹×Ô¶¨ÒåÐÅÏ¢, Ò»°ãÓÃÓÚÐèÒª·Ö×ÓÏî¼Ç¼µÄÀàÐÍ
#  @param isFinish: µ±Ê¼þ½áÊøÊ±½á¹û 0£ºÊ§°Ü 1£º³É¹¦
#  @param failReason: µ±Ê¼þ½áÊøÊ±Ê§°ÜµÄÔ­Òò
def WriteEvent_custom_mission_log(curPlayer, cmeType, logType, isFinish=0, failReason="", cmeInfoEx=None):
    #if cmeType not in ChConfig.CME_Type_List:
    #    return
    
    if logType not in ChConfig.CME_Log_Type_List:
        return
    
    startType = 1 if logType == ChConfig.CME_Log_End else 0 
    #===========================================================================
    # missionName = ChConfig.CME_Type_Dict.get(cmeType, "δ֪")
    # if cmeInfoEx != None:
    #    missionName = "%s:%s" % (missionName, cmeInfoEx)
    # if logType == ChConfig.CME_Log_Acceptable:
    #    missionName = "%s_¿ÉÌôÕ½" % missionName
    #===========================================================================
        
    missionName = cmeType
    __WriteEvent_mission_log(curPlayer, startType, missionName, isFinish, failReason, cmeType in ChConfig.CME_Ex_Log_List)
    return
 
## Ð´ÈÎÎñʼþ¼Ç¼
#  @param startType: 0 ÈÎÎñ¿ªÊ¼ 1 ÈÎÎñ½áÊø
#  @param missionName: ÈÎÎñÃû
#  @param isFinish: µ±ÈÎÎñ½áÊø£¬ÈÎÎñ½á¹û 0£ºÊ§°Ü 1£º³É¹¦
#  @param failReason: µ±ÈÎÎñ½áÊøÇÒÈÎÎñʧ°ÜʱµÄÔ­Òò
def __WriteEvent_mission_log(curPlayer, startType, missionName, isFinish, failReason, isExLog=False):
    isFinish = 1 if isFinish else 0
    exDict = {"Fail":failReason}
    resultMsg = json.dumps(exDict, ensure_ascii=False)
    EventReport(ShareDefine.Def_UserAction_MissionLog, 
                "MissionStep=%s&MissionID=%s&MissionResult=%s&MissionExtra=%s"%(startType, missionName, isFinish, resultMsg), curPlayer)
    #===========================================================================
    # missionlogEvent = missionlog()
    # missionlogEvent.SetEventAgentInfo(GameWorld.GetPlayerPlatform(curPlayer.GetAccID()))
    # missionlogEvent.scribeEventName = ShareDefine.Def_UserAction_ExMissionLog if isExLog else \
    #                                    ShareDefine.Def_UserAction_MissionLog
    # missionlogEvent.account_id = GameWorld.GetPlatformAccID(curPlayer.GetAccID())
    # missionlogEvent.chr_level = GetScribeEvent_chr_level(curPlayer)
    # missionlogEvent.type = startType
    # missionlogEvent.mission_name = missionName
    # missionlogEvent.session_id = GameWorld.GetSessionID(curPlayer)
    # 
    # missionlogEvent.ip = curPlayer.GetIP()
    # missionlogEvent.account_name = missionlogEvent.account_id
    # missionlogEvent.account_type = GameWorld.GetAccountType(curPlayer)
    # missionlogEvent.chr_name = curPlayer.GetPlayerName()
    # missionlogEvent.mission_result = isFinish
    # missionlogEvent.mission_reason = failReason
    # WriteEvent(missionlogEvent)
    #===========================================================================
    return
 
def WriteEvent_level_up(curPlayer):
    EventReport(ShareDefine.Def_UserAction_LVUP, "", curPlayer)
    #===========================================================================
    # levelupEvent = levelup()
    # levelupEvent.SetEventAgentInfo(GameWorld.GetPlayerPlatform(curPlayer.GetAccID()))
    # levelupEvent.account_id = GameWorld.GetPlatformAccID(curPlayer.GetAccID())
    # levelupEvent.session_id = GameWorld.GetSessionID(curPlayer)
    # levelupEvent.ip = curPlayer.GetIP()
    # levelupEvent.account_name = levelupEvent.account_id
    # levelupEvent.account_type = GameWorld.GetAccountType(curPlayer)
    # levelupEvent.chr_name = curPlayer.GetPlayerName()
    # levelupEvent.chr_level = GetScribeEvent_chr_level(curPlayer)
    # WriteEvent(levelupEvent)
    #===========================================================================
    return
 
def WriteEvent_chat_log(curPlayer, content, cmc_name, tagName="", addinfo=""):
    return
    #===========================================================================
    # '''
    # @todo: Ð´ÁÄÌì¼à¿Ø¼Ç¼
    # @param content: ÁÄÌìÄÚÈÝ
    # @param cmc_name: ÁÄÌìÆµµÀ±êʶ
    # @param tagName: Ë½ÁĶÔÏó
    # @param addinfo: ¶îÍâÐÅÏ¢
    # '''
    # chatlogEvent = chat_log()
    # chatlogEvent.SetEventAgentInfo(GameWorld.GetPlayerPlatform(curPlayer.GetAccID()))
    # chatlogEvent.account_id = GameWorld.GetPlatformAccID(curPlayer.GetAccID())
    # chatlogEvent.chr_name = curPlayer.GetName()
    # chatlogEvent.content = __GetEventChatContent(content)
    # chatlogEvent.cmc_name = cmc_name
    # chatlogEvent.ip = curPlayer.GetIP()
    # chatlogEvent.account_name = chatlogEvent.account_id
    # chatlogEvent.account_type = GameWorld.GetAccountType(curPlayer)
    # chatlogEvent.chr_level = GetScribeEvent_chr_level(curPlayer)
    # chatlogEvent.object = tagName
    # chatlogEvent.addinfo = addinfo
    # WriteEvent(chatlogEvent)
    #===========================================================================
    return
 
def __GetEventChatContent(content):
    '''
    <a color="255,255,0" href="GOTO 10000,74,60">[µØÍ¼:ĺ¹âÖ®³Ç(74,60)]</a>
    <A color="205,0,0" onmouseover="ShowInfo ITEM,55986" DATA="07 04 01 00 B2 DA 00 00 00 01 00 01 
        28 01 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
        00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 3C 00 00 00 7B 27 32 38 27 3A 5B 
        27 31 30 32 33 34 27 5D 2C 27 31 39 27 3A 5B 27 33 35 34 27 2C 27 38 35 36 27 2C 27 33 35 
        34 27 2C 27 37 35 38 27 2C 27 39 35 31 27 2C 27 31 30 35 32 27 5D 7D 04 00 00 00 00 00 00 
        00 00 00 00 00 00 00 00 00 00 ">[ÉñÊ¥µÄ°ÁÊÀÖ®¹­ +40]</a>
    '''
    tempMatch = re.search("<a color=.*?>.*?</a>", content)
    if tempMatch:
        tempStr = tempMatch.group()
        markIndex = tempStr.index(">") + 1
        repStr = tempStr[markIndex:tempStr.index("<", markIndex)]
        content = content.replace(tempStr, repStr)
        
    tempMatch = re.search("<A color=.*?>.*?</a>", content)
    if tempMatch:
        tempStr = tempMatch.group()
        markIndex = tempStr.index(">") + 1
        repStr = tempStr[markIndex:tempStr.index("<", markIndex)]
        content = content.replace(tempStr, repStr)
        
    # Ìæ»»»»ÐÐ
    content = content.replace("\r", "") 
    content = content.replace("\n", "") 
    return content
 
## Ð´×Ô¶¨Òåʼþ¼Ç¼
#  @param event_name: Ê¼þÃû³Æ
#  @param comments: ±¸×¢»ò¸½¼ÓÐÅÏ¢
def WriteEvent_custom_events(curPlayer, event_name, comments):
    #===========================================================================
    # customEvent = custom_events()
    # customEvent.SetEventAgentInfo(GameWorld.GetPlayerPlatform(curPlayer.GetAccID()))
    # customEvent.account_id = GameWorld.GetPlatformAccID(curPlayer.GetAccID())
    # customEvent.event_name = event_name
    # customEvent.session_id = GameWorld.GetSessionID(curPlayer)
    # 
    # customEvent.ip = curPlayer.GetIP()
    # customEvent.account_name = customEvent.account_id
    # customEvent.account_type = GameWorld.GetAccountType(curPlayer)
    # customEvent.chr_name = curPlayer.GetPlayerName()
    # customEvent.chr_level = GetScribeEvent_chr_level(curPlayer)
    # customEvent.comments = CommFunc.GetStrCutoff(comments, 255)
    # WriteEvent(customEvent)
    #===========================================================================
    return
 
#// A1 01 Íæ¼ÒµçÄÔÐÅÏ¢ #tagCMPCInfo
#
#struct tagCMPCInfo
#{
#    tagHead        Head;
#    BYTE        PCOSLen; 
#    char        PCOS[PCOSLen];    // ²Ù×÷ϵͳ
#    BYTE        ResolutionLen; 
#    char        Resolution[ResolutionLen];    // ·Ö±æÂÊ
#    BYTE        BrowserLen; 
#    char        Browser[BrowserLen];    // ä¯ÀÀÆ÷
#    BYTE        ScribeTypeLen; 
#    char        ScribeType[ScribeTypeLen];    // ¼Ç¼ÀàÐÍ
#    BYTE        ScribeDataLen; 
#    char        ScribeData[ScribeDataLen];    // ¼Ç¼À©Õ¹ÐÅÏ¢
#};
def ReceiveClientPCInfo(index, clientData, tick):
    #===========================================================================
    # curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
    # PCOS = clientData.PCOS
    # Resolution = clientData.Resolution
    # Browser = clientData.Browser
    # ScribeType = clientData.ScribeType
    # #ScribeData = clientData.ScribeData
    # 
    # GameWorld.DebugLog("ReceiveClientPCInfo %s" % ScribeType)
    # GameWorld.DebugLog("    PCOS=%s" % PCOS)
    # GameWorld.DebugLog("    Resolution=%s" % Resolution)
    # GameWorld.DebugLog("    Browser=%s" % Browser)
    # 
    # # ×ª»¯Îª¶Ô·½ËùÐè¸ñʽ
    # if PCOS and "Windows" in PCOS:
    #    PCOS = " ".join(PCOS.split(" ")[:2])
    # 
    # # ×ª»¯Îª¶Ô·½ËùÐè¸ñʽ
    # if Resolution:
    #    Resolution = "%s*%s" % eval(Resolution)
    # 
    # if ScribeType == ShareDefine.Def_UserAction_Login:
    #    firstLogin = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FirstLogin)
    #    if not firstLogin:
    #        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FirstLogin, 1)
    #        WriteEvent_entry_firstlogin(curPlayer, Browser, Resolution, PCOS)
    #        if curPlayer.GetLV() == 1:
    #            WriteEvent_level_up(curPlayer) # Ê׵Ƿ¢ËÍÒ»´Î1¼¶Êý¾Ý
    #        GameWorld.DebugLog("    entry_firstlogin")
    #        
    #    WriteEvent_login(curPlayer, Browser, Resolution, PCOS)
    #===========================================================================
            
    return
 
#// A2 19 ÓÎÏ·½¨ÒéÊÕ¼¯ #tagCMAdviceSubmit
#
#struct    tagCMAdviceSubmit
#{
#    tagHead        Head;
#    BYTE        Type;        //Ìá½»ÀàÐÍ
#    WORD        Len;
#    char        Content[Len];    //size = Len
#};
def OnSubmitBugSuggest(index, clientData, tick):
    #===========================================================================
    # curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
    # subType = clientData.Type
    # content = clientData.Content
    # eventName = Def_Custom_Events_Bug if subType == 0 else Def_Custom_Events_Suggest
    # WriteEvent_custom_events(curPlayer, eventName, content)
    # DataRecordPack.DR_BugSuggest(curPlayer, eventName, content)
    #===========================================================================
    return
 
def GetScribeEvent_chr_level(curPlayer):
    transCnt, showLV = GameWorld.GetClientLV(curPlayer)
    return transCnt * 1000 + showLV
 
 
## -------------------------------------- À©Õ¹×Ô¶¨Òå ---------------------------------------
 
class horse_class(ScribeEvent):
    # ×øÆï½ø½×¼Ç¼
    def __init__(self):
        #±ØÐë×Ö¶Î
        super(horse_class, self).__init__()
        self.account_id = "" # Õ˺ŠID£¬Æ½Ì¨ÏÂΨһ£¬ÇÒÖÕÉú²»±ä
        self.chr_name = "" # Íæ¼Ò½ÇÉ«Ãû
        
        self.bef_class_lv = 0 # ´Ë´Î½ø½×²Ù×÷ǰµÄ×øÆïµÈ½×, 0´ú±í1½×
        self.bef_exp = 0 # ´Ë´Î½ø½×²Ù×÷ǰµÄ×øÆïµÈ½×ÐÇÊýµÄ¾­ÑéÖµ
        self.cost_item_cnt = 0 # ´Ë´Î½ø½×ÏûºÄµÄ½ø½×µÀ¾ßÊýÁ¿
        self.aft_class_lv = 0 # ´Ë´Î½ø½×²Ù×÷ºóµÄ×øÆïµÈ½×, 0´ú±í1½×
        self.aft_exp = 0 # ´Ë´Î½ø½×²Ù×÷ºóµÄ×øÆïµÈ½×ÐÇÊýµÄ¾­ÑéÖµ
        
        #·Ç±ØÐë×Ö¶Î
 
        #¼´Ê±ÊǷDZØÐë×Ö¶ÎÒ²Ó¦¸Ã´«ËÍ£¬¸÷×Ö¶ÎÓÃ,·Ö¸ô£¬²¢ÇÒÓÃË«ÒýºÅ°üº¬£¬²Î¿¼¸ñʽ'"1","","","12314"'
        return
    
    def GetCurEventStr(self):
        if not self.time:
            self.time = GameWorld.GetCurrentDataTimeStr()
        tmpList = [self.product_slug, self.agent_name, self.gameserver_no, self.account_id, self.chr_name, 
                   str(self.bef_class_lv), str(self.bef_exp), str(self.cost_item_cnt),
                   str(self.aft_class_lv), str(self.aft_exp), self.time]
        
        return super(horse_class, self).GetEventStr(tmpList)
    
    def GetScribeEventName(self): return ShareDefine.Def_UserAction_HorseClass
    
def WriteEvent_horse_class(curPlayer, befClassLV, befExp, costCnt, aftClassLV, aftExp):
    ## Ð´×øÆï½ø½×¼Ç¼
    #===========================================================================
    # horseClass = horse_class()
    # horseClass.SetEventAgentInfo(GameWorld.GetPlayerPlatform(curPlayer.GetAccID()))
    # horseClass.account_id = GameWorld.GetPlatformAccID(curPlayer.GetAccID())
    # horseClass.chr_name = curPlayer.GetPlayerName()
    # horseClass.bef_class_lv = befClassLV
    # horseClass.bef_exp = befExp
    # horseClass.cost_item_cnt = costCnt
    # horseClass.aft_class_lv = aftClassLV
    # horseClass.aft_exp = aftExp
    # WriteEvent(horseClass)
    #===========================================================================
    return
 
class wing_class(ScribeEvent):
    # ³á°ò½ø½×¼Ç¼
    def __init__(self):
        #±ØÐë×Ö¶Î
        super(wing_class, self).__init__()
        self.account_id = "" # Õ˺ŠID£¬Æ½Ì¨ÏÂΨһ£¬ÇÒÖÕÉú²»±ä
        self.chr_name = "" # Íæ¼Ò½ÇÉ«Ãû
        
        self.bef_class_lv = 0 # µ±Ç°³á°òµÈ½×, 0´ú±í1½×
        self.bef_exp = 0 # ½ø½×²Ù×÷ǰµÄ×£¸£Öµ
        self.cost_item_cnt = 0 # ´Ë´Î½ø½×ÏûºÄµÄ½ø½×µÀ¾ßÊýÁ¿
        self.aft_class_lv = 0 # ´Ë´Î½ø½×²Ù×÷ºó³á°òµÄµÈ½×, 0´ú±í1½×
        self.aft_exp = 0 # ½ø½×²Ù×÷ºóµÄ×£¸£Öµ
        
        #·Ç±ØÐë×Ö¶Î
 
        #¼´Ê±ÊǷDZØÐë×Ö¶ÎÒ²Ó¦¸Ã´«ËÍ£¬¸÷×Ö¶ÎÓÃ,·Ö¸ô£¬²¢ÇÒÓÃË«ÒýºÅ°üº¬£¬²Î¿¼¸ñʽ'"1","","","12314"'
        return
    
    def GetCurEventStr(self):
        if not self.time:
            self.time = GameWorld.GetCurrentDataTimeStr()
        tmpList = [self.product_slug, self.agent_name, self.gameserver_no, self.account_id, self.chr_name, 
                   str(self.bef_class_lv), str(self.bef_exp), str(self.cost_item_cnt),
                   str(self.aft_class_lv), str(self.aft_exp), self.time]
        
        return super(wing_class, self).GetEventStr(tmpList)
    
    def GetScribeEventName(self): return ShareDefine.Def_UserAction_WingClass
    
def WriteEvent_wing_class(curPlayer, befClassLV, befExp, costCnt, aftClassLV, aftExp):
    ## Ð´³á°ò½ø½×¼Ç¼
    #===========================================================================
    # wingClass = wing_class()
    # wingClass.SetEventAgentInfo(GameWorld.GetPlayerPlatform(curPlayer.GetAccID()))
    # wingClass.account_id = GameWorld.GetPlatformAccID(curPlayer.GetAccID())
    # wingClass.chr_name = curPlayer.GetPlayerName()
    # wingClass.bef_class_lv = befClassLV
    # wingClass.bef_exp = befExp
    # wingClass.cost_item_cnt = costCnt
    # wingClass.aft_class_lv = aftClassLV
    # wingClass.aft_exp = aftExp
    # WriteEvent(wingClass)
    #===========================================================================
    return
 
class pet_lv(ScribeEvent):
    # ³èÎïÉý¼¶¼Ç¼
    def __init__(self):
        #±ØÐë×Ö¶Î
        super(pet_lv, self).__init__()
        self.account_id = "" # Õ˺ŠID£¬Æ½Ì¨ÏÂΨһ£¬ÇÒÖÕÉú²»±ä
        self.chr_name = "" # Íæ¼Ò½ÇÉ«Ãû
        
        self.bef_lv = 0 # Éý¼¶Ç°µÈ¼¶, 0´ú±í1ÐÇ
        self.aft_lv = 0 # ´Ë´ÎÉý¼¶²Ù×÷ºóµÈ¼¶
        self.bef_exp = 0 ## ´Ë´Î½ø½×²Ù×÷ǰµÄ¾­ÑéÖµ
        self.aft_exp = 0 ## ´Ë´Î½ø½×²Ù×÷ºóµÄ¾­ÑéÖµ
        #·Ç±ØÐë×Ö¶Î
 
        #¼´Ê±ÊǷDZØÐë×Ö¶ÎÒ²Ó¦¸Ã´«ËÍ£¬¸÷×Ö¶ÎÓÃ,·Ö¸ô£¬²¢ÇÒÓÃË«ÒýºÅ°üº¬£¬²Î¿¼¸ñʽ'"1","","","12314"'
        return
    
    def GetCurEventStr(self):
        if not self.time:
            self.time = GameWorld.GetCurrentDataTimeStr()
        tmpList = [self.product_slug, self.agent_name, self.gameserver_no, self.account_id, self.chr_name, 
                   str(self.bef_lv), str(self.aft_lv), str(self.bef_exp), str(self.aft_exp), self.time]
        
        return super(pet_lv, self).GetEventStr(tmpList)
    
    def GetScribeEventName(self): return ShareDefine.Def_UserAction_PetLV
    
def WriteEvent_pet_lv(curPlayer, befLV, aftLV, befExp, aftExp):
    ## Ð´³èÎïÉý¼¶¼Ç¼
    #===========================================================================
    # petLV = pet_lv()
    # petLV.SetEventAgentInfo(GameWorld.GetPlayerPlatform(curPlayer.GetAccID()))
    # petLV.account_id = GameWorld.GetPlatformAccID(curPlayer.GetAccID())
    # petLV.chr_name = curPlayer.GetPlayerName()
    # petLV.bef_lv = befLV
    # petLV.aft_lv = aftLV
    # petLV.bef_exp = befExp
    # petLV.aft_exp = aftExp
    # WriteEvent(petLV)
    #===========================================================================
    return
 
class pet_class(ScribeEvent):
    # ³èÎï½ø½×¼Ç¼
    def __init__(self):
        #±ØÐë×Ö¶Î
        super(pet_class, self).__init__()
        self.account_id = "" # Õ˺ŠID£¬Æ½Ì¨ÏÂΨһ£¬ÇÒÖÕÉú²»±ä
        self.chr_name = "" # Íæ¼Ò½ÇÉ«Ãû
        
        self.pet_name = "" # ³èÎïÃû³Æ
        self.bef_class_lv = 0 # ²Ù×÷ǰµÄµÈ½×, 0´ú±í1½×
        self.bef_exp = 0 # ²Ù×÷ǰµÄ×£¸£Öµ
        self.aft_class_lv = 0 # ´Ë´Î½ø½×²Ù×÷ºóµÄµÈ½×
        self.aft_exp = 0 # ½ø½×²Ù×÷ºóµÄ×£¸£Öµ
        
        #·Ç±ØÐë×Ö¶Î
 
        #¼´Ê±ÊǷDZØÐë×Ö¶ÎÒ²Ó¦¸Ã´«ËÍ£¬¸÷×Ö¶ÎÓÃ,·Ö¸ô£¬²¢ÇÒÓÃË«ÒýºÅ°üº¬£¬²Î¿¼¸ñʽ'"1","","","12314"'
        return
    
    def GetCurEventStr(self):
        if not self.time:
            self.time = GameWorld.GetCurrentDataTimeStr()
        tmpList = [self.product_slug, self.agent_name, self.gameserver_no, self.account_id, self.chr_name, 
                   self.pet_name, str(self.bef_class_lv), str(self.bef_exp), 
                   str(self.aft_class_lv), str(self.aft_exp), self.time]
        
        return super(pet_class, self).GetEventStr(tmpList)
    
    def GetScribeEventName(self): return ShareDefine.Def_UserAction_PetClass
    
def WriteEvent_pet_class(curPlayer, petName, befClassLV, befExp, aftClassLV, aftExp):
    ## Ð´³èÎï½ø½×¼Ç¼
    #===========================================================================
    # petLV = pet_class()
    # petLV.SetEventAgentInfo(GameWorld.GetPlayerPlatform(curPlayer.GetAccID()))
    # petLV.account_id = GameWorld.GetPlatformAccID(curPlayer.GetAccID())
    # petLV.chr_name = curPlayer.GetPlayerName()
    # petLV.pet_name = petName
    # petLV.bef_class_lv = befClassLV
    # petLV.bef_exp = befExp
    # petLV.aft_class_lv = aftClassLV
    # petLV.aft_exp = aftExp
    # WriteEvent(petLV)
    #===========================================================================
    return
 
class give_money(ScribeEvent):
    # »õ±Ò²ú³ö¼Ç¼
    def __init__(self):
        #±ØÐë×Ö¶Î
        super(give_money, self).__init__()
        self.account_id = "" # Õ˺ŠID£¬Æ½Ì¨ÏÂΨһ£¬ÇÒÖÕÉú²»±ä
        self.chr_name = "" # Íæ¼Ò½ÇÉ«Ãû
        
        self.source = "" # À´Ô´
        self.type_name = "" # »õ±ÒÃû³Æ
        self.addMoney = 0 # ²ú³öÊýÁ¿
        self.total_money = 0 # Ê£Óà»õ±Ò×ÜÁ¿
        
        #·Ç±ØÐë×Ö¶Î
 
        #¼´Ê±ÊǷDZØÐë×Ö¶ÎÒ²Ó¦¸Ã´«ËÍ£¬¸÷×Ö¶ÎÓÃ,·Ö¸ô£¬²¢ÇÒÓÃË«ÒýºÅ°üº¬£¬²Î¿¼¸ñʽ'"1","","","12314"'
        return
    
    def GetCurEventStr(self):
        if not self.time:
            self.time = GameWorld.GetCurrentDataTimeStr()
        tmpList = [self.product_slug, self.agent_name, self.gameserver_no, self.account_id, self.chr_name, 
                   self.source, self.type_name, str(self.addMoney), str(self.total_money), self.time]
        
        return super(give_money, self).GetEventStr(tmpList)
    
    def GetScribeEventName(self): return ShareDefine.Def_UserAction_GiveMoney
    
def WriteEvent_give_money(curPlayer, source, typeName, addMoney, totalMoney):
    ## Ð´»õ±Ò²ú³ö¼Ç¼
    #===========================================================================
    # giveMoney = give_money()
    # giveMoney.SetEventAgentInfo(GameWorld.GetPlayerPlatform(curPlayer.GetAccID()))
    # giveMoney.account_id = GameWorld.GetPlatformAccID(curPlayer.GetAccID())
    # giveMoney.chr_name = curPlayer.GetPlayerName()
    # giveMoney.source = source
    # giveMoney.type_name = typeName
    # giveMoney.addMoney = addMoney
    # giveMoney.total_money = totalMoney
    # WriteEvent(giveMoney)
    #===========================================================================
    return
 
class pay_money(ScribeEvent):
    # »õ±ÒÏûºÄ¼Ç¼
    def __init__(self):
        #±ØÐë×Ö¶Î
        super(pay_money, self).__init__()
        self.account_id = "" # Õ˺ŠID£¬Æ½Ì¨ÏÂΨһ£¬ÇÒÖÕÉú²»±ä
        self.chr_name = "" # Íæ¼Ò½ÇÉ«Ãû
        
        self.reason_name = "" # Ïû·Ñµã
        self.type_name = "" # »õ±ÒÃû³Æ
        self.costmoney = 0 # ÏûºÄÊýÁ¿
        self.total_money = 0 # Ê£Óà»õ±Ò×ÜÁ¿
        
        #·Ç±ØÐë×Ö¶Î
 
        #¼´Ê±ÊǷDZØÐë×Ö¶ÎÒ²Ó¦¸Ã´«ËÍ£¬¸÷×Ö¶ÎÓÃ,·Ö¸ô£¬²¢ÇÒÓÃË«ÒýºÅ°üº¬£¬²Î¿¼¸ñʽ'"1","","","12314"'
        return
    
    def GetCurEventStr(self):
        if not self.time:
            self.time = GameWorld.GetCurrentDataTimeStr()
        tmpList = [self.product_slug, self.agent_name, self.gameserver_no, self.account_id, self.chr_name, 
                   self.reason_name, self.type_name, str(self.costmoney), str(self.total_money), self.time]
        
        return super(pay_money, self).GetEventStr(tmpList)
    
    def GetScribeEventName(self): return ShareDefine.Def_UserAction_PayMoney
    
def WriteEvent_pay_money(curPlayer, reasonName, typeName, costMoney, totalMoney):
    ## Ð´»õ±ÒÏûºÄ¼Ç¼
    #===========================================================================
    # payMoney = pay_money()
    # payMoney.SetEventAgentInfo(GameWorld.GetPlayerPlatform(curPlayer.GetAccID()))
    # payMoney.account_id = GameWorld.GetPlatformAccID(curPlayer.GetAccID())
    # payMoney.chr_name = curPlayer.GetPlayerName()
    # payMoney.reason_name = reasonName
    # payMoney.type_name = typeName
    # payMoney.costmoney = costMoney
    # payMoney.total_money = totalMoney
    # WriteEvent(payMoney)
    #===========================================================================
    return
 
class equip_item(ScribeEvent):
    # Íæ¼Ò×°±¸Í³¼Æ
    def __init__(self):
        #±ØÐë×Ö¶Î
        super(equip_item, self).__init__()
        self.account_id = "" # Õ˺ŠID£¬Æ½Ì¨ÏÂΨһ£¬ÇÒÖÕÉú²»±ä
        self.chr_name = "" # Íæ¼Ò½ÇÉ«Ãû
        
        self.equip_place = 0 # ×°±¸Î»
        self.class_lv = 0 # ×°±¸½×Êý, 0ÐÂÊÖ½×, 1-1½×
        self.item_quality = 0 # Æ·ÖÊ
        
        #·Ç±ØÐë×Ö¶Î
 
        #¼´Ê±ÊǷDZØÐë×Ö¶ÎÒ²Ó¦¸Ã´«ËÍ£¬¸÷×Ö¶ÎÓÃ,·Ö¸ô£¬²¢ÇÒÓÃË«ÒýºÅ°üº¬£¬²Î¿¼¸ñʽ'"1","","","12314"'
        return
    
    def GetCurEventStr(self):
        if not self.time:
            self.time = GameWorld.GetCurrentDataTimeStr()
        tmpList = [self.product_slug, self.agent_name, self.gameserver_no, self.account_id, self.chr_name, 
                   str(self.equip_place), str(self.class_lv), str(self.item_quality), self.time]
        
        return super(equip_item, self).GetEventStr(tmpList)
    
    def GetScribeEventName(self): return ShareDefine.Def_UserAction_EquipItem
    
def WriteEvent_orange_equip(curPlayer, place, classLV, quality):
    ## Ð´Íæ¼Ò×°±¸Í³¼Æ
    #===========================================================================
    # equipItem = equip_item()
    # equipItem.SetEventAgentInfo(GameWorld.GetPlayerPlatform(curPlayer.GetAccID()))
    # equipItem.account_id = GameWorld.GetPlatformAccID(curPlayer.GetAccID())
    # equipItem.chr_name = curPlayer.GetPlayerName()
    # equipItem.equip_place = place
    # equipItem.class_lv = classLV
    # equipItem.item_quality = quality
    # WriteEvent(equipItem)
    #===========================================================================
    return
 
class item_record(ScribeEvent):
    # ÎïÆ·Á÷Ë®¼Ç¼
    def __init__(self):
        #±ØÐë×Ö¶Î
        super(item_record, self).__init__()
        self.account_id = "" # Õ˺ŠID£¬Æ½Ì¨ÏÂΨһ£¬ÇÒÖÕÉú²»±ä
        self.chr_name = "" # Íæ¼Ò½ÇÉ«Ãû
        
        self.rec_type = 0 # »ñµÃ¡¢Ê§È¥
        self.event_name = "" # Ê¼þµãÃû³Æ
        self.item_name = "" # ÎïÆ·Ãû
        self.item_count = 0 # ÎïÆ·ÊýÁ¿
        self.guid = "" # ÎïÆ·Î¨Ò»ID
        
        #·Ç±ØÐë×Ö¶Î
 
        #¼´Ê±ÊǷDZØÐë×Ö¶ÎÒ²Ó¦¸Ã´«ËÍ£¬¸÷×Ö¶ÎÓÃ,·Ö¸ô£¬²¢ÇÒÓÃË«ÒýºÅ°üº¬£¬²Î¿¼¸ñʽ'"1","","","12314"'
        return
    
    def GetCurEventStr(self):
        if not self.time:
            self.time = GameWorld.GetCurrentDataTimeStr()
        tmpList = [self.product_slug, self.agent_name, self.gameserver_no, self.account_id, self.chr_name, 
                   str(self.rec_type), self.event_name, self.item_name, str(self.item_count), self.guid, self.time]
        
        return super(item_record, self).GetEventStr(tmpList)
    
    def GetScribeEventName(self): return ShareDefine.Def_UserAction_ItemRecord
    
def WriteEvent_item_record(curPlayer, recType, operateType, itemData, operatorExtra):
    EventReport(ShareDefine.Def_UserAction_ItemRecord, "Flow=%s&OperateType=%s&ItemData=%s&OperatorExtra=%s" 
                % (recType, operateType, 
                   json.dumps(itemData, ensure_ascii=False), 
                   json.dumps(operatorExtra, ensure_ascii=False)), curPlayer)
    return
    #===============================================================================================
    # ''' @todo: ÎïÆ·Á÷Ë®¼Ç¼
    #    @param recType: 1-»ñµÃ£»-1-ʧȥ
    # '''
    # itemRecord = item_record()
    # itemRecord.SetEventAgentInfo(GameWorld.GetPlayerPlatform(curPlayer.GetAccID()))
    # itemRecord.account_id = GameWorld.GetPlatformAccID(curPlayer.GetAccID())
    # itemRecord.chr_name = curPlayer.GetPlayerName()
    # itemRecord.rec_type = recType
    # itemRecord.event_name = eventName
    # itemRecord.item_name = itemName
    # itemRecord.item_count = itemCount
    # itemRecord.guid = guid
    # WriteEvent(itemRecord)
    # return
    #===============================================================================================
 
class coin_to_gold(ScribeEvent):
    # ¶Ò»»µãȯ
    def __init__(self):
        #±ØÐë×Ö¶Î
        super(coin_to_gold, self).__init__()
        self.account_id = "" # Õ˺ŠID£¬Æ½Ì¨ÏÂΨһ£¬ÇÒÖÕÉú²»±ä
        self.chr_name = "" # Íæ¼Ò½ÇÉ«Ãû
        
        self.order_id = "" # ¶©µ¥ID
        self.event_name = "" # Ê¼þµãÃû³Æ
        self.coin = 0 # ¶Ò»»µãȯ
        self.coin_prize = 0 # ½±Àøµãȯ
        self.gold = 0 # »ñµÃ×êʯ
        self.total_gold = 0 # µ±Ç°×Ü×êʯÊý
        
        #·Ç±ØÐë×Ö¶Î
 
        #¼´Ê±ÊǷDZØÐë×Ö¶ÎÒ²Ó¦¸Ã´«ËÍ£¬¸÷×Ö¶ÎÓÃ,·Ö¸ô£¬²¢ÇÒÓÃË«ÒýºÅ°üº¬£¬²Î¿¼¸ñʽ'"1","","","12314"'
        return
    
    def GetCurEventStr(self):
        if not self.time:
            self.time = GameWorld.GetCurrentDataTimeStr()
        tmpList = [self.product_slug, self.agent_name, self.gameserver_no, self.account_id, self.chr_name, 
                   self.order_id, self.event_name, str(self.coin), str(self.coin_prize), str(self.gold), 
                   str(self.total_gold), self.time]
        
        return super(coin_to_gold, self).GetEventStr(tmpList)
    
    def GetScribeEventName(self): return ShareDefine.Def_UserAction_CoinToGold
   
def WriteEvent_coin_to_gold(curPlayer, orderID, eventName, coin, prizeCoin, addGold):
    return
    #===========================================================================
    # coinToGold = coin_to_gold()
    # coinToGold.SetEventAgentInfo(GameWorld.GetPlayerPlatform(curPlayer.GetAccID()))
    # coinToGold.account_id = GameWorld.GetPlatformAccID(curPlayer.GetAccID())
    # coinToGold.chr_name = curPlayer.GetPlayerName()
    # coinToGold.order_id = orderID
    # coinToGold.event_name = eventName
    # coinToGold.coin = coin
    # coinToGold.coin_prize = prizeCoin
    # coinToGold.gold = addGold
    # coinToGold.total_gold = curPlayer.GetGold()
    # WriteEvent(coinToGold)
    #===========================================================================
    return
 
class god_weapon_lv(ScribeEvent):
    # Éñ±øÉý¼¶¼Ç¼
    def __init__(self):
        #±ØÐë×Ö¶Î
        super(god_weapon_lv, self).__init__()
        self.account_id = "" # Õ˺ŠID£¬Æ½Ì¨ÏÂΨһ£¬ÇÒÖÕÉú²»±ä
        self.chr_name = "" # Íæ¼Ò½ÇÉ«Ãû
        
        self.god_weapon_name = "" # Éñ±øÃû³Æ
        self.bef_lv = 0 # ´Ë´Î²Ù×÷ǰµÄµÈ¼¶, 0´ú±í0¼¶, 1´ú±í+1¼¶
        self.bef_exp = 0 # ´Ë´Î²Ù×÷ǰµÄ¾­ÑéÖµ
        self.cost_item_cnt = 0 # ´Ë´ÎÏûºÄµÄµÀ¾ßÊýÁ¿
        self.aft_lv = 0 # ´Ë´Î²Ù×÷ºóµÄµÈ¼¶, 0´ú±í0¼¶, 1´ú±í+1¼¶
        self.aft_exp = 0 # ´Ë´Î½ø½×²Ù×÷ºóµÄ¾­ÑéÖµ
        
        #·Ç±ØÐë×Ö¶Î
 
        #¼´Ê±ÊǷDZØÐë×Ö¶ÎÒ²Ó¦¸Ã´«ËÍ£¬¸÷×Ö¶ÎÓÃ,·Ö¸ô£¬²¢ÇÒÓÃË«ÒýºÅ°üº¬£¬²Î¿¼¸ñʽ'"1","","","12314"'
        return
    
    def GetCurEventStr(self):
        if not self.time:
            self.time = GameWorld.GetCurrentDataTimeStr()
        tmpList = [self.product_slug, self.agent_name, self.gameserver_no, self.account_id, self.chr_name, 
                   self.god_weapon_name, str(self.bef_lv), str(self.bef_exp), str(self.cost_item_cnt),
                   str(self.aft_lv), str(self.aft_exp), self.time]
        
        return super(god_weapon_lv, self).GetEventStr(tmpList)
    
    def GetScribeEventName(self): return ShareDefine.Def_UserAction_GodWeaponLV
    
def WriteEvent_god_weapon_lv(curPlayer, godWeaponName, befLV, befExp, costCnt, aftLV, aftExp):
    ## Ð´Éñ±øÉý¼¶¼Ç¼
    #===========================================================================
    # godWeaponLV = god_weapon_lv()
    # godWeaponLV.SetEventAgentInfo(GameWorld.GetPlayerPlatform(curPlayer.GetAccID()))
    # godWeaponLV.account_id = GameWorld.GetPlatformAccID(curPlayer.GetAccID())
    # godWeaponLV.chr_name = curPlayer.GetPlayerName()
    # godWeaponLV.god_weapon_name = godWeaponName
    # godWeaponLV.bef_lv = befLV
    # godWeaponLV.bef_exp = befExp
    # godWeaponLV.cost_item_cnt = costCnt
    # godWeaponLV.aft_lv = aftLV
    # godWeaponLV.aft_exp = aftExp
    # WriteEvent(godWeaponLV)
    #===========================================================================
    return
 
class rune_lv(ScribeEvent):
    # ·ûÓ¡Éý¼¶¼Ç¼
    def __init__(self):
        #±ØÐë×Ö¶Î
        super(rune_lv, self).__init__()
        self.account_id = "" # Õ˺ŠID£¬Æ½Ì¨ÏÂΨһ£¬ÇÒÖÕÉú²»±ä
        self.chr_name = "" # Íæ¼Ò½ÇÉ«Ãû
        
        self.rune_name = "" # ·ûÓ¡Ãû³Æ
        self.cost_rune_money = 0 # ´Ë´ÎÏûºÄµÄ·ûÓ¡¾«»ª
        self.aft_lv = 0 # ´Ë´Î²Ù×÷ºóµÄµÈ¼¶, 0´ú±í1¼¶
        self.aft_rune_money = 0 # ´Ë´Î²Ù×÷ºóµÄ·ûÓ¡¾«»ª
        
        #·Ç±ØÐë×Ö¶Î
        
        #¼´Ê±ÊǷDZØÐë×Ö¶ÎÒ²Ó¦¸Ã´«ËÍ£¬¸÷×Ö¶ÎÓÃ,·Ö¸ô£¬²¢ÇÒÓÃË«ÒýºÅ°üº¬£¬²Î¿¼¸ñʽ'"1","","","12314"'
        return
    
    def GetCurEventStr(self):
        if not self.time:
            self.time = GameWorld.GetCurrentDataTimeStr()
        tmpList = [self.product_slug, self.agent_name, self.gameserver_no, self.account_id, self.chr_name, 
                   self.rune_name, str(self.cost_rune_money), str(self.aft_lv), str(self.aft_rune_money), self.time]
        
        return super(rune_lv, self).GetEventStr(tmpList)
    
    def GetScribeEventName(self): return ShareDefine.Def_UserAction_RuneLV
    
def WriteEvent_rune_lv(curPlayer, runeName, costruneMoney, aftLV, aftruneMoney):
    ## Ð´·ûÓ¡Éý¼¶¼Ç¼
    #===========================================================================
    # runeLV = rune_lv()
    # runeLV.SetEventAgentInfo(GameWorld.GetPlayerPlatform(curPlayer.GetAccID()))
    # runeLV.account_id = GameWorld.GetPlatformAccID(curPlayer.GetAccID())
    # runeLV.chr_name = curPlayer.GetPlayerName()
    # runeLV.rune_name = runeName
    # runeLV.cost_rune_money = costruneMoney
    # runeLV.aft_lv = aftLV
    # runeLV.aft_rune_money = aftruneMoney
    # WriteEvent(runeLV)
    #===========================================================================
    return
 
class change_name(ScribeEvent):
    # ¸ÄÃû¼Ç¼
    def __init__(self):
        #±ØÐë×Ö¶Î
        super(change_name, self).__init__()
        self.account_id = "" # Õ˺ŠID£¬Æ½Ì¨ÏÂΨһ£¬ÇÒÖÕÉú²»±ä
        self.chr_name = "" # Íæ¼Ò½ÇÉ«Ãû
        
        self.old_name = "" # Ô­À´µÄÃû×Ö
        self.new_name = "" # ÐµÄÃû×Ö
        #·Ç±ØÐë×Ö¶Î
        
        #¼´Ê±ÊǷDZØÐë×Ö¶ÎÒ²Ó¦¸Ã´«ËÍ£¬¸÷×Ö¶ÎÓÃ,·Ö¸ô£¬²¢ÇÒÓÃË«ÒýºÅ°üº¬£¬²Î¿¼¸ñʽ'"1","","","12314"'
        return
    
    def GetCurEventStr(self):
        if not self.time:
            self.time = GameWorld.GetCurrentDataTimeStr()
        tmpList = [self.product_slug, self.agent_name, self.gameserver_no, self.account_id, self.chr_name, 
                   self.old_name, self.new_name, self.time]
        
        return super(change_name, self).GetEventStr(tmpList)
    
    def GetScribeEventName(self): return ShareDefine.Def_UserAction_ChangeName
    
def WriteEvent_change_name(curPlayer, oldName, newName):
    ## ¸ÄÃû¼Ç¼
    #===========================================================================
    # changeName = change_name()
    # changeName.SetEventAgentInfo(GameWorld.GetPlayerPlatform(curPlayer.GetAccID()))
    # changeName.account_id = GameWorld.GetPlatformAccID(curPlayer.GetAccID())
    # changeName.chr_name = curPlayer.GetPlayerName()
    # changeName.old_name = oldName
    # changeName.new_name = newName    
    # WriteEvent(changeName)
    #===========================================================================
    return
 
class add_zhenqi(ScribeEvent):
    # ÕæÆø²ú³ö¼Ç¼
    def __init__(self):
        #±ØÐë×Ö¶Î
        super(add_zhenqi, self).__init__()
        self.account_id = "" # Õ˺ŠID£¬Æ½Ì¨ÏÂΨһ£¬ÇÒÖÕÉú²»±ä
        self.chr_name = "" # Íæ¼Ò½ÇÉ«Ãû
        
        self.eventName = "" # À´Ô´
        self.eventData = "" # À´Ô´¸½¼ÓÐÅÏ¢
        self.addValue = 0 # ²ú³öÊýÁ¿
        self.totalValue = 0 # Ê£Óà×ÜÁ¿
        
        #·Ç±ØÐë×Ö¶Î
 
        #¼´Ê±ÊǷDZØÐë×Ö¶ÎÒ²Ó¦¸Ã´«ËÍ£¬¸÷×Ö¶ÎÓÃ,·Ö¸ô£¬²¢ÇÒÓÃË«ÒýºÅ°üº¬£¬²Î¿¼¸ñʽ'"1","","","12314"'
        return
    
    def GetCurEventStr(self):
        if not self.time:
            self.time = GameWorld.GetCurrentDataTimeStr()
        tmpList = [self.product_slug, self.agent_name, self.gameserver_no, self.account_id, self.chr_name, 
                   self.eventName, str(self.eventData), str(self.addValue), str(self.totalValue), self.time]
        
        return super(add_zhenqi, self).GetEventStr(tmpList)
    
    def GetScribeEventName(self): return ShareDefine.Def_UserAction_AddZhenqi
    
def WriteEvent_add_zhenqi(curPlayer, eventName, eventData, addValue, totalValue):
    ## ÕæÆø²ú³ö¼Ç¼
    #===========================================================================
    # if eventData:
    #    eventData = str(eventData)
    #    eventData = eventData.replace("\"", "'")
    #    eventData = eventData.replace(",", "|")
    #    
    # addZhenQi = add_zhenqi()
    # addZhenQi.SetEventAgentInfo(GameWorld.GetPlayerPlatform(curPlayer.GetAccID()))
    # addZhenQi.account_id = GameWorld.GetPlatformAccID(curPlayer.GetAccID())
    # addZhenQi.chr_name = curPlayer.GetPlayerName()
    # addZhenQi.eventName = eventName
    # addZhenQi.eventData = eventData
    # addZhenQi.addValue = addValue
    # addZhenQi.totalValue = totalValue
    # WriteEvent(addZhenQi)
    #===========================================================================
    return
 
class lost_zhenqi(ScribeEvent):
    # ÕæÆøÏûºÄ¼Ç¼
    def __init__(self):
        #±ØÐë×Ö¶Î
        super(lost_zhenqi, self).__init__()
        self.account_id = "" # Õ˺ŠID£¬Æ½Ì¨ÏÂΨһ£¬ÇÒÖÕÉú²»±ä
        self.chr_name = "" # Íæ¼Ò½ÇÉ«Ãû
        
        self.eventName = "" # ÏûºÄµã
        self.eventData = "" # ÏûºÄµã¸½¼ÓÐÅÏ¢
        self.lostValue = 0 # ÏûºÄÊýÁ¿
        self.totalValue = 0 # Ê£Óà×ÜÁ¿
        
        #·Ç±ØÐë×Ö¶Î
 
        #¼´Ê±ÊǷDZØÐë×Ö¶ÎÒ²Ó¦¸Ã´«ËÍ£¬¸÷×Ö¶ÎÓÃ,·Ö¸ô£¬²¢ÇÒÓÃË«ÒýºÅ°üº¬£¬²Î¿¼¸ñʽ'"1","","","12314"'
        return
    
    def GetCurEventStr(self):
        if not self.time:
            self.time = GameWorld.GetCurrentDataTimeStr()
        tmpList = [self.product_slug, self.agent_name, self.gameserver_no, self.account_id, self.chr_name, 
                   self.eventName, str(self.eventData), str(self.lostValue), str(self.totalValue), self.time]
        
        return super(lost_zhenqi, self).GetEventStr(tmpList)
    
    def GetScribeEventName(self): return ShareDefine.Def_UserAction_LostZhenqi
    
def WriteEvent_lost_zhenqi(curPlayer, eventName, eventData, lostValue, totalValue):
    ## ÕæÆøÏûºÄ¼Ç¼
    #===========================================================================
    # if eventData:
    #    eventData = str(eventData)
    #    eventData = eventData.replace("\"", "'")
    #    eventData = eventData.replace(",", "|")
    #    
    # lostZhenQi = lost_zhenqi()
    # lostZhenQi.SetEventAgentInfo(GameWorld.GetPlayerPlatform(curPlayer.GetAccID()))
    # lostZhenQi.account_id = GameWorld.GetPlatformAccID(curPlayer.GetAccID())
    # lostZhenQi.chr_name = curPlayer.GetPlayerName()
    # lostZhenQi.eventName = eventName
    # lostZhenQi.eventData = eventData
    # lostZhenQi.lostValue = lostValue
    # lostZhenQi.totalValue = totalValue
    # WriteEvent(lostZhenQi)
    #===========================================================================
    return
 
class coat_lv(ScribeEvent):
    # Ê±×°Éý¼¶¼Ç¼
    def __init__(self):
        #±ØÐë×Ö¶Î
        super(coat_lv, self).__init__()
        self.account_id = "" # Õ˺ŠID£¬Æ½Ì¨ÏÂΨһ£¬ÇÒÖÕÉú²»±ä
        self.chr_name = "" # Íæ¼Ò½ÇÉ«Ãû
        
        self.coat_name = "" # Ê±×°Ãû³Æ
        self.bef_lv = 0 # ´Ë´Î½ø½×²Ù×÷ǰµÄµÈ¼¶
        self.bef_exp = 0 # ´Ë´Î½ø½×²Ù×÷ǰµÄ¾­ÑéÖµ
        self.cost_item_cnt = 0 # ´Ë´ÎÏûºÄµÄµÀ¾ßÊýÁ¿
        self.aft_lv = 0 # ´Ë´Î²Ù×÷ºóµÄµÈ¼¶, 0´ú±í0¼¶, 1´ú±í+1¼¶
        self.aft_exp = 0 #´Ë´Î½ø½×²Ù×÷ºóµÄ¾­ÑéÖµ
        #·Ç±ØÐë×Ö¶Î
        
        #¼´Ê±ÊǷDZØÐë×Ö¶ÎÒ²Ó¦¸Ã´«ËÍ£¬¸÷×Ö¶ÎÓÃ,·Ö¸ô£¬²¢ÇÒÓÃË«ÒýºÅ°üº¬£¬²Î¿¼¸ñʽ'"1","","","12314"'
        return
    
    def GetCurEventStr(self):
        if not self.time:
            self.time = GameWorld.GetCurrentDataTimeStr()
        tmpList = [self.product_slug, self.agent_name, self.gameserver_no, self.account_id, self.chr_name, 
                   self.coat_name, str(self.bef_lv), str(self.bef_exp), str(self.cost_item_cnt), str(self.aft_lv), str(self.aft_exp), self.time]
        
        return super(coat_lv, self).GetEventStr(tmpList)
    
    def GetScribeEventName(self): return ShareDefine.Def_UserAction_CoatLV
    
def WriteEvent_coat_lv(curPlayer, coatName, befLV, befExp, costItemCnt, aftLV, aftExp):
    return
    ## Ð´Ê±×°Éý¼¶¼Ç¼
    #===========================================================================
    # coatLV = coat_lv()
    # coatLV.SetEventAgentInfo(GameWorld.GetPlayerPlatform(curPlayer.GetAccID()))
    # coatLV.account_id = GameWorld.GetPlatformAccID(curPlayer.GetAccID())
    # coatLV.chr_name = curPlayer.GetPlayerName()
    # coatLV.coat_name = coatName
    # coatLV.bef_lv = befLV
    # coatLV.bef_exp = befExp
    # coatLV.cost_item_cnt = costItemCnt
    # coatLV.aft_lv = aftLV
    # coatLV.aft_exp = aftExp
    # WriteEvent(coatLV)
    #===========================================================================
 
 
 
class wingskin_lv(ScribeEvent):
    # Ê±×°Éý¼¶¼Ç¼
    def __init__(self):
        #±ØÐë×Ö¶Î
        super(wingskin_lv, self).__init__()
        self.account_id = "" # Õ˺ŠID£¬Æ½Ì¨ÏÂΨһ£¬ÇÒÖÕÉú²»±ä
        self.chr_name = "" # Íæ¼Ò½ÇÉ«Ãû
        
        self.skin_name = "" # »Ã»¯³á°òÃû³Æ
        self.bef_lv = 0 # ´Ë´Î½ø½×²Ù×÷ǰµÄµÈ¼¶
        self.bef_exp = 0 # ´Ë´Î½ø½×²Ù×÷ǰµÄ¾­ÑéÖµ
        self.cost_item_cnt = 0 # ´Ë´ÎÏûºÄµÄµÀ¾ßÊýÁ¿
        self.aft_lv = 0 # ´Ë´Î²Ù×÷ºóµÄµÈ¼¶, 0´ú±í0¼¶, 1´ú±í+1¼¶
        self.aft_exp = 0 #´Ë´Î½ø½×²Ù×÷ºóµÄ¾­ÑéÖµ
        #·Ç±ØÐë×Ö¶Î
        
        #¼´Ê±ÊǷDZØÐë×Ö¶ÎÒ²Ó¦¸Ã´«ËÍ£¬¸÷×Ö¶ÎÓÃ,·Ö¸ô£¬²¢ÇÒÓÃË«ÒýºÅ°üº¬£¬²Î¿¼¸ñʽ'"1","","","12314"'
        return
    
    def GetCurEventStr(self):
        if not self.time:
            self.time = GameWorld.GetCurrentDataTimeStr()
        tmpList = [self.product_slug, self.agent_name, self.gameserver_no, self.account_id, self.chr_name, 
                   self.skin_name, str(self.bef_lv), str(self.bef_exp), str(self.cost_item_cnt), str(self.aft_lv), str(self.aft_exp), self.time]
        
        return super(wingskin_lv, self).GetEventStr(tmpList)
    
    def GetScribeEventName(self): return ShareDefine.Def_UserAction_WingSkinLV
    
def WriteEvent_wingskin_lv(curPlayer, skinName, befLV, befExp, costItemCnt, aftLV, aftExp):
    ## Ð´»Ã»¯³á°òÉý¼¶¼Ç¼
    #===========================================================================
    # wingskinLV = wingskin_lv()
    # wingskinLV.SetEventAgentInfo(GameWorld.GetPlayerPlatform(curPlayer.GetAccID()))
    # wingskinLV.account_id = GameWorld.GetPlatformAccID(curPlayer.GetAccID())
    # wingskinLV.chr_name = curPlayer.GetPlayerName()
    # wingskinLV.skin_name = skinName
    # wingskinLV.bef_lv = befLV
    # wingskinLV.bef_exp = befExp
    # wingskinLV.cost_item_cnt = costItemCnt
    # wingskinLV.aft_lv = aftLV
    # wingskinLV.aft_exp = aftExp
    # WriteEvent(wingskinLV)
    #===========================================================================
    return
 
 
class horseskin_lv(ScribeEvent):
    # Ê±×°Éý¼¶¼Ç¼
    def __init__(self):
        #±ØÐë×Ö¶Î
        super(horseskin_lv, self).__init__()
        self.account_id = "" # Õ˺ŠID£¬Æ½Ì¨ÏÂΨһ£¬ÇÒÖÕÉú²»±ä
        self.chr_name = "" # Íæ¼Ò½ÇÉ«Ãû
        
        self.skin_name = "" # »Ã»¯×øÆïÃû³Æ
        self.bef_lv = 0 # ´Ë´Î½ø½×²Ù×÷ǰµÄµÈ¼¶
        self.bef_exp = 0 # ´Ë´Î½ø½×²Ù×÷ǰµÄ¾­ÑéÖµ
        self.cost_item_cnt = 0 # ´Ë´ÎÏûºÄµÄµÀ¾ßÊýÁ¿
        self.aft_lv = 0 # ´Ë´Î²Ù×÷ºóµÄµÈ¼¶, 0´ú±í0¼¶, 1´ú±í+1¼¶
        self.aft_exp = 0 #´Ë´Î½ø½×²Ù×÷ºóµÄ¾­ÑéÖµ
        #·Ç±ØÐë×Ö¶Î
        
        #¼´Ê±ÊǷDZØÐë×Ö¶ÎÒ²Ó¦¸Ã´«ËÍ£¬¸÷×Ö¶ÎÓÃ,·Ö¸ô£¬²¢ÇÒÓÃË«ÒýºÅ°üº¬£¬²Î¿¼¸ñʽ'"1","","","12314"'
        return
    
    def GetCurEventStr(self):
        if not self.time:
            self.time = GameWorld.GetCurrentDataTimeStr()
        tmpList = [self.product_slug, self.agent_name, self.gameserver_no, self.account_id, self.chr_name, 
                   self.skin_name, str(self.bef_lv), str(self.bef_exp), str(self.cost_item_cnt), str(self.aft_lv), str(self.aft_exp), self.time]
        
        return super(horseskin_lv, self).GetEventStr(tmpList)
    
    def GetScribeEventName(self): return ShareDefine.Def_UserAction_HorseSkinLV
    
def WriteEvent_horseskin_lv(curPlayer, skinName, befLV, befExp, costItemCnt, aftLV, aftExp):
    ## Ð´»Ã»¯×øÆïÉý¼¶¼Ç¼
    #===========================================================================
    # horseSkinLV = horseskin_lv()
    # horseSkinLV.SetEventAgentInfo(GameWorld.GetPlayerPlatform(curPlayer.GetAccID()))
    # horseSkinLV.account_id = GameWorld.GetPlatformAccID(curPlayer.GetAccID())
    # horseSkinLV.chr_name = curPlayer.GetPlayerName()
    # horseSkinLV.skin_name = skinName
    # horseSkinLV.bef_lv = befLV
    # horseSkinLV.bef_exp = befExp
    # horseSkinLV.cost_item_cnt = costItemCnt
    # horseSkinLV.aft_lv = aftLV
    # horseSkinLV.aft_exp = aftExp
    # WriteEvent(horseSkinLV)
    #===========================================================================
    return
## ---------------------------------------------------------------------------------------
 
 
#------------------------2018-02-09  ÐµÄÊý¾Ýͳ¼Æ--------------------------------
def WriteEvent_Entry(curPlayer, step):
    EventReport(ShareDefine.Def_UserAction_LostModel, "Step=%s&Flag=%s"%(step, ShareDefine.Def_UserAction_CreateRole), curPlayer)
    
def WriteEvent_VIP(curPlayer):
    EventReport(ShareDefine.Def_UserAction_VIPLvUP, "VIPLevel=%s"%curPlayer.GetVIPLv(), curPlayer)
    
def WriteEvent_FightPower(curPlayer):
    EventReport(ShareDefine.Def_UserAction_FightPower, "FightPower=%s"%PlayerControl.GetFightPower(curPlayer), curPlayer)