def getHelpTextAsDicts(arenaType):
    costKill, costFlags = getCosts(arenaType)
    flagsHead = __getText(TEXT_MANAGER_STYLES.NEUTRAL_TEXT, FALLOUT.INFOPANEL_GETFLAGS_HEAD)
    flagsDescr = __getText(TEXT_MANAGER_STYLES.MAIN_TEXT, FALLOUT.INFOPANEL_GETFLAGS_DESCR)
    secretsWinHead = __getText(TEXT_MANAGER_STYLES.NEUTRAL_TEXT, FALLOUT.INFOPANEL_SECRETWIN_HEAD)
    formatter = BigWorld.wg_getNiceNumberFormat
    scorePatterns = []
    if costKill > 0:
        costKillText = makeString(FALLOUT.INFOPANEL_SECRETWIN_DESCR_COST, cost=formatter(costKill))
        secretsWinDescrFirstPrefixStr = TextManager.getText(TEXT_MANAGER_STYLES.STATUS_WARNING_TEXT, costKillText)
        secretsWinDescrFirstStr = __getText(TEXT_MANAGER_STYLES.MAIN_TEXT, FALLOUT.INFOPANEL_SECRETWIN_DESCR_FIRSTSTR)
        scorePatterns.append(secretsWinDescrFirstPrefixStr + secretsWinDescrFirstStr)
    if costFlags:
        costFlagTextPatterns = []
        for c in costFlags:
            costFlagTextPatterns.append(TextManager.getText(TEXT_MANAGER_STYLES.STATUS_WARNING_TEXT, makeString(FALLOUT.INFOPANEL_SECRETWIN_DESCR_COST, cost=formatter(c))))

        secretsWinJoinPattern = TextManager.getText(TEXT_MANAGER_STYLES.MAIN_TEXT, ', ')
        secretsWinDescrSecondPrefixStr = secretsWinJoinPattern.join(costFlagTextPatterns)
        secretsWinDescrSecondStr = __getText(TEXT_MANAGER_STYLES.MAIN_TEXT, FALLOUT.INFOPANEL_SECRETWIN_DESCR_SECONDSTR)
        scorePatterns.append(secretsWinDescrSecondPrefixStr + secretsWinDescrSecondStr)
    joinPattern = TextManager.getText(TEXT_MANAGER_STYLES.MAIN_TEXT, ';\n')
    secretsWinDescr = __getText(TEXT_MANAGER_STYLES.MAIN_TEXT, FALLOUT.INFOPANEL_SECRETWIN_DESCR) % {'scorePattern': joinPattern.join(scorePatterns)}
    repairHead = __getText(TEXT_MANAGER_STYLES.NEUTRAL_TEXT, FALLOUT.INFOPANEL_REPAIR_HEAD)
    repairDescr = __getText(TEXT_MANAGER_STYLES.MAIN_TEXT, FALLOUT.INFOPANEL_REPAIR_DESCR)
    garageHead = __getText(TEXT_MANAGER_STYLES.NEUTRAL_TEXT, FALLOUT.INFOPANEL_GARAGE_HEAD)
    garageDescr = __getText(TEXT_MANAGER_STYLES.MAIN_TEXT, FALLOUT.INFOPANEL_GARAGE_DESCR)
    return [{'head': flagsHead,
      'descr': flagsDescr},
     {'head': secretsWinHead,
      'descr': secretsWinDescr},
     {'head': repairHead,
      'descr': repairDescr},
     {'head': garageHead,
      'descr': garageDescr}]
Beispiel #2
0
def makeBuildingIndicatorsVO(buildingLevel, progress, hpVal, hpTotalVal, defResVal, maxDefResVal):
    textStyle = TextType.DEFRES_TEXT
    if progress == FORT_ALIAS.STATE_FOUNDATION_DEF or progress == FORT_ALIAS.STATE_FOUNDATION:
        textStyle = TextType.ALERT_TEXT
    formattedHpValue = TextManager.reference().getText(textStyle, str(BigWorld.wg_getIntegralFormat(hpVal)))
    hpTotalFormatted = str(BigWorld.wg_getIntegralFormat(hpTotalVal)) + ' '
    formattedHpTotal = TextManager.reference().concatStyles(((TextType.STANDARD_TEXT, hpTotalFormatted), (TextIcons.NUT_ICON,)))
    formattedDefResValue = TextManager.reference().getText(TextType.DEFRES_TEXT, str(BigWorld.wg_getIntegralFormat(defResVal)))
    maxDefDerFormatted = str(BigWorld.wg_getIntegralFormat(maxDefResVal)) + ' '
    formattedDefResTotal = TextManager.reference().concatStyles(((TextType.STANDARD_TEXT, maxDefDerFormatted), (TextIcons.NUT_ICON,)))
    hpProgressLabels = {'currentValue': formattedHpValue,
     'totalValue': formattedHpTotal,
     'separator': '/'}
    storeProgressLabels = {'currentValue': formattedDefResValue,
     'totalValue': formattedDefResTotal,
     'separator': '/'}
    result = {'hpLabel': i18n.makeString(FORTIFICATIONS.BUILDINGPOPOVER_INDICATORS_HPLBL),
     'defResLabel': i18n.makeString(FORTIFICATIONS.BUILDINGPOPOVER_INDICATORS_DEFRESLBL),
     'hpCurrentValue': hpVal,
     'hpTotalValue': hpTotalVal,
     'defResCurrentValue': defResVal,
     'defResTotalValue': maxDefResVal,
     'hpProgressLabels': hpProgressLabels,
     'defResProgressLabels': storeProgressLabels}
    return result
