#!/usr/bin/python # -*- coding: GBK -*- #------------------------------------------------------------------------------- # #------------------------------------------------------------------------------- # #------------------------------------------------------------------------------- #¸ºÔðϵͳ±íµÄ¼ÓÔØ¡¢µ¼Èë¡¢´ò°ü #Ô´±í±ØÐëÊÇutf-8±àÂ룬ÇëÏÈÐÐת»»£¬·ñÔòµ¼Èë»á³ö´í #ʹÓÃProtocolStudio CodeMaker MongoDBGameData.pyÉú³É #------------------------------------------------------------------------------- import ctypes#Ìí¼Ó from ctypes import * from Common import(mylog, CommFuncEx)#import mylog import pymongo import sys import binascii import MangoDBCommon from MangoDBCommon import( SPLITCHAR, addADOExceptionCount, fix_incomingText ) import traceback import inspect DBConfig = __import__('Config.DBConfig') from DBCommon import error #------------------------------------------------------ #ÖØÉúµã#tagBornRefresh class tagBornRefresh(Structure): _pack_ = 1 _fields_ = [ ('RefreshID', c_ulong), ('MapID', c_ulong), ('PosX', c_ulong), ('PosY', c_ulong), ('Round', c_ulong), ('Country', c_ushort), ('ADOResult', c_ulong), ] def __init__(self): Structure.__init__(self) self.clear() def clear(self): memset(addressof(self), 0, self.getLength()) def readLine(self, line): self.clear() wordList = line.split(SPLITCHAR) try: self.RefreshID = int(wordList[0].strip()) self.MapID = int(wordList[1].strip()) self.PosX = int(wordList[2].strip()) self.PosY = int(wordList[3].strip()) self.Round = int(wordList[4].strip()) self.Country = int(wordList[5].strip()) except IndexError,e: errorStr = '''\nIndexError:%s [lineData:"%s"]'''%(e, line) raise Exception(errorStr) except: errorStr = '''\nException on readLine:[lineData:"%s"]\n%s'''%(line,traceback.format_exc()) raise Exception(errorStr) def __getRecord(self): '''×éÖ¯´æ´¢¼Ç¼''' rec = {} rec[u'RefreshID'] = self.RefreshID rec[u'MapID'] = self.MapID rec[u'PosX'] = self.PosX rec[u'PosY'] = self.PosY rec[u'Round'] = self.Round rec[u'Country'] = self.Country return rec def adoInsert(self, collection): '''Ö´ÐвåÈë''' trycnt = 0 rec = self.__getRecord() while(True): try: collection.insert(rec, False, True) break except pymongo.errors.OperationFailure, err: if(DBConfig.TryCntOnWriteFail > trycnt): trycnt += 1 continue addADOExceptionCount() mylog.info("%s.%s:rec = %s"%(self.__class__.__name__, inspect.stack()[0][3], rec)) msg = error.formatMsg('error', error.ERROR_NO_146, 'tagBornRefresh Insert failed!RefreshID = %s, error = %s, trycnt = %d'%(self.RefreshID, err, trycnt)) mylog.error(msg) return False return True def getBuffer(self): buf = create_string_buffer(self.getLength()) memmove(addressof(buf), addressof(self), self.getLength()) return string_at(addressof(buf), self.getLength()) def getLength(self): return sizeof(tagBornRefresh) def readData(self, buf, pos): if len(buf) < pos + self.getLength(): msg = error.formatMsg('error', error.ERROR_NO_147, 'len = %s while %s expected!'%(len(buf) - pos, self.getLength())) mylog.error(msg) return -1 self.clear() memmove(addressof(self), buf[pos:], self.getLength()) return pos + self.getLength() def outputString(self): output = '''//ÖØÉúµã#tagBornRefresh: RefreshID = %s, MapID = %s, PosX = %s, PosY = %s, Round = %s, Country = %s, ADOResult = %s, '''%( self.RefreshID, self.MapID, self.PosX, self.PosY, self.Round, self.Country, self.ADOResult ) return output #------------------------------------------------------ #×°±¸´òÔì±í#tagBuildEquip class tagBuildEquip(Structure): _pack_ = 1 _fields_ = [ ('BuildID', c_ulong), ('Item1ID', c_ulong), ('Item2ID', c_ulong), ('Item3ID', c_ulong), ('Item4ID', c_ulong), ('Item5ID', c_ulong), ('Item6ID', c_ulong), ('ItemCount', c_ushort), ('Money', c_ulong), ('Product1ID', c_ulong), ('Product2ID', c_ulong), ('Product3ID', c_ulong), ('Product4ID', c_ulong), ('Product5ID', c_ulong), ('Product6ID', c_ulong), ('Product7ID', c_ulong), ('ADOResult', c_ulong), ] def __init__(self): Structure.__init__(self) self.clear() def clear(self): memset(addressof(self), 0, self.getLength()) def readLine(self, line): self.clear() wordList = line.split(SPLITCHAR) try: self.BuildID = int(wordList[0].strip()) self.Item1ID = int(wordList[1].strip()) self.Item2ID = int(wordList[2].strip()) self.Item3ID = int(wordList[3].strip()) self.Item4ID = int(wordList[4].strip()) self.Item5ID = int(wordList[5].strip()) self.Item6ID = int(wordList[6].strip()) self.ItemCount = int(wordList[7].strip()) self.Money = int(wordList[8].strip()) self.Product1ID = int(wordList[9].strip()) self.Product2ID = int(wordList[10].strip()) self.Product3ID = int(wordList[11].strip()) self.Product4ID = int(wordList[12].strip()) self.Product5ID = int(wordList[13].strip()) self.Product6ID = int(wordList[14].strip()) self.Product7ID = int(wordList[15].strip()) except IndexError,e: errorStr = '''\nIndexError:%s [lineData:"%s"]'''%(e, line) raise Exception(errorStr) except: errorStr = '''\nException on readLine:[lineData:"%s"]\n%s'''%(line,traceback.format_exc()) raise Exception(errorStr) def __getRecord(self): '''×éÖ¯´æ´¢¼Ç¼''' rec = {} rec[u'BuildID'] = self.BuildID rec[u'Item1ID'] = self.Item1ID rec[u'Item2ID'] = self.Item2ID rec[u'Item3ID'] = self.Item3ID rec[u'Item4ID'] = self.Item4ID rec[u'Item5ID'] = self.Item5ID rec[u'Item6ID'] = self.Item6ID rec[u'ItemCount'] = self.ItemCount rec[u'Money'] = self.Money rec[u'Product1ID'] = self.Product1ID rec[u'Product2ID'] = self.Product2ID rec[u'Product3ID'] = self.Product3ID rec[u'Product4ID'] = self.Product4ID rec[u'Product5ID'] = self.Product5ID rec[u'Product6ID'] = self.Product6ID rec[u'Product7ID'] = self.Product7ID return rec def adoInsert(self, collection): '''Ö´ÐвåÈë''' trycnt = 0 rec = self.__getRecord() while(True): try: collection.insert(rec, False, True) break except pymongo.errors.OperationFailure, err: if(DBConfig.TryCntOnWriteFail > trycnt): trycnt += 1 continue addADOExceptionCount() mylog.info("%s.%s:rec = %s"%(self.__class__.__name__, inspect.stack()[0][3], rec)) msg = error.formatMsg('error', error.ERROR_NO_146, 'tagBuildEquip Insert failed!BuildID = %s, error = %s, trycnt = %d'%(self.BuildID, err, trycnt)) mylog.error(msg) return False return True def getBuffer(self): buf = create_string_buffer(self.getLength()) memmove(addressof(buf), addressof(self), self.getLength()) return string_at(addressof(buf), self.getLength()) def getLength(self): return sizeof(tagBuildEquip) def readData(self, buf, pos): if len(buf) < pos + self.getLength(): msg = error.formatMsg('error', error.ERROR_NO_147, 'len = %s while %s expected!'%(len(buf) - pos, self.getLength())) mylog.error(msg) return -1 self.clear() memmove(addressof(self), buf[pos:], self.getLength()) return pos + self.getLength() def outputString(self): output = '''//×°±¸´òÔì±í#tagBuildEquip: BuildID = %s, Item1ID = %s, Item2ID = %s, Item3ID = %s, Item4ID = %s, Item5ID = %s, Item6ID = %s, ItemCount = %s, Money = %s, Product1ID = %s, Product2ID = %s, Product3ID = %s, Product4ID = %s, Product5ID = %s, Product6ID = %s, Product7ID = %s, ADOResult = %s, '''%( self.BuildID, self.Item1ID, self.Item2ID, self.Item3ID, self.Item4ID, self.Item5ID, self.Item6ID, self.ItemCount, self.Money, self.Product1ID, self.Product2ID, self.Product3ID, self.Product4ID, self.Product5ID, self.Product6ID, self.Product7ID, self.ADOResult ) return output #------------------------------------------------------ #µØÍ¼ÐÅÏ¢#tagChinMapPeriod Ϊ0£¬²»´¦Àí Period Ϊ1£¬´ú±íÿÌ쿪Æô, ´Ëʱ PeriodValue1 ÎÞÒâÒå, PeriodHour1 ΪСʱ(Èç20µã), PeriodMinute1 Ϊ·ÖÖÓ(30)Period Ϊ2£¬´ú±íÿÖÜ¿ªÆô, ´Ëʱ PeriodValue1 ±íʾÐÇÆÚ¼¸, PeriodHour1 ΪСʱ(Èç20µã), PeriodMinute1 Ϊ·ÖÖÓ(30)Period Ϊ3£¬´ú±íÿÔ¿ªÆô, ´Ëʱ PeriodValue1 ±íʾ¼¸ºÅ(ÈçÿÔÂ15ÈÕ¿ªÆô), PeriodHour1(20µã), PeriodMinute1 Ϊ·ÖÖÓ(30) PeriodValue2, PeriodHour2, PeriodMinute2ÒâÒåͬPeriodMinute1, PeriodHour1, PeriodMinute1, ±íʾµÚ¶þ¸ö¿ªÆôµÄʱ¼äµã #µØÍ¼ÐÅÏ¢#tagChinMap class tagChinMap(Structure): _pack_ = 1 _fields_ = [ ('MapID', c_ulong), ('MapName', c_char * 15), ('Country', c_ubyte), ('LV', c_ushort), ('ExistTime', c_ulong), ('MapFBType', c_ubyte), ('AutoSize', c_ubyte), ('Period', c_ubyte), ('PeriodValue1', c_ubyte), ('PeriodHour1', c_ubyte), ('PeriodMinute1', c_ubyte), ('PeriodValue2', c_ubyte), ('PeriodHour2', c_ubyte), ('PeriodMinute2', c_ubyte), ('LocalReborn', c_ubyte), ('SkillReborn', c_ubyte), ('RebornMap', c_ushort), ('RebornMapX', c_ushort), ('RebornMapY', c_ushort), ('CanRide', c_ubyte), ('CanOutPet', c_ubyte), ('TreasureID', c_ulong), ('InitAttackModel', c_ubyte), ('AttackModel', c_ubyte), ('ADOResult', c_ulong), ] def __init__(self): Structure.__init__(self) self.clear() def clear(self): memset(addressof(self), 0, self.getLength()) def readLine(self, line): self.clear() wordList = line.split(SPLITCHAR) try: self.MapID = int(wordList[0].strip()) self.MapName = wordList[1].strip() self.Country = int(wordList[2].strip()) self.LV = int(wordList[3].strip()) self.ExistTime = int(wordList[4].strip()) self.MapFBType = int(wordList[5].strip()) self.AutoSize = int(wordList[6].strip()) self.Period = int(wordList[7].strip()) self.PeriodValue1 = int(wordList[8].strip()) self.PeriodHour1 = int(wordList[9].strip()) self.PeriodMinute1 = int(wordList[10].strip()) self.PeriodValue2 = int(wordList[11].strip()) self.PeriodHour2 = int(wordList[12].strip()) self.PeriodMinute2 = int(wordList[13].strip()) self.LocalReborn = int(wordList[14].strip()) self.SkillReborn = int(wordList[15].strip()) self.RebornMap = int(wordList[16].strip()) self.RebornMapX = int(wordList[17].strip()) self.RebornMapY = int(wordList[18].strip()) self.CanRide = int(wordList[19].strip()) self.CanOutPet = int(wordList[20].strip()) self.TreasureID = int(wordList[21].strip()) self.InitAttackModel = int(wordList[22].strip()) self.AttackModel = int(wordList[23].strip()) except IndexError,e: errorStr = '''\nIndexError:%s [lineData:"%s"]'''%(e, line) raise Exception(errorStr) except: errorStr = '''\nException on readLine:[lineData:"%s"]\n%s'''%(line,traceback.format_exc()) raise Exception(errorStr) def __getRecord(self): '''×éÖ¯´æ´¢¼Ç¼''' rec = {} rec[u'MapID'] = self.MapID rec[u'MapName'] = fix_incomingText(self.MapName) rec[u'Country'] = self.Country rec[u'LV'] = self.LV rec[u'ExistTime'] = self.ExistTime rec[u'MapFBType'] = self.MapFBType rec[u'AutoSize'] = self.AutoSize rec[u'Period'] = self.Period rec[u'PeriodValue1'] = self.PeriodValue1 rec[u'PeriodHour1'] = self.PeriodHour1 rec[u'PeriodMinute1'] = self.PeriodMinute1 rec[u'PeriodValue2'] = self.PeriodValue2 rec[u'PeriodHour2'] = self.PeriodHour2 rec[u'PeriodMinute2'] = self.PeriodMinute2 rec[u'LocalReborn'] = self.LocalReborn rec[u'SkillReborn'] = self.SkillReborn rec[u'RebornMap'] = self.RebornMap rec[u'RebornMapX'] = self.RebornMapX rec[u'RebornMapY'] = self.RebornMapY rec[u'CanRide'] = self.CanRide rec[u'CanOutPet'] = self.CanOutPet rec[u'TreasureID'] = self.TreasureID rec[u'InitAttackModel'] = self.InitAttackModel rec[u'AttackModel'] = self.AttackModel return rec def adoInsert(self, collection): '''Ö´ÐвåÈë''' trycnt = 0 rec = self.__getRecord() while(True): try: collection.insert(rec, False, True) break except pymongo.errors.OperationFailure, err: if(DBConfig.TryCntOnWriteFail > trycnt): trycnt += 1 continue addADOExceptionCount() mylog.info("%s.%s:rec = %s"%(self.__class__.__name__, inspect.stack()[0][3], rec)) msg = error.formatMsg('error', error.ERROR_NO_146, 'tagChinMap Insert failed!MapID = %s, error = %s, trycnt = %d'%(self.MapID, err, trycnt)) mylog.error(msg) return False return True def getBuffer(self): buf = create_string_buffer(self.getLength()) memmove(addressof(buf), addressof(self), self.getLength()) return string_at(addressof(buf), self.getLength()) def getLength(self): return sizeof(tagChinMap) def readData(self, buf, pos): if len(buf) < pos + self.getLength(): msg = error.formatMsg('error', error.ERROR_NO_147, 'len = %s while %s expected!'%(len(buf) - pos, self.getLength())) mylog.error(msg) return -1 self.clear() memmove(addressof(self), buf[pos:], self.getLength()) return pos + self.getLength() def outputString(self): output = ''': MapID = %s, MapName = %s, Country = %s, LV = %s, ExistTime = %s, MapFBType = %s, AutoSize = %s, Period = %s, PeriodValue1 = %s, PeriodHour1 = %s, PeriodMinute1 = %s, PeriodValue2 = %s, PeriodHour2 = %s, PeriodMinute2 = %s, LocalReborn = %s, SkillReborn = %s, RebornMap = %s, RebornMapX = %s, RebornMapY = %s, CanRide = %s, CanOutPet = %s, TreasureID = %s, InitAttackModel = %s, AttackModel = %s, ADOResult = %s, '''%( self.MapID, self.MapName, self.Country, self.LV, self.ExistTime, self.MapFBType, self.AutoSize, self.Period, self.PeriodValue1, self.PeriodHour1, self.PeriodMinute1, self.PeriodValue2, self.PeriodHour2, self.PeriodMinute2, self.LocalReborn, self.SkillReborn, self.RebornMap, self.RebornMapX, self.RebornMapY, self.CanRide, self.CanOutPet, self.TreasureID, self.InitAttackModel, self.AttackModel, self.ADOResult ) return output #------------------------------------------------------ #³¡¾°Ð§¹û#tagEffectRefresh class tagEffectRefresh(Structure): _pack_ = 1 _fields_ = [ ('RefreshID', c_ulong), ('MapID', c_ulong), ('PosX', c_ulong), ('PosY', c_ulong), ('Range', c_ulong), ('EffectId', c_ulong), ('EffectValue', c_ulong), ('ADOResult', c_ulong), ] def __init__(self): Structure.__init__(self) self.clear() def clear(self): memset(addressof(self), 0, self.getLength()) def readLine(self, line): self.clear() wordList = line.split(SPLITCHAR) try: self.RefreshID = int(wordList[0].strip()) self.MapID = int(wordList[1].strip()) self.PosX = int(wordList[2].strip()) self.PosY = int(wordList[3].strip()) self.Range = int(wordList[4].strip()) self.EffectId = int(wordList[5].strip()) self.EffectValue = int(wordList[6].strip()) except IndexError,e: errorStr = '''\nIndexError:%s [lineData:"%s"]'''%(e, line) raise Exception(errorStr) except: errorStr = '''\nException on readLine:[lineData:"%s"]\n%s'''%(line,traceback.format_exc()) raise Exception(errorStr) def __getRecord(self): '''×éÖ¯´æ´¢¼Ç¼''' rec = {} rec[u'RefreshID'] = self.RefreshID rec[u'MapID'] = self.MapID rec[u'PosX'] = self.PosX rec[u'PosY'] = self.PosY rec[u'Range'] = self.Range rec[u'EffectId'] = self.EffectId rec[u'EffectValue'] = self.EffectValue return rec def adoInsert(self, collection): '''Ö´ÐвåÈë''' trycnt = 0 rec = self.__getRecord() while(True): try: collection.insert(rec, False, True) break except pymongo.errors.OperationFailure, err: if(DBConfig.TryCntOnWriteFail > trycnt): trycnt += 1 continue addADOExceptionCount() mylog.info("%s.%s:rec = %s"%(self.__class__.__name__, inspect.stack()[0][3], rec)) msg = error.formatMsg('error', error.ERROR_NO_146, 'tagEffectRefresh Insert failed!MapID = %s, error = %s, trycnt = %d'%(self.MapID, err, trycnt)) mylog.error(msg) return False return True def getBuffer(self): buf = create_string_buffer(self.getLength()) memmove(addressof(buf), addressof(self), self.getLength()) return string_at(addressof(buf), self.getLength()) def getLength(self): return sizeof(tagEffectRefresh) def readData(self, buf, pos): if len(buf) < pos + self.getLength(): msg = error.formatMsg('error', error.ERROR_NO_147, 'len = %s while %s expected!'%(len(buf) - pos, self.getLength())) mylog.error(msg) return -1 self.clear() memmove(addressof(self), buf[pos:], self.getLength()) return pos + self.getLength() def outputString(self): output = '''//³¡¾°Ð§¹û#tagEffectRefresh: RefreshID = %s, MapID = %s, PosX = %s, PosY = %s, Range = %s, EffectId = %s, EffectValue = %s, ADOResult = %s, '''%( self.RefreshID, self.MapID, self.PosX, self.PosY, self.Range, self.EffectId, self.EffectValue, self.ADOResult ) return output #------------------------------------------------------ #´òÔìÅä·½±í#tagChinMixItem class tagChinMixItem(Structure): _pack_ = 1 _fields_ = [ ('MixItemID', c_ulong), ('ItemLV', c_ubyte), ('ItemType', c_ubyte), ('IronCount', c_ubyte), ('CopperCount', c_ubyte), ('SilverCount', c_ubyte), ('Money', c_ushort), ('BreakIronCount', c_ubyte), ('BreakCopperCount', c_ubyte), ('BreakSilverCount', c_ubyte), ('BreakMoney', c_ushort), ('ADOResult', c_ulong), ] def __init__(self): Structure.__init__(self) self.clear() def clear(self): memset(addressof(self), 0, self.getLength()) def readLine(self, line): self.clear() wordList = line.split(SPLITCHAR) try: self.MixItemID = int(wordList[0].strip()) self.ItemLV = int(wordList[1].strip()) self.ItemType = int(wordList[2].strip()) self.IronCount = int(wordList[3].strip()) self.CopperCount = int(wordList[4].strip()) self.SilverCount = int(wordList[5].strip()) self.Money = int(wordList[6].strip()) self.BreakIronCount = int(wordList[7].strip()) self.BreakCopperCount = int(wordList[8].strip()) self.BreakSilverCount = int(wordList[9].strip()) self.BreakMoney = int(wordList[10].strip()) except IndexError,e: errorStr = '''\nIndexError:%s [lineData:"%s"]'''%(e, line) raise Exception(errorStr) except: errorStr = '''\nException on readLine:[lineData:"%s"]\n%s'''%(line,traceback.format_exc()) raise Exception(errorStr) def __getRecord(self): '''×éÖ¯´æ´¢¼Ç¼''' rec = {} rec[u'MixItemID'] = self.MixItemID rec[u'ItemLV'] = self.ItemLV rec[u'ItemType'] = self.ItemType rec[u'IronCount'] = self.IronCount rec[u'CopperCount'] = self.CopperCount rec[u'SilverCount'] = self.SilverCount rec[u'Money'] = self.Money rec[u'BreakIronCount'] = self.BreakIronCount rec[u'BreakCopperCount'] = self.BreakCopperCount rec[u'BreakSilverCount'] = self.BreakSilverCount rec[u'BreakMoney'] = self.BreakMoney return rec def adoInsert(self, collection): '''Ö´ÐвåÈë''' trycnt = 0 rec = self.__getRecord() while(True): try: collection.insert(rec, False, True) break except pymongo.errors.OperationFailure, err: if(DBConfig.TryCntOnWriteFail > trycnt): trycnt += 1 continue addADOExceptionCount() mylog.info("%s.%s:rec = %s"%(self.__class__.__name__, inspect.stack()[0][3], rec)) msg = error.formatMsg('error', error.ERROR_NO_146, 'tagChinMixItem Insert failed!MixItemID = %s, error = %s, trycnt = %d'%(self.MixItemID, err, trycnt)) mylog.error(msg) return False return True def getBuffer(self): buf = create_string_buffer(self.getLength()) memmove(addressof(buf), addressof(self), self.getLength()) return string_at(addressof(buf), self.getLength()) def getLength(self): return sizeof(tagChinMixItem) def readData(self, buf, pos): if len(buf) < pos + self.getLength(): msg = error.formatMsg('error', error.ERROR_NO_147, 'len = %s while %s expected!'%(len(buf) - pos, self.getLength())) mylog.error(msg) return -1 self.clear() memmove(addressof(self), buf[pos:], self.getLength()) return pos + self.getLength() def outputString(self): output = '''//´òÔìÅä·½±í#tagChinMixItem: MixItemID = %s, ItemLV = %s, ItemType = %s, IronCount = %s, CopperCount = %s, SilverCount = %s, Money = %s, BreakIronCount = %s, BreakCopperCount = %s, BreakSilverCount = %s, BreakMoney = %s, ADOResult = %s, '''%( self.MixItemID, self.ItemLV, self.ItemType, self.IronCount, self.CopperCount, self.SilverCount, self.Money, self.BreakIronCount, self.BreakCopperCount, self.BreakSilverCount, self.BreakMoney, self.ADOResult ) return output #------------------------------------------------------ #×°±¸Ì×װЧ¹û±í#tagSuiteEffect class tagSuiteEffect(Structure): _pack_ = 1 _fields_ = [ ('SuiteID', c_ulong), ('SkillTriggeredBy2', c_ulong), ('SkillTriggeredBy3', c_ulong), ('SkillTriggeredBy4', c_ulong), ('SkillTriggeredBy5', c_ulong), ('SkillTriggeredBy6', c_ulong), ('SkillTriggeredBy7', c_ulong), ('SkillTriggeredBy8', c_ulong), ('SkillTriggeredBy9', c_ulong), ('SkillTriggeredBy10', c_ulong), ('ADOResult', c_ulong), ] def __init__(self): Structure.__init__(self) self.clear() def clear(self): memset(addressof(self), 0, self.getLength()) def readLine(self, line): self.clear() wordList = line.split(SPLITCHAR) try: self.SuiteID = int(wordList[0].strip()) self.SkillTriggeredBy2 = int(wordList[1].strip()) self.SkillTriggeredBy3 = int(wordList[2].strip()) self.SkillTriggeredBy4 = int(wordList[3].strip()) self.SkillTriggeredBy5 = int(wordList[4].strip()) self.SkillTriggeredBy6 = int(wordList[5].strip()) self.SkillTriggeredBy7 = int(wordList[6].strip()) self.SkillTriggeredBy8 = int(wordList[7].strip()) self.SkillTriggeredBy9 = int(wordList[8].strip()) self.SkillTriggeredBy10 = int(wordList[9].strip()) except IndexError,e: errorStr = '''\nIndexError:%s [lineData:"%s"]'''%(e, line) raise Exception(errorStr) except: errorStr = '''\nException on readLine:[lineData:"%s"]\n%s'''%(line,traceback.format_exc()) raise Exception(errorStr) def __getRecord(self): '''×éÖ¯´æ´¢¼Ç¼''' rec = {} rec[u'SuiteID'] = self.SuiteID rec[u'SkillTriggeredBy2'] = self.SkillTriggeredBy2 rec[u'SkillTriggeredBy3'] = self.SkillTriggeredBy3 rec[u'SkillTriggeredBy4'] = self.SkillTriggeredBy4 rec[u'SkillTriggeredBy5'] = self.SkillTriggeredBy5 rec[u'SkillTriggeredBy6'] = self.SkillTriggeredBy6 rec[u'SkillTriggeredBy7'] = self.SkillTriggeredBy7 rec[u'SkillTriggeredBy8'] = self.SkillTriggeredBy8 rec[u'SkillTriggeredBy9'] = self.SkillTriggeredBy9 rec[u'SkillTriggeredBy10'] = self.SkillTriggeredBy10 return rec def adoInsert(self, collection): '''Ö´ÐвåÈë''' trycnt = 0 rec = self.__getRecord() while(True): try: collection.insert(rec, False, True) break except pymongo.errors.OperationFailure, err: if(DBConfig.TryCntOnWriteFail > trycnt): trycnt += 1 continue addADOExceptionCount() mylog.info("%s.%s:rec = %s"%(self.__class__.__name__, inspect.stack()[0][3], rec)) msg = error.formatMsg('error', error.ERROR_NO_146, 'tagSuiteEffect Insert failed!SuiteID = %s, error = %s, trycnt = %d'%(self.SuiteID, err, trycnt)) mylog.error(msg) return False return True def getBuffer(self): buf = create_string_buffer(self.getLength()) memmove(addressof(buf), addressof(self), self.getLength()) return string_at(addressof(buf), self.getLength()) def getLength(self): return sizeof(tagSuiteEffect) def readData(self, buf, pos): if len(buf) < pos + self.getLength(): msg = error.formatMsg('error', error.ERROR_NO_147, 'len = %s while %s expected!'%(len(buf) - pos, self.getLength())) mylog.error(msg) return -1 self.clear() memmove(addressof(self), buf[pos:], self.getLength()) return pos + self.getLength() def outputString(self): output = '''//×°±¸Ì×װЧ¹û±í#tagSuiteEffect: SuiteID = %s, SkillTriggeredBy2 = %s, SkillTriggeredBy3 = %s, SkillTriggeredBy4 = %s, SkillTriggeredBy5 = %s, SkillTriggeredBy6 = %s, SkillTriggeredBy7 = %s, SkillTriggeredBy8 = %s, SkillTriggeredBy9 = %s, SkillTriggeredBy10 = %s, ADOResult = %s, '''%( self.SuiteID, self.SkillTriggeredBy2, self.SkillTriggeredBy3, self.SkillTriggeredBy4, self.SkillTriggeredBy5, self.SkillTriggeredBy6, self.SkillTriggeredBy7, self.SkillTriggeredBy8, self.SkillTriggeredBy9, self.SkillTriggeredBy10, self.ADOResult ) return output #------------------------------------------------------ #¾­ÑéÊý¾Ý#tagChinExp class tagChinExp(Structure): _pack_ = 1 _fields_ = [ ('LV', c_ushort), ('TotalExp', c_ulong), ('ReExp', c_ulong), ('ReMoney', c_ulong), ('ADOResult', c_ulong), ] def __init__(self): Structure.__init__(self) self.clear() def clear(self): memset(addressof(self), 0, self.getLength()) def readLine(self, line): self.clear() wordList = line.split(SPLITCHAR) try: self.LV = int(wordList[0].strip()) self.TotalExp = int(wordList[1].strip()) self.ReExp = int(wordList[2].strip()) self.ReMoney = int(wordList[3].strip()) except IndexError,e: errorStr = '''\nIndexError:%s [lineData:"%s"]'''%(e, line) raise Exception(errorStr) except: errorStr = '''\nException on readLine:[lineData:"%s"]\n%s'''%(line,traceback.format_exc()) raise Exception(errorStr) def __getRecord(self): '''×éÖ¯´æ´¢¼Ç¼''' rec = {} rec[u'LV'] = self.LV rec[u'TotalExp'] = self.TotalExp rec[u'ReExp'] = self.ReExp rec[u'ReMoney'] = self.ReMoney return rec def adoInsert(self, collection): '''Ö´ÐвåÈë''' trycnt = 0 rec = self.__getRecord() while(True): try: collection.insert(rec, False, True) break except pymongo.errors.OperationFailure, err: if(DBConfig.TryCntOnWriteFail > trycnt): trycnt += 1 continue addADOExceptionCount() mylog.info("%s.%s:rec = %s"%(self.__class__.__name__, inspect.stack()[0][3], rec)) msg = error.formatMsg('error', error.ERROR_NO_146, 'tagChinExp Insert failed!LV = %s, error = %s, trycnt = %d'%(self.LV, err, trycnt)) mylog.error(msg) return False return True def getBuffer(self): buf = create_string_buffer(self.getLength()) memmove(addressof(buf), addressof(self), self.getLength()) return string_at(addressof(buf), self.getLength()) def getLength(self): return sizeof(tagChinExp) def readData(self, buf, pos): if len(buf) < pos + self.getLength(): msg = error.formatMsg('error', error.ERROR_NO_147, 'len = %s while %s expected!'%(len(buf) - pos, self.getLength())) mylog.error(msg) return -1 self.clear() memmove(addressof(self), buf[pos:], self.getLength()) return pos + self.getLength() def outputString(self): output = '''//¾­ÑéÊý¾Ý#tagChinExp: LV = %s, TotalExp = %s, ReExp = %s, ReMoney = %s, ADOResult = %s, '''%( self.LV, self.TotalExp, self.ReExp, self.ReMoney, self.ADOResult ) return output #------------------------------------------------------ #ÎïÆ·#tagChinItem class tagChinItem(Structure): _pack_ = 1 _fields_ = [ ('ID', c_ulong), ('LV', c_ushort), ('Identify', c_ubyte), ('Name', c_char * 24), ('Type', c_ubyte), ('EquipPlace', c_ubyte), ('CanNPCDrop', c_ubyte), ('CanIdentifyAppear', c_ubyte), ('CanRepair', c_ubyte), ('PackCount', c_ushort), ('UseLV', c_ushort), ('CanSell', c_ubyte), ('CanTrade', c_ubyte), ('CanDrop', c_ubyte), ('CanBind', c_ubyte), ('CanRenZhu', c_ubyte), ('DieDrop', c_ubyte), ('CanPlaceInShortcut', c_ubyte), ('CDType', c_ubyte), ('CDTime', c_ulong), ('PriceGene', c_ushort), ('GoldPrice', c_ulong), ('GoldPaperPrice', c_ulong), ('SilverPrice', c_ulong), ('SilverPaperPrice', c_ulong), ('UseTag', c_ubyte), ('UseDist', c_ushort), ('CanInsertHole', c_ubyte), ('Effect1', c_ulong), ('EffectValueA1', c_ulong), ('EffectValueB1', c_ulong), ('EffectValueC1', c_ulong), ('Effect2', c_ulong), ('EffectValueA2', c_ulong), ('EffectValueB2', c_ulong), ('EffectValueC2', c_ulong), ('Effect3', c_ulong), ('EffectValueA3', c_ulong), ('EffectValueB3', c_ulong), ('EffectValueC3', c_ulong), ('Effect4', c_ulong), ('EffectValueA4', c_ulong), ('EffectValueB4', c_ulong), ('EffectValueC4', c_ulong), ('Effect5', c_ulong), ('EffectValueA5', c_ulong), ('EffectValueB5', c_ulong), ('EffectValueC5', c_ulong), ('AddSkill1', c_ulong), ('AddSkill2', c_ulong), ('AddSkill3', c_ulong), ('AddSkill4', c_ulong), ('AddSkill5', c_ulong), ('JobLimit', c_ulong), ('EventCanUse', c_ubyte), ('SexReq', c_ubyte), ('ItemColor', c_ubyte), ('ItemQuality', c_ubyte), ('MaxHoleCount', c_ubyte), ('CanBreak', c_ubyte), ('MaxEndure', c_ulong), ('EndureReduceType', c_ubyte), ('NoEndureDisappear', c_ubyte), ('UseRestrict', c_ubyte), ('IsSoulOfWar', c_ubyte), ('ReincarnationLv', c_ushort), ('BindType', c_ubyte), ('MaxAddSkillCnt', c_ubyte), ('ExpireTime', c_ulong), ('MaxFitLV', c_ubyte), ('SuiteID', c_ulong), ('Weight', c_ulong), ('LimitSTR', c_ulong), ('LimitPHY', c_ulong), ('LimitPNE', c_ulong), ('IsBothHands', c_ubyte), ('ADOResult', c_ulong), ] def __init__(self): Structure.__init__(self) self.clear() def clear(self): memset(addressof(self), 0, self.getLength()) def readLine(self, line): self.clear() wordList = line.split(SPLITCHAR) try: self.ID = int(wordList[0].strip()) self.LV = int(wordList[1].strip()) self.Identify = int(wordList[2].strip()) self.Name = wordList[3].strip() self.Type = int(wordList[4].strip()) self.EquipPlace = int(wordList[5].strip()) self.CanNPCDrop = int(wordList[6].strip()) self.CanIdentifyAppear = int(wordList[7].strip()) self.CanRepair = int(wordList[8].strip()) self.PackCount = int(wordList[9].strip()) self.UseLV = int(wordList[10].strip()) self.CanSell = int(wordList[11].strip()) self.CanTrade = int(wordList[12].strip()) self.CanDrop = int(wordList[13].strip()) self.CanBind = int(wordList[14].strip()) self.CanRenZhu = int(wordList[15].strip()) self.DieDrop = int(wordList[16].strip()) self.CanPlaceInShortcut = int(wordList[17].strip()) self.CDType = int(wordList[18].strip()) self.CDTime = int(wordList[19].strip()) self.PriceGene = int(wordList[20].strip()) self.GoldPrice = int(wordList[21].strip()) self.GoldPaperPrice = int(wordList[22].strip()) self.SilverPrice = int(wordList[23].strip()) self.SilverPaperPrice = int(wordList[24].strip()) self.UseTag = int(wordList[25].strip()) self.UseDist = int(wordList[26].strip()) self.CanInsertHole = int(wordList[27].strip()) self.Effect1 = int(wordList[28].strip()) self.EffectValueA1 = int(wordList[29].strip()) self.EffectValueB1 = int(wordList[30].strip()) self.EffectValueC1 = int(wordList[31].strip()) self.Effect2 = int(wordList[32].strip()) self.EffectValueA2 = int(wordList[33].strip()) self.EffectValueB2 = int(wordList[34].strip()) self.EffectValueC2 = int(wordList[35].strip()) self.Effect3 = int(wordList[36].strip()) self.EffectValueA3 = int(wordList[37].strip()) self.EffectValueB3 = int(wordList[38].strip()) self.EffectValueC3 = int(wordList[39].strip()) self.Effect4 = int(wordList[40].strip()) self.EffectValueA4 = int(wordList[41].strip()) self.EffectValueB4 = int(wordList[42].strip()) self.EffectValueC4 = int(wordList[43].strip()) self.Effect5 = int(wordList[44].strip()) self.EffectValueA5 = int(wordList[45].strip()) self.EffectValueB5 = int(wordList[46].strip()) self.EffectValueC5 = int(wordList[47].strip()) self.AddSkill1 = int(wordList[48].strip()) self.AddSkill2 = int(wordList[49].strip()) self.AddSkill3 = int(wordList[50].strip()) self.AddSkill4 = int(wordList[51].strip()) self.AddSkill5 = int(wordList[52].strip()) self.JobLimit = int(wordList[53].strip()) self.EventCanUse = int(wordList[54].strip()) self.SexReq = int(wordList[55].strip()) self.ItemColor = int(wordList[56].strip()) self.ItemQuality = int(wordList[57].strip()) self.MaxHoleCount = int(wordList[58].strip()) self.CanBreak = int(wordList[59].strip()) self.MaxEndure = int(wordList[60].strip()) self.EndureReduceType = int(wordList[61].strip()) self.NoEndureDisappear = int(wordList[62].strip()) self.UseRestrict = int(wordList[63].strip()) self.IsSoulOfWar = int(wordList[64].strip()) self.ReincarnationLv = int(wordList[65].strip()) self.BindType = int(wordList[66].strip()) self.MaxAddSkillCnt = int(wordList[67].strip()) self.ExpireTime = int(wordList[68].strip()) self.MaxFitLV = int(wordList[69].strip()) self.SuiteID = int(wordList[70].strip()) self.Weight = int(wordList[71].strip()) self.LimitSTR = int(wordList[72].strip()) self.LimitPHY = int(wordList[73].strip()) self.LimitPNE = int(wordList[74].strip()) self.IsBothHands = int(wordList[75].strip()) except IndexError,e: errorStr = '''\nIndexError:%s [lineData:"%s"]'''%(e, line) raise Exception(errorStr) except: errorStr = '''\nException on readLine:[lineData:"%s"]\n%s'''%(line,traceback.format_exc()) raise Exception(errorStr) def __getRecord(self): '''×éÖ¯´æ´¢¼Ç¼''' rec = {} rec[u'ID'] = self.ID rec[u'LV'] = self.LV rec[u'Identify'] = self.Identify rec[u'Name'] = fix_incomingText(self.Name) rec[u'Type'] = self.Type rec[u'EquipPlace'] = self.EquipPlace rec[u'CanNPCDrop'] = self.CanNPCDrop rec[u'CanIdentifyAppear'] = self.CanIdentifyAppear rec[u'CanRepair'] = self.CanRepair rec[u'PackCount'] = self.PackCount rec[u'UseLV'] = self.UseLV rec[u'CanSell'] = self.CanSell rec[u'CanTrade'] = self.CanTrade rec[u'CanDrop'] = self.CanDrop rec[u'CanBind'] = self.CanBind rec[u'CanRenZhu'] = self.CanRenZhu rec[u'DieDrop'] = self.DieDrop rec[u'CanPlaceInShortcut'] = self.CanPlaceInShortcut rec[u'CDType'] = self.CDType rec[u'CDTime'] = self.CDTime rec[u'PriceGene'] = self.PriceGene rec[u'GoldPrice'] = self.GoldPrice rec[u'GoldPaperPrice'] = self.GoldPaperPrice rec[u'SilverPrice'] = self.SilverPrice rec[u'SilverPaperPrice'] = self.SilverPaperPrice rec[u'UseTag'] = self.UseTag rec[u'UseDist'] = self.UseDist rec[u'CanInsertHole'] = self.CanInsertHole rec[u'Effect1'] = self.Effect1 rec[u'EffectValueA1'] = self.EffectValueA1 rec[u'EffectValueB1'] = self.EffectValueB1 rec[u'EffectValueC1'] = self.EffectValueC1 rec[u'Effect2'] = self.Effect2 rec[u'EffectValueA2'] = self.EffectValueA2 rec[u'EffectValueB2'] = self.EffectValueB2 rec[u'EffectValueC2'] = self.EffectValueC2 rec[u'Effect3'] = self.Effect3 rec[u'EffectValueA3'] = self.EffectValueA3 rec[u'EffectValueB3'] = self.EffectValueB3 rec[u'EffectValueC3'] = self.EffectValueC3 rec[u'Effect4'] = self.Effect4 rec[u'EffectValueA4'] = self.EffectValueA4 rec[u'EffectValueB4'] = self.EffectValueB4 rec[u'EffectValueC4'] = self.EffectValueC4 rec[u'Effect5'] = self.Effect5 rec[u'EffectValueA5'] = self.EffectValueA5 rec[u'EffectValueB5'] = self.EffectValueB5 rec[u'EffectValueC5'] = self.EffectValueC5 rec[u'AddSkill1'] = self.AddSkill1 rec[u'AddSkill2'] = self.AddSkill2 rec[u'AddSkill3'] = self.AddSkill3 rec[u'AddSkill4'] = self.AddSkill4 rec[u'AddSkill5'] = self.AddSkill5 rec[u'JobLimit'] = self.JobLimit rec[u'EventCanUse'] = self.EventCanUse rec[u'SexReq'] = self.SexReq rec[u'ItemColor'] = self.ItemColor rec[u'ItemQuality'] = self.ItemQuality rec[u'MaxHoleCount'] = self.MaxHoleCount rec[u'CanBreak'] = self.CanBreak rec[u'MaxEndure'] = self.MaxEndure rec[u'EndureReduceType'] = self.EndureReduceType rec[u'NoEndureDisappear'] = self.NoEndureDisappear rec[u'UseRestrict'] = self.UseRestrict rec[u'IsSoulOfWar'] = self.IsSoulOfWar rec[u'ReincarnationLv'] = self.ReincarnationLv rec[u'BindType'] = self.BindType rec[u'MaxAddSkillCnt'] = self.MaxAddSkillCnt rec[u'ExpireTime'] = self.ExpireTime rec[u'MaxFitLV'] = self.MaxFitLV rec[u'SuiteID'] = self.SuiteID rec[u'Weight'] = self.Weight rec[u'LimitSTR'] = self.LimitSTR rec[u'LimitPHY'] = self.LimitPHY rec[u'LimitPNE'] = self.LimitPNE rec[u'IsBothHands'] = self.IsBothHands return rec def adoInsert(self, collection): '''Ö´ÐвåÈë''' trycnt = 0 rec = self.__getRecord() while(True): try: collection.insert(rec, False, True) break except pymongo.errors.OperationFailure, err: if(DBConfig.TryCntOnWriteFail > trycnt): trycnt += 1 continue addADOExceptionCount() mylog.info("%s.%s:rec = %s"%(self.__class__.__name__, inspect.stack()[0][3], rec)) msg = error.formatMsg('error', error.ERROR_NO_146, 'tagChinItem Insert failed!ID = %s, error = %s, trycnt = %d'%(self.ID, err, trycnt)) mylog.error(msg) return False return True def getBuffer(self): buf = create_string_buffer(self.getLength()) memmove(addressof(buf), addressof(self), self.getLength()) return string_at(addressof(buf), self.getLength()) def getLength(self): return sizeof(tagChinItem) def readData(self, buf, pos): if len(buf) < pos + self.getLength(): msg = error.formatMsg('error', error.ERROR_NO_147, 'len = %s while %s expected!'%(len(buf) - pos, self.getLength())) mylog.error(msg) return -1 self.clear() memmove(addressof(self), buf[pos:], self.getLength()) return pos + self.getLength() def outputString(self): output = '''//ÎïÆ·#tagChinItem: ID = %s, LV = %s, Identify = %s, Name = %s, Type = %s, EquipPlace = %s, CanNPCDrop = %s, CanIdentifyAppear = %s, CanRepair = %s, PackCount = %s, UseLV = %s, CanSell = %s, CanTrade = %s, CanDrop = %s, CanBind = %s, CanRenZhu = %s, DieDrop = %s, CanPlaceInShortcut = %s, CDType = %s, CDTime = %s, PriceGene = %s, GoldPrice = %s, GoldPaperPrice = %s, SilverPrice = %s, SilverPaperPrice = %s, UseTag = %s, UseDist = %s, CanInsertHole = %s, Effect1 = %s, EffectValueA1 = %s, EffectValueB1 = %s, EffectValueC1 = %s, Effect2 = %s, EffectValueA2 = %s, EffectValueB2 = %s, EffectValueC2 = %s, Effect3 = %s, EffectValueA3 = %s, EffectValueB3 = %s, EffectValueC3 = %s, Effect4 = %s, EffectValueA4 = %s, EffectValueB4 = %s, EffectValueC4 = %s, Effect5 = %s, EffectValueA5 = %s, EffectValueB5 = %s, EffectValueC5 = %s, AddSkill1 = %s, AddSkill2 = %s, AddSkill3 = %s, AddSkill4 = %s, AddSkill5 = %s, JobLimit = %s, EventCanUse = %s, SexReq = %s, ItemColor = %s, ItemQuality = %s, MaxHoleCount = %s, CanBreak = %s, MaxEndure = %s, EndureReduceType = %s, NoEndureDisappear = %s, UseRestrict = %s, IsSoulOfWar = %s, ReincarnationLv = %s, BindType = %s, MaxAddSkillCnt = %s, ExpireTime = %s, MaxFitLV = %s, SuiteID = %s, Weight = %s, LimitSTR = %s, LimitPHY = %s, LimitPNE = %s, IsBothHands = %s, ADOResult = %s, '''%( self.ID, self.LV, self.Identify, self.Name, self.Type, self.EquipPlace, self.CanNPCDrop, self.CanIdentifyAppear, self.CanRepair, self.PackCount, self.UseLV, self.CanSell, self.CanTrade, self.CanDrop, self.CanBind, self.CanRenZhu, self.DieDrop, self.CanPlaceInShortcut, self.CDType, self.CDTime, self.PriceGene, self.GoldPrice, self.GoldPaperPrice, self.SilverPrice, self.SilverPaperPrice, self.UseTag, self.UseDist, self.CanInsertHole, self.Effect1, self.EffectValueA1, self.EffectValueB1, self.EffectValueC1, self.Effect2, self.EffectValueA2, self.EffectValueB2, self.EffectValueC2, self.Effect3, self.EffectValueA3, self.EffectValueB3, self.EffectValueC3, self.Effect4, self.EffectValueA4, self.EffectValueB4, self.EffectValueC4, self.Effect5, self.EffectValueA5, self.EffectValueB5, self.EffectValueC5, self.AddSkill1, self.AddSkill2, self.AddSkill3, self.AddSkill4, self.AddSkill5, self.JobLimit, self.EventCanUse, self.SexReq, self.ItemColor, self.ItemQuality, self.MaxHoleCount, self.CanBreak, self.MaxEndure, self.EndureReduceType, self.NoEndureDisappear, self.UseRestrict, self.IsSoulOfWar, self.ReincarnationLv, self.BindType, self.MaxAddSkillCnt, self.ExpireTime, self.MaxFitLV, self.SuiteID, self.Weight, self.LimitSTR, self.LimitPHY, self.LimitPNE, self.IsBothHands, self.ADOResult ) return output #------------------------------------------------------ #NPCÊý¾Ý#tagChinNPC class tagChinNPC(Structure): _pack_ = 1 _fields_ = [ ('NPCID', c_ulong), ('Type', c_ubyte), ('FunctionType', c_ulong), ('Name', c_char * 24), ('LV', c_ushort), ('Country', c_ubyte), ('MinAtk', c_int), ('MaxAtk', c_int), ('Def', c_int), ('MAtkMin', c_int), ('MAtkMax', c_int), ('MDef', c_int), ('PoisionAtk', c_int), ('FireAtk', c_int), ('IceAtk', c_int), ('ThunderAtk', c_int), ('WindAtk', c_int), ('PoisionDef', c_int), ('FireDef', c_int), ('IceDef', c_int), ('ThunderDef', c_int), ('WindDef', c_int), ('AtkInterval', c_ushort), ('Hit', c_ulong), ('MissRate', c_ulong), ('SuperHiteRate', c_ushort), ('OrgSpeed', c_ushort), ('MoveType', c_ubyte), ('AtkDist', c_ubyte), ('Skill1', c_ushort), ('Skill2', c_ushort), ('Skill3', c_ushort), ('Skill4', c_ushort), ('Skill5', c_ushort), ('Skill6', c_ushort), ('Skill7', c_ushort), ('Skill8', c_ushort), ('AtkType', c_ubyte), ('Sight', c_ubyte), ('MoveArea', c_ushort), ('HP', c_ulong), ('HPEx', c_ulong), ('HPRestore', c_ushort), ('AttentionRefreshID', c_ushort), ('EventArea', c_ushort), ('IsBoss', c_ubyte), ('Exp', c_ulong), ('SP', c_ulong), ('AIType', c_ubyte), ('CanAttack', c_ubyte), ('HurtType', c_ubyte), ('ADOResult', c_ulong), ] def __init__(self): Structure.__init__(self) self.clear() def clear(self): memset(addressof(self), 0, self.getLength()) def readLine(self, line): self.clear() wordList = line.split(SPLITCHAR) try: self.NPCID = int(wordList[0].strip()) self.Type = int(wordList[1].strip()) self.FunctionType = int(wordList[2].strip()) self.Name = wordList[3].strip() self.LV = int(wordList[4].strip()) self.Country = int(wordList[5].strip()) self.MinAtk = int(wordList[6].strip()) self.MaxAtk = int(wordList[7].strip()) self.Def = int(wordList[8].strip()) self.MAtkMin = int(wordList[9].strip()) self.MAtkMax = int(wordList[10].strip()) self.MDef = int(wordList[11].strip()) self.PoisionAtk = int(wordList[12].strip()) self.FireAtk = int(wordList[13].strip()) self.IceAtk = int(wordList[14].strip()) self.ThunderAtk = int(wordList[15].strip()) self.WindAtk = int(wordList[16].strip()) self.PoisionDef = int(wordList[17].strip()) self.FireDef = int(wordList[18].strip()) self.IceDef = int(wordList[19].strip()) self.ThunderDef = int(wordList[20].strip()) self.WindDef = int(wordList[21].strip()) self.AtkInterval = int(wordList[22].strip()) self.Hit = int(wordList[23].strip()) self.MissRate = int(wordList[24].strip()) self.SuperHiteRate = int(wordList[25].strip()) self.OrgSpeed = int(wordList[26].strip()) self.MoveType = int(wordList[27].strip()) self.AtkDist = int(wordList[28].strip()) self.Skill1 = int(wordList[29].strip()) self.Skill2 = int(wordList[30].strip()) self.Skill3 = int(wordList[31].strip()) self.Skill4 = int(wordList[32].strip()) self.Skill5 = int(wordList[33].strip()) self.Skill6 = int(wordList[34].strip()) self.Skill7 = int(wordList[35].strip()) self.Skill8 = int(wordList[36].strip()) self.AtkType = int(wordList[37].strip()) self.Sight = int(wordList[38].strip()) self.MoveArea = int(wordList[39].strip()) self.HP = int(wordList[40].strip()) self.HPEx = int(wordList[41].strip()) self.HPRestore = int(wordList[42].strip()) self.AttentionRefreshID = int(wordList[43].strip()) self.EventArea = int(wordList[44].strip()) self.IsBoss = int(wordList[45].strip()) self.Exp = int(wordList[46].strip()) self.SP = int(wordList[47].strip()) self.AIType = int(wordList[48].strip()) self.CanAttack = int(wordList[49].strip()) self.HurtType = int(wordList[50].strip()) except IndexError,e: errorStr = '''\nIndexError:%s [lineData:"%s"]'''%(e, line) raise Exception(errorStr) except: errorStr = '''\nException on readLine:[lineData:"%s"]\n%s'''%(line,traceback.format_exc()) raise Exception(errorStr) def __getRecord(self): '''×éÖ¯´æ´¢¼Ç¼''' rec = {} rec[u'NPCID'] = self.NPCID rec[u'Type'] = self.Type rec[u'FunctionType'] = self.FunctionType rec[u'Name'] = fix_incomingText(self.Name) rec[u'LV'] = self.LV rec[u'Country'] = self.Country rec[u'MinAtk'] = self.MinAtk rec[u'MaxAtk'] = self.MaxAtk rec[u'Def'] = self.Def rec[u'MAtkMin'] = self.MAtkMin rec[u'MAtkMax'] = self.MAtkMax rec[u'MDef'] = self.MDef rec[u'PoisionAtk'] = self.PoisionAtk rec[u'FireAtk'] = self.FireAtk rec[u'IceAtk'] = self.IceAtk rec[u'ThunderAtk'] = self.ThunderAtk rec[u'WindAtk'] = self.WindAtk rec[u'PoisionDef'] = self.PoisionDef rec[u'FireDef'] = self.FireDef rec[u'IceDef'] = self.IceDef rec[u'ThunderDef'] = self.ThunderDef rec[u'WindDef'] = self.WindDef rec[u'AtkInterval'] = self.AtkInterval rec[u'Hit'] = self.Hit rec[u'MissRate'] = self.MissRate rec[u'SuperHiteRate'] = self.SuperHiteRate rec[u'OrgSpeed'] = self.OrgSpeed rec[u'MoveType'] = self.MoveType rec[u'AtkDist'] = self.AtkDist rec[u'Skill1'] = self.Skill1 rec[u'Skill2'] = self.Skill2 rec[u'Skill3'] = self.Skill3 rec[u'Skill4'] = self.Skill4 rec[u'Skill5'] = self.Skill5 rec[u'Skill6'] = self.Skill6 rec[u'Skill7'] = self.Skill7 rec[u'Skill8'] = self.Skill8 rec[u'AtkType'] = self.AtkType rec[u'Sight'] = self.Sight rec[u'MoveArea'] = self.MoveArea rec[u'HP'] = self.HP rec[u'HPEx'] = self.HPEx rec[u'HPRestore'] = self.HPRestore rec[u'AttentionRefreshID'] = self.AttentionRefreshID rec[u'EventArea'] = self.EventArea rec[u'IsBoss'] = self.IsBoss rec[u'Exp'] = self.Exp rec[u'SP'] = self.SP rec[u'AIType'] = self.AIType rec[u'CanAttack'] = self.CanAttack rec[u'HurtType'] = self.HurtType return rec def adoInsert(self, collection): '''Ö´ÐвåÈë''' trycnt = 0 rec = self.__getRecord() while(True): try: collection.insert(rec, False, True) break except pymongo.errors.OperationFailure, err: if(DBConfig.TryCntOnWriteFail > trycnt): trycnt += 1 continue addADOExceptionCount() mylog.info("%s.%s:rec = %s"%(self.__class__.__name__, inspect.stack()[0][3], rec)) msg = error.formatMsg('error', error.ERROR_NO_146, 'tagChinNPC Insert failed!NPCID = %s, error = %s, trycnt = %d'%(self.NPCID, err, trycnt)) mylog.error(msg) return False return True def getBuffer(self): buf = create_string_buffer(self.getLength()) memmove(addressof(buf), addressof(self), self.getLength()) return string_at(addressof(buf), self.getLength()) def getLength(self): return sizeof(tagChinNPC) def readData(self, buf, pos): if len(buf) < pos + self.getLength(): msg = error.formatMsg('error', error.ERROR_NO_147, 'len = %s while %s expected!'%(len(buf) - pos, self.getLength())) mylog.error(msg) return -1 self.clear() memmove(addressof(self), buf[pos:], self.getLength()) return pos + self.getLength() def outputString(self): output = '''//NPCÊý¾Ý#tagChinNPC: NPCID = %s, Type = %s, FunctionType = %s, Name = %s, LV = %s, Country = %s, MinAtk = %s, MaxAtk = %s, Def = %s, MAtkMin = %s, MAtkMax = %s, MDef = %s, PoisionAtk = %s, FireAtk = %s, IceAtk = %s, ThunderAtk = %s, WindAtk = %s, PoisionDef = %s, FireDef = %s, IceDef = %s, ThunderDef = %s, WindDef = %s, AtkInterval = %s, Hit = %s, MissRate = %s, SuperHiteRate = %s, OrgSpeed = %s, MoveType = %s, AtkDist = %s, Skill1 = %s, Skill2 = %s, Skill3 = %s, Skill4 = %s, Skill5 = %s, Skill6 = %s, Skill7 = %s, Skill8 = %s, AtkType = %s, Sight = %s, MoveArea = %s, HP = %s, HPEx = %s, HPRestore = %s, AttentionRefreshID = %s, EventArea = %s, IsBoss = %s, Exp = %s, SP = %s, AIType = %s, CanAttack = %s, HurtType = %s, ADOResult = %s, '''%( self.NPCID, self.Type, self.FunctionType, self.Name, self.LV, self.Country, self.MinAtk, self.MaxAtk, self.Def, self.MAtkMin, self.MAtkMax, self.MDef, self.PoisionAtk, self.FireAtk, self.IceAtk, self.ThunderAtk, self.WindAtk, self.PoisionDef, self.FireDef, self.IceDef, self.ThunderDef, self.WindDef, self.AtkInterval, self.Hit, self.MissRate, self.SuperHiteRate, self.OrgSpeed, self.MoveType, self.AtkDist, self.Skill1, self.Skill2, self.Skill3, self.Skill4, self.Skill5, self.Skill6, self.Skill7, self.Skill8, self.AtkType, self.Sight, self.MoveArea, self.HP, self.HPEx, self.HPRestore, self.AttentionRefreshID, self.EventArea, self.IsBoss, self.Exp, self.SP, self.AIType, self.CanAttack, self.HurtType, self.ADOResult ) return output #------------------------------------------------------ #NPCË¢ÐÂ#tagNPCRefresh class tagNPCRefresh(Structure): _pack_ = 1 _fields_ = [ ('RefreshID', c_ulong), ('NPCID', c_ulong), ('MapID', c_ushort), ('RefreshType', c_ubyte), ('RefreshPos', c_char * 100), ('RefreshTotal', c_ushort), ('RefreshCount', c_ushort), ('RefreshTimeType', c_ubyte), ('RefreshTime', c_ulong), ('StartTime', c_ulong), ('EndTime', c_ulong), ('PatrolType', c_ubyte), ('PatrolPos', c_char * 100), ('MinStopTime', c_ushort), ('MaxStopTime', c_ushort), ('RefreshDir', c_ubyte), ('RefreshMark', c_ulong), ('ADOResult', c_ulong), ] def __init__(self): Structure.__init__(self) self.clear() def clear(self): memset(addressof(self), 0, self.getLength()) def readLine(self, line): self.clear() wordList = line.split(SPLITCHAR) try: self.RefreshID = int(wordList[0].strip()) self.NPCID = int(wordList[1].strip()) self.MapID = int(wordList[2].strip()) self.RefreshType = int(wordList[3].strip()) self.RefreshPos = wordList[4].strip() self.RefreshTotal = int(wordList[5].strip()) self.RefreshCount = int(wordList[6].strip()) self.RefreshTimeType = int(wordList[7].strip()) self.RefreshTime = int(wordList[8].strip()) self.StartTime = int(wordList[9].strip()) self.EndTime = int(wordList[10].strip()) self.PatrolType = int(wordList[11].strip()) self.PatrolPos = wordList[12].strip() self.MinStopTime = int(wordList[13].strip()) self.MaxStopTime = int(wordList[14].strip()) self.RefreshDir = int(wordList[15].strip()) self.RefreshMark = int(wordList[16].strip()) except IndexError,e: errorStr = '''\nIndexError:%s [lineData:"%s"]'''%(e, line) raise Exception(errorStr) except: errorStr = '''\nException on readLine:[lineData:"%s"]\n%s'''%(line,traceback.format_exc()) raise Exception(errorStr) def __getRecord(self): '''×éÖ¯´æ´¢¼Ç¼''' rec = {} rec[u'RefreshID'] = self.RefreshID rec[u'NPCID'] = self.NPCID rec[u'MapID'] = self.MapID rec[u'RefreshType'] = self.RefreshType rec[u'RefreshPos'] = fix_incomingText(self.RefreshPos) rec[u'RefreshTotal'] = self.RefreshTotal rec[u'RefreshCount'] = self.RefreshCount rec[u'RefreshTimeType'] = self.RefreshTimeType rec[u'RefreshTime'] = self.RefreshTime rec[u'StartTime'] = self.StartTime rec[u'EndTime'] = self.EndTime rec[u'PatrolType'] = self.PatrolType rec[u'PatrolPos'] = fix_incomingText(self.PatrolPos) rec[u'MinStopTime'] = self.MinStopTime rec[u'MaxStopTime'] = self.MaxStopTime rec[u'RefreshDir'] = self.RefreshDir rec[u'RefreshMark'] = self.RefreshMark return rec def adoInsert(self, collection): '''Ö´ÐвåÈë''' trycnt = 0 rec = self.__getRecord() while(True): try: collection.insert(rec, False, True) break except pymongo.errors.OperationFailure, err: if(DBConfig.TryCntOnWriteFail > trycnt): trycnt += 1 continue addADOExceptionCount() mylog.info("%s.%s:rec = %s"%(self.__class__.__name__, inspect.stack()[0][3], rec)) msg = error.formatMsg('error', error.ERROR_NO_146, 'tagNPCRefresh Insert failed!RefreshID = %s, error = %s, trycnt = %d'%(self.RefreshID, err, trycnt)) mylog.error(msg) return False return True def getBuffer(self): buf = create_string_buffer(self.getLength()) memmove(addressof(buf), addressof(self), self.getLength()) return string_at(addressof(buf), self.getLength()) def getLength(self): return sizeof(tagNPCRefresh) def readData(self, buf, pos): if len(buf) < pos + self.getLength(): msg = error.formatMsg('error', error.ERROR_NO_147, 'len = %s while %s expected!'%(len(buf) - pos, self.getLength())) mylog.error(msg) return -1 self.clear() memmove(addressof(self), buf[pos:], self.getLength()) return pos + self.getLength() def outputString(self): output = '''//NPCË¢ÐÂ#tagNPCRefresh: RefreshID = %s, NPCID = %s, MapID = %s, RefreshType = %s, RefreshPos = %s, RefreshTotal = %s, RefreshCount = %s, RefreshTimeType = %s, RefreshTime = %s, StartTime = %s, EndTime = %s, PatrolType = %s, PatrolPos = %s, MinStopTime = %s, MaxStopTime = %s, RefreshDir = %s, RefreshMark = %s, ADOResult = %s, '''%( self.RefreshID, self.NPCID, self.MapID, self.RefreshType, self.RefreshPos, self.RefreshTotal, self.RefreshCount, self.RefreshTimeType, self.RefreshTime, self.StartTime, self.EndTime, self.PatrolType, self.PatrolPos, self.MinStopTime, self.MaxStopTime, self.RefreshDir, self.RefreshMark, self.ADOResult ) return output #------------------------------------------------------ #²¶×½NPC»ñµÃ³èÎïµ°/³èÎïµ°Éú³É³èÎï#tagNPC_Item_Pet class tagNPC_Item_Pet(Structure): _pack_ = 1 _fields_ = [ ('NPCID', c_ulong), ('EggID', c_ulong), ('Pet', c_char * 30), ('ADOResult', c_ulong), ] def __init__(self): Structure.__init__(self) self.clear() def clear(self): memset(addressof(self), 0, self.getLength()) def readLine(self, line): self.clear() wordList = line.split(SPLITCHAR) try: self.NPCID = int(wordList[0].strip()) self.EggID = int(wordList[1].strip()) self.Pet = wordList[2].strip() except IndexError,e: errorStr = '''\nIndexError:%s [lineData:"%s"]'''%(e, line) raise Exception(errorStr) except: errorStr = '''\nException on readLine:[lineData:"%s"]\n%s'''%(line,traceback.format_exc()) raise Exception(errorStr) def __getRecord(self): '''×éÖ¯´æ´¢¼Ç¼''' rec = {} rec[u'NPCID'] = self.NPCID rec[u'EggID'] = self.EggID rec[u'Pet'] = fix_incomingText(self.Pet) return rec def adoInsert(self, collection): '''Ö´ÐвåÈë''' trycnt = 0 rec = self.__getRecord() while(True): try: collection.insert(rec, False, True) break except pymongo.errors.OperationFailure, err: if(DBConfig.TryCntOnWriteFail > trycnt): trycnt += 1 continue addADOExceptionCount() mylog.info("%s.%s:rec = %s"%(self.__class__.__name__, inspect.stack()[0][3], rec)) msg = error.formatMsg('error', error.ERROR_NO_146, 'tagNPC_Item_Pet Insert failed!NPCID = %s, error = %s, trycnt = %d'%(self.NPCID, err, trycnt)) mylog.error(msg) return False return True def getBuffer(self): buf = create_string_buffer(self.getLength()) memmove(addressof(buf), addressof(self), self.getLength()) return string_at(addressof(buf), self.getLength()) def getLength(self): return sizeof(tagNPC_Item_Pet) def readData(self, buf, pos): if len(buf) < pos + self.getLength(): msg = error.formatMsg('error', error.ERROR_NO_147, 'len = %s while %s expected!'%(len(buf) - pos, self.getLength())) mylog.error(msg) return -1 self.clear() memmove(addressof(self), buf[pos:], self.getLength()) return pos + self.getLength() def outputString(self): output = '''//²¶×½NPC»ñµÃ³èÎïµ°/³èÎïµ°Éú³É³èÎï#tagNPC_Item_Pet: NPCID = %s, EggID = %s, Pet = %s, ADOResult = %s, '''%( self.NPCID, self.EggID, self.Pet, self.ADOResult ) return output #------------------------------------------------------ #ÈÎÎñɾ³ý´¥·¢±í#tagOnMissionDelete class tagOnMissionDelete(Structure): _pack_ = 1 _fields_ = [ ('MissionID', c_ulong), ('CanDelete', c_ulong), ('DeleteTruck', c_ulong), ('DeleteItemCount', c_char * 100), ('DeleteMissionDict', c_char * 400), ('DecreaseCount', c_ulong), ('NextMissionID', c_ulong), ('ADOResult', c_ulong), ] def __init__(self): Structure.__init__(self) self.clear() def clear(self): memset(addressof(self), 0, self.getLength()) def readLine(self, line): self.clear() wordList = line.split(SPLITCHAR) try: self.MissionID = int(wordList[0].strip()) self.CanDelete = int(wordList[1].strip()) self.DeleteTruck = int(wordList[2].strip()) self.DeleteItemCount = wordList[3].strip() self.DeleteMissionDict = wordList[4].strip() self.DecreaseCount = int(wordList[5].strip()) self.NextMissionID = int(wordList[6].strip()) except IndexError,e: errorStr = '''\nIndexError:%s [lineData:"%s"]'''%(e, line) raise Exception(errorStr) except: errorStr = '''\nException on readLine:[lineData:"%s"]\n%s'''%(line,traceback.format_exc()) raise Exception(errorStr) def __getRecord(self): '''×éÖ¯´æ´¢¼Ç¼''' rec = {} rec[u'MissionID'] = self.MissionID rec[u'CanDelete'] = self.CanDelete rec[u'DeleteTruck'] = self.DeleteTruck rec[u'DeleteItemCount'] = fix_incomingText(self.DeleteItemCount) rec[u'DeleteMissionDict'] = fix_incomingText(self.DeleteMissionDict) rec[u'DecreaseCount'] = self.DecreaseCount rec[u'NextMissionID'] = self.NextMissionID return rec def adoInsert(self, collection): '''Ö´ÐвåÈë''' trycnt = 0 rec = self.__getRecord() while(True): try: collection.insert(rec, False, True) break except pymongo.errors.OperationFailure, err: if(DBConfig.TryCntOnWriteFail > trycnt): trycnt += 1 continue addADOExceptionCount() mylog.info("%s.%s:rec = %s"%(self.__class__.__name__, inspect.stack()[0][3], rec)) msg = error.formatMsg('error', error.ERROR_NO_146, 'tagOnMissionDelete Insert failed!MissionID = %s, error = %s, trycnt = %d'%(self.MissionID, err, trycnt)) mylog.error(msg) return False return True def getBuffer(self): buf = create_string_buffer(self.getLength()) memmove(addressof(buf), addressof(self), self.getLength()) return string_at(addressof(buf), self.getLength()) def getLength(self): return sizeof(tagOnMissionDelete) def readData(self, buf, pos): if len(buf) < pos + self.getLength(): msg = error.formatMsg('error', error.ERROR_NO_147, 'len = %s while %s expected!'%(len(buf) - pos, self.getLength())) mylog.error(msg) return -1 self.clear() memmove(addressof(self), buf[pos:], self.getLength()) return pos + self.getLength() def outputString(self): output = '''//ÈÎÎñɾ³ý´¥·¢±í#tagOnMissionDelete: MissionID = %s, CanDelete = %s, DeleteTruck = %s, DeleteItemCount = %s, DeleteMissionDict = %s, DecreaseCount = %s, NextMissionID = %s, ADOResult = %s, '''%( self.MissionID, self.CanDelete, self.DeleteTruck, self.DeleteItemCount, self.DeleteMissionDict, self.DecreaseCount, self.NextMissionID, self.ADOResult ) return output #------------------------------------------------------ #³èÎïÉý¼¶¾­Ñé±í#tagPetExp class tagPetExp(Structure): _pack_ = 1 _fields_ = [ ('Lv', c_ushort), ('Exp', c_ulong), ('Points', c_ubyte), ('ReExp', c_ushort), ('ADOResult', c_ulong), ] def __init__(self): Structure.__init__(self) self.clear() def clear(self): memset(addressof(self), 0, self.getLength()) def readLine(self, line): self.clear() wordList = line.split(SPLITCHAR) try: self.Lv = int(wordList[0].strip()) self.Exp = int(wordList[1].strip()) self.Points = int(wordList[2].strip()) self.ReExp = int(wordList[3].strip()) except IndexError,e: errorStr = '''\nIndexError:%s [lineData:"%s"]'''%(e, line) raise Exception(errorStr) except: errorStr = '''\nException on readLine:[lineData:"%s"]\n%s'''%(line,traceback.format_exc()) raise Exception(errorStr) def __getRecord(self): '''×éÖ¯´æ´¢¼Ç¼''' rec = {} rec[u'Lv'] = self.Lv rec[u'Exp'] = self.Exp rec[u'Points'] = self.Points rec[u'ReExp'] = self.ReExp return rec def adoInsert(self, collection): '''Ö´ÐвåÈë''' trycnt = 0 rec = self.__getRecord() while(True): try: collection.insert(rec, False, True) break except pymongo.errors.OperationFailure, err: if(DBConfig.TryCntOnWriteFail > trycnt): trycnt += 1 continue addADOExceptionCount() mylog.info("%s.%s:rec = %s"%(self.__class__.__name__, inspect.stack()[0][3], rec)) msg = error.formatMsg('error', error.ERROR_NO_146, 'tagPetExp Insert failed!Lv = %s, error = %s, trycnt = %d'%(self.Lv, err, trycnt)) mylog.error(msg) return False return True def getBuffer(self): buf = create_string_buffer(self.getLength()) memmove(addressof(buf), addressof(self), self.getLength()) return string_at(addressof(buf), self.getLength()) def getLength(self): return sizeof(tagPetExp) def readData(self, buf, pos): if len(buf) < pos + self.getLength(): msg = error.formatMsg('error', error.ERROR_NO_147, 'len = %s while %s expected!'%(len(buf) - pos, self.getLength())) mylog.error(msg) return -1 self.clear() memmove(addressof(self), buf[pos:], self.getLength()) return pos + self.getLength() def outputString(self): output = '''//³èÎïÉý¼¶¾­Ñé±í#tagPetExp: Lv = %s, Exp = %s, Points = %s, ReExp = %s, ADOResult = %s, '''%( self.Lv, self.Exp, self.Points, self.ReExp, self.ADOResult ) return output #------------------------------------------------------ #³èÎïÇ×Ãܶȼӳɱí#tagPetFriendliness class tagPetFriendliness(Structure): _pack_ = 1 _fields_ = [ ('ZoneStart', c_ulong), ('ZoneEnd', c_ulong), ('IncPercent', c_ubyte), ('ADOResult', c_ulong), ] def __init__(self): Structure.__init__(self) self.clear() def clear(self): memset(addressof(self), 0, self.getLength()) def readLine(self, line): self.clear() wordList = line.split(SPLITCHAR) try: self.ZoneStart = int(wordList[0].strip()) self.ZoneEnd = int(wordList[1].strip()) self.IncPercent = int(wordList[2].strip()) except IndexError,e: errorStr = '''\nIndexError:%s [lineData:"%s"]'''%(e, line) raise Exception(errorStr) except: errorStr = '''\nException on readLine:[lineData:"%s"]\n%s'''%(line,traceback.format_exc()) raise Exception(errorStr) def __getRecord(self): '''×éÖ¯´æ´¢¼Ç¼''' rec = {} rec[u'ZoneStart'] = self.ZoneStart rec[u'ZoneEnd'] = self.ZoneEnd rec[u'IncPercent'] = self.IncPercent return rec def adoInsert(self, collection): '''Ö´ÐвåÈë''' trycnt = 0 rec = self.__getRecord() while(True): try: collection.insert(rec, False, True) break except pymongo.errors.OperationFailure, err: if(DBConfig.TryCntOnWriteFail > trycnt): trycnt += 1 continue addADOExceptionCount() mylog.info("%s.%s:rec = %s"%(self.__class__.__name__, inspect.stack()[0][3], rec)) msg = error.formatMsg('error', error.ERROR_NO_146, 'tagPetFriendliness Insert failed!ZoneStart = %s, error = %s, trycnt = %d'%(self.ZoneStart, err, trycnt)) mylog.error(msg) return False return True def getBuffer(self): buf = create_string_buffer(self.getLength()) memmove(addressof(buf), addressof(self), self.getLength()) return string_at(addressof(buf), self.getLength()) def getLength(self): return sizeof(tagPetFriendliness) def readData(self, buf, pos): if len(buf) < pos + self.getLength(): msg = error.formatMsg('error', error.ERROR_NO_147, 'len = %s while %s expected!'%(len(buf) - pos, self.getLength())) mylog.error(msg) return -1 self.clear() memmove(addressof(self), buf[pos:], self.getLength()) return pos + self.getLength() def outputString(self): output = '''//³èÎïÇ×Ãܶȼӳɱí#tagPetFriendliness: ZoneStart = %s, ZoneEnd = %s, IncPercent = %s, ADOResult = %s, '''%( self.ZoneStart, self.ZoneEnd, self.IncPercent, self.ADOResult ) return output #------------------------------------------------------ #³èÎïÆÀ·Ö¼Ó³É±í#tagPetGrade class tagPetGrade(Structure): _pack_ = 1 _fields_ = [ ('GradeStart', c_ulong), ('GradeEnd', c_ulong), ('IncPercent', c_ubyte), ('ADOResult', c_ulong), ] def __init__(self): Structure.__init__(self) self.clear() def clear(self): memset(addressof(self), 0, self.getLength()) def readLine(self, line): self.clear() wordList = line.split(SPLITCHAR) try: self.GradeStart = int(wordList[0].strip()) self.GradeEnd = int(wordList[1].strip()) self.IncPercent = int(wordList[2].strip()) except IndexError,e: errorStr = '''\nIndexError:%s [lineData:"%s"]'''%(e, line) raise Exception(errorStr) except: errorStr = '''\nException on readLine:[lineData:"%s"]\n%s'''%(line,traceback.format_exc()) raise Exception(errorStr) def __getRecord(self): '''×éÖ¯´æ´¢¼Ç¼''' rec = {} rec[u'GradeStart'] = self.GradeStart rec[u'GradeEnd'] = self.GradeEnd rec[u'IncPercent'] = self.IncPercent return rec def adoInsert(self, collection): '''Ö´ÐвåÈë''' trycnt = 0 rec = self.__getRecord() while(True): try: collection.insert(rec, False, True) break except pymongo.errors.OperationFailure, err: if(DBConfig.TryCntOnWriteFail > trycnt): trycnt += 1 continue addADOExceptionCount() mylog.info("%s.%s:rec = %s"%(self.__class__.__name__, inspect.stack()[0][3], rec)) msg = error.formatMsg('error', error.ERROR_NO_146, 'tagPetGrade Insert failed!GradeStart = %s, error = %s, trycnt = %d'%(self.GradeStart, err, trycnt)) mylog.error(msg) return False return True def getBuffer(self): buf = create_string_buffer(self.getLength()) memmove(addressof(buf), addressof(self), self.getLength()) return string_at(addressof(buf), self.getLength()) def getLength(self): return sizeof(tagPetGrade) def readData(self, buf, pos): if len(buf) < pos + self.getLength(): msg = error.formatMsg('error', error.ERROR_NO_147, 'len = %s while %s expected!'%(len(buf) - pos, self.getLength())) mylog.error(msg) return -1 self.clear() memmove(addressof(self), buf[pos:], self.getLength()) return pos + self.getLength() def outputString(self): output = '''//³èÎïÆÀ·Ö¼Ó³É±í#tagPetGrade: GradeStart = %s, GradeEnd = %s, IncPercent = %s, ADOResult = %s, '''%( self.GradeStart, self.GradeEnd, self.IncPercent, self.ADOResult ) return output #------------------------------------------------------ #ÖØ¸´Ê¼þ±í#tagRepeatEvent class tagRepeatEvent(Structure): _pack_ = 1 _fields_ = [ ('EventID', c_ushort), ('EventName', c_char * 30), ('ClearType', c_ushort), ('RepeatTime', c_char * 20), ('ADOResult', c_ulong), ] def __init__(self): Structure.__init__(self) self.clear() def clear(self): memset(addressof(self), 0, self.getLength()) def readLine(self, line): self.clear() wordList = line.split(SPLITCHAR) try: self.EventID = int(wordList[0].strip()) self.EventName = wordList[1].strip() self.ClearType = int(wordList[2].strip()) self.RepeatTime = wordList[3].strip() except IndexError,e: errorStr = '''\nIndexError:%s [lineData:"%s"]'''%(e, line) raise Exception(errorStr) except: errorStr = '''\nException on readLine:[lineData:"%s"]\n%s'''%(line,traceback.format_exc()) raise Exception(errorStr) def __getRecord(self): '''×éÖ¯´æ´¢¼Ç¼''' rec = {} rec[u'EventID'] = self.EventID rec[u'EventName'] = fix_incomingText(self.EventName) rec[u'ClearType'] = self.ClearType rec[u'RepeatTime'] = fix_incomingText(self.RepeatTime) return rec def adoInsert(self, collection): '''Ö´ÐвåÈë''' trycnt = 0 rec = self.__getRecord() while(True): try: collection.insert(rec, False, True) break except pymongo.errors.OperationFailure, err: if(DBConfig.TryCntOnWriteFail > trycnt): trycnt += 1 continue addADOExceptionCount() mylog.info("%s.%s:rec = %s"%(self.__class__.__name__, inspect.stack()[0][3], rec)) msg = error.formatMsg('error', error.ERROR_NO_146, 'tagRepeatEvent Insert failed!EventID = %s, error = %s, trycnt = %d'%(self.EventID, err, trycnt)) mylog.error(msg) return False return True def getBuffer(self): buf = create_string_buffer(self.getLength()) memmove(addressof(buf), addressof(self), self.getLength()) return string_at(addressof(buf), self.getLength()) def getLength(self): return sizeof(tagRepeatEvent) def readData(self, buf, pos): if len(buf) < pos + self.getLength(): msg = error.formatMsg('error', error.ERROR_NO_147, 'len = %s while %s expected!'%(len(buf) - pos, self.getLength())) mylog.error(msg) return -1 self.clear() memmove(addressof(self), buf[pos:], self.getLength()) return pos + self.getLength() def outputString(self): output = '''//ÖØ¸´Ê¼þ±í#tagRepeatEvent: EventID = %s, EventName = %s, ClearType = %s, RepeatTime = %s, ADOResult = %s, '''%( self.EventID, self.EventName, self.ClearType, self.RepeatTime, self.ADOResult ) return output #------------------------------------------------------ #É̵êÎïÆ·±í#tagChinShopItem class tagChinShopItem(Structure): _pack_ = 1 _fields_ = [ ('ShopItemID', c_ulong), ('NPCID', c_ulong), ('KindIndex', c_ubyte), ('ItemID', c_ulong), ('ItemCount', c_ulong), ('MoneyType', c_ubyte), ('Money', c_ulong), ('StarLV', c_ubyte), ('IsLucky', c_ubyte), ('SkillBoostIndex', c_ushort), ('SkillBoostValue', c_ulong), ('AddAttrLV', c_ubyte), ('AddAttrType', c_ubyte), ('AddAttrValue', c_ushort), ('Hole', c_ubyte), ('StoneInfo', c_char * 256), ('LimitFamilyLV', c_ubyte), ('LimitCountDaily', c_ulong), ('LimitPlusType1', c_ubyte), ('LimitPlusValue1', c_ushort), ('LimitPlusType2', c_ubyte), ('LimitPlusValue2', c_ushort), ('LimitPlusType3', c_ubyte), ('LimitPlusValue3', c_ushort), ('ADOResult', c_ulong), ] def __init__(self): Structure.__init__(self) self.clear() def clear(self): memset(addressof(self), 0, self.getLength()) def readLine(self, line): self.clear() wordList = line.split(SPLITCHAR) try: self.ShopItemID = int(wordList[0].strip()) self.NPCID = int(wordList[1].strip()) self.KindIndex = int(wordList[2].strip()) self.ItemID = int(wordList[3].strip()) self.ItemCount = int(wordList[4].strip()) self.MoneyType = int(wordList[5].strip()) self.Money = int(wordList[6].strip()) self.StarLV = int(wordList[7].strip()) self.IsLucky = int(wordList[8].strip()) self.SkillBoostIndex = int(wordList[9].strip()) self.SkillBoostValue = int(wordList[10].strip()) self.AddAttrLV = int(wordList[11].strip()) self.AddAttrType = int(wordList[12].strip()) self.AddAttrValue = int(wordList[13].strip()) self.Hole = int(wordList[14].strip()) self.StoneInfo = wordList[15].strip() self.LimitFamilyLV = int(wordList[16].strip()) self.LimitCountDaily = int(wordList[17].strip()) self.LimitPlusType1 = int(wordList[18].strip()) self.LimitPlusValue1 = int(wordList[19].strip()) self.LimitPlusType2 = int(wordList[20].strip()) self.LimitPlusValue2 = int(wordList[21].strip()) self.LimitPlusType3 = int(wordList[22].strip()) self.LimitPlusValue3 = int(wordList[23].strip()) except IndexError,e: errorStr = '''\nIndexError:%s [lineData:"%s"]'''%(e, line) raise Exception(errorStr) except: errorStr = '''\nException on readLine:[lineData:"%s"]\n%s'''%(line,traceback.format_exc()) raise Exception(errorStr) def __getRecord(self): '''×éÖ¯´æ´¢¼Ç¼''' rec = {} rec[u'ShopItemID'] = self.ShopItemID rec[u'NPCID'] = self.NPCID rec[u'KindIndex'] = self.KindIndex rec[u'ItemID'] = self.ItemID rec[u'ItemCount'] = self.ItemCount rec[u'MoneyType'] = self.MoneyType rec[u'Money'] = self.Money rec[u'StarLV'] = self.StarLV rec[u'IsLucky'] = self.IsLucky rec[u'SkillBoostIndex'] = self.SkillBoostIndex rec[u'SkillBoostValue'] = self.SkillBoostValue rec[u'AddAttrLV'] = self.AddAttrLV rec[u'AddAttrType'] = self.AddAttrType rec[u'AddAttrValue'] = self.AddAttrValue rec[u'Hole'] = self.Hole rec[u'StoneInfo'] = fix_incomingText(self.StoneInfo) rec[u'LimitFamilyLV'] = self.LimitFamilyLV rec[u'LimitCountDaily'] = self.LimitCountDaily rec[u'LimitPlusType1'] = self.LimitPlusType1 rec[u'LimitPlusValue1'] = self.LimitPlusValue1 rec[u'LimitPlusType2'] = self.LimitPlusType2 rec[u'LimitPlusValue2'] = self.LimitPlusValue2 rec[u'LimitPlusType3'] = self.LimitPlusType3 rec[u'LimitPlusValue3'] = self.LimitPlusValue3 return rec def adoInsert(self, collection): '''Ö´ÐвåÈë''' trycnt = 0 rec = self.__getRecord() while(True): try: collection.insert(rec, False, True) break except pymongo.errors.OperationFailure, err: if(DBConfig.TryCntOnWriteFail > trycnt): trycnt += 1 continue addADOExceptionCount() mylog.info("%s.%s:rec = %s"%(self.__class__.__name__, inspect.stack()[0][3], rec)) msg = error.formatMsg('error', error.ERROR_NO_146, 'tagChinShopItem Insert failed!NPCID = %s, error = %s, trycnt = %d'%(self.NPCID, err, trycnt)) mylog.error(msg) return False return True def getBuffer(self): buf = create_string_buffer(self.getLength()) memmove(addressof(buf), addressof(self), self.getLength()) return string_at(addressof(buf), self.getLength()) def getLength(self): return sizeof(tagChinShopItem) def readData(self, buf, pos): if len(buf) < pos + self.getLength(): msg = error.formatMsg('error', error.ERROR_NO_147, 'len = %s while %s expected!'%(len(buf) - pos, self.getLength())) mylog.error(msg) return -1 self.clear() memmove(addressof(self), buf[pos:], self.getLength()) return pos + self.getLength() def outputString(self): output = '''//É̵êÎïÆ·±í#tagChinShopItem: ShopItemID = %s, NPCID = %s, KindIndex = %s, ItemID = %s, ItemCount = %s, MoneyType = %s, Money = %s, StarLV = %s, IsLucky = %s, SkillBoostIndex = %s, SkillBoostValue = %s, AddAttrLV = %s, AddAttrType = %s, AddAttrValue = %s, Hole = %s, StoneInfo = %s, LimitFamilyLV = %s, LimitCountDaily = %s, LimitPlusType1 = %s, LimitPlusValue1 = %s, LimitPlusType2 = %s, LimitPlusValue2 = %s, LimitPlusType3 = %s, LimitPlusValue3 = %s, ADOResult = %s, '''%( self.ShopItemID, self.NPCID, self.KindIndex, self.ItemID, self.ItemCount, self.MoneyType, self.Money, self.StarLV, self.IsLucky, self.SkillBoostIndex, self.SkillBoostValue, self.AddAttrLV, self.AddAttrType, self.AddAttrValue, self.Hole, self.StoneInfo, self.LimitFamilyLV, self.LimitCountDaily, self.LimitPlusType1, self.LimitPlusValue1, self.LimitPlusType2, self.LimitPlusValue2, self.LimitPlusType3, self.LimitPlusValue3, self.ADOResult ) return output #------------------------------------------------------ #¼¼ÄÜÊý¾Ý#tagChinSkill class tagChinSkill(Structure): _pack_ = 1 _fields_ = [ ('SkillID', c_ulong), ('SkillName', c_char * 22), ('SkillTypeID', c_ulong), ('SkillLV', c_ulong), ('SkillMaxLV', c_ulong), ('UseType', c_ubyte), ('FuncType', c_ubyte), ('CastTime', c_ulong), ('SkillType', c_ubyte), ('HurtType', c_ubyte), ('ContinueUse', c_ubyte), ('AtkType', c_ubyte), ('AtkRadius', c_ubyte), ('Tag', c_ubyte), ('AtkDist', c_ubyte), ('StiffTime', c_ulong), ('CoolDownTime', c_ulong), ('MP', c_ulong), ('HP', c_ulong), ('XP', c_ulong), ('UseItemID', c_ulong), ('UseItemCount', c_ulong), ('Effect1', c_ulong), ('EffectValue11', c_ulong), ('EffectValue12', c_ulong), ('EffectValue13', c_ulong), ('Effect2', c_ulong), ('EffectValue21', c_ulong), ('EffectValue22', c_ulong), ('EffectValue23', c_ulong), ('Effect3', c_ulong), ('EffectValue31', c_ulong), ('EffectValue32', c_ulong), ('EffectValue33', c_ulong), ('Effect4', c_ulong), ('EffectValue41', c_ulong), ('EffectValue42', c_ulong), ('EffectValue43', c_ulong), ('Effect5', c_ulong), ('EffectValue51', c_ulong), ('EffectValue52', c_ulong), ('EffectValue53', c_ulong), ('Effect6', c_ulong), ('EffectValue61', c_ulong), ('EffectValue62', c_ulong), ('EffectValue63', c_ulong), ('HappenRate', c_ulong), ('LastTime', c_ulong), ('SkillAngry', c_ulong), ('SkillEnhance1', c_ulong), ('SkillEnhance2', c_ulong), ('StateSkillReq', c_ulong), ('StateSkillLV', c_ulong), ('LearnSkillReq', c_ulong), ('LearnSkillLV', c_ushort), ('LVReq', c_ushort), ('LearnSkillPointReq', c_ushort), ('DieContinue', c_ubyte), ('CanRepeatTime', c_ubyte), ('CommonCD', c_ubyte), ('ClientEffectType', c_ubyte), ('FightPower', c_ulong), ('LVUpCostMoneyType', c_ubyte), ('LVUpCostMoney', c_ulong), ('LVUpCostExp', c_ulong), ('ServerSkillSeriesLimit', c_ulong), ('ServerActionLimit', c_ulong), ('ClientActionLimit', c_ulong), ('ClientSkillSeriesLimit', c_ulong), ('SkillOfSeries', c_ulong), ('ExpendMPRate', c_ushort), ('ExAttr1', c_ulong), ('ExAttr2', c_ulong), ('ExAttr3', c_ulong), ('ExAttr4', c_ulong), ('ExAttr5', c_ulong), ('ADOResult', c_ulong), ] def __init__(self): Structure.__init__(self) self.clear() def clear(self): memset(addressof(self), 0, self.getLength()) def readLine(self, line): self.clear() wordList = line.split(SPLITCHAR) try: self.SkillID = int(wordList[0].strip()) self.SkillName = wordList[1].strip() self.SkillTypeID = int(wordList[2].strip()) self.SkillLV = int(wordList[3].strip()) self.SkillMaxLV = int(wordList[4].strip()) self.UseType = int(wordList[5].strip()) self.FuncType = int(wordList[6].strip()) self.CastTime = int(wordList[7].strip()) self.SkillType = int(wordList[8].strip()) self.HurtType = int(wordList[9].strip()) self.ContinueUse = int(wordList[10].strip()) self.AtkType = int(wordList[11].strip()) self.AtkRadius = int(wordList[12].strip()) self.Tag = int(wordList[13].strip()) self.AtkDist = int(wordList[14].strip()) self.StiffTime = int(wordList[15].strip()) self.CoolDownTime = int(wordList[16].strip()) self.MP = int(wordList[17].strip()) self.HP = int(wordList[18].strip()) self.XP = int(wordList[19].strip()) self.UseItemID = int(wordList[20].strip()) self.UseItemCount = int(wordList[21].strip()) self.Effect1 = int(wordList[22].strip()) self.EffectValue11 = int(wordList[23].strip()) self.EffectValue12 = int(wordList[24].strip()) self.EffectValue13 = int(wordList[25].strip()) self.Effect2 = int(wordList[26].strip()) self.EffectValue21 = int(wordList[27].strip()) self.EffectValue22 = int(wordList[28].strip()) self.EffectValue23 = int(wordList[29].strip()) self.Effect3 = int(wordList[30].strip()) self.EffectValue31 = int(wordList[31].strip()) self.EffectValue32 = int(wordList[32].strip()) self.EffectValue33 = int(wordList[33].strip()) self.Effect4 = int(wordList[34].strip()) self.EffectValue41 = int(wordList[35].strip()) self.EffectValue42 = int(wordList[36].strip()) self.EffectValue43 = int(wordList[37].strip()) self.Effect5 = int(wordList[38].strip()) self.EffectValue51 = int(wordList[39].strip()) self.EffectValue52 = int(wordList[40].strip()) self.EffectValue53 = int(wordList[41].strip()) self.Effect6 = int(wordList[42].strip()) self.EffectValue61 = int(wordList[43].strip()) self.EffectValue62 = int(wordList[44].strip()) self.EffectValue63 = int(wordList[45].strip()) self.HappenRate = int(wordList[46].strip()) self.LastTime = int(wordList[47].strip()) self.SkillAngry = int(wordList[48].strip()) self.SkillEnhance1 = int(wordList[49].strip()) self.SkillEnhance2 = int(wordList[50].strip()) self.StateSkillReq = int(wordList[51].strip()) self.StateSkillLV = int(wordList[52].strip()) self.LearnSkillReq = int(wordList[53].strip()) self.LearnSkillLV = int(wordList[54].strip()) self.LVReq = int(wordList[55].strip()) self.LearnSkillPointReq = int(wordList[56].strip()) self.DieContinue = int(wordList[57].strip()) self.CanRepeatTime = int(wordList[58].strip()) self.CommonCD = int(wordList[59].strip()) self.ClientEffectType = int(wordList[60].strip()) self.FightPower = int(wordList[61].strip()) self.LVUpCostMoneyType = int(wordList[62].strip()) self.LVUpCostMoney = int(wordList[63].strip()) self.LVUpCostExp = int(wordList[64].strip()) self.ServerSkillSeriesLimit = int(wordList[65].strip()) self.ServerActionLimit = int(wordList[66].strip()) self.ClientActionLimit = int(wordList[67].strip()) self.ClientSkillSeriesLimit = int(wordList[68].strip()) self.SkillOfSeries = int(wordList[69].strip()) self.ExpendMPRate = int(wordList[70].strip()) self.ExAttr1 = int(wordList[71].strip()) self.ExAttr2 = int(wordList[72].strip()) self.ExAttr3 = int(wordList[73].strip()) self.ExAttr4 = int(wordList[74].strip()) self.ExAttr5 = int(wordList[75].strip()) except IndexError,e: errorStr = '''\nIndexError:%s [lineData:"%s"]'''%(e, line) raise Exception(errorStr) except: errorStr = '''\nException on readLine:[lineData:"%s"]\n%s'''%(line,traceback.format_exc()) raise Exception(errorStr) def __getRecord(self): '''×éÖ¯´æ´¢¼Ç¼''' rec = {} rec[u'SkillID'] = self.SkillID rec[u'SkillName'] = fix_incomingText(self.SkillName) rec[u'SkillTypeID'] = self.SkillTypeID rec[u'SkillLV'] = self.SkillLV rec[u'SkillMaxLV'] = self.SkillMaxLV rec[u'UseType'] = self.UseType rec[u'FuncType'] = self.FuncType rec[u'CastTime'] = self.CastTime rec[u'SkillType'] = self.SkillType rec[u'HurtType'] = self.HurtType rec[u'ContinueUse'] = self.ContinueUse rec[u'AtkType'] = self.AtkType rec[u'AtkRadius'] = self.AtkRadius rec[u'Tag'] = self.Tag rec[u'AtkDist'] = self.AtkDist rec[u'StiffTime'] = self.StiffTime rec[u'CoolDownTime'] = self.CoolDownTime rec[u'MP'] = self.MP rec[u'HP'] = self.HP rec[u'XP'] = self.XP rec[u'UseItemID'] = self.UseItemID rec[u'UseItemCount'] = self.UseItemCount rec[u'Effect1'] = self.Effect1 rec[u'EffectValue11'] = self.EffectValue11 rec[u'EffectValue12'] = self.EffectValue12 rec[u'EffectValue13'] = self.EffectValue13 rec[u'Effect2'] = self.Effect2 rec[u'EffectValue21'] = self.EffectValue21 rec[u'EffectValue22'] = self.EffectValue22 rec[u'EffectValue23'] = self.EffectValue23 rec[u'Effect3'] = self.Effect3 rec[u'EffectValue31'] = self.EffectValue31 rec[u'EffectValue32'] = self.EffectValue32 rec[u'EffectValue33'] = self.EffectValue33 rec[u'Effect4'] = self.Effect4 rec[u'EffectValue41'] = self.EffectValue41 rec[u'EffectValue42'] = self.EffectValue42 rec[u'EffectValue43'] = self.EffectValue43 rec[u'Effect5'] = self.Effect5 rec[u'EffectValue51'] = self.EffectValue51 rec[u'EffectValue52'] = self.EffectValue52 rec[u'EffectValue53'] = self.EffectValue53 rec[u'Effect6'] = self.Effect6 rec[u'EffectValue61'] = self.EffectValue61 rec[u'EffectValue62'] = self.EffectValue62 rec[u'EffectValue63'] = self.EffectValue63 rec[u'HappenRate'] = self.HappenRate rec[u'LastTime'] = self.LastTime rec[u'SkillAngry'] = self.SkillAngry rec[u'SkillEnhance1'] = self.SkillEnhance1 rec[u'SkillEnhance2'] = self.SkillEnhance2 rec[u'StateSkillReq'] = self.StateSkillReq rec[u'StateSkillLV'] = self.StateSkillLV rec[u'LearnSkillReq'] = self.LearnSkillReq rec[u'LearnSkillLV'] = self.LearnSkillLV rec[u'LVReq'] = self.LVReq rec[u'LearnSkillPointReq'] = self.LearnSkillPointReq rec[u'DieContinue'] = self.DieContinue rec[u'CanRepeatTime'] = self.CanRepeatTime rec[u'CommonCD'] = self.CommonCD rec[u'ClientEffectType'] = self.ClientEffectType rec[u'FightPower'] = self.FightPower rec[u'LVUpCostMoneyType'] = self.LVUpCostMoneyType rec[u'LVUpCostMoney'] = self.LVUpCostMoney rec[u'LVUpCostExp'] = self.LVUpCostExp rec[u'ServerSkillSeriesLimit'] = self.ServerSkillSeriesLimit rec[u'ServerActionLimit'] = self.ServerActionLimit rec[u'ClientActionLimit'] = self.ClientActionLimit rec[u'ClientSkillSeriesLimit'] = self.ClientSkillSeriesLimit rec[u'SkillOfSeries'] = self.SkillOfSeries rec[u'ExpendMPRate'] = self.ExpendMPRate rec[u'ExAttr1'] = self.ExAttr1 rec[u'ExAttr2'] = self.ExAttr2 rec[u'ExAttr3'] = self.ExAttr3 rec[u'ExAttr4'] = self.ExAttr4 rec[u'ExAttr5'] = self.ExAttr5 return rec def adoInsert(self, collection): '''Ö´ÐвåÈë''' trycnt = 0 rec = self.__getRecord() while(True): try: collection.insert(rec, False, True) break except pymongo.errors.OperationFailure, err: if(DBConfig.TryCntOnWriteFail > trycnt): trycnt += 1 continue addADOExceptionCount() mylog.info("%s.%s:rec = %s"%(self.__class__.__name__, inspect.stack()[0][3], rec)) msg = error.formatMsg('error', error.ERROR_NO_146, 'tagChinSkill Insert failed!SkillID = %s, error = %s, trycnt = %d'%(self.SkillID, err, trycnt)) mylog.error(msg) return False return True def getBuffer(self): buf = create_string_buffer(self.getLength()) memmove(addressof(buf), addressof(self), self.getLength()) return string_at(addressof(buf), self.getLength()) def getLength(self): return sizeof(tagChinSkill) def readData(self, buf, pos): if len(buf) < pos + self.getLength(): msg = error.formatMsg('error', error.ERROR_NO_147, 'len = %s while %s expected!'%(len(buf) - pos, self.getLength())) mylog.error(msg) return -1 self.clear() memmove(addressof(self), buf[pos:], self.getLength()) return pos + self.getLength() def outputString(self): output = '''//¼¼ÄÜÊý¾Ý#tagChinSkill: SkillID = %s, SkillName = %s, SkillTypeID = %s, SkillLV = %s, SkillMaxLV = %s, UseType = %s, FuncType = %s, CastTime = %s, SkillType = %s, HurtType = %s, ContinueUse = %s, AtkType = %s, AtkRadius = %s, Tag = %s, AtkDist = %s, StiffTime = %s, CoolDownTime = %s, MP = %s, HP = %s, XP = %s, UseItemID = %s, UseItemCount = %s, Effect1 = %s, EffectValue11 = %s, EffectValue12 = %s, EffectValue13 = %s, Effect2 = %s, EffectValue21 = %s, EffectValue22 = %s, EffectValue23 = %s, Effect3 = %s, EffectValue31 = %s, EffectValue32 = %s, EffectValue33 = %s, Effect4 = %s, EffectValue41 = %s, EffectValue42 = %s, EffectValue43 = %s, Effect5 = %s, EffectValue51 = %s, EffectValue52 = %s, EffectValue53 = %s, Effect6 = %s, EffectValue61 = %s, EffectValue62 = %s, EffectValue63 = %s, HappenRate = %s, LastTime = %s, SkillAngry = %s, SkillEnhance1 = %s, SkillEnhance2 = %s, StateSkillReq = %s, StateSkillLV = %s, LearnSkillReq = %s, LearnSkillLV = %s, LVReq = %s, LearnSkillPointReq = %s, DieContinue = %s, CanRepeatTime = %s, CommonCD = %s, ClientEffectType = %s, FightPower = %s, LVUpCostMoneyType = %s, LVUpCostMoney = %s, LVUpCostExp = %s, ServerSkillSeriesLimit = %s, ServerActionLimit = %s, ClientActionLimit = %s, ClientSkillSeriesLimit = %s, SkillOfSeries = %s, ExpendMPRate = %s, ExAttr1 = %s, ExAttr2 = %s, ExAttr3 = %s, ExAttr4 = %s, ExAttr5 = %s, ADOResult = %s, '''%( self.SkillID, self.SkillName, self.SkillTypeID, self.SkillLV, self.SkillMaxLV, self.UseType, self.FuncType, self.CastTime, self.SkillType, self.HurtType, self.ContinueUse, self.AtkType, self.AtkRadius, self.Tag, self.AtkDist, self.StiffTime, self.CoolDownTime, self.MP, self.HP, self.XP, self.UseItemID, self.UseItemCount, self.Effect1, self.EffectValue11, self.EffectValue12, self.EffectValue13, self.Effect2, self.EffectValue21, self.EffectValue22, self.EffectValue23, self.Effect3, self.EffectValue31, self.EffectValue32, self.EffectValue33, self.Effect4, self.EffectValue41, self.EffectValue42, self.EffectValue43, self.Effect5, self.EffectValue51, self.EffectValue52, self.EffectValue53, self.Effect6, self.EffectValue61, self.EffectValue62, self.EffectValue63, self.HappenRate, self.LastTime, self.SkillAngry, self.SkillEnhance1, self.SkillEnhance2, self.StateSkillReq, self.StateSkillLV, self.LearnSkillReq, self.LearnSkillLV, self.LVReq, self.LearnSkillPointReq, self.DieContinue, self.CanRepeatTime, self.CommonCD, self.ClientEffectType, self.FightPower, self.LVUpCostMoneyType, self.LVUpCostMoney, self.LVUpCostExp, self.ServerSkillSeriesLimit, self.ServerActionLimit, self.ClientActionLimit, self.ClientSkillSeriesLimit, self.SkillOfSeries, self.ExpendMPRate, self.ExAttr1, self.ExAttr2, self.ExAttr3, self.ExAttr4, self.ExAttr5, self.ADOResult ) return output #------------------------------------------------------ #×°±¸Ì××°¼¤»î±í#tagSuiteActivation class tagSuiteActivation(Structure): _pack_ = 1 _fields_ = [ ('EquipID', c_ulong), ('ItemID', c_ulong), ('ItemCount', c_ushort), ('Money', c_ulong), ('ADOResult', c_ulong), ] def __init__(self): Structure.__init__(self) self.clear() def clear(self): memset(addressof(self), 0, self.getLength()) def readLine(self, line): self.clear() wordList = line.split(SPLITCHAR) try: self.EquipID = int(wordList[0].strip()) self.ItemID = int(wordList[1].strip()) self.ItemCount = int(wordList[2].strip()) self.Money = int(wordList[3].strip()) except IndexError,e: errorStr = '''\nIndexError:%s [lineData:"%s"]'''%(e, line) raise Exception(errorStr) except: errorStr = '''\nException on readLine:[lineData:"%s"]\n%s'''%(line,traceback.format_exc()) raise Exception(errorStr) def __getRecord(self): '''×éÖ¯´æ´¢¼Ç¼''' rec = {} rec[u'EquipID'] = self.EquipID rec[u'ItemID'] = self.ItemID rec[u'ItemCount'] = self.ItemCount rec[u'Money'] = self.Money return rec def adoInsert(self, collection): '''Ö´ÐвåÈë''' trycnt = 0 rec = self.__getRecord() while(True): try: collection.insert(rec, False, True) break except pymongo.errors.OperationFailure, err: if(DBConfig.TryCntOnWriteFail > trycnt): trycnt += 1 continue addADOExceptionCount() mylog.info("%s.%s:rec = %s"%(self.__class__.__name__, inspect.stack()[0][3], rec)) msg = error.formatMsg('error', error.ERROR_NO_146, 'tagSuiteActivation Insert failed!EquipID = %s, error = %s, trycnt = %d'%(self.EquipID, err, trycnt)) mylog.error(msg) return False return True def getBuffer(self): buf = create_string_buffer(self.getLength()) memmove(addressof(buf), addressof(self), self.getLength()) return string_at(addressof(buf), self.getLength()) def getLength(self): return sizeof(tagSuiteActivation) def readData(self, buf, pos): if len(buf) < pos + self.getLength(): msg = error.formatMsg('error', error.ERROR_NO_147, 'len = %s while %s expected!'%(len(buf) - pos, self.getLength())) mylog.error(msg) return -1 self.clear() memmove(addressof(self), buf[pos:], self.getLength()) return pos + self.getLength() def outputString(self): output = '''//×°±¸Ì××°¼¤»î±í#tagSuiteActivation: EquipID = %s, ItemID = %s, ItemCount = %s, Money = %s, ADOResult = %s, '''%( self.EquipID, self.ItemID, self.ItemCount, self.Money, self.ADOResult ) return output #------------------------------------------------------ #³èÎïϵͳ±í#tagPet class tagPet(Structure): _pack_ = 1 _fields_ = [ ('NPCID', c_ulong), ('PetType', c_ubyte), ('BringLV', c_ushort), ('HPTalent', c_ushort), ('MPTalent', c_ushort), ('PhysicAtkTalent', c_ushort), ('MagicAtkTalent', c_ushort), ('PhysicDefTalent', c_ushort), ('MagicDefTalent', c_ushort), ('HPTalentFactor', c_ushort), ('MPTalentFactor', c_ushort), ('PhysicAtkTalentFactor', c_ushort), ('MagicAtkTalentFactor', c_ushort), ('PhysicDefTalentFactor', c_ushort), ('MagicDefTalentFactor', c_ushort), ('MaxSkillCount', c_ubyte), ('SkillList', c_char * 1000), ('LVUpSkillList', c_char * 1000), ('SkillListFromRewash', c_char * 1000), ('SkillLimit', c_ubyte), ('SkillLimitIncreateCnt', c_ubyte), ('ADOResult', c_ulong), ] def __init__(self): Structure.__init__(self) self.clear() def clear(self): memset(addressof(self), 0, self.getLength()) def readLine(self, line): self.clear() wordList = line.split(SPLITCHAR) try: self.NPCID = int(wordList[0].strip()) self.PetType = int(wordList[1].strip()) self.BringLV = int(wordList[2].strip()) self.HPTalent = int(wordList[3].strip()) self.MPTalent = int(wordList[4].strip()) self.PhysicAtkTalent = int(wordList[5].strip()) self.MagicAtkTalent = int(wordList[6].strip()) self.PhysicDefTalent = int(wordList[7].strip()) self.MagicDefTalent = int(wordList[8].strip()) self.HPTalentFactor = int(wordList[9].strip()) self.MPTalentFactor = int(wordList[10].strip()) self.PhysicAtkTalentFactor = int(wordList[11].strip()) self.MagicAtkTalentFactor = int(wordList[12].strip()) self.PhysicDefTalentFactor = int(wordList[13].strip()) self.MagicDefTalentFactor = int(wordList[14].strip()) self.MaxSkillCount = int(wordList[15].strip()) self.SkillList = wordList[16].strip() self.LVUpSkillList = wordList[17].strip() self.SkillListFromRewash = wordList[18].strip() self.SkillLimit = int(wordList[19].strip()) self.SkillLimitIncreateCnt = int(wordList[20].strip()) except IndexError,e: errorStr = '''\nIndexError:%s [lineData:"%s"]'''%(e, line) raise Exception(errorStr) except: errorStr = '''\nException on readLine:[lineData:"%s"]\n%s'''%(line,traceback.format_exc()) raise Exception(errorStr) def __getRecord(self): '''×éÖ¯´æ´¢¼Ç¼''' rec = {} rec[u'NPCID'] = self.NPCID rec[u'PetType'] = self.PetType rec[u'BringLV'] = self.BringLV rec[u'HPTalent'] = self.HPTalent rec[u'MPTalent'] = self.MPTalent rec[u'PhysicAtkTalent'] = self.PhysicAtkTalent rec[u'MagicAtkTalent'] = self.MagicAtkTalent rec[u'PhysicDefTalent'] = self.PhysicDefTalent rec[u'MagicDefTalent'] = self.MagicDefTalent rec[u'HPTalentFactor'] = self.HPTalentFactor rec[u'MPTalentFactor'] = self.MPTalentFactor rec[u'PhysicAtkTalentFactor'] = self.PhysicAtkTalentFactor rec[u'MagicAtkTalentFactor'] = self.MagicAtkTalentFactor rec[u'PhysicDefTalentFactor'] = self.PhysicDefTalentFactor rec[u'MagicDefTalentFactor'] = self.MagicDefTalentFactor rec[u'MaxSkillCount'] = self.MaxSkillCount rec[u'SkillList'] = fix_incomingText(self.SkillList) rec[u'LVUpSkillList'] = fix_incomingText(self.LVUpSkillList) rec[u'SkillListFromRewash'] = fix_incomingText(self.SkillListFromRewash) rec[u'SkillLimit'] = self.SkillLimit rec[u'SkillLimitIncreateCnt'] = self.SkillLimitIncreateCnt return rec def adoInsert(self, collection): '''Ö´ÐвåÈë''' trycnt = 0 rec = self.__getRecord() while(True): try: collection.insert(rec, False, True) break except pymongo.errors.OperationFailure, err: if(DBConfig.TryCntOnWriteFail > trycnt): trycnt += 1 continue addADOExceptionCount() mylog.info("%s.%s:rec = %s"%(self.__class__.__name__, inspect.stack()[0][3], rec)) msg = error.formatMsg('error', error.ERROR_NO_146, 'tagPet Insert failed!NPCID = %s, error = %s, trycnt = %d'%(self.NPCID, err, trycnt)) mylog.error(msg) return False return True def getBuffer(self): buf = create_string_buffer(self.getLength()) memmove(addressof(buf), addressof(self), self.getLength()) return string_at(addressof(buf), self.getLength()) def getLength(self): return sizeof(tagPet) def readData(self, buf, pos): if len(buf) < pos + self.getLength(): msg = error.formatMsg('error', error.ERROR_NO_147, 'len = %s while %s expected!'%(len(buf) - pos, self.getLength())) mylog.error(msg) return -1 self.clear() memmove(addressof(self), buf[pos:], self.getLength()) return pos + self.getLength() def outputString(self): output = '''//³èÎïϵͳ±í#tagPet: NPCID = %s, PetType = %s, BringLV = %s, HPTalent = %s, MPTalent = %s, PhysicAtkTalent = %s, MagicAtkTalent = %s, PhysicDefTalent = %s, MagicDefTalent = %s, HPTalentFactor = %s, MPTalentFactor = %s, PhysicAtkTalentFactor = %s, MagicAtkTalentFactor = %s, PhysicDefTalentFactor = %s, MagicDefTalentFactor = %s, MaxSkillCount = %s, SkillList = %s, LVUpSkillList = %s, SkillListFromRewash = %s, SkillLimit = %s, SkillLimitIncreateCnt = %s, ADOResult = %s, '''%( self.NPCID, self.PetType, self.BringLV, self.HPTalent, self.MPTalent, self.PhysicAtkTalent, self.MagicAtkTalent, self.PhysicDefTalent, self.MagicDefTalent, self.HPTalentFactor, self.MPTalentFactor, self.PhysicAtkTalentFactor, self.MagicAtkTalentFactor, self.PhysicDefTalentFactor, self.MagicDefTalentFactor, self.MaxSkillCount, self.SkillList, self.LVUpSkillList, self.SkillListFromRewash, self.SkillLimit, self.SkillLimitIncreateCnt, self.ADOResult ) return output #------------------------------------------------------ #È«¾ÖµôÂÊ#tagDBGameWorldDrop class tagDBGameWorldDrop(Structure): _pack_ = 1 _fields_ = [ ('DropKey', c_ulong), ('ItemID', c_ulong), ('FunctionType', c_ubyte), ('DropCount', c_ulong), ('RefreshType', c_ubyte), ('ADOResult', c_ulong), ] def __init__(self): Structure.__init__(self) self.clear() def clear(self): memset(addressof(self), 0, self.getLength()) def readLine(self, line): self.clear() wordList = line.split(SPLITCHAR) try: self.DropKey = int(wordList[0].strip()) self.ItemID = int(wordList[1].strip()) self.FunctionType = int(wordList[2].strip()) self.DropCount = int(wordList[3].strip()) self.RefreshType = int(wordList[4].strip()) except IndexError,e: errorStr = '''\nIndexError:%s [lineData:"%s"]'''%(e, line) raise Exception(errorStr) except: errorStr = '''\nException on readLine:[lineData:"%s"]\n%s'''%(line,traceback.format_exc()) raise Exception(errorStr) def __getRecord(self): '''×éÖ¯´æ´¢¼Ç¼''' rec = {} rec[u'DropKey'] = self.DropKey rec[u'ItemID'] = self.ItemID rec[u'FunctionType'] = self.FunctionType rec[u'DropCount'] = self.DropCount rec[u'RefreshType'] = self.RefreshType return rec def adoInsert(self, collection): '''Ö´ÐвåÈë''' trycnt = 0 rec = self.__getRecord() while(True): try: collection.insert(rec, False, True) break except pymongo.errors.OperationFailure, err: if(DBConfig.TryCntOnWriteFail > trycnt): trycnt += 1 continue addADOExceptionCount() mylog.info("%s.%s:rec = %s"%(self.__class__.__name__, inspect.stack()[0][3], rec)) msg = error.formatMsg('error', error.ERROR_NO_146, 'tagDBGameWorldDrop Insert failed!DropKey = %s, error = %s, trycnt = %d'%(self.DropKey, err, trycnt)) mylog.error(msg) return False return True def getBuffer(self): buf = create_string_buffer(self.getLength()) memmove(addressof(buf), addressof(self), self.getLength()) return string_at(addressof(buf), self.getLength()) def getLength(self): return sizeof(tagDBGameWorldDrop) def readData(self, buf, pos): if len(buf) < pos + self.getLength(): msg = error.formatMsg('error', error.ERROR_NO_147, 'len = %s while %s expected!'%(len(buf) - pos, self.getLength())) mylog.error(msg) return -1 self.clear() memmove(addressof(self), buf[pos:], self.getLength()) return pos + self.getLength() def outputString(self): output = '''//È«¾ÖµôÂÊ#tagDBGameWorldDrop: DropKey = %s, ItemID = %s, FunctionType = %s, DropCount = %s, RefreshType = %s, ADOResult = %s, '''%( self.DropKey, self.ItemID, self.FunctionType, self.DropCount, self.RefreshType, self.ADOResult ) return output #------------------------------------------------------ #É̳ÇÎïÆ·#tagDBStoreItem class tagDBStoreItem(Structure): _pack_ = 1 _fields_ = [ ('StoreItemKey', c_ulong), ('AreaIndex', c_ubyte), ('MenuIndex', c_ubyte), ('TypeIndex', c_ubyte), ('ItemID', c_ulong), ('SaleState', c_ubyte), ('ItemCount', c_ushort), ('Gold', c_ulong), ('GoldPaper', c_ulong), ('Silver', c_ulong), ('SilverPaper', c_ulong), ('ADOResult', c_ulong), ] def __init__(self): Structure.__init__(self) self.clear() def clear(self): memset(addressof(self), 0, self.getLength()) def readLine(self, line): self.clear() wordList = line.split(SPLITCHAR) try: self.StoreItemKey = int(wordList[0].strip()) self.AreaIndex = int(wordList[1].strip()) self.MenuIndex = int(wordList[2].strip()) self.TypeIndex = int(wordList[3].strip()) self.ItemID = int(wordList[4].strip()) self.SaleState = int(wordList[5].strip()) self.ItemCount = int(wordList[6].strip()) self.Gold = int(wordList[7].strip()) self.GoldPaper = int(wordList[8].strip()) self.Silver = int(wordList[9].strip()) self.SilverPaper = int(wordList[10].strip()) except IndexError,e: errorStr = '''\nIndexError:%s [lineData:"%s"]'''%(e, line) raise Exception(errorStr) except: errorStr = '''\nException on readLine:[lineData:"%s"]\n%s'''%(line,traceback.format_exc()) raise Exception(errorStr) def __getRecord(self): '''×éÖ¯´æ´¢¼Ç¼''' rec = {} rec[u'StoreItemKey'] = self.StoreItemKey rec[u'AreaIndex'] = self.AreaIndex rec[u'MenuIndex'] = self.MenuIndex rec[u'TypeIndex'] = self.TypeIndex rec[u'ItemID'] = self.ItemID rec[u'SaleState'] = self.SaleState rec[u'ItemCount'] = self.ItemCount rec[u'Gold'] = self.Gold rec[u'GoldPaper'] = self.GoldPaper rec[u'Silver'] = self.Silver rec[u'SilverPaper'] = self.SilverPaper return rec def adoInsert(self, collection): '''Ö´ÐвåÈë''' trycnt = 0 rec = self.__getRecord() while(True): try: collection.insert(rec, False, True) break except pymongo.errors.OperationFailure, err: if(DBConfig.TryCntOnWriteFail > trycnt): trycnt += 1 continue addADOExceptionCount() mylog.info("%s.%s:rec = %s"%(self.__class__.__name__, inspect.stack()[0][3], rec)) msg = error.formatMsg('error', error.ERROR_NO_146, 'tagDBStoreItem Insert failed!StoreItemKey = %s, error = %s, trycnt = %d'%(self.StoreItemKey, err, trycnt)) mylog.error(msg) return False return True def getBuffer(self): buf = create_string_buffer(self.getLength()) memmove(addressof(buf), addressof(self), self.getLength()) return string_at(addressof(buf), self.getLength()) def getLength(self): return sizeof(tagDBStoreItem) def readData(self, buf, pos): if len(buf) < pos + self.getLength(): msg = error.formatMsg('error', error.ERROR_NO_147, 'len = %s while %s expected!'%(len(buf) - pos, self.getLength())) mylog.error(msg) return -1 self.clear() memmove(addressof(self), buf[pos:], self.getLength()) return pos + self.getLength() def outputString(self): output = '''//É̳ÇÎïÆ·#tagDBStoreItem: StoreItemKey = %s, AreaIndex = %s, MenuIndex = %s, TypeIndex = %s, ItemID = %s, SaleState = %s, ItemCount = %s, Gold = %s, GoldPaper = %s, Silver = %s, SilverPaper = %s, ADOResult = %s, '''%( self.StoreItemKey, self.AreaIndex, self.MenuIndex, self.TypeIndex, self.ItemID, self.SaleState, self.ItemCount, self.Gold, self.GoldPaper, self.Silver, self.SilverPaper, self.ADOResult ) return output #------------------------------------------------------ #Çл»µã¶¨Òå#tagTransportRefresh class tagTransportRefresh(Structure): _pack_ = 1 _fields_ = [ ('RefreshID', c_ulong), ('MapID', c_ushort), ('PosX', c_ushort), ('PosY', c_ushort), ('Range', c_ushort), ('TargetMapID', c_ushort), ('TargetPosX', c_ushort), ('TargetPosY', c_ushort), ('ADOResult', c_ulong), ] def __init__(self): Structure.__init__(self) self.clear() def clear(self): memset(addressof(self), 0, self.getLength()) def readLine(self, line): self.clear() wordList = line.split(SPLITCHAR) try: self.RefreshID = int(wordList[0].strip()) self.MapID = int(wordList[1].strip()) self.PosX = int(wordList[2].strip()) self.PosY = int(wordList[3].strip()) self.Range = int(wordList[4].strip()) self.TargetMapID = int(wordList[5].strip()) self.TargetPosX = int(wordList[6].strip()) self.TargetPosY = int(wordList[7].strip()) except IndexError,e: errorStr = '''\nIndexError:%s [lineData:"%s"]'''%(e, line) raise Exception(errorStr) except: errorStr = '''\nException on readLine:[lineData:"%s"]\n%s'''%(line,traceback.format_exc()) raise Exception(errorStr) def __getRecord(self): '''×éÖ¯´æ´¢¼Ç¼''' rec = {} rec[u'RefreshID'] = self.RefreshID rec[u'MapID'] = self.MapID rec[u'PosX'] = self.PosX rec[u'PosY'] = self.PosY rec[u'Range'] = self.Range rec[u'TargetMapID'] = self.TargetMapID rec[u'TargetPosX'] = self.TargetPosX rec[u'TargetPosY'] = self.TargetPosY return rec def adoInsert(self, collection): '''Ö´ÐвåÈë''' trycnt = 0 rec = self.__getRecord() while(True): try: collection.insert(rec, False, True) break except pymongo.errors.OperationFailure, err: if(DBConfig.TryCntOnWriteFail > trycnt): trycnt += 1 continue addADOExceptionCount() mylog.info("%s.%s:rec = %s"%(self.__class__.__name__, inspect.stack()[0][3], rec)) msg = error.formatMsg('error', error.ERROR_NO_146, 'tagTransportRefresh Insert failed!RefreshID = %s, error = %s, trycnt = %d'%(self.RefreshID, err, trycnt)) mylog.error(msg) return False return True def getBuffer(self): buf = create_string_buffer(self.getLength()) memmove(addressof(buf), addressof(self), self.getLength()) return string_at(addressof(buf), self.getLength()) def getLength(self): return sizeof(tagTransportRefresh) def readData(self, buf, pos): if len(buf) < pos + self.getLength(): msg = error.formatMsg('error', error.ERROR_NO_147, 'len = %s while %s expected!'%(len(buf) - pos, self.getLength())) mylog.error(msg) return -1 self.clear() memmove(addressof(self), buf[pos:], self.getLength()) return pos + self.getLength() def outputString(self): output = '''//Çл»µã¶¨Òå#tagTransportRefresh: RefreshID = %s, MapID = %s, PosX = %s, PosY = %s, Range = %s, TargetMapID = %s, TargetPosX = %s, TargetPosY = %s, ADOResult = %s, '''%( self.RefreshID, self.MapID, self.PosX, self.PosY, self.Range, self.TargetMapID, self.TargetPosX, self.TargetPosY, self.ADOResult ) return output #·ÉÐÐÎï¼þ»ù´¡ÐÅÏ¢±í#tagFlyObjBaseInfo class tagFlyObjBaseInfo(Structure): _pack_ = 1 _fields_ = [ ('TypeID', c_ulong), ('Size', c_ushort), ('Speed', c_ushort), ('BombOnArrive', c_ubyte), ('DisapperaredOnHit', c_ubyte), ('ADOResult', c_ulong), ] def __init__(self): Structure.__init__(self) self.clear() def clear(self): memset(addressof(self), 0, self.getLength()) def readLine(self, line): self.clear() wordList = line.split(SPLITCHAR) try: self.TypeID = int(wordList[0].strip()) self.Size = int(wordList[1].strip()) self.Speed = int(wordList[2].strip()) self.BombOnArrive = int(wordList[3].strip()) self.DisapperaredOnHit = int(wordList[4].strip()) except IndexError,e: errorStr = '''\nIndexError:%s [lineData:"%s"]'''%(e, line) raise Exception(errorStr) except: errorStr = '''\nException on readLine:[lineData:"%s"]\n%s'''%(line,traceback.format_exc()) raise Exception(errorStr) def __getRecord(self): '''×éÖ¯´æ´¢¼Ç¼''' rec = {} rec[u'TypeID'] = self.TypeID rec[u'Size'] = self.Size rec[u'Speed'] = self.Speed rec[u'BombOnArrive'] = self.BombOnArrive rec[u'DisapperaredOnHit'] = self.DisapperaredOnHit return rec def adoInsert(self, collection): '''Ö´ÐвåÈë''' trycnt = 0 rec = self.__getRecord() while(True): try: collection.insert(rec, False, True) break except pymongo.errors.OperationFailure, err: if(DBConfig.TryCntOnWriteFail > trycnt): trycnt += 1 continue addADOExceptionCount() mylog.info("%s.%s:rec = %s"%(self.__class__.__name__, inspect.stack()[0][3], rec)) msg = error.formatMsg('error', error.ERROR_NO_146, 'tagFlyObjBaseInfo Insert failed!TypeID = %s, error = %s, trycnt = %d'%(self.TypeID, err, trycnt)) mylog.error(msg) return False return True def getBuffer(self): buf = create_string_buffer(self.getLength()) memmove(addressof(buf), addressof(self), self.getLength()) return string_at(addressof(buf), self.getLength()) def getLength(self): return sizeof(tagFlyObjBaseInfo) def readData(self, buf, pos): if len(buf) < pos + self.getLength(): msg = error.formatMsg('error', error.ERROR_NO_147, 'len = %s while %s expected!'%(len(buf) - pos, self.getLength())) mylog.error(msg) return -1 self.clear() memmove(addressof(self), buf[pos:], self.getLength()) return pos + self.getLength() def outputString(self): output = '''//·ÉÐÐÎï¼þ»ù´¡ÐÅÏ¢±í#tagFlyObjBaseInfo: TypeID = %s, Size = %s, Speed = %s, BombOnArrive = %s, DisapperaredOnHit = %s, ADOResult = %s, '''%( self.TypeID, self.Size, self.Speed, self.BombOnArrive, self.DisapperaredOnHit, self.ADOResult ) return output def sysDBLoadFromFile(className, fileName): return MangoDBCommon.sysDBLoadFromFile(className, fileName) def SysDBUpdate(className, collection, fileName): return MangoDBCommon.SysDBUpdate(className, collection, fileName)