def __getAvailabilityStr(self):
     battle = g_eventsCache.getCompanyBattles()
     if not battle.isValid():
         return
     startTimeLeft = battle.getCreationTimeLeft()
     finishTimeLeft = battle.getDestroyingTimeLeft()
     if startTimeLeft is not None and startTimeLeft > 0:
         if startTimeLeft < time_utils.ONE_DAY:
             return text_styles.alert(
                 i18n.makeString(
                     MENU.HEADERBUTTONS_BATTLE_AVAILABLESINCESOON,
                     time=text_styles.stats(
                         time_formatters.getTimeDurationStr(
                             startTimeLeft, True))))
         else:
             return text_styles.stats(
                 i18n.makeString(MENU.HEADERBUTTONS_BATTLE_AVAILABLESINCE,
                                 datetime=self._getDateTimeString(
                                     battle.startTime)))
     elif finishTimeLeft is not None and finishTimeLeft > 0:
         if finishTimeLeft < time_utils.ONE_DAY:
             return text_styles.success(
                 i18n.makeString(
                     MENU.HEADERBUTTONS_BATTLE_AVAILABLEUNTILSOON,
                     time=text_styles.stats(
                         time_formatters.getTimeDurationStr(
                             finishTimeLeft, True))))
         else:
             return text_styles.success(
                 i18n.makeString(MENU.HEADERBUTTONS_BATTLE_AVAILABLEUNTIL,
                                 datetime=self._getDateTimeString(
                                     battle.finishTime)))
Beispiel #2
0
 def __initControls(self):
     self.as_setInitDataS({'ratingDescription': text_styles.stats(_ms(CLANS.SEARCH_INFO_RATINGDESCRIPTION)),
      'ratingTooltip': CLANS.SEARCH_INFO_RATINGDESCRIPTION_TOOLTIP,
      'requestSent': text_styles.success(_ms(CLANS.SEARCH_INFO_REQUESTSENT)),
      'clanProfileBtnLabel': _ms(CLANS.SEARCH_INFO_CLANPROFILEBTN),
      'sendRequestBtnLabel': _ms(CLANS.SEARCH_INFO_SENDREQUESTBTN)})
     self.as_setWaitingVisibleS(False)
Beispiel #3
0
 def getAdditionalStatusText(self):
     if self._isAddReward:
         return text_styles.success(
             '#menu:awardWindow/personalMission/sideConditionCompleted')
     else:
         return text_styles.neutral(
             '#menu:awardWindow/personalMission/sideConditionNotCompleted')
Beispiel #4
0
 def _packBlocks(self, *args, **kwargs):
     self._items = super(BattlePassPointsTooltipData,
                         self)._packBlocks(*args, **kwargs)
     titleBlock = formatters.packTitleDescBlock(title=text_styles.highTitle(
         backport.text(
             R.strings.battle_pass.tooltips.battlePassPoints.title())))
     imageBlock = formatters.packImageBlockData(img=backport.image(
         R.images.gui.maps.icons.battlePass.tooltips.battlePassPoints()),
                                                align=BLOCKS_TOOLTIP_TYPES.
                                                ALIGN_CENTER)
     titleImageBlock = formatters.packBuildUpBlockData(
         [titleBlock, imageBlock])
     self._items.append(titleImageBlock)
     descriptionBlock = text_styles.main(
         backport.text(
             R.strings.battle_pass.tooltips.battlePassPoints.description()))
     self._items.append(formatters.packTextBlockData(descriptionBlock))
     state = self.__battlePassController.getState()
     if state == BattlePassState.COMPLETED:
         self._items.append(
             formatters.packBuildUpBlockData(
                 [
                     formatters.packImageTextBlockData(
                         title=text_styles.success(
                             backport.text(R.strings.battle_pass.tooltips.
                                           battlePassPoints.completed())),
                         img=backport.image(
                             R.images.gui.maps.icons.library.check()),
                         imgPadding=formatters.packPadding(top=-2))
                 ],
                 linkage=BLOCKS_TOOLTIP_TYPES.
                 TOOLTIP_BUILDUP_BLOCK_WHITE_BG_LINKAGE,
                 padding=formatters.packPadding(bottom=-10)))
     return self._items
 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)
Beispiel #6
0
 def __packStaticHeaderData(self, club):
     profile = self.clubsCtrl.getProfile()
     limits = self.clubsState.getLimits()
     if limits.canDestroyClub(profile, club).success:
         btnDestroyText = _ms(CYBERSPORT.STATICFORMATION_STAFFVIEW_DESTROYSTATIC_TEXT)
     elif limits.canLeaveClub(profile, club).success:
         btnDestroyText = _ms(CYBERSPORT.STATICFORMATION_STAFFVIEW_EXITSTATIC_TEXT)
     else:
         btnDestroyText = ''
     if club.canParticipateBattles():
         lblStaffedText = ''.join([text_styles.success(CYBERSPORT.STATICFORMATION_STAFFVIEW_LBLSTAFFED_TEXT),
          text_styles.standard(' ('),
          text_styles.main(str(len(club.getMembers()))),
          text_styles.standard('/%d)' % CLUB_LIMITS.MAX_MEMBERS)])
     else:
         lblStaffedText = ''
     return {'lblTitleText': text_styles.highTitle(CYBERSPORT.STATICFORMATION_STAFFVIEW_TITLE_TEXT),
      'lblDescriptionText': text_styles.standard(_ms(CYBERSPORT.STATICFORMATION_STAFFVIEW_DESCRIPTION_OTHER_TEXT, clubName=club.getUserName())),
      'btnRecruitmentText': _ms(CYBERSPORT.STATICFORMATION_STAFFVIEW_RECRUITMENTBTN_TEXT),
      'btnRecruitmentTooltip': TOOLTIPS.STATICFORMATIONSTAFFVIEW_RECRUITMENTBTN,
      'btnInviteText': _ms(CYBERSPORT.STATICFORMATION_STAFFVIEW_INVITEBTN_TEXT),
      'btnRemoveText': btnDestroyText,
      'cbOpenedText': _ms(CYBERSPORT.STATICFORMATION_STAFFVIEW_RECRUITMENTOPENEDCHKBX_TEXT),
      'lblStaffedText': lblStaffedText,
      'lblStaffedTooltip': TOOLTIPS.STATICFORMATIONSTAFFVIEW_LBLSTAFFED,
      'tableHeader': _packTableHeaders()}
