コード例 #1
0
 def _getCompleteStatusFields(self, *args):
     quest = self.event
     if quest.areTokensPawned():
         statusTooltipData = {
             'tooltip':
             makeTooltip(
                 header=TOOLTIPS.
                 PERSONALMISSIONS_STATUS_DONEWITHPAWN_HEADER,
                 body=TOOLTIPS.PERSONALMISSIONS_STATUS_DONEWITHPAWN_BODY)
         }
         count = text_styles.stats(
             str(quest.getPawnCost()) + AWARD_SHEET_ICON)
         statusLabel = text_styles.bonusAppliedText(
             icons.checkmark() +
             _ms(QUESTS.PERSONALMISSION_STATUS_DONEWITHPAWN, count=count))
     else:
         statusLabel = text_styles.bonusAppliedText(
             icons.checkmark() +
             _ms(QUESTS.PERSONALMISSION_STATUS_MAINDONE))
         statusTooltipData = {
             'tooltip':
             makeTooltip(
                 header=TOOLTIPS.PERSONALMISSIONS_STATUS_MAINDONE_HEADER,
                 body=TOOLTIPS.PERSONALMISSIONS_STATUS_MAINDONE_BODY)
         }
     return {
         'statusLabel': statusLabel,
         'status': MISSIONS_STATES.COMPLETED,
         'statusTooltipData': statusTooltipData
     }
コード例 #2
0
 def __updateNotActivatedView(self):
     _ms = i18n.makeString
     titleText = text_styles.promoTitle(_ms(FORTIFICATIONS.SETTINGSWINDOW_NOTACTIVATED_TITLE))
     description = text_styles.main(_ms(FORTIFICATIONS.SETTINGSWINDOW_NOTACTIVATED_DESCRIPTION))
     conditionTitle = text_styles.middleTitle(_ms(FORTIFICATIONS.SETTINGSWINDOW_NOTACTIVATED_CONDITIONTITLE))
     firstConditionIcon = icons.checkmark()
     secondConditionIcon = icons.checkmark()
     conditionsText = text_styles.middleTitle(_ms(FORTIFICATIONS.SETTINGSWINDOW_NOTACTIVATED_CONDITIONS))
     fortConditionsText = text_styles.main(_ms(FORTIFICATIONS.SETTINGSWINDOW_NOTACTIVATED_CONDITIONS_FORTLEVEL))
     defenceConditionsText = text_styles.main(_ms(FORTIFICATIONS.SETTINGSWINDOW_NOTACTIVATED_CONDITIONS_DEFENCE))
     attackConditionsText = text_styles.main(_ms(FORTIFICATIONS.SETTINGSWINDOW_NOTACTIVATED_CONDITIONS_ATTACK))
     firstConditionNotReady = ""
     secondConditionNotReady = ""
     if not self.__checkBaseLevel():
         firstConditionIcon = text_styles.standard("-")
         firstConditionNotReady = text_styles.error(_ms(FORTIFICATIONS.SETTINGSWINDOW_NOTACTIVATED_ISNOTREADY))
     if not self.__checkPlayerCount():
         secondConditionIcon = text_styles.standard("-")
         secondConditionNotReady = text_styles.error(_ms(FORTIFICATIONS.SETTINGSWINDOW_NOTACTIVATED_ISNOTREADY))
     firstConditionMsg = text_styles.main(
         _ms(
             FORTIFICATIONS.SETTINGSWINDOW_NOTACTIVATED_BASELEVELCONDITION,
             level=fort_formatters.getTextLevel(g_fortCache.defenceConditions.minRegionLevel),
             isNotReady=firstConditionNotReady,
         )
     )
     secondConditionMsg = text_styles.main(
         _ms(
             FORTIFICATIONS.SETTINGSWINDOW_NOTACTIVATED_PLAYERCOUNTCONDITION,
             membersCount=BigWorld.wg_getNiceNumberFormat(g_fortCache.defenceConditions.minClanMembers),
             isNotReady=secondConditionNotReady,
         )
     )
     fortCondition = firstConditionMsg
     secondCondition = secondConditionMsg
     settingsBlockTop = self.__makeSettingsBlockVO(True)
     settingsBlockBottom = self.__makeSettingsBlockVO(False)
     result = {
         "titleText": titleText,
         "description": description,
         "conditionTitle": conditionTitle,
         "firstCondition": fortCondition,
         "secondCondition": secondCondition,
         "conditionsText": conditionsText,
         "fortConditionsText": fortConditionsText,
         "defenceConditionsText": defenceConditionsText,
         "attackConditionsText": attackConditionsText,
         "isBtnEnabled": self.__checkConditions(),
         "btnToolTipData": self.__getButtonToolTip(),
         "firstStatus": firstConditionIcon,
         "secondStatus": secondConditionIcon,
         "settingsBlockTop": settingsBlockTop,
         "settingsBlockBottom": settingsBlockBottom,
     }
     self.as_setDataForNotActivatedS(result)
コード例 #3
0
 def _getStatusBlock(cls, quest):
     isAvailable, reason = quest.isAvailable()
     if not isAvailable:
         if reason == 'noVehicle':
             key = TOOLTIPS.PERSONALMISSIONS_MAPREGION_FOOTER_TITLE_NOVEHICLE
         else:
             key = TOOLTIPS.PERSONALMISSIONS_MAPREGION_FOOTER_TITLE_NOTAVAILABLE
         text = text_styles.concatStylesWithSpace(icons.markerBlocked(-2),
                                                  text_styles.error(key))
     elif quest.isInProgress():
         if quest.isOnPause:
             text = text_styles.concatStylesWithSpace(
                 icons.makeImageTag(RES_ICONS.MAPS_ICONS_LIBRARY_ONPAUSE,
                                    16, 16, -3, 8),
                 text_styles.playerOnline(
                     TOOLTIPS.
                     PERSONALMISSIONS_MAPREGION_FOOTER_TITLE_ONPAUSE))
         elif quest.areTokensPawned():
             label = _ms(
                 TOOLTIPS.
                 PERSONALMISSIONS_MAPREGION_FOOTER_TITLE_SHEETRECOVERYINPROGRESS,
                 icon=missions_helper.getHtmlAwardSheetIcon(
                     quest.getQuestBranch()),
                 count=quest.getPawnCost())
             text = text_styles.concatStylesWithSpace(
                 icons.inProgress(-1), text_styles.neutral(label))
         else:
             text = text_styles.concatStylesWithSpace(
                 icons.inProgress(-1),
                 text_styles.neutral(
                     TOOLTIPS.
                     PERSONALMISSIONS_MAPREGION_FOOTER_TITLE_INPROGRESS))
     elif quest.isCompleted():
         if quest.areTokensPawned():
             text = text_styles.concatStylesWithSpace(
                 icons.checkmark(-2),
                 text_styles.bonusAppliedText(
                     TOOLTIPS.
                     PERSONALMISSIONS_MAPREGION_FOOTER_TITLE_DONEFREESHEET),
                 missions_helper.getHtmlAwardSheetIcon(
                     quest.getQuestBranch()),
                 text_styles.stats('x%s' % quest.getPawnCost()))
         else:
             text = text_styles.concatStylesWithSpace(
                 icons.checkmark(-2),
                 text_styles.bonusAppliedText(
                     TOOLTIPS.PERSONALMISSIONS_MAPREGION_FOOTER_TITLE_DONE))
     else:
         text = text_styles.main(
             TOOLTIPS.PERSONALMISSIONS_MAPREGION_FOOTER_TITLE_AVAILABLE)
     return formatters.packAlignedTextBlockData(
         text=text,
         align=BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER,
         padding=formatters.packPadding(top=-5, bottom=-5))
