コード例 #1
0
ファイル: requirements.py プロジェクト: kusaku/wot_scripts
 def format(cls, condition, event, styler):
     labelKey = None
     if condition.getClanIds() is None:
         if condition.isNegative():
             labelKey = 'notInAnyClan'
         else:
             labelKey = 'inAnyClan'
     else:
         clanDBID = cls.itemsCache.items.stats.clanDBID
         if not condition.isNegative():
             if clanDBID:
                 if clanDBID in condition.getClanIds():
                     labelKey = 'forCurrentClan'
                 else:
                     labelKey = 'notForCurrentClan'
             else:
                 labelKey = 'inClan'
         elif clanDBID and clanDBID in condition.getClanIds():
             labelKey = 'notForCurrentClan'
     if labelKey is not None:
         label = ms('#quests:details/requirements/{}'.format(labelKey))
         style = styler(condition.isAvailable())
         return [packText(style(label))]
     else:
         return []
コード例 #2
0
 def format(cls, condition, event, styler):
     relation, value = condition.relation, condition.relationValue
     label = backport.text(
         R.strings.quests.details.requirements.globalRating())
     label = relate(relation, value, label)
     style = styler(condition.isAvailable())
     return [packText(style(label))]
コード例 #3
0
def getSeparatorBlock(groupType=GROUP_TYPE.AND):
    label = getSeparator(groupType)
    if label:
        item = packText(text_styles.standard(label))
        return item
    else:
        return None
コード例 #4
0
ファイル: requirements.py プロジェクト: kusaku/wot_scripts
 def format(cls, condition, event, styler):
     if condition.isPremiumNeeded():
         labelKey = 'premiumAccount'
     else:
         labelKey = 'notPremiumAccount'
     label = ms('#quests:details/requirements/{}'.format(labelKey))
     style = styler(condition.isAvailable())
     return [packText(style(label))]
コード例 #5
0
 def format(cls, condition, event, styler):
     style = styler(condition.isAvailable())
     xpKey = 'receivedMultXp' if condition.getValue(
     ) else 'notReceivedMultXp'
     key = R.strings.quests.details.requirements.vehicle.dyn(xpKey)()
     label = backport.text(key,
                           mult=cls.itemsCache.items.shop.dailyXPFactor)
     return [packText(style(label))]
コード例 #6
0
ファイル: requirements.py プロジェクト: kusaku/wot_scripts
 def format(self, styler):
     style = styler(self._isAvailable)
     result = []
     if self._tokens:
         result = [
             packText(style('#quests:details/requirements/token')),
             packTokens(self._tokens)
         ]
     return result
コード例 #7
0
 def format(cls, condition, event, styler):
     if condition.isPremiumNeeded():
         labelKey = 'premiumPlusAccount'
     else:
         labelKey = 'notPremiumAccount'
     label = backport.text(
         R.strings.quests.details.requirements.dyn(labelKey)())
     style = styler(condition.isAvailable())
     return [packText(style(label))]
コード例 #8
0
ファイル: requirements.py プロジェクト: kusaku/wot_scripts
 def format(cls, condition, event, styler):
     style = styler(condition.isAvailable())
     labelKey = '#quests:details/requirements/{}'.format(
         condition.getName())
     result = []
     if condition.isAnyVehicleAcceptable():
         label = ms('{}/all'.format(labelKey))
         result.append(packText(style(label)))
     elif 'types' not in condition.data:
         _, fnations, flevels, fclasses = condition.parseFilters()
         keys, kwargs = [], {}
         if fnations:
             keys.append('nation')
             names = [nations.NAMES[nationId] for nationId in fnations]
             names = [ms('#menu:nations/{}'.format(name)) for name in names]
             kwargs['nation'] = ', '.join(names)
         if fclasses:
             keys.append('type')
             names = [
                 ms('#menu:classes/{}'.format(name)) for name in fclasses
             ]
             kwargs['type'] = ', '.join(names)
         if flevels:
             keys.append('level')
             names = [int2roman(lvl) for lvl in flevels]
             kwargs['level'] = ', '.join(names)
         labelKey = '{}/{}'.format(labelKey, '_'.join(keys))
         if condition.relationValue is None and condition.isNegative():
             labelKey = '{}/not'.format(labelKey)
         label = ms(labelKey, **kwargs)
         label = relate(condition.relation, condition.relationValue, label)
         result.append(packText(style(label)))
     else:
         if condition.isNegative():
             labelKey = '{}/not'.format(labelKey)
         label = ms(labelKey)
         names = [
             vehicle.userName for vehicle in condition.getVehiclesList()
         ]
         result.append(
             packText(style('{}: {}'.format(label, ', '.join(names)))))
     return result
