コード例 #1
0
ファイル: vo_converters.py プロジェクト: kblw/wot_client
def makeBuildingIndicatorsVO(buildingLevel, progress, hpVal, hpTotalVal, defResVal, maxDefResVal):
    FORMAT_PATTERN = '###'
    if progress == FORT_ALIAS.STATE_FOUNDATION_DEF or progress == FORT_ALIAS.STATE_FOUNDATION:
        hpValueFormatter = text_styles.alert(FORMAT_PATTERN)
    else:
        hpValueFormatter = text_styles.defRes(FORMAT_PATTERN)
    hpTotalFormatted = str(BigWorld.wg_getIntegralFormat(hpTotalVal)) + ' '
    formattedHpTotal = ''.join((text_styles.standard(hpTotalFormatted), icons.nut()))
    defResValueFormatter = text_styles.defRes(FORMAT_PATTERN)
    maxDefDerFormatted = str(BigWorld.wg_getIntegralFormat(maxDefResVal)) + ' '
    formattedDefResTotal = ''.join((text_styles.standard(maxDefDerFormatted), icons.nut()))
    hpProgressLabels = {'currentValue': str(BigWorld.wg_getIntegralFormat(hpVal)),
     'currentValueFormatter': hpValueFormatter,
     'totalValue': formattedHpTotal,
     'separator': '/'}
    storeProgressLabels = {'currentValue': str(BigWorld.wg_getIntegralFormat(defResVal)),
     'currentValueFormatter': defResValueFormatter,
     '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
コード例 #2
0
def makeBuildingIndicatorsVO(buildingLevel, progress, hpVal, hpTotalVal,
                             defResVal, maxDefResVal):
    FORMAT_PATTERN = '###'
    if progress == FORT_ALIAS.STATE_FOUNDATION_DEF or progress == FORT_ALIAS.STATE_FOUNDATION:
        hpValueFormatter = text_styles.alert(FORMAT_PATTERN)
    else:
        hpValueFormatter = text_styles.defRes(FORMAT_PATTERN)
    hpTotalFormatted = str(BigWorld.wg_getIntegralFormat(hpTotalVal)) + ' '
    formattedHpTotal = ''.join(
        (text_styles.standard(hpTotalFormatted), icons.nut()))
    defResValueFormatter = text_styles.alert(
        FORMAT_PATTERN) if defResVal > maxDefResVal else text_styles.defRes(
            FORMAT_PATTERN)
    maxDefDerFormatted = str(BigWorld.wg_getIntegralFormat(maxDefResVal)) + ' '
    formattedDefResTotal = ''.join(
        (text_styles.standard(maxDefDerFormatted), icons.nut()))
    hpProgressLabels = {
        'currentValue': str(BigWorld.wg_getIntegralFormat(hpVal)),
        'currentValueFormatter': hpValueFormatter,
        'totalValue': formattedHpTotal,
        'separator': '/'
    }
    storeProgressLabels = {
        'currentValue': str(BigWorld.wg_getIntegralFormat(defResVal)),
        'currentValueFormatter': defResValueFormatter,
        'totalValue': formattedDefResTotal,
        'separator': '/'
    }
    result = {
        'hpLabel':
        i18n.makeString(FORTIFICATIONS.BUILDINGPOPOVER_INDICATORS_HPLBL),
        'defResLabel':
        i18n.makeString(FORTIFICATIONS.BUILDINGPOPOVER_INDICATORS_DEFRESLBL),
        'hpCurrentValue':
        hpVal,
        'hpTotalValue':
        hpTotalVal,
        'defResCurrentValue':
        defResVal,
        'defResCompensationValue':
        max(0, defResVal - maxDefResVal),
        'defResTotalValue':
        maxDefResVal,
        'hpProgressLabels':
        hpProgressLabels,
        'defResProgressLabels':
        storeProgressLabels
    }
    return result
コード例 #3
0
ファイル: vo_converters.py プロジェクト: kblw/wot_client
def makeSimpleClanListRenderVO(member, intTotalMining, intWeekMining, role, roleID):
    week = text_styles.defRes(BigWorld.wg_getIntegralFormat(intWeekMining))
    allTime = text_styles.defRes(BigWorld.wg_getIntegralFormat(intTotalMining))
    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()}
コード例 #4
0
def makeSimpleClanListRenderVO(member, intTotalMining, intWeekMining, role, roleID):
    week = text_styles.defRes(BigWorld.wg_getIntegralFormat(intWeekMining))
    allTime = text_styles.defRes(BigWorld.wg_getIntegralFormat(intTotalMining))
    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()}
コード例 #5
0
def getDefRes(value, addIcon = True):
    text = text_styles.defRes(BigWorld.wg_getIntegralFormat(value))
    if addIcon:
        icon = icons.nut()
        return text + ' ' + icon
    else:
        return text