Beispiel #7
0
 def __packStaticHeaderData(self, club):
     profile = self.clubsCtrl.getProfile()
     limits = self.clubsState.getLimits()
     if limits.canDestroyClub(profile, club).success:
         btnDestroyText = _ms(CYBERSPORT.STATICFORMATION_STAFFVIEW_DESTROYSTATIC_TEXT)
     elif limits.canLeaveClub(profile, club).success:
         btnDestroyText = _ms(CYBERSPORT.STATICFORMATION_STAFFVIEW_EXITSTATIC_TEXT)
     else:
         btnDestroyText = ''
     if club.canParticipateBattles():
         lblStaffedText = ''.join([text_styles.success(CYBERSPORT.STATICFORMATION_STAFFVIEW_LBLSTAFFED_TEXT),
          text_styles.standard(' ('),
          text_styles.main(str(len(club.getMembers()))),
          text_styles.standard('/%d)' % CLUB_LIMITS.MAX_MEMBERS)])
     else:
         lblStaffedText = ''
     return {'lblTitleText': text_styles.highTitle(CYBERSPORT.STATICFORMATION_STAFFVIEW_TITLE_TEXT),
      'lblDescriptionText': text_styles.standard(_ms(CYBERSPORT.STATICFORMATION_STAFFVIEW_DESCRIPTION_OTHER_TEXT, clubName=club.getUserName())),
      'btnRecruitmentText': _ms(CYBERSPORT.STATICFORMATION_STAFFVIEW_RECRUITMENTBTN_TEXT, count=len(club.getApplicants(onlyActive=True))),
      'btnRecruitmentTooltip': TOOLTIPS.STATICFORMATIONSTAFFVIEW_RECRUITMENTBTN,
      'btnInviteText': _ms(CYBERSPORT.STATICFORMATION_STAFFVIEW_INVITEBTN_TEXT),
      'btnRemoveText': btnDestroyText,
      'cbOpenedText': _ms(CYBERSPORT.STATICFORMATION_STAFFVIEW_RECRUITMENTOPENEDCHKBX_TEXT),
      'lblStaffedText': lblStaffedText,
      'lblStaffedTooltip': TOOLTIPS.STATICFORMATIONSTAFFVIEW_LBLSTAFFED,
      'tableHeader': _packTableHeaders()}
 def __getAvailabilityStr(self):
     battle = g_eventsCache.getCompanyBattles()
     if not battle.isValid():
         return
     startTimeLeft = battle.getCreationTimeLeft()
     finishTimeLeft = battle.getDestroyingTimeLeft()
     if startTimeLeft is not None and startTimeLeft > 0:
         if startTimeLeft < time_utils.ONE_DAY:
             return text_styles.alert(i18n.makeString(MENU.HEADERBUTTONS_BATTLE_AVAILABLESINCESOON, time=text_styles.stats(time_formatters.getTimeDurationStr(startTimeLeft, True))))
         else:
             return text_styles.stats(i18n.makeString(MENU.HEADERBUTTONS_BATTLE_AVAILABLESINCE, datetime=self._getDateTimeString(battle.startTime)))
     elif finishTimeLeft is not None and finishTimeLeft > 0:
         if finishTimeLeft < time_utils.ONE_DAY:
             return text_styles.success(i18n.makeString(MENU.HEADERBUTTONS_BATTLE_AVAILABLEUNTILSOON, time=text_styles.stats(time_formatters.getTimeDurationStr(finishTimeLeft, True))))
         else:
             return text_styles.success(i18n.makeString(MENU.HEADERBUTTONS_BATTLE_AVAILABLEUNTIL, datetime=self._getDateTimeString(battle.finishTime)))
 def __initControls(self):
     self.as_setInitDataS({'ratingDescription': text_styles.stats(_ms(CLANS.SEARCH_INFO_RATINGDESCRIPTION)),
      'ratingTooltip': CLANS.SEARCH_INFO_RATINGDESCRIPTION_TOOLTIP,
      'requestSent': text_styles.success(_ms(CLANS.SEARCH_INFO_REQUESTSENT)),
      'clanProfileBtnLabel': _ms(CLANS.SEARCH_INFO_CLANPROFILEBTN),
      'sendRequestBtnLabel': _ms(CLANS.SEARCH_INFO_SENDREQUESTBTN)})
     self.as_setWaitingVisibleS(False)
Beispiel #10
0
 def getMainStatusText(self):
     statusText = text_styles.success(
         MENU.AWARDWINDOW_MISSION_MAINCONDITIONCOMPLETE)
     return text_styles.concatStylesWithSpace(
         statusText,
         text_styles.standard(
             MENU.AWARDWINDOW_PERSONALMISSION_ALREADYCOMPLETED)
     ) if not self._isMainReward else statusText
def _formatInviteStatus(invitation):
    if invitation.isAccepted():
        return text_styles.success('#cybersport:InvitesAndRequestsWindow/accepted')
    if invitation.isDeclined():
        return text_styles.error('#cybersport:InvitesAndRequestsWindow/rejected')
    if invitation.isCancelled():
        return text_styles.error('#cybersport:InvitesAndRequestsWindow/cancelled')
    return ''
 def _getState(self, resToExchange):
     if resToExchange <= 0:
         return (CONFIRM_EXCHANGE_DIALOG_TYPES.EXCHANGE_NOT_NEEED_STATE, text_styles.success(self._makeString(I18N_EXCHANGENONEEDTEXT_KEY)))
     if not self._isEnoughGold(resToExchange):
         goldToExchange = self._getGoldToExchange(resToExchange)
         fmtGold = ''.join((text_styles.gold(backport.getGoldFormat(goldToExchange)), icons.gold()))
         return (CONFIRM_EXCHANGE_DIALOG_TYPES.NOT_ENOUGH_GOLD_STATE, text_styles.error(self._makeString(I18N_GOLDNOTENOUGHTEXT_KEY, {'gold': fmtGold})))
     return (CONFIRM_EXCHANGE_DIALOG_TYPES.NORMAL_STATE, '')