コード例 #4
0
 def __getObtainedStatus(self, isAlliance):
     return text_styles.concatStylesWithSpace(
         icons.checkmark(-2),
         text_styles.statInfo(
             PERSONAL_MISSIONS.TANKMODULETOOLTIPDATA_STATUS_OBTAINED
             if not isAlliance else PERSONAL_MISSIONS.
             TANKMODULETOOLTIPDATA_STATUS_ALLIANCE_OBTAINED))
コード例 #5
0
 def _packProgressStateBlock(self):
     currentLevel = self._item.getLatestOpenedProgressionLevel(
         self.__vehicle)
     if currentLevel == -1 and self._progressionLevel == 1:
         currentLevel = 0
     if self._progressionLevel < 1:
         return None
     else:
         if currentLevel >= self._progressionLevel:
             desc = text_styles.concatStylesToSingleLine(
                 icons.checkmark(),
                 text_styles.bonusAppliedText(
                     getProgressionItemStatusText(self._progressionLevel)))
         elif currentLevel + 1 == self._progressionLevel:
             desc = text_styles.concatStylesToSingleLine(
                 icons.inProgress(),
                 text_styles.neutral(
                     backport.text(
                         R.strings.vehicle_customization.customization.
                         infotype.progression.inProgressState())))
         else:
             desc = text_styles.concatStylesToSingleLine(
                 icons.markerBlocked(),
                 text_styles.error(
                     backport.text(
                         R.strings.vehicle_customization.customization.
                         infotype.progression.notAvailableState.title())))
             desc = text_styles.concatStylesToMultiLine(
                 desc,
                 text_styles.main(
                     backport.text(
                         R.strings.vehicle_customization.customization.
                         infotype.progression.notAvailableState.desc())))
         return formatters.packAlignedTextBlockData(
             text=desc, align=BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER)
コード例 #6
0
 def __updateStatus(self):
     prefix = i18n.makeString(FORTIFICATIONS.SETTINGSDEFENCEHOURPOPOVER_DEFENCEHOURTITLE)
     prefix = text_styles.highTitle(prefix)
     if self._isFortFrozen():
         toolTip = i18n.makeString(TOOLTIPS.FORTIFICATION_FORTSETTINGSWINDOW_STATUSSTRING_FREEZED)
         icon = RES_ICONS.MAPS_ICONS_LIBRARY_ERRORICON_1
         imageSource = icons.makeImageTag(icon, 16, 16, -4, 0)
         currentStatus = text_styles.error(i18n.makeString(FORTIFICATIONS.SETTINGSWINDOW_STATUSMSG_FREEZED))
         currentStatus = imageSource + " " + currentStatus
     elif self.__defencePeriod:
         toolTip = i18n.makeString(TOOLTIPS.FORTIFICATION_FORTSETTINGSWINDOW_STATUSSTRING_ACTIVATED)
         currentStatus = "".join(
             (
                 icons.checkmark(),
                 text_styles.success(" " + i18n.makeString(FORTIFICATIONS.SETTINGSWINDOW_STATUSMSG_ACTIVATED)),
             )
         )
     elif self.__checkConditions():
         toolTip = i18n.makeString(TOOLTIPS.FORTIFICATION_FORTSETTINGSWINDOW_STATUSSTRING_CANBEACTIVATED)
         currentStatus = "".join(
             (
                 icons.alert(),
                 text_styles.alert(" " + i18n.makeString(FORTIFICATIONS.SETTINGSWINDOW_STATUSMSG_NOTACTIVATED)),
             )
         )
     else:
         toolTip = i18n.makeString(TOOLTIPS.FORTIFICATION_FORTSETTINGSWINDOW_STATUSSTRING_CANNOTBEACTIVATED)
         currentStatus = "".join(
             (
                 icons.notAvailable(),
                 text_styles.standard(" " + i18n.makeString(FORTIFICATIONS.SETTINGSWINDOW_STATUSMSG_NOTAVAILABLE)),
             )
         )
     self.as_setMainStatusS(prefix, currentStatus, toolTip)
コード例 #7
0
 def requestBuildingInfo(self, uid):
     infoData = {}
     id = self.getBuildingIDbyUID(uid)
     self.__markAsVisited(id)
     buildingStatus = self.__getBuildingStatus(id)
     infoData['buildingName'] = text_styles.highTitle(
         i18n.makeString(FORTIFICATIONS.buildings_buildingname(uid)))
     infoData['buildingID'] = uid
     infoData['longDescr'] = text_styles.standard(
         i18n.makeString(FORTIFICATIONS.buildingsprocess_longdescr(uid)))
     buttonLbl = FORTIFICATIONS.BUILDINGSPROCESS_BUTTONLBL
     if buildingStatus == self.BUILDING_STATUS.BUILT:
         buttonLbl = text_styles.standard(
             i18n.makeString(
                 FORTIFICATIONS.BUILDINGSPROCESS_BUTTONLBLBUILT))
     infoData['buttonLabel'] = i18n.makeString(buttonLbl)
     infoData['orderInfo'] = self.__makeOrderInfoData(uid)
     isVisibleBtn = True
     isEnableBtn = True
     statusMsg = ''
     statusIconTooltip = None
     if buildingStatus == self.BUILDING_STATUS.BUILT:
         statusMsg = ''.join(
             (icons.checkmark(),
              text_styles.success(
                  i18n.makeString(
                      FORTIFICATIONS.BUILDINGSPROCESS_STATUSMSG_BUILT))))
         isEnableBtn = False
         isVisibleBtn = False
         statusIconTooltip = self.__makeStatusTooltip(True)
         buttonTooltip = self.__makeButtonTooltip(
             self.BUILDING_STATUS.BUILT, None)
     elif buildingStatus == self.BUILDING_STATUS.NOT_AVAILABLE:
         isEnableBtn = False
         isVisibleBtn = True
         statusMsg = text_styles.error(
             i18n.makeString(FORTIFICATIONS.
                             BUILDINGSPROCESS_BUILDINGINFO_STATUSMESSAGE))
         imageSource = icons.makeImageTag(
             RES_ICONS.MAPS_ICONS_LIBRARY_REDNOTAVAILABLE, 12, 12, 0, 0)
         statusMsg = imageSource + ' ' + statusMsg
         statusIconTooltip = self.__makeStatusTooltip(False)
         buttonTooltip = self.__makeButtonTooltip(
             self.BUILDING_STATUS.NOT_AVAILABLE, None)
     else:
         buttonTooltip = self.__makeButtonTooltip(
             self.BUILDING_STATUS.AVAILABLE,
             i18n.makeString(FORTIFICATIONS.buildings_buildingname(uid)))
     infoData['isVisibleBtn'] = isVisibleBtn
     infoData['isEnableBtn'] = isEnableBtn
     infoData['statusMsg'] = statusMsg
     infoData['statusIconTooltip'] = statusIconTooltip
     infoData['buttonTooltip'] = buttonTooltip
     buildingIcon = FortViewHelper.getPopoverIconSource(
         uid, FORT_BATTLE_DIVISIONS.ABSOLUTE.maxFortLevel)
     infoData['buildingIcon'] = buildingIcon
     self.as_responseBuildingInfoS(infoData)
     return