コード例 #6
0
ファイル: fort_formatters.py プロジェクト: webiumsk/WOT0.10.0
def getDefRes(value, addIcon = True):
    text = text_styles.defRes(BigWorld.wg_getIntegralFormat(value))
    if addIcon:
        icon = icons.nut()
        return text + ' ' + icon
    else:
        return text
コード例 #7
0
 def __makeData(self):
     sourceCount = text_styles.defRes(str(fortified_regions.g_cache.startResource))
     sourceCount += ' ' + icons.nut()
     sourceCount = text_styles.standard(i18n.makeString(FORTIFICATIONS.CONGRATULATIONWINDOW_TEXTBODY, sourceCount=sourceCount))
     self.as_setTextS(sourceCount)
     self.as_setTitleS(i18n.makeString(FORTIFICATIONS.CONGRATULATIONWINDOW_TEXTTITLE))
     self.as_setButtonLblS(i18n.makeString(FORTIFICATIONS.CONGRATULATIONWINDOW_BUTTONLBL))
     self.as_setWindowTitleS(i18n.makeString(FORTIFICATIONS.CONGRATULATIONWINDOW_TITLELBL))
コード例 #8
0
 def __prepareIndicatorData(self, isCanModernization, increment = False, resLeft = 0):
     if increment:
         hpTotalVal = self.nextLevel.levelRef.hp
         hpVal = self.nextLevel.hp
         defResVal = self.__defResVal - self.__cost + resLeft
         maxDerResVal = self.nextLevel.levelRef.storage
     else:
         hpTotalVal = self.__hpTotalVal
         hpVal = self.__hpVal
         defResVal = self.__defResVal
         maxDerResVal = self.__maxDerResVal
     formatter = text_styles.defRes
     if self.__progress == FORTIFICATION_ALIASES.STATE_FOUNDATION_DEF or self.__progress == FORTIFICATION_ALIASES.STATE_FOUNDATION:
         formatter = text_styles.alert
     if not isCanModernization and increment:
         currentHpLabel = text_styles.main('--')
         currentHpValue = 0
     else:
         currentHpLabel = str(BigWorld.wg_getIntegralFormat(hpVal))
         currentHpValue = hpVal
     FORMAT_PATTERN = '###'
     formattedHpValue = formatter(FORMAT_PATTERN)
     formatter = text_styles.standard
     if increment:
         formatter = text_styles.neutral
     formattedHpTotal = formatter(str(BigWorld.wg_getIntegralFormat(hpTotalVal)))
     formattedHpTotal += ' ' + icons.nut()
     if not isCanModernization and increment:
         currentDefResLabel = text_styles.main('--')
         currentDefResValue = 0
     else:
         currentDefResLabel = str(BigWorld.wg_getIntegralFormat(defResVal))
         currentDefResValue = defResVal
     defResValueFormatter = text_styles.defRes(FORMAT_PATTERN)
     formattedDefResTotal = formatter(str(BigWorld.wg_getIntegralFormat(maxDerResVal)))
     formattedDefResTotal += ' ' + icons.nut()
     result = {}
     result['hpLabel'] = i18n.makeString(FORTIFICATIONS.BUILDINGPOPOVER_INDICATORS_HPLBL)
     result['defResLabel'] = i18n.makeString(FORTIFICATIONS.BUILDINGPOPOVER_INDICATORS_DEFRESLBL)
     result['hpCurrentValue'] = currentHpValue
     result['hpTotalValue'] = hpTotalVal
     result['defResCurrentValue'] = currentDefResValue
     result['defResTotalValue'] = maxDerResVal
     hpProgressLabels = {}
     hpProgressLabels['currentValue'] = currentHpLabel
     hpProgressLabels['currentValueFormatter'] = formattedHpValue
     hpProgressLabels['totalValue'] = formattedHpTotal
     hpProgressLabels['separator'] = '/'
     storeProgressLabels = {}
     storeProgressLabels['currentValue'] = currentDefResLabel
     storeProgressLabels['currentValueFormatter'] = defResValueFormatter
     storeProgressLabels['totalValue'] = formattedDefResTotal
     storeProgressLabels['separator'] = '/'
     result['hpProgressLabels'] = hpProgressLabels
     result['defResProgressLabels'] = storeProgressLabels
     return result
コード例 #9
0
 def __makeData(self):
     sourceCount = text_styles.defRes(
         str(fortified_regions.g_cache.startResource))
     sourceCount += ' ' + icons.nut()
     sourceCount = text_styles.standard(
         i18n.makeString(FORTIFICATIONS.CONGRATULATIONWINDOW_TEXTBODY,
                         sourceCount=sourceCount))
     self.as_setTextS(sourceCount)
     self.as_setTitleS(
         i18n.makeString(FORTIFICATIONS.CONGRATULATIONWINDOW_TEXTTITLE))
     self.as_setButtonLblS(
         i18n.makeString(FORTIFICATIONS.CONGRATULATIONWINDOW_BUTTONLBL))
     self.as_setWindowTitleS(
         i18n.makeString(FORTIFICATIONS.CONGRATULATIONWINDOW_TITLELBL))
