Esempio n. 1
0
 def _getCustomData(self):
     fort = self.fortCtrl.getFort()
     level = fort.level
     levelTxt = fort_formatters.getTextLevel(level)
     defResQuantity = fort.getTotalDefRes()
     defResPrefix = text_styles.main(
         i18n.makeString(
             FORTIFICATIONS.FORTMAINVIEW_COMMON_TOTALDEPOTQUANTITYTEXT))
     return {
         'clanName':
         g_clanCache.clanTag,
         'levelTitle':
         i18n.makeString(FORTIFICATIONS.FORTMAINVIEW_HEADER_LEVELSLBL,
                         buildLevel=levelTxt),
         'defResText':
         defResPrefix + fort_formatters.getDefRes(defResQuantity, True),
         'clanProfileBtnLbl':
         CLANS.FORT_HEADER_CLANPROFILEBTNLBL,
         'clanListBtnTooltip':
         makeTooltip(
             i18n.makeString(TOOLTIPS.FORTIFICATION_HEADER_CLANLIST_HEADER,
                             clanName=g_clanCache.clanTag),
             i18n.makeString(TOOLTIPS.FORTIFICATION_HEADER_CLANLIST_BODY)),
         'orderSelectorVO': {
             'isSelected':
             AccountSettings.getFilter(ORDERS_FILTER)['isSelected'],
             'icon':
             RES_ICONS.MAPS_ICONS_LIBRARY_FORTIFICATION_AIM
         }
     }
Esempio n. 2
0
 def _prepareAndSetData(self):
     orderID = self.getOrderIDbyUID(self._orderID)
     order = self.fortCtrl.getFort().getOrder(orderID)
     building = self.fortCtrl.getFort().getBuilding(order.buildingID)
     canActivateOrder, _ = self.fortCtrl.getLimits().canActivateOrder(orderID)
     isBtnDisabled = not canActivateOrder or self._isProductionInPause(building)
     showAlertIcon, alertIconTooltip = self._showOrderAlertIcon(order)
     data = {'title': self._getTitle(),
      'levelStr': self._getLevelStr(order.level),
      'description': self._getOrderDescription(order),
      'effectTimeStr': self._getEffectTimeStr(order),
      'leftTimeStr': '' if order.isConsumable else self._getFormattedLeftTime(order),
      'productionTime': self._getFormattedTimeStr(order.productionTotalTime),
      'buildingStr': self._getBuildingStr(order),
      'productionCost': fort_formatters.getDefRes(order.productionCost, True),
      'producedAmount': self._getCountStr(order),
      'icon': order.bigIcon,
      'canUseOrder': False if order.isConsumable else self._canGiveOrder(),
      'canCreateOrder': self._canCreateOrder(order),
      'inCooldown': False if order.isConsumable else order.inCooldown,
      'effectTime': order.effectTime,
      'leftTime': order.getUsageLeftTime(),
      'useBtnTooltip': self._getUseBtnTooltip(order, building, isBtnDisabled),
      'hasBuilding': order.hasBuilding,
      'isPermanent': order.isPermanent,
      'questID': self._getQuestID(order),
      'showLinkBtn': self._showLinkBtn(order),
      'showAlertIcon': showAlertIcon,
      'alertIconTooltip': alertIconTooltip,
      'showDetailsBtn': order.isConsumable}
     self.as_setInitDataS(data)
     self.as_disableOrderS(isBtnDisabled)
    def __makeDivisionsData(self, list):
        result = []
        for item in list:
            divisionType = {}
            title = i18n.makeString(item['label'])
            profit = fort_formatters.getDefRes(item['profit'])
            divisionID = item['level']
            divisionType['divisionName'] = highTitle(i18n.makeString(I18N_FORTIFICATIONS.CHOICEDIVISION_DIVISIONFULLNAME, divisionType=title))
            divisionType['divisionProfit'] = standard(i18n.makeString(I18N_FORTIFICATIONS.CHOICEDIVISION_DIVISIONPROFIT, defResCount=profit))
            minVehLvl, maxVehLvl = item['vehLvls']
            if maxVehLvl == minVehLvl:
                vehicleLevel = i18n.makeString(I18N_FORTIFICATIONS.CHOICEDIVISION_VEHICLELEVELSINGLE, level=_getTextLevels(maxVehLvl))
            else:
                vehicleLevel = i18n.makeString(I18N_FORTIFICATIONS.CHOICEDIVISION_VEHICLELEVEL, minLevel=_getTextLevels(minVehLvl), maxLevel=_getTextLevels(maxVehLvl))
            divisionType['vehicleLevel'] = standard(vehicleLevel)
            divisionType['divisionID'] = divisionID
            if divisionID == SORTIE_DIVISION.MIDDLE:
                minCount, maxCount = self.playersRange[0]
            elif divisionID == SORTIE_DIVISION.CHAMPION:
                minCount, maxCount = self.playersRange[1]
            else:
                minCount, maxCount = self.playersRange[2]
            divisionType['playerRange'] = main('{0}-{1}'.format(str(minCount), str(maxCount)))
            result.append(divisionType)

        return result