コード例 #8
0
 def _getBottom(self, value):
     if value > 0:
         formater = text_styles.main
         icon = ''
         tooltipText = R.strings.tooltips.hangar.header.quests.bottom()
     else:
         formater = text_styles.success
         icon = icons.checkmark()
         tooltipText = R.strings.tooltips.hangar.header.quests.bottom.empty()
     return formatters.packTextBlockData(text=makeHtmlString('html_templates:lobby/textStyle', 'alignText', {'align': 'center',
      'message': formater('{0}{1}'.format(icon, backport.text(tooltipText, count=value)))}), padding=formatters.packPadding(top=-10, bottom=10))
コード例 #9
0
 def __updateNotActivatedView(self):
     _ms = i18n.makeString
     titleText = text_styles.promoTitle(_ms(FORTIFICATIONS.SETTINGSWINDOW_NOTACTIVATED_TITLE))
     description = text_styles.main(_ms(FORTIFICATIONS.SETTINGSWINDOW_NOTACTIVATED_DESCRIPTION))
     conditionTitle = text_styles.middleTitle(_ms(FORTIFICATIONS.SETTINGSWINDOW_NOTACTIVATED_CONDITIONTITLE))
     firstConditionIcon = icons.checkmark()
     secondConditionIcon = icons.checkmark()
     conditionsText = text_styles.middleTitle(_ms(FORTIFICATIONS.SETTINGSWINDOW_NOTACTIVATED_CONDITIONS))
     fortConditionsText = text_styles.main(_ms(FORTIFICATIONS.SETTINGSWINDOW_NOTACTIVATED_CONDITIONS_FORTLEVEL))
     defenceConditionsText = text_styles.main(_ms(FORTIFICATIONS.SETTINGSWINDOW_NOTACTIVATED_CONDITIONS_DEFENCE))
     attackConditionsText = text_styles.main(_ms(FORTIFICATIONS.SETTINGSWINDOW_NOTACTIVATED_CONDITIONS_ATTACK))
     firstConditionNotReady = ''
     secondConditionNotReady = ''
     if not self.__checkBaseLevel():
         firstConditionIcon = text_styles.standard('-')
         firstConditionNotReady = text_styles.error(_ms(FORTIFICATIONS.SETTINGSWINDOW_NOTACTIVATED_ISNOTREADY))
     if not self.__checkPlayerCount():
         secondConditionIcon = text_styles.standard('-')
         secondConditionNotReady = text_styles.error(_ms(FORTIFICATIONS.SETTINGSWINDOW_NOTACTIVATED_ISNOTREADY))
     firstConditionMsg = text_styles.main(_ms(FORTIFICATIONS.SETTINGSWINDOW_NOTACTIVATED_BASELEVELCONDITION, level=fort_formatters.getTextLevel(g_fortCache.defenceConditions.minRegionLevel), isNotReady=firstConditionNotReady))
     secondConditionMsg = text_styles.main(_ms(FORTIFICATIONS.SETTINGSWINDOW_NOTACTIVATED_PLAYERCOUNTCONDITION, membersCount=BigWorld.wg_getNiceNumberFormat(g_fortCache.defenceConditions.minClanMembers), isNotReady=secondConditionNotReady))
     fortCondition = firstConditionMsg
     secondCondition = secondConditionMsg
     settingsBlockTop = self.__makeSettingsBlockVO(True)
     settingsBlockBottom = self.__makeSettingsBlockVO(False)
     result = {'titleText': titleText,
      'description': description,
      'conditionTitle': conditionTitle,
      'firstCondition': fortCondition,
      'secondCondition': secondCondition,
      'conditionsText': conditionsText,
      'fortConditionsText': fortConditionsText,
      'defenceConditionsText': defenceConditionsText,
      'attackConditionsText': attackConditionsText,
      'isBtnEnabled': self.__checkConditions(),
      'btnToolTipData': self.__getButtonToolTip(),
      'firstStatus': firstConditionIcon,
      'secondStatus': secondConditionIcon,
      'settingsBlockTop': settingsBlockTop,
      'settingsBlockBottom': settingsBlockBottom}
     self.as_setDataForNotActivatedS(result)
コード例 #10
0
 def _getBottom(self, value):
     if value > 0:
         formater = text_styles.main
         icon = ''
         tooltipText = TOOLTIPS.HANGAR_HEADER_QUESTS_BOTTOM
     else:
         formater = text_styles.success
         icon = icons.checkmark()
         tooltipText = TOOLTIPS.HANGAR_HEADER_QUESTS_BOTTOM_EMPTY
     return formatters.packTextBlockData(text=makeHtmlString(
         'html_templates:lobby/textStyle', 'alignText', {
             'align':
             'center',
             'message':
             formater('{0}{1}'.format(icon, _ms(tooltipText, count=value)))
         }),
                                         padding=formatters.packPadding(
                                             top=-10, bottom=10))