コード例 #10
0
 def __updateSortieData(self):
     ms = i18n.makeString
     dossier = self.fortCtrl.getFort().getFortDossier()
     sortiesStats = dossier.getSortiesStats()
     totalRes = sortiesStats.getLoot()
     defresValueStr = str(BigWorld.wg_getIntegralFormat(totalRes)) + ' '
     formattedDefresValue = ''.join((text_styles.defRes(defresValueStr), icons.nut()))
     middleBattlesCount = BigWorld.wg_getIntegralFormat(sortiesStats.getMiddleBattlesCount())
     championshipBattlesCount = BigWorld.wg_getIntegralFormat(sortiesStats.getChampionBattlesCount())
     absoluteBattlesCount = BigWorld.wg_getIntegralFormat(sortiesStats.getAbsoluteBattlesCount())
     self.__data.update({'clanName': g_clanCache.clanTag,
      'sortieBattlesCount': ProfileUtils.getTotalBattlesHeaderParam(sortiesStats, FORTIFICATIONS.CLANSTATS_PARAMS_SORTIE_BATTLESCOUNT_LABEL, FORTIFICATIONS.CLANSTATS_PARAMS_SORTIE_BATTLESCOUNT_TOOLTIP),
      'sortieWins': ProfileUtils.packLditItemData(ProfileUtils.getFormattedWinsEfficiency(sortiesStats), FORTIFICATIONS.CLANSTATS_PARAMS_SORTIE_WINS_LABEL, FORTIFICATIONS.CLANSTATS_PARAMS_SORTIE_WINS_TOOLTIP, 'wins40x32.png'),
      'sortieAvgDefres': ProfileUtils.packLditItemData(ProfileUtils.formatEfficiency(sortiesStats.getBattlesCount(), sortiesStats.getAvgLoot), FORTIFICATIONS.CLANSTATS_PARAMS_SORTIE_AVGDEFRES_LABEL, FORTIFICATIONS.CLANSTATS_PARAMS_SORTIE_AVGDEFRES_TOOLTIP, 'avgDefes40x32.png'),
      'sortieBattlesStats': [{'value': self.__getMiddleTitleText(middleBattlesCount),
                              'label': ms(FORTIFICATIONS.CLANSTATS_PARAMS_SORTIE_BATTLES_MIDDLEBATTLESCOUNT_LABEL)}, {'value': self.__getMiddleTitleText(championshipBattlesCount),
                              'label': ms(FORTIFICATIONS.CLANSTATS_PARAMS_SORTIE_BATTLES_CHAMPIONBATTLESCOUNT_LABEL)}, {'value': self.__getMiddleTitleText(absoluteBattlesCount),
                              'label': ms(FORTIFICATIONS.CLANSTATS_PARAMS_SORTIE_BATTLES_ABSOLUTEBATTLESCOUNT_LABEL)}],
      'sortieDefresStats': [{'value': formattedDefresValue,
                             'label': ms(FORTIFICATIONS.CLANSTATS_PARAMS_SORTIE_DEFRES_LOOTINSORTIES_LABEL)}]})
