コード例 #1
0
 def _extractRawParams(self):
     if self._vehicleDescr is not None:
         descriptors = getGunDescriptors(self._itemDescr, self._vehicleDescr)
         params = calcGunParams(self._itemDescr, descriptors)
     else:
         params = self._getPrecachedInfo().params
     return params
コード例 #2
0
 def getAvgParams(self):
     if self._vehicleDescr is not None:
         descriptors = getGunDescriptors(self._itemDescr, self._vehicleDescr)
         avgParams = calcGunParams(self._itemDescr, descriptors)
     else:
         avgParams = self.precachedParams.avgParams
     return avgParams
コード例 #3
0
    def __precacheGuns(self):
        for nationIdx in nations.INDICES.itervalues():
            self.__cache.setdefault(nationIdx, {})[ITEM_TYPES.vehicleGun] = {}
            vcls = self.__getItems(ITEM_TYPES.vehicle, nationIdx)
            guns = self.__getItems(ITEM_TYPES.vehicleGun, nationIdx)
            for g in guns:
                descriptors = list()
                turretsList = list()
                turretsIntCDs = dict()
                clipVehiclesList = set()
                for vDescr in vcls:
                    turretsIntCDs[
                        vDescr.type.
                        compactDescr] = curVehicleTurretsCDs = list()
                    for vTurrets in vDescr.type.turrets:
                        for turret in vTurrets:
                            for gun in turret['guns']:
                                if gun['id'][1] == g['id'][1]:
                                    descriptors.append(gun)
                                    if len(vDescr.hull['fakeTurrets']
                                           ['lobby']) != len(vDescr.turrets):
                                        curVehicleTurretsCDs.append(
                                            turret['compactDescr'])
                                        turretsList.append(
                                            turret['userString'])
                                    if gun['clip'][0] > 1:
                                        clipVehiclesList.add(
                                            vDescr.type.compactDescr)

                self.__cache[nationIdx][ITEM_TYPES.vehicleGun][
                    g['compactDescr']] = PrecachedGun(
                        turrets=tuple(turretsList),
                        clipVehicles=clipVehiclesList,
                        avgParams=calcGunParams(g, descriptors),
                        turretsByVehicles=turretsIntCDs)
コード例 #4
0
    def __precacheGuns(self):
        for nationIdx in nations.INDICES.itervalues():
            self.__cache.setdefault(nationIdx, {})[ITEM_TYPES.vehicleGun] = {}
            vcls = self.__getItems(ITEM_TYPES.vehicle, nationIdx)
            guns = self.__getItems(ITEM_TYPES.vehicleGun, nationIdx)
            for g in guns:
                descriptors = []
                turretsIntCDs = {}
                clipVehiclesList = set()
                for vDescr in vcls:
                    curVehicleTurretsCDs = []
                    for vTurrets in vDescr.type.turrets:
                        for turret in vTurrets:
                            for gun in turret.guns:
                                if gun.id[1] == g.id[1]:
                                    descriptors.append(gun)
                                    if len(vDescr.hull.fakeTurrets['lobby']
                                           ) != len(vDescr.turrets):
                                        curVehicleTurretsCDs.append(
                                            turret.compactDescr)
                                    if gun.clip[0] > 1:
                                        clipVehiclesList.add(
                                            vDescr.type.compactDescr)

                    turretsIntCDs[vDescr.type.compactDescr] = tuple(
                        curVehicleTurretsCDs)

                self.__cache[nationIdx][ITEM_TYPES.vehicleGun][
                    g.compactDescr] = PrecachedGun(
                        clipVehicles=clipVehiclesList,
                        params=calcGunParams(g, descriptors),
                        turretsByVehicles=turretsIntCDs)
コード例 #5
0
 def getAvgParams(self):
     if self._vehicleDescr is not None:
         descriptors = getGunDescriptors(self._itemDescr,
                                         self._vehicleDescr)
         avgParams = calcGunParams(self._itemDescr, descriptors)
     else:
         avgParams = self.precachedParams.avgParams
     return avgParams
コード例 #6
0
    def __precacheGuns(self, vehiclesCache):
        descriptors = []
        curVehicleTurretsCDs = []
        getter = vehicles.g_cache.guns
        for nationIdx in nations.INDICES.itervalues():
            self.__cache.setdefault(nationIdx, {})[ITEM_TYPES.vehicleGun] = {}
            for g in getter(nationIdx).itervalues():
                del descriptors[:]
                turretsIntCDs = {}
                clipVehiclesList = set()
                autoReloadVehsList = set()
                for vDescr in vehiclesCache.generator(nationIdx):
                    del curVehicleTurretsCDs[:]
                    vehCD = vDescr.type.compactDescr
                    for vTurrets in vDescr.type.turrets:
                        for turret in vTurrets:
                            for gun in turret.guns:
                                if gun.id[1] == g.id[1]:
                                    descriptors.append(gun)
                                    if len(vDescr.hull.fakeTurrets['lobby']
                                           ) != len(vDescr.turrets):
                                        curVehicleTurretsCDs.append(
                                            turret.compactDescr)
                                    if gun.clip[0] > 1:
                                        clipVehiclesList.add(vehCD)
                                    if isAutoReloadGun(gun):
                                        autoReloadVehsList.add(vehCD)

                    if curVehicleTurretsCDs:
                        turretsIntCDs[vDescr.type.compactDescr] = tuple(
                            curVehicleTurretsCDs)

                self.__cache[nationIdx][ITEM_TYPES.vehicleGun][
                    g.compactDescr] = PrecachedGun(
                        clipVehicles=clipVehiclesList
                        if clipVehiclesList else None,
                        autoReloadVehicles=frozenset(autoReloadVehsList)
                        if autoReloadVehsList else None,
                        params=calcGunParams(g, descriptors),
                        turretsByVehicles=turretsIntCDs)

        return
コード例 #7
0
    def __precachGuns(self):
        for nationIdx in nations.INDICES.itervalues():
            self.__cache.setdefault(nationIdx, {})[ITEM_TYPES.vehicleGun] = {}
            vcls = self.__getItems(ITEM_TYPES.vehicle, nationIdx)
            guns = self.__getItems(ITEM_TYPES.vehicleGun, nationIdx)
            for g in guns:
                descriptors = list()
                turretsList = list()
                turretsIntCDs = dict()
                clipVehiclesList = set()
                for vDescr in vcls:
                    turretsIntCDs[vDescr.type.compactDescr] = curVehicleTurretsCDs = list()
                    for vTurrets in vDescr.type.turrets:
                        for turret in vTurrets:
                            for gun in turret['guns']:
                                if gun['id'][1] == g['id'][1]:
                                    descriptors.append(gun)
                                    if len(vDescr.hull['fakeTurrets']['lobby']) != len(vDescr.turrets):
                                        curVehicleTurretsCDs.append(turret['compactDescr'])
                                        turretsList.append(turret['userString'])
                                    if gun['clip'][0] > 1:
                                        clipVehiclesList.add(vDescr.type.compactDescr)

                self.__cache[nationIdx][ITEM_TYPES.vehicleGun][g['compactDescr']] = PrecachedGun(turrets=tuple(turretsList), clipVehicles=clipVehiclesList, avgParams=calcGunParams(g, descriptors), turretsByVehicles=turretsIntCDs)