コード例 #11
0
 def __makeQuestDetailsInfo(self, questID):
     quest = events_helpers.getPotapovQuestsCache().getQuests()[questID]
     questInfoData = events_helpers.getEventInfoData(quest)
     self._navInfo.selectPotapovQuest(self.__tile.getID(), questID)
     vehMinLevel, vehClasses = quest.getVehMinLevel(), quest.getVehicleClasses()
     if vehMinLevel > 1:
         reqsHeader = text_styles.middleTitle(_ms(QUESTS.QUESTTASKDETAILSVIEW_REQUIREMENTS))
         if quest.getQuestBranch() == PQ_BRANCH.REGULAR:
             reqs = _ms(QUESTS.QUESTTASKDETAILSVIEW_REQUIREMENTS_TEXT, level=int2roman(vehMinLevel), vehType=', '.join([ Vehicle.getTypeShortUserName(vc) for vc in vehClasses ]))
         elif vehMinLevel < 10:
             reqs = _ms(QUESTS.QUESTTASKDETAILSVIEW_REQUIREMENTS_MORE8LVL)
         else:
             reqs = _ms(QUESTS.QUESTTASKDETAILSVIEW_REQUIREMENTS_ONLY10LVL)
     else:
         reqsHeader = reqs = ''
     condition = makeHtmlString('html_templates:lobby/quests/potapov', 'questDetails', ctx={'mainCondHeader': text_styles.middleTitle(_ms(QUESTS.QUESTTASKDETAILSVIEW_MAINCONDITIONS)),
      'mainCond': quest.getUserMainCondition(),
      'addCondHeader': text_styles.middleTitle(_ms(QUESTS.QUESTTASKDETAILSVIEW_ADDITIONALCONDITIONS)),
      'addCond': quest.getUserAddCondition(),
      'requirementsHeader': reqsHeader,
      'requirements': reqs,
      'adviseHeader': text_styles.middleTitle(_ms(QUESTS.QUESTTASKDETAILSVIEW_DESCRIPTION)),
      'advise': quest.getUserAdvice(),
      'descr': quest.getUserDescription()})
     if not quest.isUnlocked():
         btnInfo = _makeSelectBtn(QUESTS.QUESTTASKDETAILSVIEW_BTNLABEL_BEGIN, enabled=False, descr=text_styles.error(icons.notAvailableRed() + ' ' + _ms(self._lockedMessageStrKey)))
     elif quest.needToGetReward():
         btnInfo = _makeSelectBtn(QUESTS.QUESTTASKDETAILSVIEW_BTNLABEL_TAKEAWARD, TOOLTIPS.PRIVATEQUESTS_ACTIONPANNEL_RECEIVETHEAWARD, _ms(QUESTS.QUESTTASKDETAILSVIEW_TASKDESCRIPTION_TAKEAWARD))
     elif quest.isInProgress():
         btnInfo = _makeRefuseBtn(QUESTS.QUESTTASKDETAILSVIEW_BTNLABEL_CANCEL, TOOLTIPS.PRIVATEQUESTS_ACTIONPANNEL_ABORT, _ms(QUESTS.QUESTTASKDETAILSVIEW_TASKDESCRIPTION_INPROGRESS))
     elif quest.isFullCompleted():
         btnInfo = _makeNoBtn(text_styles.success(icons.checkmark() + _ms(QUESTS.QUESTTASKDETAILSVIEW_TASKDESCRIPTION_EXCELLENTDONE)))
     elif quest.isMainCompleted():
         btnInfo = _makeSelectBtn(QUESTS.QUESTTASKDETAILSVIEW_BTNLABEL_REPEAT, TOOLTIPS.PRIVATEQUESTS_ACTIONPANNEL_REPEAT, text_styles.success(icons.checkmark() + _ms(QUESTS.QUESTTASKDETAILSVIEW_TASKDESCRIPTION_DONE)))
     else:
         btnInfo = _makeSelectBtn(QUESTS.QUESTTASKDETAILSVIEW_BTNLABEL_BEGIN, TOOLTIPS.PRIVATEQUESTS_ACTIONPANNEL_PERFORM, _ms(QUESTS.QUESTTASKDETAILSVIEW_TASKDESCRIPTION_AVAILABLE))
     mainAwards, addAwards = questInfoData._getBonuses(events_helpers.getPotapovQuestsCache().getQuests().values())
     result = {'taskID': questID,
      'headerText': text_styles.highTitle(quest.getUserName()),
      'conditionsText': condition,
      'mainAwards': mainAwards,
      'addAwards': addAwards}
     result.update(btnInfo._asdict())
     return result
コード例 #12
0
 def __updateStatus(self):
     prefix = i18n.makeString(FORTIFICATIONS.SETTINGSDEFENCEHOURPOPOVER_DEFENCEHOURTITLE)
     prefix = text_styles.highTitle(prefix)
     if self._isFortFrozen():
         toolTip = i18n.makeString(TOOLTIPS.FORTIFICATION_FORTSETTINGSWINDOW_STATUSSTRING_FREEZED)
         icon = RES_ICONS.MAPS_ICONS_LIBRARY_ERRORICON_1
         imageSource = icons.makeImageTag(icon, 16, 16, -4, 0)
         currentStatus = text_styles.error(i18n.makeString(FORTIFICATIONS.SETTINGSWINDOW_STATUSMSG_FREEZED))
         currentStatus = imageSource + ' ' + currentStatus
     elif self.__defencePeriod:
         toolTip = i18n.makeString(TOOLTIPS.FORTIFICATION_FORTSETTINGSWINDOW_STATUSSTRING_ACTIVATED)
         currentStatus = ''.join((icons.checkmark(), text_styles.success(' ' + i18n.makeString(FORTIFICATIONS.SETTINGSWINDOW_STATUSMSG_ACTIVATED))))
     elif self.__checkConditions():
         toolTip = i18n.makeString(TOOLTIPS.FORTIFICATION_FORTSETTINGSWINDOW_STATUSSTRING_CANBEACTIVATED)
         currentStatus = ''.join((icons.alert(), text_styles.alert(' ' + i18n.makeString(FORTIFICATIONS.SETTINGSWINDOW_STATUSMSG_NOTACTIVATED))))
     else:
         toolTip = i18n.makeString(TOOLTIPS.FORTIFICATION_FORTSETTINGSWINDOW_STATUSSTRING_CANNOTBEACTIVATED)
         currentStatus = ''.join((icons.notAvailable(), text_styles.standard(' ' + i18n.makeString(FORTIFICATIONS.SETTINGSWINDOW_STATUSMSG_NOTAVAILABLE))))
     self.as_setMainStatusS(prefix, currentStatus, toolTip)