コード例 #11
0
 def __updateSortieData(self):
     ms = i18n.makeString
     dossier = self.fortCtrl.getFort().getFortDossier()
     sortiesStats = dossier.getSortiesStats()
     totalRes = sortiesStats.getLoot()
     defresValueStr = str(BigWorld.wg_getIntegralFormat(totalRes)) + ' '
     formattedDefresValue = ''.join((text_styles.defRes(defresValueStr), icons.nut()))
     middleBattlesCount = BigWorld.wg_getIntegralFormat(sortiesStats.getMiddleBattlesCount())
     championshipBattlesCount = BigWorld.wg_getIntegralFormat(sortiesStats.getChampionBattlesCount())
     absoluteBattlesCount = BigWorld.wg_getIntegralFormat(sortiesStats.getAbsoluteBattlesCount())
     self.__data.update({'clanName': g_clanCache.clanTag,
      'sortieBattlesCount': ProfileUtils.getTotalBattlesHeaderParam(sortiesStats, FORTIFICATIONS.CLANSTATS_PARAMS_SORTIE_BATTLESCOUNT_LABEL, FORTIFICATIONS.CLANSTATS_PARAMS_SORTIE_BATTLESCOUNT_TOOLTIP),
      'sortieWins': ProfileUtils.packLditItemData(ProfileUtils.getFormattedWinsEfficiency(sortiesStats), FORTIFICATIONS.CLANSTATS_PARAMS_SORTIE_WINS_LABEL, FORTIFICATIONS.CLANSTATS_PARAMS_SORTIE_WINS_TOOLTIP, 'wins40x32.png'),
      'sortieAvgDefres': ProfileUtils.packLditItemData(ProfileUtils.formatEfficiency(sortiesStats.getBattlesCount(), sortiesStats.getAvgLoot), FORTIFICATIONS.CLANSTATS_PARAMS_SORTIE_AVGDEFRES_LABEL, FORTIFICATIONS.CLANSTATS_PARAMS_SORTIE_AVGDEFRES_TOOLTIP, 'avgDefes40x32.png'),
      'sortieBattlesStats': [{'value': self.__getMiddleTitleText(middleBattlesCount),
                              'label': ms(FORTIFICATIONS.CLANSTATS_PARAMS_SORTIE_BATTLES_MIDDLEBATTLESCOUNT_LABEL)}, {'value': self.__getMiddleTitleText(championshipBattlesCount),
                              'label': ms(FORTIFICATIONS.CLANSTATS_PARAMS_SORTIE_BATTLES_CHAMPIONBATTLESCOUNT_LABEL)}, {'value': self.__getMiddleTitleText(absoluteBattlesCount),
                              'label': ms(FORTIFICATIONS.CLANSTATS_PARAMS_SORTIE_BATTLES_ABSOLUTEBATTLESCOUNT_LABEL)}],
      'sortieDefresStats': [{'value': formattedDefresValue,
                             'label': ms(FORTIFICATIONS.CLANSTATS_PARAMS_SORTIE_DEFRES_LOOTINSORTIES_LABEL)}]})
