Esempio n. 1
0
 def getDisplayableData(self, controlID):
     if i18n.doesTextExist('#settings:%s/name'):
         name = i18n.makeString('#settings:%s/name' % controlID)
     else:
         name = i18n.makeString('#settings:%s' % controlID)
     warning = ''
     if i18n.doesTextExist('#settings:%s/warning'):
         warning = i18n.makeString('#settings:%s/warning' % controlID)
     return {'name': name,
      'descr': i18n.makeString('#settings:%s/description' % controlID),
      'recommended': '',
      'status': {'level': 'warning',
                 'text': warning}}
Esempio n. 2
0
 def _getStateText(self, state):
     if not doesTextExist(state):
         return ''
     stateStr = makeString(state)
     if stateStr:
         stateStr = makeHtmlString('html_templates:lobby/clans', 'inviteState', {'state': stateStr})
     return stateStr
Esempio n. 3
0
    def __init__(self, ctx):
        self.__cache = []
        self.__isEpic = ctx.get('isEpic', False)
        for arenaTypeID, arenaType in ArenaType.g_cache.iteritems():
            if arenaType.explicitRequestOnly or not gameplay_ctx.isCreationEnabled(arenaType.gameplayName, self.__isEpic):
                continue
            try:
                nameSuffix = ''
                if arenaType.gameplayName != 'ctf':
                    arenaGameplayName = '#arenas:type/%s/%s/name' % (arenaType.gameplayName, arenaType.geometryName)
                    if i18n.doesTextExist(arenaGameplayName):
                        nameSuffix = i18n.makeString(arenaGameplayName)
                    else:
                        nameSuffix = i18n.makeString('#arenas:type/%s/name' % arenaType.gameplayName)
                self.__cache.append({'label': '%s - %s' % (arenaType.name, nameSuffix) if nameSuffix else arenaType.name,
                 'name': arenaType.name,
                 'arenaType': nameSuffix,
                 'key': arenaTypeID,
                 'size': arenaType.maxPlayersInTeam,
                 'time': arenaType.roundLength / 60,
                 'description': '',
                 'icon': formatters.getMapIconPath(arenaType)})
            except Exception:
                LOG_ERROR('There is error while reading arenas cache', arenaTypeID, arenaType)
                LOG_CURRENT_EXCEPTION()
                continue

        self.__cache = sorted(self.__cache, key=lambda x: (x['label'].lower(), x['name'].lower()))
Esempio n. 4
0
 def _errorHandler(self, code, errStr='', ctx=None):
     if len(errStr) and i18n.doesTextExist(
             '#system_messages:premium/%s' % errStr):
         return makeI18nError('premium/%s' % errStr,
                              period=self.period,
                              auxData={'errStr': errStr})
     return makeI18nError('premium/server_error',
                          period=self.period,
                          auxData={'errStr': errStr})
Esempio n. 5
0
 def getState(self, invite):
     stateString = getInviteStatusString(invite.getStatus())
     key = '#invites:clubs/state/%s' % stateString
     if not doesTextExist(key):
         return ''
     state = makeString(key)
     if state:
         state = makeHtmlString('html_templates:lobby/clubs', 'inviteState', {'state': state})
     return state
Esempio n. 6
0
 def getState(self, invite):
     stateString = getInviteStatusString(invite.getStatus())
     key = '#invites:clubs/state/%s' % stateString
     if not doesTextExist(key):
         return ''
     state = makeString(key)
     if state:
         state = makeHtmlString('html_templates:lobby/clubs', 'inviteState', {'state': state})
     return state
Esempio n. 7
0
def getRequestErrorMsg(result, ctx):
    msgKey = (ctx.getRequestType(), result.code)
    if msgKey in _CUSTOM_ERR_MESSAGES:
        errorMsg = _CUSTOM_ERR_MESSAGES[msgKey]
    else:
        errorMsg = result.errStr
    key = ERROR_SYS_MSG_TPL % errorMsg
    if doesTextExist(key):
        return makeString(key)
    return ''
Esempio n. 8
0
 def _getStateText(self, state, isWarning):
     if not doesTextExist(state):
         return ''
     stateStr = makeString(state)
     if stateStr:
         if isWarning:
             stateStr = '<br/><br/>%s' % alert_text_style(stateStr)
         else:
             stateStr = '<br/><br/>%s' % standard_text_style(stateStr)
     return stateStr