コード例 #13
0
 def requestBuildingInfo(self, uid):
     infoData = {}
     id = self.getBuildingIDbyUID(uid)
     self.__markAsVisited(id)
     buildingStatus = self.__getBuildingStatus(id)
     infoData['buildingName'] = text_styles.highTitle(i18n.makeString(FORTIFICATIONS.buildings_buildingname(uid)))
     infoData['buildingID'] = uid
     infoData['longDescr'] = text_styles.standard(i18n.makeString(FORTIFICATIONS.buildingsprocess_longdescr(uid)))
     buttonLbl = FORTIFICATIONS.BUILDINGSPROCESS_BUTTONLBL
     if buildingStatus == self.BUILDING_STATUS.BUILT:
         buttonLbl = text_styles.standard(i18n.makeString(FORTIFICATIONS.BUILDINGSPROCESS_BUTTONLBLBUILT))
     infoData['buttonLabel'] = i18n.makeString(buttonLbl)
     infoData['orderInfo'] = self.__makeOrderInfoData(uid)
     isVisibleBtn = True
     isEnableBtn = True
     statusMsg = ''
     statusIconTooltip = None
     if buildingStatus == self.BUILDING_STATUS.BUILT:
         statusMsg = ''.join((icons.checkmark(), text_styles.success(i18n.makeString(FORTIFICATIONS.BUILDINGSPROCESS_STATUSMSG_BUILT))))
         isEnableBtn = False
         isVisibleBtn = False
         statusIconTooltip = self.__makeStatusTooltip(True)
         buttonTooltip = self.__makeButtonTooltip(self.BUILDING_STATUS.BUILT, None)
     elif buildingStatus == self.BUILDING_STATUS.NOT_AVAILABLE:
         isEnableBtn = False
         isVisibleBtn = True
         statusMsg = text_styles.error(i18n.makeString(FORTIFICATIONS.BUILDINGSPROCESS_BUILDINGINFO_STATUSMESSAGE))
         imageSource = icons.makeImageTag(RES_ICONS.MAPS_ICONS_LIBRARY_REDNOTAVAILABLE, 12, 12, 0, 0)
         statusMsg = imageSource + ' ' + statusMsg
         statusIconTooltip = self.__makeStatusTooltip(False)
         buttonTooltip = self.__makeButtonTooltip(self.BUILDING_STATUS.NOT_AVAILABLE, None)
     else:
         buttonTooltip = self.__makeButtonTooltip(self.BUILDING_STATUS.AVAILABLE, i18n.makeString(FORTIFICATIONS.buildings_buildingname(uid)))
     infoData['isVisibleBtn'] = isVisibleBtn
     infoData['isEnableBtn'] = isEnableBtn
     infoData['statusMsg'] = statusMsg
     infoData['statusIconTooltip'] = statusIconTooltip
     infoData['buttonTooltip'] = buttonTooltip
     buildingIcon = FortViewHelper.getPopoverIconSource(uid, FORT_BATTLE_DIVISIONS.ABSOLUTE.maxFortLevel)
     infoData['buildingIcon'] = buildingIcon
     self.as_responseBuildingInfoS(infoData)
     return
コード例 #14
0
 def __getStrings(self, value, status):
     id = value
     name = text_styles.middleTitle(
         i18n.makeString(FORTIFICATIONS.buildings_buildingname(id)))
     shortDescr = text_styles.standard(
         i18n.makeString(FORTIFICATIONS.buildingsprocess_shortdescr(id)))
     statusMsg = ''
     if status == self.BUILDING_STATUS.AVAILABLE:
         return (id, name, shortDescr, statusMsg, status)
     if status == self.BUILDING_STATUS.NOT_AVAILABLE:
         icon = icons.notAvailable()
         statusMsg = text_styles.standard(
             i18n.makeString(
                 FORTIFICATIONS.BUILDINGSPROCESS_STATUSMSG_NOTAVAILABLE))
     else:
         icon = icons.checkmark()
         statusMsg = text_styles.success(
             i18n.makeString(
                 FORTIFICATIONS.BUILDINGSPROCESS_STATUSMSG_BUILT))
     statusMsg = ''.join((icon, statusMsg))
     return (id, name, shortDescr, statusMsg, status)
コード例 #15
0
 def __getStrings(self, value, status):
     id = value
     name = text_styles.middleTitle(i18n.makeString(FORTIFICATIONS.buildings_buildingname(id)))
     shortDescr = text_styles.standard(i18n.makeString(FORTIFICATIONS.buildingsprocess_shortdescr(id)))
     statusMsg = ''
     if status == self.BUILDING_STATUS.AVAILABLE:
         return (id,
          name,
          shortDescr,
          statusMsg,
          status)
     if status == self.BUILDING_STATUS.NOT_AVAILABLE:
         icon = icons.notAvailable()
         statusMsg = text_styles.standard(i18n.makeString(FORTIFICATIONS.BUILDINGSPROCESS_STATUSMSG_NOTAVAILABLE))
     else:
         icon = icons.checkmark()
         statusMsg = text_styles.success(i18n.makeString(FORTIFICATIONS.BUILDINGSPROCESS_STATUSMSG_BUILT))
     statusMsg = ''.join((icon, statusMsg))
     return (id,
      name,
      shortDescr,
      statusMsg,
      status)
