def __getTankmanDossierDescr(self, tmanInvID): """ @param tmanInvID: tankman inventory id @return: tankman dossier descriptor """ tmanData = self.inventory.getTankmanData(tmanInvID) if tmanData is not None: return dossiers2.getTankmanDossierDescr(tmanData.descriptor.dossierCompactDescr) return dossiers2.getTankmanDossierDescr()
def __getTankmanDossierDescr(self, tmanInvID): """ @param tmanInvID: tankman inventory id @return: tankman dossier descriptor """ tmanData = self.inventory.getTankmanData(tmanInvID) if tmanData is not None: return dossiers2.getTankmanDossierDescr( tmanData.descriptor.dossierCompactDescr) return dossiers2.getTankmanDossierDescr()
def updateDossierCompDescr(compDescr): data = {} verDescr = __getVersion(compDescr) recordsLayout = __TANKMAN_LAYOUT_14 record_packing = __RECORD_PACKING_14 if verDescr == 10: recordsLayout = __TANKMAN_LAYOUT_10 record_packing = __RECORD_PACKING_10 elif verDescr == 11: recordsLayout = __TANKMAN_LAYOUT_11 record_packing = __RECORD_PACKING_11 elif verDescr == 12: recordsLayout = __TANKMAN_LAYOUT_12 record_packing = __RECORD_PACKING_12 elif verDescr == 13: recordsLayout = __TANKMAN_LAYOUT_13 record_packing = __RECORD_PACKING_13 fmt = __buildRecordsFmt(recordsLayout, record_packing) values = struct.unpack(fmt, compDescr) for index, record in enumerate(recordsLayout): data[record] = values[index] d2 = dossiers2.getTankmanDossierDescr() total = d2.expand('total') total.eventsEnabled = False total['battlesCount'] = data['battlesCount'] achievements = d2.expand('achievements') achievements.eventsEnabled = False for record in ['warrior', 'invader', 'sniper', 'defender', 'steelwall', 'supporter', 'scout', 'evileye', 'medalWittmann', 'medalOrlik', 'medalOskin', 'medalHalonen', 'medalBurda', 'medalBillotte', 'medalKolobanov', 'medalFadin', 'medalRadleyWalters', 'medalBrunoPietro', 'medalTarczay', 'medalPascucci', 'medalDumitru', 'medalLehvaslaiho', 'medalNikolas', 'medalLafayettePool', 'heroesOfRassenay', 'medalDeLanglade', 'medalTamadaYoshio']: achievements[record] = data.get(record, 0) return d2.makeCompDescr()
def __tankmanDossierResponse(self, tankmanID, resultID, data): if resultID < 0: LOG_ERROR('Server return error for inventory tankman dossier request: responseCode=%s' % resultID) return if self.__callback and data is not None: dossier = '' tankman = data.get('compDescr', None) if tankman is not None: tmenCompDescr = tankman.get(tankmanID, None) if tmenCompDescr is not None: dossier = tankmen.TankmanDescr(tmenCompDescr).dossierCompactDescr self.__callback(dossiers2.getTankmanDossierDescr(dossier))
def __tankmanDossierResponse(self, tankmanID, resultID, data): if resultID < 0: LOG_ERROR( 'Server return error for inventory tankman dossier request: responseCode=%s' % resultID) return if self.__callback and data is not None: dossier = '' tankman = data.get('compDescr', None) if tankman is not None: tmenCompDescr = tankman.get(tankmanID, None) if tmenCompDescr is not None: dossier = tankmen.TankmanDescr( tmenCompDescr).dossierCompactDescr self.__callback(dossiers2.getTankmanDossierDescr(dossier))
def getTankmanDossierDescr(compDescr = ''): if compDescr == '': return dossiers1.getTankmanDossierDescr() version = struct.unpack_from('<H', compDescr)[0] if version < 64: return dossiers1.getTankmanDossierDescr(compDescr) d2 = dossiers2.getTankmanDossierDescr(compDescr) d = dossiers1.getTankmanDossierDescr() d.expand() total = d2.expand('a15x15') for record in ['battlesCount']: d[record] = total[record] achievements = d2.expand('achievements') for record in ['warrior', 'invader', 'sniper', 'defender', 'steelwall', 'supporter', 'scout', 'evileye', 'medalWittmann', 'medalOrlik', 'medalOskin', 'medalHalonen', 'medalBurda', 'medalBillotte', 'medalKolobanov', 'medalFadin', 'medalRadleyWalters', 'medalBrunoPietro', 'medalTarczay', 'medalPascucci', 'medalDumitru', 'medalLehvaslaiho', 'medalNikolas', 'medalLafayettePool', 'heroesOfRassenay', 'medalDeLanglade', 'medalTamadaYoshio']: d[record] = achievements[record] return d
def __getTankmanDossierDescr(self, tmanInvID): tmanData = self.__inventory.getTankmanData(tmanInvID) return dossiers2.getTankmanDossierDescr( tmanData.descriptor.dossierCompactDescr ) if tmanData is not None else dossiers2.getTankmanDossierDescr()
def unpack(tmanCompDescr, dossierCD, extDossierDump): return TankmanDossier(tankmen.TankmanDescr(tmanCompDescr), dossiers2.getTankmanDossierDescr(dossierCD), loadDossier(extDossierDump))