def getDefRes(value, addIcon = True):
    valueStr = BigWorld.wg_getIntegralFormat(value)
    text = TextManager.reference().getText(TEXT_MANAGER_STYLES.DEFRES_TEXT, valueStr)
    if addIcon:
        icon = TextManager.reference().getIcon(TextIcons.NUT_ICON)
        return text + ' ' + icon
    else:
        return text
Beispiel #4
0
 def __checkMoney(self):
     changeRoleCost = self.__items.shop.changeRoleCost
     formattedPrice = BigWorld.wg_getIntegralFormat(changeRoleCost)
     actualGold = self.__items.stats.gold
     enoughGold = actualGold - changeRoleCost >= 0
     textType = TextType.GOLD_TEXT if enoughGold else TextType.ERROR_TEXT
     priceString = TextManager.getText(textType, formattedPrice)
     priceString += TextManager.getIcon(TextIcons.GOLD)
     self.as_setPriceS(priceString, enoughGold)
Beispiel #5
0
 def _makeMeta(self):
     item = g_itemsCache.items.getItemByCD(self._unlockCtx.unlockCD)
     xpCost = BigWorld.wg_getIntegralFormat(self._costCtx['xpCost'])
     freeXp = BigWorld.wg_getIntegralFormat(self._costCtx['freeXP'])
     ctx = {'xpCost': TextManager.getText(TextType.EXP_TEXT, xpCost),
      'freeXP': TextManager.getText(TextType.EXP_TEXT, freeXp),
      'typeString': item.userType,
      'userString': item.userName}
     if item.itemTypeID == GUI_ITEM_TYPE.VEHICLE:
         key = 'confirmUnlockVehicle'
     else:
         key = 'confirmUnlockItem'
     return dialogs.I18nConfirmDialogMeta('confirmUnlock', meta=dialogs.HtmlMessageLocalDialogMeta('html_templates:lobby/dialogs', key, ctx=ctx))
def getRentLeftTimeStr(localization, rentLeftTime, timeStyle = None, ctx = None):
    if ctx is None:
        ctx = {}
    if rentLeftTime > 0:
        if rentLeftTime > time_utils.ONE_DAY:
            timeLeft = str(int(math.ceil(float(rentLeftTime) / time_utils.ONE_DAY)))
            if timeStyle:
                timeLeft = TextManager.getText(timeStyle, timeLeft)
            return i18n.makeString((localization % 'days'), days=timeLeft, **ctx)
        else:
            timeLeft = str(int(math.ceil(float(rentLeftTime) / time_utils.ONE_HOUR)))
            if timeStyle:
                timeLeft = TextManager.getText(timeStyle, timeLeft)
            return i18n.makeString((localization % 'hours'), hours=timeLeft, **ctx)
    return ''
