def __getCompanyAvailabilityData(self):
        tooltipData = TOOLTIPS.BATTLETYPES_COMPANY
        battle = g_eventsCache.getCompanyBattles()
        header = i18n.makeString(tooltipData + "/header")
        body = i18n.makeString(tooltipData + "/body")
        serversList = []
        if battle.isValid() and battle.isDestroyingTimeCorrect():
            for peripheryID in battle.peripheryIDs:
                host = g_preDefinedHosts.periphery(peripheryID)
                if host is not None:
                    serversList.append(host.name)

            beginDate = ""
            endDate = ""
            serversString = ""
            if battle.startTime is not None:
                beginDate = i18n.makeString(
                    TOOLTIPS.BATTLETYPES_AVAILABLETIME_SINCE, beginDate=BigWorld.wg_getShortDateFormat(battle.startTime)
                )
            if battle.finishTime is not None:
                endDate = i18n.makeString(
                    TOOLTIPS.BATTLETYPES_AVAILABLETIME_UNTIL, endDate=BigWorld.wg_getShortDateFormat(battle.finishTime)
                )
            if serversList:
                serversString = i18n.makeString(
                    TOOLTIPS.BATTLETYPES_AVAILABLETIME_SERVERS, servers=", ".join(serversList)
                )
            if beginDate or endDate or serversString:
                restrictInfo = i18n.makeString(
                    TOOLTIPS.BATTLETYPES_AVAILABLETIME, since=beginDate, until=endDate, servers=serversString
                )
                body = "%s\n\n%s" % (body, restrictInfo)
        return makeTooltip(header, body)
    def __getCompanyAvailabilityData(self):
        tooltipData = TOOLTIPS.BATTLETYPES_COMPANY
        battle = g_eventsCache.getCompanyBattles()
        header = i18n.makeString(tooltipData + '/header')
        body = i18n.makeString(tooltipData + '/body')
        serversList = []
        if battle.isValid() and battle.isDestroyingTimeCorrect():
            for peripheryID in battle.peripheryIDs:
                host = g_preDefinedHosts.periphery(peripheryID)
                if host is not None:
                    serversList.append(host.name)

            beginDate = ''
            endDate = ''
            serversString = ''
            if battle.startTime is not None:
                beginDate = i18n.makeString(TOOLTIPS.BATTLETYPES_AVAILABLETIME_SINCE, beginDate=BigWorld.wg_getShortDateFormat(battle.startTime))
            if battle.finishTime is not None:
                endDate = i18n.makeString(TOOLTIPS.BATTLETYPES_AVAILABLETIME_UNTIL, endDate=BigWorld.wg_getShortDateFormat(battle.finishTime))
            if serversList:
                serversString = i18n.makeString(TOOLTIPS.BATTLETYPES_AVAILABLETIME_SERVERS, servers=', '.join(serversList))
            if beginDate or endDate or serversString:
                restrictInfo = i18n.makeString(TOOLTIPS.BATTLETYPES_AVAILABLETIME, since=beginDate, until=endDate, servers=serversString)
                body = '%s\n\n%s' % (body, restrictInfo)
        return makeTooltip(header, body)
 def select(self):
     battle = g_eventsCache.getCompanyBattles()
     if battle.isRunning():
         if battle.needToChangePeriphery():
             g_eventDispatcher.showSwitchPeripheryWindow(ctx=SwitchPeripheryCompanyCtx())
         else:
             super(_CompanyItem, self).select()
Beispiel #4
0
 def select(self):
     battle = g_eventsCache.getCompanyBattles()
     if battle.isRunning():
         if battle.needToChangePeriphery():
             g_eventDispatcher.showSwitchPeripheryWindow(ctx=SwitchPeripheryCompanyCtx())
         else:
             super(_CompanyItem, self).select()
 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 __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 #7
0
 def getForbiddenPeripherieIDs(self):
     validPeripheryIDs = set((host.peripheryID for host in g_preDefinedHosts.hosts() if host.peripheryID != 0))
     return validPeripheryIDs - g_eventsCache.getCompanyBattles().peripheryIDs
 def _update(self, state):
     self._isSelected = state.isInPrebattle(PREBATTLE_TYPE.COMPANY)
     battle = g_eventsCache.getCompanyBattles()
     self._isDisabled = not (battle.isRunning() and battle.isValid())
Beispiel #9
0
 def _update(self, state):
     self._isSelected = state.isInPrebattle(PREBATTLE_TYPE.COMPANY)
     battle = g_eventsCache.getCompanyBattles()
     self._isDisabled = not (battle.isRunning() and battle.isValid())
Beispiel #10
0
 def getForbiddenPeripherieIDs(self):
     validPeripheryIDs = set((host.peripheryID
                              for host in g_preDefinedHosts.hosts()
                              if host.peripheryID != 0))
     return validPeripheryIDs - g_eventsCache.getCompanyBattles(
     ).peripheryIDs
 def _update(self, state):
     self._isSelected = state.isInPrebattle(PREBATTLE_TYPE.COMPANY)
     battle = g_eventsCache.getCompanyBattles()
     self._isDisabled = not battle.isAvailable()
 def _update(self, state):
     self._isSelected = state.isInPrebattle(PREBATTLE_TYPE.COMPANY)
     battle = g_eventsCache.getCompanyBattles()
     self._isDisabled = not battle.isAvailable()