コード例 #12
0
 def __makeData(self):
     baseBuildingMaxLevel = MAX_LEVEL.MAX_BASE_LEVEL_SECOND_ITERATION if self.__isFortBattleAvailable else MAX_LEVEL.MAX_BASE_LEVEL_FIRST_ITERATION
     result = {}
     cndBody = ''
     limits = self.fortCtrl.getLimits()
     canUpgrade, upgradeRestriction = limits.canUpgrade(self.intBuildingID)
     LOG_DEBUG(upgradeRestriction)
     cndPostfix = ''
     isCanModernization = canUpgrade
     conditionIcon = icons.checkmark()
     canUpgradeByDefPeriod = True
     isBaseBuilding = self.__uid == FORTIFICATION_ALIASES.FORT_BASE_BUILDING
     if self.__uid != FORTIFICATION_ALIASES.FORT_BASE_BUILDING:
         cndBody = i18n.makeString(FORTIFICATIONS.MODERNIZATION_CONDITIONS_GENERALCONDITION, level=fort_formatters.getTextLevel(self.__buildingLevel + 1))
         if canUpgrade:
             isCanModernization = True
         else:
             isCanModernization = False
         if self.__buildingLevel == MAX_LEVEL.MAX_BUILD_LEVEL:
             if self.__isFortBattleAvailable:
                 cndBody = i18n.makeString(FORTIFICATIONS.MODERNIZATION_CONDITIONS_DEFENCEPERIODANDBASEBUILDING, level=fort_formatters.getTextLevel(self.__buildingLevel + 1))
                 if not self.__defencePeriod or self.__baseBuildingLevel < MAX_LEVEL.MAX_BASE_LEVEL_SECOND_ITERATION:
                     cndPostfix = text_styles.error(i18n.makeString(FORTIFICATIONS.MODERNIZATION_CONDITIONS_NOTFULFILLED))
                     isCanModernization = False
                     canUpgradeByDefPeriod = False
                     conditionIcon = text_styles.standard('-')
             elif self.__buildingLevel == self.__baseBuildingLevel:
                 cndPostfix = text_styles.error(i18n.makeString(FORTIFICATIONS.MODERNIZATION_CONDITIONS_NOTFULFILLED))
         elif self.__buildingLevel == self.__baseBuildingLevel:
             cndPostfix = text_styles.error(i18n.makeString(FORTIFICATIONS.MODERNIZATION_CONDITIONS_NOTFULFILLED))
             isCanModernization = False
     elif self.__buildingLevel == baseBuildingMaxLevel:
         cndBody = i18n.makeString(FORTIFICATIONS.MODERNIZATION_CONDITIONS_BASEBUILDINGFIVELEVEL)
         if not self.__defencePeriod and self.__isFortBattleAvailable:
             cndPostfix = text_styles.error(i18n.makeString(FORTIFICATIONS.MODERNIZATION_CONDITIONS_NOTFULFILLED))
             isCanModernization = False
             canUpgradeByDefPeriod = False
             conditionIcon = text_styles.standard('-')
         elif not self.__isFortBattleAvailable:
             isCanModernization = False
             canUpgradeByDefPeriod = False
             cndBody = text_styles.alert(i18n.makeString(FORTIFICATIONS.MODERNIZATION_CONDITIONS_FORTMAXLEVEL))
             conditionIcon = ''
     prefixBody = text_styles.main(cndBody)
     result['condition'] = prefixBody + cndPostfix
     result['costUpgrade'] = text_styles.defRes(i18n.makeString(FORTIFICATIONS.MODERNIZATION_MODERNIZATIONINFO_COUNTCOST))
     result['intBuildingID'] = self.intBuildingID
     if not canUpgrade and upgradeRestriction != FORT_RESTRICTION.BUILDING_NOT_ENOUGH_RESOURCE:
         conditionIcon = text_styles.standard('-')
     if self._buildingDescr.storage < self.__cost:
         costMsg = text_styles.error(BigWorld.wg_getIntegralFormat(self.__cost))
         constIcon = icons.nut()
         costMsg = costMsg + ' ' + constIcon
     else:
         costMsg = fort_formatters.getDefRes(self.__cost, True)
     result['costValue'] = costMsg
     if cndBody != '':
         result['conditionIcon'] = conditionIcon
     result['canUpgrade'] = isCanModernization
     if not isCanModernization:
         btnToolTip = {}
         if not canUpgradeByDefPeriod and self.__isFortBattleAvailable:
             btnToolTip['header'] = i18n.makeString(TOOLTIPS.FORTIFICATION_MODERNIZATION_NOTACTIVATEDDEFPERIOD_HEADER)
             btnToolTip['body'] = i18n.makeString(i18n.makeString(TOOLTIPS.FORTIFICATION_MODERNIZATION_NOTACTIVATEDDEFPERIOD_BODY))
         else:
             btnToolTip['header'] = i18n.makeString(TOOLTIPS.FORTIFICATION_MODERNIZATION_APPLYBUTTON_HEADER)
             if not self.__isFortBattleAvailable and isBaseBuilding and self.__buildingLevel == baseBuildingMaxLevel:
                 btnToolTip['header'] = i18n.makeString('#tooltips:fortification/popOver/upgradeFoundationBtn_Disabled/header')
                 btnToolTip['body'] = i18n.makeString(FORTIFICATIONS.MODERNIZATION_CONDITIONS_FORTMAXLEVEL)
             elif upgradeRestriction == FORT_RESTRICTION.BUILDING_NOT_ENOUGH_RESOURCE_AND_LOW_LEVEL:
                 btnToolTip['body'] = i18n.makeString(TOOLTIPS.FORTIFICATION_MODERNIZATION_APPLYBUTTON_LOWLEVELANDRESOURCE, baseLevel=fort_formatters.getTextLevel(self.__baseBuildingLevel + 1))
             elif upgradeRestriction == FORT_RESTRICTION.BUILDING_FORT_LEVEL_TOO_LOW:
                 btnToolTip['body'] = i18n.makeString(TOOLTIPS.FORTIFICATION_MODERNIZATION_APPLYBUTTON_LOWBASELEVEL, baseLevel=fort_formatters.getTextLevel(self.__baseBuildingLevel + 1))
             elif upgradeRestriction == FORT_RESTRICTION.BUILDING_NOT_ENOUGH_RESOURCE:
                 btnToolTip['body'] = i18n.makeString(TOOLTIPS.FORTIFICATION_MODERNIZATION_APPLYBUTTON_NETENOUGHRESOURCE)
         result['btnToolTip'] = btnToolTip
     fort = self.fortCtrl.getFort()
     newCount = 0
     resLeft = 0
     orderCount = 0
     if self.__uid != FORTIFICATION_ALIASES.FORT_BASE_BUILDING:
         order = fort.getOrder(self._buildingDescr.typeRef.orderType)
         orderCount = order.count
         newCount, resLeft = fort.recalculateOrder(order.orderID, order.count, order.level, order.level + 1)
     inProcess, _ = fort.getDefenceHourProcessing()
     isDefenceOn = fort.isDefenceHourEnabled() or inProcess
     before = {}
     before['buildingType'] = self.__uid
     before['buildingLevel'] = self.__buildingLevel
     before['buildingIcon'] = FortViewHelper.getMapIconSource(self.__uid, self.__buildingLevel, isDefenceOn=isDefenceOn)
     before['buildingIndicators'] = self.__prepareIndicatorData(isCanModernization, False)
     before['defResInfo'] = self.__prepareOrderInfo(False, orderCount, self.__buildingLevel)
     before['titleText'] = text_styles.middleTitle(i18n.makeString(FORTIFICATIONS.MODERNIZATION_MODERNIZATIONINFO_BEFORELABEL))
     result['beforeUpgradeData'] = before
     after = {}
     after['buildingType'] = self.__uid
     after['buildingLevel'] = self.__buildingLevel + 1
     after['buildingIcon'] = FortViewHelper.getMapIconSource(self.__uid, self.__buildingLevel + 1)
     after['buildingIndicators'] = self.__prepareIndicatorData(isCanModernization, True, resLeft)
     after['defResInfo'] = self.__prepareOrderInfo(True, newCount, self.__buildingLevel + 1)
     after['titleText'] = text_styles.middleTitle(i18n.makeString(FORTIFICATIONS.MODERNIZATION_MODERNIZATIONINFO_AFTERLABEL))
     result['afterUpgradeData'] = after
     return result