Beispiel #7
0
 def __getActionButtonStateVO(self):
     stateString = ''
     unitFunctional = self.unitFunctional
     pInfo = unitFunctional.getPlayerInfo()
     isInQueue = unitFunctional.getFlags().isInIdle()
     isEnabled = g_currentVehicle.isReadyToPrebattle() and not isInQueue
     playerReady = pInfo.isReady
     if not g_currentVehicle.isPresent():
         stateString = i18n.makeString('#cybersport:window/unit/message/vehicleNotSelected')
     elif not g_currentVehicle.isReadyToPrebattle():
         stateString = i18n.makeString('#cybersport:window/unit/message/vehicleNotValid')
     elif not playerReady:
         stateString = i18n.makeString(MESSENGER.DIALOGS_SQUAD_MESSAGE_GETREADY)
     elif g_eventsCache.isEventEnabled() and self.__isFallout is not None and self.__isFallout != g_currentVehicle.item.isEvent:
         stateString = error(MENU.CURRENTVEHICLESTATUS_NOTVALIDVEHICLE)
     elif playerReady and not isInQueue:
         stateString = i18n.makeString(MESSENGER.DIALOGS_SQUAD_MESSAGE_GETNOTREADY)
     stateString = TextManager.getText(TEXT_MANAGER_STYLES.MAIN_TEXT if isEnabled else TEXT_MANAGER_STYLES.ERROR_TEXT, stateString)
     if playerReady:
         label = CYBERSPORT.WINDOW_UNIT_NOTREADY
     else:
         label = CYBERSPORT.WINDOW_UNIT_READY
     return {'stateString': stateString,
      'label': label,
      'isEnabled': isEnabled,
      'isReady': playerReady}
 def __makeMainVO(self):
     result = {}
     extra = self.unitFunctional.getExtra()
     (_, _, arenaTypeID), _ = self.__currentBuilding
     _getText = self.app.utilsManager.textManager.getText
     unitPermissions = self.unitFunctional.getPermissions()
     activeConsumes = extra.getConsumables()
     result['mapID'] = arenaTypeID
     arenaType = ArenaType.g_cache.get(arenaTypeID)
     canUseEquipments = self.__battle.itemData.canUseEquipments
     if arenaType is not None:
         mapName = _getText(TEXT_MANAGER_STYLES.MAIN_TEXT, arenaType.name)
     else:
         mapName = ''
     infoIcon = self.app.utilsManager.textManager.getIcon(TextIcons.INFO_ICON)
     result['headerDescr'] = _getText(TEXT_MANAGER_STYLES.STANDARD_TEXT, i18n.makeString(FORTIFICATIONS.FORTCLANBATTLEROOM_HEADER_MAPTITLE, mapName=mapName) + ' ' + infoIcon)
     result['isOrdersBgVisible'] = bool(not unitPermissions.canChangeConsumables() and len(activeConsumes) and not canUseEquipments)
     result['mineClanName'] = g_clanCache.clanTag
     _, enemyClanAbbev, _ = self.__battle.getOpponentClanInfo()
     result['enemyClanName'] = '[%s]' % enemyClanAbbev
     if not canUseEquipments and unitPermissions.canChangeConsumables():
         result['ordersDisabledMessage'] = TextManager.getIcon(TextIcons.ALERT_ICON) + ' ' + TextManager.getText(TEXT_MANAGER_STYLES.ALERT_TEXT, i18n.makeString(FORTIFICATIONS.FORTCLANBATTLEROOM_HEADER_ORDERSDISABLED))
         result['ordersDisabledTooltip'] = TOOLTIPS.FORTIFICATION_FORTCLANBATTLEROOM_ORDERSDISABLED_DIVISIONMISMATCH
     self.as_setBattleRoomDataS(result)
     return
 def __getTransportingBuildTooltipData(self, building):
     state = None
     headerArgs = {}
     bodyArgs = {}
     if building is not None:
         buildingName = building.userName
         if building.isInCooldown():
             state = 'cooldown'
             timeStr = TextManager.reference().getTimeDurationStr(building.getEstimatedCooldown())
             headerArgs = {'buildingName': buildingName}
             bodyArgs = {'time': timeStr}
         elif not building.hasStorageToExport():
             state = 'emptyStorage'
             headerArgs = {'buildingName': buildingName}
         elif not building.hasSpaceToImport() and self.isOnNextTransportingStep():
             state = 'notEmptySpace'
             headerArgs = {'buildingName': buildingName}
         elif not building.isReady():
             state = 'foundation'
     else:
         state = 'foundation'
     if state == 'foundation':
         headerArgs = {'buildingName': i18n.makeString(FORTIFICATIONS.BUILDINGS_TROWELLABEL)}
     if state is not None:
         header = TOOLTIPS.fortification_transporting(state + '/header')
         body = TOOLTIPS.fortification_transporting(state + '/body')
         return [i18n.makeString(header, **headerArgs), i18n.makeString(body, **bodyArgs)]
     else:
         return
         return
Beispiel #10
0
def makeSimpleClanListRenderVO(member, intTotalMining, intWeekMining, role, roleID):
    week = BigWorld.wg_getIntegralFormat(intWeekMining)
    week = TextManager.reference().getText(TextType.DEFRES_TEXT, week)
    allTime = BigWorld.wg_getIntegralFormat(intTotalMining)
    allTime = TextManager.reference().getText(TextType.DEFRES_TEXT, allTime)
    databaseID = member.getID()
    return {'dbID': databaseID,
     'uid': databaseID,
     'himself': bool(BigWorld.player().databaseID == databaseID),
     'userName': member.getName(),
     'playerRole': role,
     'playerRoleID': roleID,
     'thisWeek': week,
     'allTime': allTime,
     'intWeekMining': intWeekMining,
     'intTotalMining': intTotalMining,
     'fullName': member.getFullName()}
Beispiel #11
0
 def getBuildingTooltipBody(self, hpVal, maxHpValue, defResVal, maxDefResValue):
     nutIcon = ' ' + TextManager.reference().getIcon(TextIcons.NUT_ICON)
     labelOne = i18n.makeString(FORTIFICATIONS.BUILDINGS_BUILDINGTOOLTIP_STRENGTH)
     labelTwo = i18n.makeString(FORTIFICATIONS.BUILDINGS_BUILDINGTOOLTIP_STORE)
     fstLine = labelOne + self.__toFormattedStr(hpVal) + '/' + self.__toFormattedStr(maxHpValue) + nutIcon
     secLine = labelTwo + self.__toFormattedStr(defResVal) + '/' + self.__toFormattedStr(maxDefResValue) + nutIcon
     toolTipData = fstLine + secLine
     return toolTipData