Beispiel #13
0
 def _getPreformattedTankwomanBonus(self, operation):
     if not operation.isFullCompleted():
         current, total = _getTankwomansCountInOperation(operation)
         currentStr = text_styles.success(current) if current else text_styles.stats(current)
         images = dict(((size, RES_ICONS.getBonusIcon(size, 'tankwoman')) for size in AWARDS_SIZES.ALL()))
         return PreformattedBonus(bonusName=self._TANKWOMAN_BONUS, label='%s / %s' % (currentStr, str(total)), images=images, labelFormatter=text_styles.main)
     else:
         return None
 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
 def _getFormattedLeftTime(self, order):
     if order.inCooldown:
         if not order.isPermanent:
             secondsLeft = order.getUsageLeftTime()
             return time_formatters.getTimeDurationStr(secondsLeft)
         else:
             nextBattle = i18n.makeString(FORTIFICATIONS.ORDERS_ORDERPOPOVER_NEXTBATTLE)
             return text_styles.success(nextBattle)
     return ''
 def _getCompleteLabel(cls, progress):
     currentProgress = '%s / %s' % (text_styles.bonusAppliedText(
         progress.getCurrent()), text_styles.success(progress.getGoal()))
     label = i18n.makeString(
         PERSONAL_MISSIONS.CONDITIONS_CURRENTPROGRESS_BOTTOMLABEL,
         currentProgress=currentProgress)
     status = text_styles.bonusAppliedText(
         PERSONAL_MISSIONS.CONDITIONS_COMPLETED_BOTTOMLABEL)
     return '%s      %s' % (label, status)
 def _getFormattedLeftTime(self, order):
     if order.inCooldown:
         if not order.isPermanent:
             secondsLeft = order.getUsageLeftTime()
             return time_formatters.getTimeDurationStr(secondsLeft)
         else:
             nextBattle = i18n.makeString(FORTIFICATIONS.ORDERS_ORDERPOPOVER_NEXTBATTLE)
             return text_styles.success(nextBattle)
     return ''
 def __makeVacationData(self):
     alertMessage = ''
     blockBtnEnabled = True
     daysBeforeVacation = -1
     fort = self.fortCtrl.getFort()
     isVacationEnabled = fort.isVacationEnabled()
     inProcess, inCooldown = fort.getVacationProcessing()
     _, vacationEnd = fort.getVacationDate()
     blockBtnToolTip = TOOLTIPS.FORTIFICATION_FORTSETTINGSWINDOW_VACATIONBTNENABLED
     descriptionTooltip = TOOLTIPS.FORTIFICATION_FORTSETTINGSWINDOW_VACATIONDESCRIPTION
     conditionPostfix = text_styles.standard(
         i18n.makeString(FORTIFICATIONS.
                         SETTINGSWINDOW_BLOCKCONDITION_VACATIONNOTPLANNED))
     if inProcess or inCooldown:
         blockBtnEnabled = False
         if fort.isOnVacation():
             blockBtnToolTip = TOOLTIPS.FORTIFICATION_FORTSETTINGSWINDOW_VACATIONBTNDISABLED
             daysBeforeVacation = -1
         elif time_utils.getTimeDeltaFromNow(vacationEnd) != 0:
             blockBtnToolTip = TOOLTIPS.FORTIFICATION_FORTSETTINGSWINDOW_VACATIONBTNDISABLED
         else:
             cooldownEnd = vacationEnd + g_fortCache.vacationCooldownTime
             daysBeforeVacation = time_utils.getTimeDeltaFromNow(
                 cooldownEnd) / time_utils.ONE_DAY + 1
             if daysBeforeVacation == 0:
                 blockBtnToolTip = TOOLTIPS.FORTIFICATION_FORTSETTINGSWINDOW_VACATIONBTNDSBLDLESSADAY
                 daysBeforeVacation = -1
             else:
                 blockBtnToolTip = TOOLTIPS.FORTIFICATION_FORTSETTINGSWINDOW_VACATIONBTNDISABLEDNOTPLANNED
                 isVacationEnabled = False
     if isVacationEnabled:
         vacation = fort.getVacationDateTimeStr()
         if not self._isFortFrozen():
             if not fort.isOnVacation():
                 conditionPostfix = text_styles.neutral(vacation)
             else:
                 conditionPostfix = text_styles.success(vacation)
         else:
             conditionPostfix = text_styles.standard(vacation)
     conditionPrefix = text_styles.main(
         i18n.makeString(
             FORTIFICATIONS.settingswindow_blockcondition('vacation')))
     blockDescr = text_styles.standard(
         i18n.makeString(
             FORTIFICATIONS.settingswindow_blockdescr('vacation')))
     if alertMessage:
         alertMessage = icons.alert() + ' ' + alertMessage
     return {
         'blockBtnEnabled': blockBtnEnabled,
         'blockDescr': blockDescr,
         'blockCondition': conditionPrefix + ' ' + conditionPostfix,
         'alertMessage': alertMessage,
         'blockBtnToolTip': blockBtnToolTip,
         'daysBeforeVacation': daysBeforeVacation,
         'descriptionTooltip': descriptionTooltip
     }
Beispiel #19
0
 def getMainStatusText(self):
     statusText = text_styles.success(
         '#menu:awardWindow/mission/mainConditionComplete')
     if not self._isMainReward:
         return text_styles.concatStylesWithSpace(
             statusText,
             text_styles.standard(
                 '#menu:awardWindow/personalMission/alreadyCompleted'))
     else:
         return statusText