Esempio n. 4
0
 def _prepareAndSetData(self):
     orderID = self.getOrderIDbyUID(self._orderID)
     order = self.fortCtrl.getFort().getOrder(orderID)
     building = self.fortCtrl.getFort().getBuilding(order.buildingID)
     canActivateOrder, _ = self.fortCtrl.getLimits().canActivateOrder(orderID)
     isBtnDisabled = not canActivateOrder or self._isProductionInPause(building)
     showAlertIcon, alertIconTooltip = self._showOrderAlertIcon(order)
     data = {'title': self._getTitle(),
      'levelStr': self._getLevelStr(order.level),
      'description': self._getOrderDescription(order),
      'effectTimeStr': self._getEffectTimeStr(order),
      'leftTimeStr': '' if order.isConsumable else self._getFormattedLeftTime(order),
      'productionTime': time_formatters.getTimeDurationStr(order.productionTotalTime),
      'buildingStr': self._getBuildingStr(order),
      'productionCost': fort_formatters.getDefRes(order.productionCost, True),
      'producedAmount': self._getCountStr(order),
      'icon': order.bigIcon,
      'canUseOrder': False if order.isConsumable else self._canGiveOrder(),
      'canCreateOrder': self._canCreateOrder(order),
      'inCooldown': False if order.isConsumable else order.inCooldown,
      'effectTime': order.effectTime,
      'leftTime': order.getUsageLeftTime(),
      'useBtnTooltip': self._getUseBtnTooltip(order, building, isBtnDisabled),
      'hasBuilding': order.hasBuilding,
      'isPermanent': order.isPermanent,
      'questID': self._getQuestID(order),
      'showLinkBtn': self._showLinkBtn(order),
      'showAlertIcon': showAlertIcon,
      'alertIconTooltip': alertIconTooltip,
      'showDetailsBtn': order.isConsumable}
     self.as_setInitDataS(data)
     self.as_disableOrderS(isBtnDisabled)
Esempio n. 5
0
 def _prepareAndSetData(self):
     orderID = self.getOrderIDbyUID(self._orderID)
     order = self.fortCtrl.getFort().getOrder(orderID)
     building = self.fortCtrl.getFort().getBuilding(order.buildingID)
     canActivateOrder, _ = self.fortCtrl.getLimits().canActivateOrder(orderID)
     isBtnDisabled = not canActivateOrder or self._isProductionInPause(building)
     showAlertIcon, alertIconTooltip = self._showOrderAlertIcon(order)
     data = {
         "title": self._getTitle(),
         "levelStr": self._getLevelStr(order.level),
         "description": self._getOrderDescription(order),
         "effectTimeStr": self._getEffectTimeStr(order),
         "leftTimeStr": "" if order.isConsumable else self._getFormattedLeftTime(order),
         "productionTime": time_formatters.getTimeDurationStr(order.productionTotalTime),
         "buildingStr": self._getBuildingStr(order),
         "productionCost": fort_formatters.getDefRes(order.productionCost, True),
         "producedAmount": self._getCountStr(order),
         "icon": order.bigIcon,
         "canUseOrder": False if order.isConsumable else self._canGiveOrder(),
         "canCreateOrder": self._canCreateOrder(order),
         "inCooldown": False if order.isConsumable else order.inCooldown,
         "effectTime": order.effectTime,
         "leftTime": order.getUsageLeftTime(),
         "useBtnTooltip": self._getUseBtnTooltip(order, building, isBtnDisabled),
         "hasBuilding": order.hasBuilding,
         "isPermanent": order.isPermanent,
         "questID": self._getQuestID(order),
         "showLinkBtn": self._showLinkBtn(order),
         "showAlertIcon": showAlertIcon,
         "alertIconTooltip": alertIconTooltip,
         "showDetailsBtn": order.isConsumable,
     }
     self.as_setInitDataS(data)
     self.as_disableOrderS(isBtnDisabled)