コード例 #13
0
 def __getFormattedDefresValue(self, value):
     return ''.join((text_styles.defRes(ProfileUtils.getAvailableValueStr(value) + ' '), icons.nut()))
コード例 #14
0
def _resourceParam(value):
    return ''.join((text_styles.defRes(value), icons.nutStat()))
コード例 #15
0
def _resourceParam(value):
    return ''.join((text_styles.defRes(value), icons.nutStat()))
コード例 #16
0
 def _getWeekMiningStr(self, weekMining):
     randWeek = BigWorld.wg_getIntegralFormat(weekMining)
     return text_styles.defRes(randWeek)
コード例 #17
0
 def _getTotalMiningStr(self, totalMining):
     allTime = BigWorld.wg_getIntegralFormat(totalMining)
     return text_styles.defRes(allTime)
コード例 #18
0
 def _getWeekMiningStr(self, weekMining):
     randWeek = BigWorld.wg_getIntegralFormat(weekMining)
     return text_styles.defRes(randWeek)
コード例 #19
0
 def __prepareIndicatorData(self,
                            isCanModernization,
                            increment=False,
                            resLeft=0):
     if increment:
         hpTotalVal = self.nextLevel.levelRef.hp
         hpVal = self.nextLevel.hp
         defResVal = self.__defResVal - self.__cost + resLeft
         maxDefResVal = self.nextLevel.levelRef.storage
     else:
         hpTotalVal = self.__hpTotalVal
         hpVal = self.__hpVal
         defResVal = self.__defResVal
         maxDefResVal = self.__maxDerResVal
     formatter = text_styles.defRes
     if self.__progress == FORTIFICATION_ALIASES.STATE_FOUNDATION_DEF or self.__progress == FORTIFICATION_ALIASES.STATE_FOUNDATION:
         formatter = text_styles.alert
     if not isCanModernization and increment:
         currentHpLabel = text_styles.main('--')
         currentHpValue = 0
     else:
         currentHpLabel = str(BigWorld.wg_getIntegralFormat(hpVal))
         currentHpValue = hpVal
     FORMAT_PATTERN = '###'
     formattedHpValue = formatter(FORMAT_PATTERN)
     formatter = text_styles.standard
     if increment:
         formatter = text_styles.neutral
     formattedHpTotal = formatter(
         str(BigWorld.wg_getIntegralFormat(hpTotalVal)))
     formattedHpTotal += ' ' + icons.nut()
     if not isCanModernization and increment:
         currentDefResLabel = text_styles.main('--')
         currentDefResValue = 0
     else:
         currentDefResLabel = str(BigWorld.wg_getIntegralFormat(defResVal))
         currentDefResValue = defResVal
     defResValueFormatter = text_styles.alert(
         FORMAT_PATTERN
     ) if defResVal > maxDefResVal else text_styles.defRes(FORMAT_PATTERN)
     formattedDefResTotal = formatter(
         str(BigWorld.wg_getIntegralFormat(maxDefResVal)))
     formattedDefResTotal += ' ' + icons.nut()
     result = {}
     result['hpLabel'] = i18n.makeString(
         FORTIFICATIONS.BUILDINGPOPOVER_INDICATORS_HPLBL)
     result['defResLabel'] = i18n.makeString(
         FORTIFICATIONS.BUILDINGPOPOVER_INDICATORS_DEFRESLBL)
     result['hpCurrentValue'] = currentHpValue
     result['hpTotalValue'] = hpTotalVal
     result['defResCurrentValue'] = currentDefResValue
     result['defResTotalValue'] = maxDefResVal
     result['defResTotalValue'] = maxDefResVal
     result['defResCompensationValue'] = max(0, defResVal - maxDefResVal)
     hpProgressLabels = {}
     hpProgressLabels['currentValue'] = currentHpLabel
     hpProgressLabels['currentValueFormatter'] = formattedHpValue
     hpProgressLabels['totalValue'] = formattedHpTotal
     hpProgressLabels['separator'] = '/'
     storeProgressLabels = {}
     storeProgressLabels['currentValue'] = currentDefResLabel
     storeProgressLabels['currentValueFormatter'] = defResValueFormatter
     storeProgressLabels['totalValue'] = formattedDefResTotal
     storeProgressLabels['separator'] = '/'
     result['hpProgressLabels'] = hpProgressLabels
     result['defResProgressLabels'] = storeProgressLabels
     return result