コード例 #9
0
ファイル: requirements.py プロジェクト: kusaku/wot_scripts
 def format(cls, condition, event, styler):
     style = styler(condition.isAvailable())
     if condition.average:
         titleKey = '#quests:details/requirements/dossierAvgValue'
     else:
         titleKey = '#quests:details/requirements/dossierValue'
     block, record = condition.recordName
     battleMode = cls._dossierBlock2BattleMode(block)
     labelKey = '#quests:details/dossier/{}/{}'.format(battleMode, record)
     label = ms(titleKey, label=ms(labelKey))
     label = relate(condition.relation, condition.relationValue, label)
     return [packText(style(label))]
コード例 #10
0
 def format(cls, condition, event, styler):
     style = styler(condition.isAvailable())
     if condition.average:
         titleKey = R.strings.quests.details.requirements.dossierAvgValue()
     else:
         titleKey = R.strings.quests.details.requirements.dossierValue()
     block, record = condition.recordName
     battleMode = cls._dossierBlock2BattleMode(block)
     labelKey = R.strings.quests.details.dossier.dyn(battleMode).dyn(
         record)()
     label = backport.text(titleKey, label=backport.text(labelKey))
     label = relate(condition.relation, condition.relationValue, label)
     return [packText(style(label))]
コード例 #11
0
 def format(cls, condition, event, styler=reqStyle):
     style = styler(condition.isAvailable())
     result = []
     if event.getType(
     ) not in EVENT_TYPE.LIKE_BATTLE_QUESTS + EVENT_TYPE.LIKE_TOKEN_QUESTS:
         return result
     tokensNeedCount = condition.getNeededCount()
     return [
         packText(
             style(
                 _ms(TOOLTIPS.QUESTS_UNAVAILABLE_TOKEN,
                     tokenName=text_styles.neutral(condition.getUserName()),
                     count=tokensNeedCount)))
     ]
コード例 #12
0
ファイル: requirements.py プロジェクト: kusaku/wot_scripts
 def format(cls, condition, event, styler):
     igrTypes = condition.getIgrTypes()
     if IS_CHINA:
         key = 'igr'
     elif igrTypes.issubset({IGR_TYPE.BASE}):
         key = 'igrBasic'
     elif igrTypes.issubset({IGR_TYPE.PREMIUM}):
         key = 'igrPremium'
     else:
         key = 'igr'
     label = ms('#quests:details/requirements/{}'.format(key))
     style = styler(condition.isAvailable())
     return [
         packText(
             makeHtmlString('html_templates:lobby/quests', 'playInIgr',
                            {'label': style(label)}))
     ]
コード例 #13
0
ファイル: requirements.py プロジェクト: kusaku/wot_scripts
 def format(cls, condition, event, styler):
     style = styler(condition.isAvailable())
     key = '#quests:details/requirements/vehicle/%s' % (
         'receivedMultXp' if condition.getValue() else 'notReceivedMultXp')
     label = ms(key, mult=cls.itemsCache.items.shop.dailyXPFactor)
     return [packText(style(label))]
コード例 #14
0
ファイル: requirements.py プロジェクト: kusaku/wot_scripts
 def format(cls, condition, event, styler):
     relation, value = condition.relation, condition.relationValue
     label = ms('#quests:details/requirements/globalRating')
     label = relate(relation, value, label)
     style = styler(condition.isAvailable())
     return [packText(style(label))]