Esempio n. 6
0
 def _getCustomData(self):
     fort = self.fortCtrl.getFort()
     level = fort.level
     levelTxt = fort_formatters.getTextLevel(level)
     defResQuantity = fort.getTotalDefRes()
     defResPrefix = text_styles.main(
         i18n.makeString(
             FORTIFICATIONS.FORTMAINVIEW_COMMON_TOTALDEPOTQUANTITYTEXT))
     disabledTransporting = False
     if self.__currentMode in (
             FORTIFICATION_ALIASES.MODE_TRANSPORTING_FIRST_STEP,
             FORTIFICATION_ALIASES.MODE_TRANSPORTING_NEXT_STEP,
             FORTIFICATION_ALIASES.MODE_TRANSPORTING_NOT_AVAILABLE):
         if not self.fortCtrl.getFort().isTransportationAvailable():
             disabledTransporting = True
     return {
         'clanName':
         g_clanCache.clanTag,
         'levelTitle':
         i18n.makeString(FORTIFICATIONS.FORTMAINVIEW_HEADER_LEVELSLBL,
                         buildLevel=levelTxt),
         'defResText':
         defResPrefix + fort_formatters.getDefRes(defResQuantity, True),
         'disabledTransporting':
         disabledTransporting,
         'orderSelectorVO': {
             'isSelected':
             AccountSettings.getFilter(ORDERS_FILTER)['isSelected'],
             'icon':
             RES_ICONS.MAPS_ICONS_LIBRARY_FORTIFICATION_AIM
         }
     }
 def _getCustomData(self):
     fort = self.fortCtrl.getFort()
     level = fort.level
     levelTxt = fort_formatters.getTextLevel(level)
     defResQuantity = fort.getTotalDefRes()
     defResPrefix = text_styles.main(i18n.makeString(FORTIFICATIONS.FORTMAINVIEW_COMMON_TOTALDEPOTQUANTITYTEXT))
     return {'clanName': g_clanCache.clanTag,
      'levelTitle': i18n.makeString(FORTIFICATIONS.FORTMAINVIEW_HEADER_LEVELSLBL, buildLevel=levelTxt),
      'defResText': defResPrefix + fort_formatters.getDefRes(defResQuantity, True),
      'clanProfileBtnLbl': CLANS.FORT_HEADER_CLANPROFILEBTNLBL,
      'clanListBtnTooltip': makeTooltip(i18n.makeString(TOOLTIPS.FORTIFICATION_HEADER_CLANLIST_HEADER, clanName=g_clanCache.clanTag), i18n.makeString(TOOLTIPS.FORTIFICATION_HEADER_CLANLIST_BODY)),
      'orderSelectorVO': {'isSelected': AccountSettings.getFilter(ORDERS_FILTER)['isSelected'],
                          'icon': RES_ICONS.MAPS_ICONS_LIBRARY_FORTIFICATION_AIM}}
 def _update(self):
     prefix = i18n.makeString(FORTIFICATIONS.FORTTRANSPORTCONFIRMATIONWINDOW_MAXTRANSPORTINGSIZELABEL)
     stdText = self.app.utilsManager.textManager.getText(TEXT_MANAGER_STYLES.STANDARD_TEXT, prefix)
     defResText = fort_formatters.getDefRes(self.getTransportingSize(), True)
     self.as_setMaxTransportingSizeS(stdText + defResText)
     clockIcon = self.app.utilsManager.textManager.getIcon(TextIcons.CLOCK_ICON)
     time = self.app.utilsManager.textManager.getTimeDurationStr(self.fortCtrl.getFort().getTransportationLevel().cooldownTime)
     ctx = {'estimatedTime': time}
     estimatedTextString = i18n.makeString(FORTIFICATIONS.FORTTRANSPORTCONFIRMATIONWINDOW_TRANSPORTINGFOOTERTEXT, **ctx)
     estimatedText = self.app.utilsManager.textManager.getText(TEXT_MANAGER_STYLES.STANDARD_TEXT, estimatedTextString)
     self.as_setFooterTextS(clockIcon + estimatedText)
     data = self.__buildData()
     self.as_setDataS(data)
     isFirstTransporting = self._isTutorial()
     self.as_enableForFirstTransportingS(isFirstTransporting)
 def _update(self):
     prefix = i18n.makeString(FORTIFICATIONS.FORTTRANSPORTCONFIRMATIONWINDOW_MAXTRANSPORTINGSIZELABEL)
     stdText = text_styles.standard(prefix)
     defResText = fort_formatters.getDefRes(self.getTransportingSize(), True)
     self.as_setMaxTransportingSizeS(stdText + defResText)
     clockIcon = icons.clock()
     time = time_formatters.getTimeDurationStr(self.fortCtrl.getFort().getTransportationLevel().cooldownTime)
     ctx = {'estimatedTime': time}
     estimatedTextString = i18n.makeString(FORTIFICATIONS.FORTTRANSPORTCONFIRMATIONWINDOW_TRANSPORTINGFOOTERTEXT, **ctx)
     estimatedText = text_styles.standard(estimatedTextString)
     self.as_setFooterTextS(clockIcon + estimatedText)
     data = self.__buildData()
     self.as_setDataS(data)
     isFirstTransporting = self._isTutorial()
     self.as_enableForFirstTransportingS(isFirstTransporting)