Esempio n. 9
0
def getRequestErrorMsg(result, ctx):
    msgKey = (ctx.getRequestType(), result.code)
    if msgKey in _CUSTOM_ERR_MESSAGES:
        errorMsg = _CUSTOM_ERR_MESSAGES[msgKey]
    else:
        errorMsg = result.errStr
    key = ERROR_SYS_MSG_TPL % errorMsg
    if doesTextExist(key):
        return makeString(key)
    return ''
Esempio n. 10
0
 def _getStateText(self, state, isWarning):
     if not doesTextExist(state):
         return ''
     stateStr = makeString(state)
     if stateStr:
         if isWarning:
             stateStr = '<br/><br/>%s' % alert_text_style(stateStr)
         else:
             stateStr = '<br/><br/>%s' % standard_text_style(stateStr)
     return stateStr
Esempio n. 11
0
    def _getDescription(self, condition):
        camos = []
        for camo in condition.getCamos2ids():
            camoI18key = '#quests:details/conditions/clanKills/camo/%s' % str(camo)
            if i18n.doesTextExist(camoI18key):
                camos.append(i18n.makeString(camoI18key))

        i18nKey = '#quests:details/conditions/clanKills'
        if condition.isNegative():
            i18nKey = '%s/not' % i18nKey
        return packDescriptionField(i18n.makeString(i18nKey, camos=', '.join(camos)))
Esempio n. 12
0
def makeStatValue(field, value):
    tooltip = ''
    tooltipHeader = _STATS_INFOTIP_HEADER_FORMAT.format(field)
    if i18n.doesTextExist(tooltipHeader):
        tooltip = makeTooltip(
            header=i18n.makeString(tooltipHeader),
            body=i18n.makeString(
                BATTLE_RESULTS.getTeamStatsInfotipBody(statName=field)))
    return {
        'label':
        i18n.makeString(BATTLE_RESULTS.getTeamStatsLabel(statName=field)),
        'value': value,
        'infoTooltip': tooltip
    }
Esempio n. 13
0
 def _getValue(self):
     tile = self._tooltip.item
     level = Vehicle.VEHICLE_STATE_LEVEL.WARNING
     if tile.isCompleted():
         status, level = 'completed', Vehicle.VEHICLE_STATE_LEVEL.INFO
     elif tile.isInProgress():
         status = 'inProgress'
     elif tile.isUnlocked():
         status = 'available'
     else:
         status = 'lock'
     textKey = '#tooltips:privateQuests/status/{0}/{1}'.format(status, 'descr')
     return {'header': i18n.makeString('#tooltips:privateQuests/status/{0}/{1}'.format(status, 'header')),
      'text': i18n.makeString(textKey) if i18n.doesTextExist(textKey) else None,
      'level': level}
Esempio n. 14
0
 def _getValue(self):
     tile = self._tooltip.item
     level = Vehicle.VEHICLE_STATE_LEVEL.WARNING
     if tile.isCompleted():
         status, level = 'completed', Vehicle.VEHICLE_STATE_LEVEL.INFO
     elif tile.isInProgress():
         status = 'inProgress'
     elif tile.isUnlocked():
         status = 'available'
     else:
         status = 'lock'
     textKey = '#tooltips:privateQuests/status/{0}/{1}'.format(status, 'descr')
     return {'header': i18n.makeString('#tooltips:privateQuests/status/{0}/{1}'.format(status, 'header')),
      'text': i18n.makeString(textKey) if i18n.doesTextExist(textKey) else None,
      'level': level}
Esempio n. 15
0
def getRequestErrorMsg(result, ctx):
    msgReqKey = ctx.getRequestType()
    msgKey = (msgReqKey, result.code)
    if msgKey in _CUSTOM_ERR_MESSAGES:
        errorMsg = _CUSTOM_ERR_MESSAGES[msgKey]
    elif msgReqKey in _CUSTOM_ERR_MESSAGES_BY_REQUEST:
        errorMsg = _CUSTOM_ERR_MESSAGES_BY_REQUEST[msgReqKey]
    else:
        errorMsg = result.txtStr
    msg = ''
    if callable(errorMsg):
        msg = errorMsg(result, ctx)
    else:
        key = ERROR_SYS_MSG_TPL % errorMsg
        if doesTextExist(key):
            msg = makeString(key)
    return msg
