def _extractRawParams(self):
     if self._vehicleDescr is not None:
         descriptors = getShellDescriptors(self._itemDescr, self._vehicleDescr)
         params = calcShellParams(descriptors)
     else:
         params = self._getPrecachedInfo().params
     return params
Example #2
0
 def getAvgParams(self):
     if self._vehicleDescr is not None:
         descriptors = getShellDescriptors(self._itemDescr, self._vehicleDescr)
         avgParams = calcShellParams(descriptors)
     else:
         avgParams = self.precachedParams.avgParams
     return avgParams
Example #3
0
 def getAvgParams(self):
     if self._vehicleDescr is not None:
         descriptors = getShellDescriptors(self._itemDescr,
                                           self._vehicleDescr)
         avgParams = calcShellParams(descriptors)
     else:
         avgParams = self.precachedParams.avgParams
     return avgParams
Example #4
0
    def __precacheShells(self):
        for nationIdx in nations.INDICES.values():
            self.__cache.setdefault(nationIdx, {})[ITEM_TYPES.shell] = {}
            guns = self.__getItems(ITEM_TYPES.vehicleGun, nationIdx)
            shells = self.__getItems(ITEM_TYPES.shell, nationIdx)
            for sDescr in shells:
                descriptors = list()
                gunsCDs = []
                for gDescr in guns:
                    for shot in gDescr.shots:
                        if shot.shell.id[1] == sDescr.id[1]:
                            if gDescr.compactDescr not in gunsCDs:
                                gunsCDs.append(gDescr.compactDescr)
                                descriptors.append(shot)

                self.__cache[nationIdx][ITEM_TYPES.shell][
                    sDescr.compactDescr] = PrecachedShell(
                        guns=tuple(gunsCDs),
                        params=calcShellParams(descriptors))
Example #5
0
    def __precacheShells(self):
        for nationIdx in nations.INDICES.values():
            self.__cache.setdefault(nationIdx, {})[ITEM_TYPES.shell] = {}
            guns = self.__getItems(ITEM_TYPES.vehicleGun, nationIdx)
            shells = self.__getItems(ITEM_TYPES.shell, nationIdx)
            for sDescr in shells:
                descriptors = list()
                gNames = list()
                for gDescr in guns:
                    if 'shots' in gDescr:
                        for shot in gDescr['shots']:
                            if shot['shell']['id'][1] == sDescr['id'][1]:
                                if gDescr['userString'] not in gNames:
                                    gNames.append(gDescr['userString'])
                                    descriptors.append(shot)

                self.__cache[nationIdx][ITEM_TYPES.shell][
                    sDescr['compactDescr']] = PrecachedShell(
                        guns=tuple(gNames),
                        avgParams=calcShellParams(descriptors))
Example #6
0
    def __precacheShells(self):
        descriptors = []
        gunsCDs = []
        gunsGetter = vehicles.g_cache.guns
        shellsGetter = vehicles.g_cache.shells
        for nationIdx in nations.INDICES.values():
            self.__cache.setdefault(nationIdx, {})[ITEM_TYPES.shell] = {}
            for sDescr in shellsGetter(nationIdx).itervalues():
                del descriptors[:]
                del gunsCDs[:]
                for gDescr in gunsGetter(nationIdx).itervalues():
                    for shot in gDescr.shots:
                        if shot.shell.id[1] == sDescr.id[1]:
                            if gDescr.compactDescr not in gunsCDs:
                                gunsCDs.append(gDescr.compactDescr)
                                descriptors.append(shot)

                self.__cache[nationIdx][ITEM_TYPES.shell][
                    sDescr.compactDescr] = PrecachedShell(
                        guns=tuple(gunsCDs),
                        params=calcShellParams(descriptors))
    def __precachShells(self):
        for nationIdx in nations.INDICES.values():
            self.__cache.setdefault(nationIdx, {})[ITEM_TYPES.shell] = {}
            guns = self.__getItems(ITEM_TYPES.vehicleGun, nationIdx)
            shells = self.__getItems(ITEM_TYPES.shell, nationIdx)
            for sDescr in shells:
                descriptors = list()
                gNames = list()
                for gDescr in guns:
                    if 'shots' in gDescr:
                        for shot in gDescr['shots']:
                            if shot['shell']['id'][1] == sDescr['id'][1]:
                                if gDescr['userString'] not in gNames:
                                    gNames.append(gDescr['userString'])
                                    descriptors.append(shot)

                self.__cache[nationIdx][ITEM_TYPES.shell][sDescr['compactDescr']] = PrecachedShell(guns=tuple(gNames), avgParams=calcShellParams(descriptors))