コード例 #20
0
 def __makeData(self):
     isFortsEnabled = g_lobbyContext.getServerSettings().isFortsEnabled()
     if isFortsEnabled:
         baseBuildingMaxLevel = MAX_LEVEL.MAX_BASE_LEVEL_SECOND_ITERATION
     else:
         baseBuildingMaxLevel = MAX_LEVEL.MAX_BASE_LEVEL_FIRST_ITERATION
     result = {}
     cndBody = ''
     limits = self.fortCtrl.getLimits()
     canUpgrade, upgradeRestriction = limits.canUpgrade(self.intBuildingID)
     LOG_DEBUG(upgradeRestriction)
     cndPostfix = ''
     isCanModernization = canUpgrade
     conditionIcon = icons.checkmark()
     canUpgradeByDefPeriod = True
     isBaseBuilding = self.__uid == FORTIFICATION_ALIASES.FORT_BASE_BUILDING
     if self.__uid != FORTIFICATION_ALIASES.FORT_BASE_BUILDING:
         cndBody = i18n.makeString(
             FORTIFICATIONS.MODERNIZATION_CONDITIONS_GENERALCONDITION,
             level=fort_formatters.getTextLevel(self.__buildingLevel + 1))
         canUpgrade = isCanModernization
         if self.__buildingLevel == MAX_LEVEL.MAX_BUILD_LEVEL:
             if isFortsEnabled:
                 cndBody = i18n.makeString(
                     FORTIFICATIONS.
                     MODERNIZATION_CONDITIONS_DEFENCEPERIODANDBASEBUILDING,
                     level=fort_formatters.getTextLevel(
                         self.__buildingLevel + 1))
                 if not self.__defencePeriod or self.__baseBuildingLevel < MAX_LEVEL.MAX_BASE_LEVEL_SECOND_ITERATION:
                     cndPostfix = text_styles.error(
                         i18n.makeString(
                             FORTIFICATIONS.
                             MODERNIZATION_CONDITIONS_NOTFULFILLED))
                     isCanModernization = False
                     canUpgradeByDefPeriod = False
                     conditionIcon = text_styles.standard('-')
             elif self.__buildingLevel == self.__baseBuildingLevel:
                 cndPostfix = text_styles.error(
                     i18n.makeString(FORTIFICATIONS.
                                     MODERNIZATION_CONDITIONS_NOTFULFILLED))
         elif self.__buildingLevel == self.__baseBuildingLevel:
             cndPostfix = text_styles.error(
                 i18n.makeString(
                     FORTIFICATIONS.MODERNIZATION_CONDITIONS_NOTFULFILLED))
             isCanModernization = False
     elif self.__buildingLevel == baseBuildingMaxLevel:
         cndBody = i18n.makeString(
             FORTIFICATIONS.MODERNIZATION_CONDITIONS_BASEBUILDINGFIVELEVEL)
         if not self.__defencePeriod and isFortsEnabled:
             cndPostfix = text_styles.error(
                 i18n.makeString(
                     FORTIFICATIONS.MODERNIZATION_CONDITIONS_NOTFULFILLED))
             isCanModernization = False
             canUpgradeByDefPeriod = False
             conditionIcon = text_styles.standard('-')
         elif not isFortsEnabled:
             isCanModernization = False
             canUpgradeByDefPeriod = False
             cndBody = text_styles.alert(
                 i18n.makeString(
                     FORTIFICATIONS.MODERNIZATION_CONDITIONS_FORTMAXLEVEL))
             conditionIcon = ''
     prefixBody = text_styles.main(cndBody)
     result['condition'] = prefixBody + cndPostfix
     result['costUpgrade'] = text_styles.defRes(
         i18n.makeString(
             FORTIFICATIONS.MODERNIZATION_MODERNIZATIONINFO_COUNTCOST))
     result['intBuildingID'] = self.intBuildingID
     if not canUpgrade and upgradeRestriction != FORT_RESTRICTION.BUILDING_NOT_ENOUGH_RESOURCE:
         conditionIcon = text_styles.standard('-')
     if self._buildingDescr.storage < self.__cost:
         costMsg = text_styles.error(
             BigWorld.wg_getIntegralFormat(self.__cost))
         constIcon = icons.nut()
         costMsg = costMsg + ' ' + constIcon
     else:
         costMsg = fort_formatters.getDefRes(self.__cost, True)
     result['costValue'] = costMsg
     if cndBody != '':
         result['conditionIcon'] = conditionIcon
     result['canUpgrade'] = isCanModernization
     if not isCanModernization:
         ttHeader = ''
         ttBody = ''
         if not canUpgradeByDefPeriod and isFortsEnabled:
             ttHeader = i18n.makeString(
                 TOOLTIPS.
                 FORTIFICATION_MODERNIZATION_NOTACTIVATEDDEFPERIOD_HEADER)
             ttBody = i18n.makeString(
                 i18n.makeString(
                     TOOLTIPS.
                     FORTIFICATION_MODERNIZATION_NOTACTIVATEDDEFPERIOD_BODY)
             )
         else:
             ttHeader = i18n.makeString(
                 TOOLTIPS.FORTIFICATION_MODERNIZATION_APPLYBUTTON_HEADER)
             if not isFortsEnabled and isBaseBuilding and self.__buildingLevel == baseBuildingMaxLevel:
                 ttHeader = i18n.makeString(
                     '#tooltips:fortification/popOver/upgradeFoundationBtn_Disabled/header'
                 )
                 ttBody = i18n.makeString(
                     FORTIFICATIONS.MODERNIZATION_CONDITIONS_FORTMAXLEVEL)
             elif upgradeRestriction == FORT_RESTRICTION.BUILDING_NOT_ENOUGH_RESOURCE_AND_LOW_LEVEL:
                 ttBody = i18n.makeString(
                     TOOLTIPS.
                     FORTIFICATION_MODERNIZATION_APPLYBUTTON_LOWLEVELANDRESOURCE,
                     baseLevel=fort_formatters.getTextLevel(
                         self.__baseBuildingLevel + 1))
             elif upgradeRestriction == FORT_RESTRICTION.BUILDING_FORT_LEVEL_TOO_LOW:
                 ttBody = i18n.makeString(
                     TOOLTIPS.
                     FORTIFICATION_MODERNIZATION_APPLYBUTTON_LOWBASELEVEL,
                     baseLevel=fort_formatters.getTextLevel(
                         self.__baseBuildingLevel + 1))
             elif upgradeRestriction == FORT_RESTRICTION.BUILDING_NOT_ENOUGH_RESOURCE:
                 ttBody = i18n.makeString(
                     TOOLTIPS.
                     FORTIFICATION_MODERNIZATION_APPLYBUTTON_NETENOUGHRESOURCE
                 )
         result['btnToolTip'] = makeTooltip(ttHeader, ttBody)
     fort = self.fortCtrl.getFort()
     newCount = 0
     resLeft = 0
     orderCount = 0
     if self.__uid != FORTIFICATION_ALIASES.FORT_BASE_BUILDING:
         order = fort.getOrder(self._buildingDescr.typeRef.orderType)
         orderCount = order.count
         newCount, resLeft = fort.recalculateOrder(order.orderID,
                                                   order.count, order.level,
                                                   order.level + 1)
     inProcess, _ = fort.getDefenceHourProcessing()
     isDefenceOn = fort.isDefenceHourEnabled() or inProcess
     before = {}
     before['buildingLevel'] = self.__buildingLevel
     before['buildingIcon'] = FortViewHelper.getMapIconSource(
         self.__uid, self.__buildingLevel, isDefenceOn=isDefenceOn)
     before['buildingIndicators'] = self.__prepareIndicatorData(
         isCanModernization, False)
     before['defResInfo'] = self.__prepareOrderInfo(False, orderCount,
                                                    self.__buildingLevel)
     before['titleText'] = text_styles.middleTitle(
         i18n.makeString(
             FORTIFICATIONS.MODERNIZATION_MODERNIZATIONINFO_BEFORELABEL))
     result['beforeUpgradeData'] = before
     after = {}
     after['buildingLevel'] = self.__buildingLevel + 1
     after['buildingIcon'] = FortViewHelper.getMapIconSource(
         self.__uid, self.__buildingLevel + 1)
     after['buildingIndicators'] = self.__prepareIndicatorData(
         isCanModernization, True, resLeft)
     after['defResInfo'] = self.__prepareOrderInfo(True, newCount,
                                                   self.__buildingLevel + 1)
     after['titleText'] = text_styles.middleTitle(
         i18n.makeString(
             FORTIFICATIONS.MODERNIZATION_MODERNIZATIONINFO_AFTERLABEL))
     result['afterUpgradeData'] = after
     return result
コード例 #21
0
 def _getTotalMiningStr(self, totalMining):
     allTime = BigWorld.wg_getIntegralFormat(totalMining)
     return text_styles.defRes(allTime)
コード例 #22
0
 def __getFormattedDefresValue(self, value):
     return ''.join((text_styles.defRes(ProfileUtils.getAvailableValueStr(value) + ' '), icons.nut()))