Esempio n. 16
0
def getRequestErrorMsg(result, ctx):
    msgReqKey = ctx.getRequestType()
    msgKey = (msgReqKey, result.code)
    if msgKey in _CUSTOM_ERR_MESSAGES:
        errorMsg = _CUSTOM_ERR_MESSAGES[msgKey]
    elif msgReqKey in _CUSTOM_ERR_MESSAGES_BY_REQUEST:
        errorMsg = _CUSTOM_ERR_MESSAGES_BY_REQUEST[msgReqKey]
    else:
        errorMsg = result.errStr
    msg = ''
    if callable(errorMsg):
        msg = errorMsg(result, ctx)
    else:
        key = ERROR_SYS_MSG_TPL % errorMsg
        if doesTextExist(key):
            msg = makeString(key)
    return msg
Esempio n. 17
0
 def _getValue(self):
     tile = self._tooltip.item
     level = Vehicle.VEHICLE_STATE_LEVEL.WARNING
     if tile.isCompleted():
         status, level = "completed", Vehicle.VEHICLE_STATE_LEVEL.INFO
     elif tile.isInProgress():
         status = "inProgress"
     elif tile.isUnlocked():
         status = "available"
     else:
         status = "lock"
     textKey = "#tooltips:privateQuests/status/{0}/{1}".format(status, "descr")
     return {
         "header": i18n.makeString("#tooltips:privateQuests/status/{0}/{1}".format(status, "header")),
         "text": i18n.makeString(textKey) if i18n.doesTextExist(textKey) else None,
         "level": level,
     }
Esempio n. 18
0
    def _format(self, condition, event):
        result = []
        if not event.isGuiDisabled():
            camos = []
            for camo in condition.getCamos2ids():
                camoI18key = '#quests:details/conditions/clanKills/camo/%s' % str(
                    camo)
                if i18n.doesTextExist(camoI18key):
                    camos.append(i18n.makeString(camoI18key))

            i18nKey = '#quests:details/conditions/clanKills'
            if condition.isNegative():
                i18nKey = '%s/not' % i18nKey
            if len(camos):
                result = [
                    formatters.packTextBlock(
                        i18n.makeString(i18nKey, camos=', '.join(camos)))
                ]
        return result
Esempio n. 19
0
 def _errorHandler(self, code, errStr="", ctx=None):
     if len(errStr) and i18n.doesTextExist("#system_messages:premium/%s" % errStr):
         return makeI18nError("premium/%s" % errStr, period=self.period, auxData={"errStr": errStr})
     return makeI18nError("premium/server_error", period=self.period, auxData={"errStr": errStr})
Esempio n. 20
0
 def getNotificationInfo(self):
     notificationKey = '#achievements:%s_notification%d' % (
         self._getActualName(), self._value)
     if i18n.doesTextExist(notificationKey):
         return i18n.makeString(notificationKey)
     return ''
 def getNotificationInfo(self):
     notificationKey = '#achievements:%s_notification%d' % (self._getActualName(), self._value)
     if i18n.doesTextExist(notificationKey):
         return i18n.makeString(notificationKey)
     return ''
Esempio n. 22
0
 def getUserCondition(self):
     condKey = '#achievements:%s_condition' % self._getActualName()
     if i18n.doesTextExist(condKey):
         return i18n.makeString(condKey)
     return ''
Esempio n. 23
0
 def getUserHeroInfo(self):
     heroInfoKey = '#achievements:%s_heroInfo' % self._getActualName()
     if i18n.doesTextExist(heroInfoKey):
         return i18n.makeString(heroInfoKey)
     return ''
Esempio n. 24
0
 def _errorHandler(self, code, errStr = '', ctx = None):
     if len(errStr) and i18n.doesTextExist('#system_messages:premium/%s' % errStr):
         return makeI18nError('premium/%s' % errStr, period=self.period, auxData={'errStr': errStr})
     return makeI18nError('premium/server_error', period=self.period, auxData={'errStr': errStr})
 def getUserCondition(self):
     condKey = '#achievements:%s_condition' % self._getActualName()
     return i18n.makeString(condKey) if i18n.doesTextExist(condKey) else ''
 def getNotificationInfo(self):
     notificationKey = '#achievements:%s_notification' % self._getActualName(
     )
     return i18n.makeString(notificationKey) if i18n.doesTextExist(
         notificationKey) else ''
 def getUserHeroInfo(self):
     heroInfoKey = '#achievements:%s_heroInfo' % self._getActualName()
     return i18n.makeString(heroInfoKey) if i18n.doesTextExist(
         heroInfoKey) else ''
Esempio n. 28
0
 def _getConditionText(self):
     condTextKey = '#achievements:%s_condition_text' % self._getActualName()
     return text_styles.creditsSmall(i18n.makeString(
         condTextKey)) if i18n.doesTextExist(condTextKey) else ''