Beispiel #12
0
    def getList(self):
        result = []
        for item in self.getCustomizations():
            itemType = item.get('custType')
            itemId = item.get('id', (-1, -1))
            boundVehicle = item.get('vehTypeCompDescr', None)
            boundToCurrentVehicle = item.get('boundToCurrentVehicle', False)
            nationId = 0
            texture = ''
            res = ''
            if itemType == CUSTOMIZATION_ITEM_TYPE.CAMOUFLAGE_TYPE:
                customization = vehicles.g_cache.customization(itemId[0])
                camouflages = customization.get('camouflages', {})
                camouflage = camouflages.get(itemId[1], None)
                if camouflage:
                    armorColor = customization.get('armorColor', 0)
                    texture = self._makeTextureUrl(67, 67, camouflage.get('texture'), camouflage.get('colors', (0, 0, 0, 0)), armorColor)
                    nationId, itemId = itemId
            elif itemType == CUSTOMIZATION_ITEM_TYPE.EMBLEM_TYPE:
                _, emblems, _ = vehicles.g_cache.playerEmblems()
                emblem = emblems.get(itemId, None)
                if emblem:
                    texture = emblem[2]
                    res = {'id': itemId,
                     'type': CUSTOMIZATION_ITEM_TYPE.EMBLEM,
                     'nationId': 0,
                     'texture': texture}
            elif itemType == CUSTOMIZATION_ITEM_TYPE.INSCRIPTION_TYPE:
                customization = vehicles.g_cache.customization(itemId[0])
                inscriptions = customization.get(CUSTOMIZATION_ITEM_TYPE.INSCRIPTION_TYPE, {})
                inscription = inscriptions.get(itemId[1], None)
                if inscription:
                    texture = inscription[2]
                    nationId, itemId = itemId
            if texture.startswith('gui'):
                texture = texture.replace('gui', '..', 1)
            isPermanent = item.get('isPermanent', False)
            value = item.get('value', 0)
            valueStr = None
            if not isPermanent:
                value *= 86400
            elif value > 1:
                valueStr = TextManager.getText(message=i18n.makeString(QUESTS.BONUSES_CUSTOMIZATION_VALUE, count=value))
            res = {'id': itemId,
             'type': CUSTOMIZATION_ITEM_TYPE.CI_TYPES.index(itemType),
             'nationId': nationId,
             'texture': texture,
             'isPermanent': isPermanent,
             'value': value,
             'valueStr': valueStr,
             'boundVehicle': boundVehicle,
             'boundToCurrentVehicle': boundToCurrentVehicle}
            result.append(res)

        return result
 def __updateHeader(self):
     isCreator = self.unitFunctional.getPlayerInfo().isCreator() if self.unitFunctional is not None else False
     club = self.clubsCtrl.getClub(self.__clubDBID)
     hasRankForModeChange = club is not None and club.getPermissions().canSetRanked()
     seasonActive = isSeasonInProgress()
     modeLabel = ''
     modeTooltip = ''
     modeTextStyle = TEXT_MANAGER_STYLES.STANDARD_TEXT
     if not seasonActive:
         modeLabel = CYBERSPORT.STATICFORMATION_UNITVIEW_MODECHANGEWARNING_NOSEASON
         modeTooltip = CYBERSPORT.STATICFORMATION_UNITVIEW_MODECHANGEWARNING_NOSEASONTOOLTIP
     elif isCreator:
         if not hasRankForModeChange:
             modeLabel = CYBERSPORT.STATICFORMATION_UNITVIEW_MODECHANGEWARNING_LOWRANK
             modeTooltip = CYBERSPORT.STATICFORMATION_UNITVIEW_MODECHANGEWARNING_LOWRANKTOOLTIP
         elif self.__extra.isRatedBattle:
             modeLabel = CYBERSPORT.STATICFORMATION_UNITVIEW_SETUNRANKEDMODE
         else:
             modeLabel = CYBERSPORT.STATICFORMATION_UNITVIEW_SETRANKEDMODE
     elif self.__extra.isRatedBattle:
         modeLabel = CYBERSPORT.STATICFORMATION_UNITVIEW_RANKEDMODE
         modeTextStyle = TEXT_MANAGER_STYLES.NEUTRAL_TEXT
     else:
         modeLabel = CYBERSPORT.STATICFORMATION_UNITVIEW_MODECHANGEWARNING_WRONGROLE
         modeTooltip = CYBERSPORT.STATICFORMATION_UNITVIEW_MODECHANGEWARNING_WRONGROLETOOLTIP
     bgSource = RES_ICONS.MAPS_ICONS_LIBRARY_CYBERSPORT_LEAGUERIBBONS_UNRANKED
     battles = self.ABSENT_VALUES
     winRate = self.ABSENT_VALUES
     leagueIcon = getLadderChevron64x64()
     enableWinRateTF = False
     if club is not None:
         clubTotalStats = club.getTotalDossier().getTotalStats()
         battles = BigWorld.wg_getNiceNumberFormat(clubTotalStats.getBattlesCount())
         division = club.getLadderInfo().division
         leagueIcon = getLadderChevron64x64(division)
         winRateValue = ProfileUtils.getValueOrUnavailable(clubTotalStats.getWinsEfficiency())
         if winRateValue != ProfileUtils.UNAVAILABLE_VALUE:
             enableWinRateTF = True
             winRate = ProfileUtils.formatFloatPercent(winRateValue)
         else:
             winRate = self.ABSENT_VALUES
         if self.__extra.isRatedBattle:
             bgSource = getLadderBackground(division)
         self.requestClubEmblem64x64(club.getClubDbID(), club.getEmblem64x64())
     self.as_setHeaderDataS({'teamName': self.__extra.clubName,
      'isRankedMode': bool(self.__extra.isRatedBattle),
      'battles': battles,
      'winRate': winRate,
      'enableWinRateTF': enableWinRateTF,
      'leagueIcon': leagueIcon,
      'isFixedMode': not seasonActive or not isCreator,
      'modeLabel': TextManager.getText(modeTextStyle, _ms(modeLabel)),
      'modeTooltip': modeTooltip,
      'bgSource': bgSource})
     return