Beispiel #20
0
def _formatInviteStatus(invitation):
    if invitation.isAccepted():
        return text_styles.success(
            '#cybersport:InvitesAndRequestsWindow/accepted')
    if invitation.isDeclined():
        return text_styles.error(
            '#cybersport:InvitesAndRequestsWindow/rejected')
    if invitation.isCancelled():
        return text_styles.error(
            '#cybersport:InvitesAndRequestsWindow/cancelled')
    return ''
 def __getStatusText(self, isMain):
     if not self.__hasBattleProgress:
         return ''
     statusConditionValues = self.__getStatusConditionValues(isMain)
     if statusConditionValues:
         current, goal, isCompleted = statusConditionValues
         currentStr = BigWorld.wg_getIntegralFormat(current)
         goalStr = BigWorld.wg_getIntegralFormat(goal)
         if isCompleted:
             return ''.join([text_styles.bonusAppliedText(currentStr), text_styles.success(' / %s' % goalStr)])
         return ''.join([text_styles.stats(currentStr), text_styles.main(' / %s' % goalStr)])
 def __makeVacationData(self):
     alertMessage = ""
     blockBtnEnabled = True
     daysBeforeVacation = -1
     fort = self.fortCtrl.getFort()
     isVacationEnabled = fort.isVacationEnabled()
     inProcess, inCooldown = fort.getVacationProcessing()
     _, vacationEnd = fort.getVacationDate()
     blockBtnToolTip = TOOLTIPS.FORTIFICATION_FORTSETTINGSWINDOW_VACATIONBTNENABLED
     descriptionTooltip = TOOLTIPS.FORTIFICATION_FORTSETTINGSWINDOW_VACATIONDESCRIPTION
     conditionPostfix = text_styles.standard(
         i18n.makeString(FORTIFICATIONS.SETTINGSWINDOW_BLOCKCONDITION_VACATIONNOTPLANNED)
     )
     if inProcess or inCooldown:
         blockBtnEnabled = False
         if fort.isOnVacation():
             blockBtnToolTip = TOOLTIPS.FORTIFICATION_FORTSETTINGSWINDOW_VACATIONBTNDISABLED
             daysBeforeVacation = -1
         elif time_utils.getTimeDeltaFromNow(vacationEnd) != 0:
             blockBtnToolTip = TOOLTIPS.FORTIFICATION_FORTSETTINGSWINDOW_VACATIONBTNDISABLED
         else:
             cooldownEnd = vacationEnd + g_fortCache.vacationCooldownTime
             daysBeforeVacation = time_utils.getTimeDeltaFromNow(cooldownEnd) / time_utils.ONE_DAY + 1
             if daysBeforeVacation == 0:
                 blockBtnToolTip = TOOLTIPS.FORTIFICATION_FORTSETTINGSWINDOW_VACATIONBTNDSBLDLESSADAY
                 daysBeforeVacation = -1
             else:
                 blockBtnToolTip = TOOLTIPS.FORTIFICATION_FORTSETTINGSWINDOW_VACATIONBTNDISABLEDNOTPLANNED
                 isVacationEnabled = False
     if isVacationEnabled:
         vacation = fort.getVacationDateTimeStr()
         if not self._isFortFrozen():
             if not fort.isOnVacation():
                 conditionPostfix = text_styles.neutral(vacation)
             else:
                 conditionPostfix = text_styles.success(vacation)
         else:
             conditionPostfix = text_styles.standard(vacation)
     conditionPrefix = text_styles.main(i18n.makeString(FORTIFICATIONS.settingswindow_blockcondition("vacation")))
     blockDescr = text_styles.standard(i18n.makeString(FORTIFICATIONS.settingswindow_blockdescr("vacation")))
     if alertMessage:
         alertMessage = icons.alert() + " " + alertMessage
     return {
         "blockBtnEnabled": blockBtnEnabled,
         "blockDescr": blockDescr,
         "blockCondition": conditionPrefix + " " + conditionPostfix,
         "alertMessage": alertMessage,
         "blockBtnToolTip": blockBtnToolTip,
         "daysBeforeVacation": daysBeforeVacation,
         "descriptionTooltip": descriptionTooltip,
     }
 def _getCompleteStatusFields(self, isLimited, bonusCount, bonusLimit):
     """
     Gets status fields data for completed mission state.
     Data used in detailed mission view to display its completed state.
     For completed daily quests return unavailable state fields.
     """
     statusTooltipData = None
     dateLabel = self._getActiveTimeDateLabel()
     resetDateLabel = ''
     status = EVENT_STATUS.COMPLETED
     if isLimited and bonusLimit > 1:
         statusLabel = text_styles.bonusAppliedText(
             _ms(QUESTS.MISSIONDETAILS_MISSIONSCOMPLETE,
                 count=text_styles.bonusAppliedText(bonusCount),
                 total=text_styles.standard(bonusLimit)))
         statusTooltipData = getCompletetBonusLimitTooltip()
     else:
         progressDesc = text_styles.success(_ms(QUESTS.QUESTS_STATUS_DONE))
         icon = icons.makeImageTag(RES_ICONS.MAPS_ICONS_LIBRARY_OKICON, 16,
                                   16, -2, 8)
         statusLabel = text_styles.concatStylesToSingleLine(
             icon, progressDesc)
     if self.event.bonusCond.isDaily():
         status = EVENT_STATUS.NOT_AVAILABLE
         dateLabel = text_styles.concatStylesWithSpace(
             icons.makeImageTag(RES_ICONS.MAPS_ICONS_LIBRARY_TIMERICON, 16,
                                16, -2, 8),
             text_styles.error(QUESTS.MISSIONDETAILS_STATUS_NOTAVAILABLE),
             self._getCompleteDailyStatus(
                 QUESTS.MISSIONDETAILS_STATUS_COMPLETED_DAILY))
         resetDateLabel = self._getDailyResetStatusLabel()
     return {
         'statusLabel':
         statusLabel,
         'dateLabel':
         dateLabel,
         'status':
         status,
         'bottomStatusText':
         text_styles.concatStylesWithSpace(
             icons.makeImageTag(RES_ICONS.MAPS_ICONS_LIBRARY_DONE, 32, 32,
                                -8),
             text_styles.missionStatusAvailable(
                 QUESTS.MISSIONDETAILS_BOTTOMSTATUSCOMPLETE)),
         'statusTooltipData':
         statusTooltipData,
         'resetDateLabel':
         resetDateLabel
     }
Beispiel #24
0
 def _makeInviteStateString(self, item):
     status = item.getStatus()
     if status == CLAN_INVITE_STATES.ACTIVE:
         return text_styles.standard(self.__formatActiveStateString(item))
     if status == CLAN_INVITE_STATES.ACCEPTED:
         return text_styles.success(_ms(CLANS.CLANINVITESWINDOW_STATUS_ACCEPTED))
     if status == CLAN_INVITE_STATES.DECLINED:
         return text_styles.standard(_ms(CLANS.CLANINVITESWINDOW_STATUS_DECLINED))
     if status == CLAN_INVITE_STATES.EXPIRED:
         return text_styles.standard(_ms(CLANS.CLANINVITESWINDOW_STATUS_EXPIRED))
     if status == CLAN_INVITE_STATES.EXPIRED_RESENT or status == CLAN_INVITE_STATES.DECLINED_RESENT:
         return text_styles.standard(_ms(CLANS.CLANINVITESWINDOW_STATUS_SENT))
     if status == CLAN_INVITE_STATES.ERROR:
         return text_styles.error(_ms(CLANS.CLANINVITESWINDOW_STATUS_ERROR))
     return ''
 def _makeInviteStateString(self, item):
     status = item.getStatus()
     if status == CLAN_INVITE_STATES.ACTIVE:
         return text_styles.standard(self.__formatActiveStateString(item))
     if status == CLAN_INVITE_STATES.ACCEPTED:
         return text_styles.success(_ms(CLANS.CLANINVITESWINDOW_STATUS_ACCEPTED))
     if status == CLAN_INVITE_STATES.DECLINED:
         return text_styles.standard(_ms(CLANS.CLANINVITESWINDOW_STATUS_DECLINED))
     if status == CLAN_INVITE_STATES.EXPIRED:
         return text_styles.standard(_ms(CLANS.CLANINVITESWINDOW_STATUS_EXPIRED))
     if status == CLAN_INVITE_STATES.EXPIRED_RESENT or status == CLAN_INVITE_STATES.DECLINED_RESENT:
         return text_styles.standard(_ms(CLANS.CLANINVITESWINDOW_STATUS_SENT))
     if status == CLAN_INVITE_STATES.ERROR:
         return text_styles.error(_ms(CLANS.CLANINVITESWINDOW_STATUS_ERROR))
     return ''
