コード例 #1
0
def __processKillList(dossierDescr, killList):
    if not killList:
        return 0
    cache = getCache()
    vehicles8p = cache['vehicles8+']
    vehiclesByTag = cache['vehiclesByTag']
    frags8p = 0
    killsByTag = {}
    vehTypeFrags = dossierDescr['vehTypeFrags']
    for _, vehTypeCompDescr, _ in killList:
        vehTypeFrags[vehTypeCompDescr] = min(
            vehTypeFrags.get(vehTypeCompDescr, 0) + 1, 60001)
        if vehTypeCompDescr in vehicles8p:
            frags8p += 1
        for tag, record in (('beast', 'fragsBeast'), ('sinai', 'fragsSinai'),
                            ('patton', 'fragsPatton')):
            if vehTypeCompDescr in vehiclesByTag[tag]:
                killsByTag[record] = killsByTag.get(record, 0) + 1

    if killsByTag:
        achievements = dossierDescr['achievements']
        for record, frags in killsByTag.iteritems():
            achievements[record] += frags

    return frags8p
コード例 #2
0
 def _readLevelUpTotalValue(self, dossier):
     dossierCache = cache.getCache()
     if self._nationID != -1:
         return len(dossierCache[self._NATIONAL_VEHICLES].get(
             self._nationID, []))
     else:
         return len(self._getAllSuitableVehicles())
コード例 #3
0
def _set_VEH_TYPE_FRAGS_DEPENDENCIES():
    global VEH_TYPE_FRAGS_DEPENDENCIES
    cache = getCache()
    VEH_TYPE_FRAGS_DEPENDENCIES.update({
        cache['mausTypeCompDescr']: [_updateMousebane],
        '_insert_': [_updateTankExpert]
    })
コード例 #4
0
def getAllCollectorVehicles():
    cache = getCache()
    collectorVehicles = set()
    collectorVehiclesByNations = cache['collectorVehiclesByNations']
    for collectorVehiclesInNation in collectorVehiclesByNations.itervalues():
        collectorVehicles.update(collectorVehiclesInNation)

    return collectorVehicles
コード例 #5
0
ファイル: helpers.py プロジェクト: mahmoudimus/WOT-0.9.20.0
def getMechanicEngineerRequirements(defaultUnlocks, unlocks, nationID = -1):
    cache = getCache()
    vehiclesInTreesByNation = cache['vehiclesInTreesByNation']
    res = {'mechanicEngineer': cache['vehiclesInTrees'] - defaultUnlocks - unlocks}
    if nationID == -1:
        nationIDs = cache['nationsWithVehiclesInTree']
    else:
        nationIDs = [nationID]
    for nationIdx in nationIDs:
        res[''.join(['mechanicEngineer', str(nationIdx)])] = vehiclesInTreesByNation[nationIdx] - defaultUnlocks - unlocks

    return res
コード例 #6
0
ファイル: helpers.py プロジェクト: webiumsk/WOT0.9.10
def getMechanicEngineerRequirements(defaultUnlocks, unlocks, nationID = -1):
    cache = getCache()
    vehiclesInTreesByNation = cache['vehiclesInTreesByNation']
    res = {'mechanicEngineer': cache['vehiclesInTrees'] - defaultUnlocks - unlocks}
    if nationID == -1:
        nationIDs = cache['nationsWithVehiclesInTree']
    else:
        nationIDs = [nationID]
    for nationIdx in nationIDs:
        res[''.join(['mechanicEngineer', str(nationIdx)])] = vehiclesInTreesByNation[nationIdx] - defaultUnlocks - unlocks

    return res
コード例 #7
0
def getVehicleCollectorRequirements(inventoryVehicles, nationID=ALL_NATIONS_INDEX):
    cache = getCache()
    collectorVehicles = getAllCollectorVehicles()
    res = {'collectorVehicle': collectorVehicles - inventoryVehicles}
    collectorVehiclesByNations = cache['collectorVehiclesByNations']
    nationIDs = collectorVehiclesByNations.keys() if nationID == ALL_NATIONS_INDEX else [nationID]
    for nationIdx in nationIDs:
        achievementName = ''.join(['collectorVehicle', str(nationIdx)])
        collectorVehiclesByNation = collectorVehiclesByNations.get(nationIdx, set())
        if collectorVehiclesByNation:
            res[achievementName] = collectorVehiclesByNation - inventoryVehicles

    return res