Beispiel #14
0
 def getHangarMessage(self):
     if self.isPresent():
         state, stateLvl = self.item.getState()
         if state == Vehicle.VEHICLE_STATE.IN_PREMIUM_IGR_ONLY:
             localization = '#menu:vehicle/igrRentLeft/%s'
             rentLeftStr = getRentLeftTimeStr(localization, self.item.rentLeftTime)
             icon = TextManager.getIcon(TextIcons.PREMIUM_IGR_BIG)
             message = i18n.makeString('#menu:currentVehicleStatus/' + state, icon=icon, time=rentLeftStr)
             return (state, message, stateLvl)
         return (state, '#menu:currentVehicleStatus/' + state, stateLvl)
     return ('notpresent', MENU.CURRENTVEHICLESTATUS_NOTPRESENT, Vehicle.VEHICLE_STATE_LEVEL.CRITICAL)
Beispiel #15
0
    def __reSubHandler(cls, match):
        try:
            arenaUniqueID, arenaTypeID, vehTypeCompDescr, xp, _ = unpackPostBattleUniqueSubUrl(match.group(3))
            return g_settings.htmlTemplates.format('postBattleSharingLink', {'linkCode': pickle.dumps((arenaUniqueID, match.group(2))),
             'arena': functions.getArenaShortName(arenaTypeID),
             'vehicle': Vehicle(typeCompDescr=vehTypeCompDescr).shortUserName,
             'xp': BigWorld.wg_getIntegralFormat(xp),
             'arrowButton': TextManager.getIcon(TextIcons.ARROW_BUTTON)})
        except:
            LOG_DEBUG('Invalid post battle results in message', match)
            LOG_CURRENT_EXCEPTION()

        return match.group()
 def __getExchangeBlockData(self, resToExchange):
     goldStepperTitleStr = i18n.makeString(DIALOGS.CONFIRMEXCHANGEDIALOG_GOLDITEMSSTEPPERTITLE)
     goldStepperTitleFmt = TextManager.getText(TEXT_MANAGER_STYLES.MAIN_TEXT, goldStepperTitleStr)
     return {'exchangeRateItemsIcon': self._getExchangeRateItemsIcon(),
      'goldStepperTitle': goldStepperTitleFmt,
      'needItemsIcon': self._getCurrencyIconPath(),
      'needItemsStepperTitle': self._getResourceStepperTxt(),
      'goldIcon': RES_ICONS.MAPS_ICONS_LIBRARY_GOLDICON_2,
      'defaultExchangeRate': self._getDefaultExchangeRate(),
      'exchangeRate': self.getExchangeRate(),
      'defaultGoldValue': self.__getGoldToExchange(resToExchange),
      'goldStepSize': self._getStepSize(),
      'maxGoldValue': self._getMaxExchangeValue(),
      'goldTextColorId': TEXT_MANAGER_STYLES.GOLD_TEXT,
      'itemsTextColorId': self._getColorScheme()}
Beispiel #17
0
def makeSortieShortVO(unitFunctional, unitIdx = None, app = None):
    fullData = unitFunctional.getUnitFullData(unitIdx=unitIdx)
    if fullData is None:
        textMgr = TextManager.reference()
        title = i18n.makeString(FORTIFICATIONS.SORTIE_LISTVIEW_ALERTTEXT_TITLE)
        body = i18n.makeString(FORTIFICATIONS.SORTIE_LISTVIEW_ALERTTEXT_BODY)
        alertView = {'icon': RES_ICONS.MAPS_ICONS_LIBRARY_ALERTICON,
         'titleMsg': textMgr.getText(TextType.ALERT_TEXT, title),
         'bodyMsg': textMgr.getText(TextType.MAIN_TEXT, body),
         'buttonLbl': FORTIFICATIONS.SORTIE_LISTVIEW_ENTERBTN}
        return {'isShowAlertView': True,
         'alertView': alertView}
    (unit, unitState, unitStats, pInfo, slotsIter,) = fullData
    division = getDivisionNameByType(unit.getRosterTypeID())
    divisionTypeStr = i18n.makeString(FORTIFICATIONS.sortie_division_name(division))
    (unit, unitState, _, pInfo, slotsIter,) = fullData
    return {'isFreezed': unitState.isLocked(),
     'hasRestrictions': unit.isRosterSet(ignored=settings.CREATOR_ROSTER_SLOT_INDEXES),
     'slots': _getSlotsData(unitIdx, unit, unitState, pInfo, slotsIter, app, unitFunctional.getRosterSettings().getLevelsRange()),
     'description': divisionTypeStr if divisionTypeStr else unitFunctional.getCensoredComment(unitIdx=unitIdx)}
 def makeVO(self):
     item = self._items.getItemByCD(self.getTypeCompDescr())
     resToExchange = self._getResourceToExchange()
     extraData = None
     if item.itemTypeID == GUI_ITEM_TYPE.GUN and item.isClipGun():
         extraData = CLIP_ICON_PATH
     state, stateMsg = self.__getState(resToExchange)
     return {'title': self.getTitle(),
      'exchangeBtnText': self.getButtonLabels()[0]['label'],
      'cancelBtnText': self.getButtonLabels()[1]['label'],
      'state': state,
      'lockExchangeMessage': stateMsg,
      'iconExtraInfo': extraData,
      'iconModuleType': item.itemTypeName,
      'icon': self.__getIcon(item) if self.__getIconType(item) == CONFIRM_EXCHANGE_DIALOG_TYPES.VEHICLE_ICON else item.getGUIEmblemID(),
      'iconType': self.__getIconType(item),
      'itemName': TextManager.getText(TEXT_MANAGER_STYLES.MIDDLE_TITLE, item.userName),
      'needItemsText': self.__getResourceToExchangeTxt(resToExchange),
      'needGoldText': self.__getGoldToExchangeTxt(resToExchange),
      'exchangeBlockData': self.__getExchangeBlockData(resToExchange)}