コード例 #16
0
 def __makeQuestDetailsInfo(self, questID):
     quest = events_helpers.getPotapovQuestsCache().getQuests()[questID]
     questInfoData = events_helpers.getEventInfoData(quest)
     self._navInfo.selectPotapovQuest(self.__tile.getID(), questID)
     vehMinLevel, vehClasses = quest.getVehMinLevel(
     ), quest.getVehicleClasses()
     if vehMinLevel > 1:
         reqsHeader = text_styles.middleTitle(
             _ms(QUESTS.QUESTTASKDETAILSVIEW_REQUIREMENTS))
         if quest.getQuestBranch() == PQ_BRANCH.REGULAR:
             reqs = _ms(QUESTS.QUESTTASKDETAILSVIEW_REQUIREMENTS_TEXT,
                        level=int2roman(vehMinLevel),
                        vehType=', '.join([
                            Vehicle.getTypeShortUserName(vc)
                            for vc in vehClasses
                        ]))
         elif vehMinLevel < 10:
             reqs = _ms(QUESTS.QUESTTASKDETAILSVIEW_REQUIREMENTS_MORE8LVL)
         else:
             reqs = _ms(QUESTS.QUESTTASKDETAILSVIEW_REQUIREMENTS_ONLY10LVL)
     else:
         reqsHeader = reqs = ''
     condition = makeHtmlString(
         'html_templates:lobby/quests/potapov',
         'questDetails',
         ctx={
             'mainCondHeader':
             text_styles.middleTitle(
                 _ms(QUESTS.QUESTTASKDETAILSVIEW_MAINCONDITIONS)),
             'mainCond':
             quest.getUserMainCondition(),
             'addCondHeader':
             text_styles.middleTitle(
                 _ms(QUESTS.QUESTTASKDETAILSVIEW_ADDITIONALCONDITIONS)),
             'addCond':
             quest.getUserAddCondition(),
             'requirementsHeader':
             reqsHeader,
             'requirements':
             reqs,
             'adviseHeader':
             text_styles.middleTitle(
                 _ms(QUESTS.QUESTTASKDETAILSVIEW_DESCRIPTION)),
             'advise':
             quest.getUserAdvice(),
             'descr':
             quest.getUserDescription()
         })
     if not quest.isUnlocked():
         btnInfo = _makeSelectBtn(
             QUESTS.QUESTTASKDETAILSVIEW_BTNLABEL_BEGIN,
             enabled=False,
             descr=text_styles.error(icons.notAvailableRed() + ' ' +
                                     _ms(self._lockedMessageStrKey)))
     elif quest.needToGetReward():
         btnInfo = _makeSelectBtn(
             QUESTS.QUESTTASKDETAILSVIEW_BTNLABEL_TAKEAWARD,
             TOOLTIPS.PRIVATEQUESTS_ACTIONPANNEL_RECEIVETHEAWARD,
             _ms(QUESTS.QUESTTASKDETAILSVIEW_TASKDESCRIPTION_TAKEAWARD))
     elif quest.isInProgress():
         btnInfo = _makeRefuseBtn(
             QUESTS.QUESTTASKDETAILSVIEW_BTNLABEL_CANCEL,
             TOOLTIPS.PRIVATEQUESTS_ACTIONPANNEL_ABORT,
             _ms(QUESTS.QUESTTASKDETAILSVIEW_TASKDESCRIPTION_INPROGRESS))
     elif quest.isFullCompleted():
         btnInfo = _makeNoBtn(
             text_styles.success(icons.checkmark() + _ms(
                 QUESTS.QUESTTASKDETAILSVIEW_TASKDESCRIPTION_EXCELLENTDONE))
         )
     elif quest.isMainCompleted():
         btnInfo = _makeSelectBtn(
             QUESTS.QUESTTASKDETAILSVIEW_BTNLABEL_REPEAT,
             TOOLTIPS.PRIVATEQUESTS_ACTIONPANNEL_REPEAT,
             text_styles.success(
                 icons.checkmark() +
                 _ms(QUESTS.QUESTTASKDETAILSVIEW_TASKDESCRIPTION_DONE)))
     else:
         btnInfo = _makeSelectBtn(
             QUESTS.QUESTTASKDETAILSVIEW_BTNLABEL_BEGIN,
             TOOLTIPS.PRIVATEQUESTS_ACTIONPANNEL_PERFORM,
             _ms(QUESTS.QUESTTASKDETAILSVIEW_TASKDESCRIPTION_AVAILABLE))
     mainAwards, addAwards = questInfoData._getBonuses(
         events_helpers.getPotapovQuestsCache().getQuests().values())
     result = {
         'taskID': questID,
         'headerText': text_styles.highTitle(quest.getUserName()),
         'conditionsText': condition,
         'mainAwards': mainAwards,
         'addAwards': addAwards
     }
     result.update(btnInfo._asdict())
     return result
コード例 #17
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
コード例 #18
0
 def __getObtainedStatus(self):
     return text_styles.concatStylesWithSpace(
         icons.checkmark(-2),
         text_styles.statInfo(
             PERSONAL_MISSIONS.TANKMODULETOOLTIPDATA_STATUS_OBTAINED))
コード例 #19
0
 def _getStatusBlock(self, operation):
     if not operation.isUnlocked():
         block = formatters.packBuildUpBlockData([
             formatters.packAlignedTextBlockData(
                 text=text_styles.concatStylesWithSpace(
                     icons.markerBlocked(-2),
                     text_styles.error(
                         TOOLTIPS.
                         PERSONALMISSIONS_OPERATION_FOOTER_TITLE_NOTAVAILABLE
                     )),
                 align=BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER,
                 padding=formatters.packPadding(top=-5)),
             formatters.packAlignedTextBlockData(
                 text=text_styles.main(
                     TOOLTIPS.
                     PERSONALMISSIONS_OPERATION_FOOTER_DESCR_DOPREVOPERATION
                 ),
                 align=BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER,
                 padding=formatters.packPadding(bottom=14))
         ])
     elif operation.isFullCompleted():
         block = formatters.packAlignedTextBlockData(
             text=text_styles.concatStylesWithSpace(
                 icons.doubleCheckmark(1),
                 text_styles.bonusAppliedText(
                     TOOLTIPS.
                     PERSONALMISSIONS_OPERATION_FOOTER_TITLE_EXCELLENTDONE)
             ),
             align=BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER,
             padding=formatters.packPadding(top=-5, bottom=12))
     elif operation.isAwardAchieved():
         data = [
             formatters.packAlignedTextBlockData(
                 text=text_styles.concatStylesWithSpace(
                     icons.checkmark(-2),
                     text_styles.bonusAppliedText(
                         TOOLTIPS.
                         PERSONALMISSIONS_OPERATION_FOOTER_TITLE_DONE)),
                 align=BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER,
                 padding=formatters.packPadding(top=-5))
         ]
         currentCount = operation.getFreeTokensCount()
         totalCount = operation.getFreeTokensTotalCount()
         if currentCount < totalCount:
             data.append(
                 formatters.packAlignedTextBlockData(
                     text=text_styles.concatStylesToSingleLine(
                         text_styles.main(
                             TOOLTIPS.
                             PERSONALMISSIONS_OPERATION_FOOTER_DESCR_FREESHEETS
                         ), missions_helper.AWARD_SHEET_ICON,
                         text_styles.bonusAppliedText(currentCount),
                         text_styles.main(' / %s' % totalCount)),
                     align=BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER,
                     padding=formatters.packPadding(bottom=14)))
         else:
             currentCount = len(operation.getFullCompletedQuests(True))
             totalCount = operation.getQuestsCount()
             data.append(
                 formatters.packAlignedTextBlockData(
                     text=text_styles.concatStylesToSingleLine(
                         text_styles.main(
                             TOOLTIPS.
                             PERSONALMISSIONS_OPERATION_FOOTER_DESCR_QUESTSFULLYDONE
                         ), text_styles.bonusAppliedText(currentCount),
                         text_styles.main(' / %s' % totalCount)),
                     align=BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER,
                     padding=formatters.packPadding(bottom=14)))
         block = formatters.packBuildUpBlockData(data)
     elif operation.isInProgress():
         currentCount, totalCount = operation.getTokensCount()
         block = formatters.packBuildUpBlockData([
             formatters.packAlignedTextBlockData(
                 text=text_styles.concatStylesWithSpace(
                     icons.inProgress(-1),
                     text_styles.neutral(
                         TOOLTIPS.
                         PERSONALMISSIONS_OPERATION_FOOTER_TITLE_INPROGRESS)
                 ),
                 align=BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER,
                 padding=formatters.packPadding(top=-5)),
             formatters.packAlignedTextBlockData(
                 text=text_styles.concatStylesToSingleLine(
                     text_styles.main(
                         TOOLTIPS.
                         PERSONALMISSIONS_OPERATION_FOOTER_DESCR_COMPLETIONTOKENS
                     ), text_styles.bonusAppliedText(currentCount),
                     text_styles.main(' / %s' % totalCount)),
                 align=BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER,
                 padding=formatters.packPadding(bottom=14))
         ])
     elif not operation.hasRequiredVehicles():
         block = formatters.packBuildUpBlockData([
             formatters.packAlignedTextBlockData(
                 text=text_styles.concatStylesWithSpace(
                     icons.markerBlocked(-2),
                     text_styles.error(
                         TOOLTIPS.
                         PERSONALMISSIONS_OPERATION_FOOTER_TITLE_NOTAVAILABLE
                     )),
                 align=BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER,
                 padding=formatters.packPadding(top=-5)),
             formatters.packAlignedTextBlockData(
                 text=text_styles.main(
                     TOOLTIPS.
                     PERSONALMISSIONS_OPERATION_FOOTER_DESCR_NOVEHICLE),
                 align=BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER,
                 padding=formatters.packPadding(bottom=14))
         ])
     else:
         block = formatters.packBuildUpBlockData([
             formatters.packAlignedTextBlockData(
                 text=text_styles.stats(
                     TOOLTIPS.
                     PERSONALMISSIONS_OPERATION_FOOTER_TITLE_AVAILABLE),
                 align=BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER,
                 padding=formatters.packPadding(top=-5)),
             formatters.packAlignedTextBlockData(
                 text=text_styles.main(
                     TOOLTIPS.
                     PERSONALMISSIONS_OPERATION_FOOTER_DESCR_SELECTQUEST),
                 align=BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER,
                 padding=formatters.packPadding(bottom=14))
         ])
     return block