Beispiel #26
0
    def __updateData(self):
        fort = self.fortCtrl.getFort()
        extra = self.unitFunctional.getExtra()
        result = []
        activeConsumes = dict(((otID, slotIdx) for slotIdx, (otID, level) in extra.getConsumables().iteritems()))
        for orderTypeID in constants.FORT_ORDER_TYPE.CONSUMABLES:
            orderItem = fort.getOrder(orderTypeID)
            building = fort.getBuilding(orderItem.buildingID)
            isBuildingReady = building is not None
            isSelected = orderTypeID in activeConsumes
            isSelectedInThisSlot = isSelected and activeConsumes[orderTypeID] == self.__slotIdx
            isConsumableEnabled = isSelectedInThisSlot or not isSelected and orderItem.count > 0
            showArsenalIcon = isBuildingReady and not isSelected
            if isSelectedInThisSlot:
                returnBtnLabel = FORTIFICATIONS.ORDERSELECTPOPOVER_RETURNBTNLABEL
            else:
                returnBtnLabel = ''
            orderLevelLabel = text_styles.main(_ms(FORTIFICATIONS.ORDERSELECTPOPOVER_ORDERLEVEL, orderLevel=fort_formatters.getTextLevel(orderItem.level)))
            if not isBuildingReady:
                icon = icons.makeImageTag(RES_ICONS.MAPS_ICONS_LIBRARY_REDNOTAVAILABLE, 16, 16, -2, 0)
                description = '%s %s' % (icon, text_styles.error(_ms(FORTIFICATIONS.ORDERSELECTPOPOVER_NOTAVAILABLE)))
                orderCountText = ''
            elif not isSelected:
                description = orderLevelLabel
                if orderItem.count:
                    orderCountText = text_styles.standard(_ms(FORTIFICATIONS.ORDERSELECTPOPOVER_ORDERCOUNT, orderNumber=text_styles.stats(str(orderItem.count))))
                else:
                    orderCountText = text_styles.standard(_ms(FORTIFICATIONS.ORDERSELECTPOPOVER_ORDERCOUNT, orderNumber=text_styles.error(str(orderItem.count))))
            else:
                if isSelectedInThisSlot:
                    description = ''
                else:
                    description = orderLevelLabel
                icon = icons.nut()
                orderCountText = icon + text_styles.success(_ms(FORTIFICATIONS.ORDERSELECTPOPOVER_SELECTED))
            result.append({'orderID': orderTypeID,
             'orderIconSrc': orderItem.icon,
             'headerText': text_styles.middleTitle(_ms(orderItem.userName)),
             'descriptionText': description,
             'orderCountText': orderCountText,
             'isEnabled': isConsumableEnabled,
             'isSelected': isSelectedInThisSlot,
             'showArsenalIcon': showArsenalIcon,
             'returnBtnLabel': returnBtnLabel,
             'orderLevel': orderItem.level})

        self.as_setDataS({'orders': result})
        return
    def __updateData(self):
        fort = self.fortCtrl.getFort()
        extra = self.unitFunctional.getExtra()
        result = []
        activeConsumes = dict(((otID, slotIdx) for slotIdx, (otID, level) in extra.getConsumables().iteritems()))
        for orderTypeID in constants.FORT_ORDER_TYPE.CONSUMABLES:
            orderItem = fort.getOrder(orderTypeID)
            building = fort.getBuilding(orderItem.buildingID)
            isBuildingReady = building is not None
            isSelected = orderTypeID in activeConsumes
            isSelectedInThisSlot = isSelected and activeConsumes[orderTypeID] == self.__slotIdx
            isConsumableEnabled = isSelectedInThisSlot or not isSelected and orderItem.count > 0
            showArsenalIcon = isBuildingReady and not isSelected
            if isSelectedInThisSlot:
                returnBtnLabel = FORTIFICATIONS.ORDERSELECTPOPOVER_RETURNBTNLABEL
            else:
                returnBtnLabel = ''
            orderLevelLabel = text_styles.main(_ms(FORTIFICATIONS.ORDERSELECTPOPOVER_ORDERLEVEL, orderLevel=fort_formatters.getTextLevel(orderItem.level)))
            if not isBuildingReady:
                icon = icons.makeImageTag(RES_ICONS.MAPS_ICONS_LIBRARY_REDNOTAVAILABLE, 16, 16, -2, 0)
                description = '%s %s' % (icon, text_styles.error(_ms(FORTIFICATIONS.ORDERSELECTPOPOVER_NOTAVAILABLE)))
                orderCountText = ''
            elif not isSelected:
                description = orderLevelLabel
                if orderItem.count:
                    orderCountText = text_styles.standard(_ms(FORTIFICATIONS.ORDERSELECTPOPOVER_ORDERCOUNT, orderNumber=text_styles.stats(str(orderItem.count))))
                else:
                    orderCountText = text_styles.standard(_ms(FORTIFICATIONS.ORDERSELECTPOPOVER_ORDERCOUNT, orderNumber=text_styles.error(str(orderItem.count))))
            else:
                if isSelectedInThisSlot:
                    description = ''
                else:
                    description = orderLevelLabel
                icon = icons.nut()
                orderCountText = icon + text_styles.success(_ms(FORTIFICATIONS.ORDERSELECTPOPOVER_SELECTED))
            result.append({'orderID': orderTypeID,
             'orderIconSrc': orderItem.icon,
             'headerText': text_styles.middleTitle(_ms(orderItem.userName)),
             'descriptionText': description,
             'orderCountText': orderCountText,
             'isEnabled': isConsumableEnabled,
             'isSelected': isSelectedInThisSlot,
             'showArsenalIcon': showArsenalIcon,
             'returnBtnLabel': returnBtnLabel,
             'orderLevel': orderItem.level})

        self.as_setDataS({'orders': result})
        return
 def _getCompleteStatusFields(self, isLimited, bonusCount, bonusLimit):
     """
     Gets status fields data for completed mission state.
     Data used in mission card to display its completed state.
     For completed daily quests return unavailable state fields.
     """
     if self.event.bonusCond.isDaily():
         status = EVENT_STATUS.NOT_AVAILABLE
         clockIcon = icons.makeImageTag(
             RES_ICONS.MAPS_ICONS_LIBRARY_TIMERICON, 16, 16, -2, 8)
         statusText = _ms(QUESTS.MISSIONDETAILS_STATUS_NOTAVAILABLE)
         statusLabel = text_styles.concatStylesWithSpace(
             clockIcon, text_styles.error(statusText))
         statusTooltipData = {
             'tooltip':
             makeTooltip(
                 _ms(TOOLTIPS.QUESTS_UNAVAILABLE_TIME_STATUSTOOLTIP),
                 self._getCompleteDailyStatus(
                     QUESTS.MISSIONDETAILS_STATUS_COMPLETED_DAILY)),
             'isSpecial':
             False,
             'args':
             None
         }
     else:
         status = EVENT_STATUS.COMPLETED
         if isLimited and bonusLimit > 1:
             statusLabel = text_styles.bonusAppliedText(
                 _ms(QUESTS.MISSIONDETAILS_MISSIONSCOMPLETE,
                     count=text_styles.bonusAppliedText(bonusCount),
                     total=text_styles.standard(bonusLimit)))
             statusTooltipData = getCompletetBonusLimitTooltip()
         else:
             statusTooltipData = None
             progressDesc = text_styles.success(
                 _ms(QUESTS.QUESTS_STATUS_DONE))
             icon = icons.makeImageTag(RES_ICONS.MAPS_ICONS_LIBRARY_OKICON,
                                       16, 16, -2, 8)
             statusLabel = text_styles.concatStylesToSingleLine(
                 icon, progressDesc)
     return {
         'statusLabel': statusLabel,
         'status': status,
         'statusTooltipData': statusTooltipData
     }
 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
 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)
 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
 def __getState(self, resToExchange):
     """
     Gets state and reason for exchange possibility
     :param resToExchange: <int> resource for exchange
     :return: <tuple(state:<int>, reason<str>)>
     """
     if resToExchange <= 0:
         return (
             CONFIRM_EXCHANGE_DIALOG_TYPES.EXCHANGE_NOT_NEEED_STATE,
             text_styles.success(self._makeString(I18N_EXCHANGENONEEDTEXT_KEY)),
         )
     elif not self.__isEnoughGold(resToExchange):
         goldToExchange = self.__getGoldToExchange(resToExchange)
         fmtGold = "".join((text_styles.gold(BigWorld.wg_getGoldFormat(goldToExchange)), icons.gold()))
         return (
             CONFIRM_EXCHANGE_DIALOG_TYPES.NOT_ENOUGH_GOLD_STATE,
             text_styles.error(self._makeString(I18N_GOLDNOTENOUGHTEXT_KEY, {"gold": fmtGold})),
         )
     else:
         return (CONFIRM_EXCHANGE_DIALOG_TYPES.NORMAL_STATE, "")