Beispiel #19
0
def getComplexStatus(statusKey):
    try:
        if not statusKey:
            return (None, None)
        headerKey = statusKey + '/header'
        textKey = statusKey + '/text'
        header = makeString(headerKey)
        text = makeString(textKey)
        if headerKey == TOOLTIPS.VEHICLESTATUS_INPREMIUMIGRONLY_HEADER:
            icon = TextManager.getIcon(TextIcons.PREMIUM_IGR_SMALL)
            header = makeString(headerKey, icon=icon)
        if header == headerKey.split(':', 1)[1]:
            header = None
        if text == textKey.split(':', 1)[1]:
            text = None
        return (header, text)
    except Exception:
        LOG_CURRENT_EXCEPTION()
        return (None, None)

    return
Beispiel #20
0
 def getCommonBuildTooltipData(self, buildingDescr):
     hpVal = 0
     maxHpValue = 0
     defResVal = 0
     maxDefResValue = 0
     orderTooltipData = None
     if buildingDescr is not None:
         hpVal = buildingDescr.hp
         maxHpValue = buildingDescr.levelRef.hp
         defResVal = buildingDescr.storage
         maxDefResValue = buildingDescr.levelRef.storage
         if buildingDescr.orderInProduction:
             if self._isProductionInPause(buildingDescr):
                 orderTooltipData = '\n' + i18n.makeString(TOOLTIPS.FORTIFICATION_ORDERPROCESS_INPAUSE)
             else:
                 order = self.fortCtrl.getFort().getOrder(self.fortCtrl.getFort().getBuildingOrder(buildingDescr.typeID))
                 orderTime = TextManager.reference().getTimeDurationStr(order.getProductionLeftTime())
                 orderTooltipData = i18n.makeString(FORTIFICATIONS.BUILDINGS_BUILDINGTOOLTIP_ORDER, order.productionCount, orderTime)
     toolTipData = self.getBuildingTooltipBody(hpVal, maxHpValue, defResVal, maxDefResValue)
     if orderTooltipData is not None:
         toolTipData += orderTooltipData
     return toolTipData
Beispiel #21
0
def makeSortieVO(unitFunctional, unitIdx = None, app = None):
    fullData = unitFunctional.getUnitFullData(unitIdx=unitIdx)
    if fullData is None:
        return {}
    (unit, unitState, unitStats, pInfo, slotsIter,) = fullData
    division = getDivisionNameByType(unit.getRosterTypeID())
    divisionTypeStr = i18n.makeString(FORTIFICATIONS.sortie_division_name(division))
    divisionStr = i18n.makeString(FORTIFICATIONS.SORTIE_ROOM_DIVISION)
    divisionLbl = TextManager.reference().concatStyles(((TextType.STANDARD_TEXT, divisionStr), (TextType.MAIN_TEXT, divisionTypeStr)))
    isPlayerCreator = pInfo.isCreator()
    (canDoAction, restriction,) = unitFunctional.validateLevels(stats=unitStats)
    sumLevelsStr = makeTotalLevelLabel(unitStats, restriction)
    return {'isCommander': isPlayerCreator,
     'isFreezed': unitState.isLocked(),
     'hasRestrictions': unit.isRosterSet(ignored=settings.CREATOR_ROSTER_SLOT_INDEXES),
     'statusLbl': makeUnitStateLabel(unitState),
     'statusValue': unitState.isOpened(),
     'sumLevelsInt': unitStats.curTotalLevel,
     'sumLevels': sumLevelsStr,
     'sumLevelsError': canDoAction,
     'slots': _getSlotsData(unitIdx, unit, unitState, pInfo, slotsIter, app, unitFunctional.getRosterSettings().getLevelsRange()),
     'description': unitFunctional.getCensoredComment(unitIdx=unitIdx),
     'divisionLbl': divisionLbl}
Beispiel #22
0
 def __init__(self):
     super(UtilsManager, self).__init__()
     self._textMgr = TextManager()