コード例 #8
0
def getAllCollectorVehicles(nationID=ALL_NATIONS_INDEX):
    cache = getCache()
    collectorVehicles = set()
    collectorVehiclesByNations = cache['collectorVehiclesByNations']
    if nationID == ALL_NATIONS_INDEX:
        for collectorVehiclesInNation in collectorVehiclesByNations.itervalues(
        ):
            collectorVehicles.update(collectorVehiclesInNation)

    else:
        collectorVehicles.update(
            collectorVehiclesByNations.get(nationID, set()))
    return collectorVehicles
コード例 #9
0
ファイル: customhelpers.py プロジェクト: aevitas/wotsdk
def getTankExpertRequirements(vehTypeFrags, nationID=-1):
    cache = getCache()
    killedVehTypes = set(vehTypeFrags.iterkeys())
    res = {"tankExpert": cache["vehiclesInTrees"] - killedVehTypes}
    if nationID == -1:
        nationIDs = cache["nationsWithVehiclesInTree"]
    else:
        nationIDs = [nationID]
    vehiclesInTreesByNation = cache["vehiclesInTreesByNation"]
    for nationIdx in nationIDs:
        res["".join(["tankExpert", str(nationIdx)])] = vehiclesInTreesByNation[nationIdx] - killedVehTypes

    return res
コード例 #10
0
ファイル: helpers.py プロジェクト: mahmoudimus/WOT-0.9.20.0
def getTankExpertRequirements(vehTypeFrags, nationID = -1):
    cache = getCache()
    killedVehTypes = set(vehTypeFrags.iterkeys())
    res = {'tankExpert': cache['vehiclesInTrees'] - killedVehTypes}
    if nationID == -1:
        nationIDs = cache['nationsWithVehiclesInTree']
    else:
        nationIDs = [nationID]
    vehiclesInTreesByNation = cache['vehiclesInTreesByNation']
    for nationIdx in nationIDs:
        res[''.join(['tankExpert', str(nationIdx)])] = vehiclesInTreesByNation[nationIdx] - killedVehTypes

    return res
コード例 #11
0
ファイル: helpers.py プロジェクト: webiumsk/WOT0.9.10
def getTankExpertRequirements(vehTypeFrags, nationID = -1):
    cache = getCache()
    killedVehTypes = set(vehTypeFrags.iterkeys())
    res = {'tankExpert': cache['vehiclesInTrees'] - killedVehTypes}
    if nationID == -1:
        nationIDs = cache['nationsWithVehiclesInTree']
    else:
        nationIDs = [nationID]
    vehiclesInTreesByNation = cache['vehiclesInTreesByNation']
    for nationIdx in nationIDs:
        res[''.join(['tankExpert', str(nationIdx)])] = vehiclesInTreesByNation[nationIdx] - killedVehTypes

    return res
コード例 #12
0
ファイル: customhelpers.py プロジェクト: aevitas/wotsdk
def getMechanicEngineerRequirements(defaultUnlocks, unlocks, nationID=-1):
    cache = getCache()
    vehiclesInTreesByNation = cache["vehiclesInTreesByNation"]
    res = {"mechanicEngineer": cache["vehiclesInTrees"] - defaultUnlocks - unlocks}
    if nationID == -1:
        nationIDs = cache["nationsWithVehiclesInTree"]
    else:
        nationIDs = [nationID]
    for nationIdx in nationIDs:
        res["".join(["mechanicEngineer", str(nationIdx)])] = (
            vehiclesInTreesByNation[nationIdx] - defaultUnlocks - unlocks
        )

    return res
コード例 #13
0
ファイル: dependencies.py プロジェクト: webiumsk/WOT-0.9.15.1
def _updateTankExpert(dossierDescr, dossierBlockDescr, key, value):
    cache = getCache()
    killedVehTypes = set(dossierBlockDescr.iterkeys())
    vehiclesInTrees = cache['vehiclesInTrees']
    if key not in vehiclesInTrees:
        return
    if not bool(vehiclesInTrees - killedVehTypes):
        dossierDescr['achievements']['tankExpert'] = True
        dossierDescr.addPopUp('achievements', 'tankExpert', True)
    nationID = getVehicleNationID(key)
    if not bool(cache['vehiclesInTreesByNation'][nationID] - killedVehTypes):
        record = ''.join(['tankExpert', str(nationID)])
        dossierDescr['achievements'][record] = True
        dossierDescr.addPopUp('achievements', record, True)
コード例 #14
0
ファイル: dependencies.py プロジェクト: kusaku/wot_scripts
def _updateTankExpert(dossierDescr, dossierBlockDescr, key, value):
    cache = getCache()
    killedVehTypes = set(dossierBlockDescr.iterkeys())
    vehiclesInTrees = cache['vehiclesInTrees']
    if key not in vehiclesInTrees:
        return
    if not bool(vehiclesInTrees - killedVehTypes):
        dossierDescr['achievements']['tankExpert'] = True
        dossierDescr.addPopUp('achievements', 'tankExpert', True)
    nationID = getVehicleNationID(key)
    if not bool(cache['vehiclesInTreesByNation'][nationID] - killedVehTypes):
        record = ''.join(['tankExpert', str(nationID)])
        dossierDescr['achievements'][record] = True
        dossierDescr.addPopUp('achievements', record, True)