コード例 #20
0
    def __updateFooter(self):
        chainState = self.__getChainState(self.getChain())
        isQuestInProgress = False
        btnVisible = False
        btnEnabled = False
        btnLabel = ''
        descr = ''
        currentOperation = self.getOperation()
        chainClassifier = currentOperation.getChainClassifier(
            self.getChainID())
        vehicleClass = getTypeShortUserName(chainClassifier.classificationAttr)
        pm = self._eventsCache.getPersonalMissions()
        branch = self.getBranch()
        freeSheets = pm.getFreeTokensCount(branch)
        pawnedSheets = pm.getPawnedTokensCount(branch)
        if not chainState.hasUnlocked:
            status = text_styles.concatStylesWithSpace(
                icons.markerBlocked(),
                text_styles.error(PERSONAL_MISSIONS.STATUSPANEL_STATUS_LOCKED))
        elif chainState.questInProgress is not None:
            quest = chainState.questInProgress
            if quest.isOnPause:
                status = text_styles.concatStylesWithSpace(
                    icons.makeImageTag(RES_ICONS.MAPS_ICONS_LIBRARY_ONPAUSE,
                                       16, 16, -3, 8),
                    text_styles.playerOnline(quest.getUserName()))
            else:
                isQuestInProgress = True
                status = text_styles.concatStylesWithSpace(
                    icons.inProgress(),
                    text_styles.tutorial(quest.getUserName()))
            if quest.areTokensPawned():
                descr = text_styles.neutral(
                    _ms(PERSONAL_MISSIONS.STATUSPANEL_STATUS_PAWNED,
                        count=quest.getPawnCost(),
                        icon=getHtmlAwardSheetIcon(quest.getQuestBranch())))
            elif quest.isMainCompleted():
                descr = text_styles.neutral(
                    PERSONAL_MISSIONS.STATUSPANEL_STATUS_IMPROVE)
            elif quest.canBePawned() and not quest.isDisabled():
                btnVisible = True
                pawnCost = quest.getPawnCost()
                btnLabel = _ms(
                    PERSONAL_MISSIONS.STATUSPANEL_FREESHEETBTN_LABEL,
                    count=pawnCost,
                    icon=getHtmlAwardSheetIcon(quest.getQuestBranch()))
                if pawnCost <= freeSheets:
                    btnEnabled = True
        elif chainState.isFullCompleted:
            status = text_styles.concatStylesWithSpace(
                icons.doubleCheckmark(1),
                text_styles.bonusAppliedText(
                    _ms(PERSONAL_MISSIONS.STATUSPANEL_STATUS_ALLEXCELLENTDONE,
                        vehicleClass=vehicleClass)))
        elif chainState.isCompleted:
            status = text_styles.concatStylesWithSpace(
                icons.checkmark(-2),
                text_styles.bonusAppliedText(
                    _ms(PERSONAL_MISSIONS.STATUSPANEL_STATUS_ALLDONE,
                        vehicleClass=vehicleClass)))
        elif not chainState.hasVehicle:
            if self.getBranch() == PM_BRANCH.PERSONAL_MISSION_2:
                template = PERSONAL_MISSIONS.OPERATIONTITLE_LABEL_NOVEHICLE_PM2
            else:
                template = PERSONAL_MISSIONS.OPERATIONTITLE_LABEL_NOVEHICLE_REGULAR
            vehData = getChainVehRequirements(currentOperation,
                                              self.getChainID(),
                                              useIcons=False)
            status = text_styles.concatStylesWithSpace(
                icons.markerBlocked(),
                text_styles.error(_ms(template, vehData=vehData)))
        else:
            status = text_styles.concatStylesWithSpace(
                icons.makeImageTag(
                    RES_ICONS.MAPS_ICONS_LIBRARY_ATTENTIONICONFILLED, 16, 16,
                    -2),
                text_styles.neutral(
                    PERSONAL_MISSIONS.STATUSPANEL_STATUS_SELECTTASK))
        tankwomanQuests = []
        for operation in pm.getAllOperations().itervalues():
            tankwomanQuests.extend(
                operation.getQuestsByFilter(
                    PersonalMission.needToGetTankWoman).itervalues())

        counterText = ''
        tankwomanVisible = False
        if tankwomanQuests:
            counterText = text_styles.highlightText('x%s' %
                                                    len(tankwomanQuests))
            tankwomanVisible = True
        self.as_setStatusDataS({
            'statusText': status,
            'descrText': descr,
            'btnVisible': btnVisible,
            'btnEnabled': btnEnabled,
            'btnLabel': btnLabel,
            'sheetsBlockData': {
                'freeSheetsIcon':
                AwardSheetPresenter.getIcon(AwardSheetPresenter.Size.MID),
                'freeSheetsText':
                text_styles.main(
                    _ms(PERSONAL_MISSIONS.STATUSPANEL_FREESHEETS,
                        count=text_styles.highlightText(freeSheets))),
                'pawnedSheetsText':
                text_styles.main(
                    _ms(PERSONAL_MISSIONS.STATUSPANEL_PAWNEDSHEETS,
                        count=text_styles.highlightText(pawnedSheets))),
                'tooltipData': {
                    'isSpecial':
                    True,
                    'specialAlias':
                    TOOLTIPS_CONSTANTS.FREE_SHEET_RETURN if freeSheets
                    or pawnedSheets else TOOLTIPS_CONSTANTS.FREE_SHEET,
                    'specialArgs': [currentOperation.getCampaignID()]
                },
                'popover':
                PERSONAL_MISSIONS_ALIASES.FREE_SHEET_POPOVER,
                'popoverData': {
                    'branch': branch
                }
            },
            'tankgirlsBlockData': {
                'counterText': counterText,
                'visible': tankwomanVisible,
                'tooltipData': {
                    'isSpecial': True,
                    'specialAlias':
                    TOOLTIPS_CONSTANTS.PERSONAL_MISSIONS_TANKWOMAN,
                    'specialArgs': []
                },
                'popover': PERSONAL_MISSIONS_ALIASES.TANK_GIRLS_POPOVER
            },
            'tooltip': None,
            'isQuestInProgress': isQuestInProgress
        })
        return