Beispiel #33
0
 def __getStatusText(self, isMain):
     statusConditionValues = self.__getStatusConditionValues(isMain)
     if statusConditionValues:
         current, goal, state = statusConditionValues
         currentStr = backport.getNiceNumberFormat(current)
         goalStr = backport.getIntegralFormat(goal)
         if state == QUEST_PROGRESS_STATE.COMPLETED:
             return ''.join([
                 text_styles.bonusAppliedText(currentStr),
                 text_styles.success(' / %s' % goalStr)
             ])
         if state == QUEST_PROGRESS_STATE.FAILED:
             return ''.join([
                 text_styles.error(currentStr),
                 text_styles.failedStatusText(' / %s' % goalStr)
             ])
         return ''.join([
             text_styles.stats(currentStr),
             text_styles.main(' / %s' % goalStr)
         ])
Beispiel #34
0
 def __getState(self, resToExchange):
     """
     Gets state and reason for exchange possibility
     :param resToExchange: <int> resource for exchange
     :return: <tuple(state:<int>, reason<str>)>
     """
     if resToExchange <= 0:
         return (CONFIRM_EXCHANGE_DIALOG_TYPES.EXCHANGE_NOT_NEEED_STATE,
                 text_styles.success(
                     self._makeString(I18N_EXCHANGENONEEDTEXT_KEY)))
     if not self.__isEnoughGold(resToExchange):
         goldToExchange = self.__getGoldToExchange(resToExchange)
         fmtGold = ''.join(
             (text_styles.gold(BigWorld.wg_getGoldFormat(goldToExchange)),
              icons.gold()))
         return (CONFIRM_EXCHANGE_DIALOG_TYPES.NOT_ENOUGH_GOLD_STATE,
                 text_styles.error(
                     self._makeString(I18N_GOLDNOTENOUGHTEXT_KEY,
                                      {'gold': fmtGold})))
     return (CONFIRM_EXCHANGE_DIALOG_TYPES.NORMAL_STATE, '')