コード例 #15
0
def __processKillList(dossierDescr, killList):
    if not killList:
        return 0
    cache = getCache()
    vehicles8p = cache["vehicles8+"]
    vehiclesByTag = cache["vehiclesByTag"]
    frags8p = 0
    killsByTag = {}
    vehTypeFrags = dossierDescr["vehTypeFrags"]
    for _, vehTypeCompDescr, _ in killList:
        vehTypeFrags[vehTypeCompDescr] = min(vehTypeFrags.get(vehTypeCompDescr, 0) + 1, 60001)
        if vehTypeCompDescr in vehicles8p:
            frags8p += 1
        for tag, record in (("beast", "fragsBeast"), ("sinai", "fragsSinai"), ("patton", "fragsPatton")):
            if vehTypeCompDescr in vehiclesByTag[tag]:
                killsByTag[record] = killsByTag.get(record, 0) + 1

    if killsByTag:
        achievements = dossierDescr["achievements"]
        for record, frags in killsByTag.iteritems():
            achievements[record] += frags

    return frags8p
コード例 #16
0
def __processKillList(dossierDescr, killList):
    if not killList:
        return 0
    cache = getCache()
    vehicles8p = cache['vehicles8+']
    vehiclesByTag = cache['vehiclesByTag']
    frags8p = 0
    killsByTag = {}
    vehTypeFrags = dossierDescr['vehTypeFrags']
    for _, vehTypeCompDescr, _ in killList:
        vehTypeFrags[vehTypeCompDescr] = min(vehTypeFrags.get(vehTypeCompDescr, 0) + 1, 60001)
        if vehTypeCompDescr in vehicles8p:
            frags8p += 1
        for tag, record in (('beast', 'fragsBeast'), ('sinai', 'fragsSinai'), ('patton', 'fragsPatton')):
            if vehTypeCompDescr in vehiclesByTag[tag]:
                killsByTag[record] = killsByTag.get(record, 0) + 1

    if killsByTag:
        achievements = dossierDescr['achievements']
        for record, frags in killsByTag.iteritems():
            achievements[record] += frags

    return frags8p
コード例 #17
0
 def __getDisabledStatusBlock(self):
     nationID = nations.INDICES.get(self.__nationName)
     align = BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER
     if helper.isAllCollectionPurchased(nationID):
         block = formatters.packAlignedTextBlockData(
             text=text_styles.middleTitle(
                 backport.text(R.strings.tooltips.collectibleVehicleTooltip.
                               status.purchased())),
             align=align)
     else:
         maxUnlockedLevel = self.__itemsCache.items.stats.getMaxResearchedLevelByNations(
         ).get(nationID, MIN_VEHICLE_LEVEL)
         vehicleLevels = getCache()['collectorVehiclesLevelsByNations'].get(
             nationID, set())
         if not vehicleLevels:
             raise SoftException(
                 'There are not collectible vehicles in the nation tree of {}'
                 .format(self.__nationName))
         if min(vehicleLevels) <= maxUnlockedLevel:
             header = R.strings.tooltips.collectibleVehicleTooltip.status.purchaseAvailable(
             )
             text = R.strings.tooltips.collectibleVehicleTooltip.status.condition(
             )
             styleGetter = text_styles.middleTitle
         else:
             header = R.strings.tooltips.collectibleVehicleTooltip.status.purchaseUnavailable(
             )
             text = R.strings.tooltips.collectibleVehicleTooltip.status.condition(
             )
             styleGetter = text_styles.statusAttention
         block = formatters.packAlignedTextBlockData(
             text=text_styles.concatStylesToMultiLine(
                 styleGetter(backport.text(header)),
                 text_styles.main(backport.text(text))),
             align=BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER)
     return formatters.packBuildUpBlockData(
         blocks=[block], padding=formatters.packPadding(top=5))
コード例 #18
0
ファイル: dependencies.py プロジェクト: webiumsk/WOT-0.9.15.1
def _set_VEH_TYPE_FRAGS_DEPENDENCIES():
    global VEH_TYPE_FRAGS_DEPENDENCIES
    cache = getCache()
    VEH_TYPE_FRAGS_DEPENDENCIES.update({cache['mausTypeCompDescr']: [_updateMousebane],
     '_insert_': [_updateTankExpert]})