Beispiel #23
0
class UtilsManager(UtilsManagerMeta):
    def __init__(self):
        super(UtilsManager, self).__init__()
        self._textMgr = TextManager()

    def registerTextManager(self, flashObject):
        self._textMgr.setFlashObject(flashObject)

    def destroy(self):
        self.__unregisterMrgs()
        super(UtilsManagerMeta, self).destroy()

    def __unregisterMrgs(self):
        self._textMgr.destroy()
        self._textMgr = None
        return

    @property
    def textManager(self):
        return self._textMgr

    def getGUINations(self):
        return GUI_NATIONS

    def getNationNames(self):
        return nations.NAMES

    def getNationIndices(self):
        return nations.INDICES

    def changeStringCasing(self, s, isUpper, _):
        return utils.changeStringCasing(str(s).decode('utf-8'), isUpper)

    @classmethod
    def getAbsoluteUrl(cls, value):
        return getAbsoluteUrl(value)

    @classmethod
    def getHtmlIconText(cls, properties):
        template = "<img src='{0}' width='{1}' height='{2}' vspace='{3}' hspace='{4}'/>"
        absoluteUrl = cls.getAbsoluteUrl(properties.imageAlias)
        return template.format(properties.imageAlias, properties.width,
                               properties.height, properties.vSpace,
                               properties.hSpace)

    def getFirstDayOfWeek(self):
        return BigWorld.wg_firstDayOfWeek() + 1

    def getWeekDayNames(self, full, isUpper, isLower):
        source = list(MENU.DATETIME_WEEKDAYS_FULL_ENUM if full else MENU.
                      DATETIME_WEEKDAYS_SHORT_ENUM)
        result = []
        for day in calendar.Calendar(
                firstweekday=BigWorld.wg_firstDayOfWeek()).iterweekdays():
            name = i18n.makeString(source[day])
            if isUpper:
                name = self.changeStringCasing(name, True, None)
            elif isLower:
                name = self.changeStringCasing(name, False, None)
            result.append(name)

        return result

    def getMonthsNames(self, full, isUpper, isLower):
        source = list(MENU.DATETIME_MONTHS_FULL_ENUM if full else MENU.
                      DATETIME_MONTHS_SHORT_ENUM)
        result = []
        for key in source:
            name = i18n.makeString(key)
            if isUpper:
                name = self.changeStringCasing(name, True, None)
            elif isLower:
                name = self.changeStringCasing(name, False, None)
            result.append(name)

        return result

    def _dispose(self):
        self._textMgr = None
        super(UtilsManager, self)._dispose()
        return

    def intToStringWithPrefixPatern(self, value, count, fill):
        return ('{0:' + str(fill) + '>' + str(count) + '}').format(value)

    def isTwelveHoursFormat(self):
        return getClientLanguage() == 'en'
Beispiel #24
0
 def __init__(self):
     super(UtilsManager, self).__init__()
     self._textMgr = TextManager()
Beispiel #25
0
class UtilsManager(UtilsManagerMeta):

    def __init__(self):
        super(UtilsManager, self).__init__()
        self._textMgr = TextManager()

    def registerTextManager(self, flashObject):
        self._textMgr.setFlashObject(flashObject)

    def _populate(self):
        super(UtilsManager, self)._populate()
        settings = GUI_SETTINGS.imageCache
        self.as_setImageCacheSettingsS(settings['maxSize'], settings['minSize'])

    def destroy(self):
        self.__unregisterMrgs()
        super(UtilsManagerMeta, self).destroy()

    def __unregisterMrgs(self):
        self._textMgr.destroy()
        self._textMgr = None
        return

    @property
    def textManager(self):
        return self._textMgr

    def getGUINations(self):
        return GUI_NATIONS

    def getNationNames(self):
        return nations.NAMES

    def getNationIndices(self):
        return nations.INDICES

    def changeStringCasing(self, s, isUpper, _):
        return utils.changeStringCasing(str(s).decode('utf-8'), isUpper)

    @classmethod
    def getAbsoluteUrl(cls, value):
        return getAbsoluteUrl(value)

    @classmethod
    def getHtmlIconText(cls, properties):
        template = "<img src='{0}' width='{1}' height='{2}' vspace='{3}' hspace='{4}'/>"
        absoluteUrl = cls.getAbsoluteUrl(properties.imageAlias)
        return template.format(properties.imageAlias, properties.width, properties.height, properties.vSpace, properties.hSpace)

    def getFirstDayOfWeek(self):
        return BigWorld.wg_firstDayOfWeek() + 1

    def getWeekDayNames(self, full, isUpper, isLower):
        source = list(MENU.DATETIME_WEEKDAYS_FULL_ENUM if full else MENU.DATETIME_WEEKDAYS_SHORT_ENUM)
        result = []
        for day in calendar.Calendar(firstweekday=BigWorld.wg_firstDayOfWeek()).iterweekdays():
            name = i18n.makeString(source[day])
            if isUpper:
                name = self.changeStringCasing(name, True, None)
            elif isLower:
                name = self.changeStringCasing(name, False, None)
            result.append(name)

        return result

    def getMonthsNames(self, full, isUpper, isLower):
        source = list(MENU.DATETIME_MONTHS_FULL_ENUM if full else MENU.DATETIME_MONTHS_SHORT_ENUM)
        result = []
        for key in source:
            name = i18n.makeString(key)
            if isUpper:
                name = self.changeStringCasing(name, True, None)
            elif isLower:
                name = self.changeStringCasing(name, False, None)
            result.append(name)

        return result

    def _dispose(self):
        self._textMgr = None
        super(UtilsManager, self)._dispose()
        return

    def intToStringWithPrefixPatern(self, value, count, fill):
        return ('{0:' + str(fill) + '>' + str(count) + '}').format(value)

    def isTwelveHoursFormat(self):
        return getClientLanguage() == 'en'
 def _getNotEnoughGoldStateTxt(self, strGold):
     return TextManager.getText(TEXT_MANAGER_STYLES.ERROR_TEXT, self._makeString(I18N_GOLDNOTENOUGHTEXT_KEY.format(self._key), {'gold': strGold}))
 def _getNoNeedExchangeStateTxt(self):
     return TextManager.getText(TEXT_MANAGER_STYLES.SUCCESS_TEXT, self._makeString(I18N_EXCHANGENONEEDTEXT_KEY.format(self._key), {}))
 def _getResourceStepperTxt(self):
     return TextManager.getText(TEXT_MANAGER_STYLES.MAIN_TEXT, self._makeString(I18N_NEEDITEMSSTEPPERTITLE_KEY.format(self._key), {}))
 def _getExchangeTxt(self, strGold):
     return TextManager.getText(TEXT_MANAGER_STYLES.MAIN_TEXT, self._makeString(I18N_NEEDGOLDTEXT_KEY.format(self._key), {'gold': strGold}))
 def _getCurrencyTxt(self, strResource):
     return TextManager.getText(TEXT_MANAGER_STYLES.ERROR_TEXT, self._makeString(I18N_NEEDITEMSTEXT_KEY.format(self._key), {'value': strResource}))
 def _getCurrencyIconStr(self):
     return TextManager.getIcon(TextIcons.FREE_XP)
 def _getCurrencyIconStr(self):
     return TextManager.getIcon(TextIcons.CREDITS)