コード例 #21
0
    def __updateFooter(self):
        chainState = self.__getChainState(self.getChain())
        isQuestInProgress = False
        btnVisible = False
        btnEnabled = False
        btnLabel = ''
        descr = ''
        currentOperation = self.getOperation()
        currentVehicleType = currentOperation.getChainVehicleClass(
            self.getChainID())
        vehicleClass = getTypeShortUserName(currentVehicleType)
        pm = self._eventsCache.personalMissions
        freeSheets = pm.getFreeTokensCount()
        pawnedSheets = pm.getPawnedTokensCount()
        if not chainState.hasUnlocked:
            status = text_styles.concatStylesWithSpace(
                icons.markerBlocked(),
                text_styles.error(PERSONAL_MISSIONS.STATUSPANEL_STATUS_LOCKED))
        elif chainState.questInProgress is not None:
            quest = chainState.questInProgress
            isQuestInProgress = True
            status = text_styles.concatStylesWithSpace(
                icons.inProgress(), text_styles.tutorial(quest.getUserName()))
            if quest.areTokensPawned():
                descr = text_styles.neutral(
                    _ms(PERSONAL_MISSIONS.STATUSPANEL_STATUS_PAWNED,
                        count=quest.getPawnCost(),
                        icon=icons.makeImageTag(
                            RES_ICONS.
                            MAPS_ICONS_PERSONALMISSIONS_SHEET_RECEIVED_SMALL,
                            16, 16, -3, 8)))
            elif quest.isMainCompleted():
                descr = text_styles.neutral(
                    PERSONAL_MISSIONS.STATUSPANEL_STATUS_IMPROVE)
            elif quest.canBePawned():
                btnVisible = True
                pawnCost = quest.getPawnCost()
                btnLabel = _ms(
                    PERSONAL_MISSIONS.STATUSPANEL_FREESHEETBTN_LABEL,
                    count=pawnCost,
                    icon=icons.makeImageTag(
                        RES_ICONS.
                        MAPS_ICONS_PERSONALMISSIONS_SHEET_RECEIVED_SMALL, 16,
                        16, -3, 8))
                if pawnCost <= freeSheets:
                    btnEnabled = True
        elif chainState.isFullCompleted:
            status = text_styles.concatStylesWithSpace(
                icons.checkmark(-2),
                text_styles.bonusAppliedText(
                    _ms(PERSONAL_MISSIONS.STATUSPANEL_STATUS_ALLEXCELLENTDONE,
                        vehicleClass=vehicleClass)))
        elif chainState.isCompleted:
            status = text_styles.concatStylesWithSpace(
                icons.checkmark(-2),
                text_styles.bonusAppliedText(
                    _ms(PERSONAL_MISSIONS.STATUSPANEL_STATUS_ALLDONE,
                        vehicleClass=vehicleClass)))
        elif not chainState.hasVehicle:
            status = text_styles.concatStylesWithSpace(
                icons.markerBlocked(),
                text_styles.error(
                    _ms(PERSONAL_MISSIONS.STATUSPANEL_STATUS_NOVEHICLE,
                        vehicleClass=vehicleClass)))
        else:
            status = text_styles.concatStylesWithSpace(
                icons.makeImageTag(
                    RES_ICONS.MAPS_ICONS_LIBRARY_ATTENTIONICONFILLED, 16, 16,
                    -2),
                text_styles.neutral(
                    PERSONAL_MISSIONS.STATUSPANEL_STATUS_SELECTTASK))

        def tankwomanFilter(quest):
            tankman, isMainBonus = quest.getTankmanBonus()
            return tankman and (quest.needToGetAddReward() and not isMainBonus
                                or quest.needToGetMainReward() and isMainBonus)

        tankwomanQuests = []
        for operation in pm.getOperations().itervalues():
            tankwomanQuests.extend(
                operation.getQuestsByFilter(tankwomanFilter).itervalues())

        counterText = ''
        tankwomanVisible = False
        if tankwomanQuests:
            counterText = text_styles.highlightText('x%s' %
                                                    len(tankwomanQuests))
            tankwomanVisible = True
        self.as_setStatusDataS({
            'statusText': status,
            'descrText': descr,
            'btnVisible': btnVisible,
            'btnEnabled': btnEnabled,
            'btnLabel': btnLabel,
            'sheetsBlockData': {
                'freeSheetsText':
                text_styles.main(
                    _ms(PERSONAL_MISSIONS.STATUSPANEL_FREESHEETS,
                        count=text_styles.highlightText(freeSheets))),
                'pawnedSheetsText':
                text_styles.main(
                    _ms(PERSONAL_MISSIONS.STATUSPANEL_PAWNEDSHEETS,
                        count=text_styles.highlightText(pawnedSheets))),
                'tooltipData': {
                    'isSpecial':
                    True,
                    'specialAlias':
                    TOOLTIPS_CONSTANTS.FREE_SHEET_RETURN if freeSheets
                    or pawnedSheets else TOOLTIPS_CONSTANTS.FREE_SHEET,
                    'specialArgs': []
                },
                'popover':
                PERSONAL_MISSIONS_ALIASES.FREE_SHEET_POPOVER
            },
            'tankgirlsBlockData': {
                'counterText': counterText,
                'visible': tankwomanVisible,
                'tooltipData': {
                    'isSpecial': True,
                    'specialAlias':
                    TOOLTIPS_CONSTANTS.PERSONAL_MISSIONS_TANKWOMAN,
                    'specialArgs': []
                },
                'popover': PERSONAL_MISSIONS_ALIASES.TANK_GIRLS_POPOVER
            },
            'tooltip': None,
            'isQuestInProgress': isQuestInProgress
        })
        return
コード例 #22
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