Esempio n. 10
0
 def _getCustomData(self):
     fort = self.fortCtrl.getFort()
     level = fort.level
     levelTxt = fort_formatters.getTextLevel(level)
     defResQuantity = fort.getTotalDefRes()
     defResPrefix = text_styles.main(i18n.makeString(FORTIFICATIONS.FORTMAINVIEW_COMMON_TOTALDEPOTQUANTITYTEXT))
     disabledTransporting = False
     if self.__currentMode in (FORTIFICATION_ALIASES.MODE_TRANSPORTING_FIRST_STEP, FORTIFICATION_ALIASES.MODE_TRANSPORTING_NEXT_STEP, FORTIFICATION_ALIASES.MODE_TRANSPORTING_NOT_AVAILABLE):
         if not self.fortCtrl.getFort().isTransportationAvailable():
             disabledTransporting = True
     return {'clanName': g_clanCache.clanTag,
      'levelTitle': i18n.makeString(FORTIFICATIONS.FORTMAINVIEW_HEADER_LEVELSLBL, buildLevel=levelTxt),
      'defResText': defResPrefix + fort_formatters.getDefRes(defResQuantity, True),
      'disabledTransporting': disabledTransporting,
      'orderSelectorVO': {'isSelected': AccountSettings.getFilter(ORDERS_FILTER)['isSelected'],
                          'icon': RES_ICONS.MAPS_ICONS_LIBRARY_FORTIFICATION_AIM}}
Esempio n. 11
0
    def __makeDivisionsData(self, list):
        result = []
        for item in list:
            divisionType = {}
            title = i18n.makeString(item['label'])
            profit = fort_formatters.getDefRes(item['profit'])
            minLevel = 1
            maxLevel = item['level']
            divisionType['divisionName'] = self.app.utilsManager.textManager.getText(TextType.HIGH_TITLE, i18n.makeString(I18N_FORTIFICATIONS.CHOICEDIVISION_DIVISIONFULLNAME, divisionType=title))
            divisionType['divisionProfit'] = self.app.utilsManager.textManager.getText(TextType.STANDARD_TEXT, i18n.makeString(I18N_FORTIFICATIONS.CHOICEDIVISION_DIVISIONPROFIT, defResCount=profit))
            minLevelStr = self.app.utilsManager.textManager.getText(TextType.MAIN_TEXT, fort_formatters.getTextLevel(minLevel))
            maxLevelStr = self.app.utilsManager.textManager.getText(TextType.MAIN_TEXT, fort_formatters.getTextLevel(maxLevel))
            divisionType['vehicleLevel'] = self.app.utilsManager.textManager.getText(TextType.STANDARD_TEXT, i18n.makeString(I18N_FORTIFICATIONS.CHOICEDIVISION_VEHICLELEVEL, minLevel=minLevelStr, maxLevel=maxLevelStr))
            divisionType['divisionID'] = maxLevel
            minCount, maxCount = self.__getPlayerLimits(maxLevel)
            divisionType['playerRange'] = self.__makePlayerCount(minCount, maxCount)
            result.append(divisionType)

        return result
Esempio n. 12
0
 def _update(self):
     prefix = i18n.makeString(
         FORTIFICATIONS.
         FORTTRANSPORTCONFIRMATIONWINDOW_MAXTRANSPORTINGSIZELABEL)
     stdText = text_styles.standard(prefix)
     defResText = fort_formatters.getDefRes(self.getTransportingSize(),
                                            True)
     self.as_setMaxTransportingSizeS(stdText + defResText)
     clockIcon = icons.clock()
     time = time_formatters.getTimeDurationStr(
         self.fortCtrl.getFort().getTransportationLevel().cooldownTime)
     ctx = {'estimatedTime': time}
     estimatedTextString = i18n.makeString(
         FORTIFICATIONS.
         FORTTRANSPORTCONFIRMATIONWINDOW_TRANSPORTINGFOOTERTEXT, **ctx)
     estimatedText = text_styles.standard(estimatedTextString)
     self.as_setFooterTextS(clockIcon + estimatedText)
     data = self.__buildData()
     self.as_setDataS(data)
     isFirstTransporting = self._isTutorial()
     self.as_enableForFirstTransportingS(isFirstTransporting)
 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
 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