Beispiel #35
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)
Beispiel #36
0
 def __getStatusText(self, isMain):
     if not self.__hasBattleProgress:
         return ''
     statusConditionValues = self.__getStatusConditionValues(isMain)
     if statusConditionValues:
         current, goal, state = statusConditionValues
         currentStr = BigWorld.wg_getNiceNumberFormat(current)
         goalStr = BigWorld.wg_getIntegralFormat(goal)
         if state == QUEST_PROGRESS_STATE.COMPLETED:
             return ''.join([
                 text_styles.bonusAppliedText(currentStr),
                 text_styles.success(' / %s' % goalStr)
             ])
         if state == QUEST_PROGRESS_STATE.FAILED:
             return text_styles.concatStylesWithSpace(
                 icons.markerBlocked(),
                 text_styles.error(QUESTS.PERSONALMISSION_STATUS_NOTDONE))
         return ''.join([
             text_styles.stats(currentStr),
             text_styles.main(' / %s' % goalStr)
         ])
 def _buildVO(self):
     actionPriceVO = None
     restorePrice, lengthInHours = getTankmenRestoreInfo(self._tankman)
     warningTexts = []
     if restorePrice.credits == 0:
         restoreCurrency = ICON_TEXT_FRAMES.EMPTY
         restorePriceStr = text_styles.success(_ms(DIALOGS.RESTORETANKMAN_FORFREE))
     else:
         restoreCurrency = ICON_TEXT_FRAMES.CREDITS
         restorePriceStr = str(currency.getBWFormatter(Currency.CREDITS)(restorePrice.credits))
         if self._showPeriodEndWarning:
             daysCount = lengthInHours / time_utils.HOURS_IN_DAY
             warningTexts.append(text_styles.alert(_ms(DIALOGS.RESTORETANKMNAN_NEWPERIODWARNING, daysCount=daysCount)))
         if constants.IS_KOREA and restorePrice.gold > 0:
             warningTexts.append(text_styles.standard(DIALOGS.BUYVEHICLEDIALOG_WARNING))
     return {'questionText': text_styles.stats(_ms(DIALOGS.RESTORETANKMAN_PRICE)),
      'restoreCurrency': restoreCurrency,
      'restorePrice': restorePriceStr,
      'isEnoughMoneyForRestore': g_itemsCache.items.stats.money.credits >= restorePrice.credits,
      'actionPriceVO': actionPriceVO,
      'warningText': '\n\n'.join(warningTexts)}
 def _buildVO(self):
     actionPriceVO = None
     restorePrice, lengthInHours = getTankmenRestoreInfo(self._tankman)
     warningTexts = []
     if not restorePrice:
         currencyTextFrame = ICON_TEXT_FRAMES.EMPTY
         restorePriceStr = text_styles.success(
             _ms(DIALOGS.RESTORETANKMAN_FORFREE))
         isEnoughMoney = True
     else:
         currencyName = restorePrice.getCurrency()
         currencyTextFrame = self._CURRENCY_TO_TEXT_FRAME[currencyName]
         restorePriceStr = str(
             currency.getBWFormatter(currencyName)(
                 restorePrice.getSignValue(currencyName)))
         isEnoughMoney = self.itemsCache.items.stats.money.get(
             currencyName, 0) >= restorePrice.get(currencyName, 0)
         if self._showPeriodEndWarning and restorePrice.isSet(
                 Currency.GOLD):
             daysCount = lengthInHours / time_utils.HOURS_IN_DAY
             warningTexts.append(
                 text_styles.alert(
                     _ms(DIALOGS.RESTORETANKMAN_NEWPERIODWARNING,
                         daysCount=daysCount)))
         if constants.IS_KOREA and restorePrice.isSet(Currency.GOLD):
             warningTexts.append(
                 text_styles.standard(DIALOGS.BUYVEHICLEDIALOG_WARNING))
     if isLongDisconnectedFromCenter():
         warningTexts.append(
             text_styles.error(
                 DIALOGS.RESTORETANKMAN_DISCONNECTEDFROMCENTER))
     return {
         'questionText':
         text_styles.stats(_ms(DIALOGS.RESTORETANKMAN_PRICE)),
         'restoreCurrency': currencyTextFrame,
         'restorePrice': restorePriceStr,
         'isEnoughMoneyForRestore': isEnoughMoney,
         'actionPriceVO': actionPriceVO,
         'warningText': '\n\n'.join(warningTexts)
     }
Beispiel #39
0
 def _buildVO(self):
     actionPriceVO = None
     restorePrice, lengthInHours = getTankmenRestoreInfo(self._tankman)
     warningTexts = []
     if restorePrice.credits == 0:
         restoreCurrency = ICON_TEXT_FRAMES.EMPTY
         restorePriceStr = text_styles.success(
             _ms(DIALOGS.RESTORETANKMAN_FORFREE))
     else:
         restoreCurrency = ICON_TEXT_FRAMES.CREDITS
         restorePriceStr = str(
             currency.getBWFormatter(Currency.CREDITS)(
                 restorePrice.credits))
         if self._showPeriodEndWarning:
             daysCount = lengthInHours / time_utils.HOURS_IN_DAY
             warningTexts.append(
                 text_styles.alert(
                     _ms(DIALOGS.RESTORETANKMAN_NEWPERIODWARNING,
                         daysCount=daysCount)))
         if constants.IS_KOREA and restorePrice.gold > 0:
             warningTexts.append(
                 text_styles.standard(DIALOGS.BUYVEHICLEDIALOG_WARNING))
     if isLongDisconnectedFromCenter():
         warningTexts.append(
             text_styles.error(
                 DIALOGS.RESTORETANKMAN_DISCONNECTEDFROMCENTER))
     return {
         'questionText':
         text_styles.stats(_ms(DIALOGS.RESTORETANKMAN_PRICE)),
         'restoreCurrency':
         restoreCurrency,
         'restorePrice':
         restorePriceStr,
         'isEnoughMoneyForRestore':
         g_itemsCache.items.stats.money.credits >= restorePrice.credits,
         'actionPriceVO':
         actionPriceVO,
         'warningText':
         '\n\n'.join(warningTexts)
     }
 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)
Beispiel #41
0
def packEfficiencyPropData(randomStats, sessionStats, accountWtr, propId):
    data = _EFFICIENT_DATA[propId]
    isWtr = propId == SESSION_STATS_CONSTANTS.SESSION_STATS_PROPS_WTR
    isInteger = propId in (SESSION_STATS_CONSTANTS.SESSION_STATS_PROPS_WTR,)
    isWithoutTotalValue = propId in (SESSION_STATS_CONSTANTS.SESSION_STATS_PROPS_AVERAGE_VEHICLE_LEVEL,)
    isWithoutDelta = propId in (SESSION_STATS_CONSTANTS.SESSION_STATS_PROPS_WINS, SESSION_STATS_CONSTANTS.SESSION_STATS_PROPS_AVERAGE_FRAGS)
    if isWtr:
        totalValue = data['totalValue'](accountWtr)
    else:
        totalValue = data['totalValue'](randomStats)
    currentValue = data['currentValue'](sessionStats)
    dynamicValue = data['delta'](sessionStats)
    if not dynamicValue:
        dynamicValue = text_styles.highlightText('-')
        diffIconSource = None
    elif dynamicValue > 0.0:
        precisionValue = precisionFormat(dynamicValue, showIntegerOnly=isInteger)
        dynamicValue = precisionValue and text_styles.success(precisionValue)
        diffIconSource = backport.image(R.images.gui.maps.icons.vehParams.icon_increase())
    else:
        precisionValue = precisionFormat(dynamicValue, showIntegerOnly=isInteger)
        dynamicValue = precisionValue and text_styles.error(precisionValue)
        diffIconSource = backport.image(R.images.gui.maps.icons.vehParams.icon_decrease())
    params = []
    if not isWithoutTotalValue:
        params.append({'label': text_styles.standard(backport.text(R.strings.session_stats.propertyInfo.total())),
         'value': text_styles.main(totalValue)})
    params.append({'label': text_styles.standard(backport.text(R.strings.session_stats.propertyInfo.current())),
     'value': text_styles.main(currentValue)})
    if not isWithoutTotalValue and not isWithoutDelta:
        params.append({'label': text_styles.standard(backport.text(R.strings.session_stats.propertyInfo.dynamic())),
         'value': dynamicValue,
         'delta': {'icon': diffIconSource}})
    return {'title': text_styles.promoSubTitle(backport.text(data['title'])),
     'description': text_styles.main(backport.text(data['descr'])),
     'params': params,
     'icon': getSessionStatsPropImage(propId)}
 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
