| | |
| | | ('RealmLV', ctypes.c_ubyte),
|
| | | ('Face', ctypes.c_int),
|
| | | ('FacePic', ctypes.c_int),
|
| | | ('ModelMark', ctypes.c_ulong),
|
| | | ('EquipShowSwitch', ctypes.c_ulong),
|
| | | ('FamilyID', ctypes.c_ulong),
|
| | | ('FamilyName', ctypes.c_char * 33),
|
| | | ('FamilyEmblemID', ctypes.c_ushort),
|
| | | ('FamilyEmblemWord', ctypes.c_char * 3),
|
| | | ('TitleID', ctypes.c_ulong),
|
| | | ('FightPower', ctypes.c_ulong),
|
| | | ('FightPowerEx', ctypes.c_ulong),
|
| | |
| | | self.RealmLV = 0
|
| | | self.Face = 0
|
| | | self.FacePic = 0
|
| | | self.ModelMark = 0
|
| | | self.EquipShowSwitch = 0
|
| | | self.FamilyID = 0
|
| | | self.FamilyName = ''
|
| | | self.FamilyEmblemID = 0
|
| | | self.FamilyEmblemWord = ''
|
| | | self.TitleID = 0
|
| | | self.FightPower = 0
|
| | | self.FightPowerEx = 0
|
| | |
| | | self.RealmLV, pos = CommFunc.ReadBYTE(buf, pos)
|
| | | self.Face, pos = CommFunc.ReadDWORD(buf, pos)
|
| | | self.FacePic, pos = CommFunc.ReadDWORD(buf, pos)
|
| | | self.ModelMark, pos = CommFunc.ReadDWORD(buf, pos)
|
| | | self.EquipShowSwitch, pos = CommFunc.ReadDWORD(buf, pos)
|
| | | self.FamilyID, pos = CommFunc.ReadDWORD(buf, pos)
|
| | | self.FamilyName, pos = CommFunc.ReadString(buf, pos, 33)
|
| | | self.FamilyEmblemID, pos = CommFunc.ReadWORD(buf, pos)
|
| | | self.FamilyEmblemWord, pos = CommFunc.ReadString(buf, pos, 3)
|
| | | self.TitleID, pos = CommFunc.ReadDWORD(buf, pos)
|
| | | self.FightPower, pos = CommFunc.ReadDWORD(buf, pos)
|
| | | self.FightPowerEx, pos = CommFunc.ReadDWORD(buf, pos)
|
| | |
| | | buf = CommFunc.WriteBYTE(buf, self.RealmLV)
|
| | | buf = CommFunc.WriteDWORD(buf, self.Face)
|
| | | buf = CommFunc.WriteDWORD(buf, self.FacePic)
|
| | | buf = CommFunc.WriteDWORD(buf, self.ModelMark)
|
| | | buf = CommFunc.WriteDWORD(buf, self.EquipShowSwitch)
|
| | | buf = CommFunc.WriteDWORD(buf, self.FamilyID)
|
| | | buf = CommFunc.WriteString(buf, sizeof(ctypes.c_char) * 33, self.FamilyName)
|
| | | buf = CommFunc.WriteWORD(buf, self.FamilyEmblemID)
|
| | | buf = CommFunc.WriteString(buf, sizeof(ctypes.c_char) * 3, self.FamilyEmblemWord)
|
| | | buf = CommFunc.WriteDWORD(buf, self.TitleID)
|
| | | buf = CommFunc.WriteDWORD(buf, self.FightPower)
|
| | | buf = CommFunc.WriteDWORD(buf, self.FightPowerEx)
|
| | |
| | | length += sizeof(ctypes.c_int)
|
| | | length += sizeof(ctypes.c_int)
|
| | | length += sizeof(ctypes.c_ulong)
|
| | | length += sizeof(ctypes.c_ulong)
|
| | | length += sizeof(ctypes.c_ulong)
|
| | | length += sizeof(ctypes.c_char) * 33
|
| | | length += sizeof(ctypes.c_ushort)
|
| | | length += sizeof(ctypes.c_char) * 3
|
| | | length += sizeof(ctypes.c_ulong)
|
| | | length += sizeof(ctypes.c_ulong)
|
| | | length += sizeof(ctypes.c_ulong)
|
| | |
| | | rec[u'RealmLV'] = self.RealmLV
|
| | | rec[u'Face'] = self.Face
|
| | | rec[u'FacePic'] = self.FacePic
|
| | | rec[u'ModelMark'] = self.ModelMark
|
| | | rec[u'EquipShowSwitch'] = self.EquipShowSwitch
|
| | | rec[u'FamilyID'] = self.FamilyID
|
| | | rec[u'FamilyName'] = fix_incomingText(self.FamilyName)
|
| | | rec[u'FamilyEmblemID'] = self.FamilyEmblemID
|
| | | rec[u'FamilyEmblemWord'] = fix_incomingText(self.FamilyEmblemWord)
|
| | | rec[u'TitleID'] = self.TitleID
|
| | | rec[u'FightPower'] = self.FightPower
|
| | | rec[u'FightPowerEx'] = self.FightPowerEx
|
| | |
| | | self.RealmLV = rec.get(u'RealmLV', 0)
|
| | | self.Face = rec.get(u'Face', 0)
|
| | | self.FacePic = rec.get(u'FacePic', 0)
|
| | | self.ModelMark = rec.get(u'ModelMark', 0)
|
| | | self.EquipShowSwitch = rec.get(u'EquipShowSwitch', 0)
|
| | | self.FamilyID = rec.get(u'FamilyID', 0)
|
| | | self.FamilyName = fix_outgoingText(rec.get(u'FamilyName', u''))
|
| | | self.FamilyEmblemID = rec.get(u'FamilyEmblemID', 0)
|
| | | self.FamilyEmblemWord = fix_outgoingText(rec.get(u'FamilyEmblemWord', u''))
|
| | | self.TitleID = rec.get(u'TitleID', 0)
|
| | | self.FightPower = rec.get(u'FightPower', 0)
|
| | | self.FightPowerEx = rec.get(u'FightPowerEx', 0)
|
| | |
| | | RealmLV = %s,
|
| | | Face = %s,
|
| | | FacePic = %s,
|
| | | ModelMark = %s,
|
| | | EquipShowSwitch = %s,
|
| | | FamilyID = %s,
|
| | | FamilyName = %s,
|
| | | FamilyEmblemID = %s,
|
| | | FamilyEmblemWord = %s,
|
| | | TitleID = %s,
|
| | | FightPower = %s,
|
| | | FightPowerEx = %s,
|
| | |
| | | self.RealmLV,
|
| | | self.Face,
|
| | | self.FacePic,
|
| | | self.ModelMark,
|
| | | self.EquipShowSwitch,
|
| | | self.FamilyID,
|
| | | self.FamilyName,
|
| | | self.FamilyEmblemID,
|
| | | self.FamilyEmblemWord,
|
| | | self.TitleID,
|
| | | self.FightPower,
|
| | | self.FightPowerEx,
|
| | |
| | | return output
|
| | |
|
| | | def dumpString(self):
|
| | | output = '''%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s'''%(
|
| | | output = '''%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s'''%(
|
| | | self.PlayerID,
|
| | | self.AccID,
|
| | | self.PlayerName,
|
| | |
| | | self.RealmLV,
|
| | | self.Face,
|
| | | self.FacePic,
|
| | | self.ModelMark,
|
| | | self.EquipShowSwitch,
|
| | | self.FamilyID,
|
| | | self.FamilyName,
|
| | | self.FamilyEmblemID,
|
| | | self.FamilyEmblemWord,
|
| | | self.TitleID,
|
| | | self.FightPower,
|
| | | self.FightPowerEx,
|
| | |
| | | else:
|
| | | self.FamilyName = Str[:33]
|
| | |
|
| | | def SetFamilyEmblemWord(self,Str):
|
| | | if len(Str)<=3:
|
| | | self.FamilyEmblemWord = Str
|
| | | else:
|
| | | self.FamilyEmblemWord = Str[:3]
|
| | | |
| | |
|
| | | # 排行榜表 #tagDBBillboard
|
| | | class tagDBBillboard(Structure):
|
| | |
| | | ('CmpValue', ctypes.c_ulong),
|
| | | ('CmpValue2', ctypes.c_ulong),
|
| | | ('CmpValue3', ctypes.c_ulong),
|
| | | ('Time', ctypes.c_ulong),
|
| | | ('DataLen', ctypes.c_ushort),
|
| | | ('UserData', ctypes.c_char_p),
|
| | | ('ADOResult', ctypes.c_ulong),
|
| | |
| | | self.CmpValue = 0
|
| | | self.CmpValue2 = 0
|
| | | self.CmpValue3 = 0
|
| | | self.Time = 0
|
| | | self.DataLen = 0
|
| | | self.UserData = ''
|
| | |
|
| | |
| | | self.CmpValue, pos = CommFunc.ReadDWORD(buf, pos)
|
| | | self.CmpValue2, pos = CommFunc.ReadDWORD(buf, pos)
|
| | | self.CmpValue3, pos = CommFunc.ReadDWORD(buf, pos)
|
| | | self.Time, pos = CommFunc.ReadDWORD(buf, pos)
|
| | | self.DataLen, pos = CommFunc.ReadWORD(buf, pos)
|
| | | tmp, pos = CommFunc.ReadString(buf, pos, self.DataLen)
|
| | | self.UserData = ctypes.c_char_p(tmp)
|
| | |
| | | buf = CommFunc.WriteDWORD(buf, self.CmpValue)
|
| | | buf = CommFunc.WriteDWORD(buf, self.CmpValue2)
|
| | | buf = CommFunc.WriteDWORD(buf, self.CmpValue3)
|
| | | buf = CommFunc.WriteDWORD(buf, self.Time)
|
| | | buf = CommFunc.WriteWORD(buf, self.DataLen)
|
| | | buf = CommFunc.WriteString(buf, self.DataLen, self.UserData)
|
| | | return buf
|
| | |
| | | length += sizeof(ctypes.c_char) * 33
|
| | | length += sizeof(ctypes.c_char) * 65
|
| | | length += sizeof(ctypes.c_ubyte)
|
| | | length += sizeof(ctypes.c_ulong)
|
| | | length += sizeof(ctypes.c_ulong)
|
| | | length += sizeof(ctypes.c_ulong)
|
| | | length += sizeof(ctypes.c_ulong)
|
| | |
| | | rec[u'CmpValue'] = self.CmpValue
|
| | | rec[u'CmpValue2'] = self.CmpValue2
|
| | | rec[u'CmpValue3'] = self.CmpValue3
|
| | | rec[u'Time'] = self.Time
|
| | | rec[u'DataLen'] = self.DataLen
|
| | | rec[u'UserData'] = fix_incomingText(self.UserData)
|
| | | return rec
|
| | |
| | | self.CmpValue = rec.get(u'CmpValue', 0)
|
| | | self.CmpValue2 = rec.get(u'CmpValue2', 0)
|
| | | self.CmpValue3 = rec.get(u'CmpValue3', 0)
|
| | | self.Time = rec.get(u'Time', 0)
|
| | | self.DataLen = rec.get(u'DataLen', 0)
|
| | | self.UserData = fix_outgoingText(rec.get(u'UserData', u''))
|
| | |
|
| | |
| | | CmpValue = %s,
|
| | | CmpValue2 = %s,
|
| | | CmpValue3 = %s,
|
| | | Time = %s,
|
| | | DataLen = %s,
|
| | | UserData = %s,
|
| | | ADOResult = %s,
|
| | |
| | | self.CmpValue,
|
| | | self.CmpValue2,
|
| | | self.CmpValue3,
|
| | | self.Time,
|
| | | self.DataLen,
|
| | | self.UserData,
|
| | | self.ADOResult,
|
| | |
| | | return output
|
| | |
|
| | | def dumpString(self):
|
| | | output = '''%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s'''%(
|
| | | output = '''%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s'''%(
|
| | | self.GroupValue1,
|
| | | self.GroupValue2,
|
| | | self.BillboardType,
|
| | |
| | | self.CmpValue,
|
| | | self.CmpValue2,
|
| | | self.CmpValue3,
|
| | | self.Time,
|
| | | self.DataLen,
|
| | | self.UserData,
|
| | | )
|
| | |
| | | ('FightPower', ctypes.c_ulong),
|
| | | ('FightPowerEx', ctypes.c_ulong),
|
| | | ('EmblemID', ctypes.c_ushort),
|
| | | ('EmblemWord', ctypes.c_char * 3),
|
| | | ('ADOResult', ctypes.c_ulong),
|
| | | ]
|
| | |
|
| | |
| | | self.FightPower = 0
|
| | | self.FightPowerEx = 0
|
| | | self.EmblemID = 0
|
| | | self.EmblemWord = ''
|
| | |
|
| | | def readData(self, buf, pos = 0, length = 0):
|
| | | if not pos <= length:
|
| | |
| | | self.FightPower, pos = CommFunc.ReadDWORD(buf, pos)
|
| | | self.FightPowerEx, pos = CommFunc.ReadDWORD(buf, pos)
|
| | | self.EmblemID, pos = CommFunc.ReadWORD(buf, pos)
|
| | | self.EmblemWord, pos = CommFunc.ReadString(buf, pos, 3)
|
| | | return self.getLength()
|
| | |
|
| | | def getBuffer(self):
|
| | |
| | | buf = CommFunc.WriteDWORD(buf, self.FightPower)
|
| | | buf = CommFunc.WriteDWORD(buf, self.FightPowerEx)
|
| | | buf = CommFunc.WriteWORD(buf, self.EmblemID)
|
| | | buf = CommFunc.WriteString(buf, sizeof(ctypes.c_char) * 3, self.EmblemWord)
|
| | | return buf
|
| | |
|
| | | def getLength(self):
|
| | |
| | | length += sizeof(ctypes.c_ulong)
|
| | | length += sizeof(ctypes.c_ulong)
|
| | | length += sizeof(ctypes.c_ushort)
|
| | | length += sizeof(ctypes.c_char) * 3
|
| | | return length
|
| | |
|
| | | def getRecord(self):
|
| | |
| | | rec[u'FightPower'] = self.FightPower
|
| | | rec[u'FightPowerEx'] = self.FightPowerEx
|
| | | rec[u'EmblemID'] = self.EmblemID
|
| | | rec[u'EmblemWord'] = fix_incomingText(self.EmblemWord)
|
| | | return rec
|
| | |
|
| | | def readRecord(self, rec):
|
| | |
| | | self.FightPower = rec.get(u'FightPower', 0)
|
| | | self.FightPowerEx = rec.get(u'FightPowerEx', 0)
|
| | | self.EmblemID = rec.get(u'EmblemID', 0)
|
| | | self.EmblemWord = fix_outgoingText(rec.get(u'EmblemWord', u''))
|
| | |
|
| | | def adoLoad(self, collection):
|
| | | '''使用KEY查找并读取'''
|
| | |
| | | FightPower = %s,
|
| | | FightPowerEx = %s,
|
| | | EmblemID = %s,
|
| | | EmblemWord = %s,
|
| | | ADOResult = %s,
|
| | | '''%(
|
| | | self.ID,
|
| | |
| | | self.FightPower,
|
| | | self.FightPowerEx,
|
| | | self.EmblemID,
|
| | | self.EmblemWord,
|
| | | self.ADOResult,
|
| | | )
|
| | | return output
|
| | |
|
| | | def dumpString(self):
|
| | | output = '''%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s'''%(
|
| | | output = '''%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s'''%(
|
| | | self.ID,
|
| | | self.Name,
|
| | | self.LeaderID,
|
| | |
| | | self.FightPower,
|
| | | self.FightPowerEx,
|
| | | self.EmblemID,
|
| | | self.EmblemWord,
|
| | | )
|
| | | return output
|
| | |
|
| | |
| | | self.Name = Str
|
| | | else:
|
| | | self.Name = Str[:33]
|
| | | |
| | | def SetEmblemWord(self,Str):
|
| | | if len(Str)<=3:
|
| | | self.EmblemWord = Str
|
| | | else:
|
| | | self.EmblemWord = Str[:3]
|
| | |
|
| | |
|
| | | # 家族成员表 #tagDBFamilyMem
|
| | |
| | | ('OffTime', ctypes.c_ulong),
|
| | | ('FmLV', ctypes.c_ubyte),
|
| | | ('ContribTotal', ctypes.c_ulong),
|
| | | ('ContribWeek', ctypes.c_ulong),
|
| | | ('ContribDay', ctypes.c_ulong),
|
| | | ('DonateCntTotal', ctypes.c_ulong),
|
| | | ('DonateCntDay', ctypes.c_ubyte),
|
| | | ('TitleID', ctypes.c_ulong),
|
| | | ('ADOResult', ctypes.c_ulong),
|
| | | ]
|
| | |
|
| | |
| | | self.OffTime, pos = CommFunc.ReadDWORD(buf, pos)
|
| | | self.FmLV, pos = CommFunc.ReadBYTE(buf, pos)
|
| | | self.ContribTotal, pos = CommFunc.ReadDWORD(buf, pos)
|
| | | self.ContribWeek, pos = CommFunc.ReadDWORD(buf, pos)
|
| | | self.ContribDay, pos = CommFunc.ReadDWORD(buf, pos)
|
| | | self.DonateCntTotal, pos = CommFunc.ReadDWORD(buf, pos)
|
| | | self.DonateCntDay, pos = CommFunc.ReadBYTE(buf, pos)
|
| | | self.TitleID, pos = CommFunc.ReadDWORD(buf, pos)
|
| | | return self.getLength()
|
| | |
|
| | |
|
| | |
| | | rec[u'OffTime'] = self.OffTime
|
| | | rec[u'FmLV'] = self.FmLV
|
| | | rec[u'ContribTotal'] = self.ContribTotal
|
| | | rec[u'ContribWeek'] = self.ContribWeek
|
| | | rec[u'ContribDay'] = self.ContribDay
|
| | | rec[u'DonateCntTotal'] = self.DonateCntTotal
|
| | | rec[u'DonateCntDay'] = self.DonateCntDay
|
| | | rec[u'TitleID'] = self.TitleID
|
| | | return rec
|
| | |
|
| | | def readRecord(self, rec):
|
| | |
| | | self.OffTime = rec.get(u'OffTime', 0)
|
| | | self.FmLV = rec.get(u'FmLV', 0)
|
| | | self.ContribTotal = rec.get(u'ContribTotal', 0)
|
| | | self.ContribWeek = rec.get(u'ContribWeek', 0)
|
| | | self.ContribDay = rec.get(u'ContribDay', 0)
|
| | | self.DonateCntTotal = rec.get(u'DonateCntTotal', 0)
|
| | | self.DonateCntDay = rec.get(u'DonateCntDay', 0)
|
| | | self.TitleID = rec.get(u'TitleID', 0)
|
| | |
|
| | | def adoLoad(self, collection):
|
| | | '''使用KEY查找并读取'''
|
| | |
| | | OffTime = %s,
|
| | | FmLV = %s,
|
| | | ContribTotal = %s,
|
| | | ContribWeek = %s,
|
| | | ContribDay = %s,
|
| | | DonateCntTotal = %s,
|
| | | DonateCntDay = %s,
|
| | | TitleID = %s,
|
| | | ADOResult = %s,
|
| | | '''%(
|
| | | self.PlayerID,
|
| | |
| | | self.OffTime,
|
| | | self.FmLV,
|
| | | self.ContribTotal,
|
| | | self.ContribWeek,
|
| | | self.ContribDay,
|
| | | self.DonateCntTotal,
|
| | | self.DonateCntDay,
|
| | | self.TitleID,
|
| | | self.ADOResult,
|
| | | )
|
| | | return output
|
| | |
|
| | | def dumpString(self):
|
| | | output = '''%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s'''%(
|
| | | output = '''%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s'''%(
|
| | | self.PlayerID,
|
| | | self.FamilyID,
|
| | | self.JoinTime,
|
| | |
| | | self.OffTime,
|
| | | self.FmLV,
|
| | | self.ContribTotal,
|
| | | self.ContribWeek,
|
| | | self.ContribDay,
|
| | | self.DonateCntTotal,
|
| | | self.DonateCntDay,
|
| | | self.TitleID,
|
| | | )
|
| | | return output
|
| | |
|
| | |
| | | else:
|
| | | self.Name = Str[:33]
|
| | |
|
| | |
|
| | |
|
| | | # 通用记录表新 #tagDBGameRec
|
| | | class tagDBGameRec(Structure):
|
| | | _pack_ = 1
|
| | | _fields_ = [
|
| | | ('RecType', ctypes.c_ushort),
|
| | | ('RecID', ctypes.c_ulong),
|
| | | ('Time', ctypes.c_double),
|
| | | ('Value1', ctypes.c_ulong),
|
| | | ('Value2', ctypes.c_ulong),
|
| | | ('Value3', ctypes.c_ulong),
|
| | | ('Value4', ctypes.c_ulong),
|
| | | ('Value5', ctypes.c_ulong),
|
| | | ('Value6', ctypes.c_ulong),
|
| | | ('Value7', ctypes.c_ulong),
|
| | | ('Value8', ctypes.c_ulong),
|
| | | ('UserDataLen', ctypes.c_ushort),
|
| | | ('UserData', ctypes.c_char_p),
|
| | | ('ADOResult', ctypes.c_ulong),
|
| | | ]
|
| | |
|
| | | def __init__(self):
|
| | | Structure.__init__(self)
|
| | | self.clear()
|
| | |
|
| | | def clear(self):
|
| | | self.RecType = 0
|
| | | self.RecID = 0
|
| | | self.Time = 0.0
|
| | | self.Value1 = 0
|
| | | self.Value2 = 0
|
| | | self.Value3 = 0
|
| | | self.Value4 = 0
|
| | | self.Value5 = 0
|
| | | self.Value6 = 0
|
| | | self.Value7 = 0
|
| | | self.Value8 = 0
|
| | | self.UserDataLen = 0
|
| | | self.UserData = ''
|
| | |
|
| | | def readData(self, buf, pos = 0, length = 0):
|
| | | if not pos <= length:
|
| | | msg = error.formatMsg('error', error.ERROR_NO_148, '(pos = %s) > (length = %s)'%(pos, length))
|
| | | mylog.error(msg)
|
| | | return -1
|
| | | if len(buf) < pos + self.getLength():
|
| | | msg = error.formatMsg('error', error.ERROR_NO_149, 'len = %s while %s expected!'%(len(buf) - pos, self.getLength()))
|
| | | mylog.error(msg)
|
| | | self.clear()
|
| | | self.RecType, pos = CommFunc.ReadWORD(buf, pos)
|
| | | self.RecID, pos = CommFunc.ReadDWORD(buf, pos)
|
| | | self.Time, pos = CommFunc.ReadDouble(buf, pos)
|
| | | self.Value1, pos = CommFunc.ReadDWORD(buf, pos)
|
| | | self.Value2, pos = CommFunc.ReadDWORD(buf, pos)
|
| | | self.Value3, pos = CommFunc.ReadDWORD(buf, pos)
|
| | | self.Value4, pos = CommFunc.ReadDWORD(buf, pos)
|
| | | self.Value5, pos = CommFunc.ReadDWORD(buf, pos)
|
| | | self.Value6, pos = CommFunc.ReadDWORD(buf, pos)
|
| | | self.Value7, pos = CommFunc.ReadDWORD(buf, pos)
|
| | | self.Value8, pos = CommFunc.ReadDWORD(buf, pos)
|
| | | self.UserDataLen, pos = CommFunc.ReadWORD(buf, pos)
|
| | | tmp, pos = CommFunc.ReadString(buf, pos, self.UserDataLen)
|
| | | self.UserData = ctypes.c_char_p(tmp)
|
| | | return self.getLength()
|
| | |
|
| | | def getBuffer(self):
|
| | | buf = ''
|
| | | buf = CommFunc.WriteWORD(buf, self.RecType)
|
| | | buf = CommFunc.WriteDWORD(buf, self.RecID)
|
| | | buf = CommFunc.WriteDouble(buf, self.Time)
|
| | | buf = CommFunc.WriteDWORD(buf, self.Value1)
|
| | | buf = CommFunc.WriteDWORD(buf, self.Value2)
|
| | | buf = CommFunc.WriteDWORD(buf, self.Value3)
|
| | | buf = CommFunc.WriteDWORD(buf, self.Value4)
|
| | | buf = CommFunc.WriteDWORD(buf, self.Value5)
|
| | | buf = CommFunc.WriteDWORD(buf, self.Value6)
|
| | | buf = CommFunc.WriteDWORD(buf, self.Value7)
|
| | | buf = CommFunc.WriteDWORD(buf, self.Value8)
|
| | | buf = CommFunc.WriteWORD(buf, self.UserDataLen)
|
| | | buf = CommFunc.WriteString(buf, self.UserDataLen, self.UserData)
|
| | | return buf
|
| | |
|
| | | def getLength(self):
|
| | | length = 0
|
| | | length += sizeof(ctypes.c_ushort)
|
| | | length += sizeof(ctypes.c_ulong)
|
| | | length += sizeof(ctypes.c_double)
|
| | | length += sizeof(ctypes.c_ulong)
|
| | | length += sizeof(ctypes.c_ulong)
|
| | | length += sizeof(ctypes.c_ulong)
|
| | | length += sizeof(ctypes.c_ulong)
|
| | | length += sizeof(ctypes.c_ulong)
|
| | | length += sizeof(ctypes.c_ulong)
|
| | | length += sizeof(ctypes.c_ulong)
|
| | | length += sizeof(ctypes.c_ulong)
|
| | | length += sizeof(ctypes.c_ushort)
|
| | | length += self.UserDataLen
|
| | | return length
|
| | |
|
| | | def getRecord(self):
|
| | | '''组织存储记录'''
|
| | | rec = {}
|
| | | rec[u'RecType'] = self.RecType
|
| | | rec[u'RecID'] = self.RecID
|
| | | rec[u'Time'] = self.Time
|
| | | rec[u'Value1'] = self.Value1
|
| | | rec[u'Value2'] = self.Value2
|
| | | rec[u'Value3'] = self.Value3
|
| | | rec[u'Value4'] = self.Value4
|
| | | rec[u'Value5'] = self.Value5
|
| | | rec[u'Value6'] = self.Value6
|
| | | rec[u'Value7'] = self.Value7
|
| | | rec[u'Value8'] = self.Value8
|
| | | rec[u'UserDataLen'] = self.UserDataLen
|
| | | rec[u'UserData'] = fix_incomingText(self.UserData)
|
| | | return rec
|
| | |
|
| | | def readRecord(self, rec):
|
| | | '''由于MongoDB读出来是unicode,所有字符串需要进行转换'''
|
| | | self.RecType = rec.get(u'RecType', 0)
|
| | | self.RecID = rec.get(u'RecID', 0)
|
| | | self.Time = rec.get(u'Time', 0)
|
| | | self.Value1 = rec.get(u'Value1', 0)
|
| | | self.Value2 = rec.get(u'Value2', 0)
|
| | | self.Value3 = rec.get(u'Value3', 0)
|
| | | self.Value4 = rec.get(u'Value4', 0)
|
| | | self.Value5 = rec.get(u'Value5', 0)
|
| | | self.Value6 = rec.get(u'Value6', 0)
|
| | | self.Value7 = rec.get(u'Value7', 0)
|
| | | self.Value8 = rec.get(u'Value8', 0)
|
| | | self.UserDataLen = rec.get(u'UserDataLen', 0)
|
| | | self.UserData = fix_outgoingText(rec.get(u'UserData', u''))
|
| | |
|
| | | #Can not implement adoLoadStr method:No key defined!
|
| | | #Can not implement adoInsertStr method:No key defined!
|
| | | #Can not implement adoUpdateStr method:No key defined!
|
| | | #Can not implement adoUpdateStr method:No key defined!
|
| | | #Can not implement adoCheckUpdateStr method:No key defined!
|
| | | #Can not implement adoCheckUpdateExStr method:No key defined!
|
| | |
|
| | | def getAdoRecords(self, resultCollection):
|
| | | '''查询结果打包成二进制流'''
|
| | | result = ''
|
| | | result = CommFunc.WriteDWORD(result, resultCollection.count())
|
| | | for rec in resultCollection:
|
| | | self.readRecord(rec)
|
| | | result += self.getBuffer()
|
| | | return result
|
| | |
|
| | | #Can not implement adoQueryIndexStr method:No key defined!
|
| | |
|
| | | def adoQueryCustom(self, collection, queryDict):
|
| | | '''自定义查询'''
|
| | | resultCollection = collection.find(queryDict)
|
| | |
|
| | | return self.getAdoRecords(resultCollection)
|
| | |
|
| | |
|
| | | def adoQueryAll(self, collection):
|
| | | '''查询所有''' |
| | | resultCollection = collection.find()
|
| | | |
| | | return self.getAdoRecords(resultCollection)
|
| | |
|
| | | #Can not implement adoDeleteByIndexStr method:No key defined!
|
| | | def outputString(self):
|
| | | output = '''// 通用记录表新 #tagDBGameRec:
|
| | | RecType = %s,
|
| | | RecID = %s,
|
| | | Time = %s,
|
| | | Value1 = %s,
|
| | | Value2 = %s,
|
| | | Value3 = %s,
|
| | | Value4 = %s,
|
| | | Value5 = %s,
|
| | | Value6 = %s,
|
| | | Value7 = %s,
|
| | | Value8 = %s,
|
| | | UserDataLen = %s,
|
| | | UserData = %s,
|
| | | ADOResult = %s,
|
| | | '''%(
|
| | | self.RecType,
|
| | | self.RecID,
|
| | | self.Time,
|
| | | self.Value1,
|
| | | self.Value2,
|
| | | self.Value3,
|
| | | self.Value4,
|
| | | self.Value5,
|
| | | self.Value6,
|
| | | self.Value7,
|
| | | self.Value8,
|
| | | self.UserDataLen,
|
| | | self.UserData,
|
| | | self.ADOResult,
|
| | | )
|
| | | return output
|
| | |
|
| | | def dumpString(self):
|
| | | output = '''%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s'''%(
|
| | | self.RecType,
|
| | | self.RecID,
|
| | | self.Time,
|
| | | self.Value1,
|
| | | self.Value2,
|
| | | self.Value3,
|
| | | self.Value4,
|
| | | self.Value5,
|
| | | self.Value6,
|
| | | self.Value7,
|
| | | self.Value8,
|
| | | self.UserDataLen,
|
| | | self.UserData,
|
| | | )
|
| | | return output
|
| | |
|
| | |
|
| | | # 功能队伍表 #tagDBFuncTeam
|