Beispiel #33
0
class UtilsManager(UtilsManagerMeta):
    def __init__(self):
        super(UtilsManager, self).__init__()
        self._textMgr = TextManager()

    def registerTextManager(self, flashObject):
        self._textMgr.setFlashObject(flashObject)

    def destroy(self):
        self.__unregisterMrgs()
        super(UtilsManagerMeta, self).destroy()

    def __unregisterMrgs(self):
        self._textMgr.destroy()
        self._textMgr = None
        return

    def __isKeyboardKey(self, inKey):
        return inKey > BW_TO_SCALEFORM[Keys.KEY_MOUSE7]

    @property
    def textManager(self):
        return self._textMgr

    def getGUINations(self):
        return GUI_NATIONS

    def getNationNames(self):
        return nations.NAMES

    def mapScaleformToVirtualKey(self, inKey):
        if inKey not in SCALEFORM_TO_BW or not self.__isKeyboardKey(inKey):
            return inKey
        tkey = SCALEFORM_TO_BW[inKey]
        return inKey if tkey == KEY_NONE or not canGetVirtualKey(
            tkey) else BigWorld.mapVirtualKey(tkey,
                                              MappingType.MAPVK_VSC_TO_VK)

    def getCharFromVirtualKey(self, key):
        return BigWorld.mapVirtualKey(key, MappingType.MAPVK_VK_TO_CHAR)

    def getNationIndices(self):
        return nations.INDICES

    def changeStringCasing(self, s, isUpper, _):
        return utils.changeStringCasing(str(s).decode('utf-8'), isUpper)

    @classmethod
    def getAbsoluteUrl(cls, value):
        return getAbsoluteUrl(value)

    @classmethod
    def getHtmlIconText(cls, properties):
        template = "<img src='{0}' width='{1}' height='{2}' vspace='{3}' hspace='{4}'/>"
        absoluteUrl = cls.getAbsoluteUrl(properties.imageAlias)
        return template.format(absoluteUrl, properties.width,
                               properties.height, properties.vSpace,
                               properties.hSpace)

    def getFirstDayOfWeek(self):
        return BigWorld.wg_firstDayOfWeek() + 1

    def getWeekDayNames(self, full, isUpper, isLower, useRegionSettings=True):
        source = list(MENU.DATETIME_WEEKDAYS_FULL_ENUM if full else MENU.
                      DATETIME_WEEKDAYS_SHORT_ENUM)
        result = []
        if useRegionSettings:
            firstDayOfWeek = BigWorld.wg_firstDayOfWeek()
        else:
            firstDayOfWeek = 0
        for day in calendar.Calendar(
                firstweekday=firstDayOfWeek).iterweekdays():
            name = i18n.makeString(source[day])
            if isUpper:
                name = self.changeStringCasing(name, True, None)
            elif isLower:
                name = self.changeStringCasing(name, False, None)
            result.append(name)

        return result

    def getMonthsNames(self, full, isUpper, isLower):
        source = list(MENU.DATETIME_MONTHS_FULL_ENUM if full else MENU.
                      DATETIME_MONTHS_SHORT_ENUM)
        result = []
        for key in source:
            name = i18n.makeString(key)
            if isUpper:
                name = self.changeStringCasing(name, True, None)
            elif isLower:
                name = self.changeStringCasing(name, False, None)
            result.append(name)

        return result

    def _dispose(self):
        self._textMgr = None
        super(UtilsManager, self)._dispose()
        return

    def intToStringWithPrefixPatern(self, value, count, fill):
        return ('{0:' + str(fill) + '>' + str(count) + '}').format(value)

    def isTwelveHoursFormat(self):
        return getClientLanguage() == 'en'