Beispiel #43
0
 def getMainStatusText(self):
     return text_styles.success('#menu:awardWindow/mission/conditionComplete')
Beispiel #44
0
 def getMainStatusText(self):
     statusText = text_styles.success('#menu:awardWindow/mission/mainConditionComplete')
     if not self._isMainReward:
         return text_styles.concatStylesWithSpace(statusText, text_styles.standard('#menu:awardWindow/personalMission/alreadyCompleted'))
     else:
         return statusText
Beispiel #45
0
 def getAdditionalStatusText(self):
     if self._isAddReward:
         return text_styles.success('#menu:awardWindow/personalMission/sideConditionCompleted')
     else:
         return text_styles.neutral('#menu:awardWindow/personalMission/sideConditionNotCompleted')
    def __updateData(self):
        _ms = i18n.makeString
        winStatus = self.__data['isWinner']
        isDefence = self.__data['isDefence']
        enemyBuildingCapture = self.__data['enemyBuildingCapture']
        ourClanAbbrev = self.__data['ownClanName']
        enemyClanAbbrev = self.__data['enemyClanName']
        clanResourceDataKey = 'fortResourceLostByClan'
        resourceHeaderLabel = _ms(FORTIFICATIONS.FORTBATTLERESULTSWINDOW_DEFRESRECEIVED_HEADER)
        byPlayerText = _ms(FORTIFICATIONS.FORTBATTLERESULTSWINDOW_DEFRESRECEIVED_BYPLAYER)
        playerResText = BigWorld.wg_getNiceNumberFormat(self.__data.get('fortResource', 0))
        showByPlayerInfo = True
        if self.BATTLE_RESULT.isWin(winStatus):
            g_fortSoundController.playFortClanWarResult('win')
            resultText = _ms(FORTIFICATIONS.FORTBATTLERESULTSWINDOW_WIN_HEADER)
            descriptionStartText = _ms(FORTIFICATIONS.FORTBATTLERESULTSWINDOW_WIN_DESCRIPTION_START)
            descriptionEndText = _ms(FORTIFICATIONS.FORTBATTLERESULTSWINDOW_WIN_DESCRIPTION_END, clanTag='[%s]' % enemyClanAbbrev, numBuildings=enemyBuildingCapture)
            clanResourceDataKey = 'fortResourceCaptureByClan'
        elif self.BATTLE_RESULT.isDefeat(winStatus):
            g_fortSoundController.playFortClanWarResult('lose')
            resultText = _ms(FORTIFICATIONS.FORTBATTLERESULTSWINDOW_DEFEAT_HEADER)
            descriptionStartText = _ms(FORTIFICATIONS.FORTBATTLERESULTSWINDOW_DEFEAT_DESCRIPTION_START)
            descriptionEndText = _ms(FORTIFICATIONS.FORTBATTLERESULTSWINDOW_DEFEAT_DESCRIPTION_END, clanTag='[%s]' % enemyClanAbbrev, numBuildings=enemyBuildingCapture)
            resourceHeaderLabel = _ms(FORTIFICATIONS.FORTBATTLERESULTSWINDOW_DEFRESLOST_HEADER)
            byPlayerText = ''
            playerResText = ''
            showByPlayerInfo = False
        else:
            g_fortSoundController.playFortClanWarResult('draw')
            resultText = _ms(FORTIFICATIONS.FORTBATTLERESULTSWINDOW_TIE_HEADER)
            descriptionStartText = _ms(FORTIFICATIONS.FORTBATTLERESULTSWINDOW_TIE_DESCRIPTION_START)
            descriptionEndText = _ms(FORTIFICATIONS.FORTBATTLERESULTSWINDOW_TIE_DESCRIPTION_END, clanTag='[%s]' % enemyClanAbbrev)
        battles = []
        combatsData = self.__data.get('combats', [])
        if isDefence:
            combatsData = FORT_COMBAT_RESULT.invertCombatList(combatsData)
        for data in combatsData:
            combatResult, startTime, _, isDefendersBuilding, buildingTypeID = data
            building = FortBuilding(typeID=buildingTypeID)
            if combatResult in (constants.FORT_COMBAT_RESULT.WIN, constants.FORT_COMBAT_RESULT.TECH_WIN):
                battleResult = text_styles.success(_ms(FORTIFICATIONS.FORTBATTLERESULTSWINDOW_TABLE_RESULT_WIN))
            else:
                battleResult = text_styles.error(_ms(FORTIFICATIONS.FORTBATTLERESULTSWINDOW_TABLE_RESULT_DEFEAT))
            battles.append({'battleID': 0,
             'startTime': BigWorld.wg_getShortTimeFormat(startTime),
             'building': building.userName,
             'clanAbbrev': ourClanAbbrev if isDefence == isDefendersBuilding else enemyClanAbbrev,
             'result': battleResult,
             'description': '',
             'participated': True})

        achievementsLeft, achievementsRight = self.__populatePersonalMedals()
        self.as_setDataS({'windowTitle': _ms(FORTIFICATIONS.FORTBATTLERESULTSWINDOW_WINDOWTITLE),
         'resultText': resultText,
         'descriptionStartText': descriptionStartText,
         'descriptionEndText': descriptionEndText,
         'journalText': _ms(FORTIFICATIONS.FORTBATTLERESULTSWINDOW_JOURNAL),
         'defResReceivedText': resourceHeaderLabel,
         'byClanText': _ms(FORTIFICATIONS.FORTBATTLERESULTSWINDOW_DEFRESRECEIVED_BYCLAN),
         'byPlayerText': byPlayerText,
         'battleResult': self.BATTLE_RESULT.getResultByWinStatus(winStatus),
         'clanResText': BigWorld.wg_getNiceNumberFormat(self.__data.get(clanResourceDataKey, 0)),
         'playerResText': playerResText,
         'showByPlayerInfo': showByPlayerInfo,
         'battles': battles,
         'achievementsLeft': achievementsLeft,
         'achievementsRight': achievementsRight,
         'tableHeader': self._createTableHeader()})
Beispiel #47
0
 def getMainStatusText(self):
     return text_styles.success(
         '#menu:awardWindow/mission/conditionComplete')
 def _getNoNeedExchangeStateTxt(self):
     return text_styles.success(self._makeString(I18N_EXCHANGENONEEDTEXT_KEY.format(self._key), {}))
 def _getNoNeedExchangeStateTxt(self):
     return text_styles.success(
         self._makeString(I18N_EXCHANGENONEEDTEXT_KEY.format(self._key),
                          {}))