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)
Example #2
0
 def getVacationDateStr(self):
     if not self.isVacationEnabled():
         return None
     else:
         start, finish = self.getVacationDate()
         return '%s - %s' % (BigWorld.wg_getShortDateFormat(start),
                             BigWorld.wg_getShortDateFormat(finish))
Example #3
0
 def getVacationDateTimeStr(self):
     if not self.isVacationEnabled():
         return None
     start, finish = self.getVacationDate()
     return '%s (%s) - %s (%s)' % (BigWorld.wg_getShortDateFormat(start),
      BigWorld.wg_getShortTimeFormat(start),
      BigWorld.wg_getShortDateFormat(finish),
      BigWorld.wg_getShortTimeFormat(finish))
 def __setData(self):
     _getText = self.app.utilsManager.textManager.getText
     _ms = i18n.makeString
     place, league, division, ladderPts = self.__makeLadderData()
     league = _getText(TextType.STATUS_WARNING_TEXT, str(league))
     division = _getText(TextType.STATUS_WARNING_TEXT, division)
     ladderPts = _getText(TextType.STATUS_WARNING_TEXT, ladderPts)
     placeText = _getText(TextType.PROMO_SUB_TITLE, _ms(CYBERSPORT.STATICFORMATIONSUMMARYVIEW_LADDER_PLACE, place=place))
     leagueDivisionText = _getText(TextType.MIDDLE_TITLE, _ms(CYBERSPORT.STATICFORMATIONSUMMARYVIEW_LADDER_LEAGUEDIVISION, league=league, division=division))
     ladderPtsText = _getText(TextType.MAIN_TEXT, _ms(CYBERSPORT.STATICFORMATIONSUMMARYVIEW_LADDER_LADDERPTS, points=ladderPts))
     bestTanksText = _getText(TextType.STATS_TEXT, _ms(CYBERSPORT.STATICFORMATIONSUMMARYVIEW_BESTTANKS))
     bestMapsText = _getText(TextType.STATS_TEXT, _ms(CYBERSPORT.STATICFORMATIONSUMMARYVIEW_BESTMAPS))
     notEnoughTanksText = notEnoughMapsText = _getText(TextType.STANDARD_TEXT, _ms(CYBERSPORT.STATICFORMATIONSUMMARYVIEW_NOTENOUGHTANKSMAPS))
     registeredDate = time_utils.getCurrentTimestamp() - random.randint(0, 20) * time_utils.ONE_DAY
     lastBattleDate = time_utils.getCurrentTimestamp() - random.randint(0, 20) * time_utils.ONE_DAY
     registeredDate = _getText(TextType.MAIN_TEXT, BigWorld.wg_getShortDateFormat(registeredDate))
     lastBattleDate = _getText(TextType.MAIN_TEXT, BigWorld.wg_getShortDateFormat(lastBattleDate))
     registeredText = _getText(TextType.STANDARD_TEXT, _ms(CYBERSPORT.STATICFORMATIONSUMMARYVIEW_REGISTERED, date=registeredDate))
     lastBattleText = _getText(TextType.STANDARD_TEXT, _ms(CYBERSPORT.STATICFORMATIONSUMMARYVIEW_LASTBATTLE, date=lastBattleDate))
     ladderIconSource = RES_ICONS.MAPS_ICONS_LIBRARY_CYBERSPORT_LADDER_256_1A
     noAwardsText = _getText(TextType.STATS_TEXT, _ms(CYBERSPORT.STATICFORMATIONSUMMARYVIEW_NOAWARDS))
     ribbonSource = RES_ICONS.MAPS_ICONS_LIBRARY_CYBERSPORT_RIBBON
     battlesNumData, winsPercentData, winsByCaptureData, techDefeatsData = self.__makeStats()
     bestTanks, bestMaps = self.__makeBestTanksMaps()
     bestTanksGroupWidth = 152
     bestMapsGroupWidth = 211
     notEnoughTanksTFVisible = False if len(bestTanks) else True
     notEnoughMapsTFVisible = False if len(bestMaps) else True
     result = {'placeText': placeText,
      'leagueDivisionText': leagueDivisionText,
      'ladderPtsText': ladderPtsText,
      'bestTanksText': bestTanksText,
      'bestMapsText': bestMapsText,
      'notEnoughTanksText': notEnoughTanksText,
      'notEnoughMapsText': notEnoughMapsText,
      'registeredText': registeredText,
      'lastBattleText': lastBattleText,
      'ladderIconSource': ladderIconSource,
      'noAwardsText': noAwardsText,
      'ribbonSource': ribbonSource,
      'battlesNumData': battlesNumData,
      'winsPercentData': winsPercentData,
      'winsByCaptureData': winsByCaptureData,
      'techDefeatsData': techDefeatsData,
      'bestTanks': bestTanks,
      'bestMaps': bestMaps,
      'achievements': self.__makeAchievements(),
      'bestTanksGroupWidth': bestTanksGroupWidth,
      'bestMapsGroupWidth': bestMapsGroupWidth,
      'notEnoughTanksTFVisible': notEnoughTanksTFVisible,
      'notEnoughMapsTFVisible': notEnoughMapsTFVisible}
     self.as_setDataS(result)
Example #5
0
def makeCantJoinReasonTextVO(event, playerData):
    playerState = playerData.getPlayerStateByEventId(event.getEventID())
    stateReasons = playerState.getPlayerStateReasons() if playerState else []
    stateReason = stateReasons[0] if stateReasons else None
    tooltip = None
    buttonVisible = False
    if event.isRegistrationFinished():
        result = formatErrorTextWithIcon(
            EVENT_BOARDS.STATUS_CANTJOIN_REASON_ENDREGISTRATION)
    elif _psr.SPECIALACCOUNT in stateReasons:
        result = getStatusTitleStyle(
            _ms(EVENT_BOARDS.STATUS_CANTJOIN_REASON_SPECIAL))
    elif stateReason is _psr.WASUNREGISTERED:
        result = getStatusTitleStyle(
            _ms(EVENT_BOARDS.STATUS_CANTJOIN_REASON_LEFTEVENT))
        tooltip = makeTooltip(
            EVENT_BOARDS.STATUS_CANTJOIN_REASON_LEFTEVENT,
            EVENT_BOARDS.STATUS_CANTJOIN_REASON_LEFTEVENT_TOOLTIP)
    else:
        limits = event.getLimits()
        if len(stateReasons) > 1:
            reasonText = _ms(EVENT_BOARDS.STATUS_CANTJOIN_REASON_MANY,
                             number=len(stateReasons))
            tooltip = _makeCantJoinReasonTooltip(stateReasons, playerData,
                                                 limits)
        elif stateReason is _psr.BYWINRATE:
            winRate = playerData.getWinRate()
            winRateMin = limits.getWinRateMin()
            winRateMax = limits.getWinRateMax()
            if winRate < winRateMin:
                reasonText = _ms(
                    EVENT_BOARDS.STATUS_CANTJOIN_REASON_BYWINRATELOW,
                    number=str(winRateMin))
            else:
                reasonText = _ms(
                    EVENT_BOARDS.STATUS_CANTJOIN_REASON_BYWINRATEHIGH,
                    number=str(winRateMax))
        elif stateReason is _psr.BYAGE:
            date = BigWorld.wg_getShortDateFormat(
                limits.getRegistrationDateMaxTs())
            reasonText = _ms(EVENT_BOARDS.STATUS_CANTJOIN_REASON_BYAGE,
                             date=date)
        elif stateReason is _psr.BYBATTLESCOUNT:
            battlesCount = playerData.getBattlesCount()
            reasonText = _ms(
                EVENT_BOARDS.STATUS_CANTJOIN_REASON_BYBATTLESCOUNT,
                number=battlesCount)
        elif stateReason is _psr.BYBAN:
            reasonText = _ms(EVENT_BOARDS.STATUS_CANTJOIN_REASON_BANNED)
        elif stateReason is _psr.VEHICLESMISSING:
            reasonText = _ms(
                EVENT_BOARDS.STATUS_CANTJOIN_REASON_VEHICLESMISSING)
        else:
            reasonText = ''
        notAvailableText = formatErrorTextWithIcon(
            EVENT_BOARDS.STATUS_CANTJOIN_NOTAVAILABLE)
        reasonText = text_styles.main(reasonText)
        result = '{} {}'.format(notAvailableText, reasonText)
        buttonVisible = True
    return (result, tooltip, buttonVisible)
Example #6
0
 def getDateTimeFormat(cls, value):
     return cls._makeLocalTimeString(
         value,
         lambda localTime: "{0:>s} {1:>s}".format(
             BigWorld.wg_getShortDateFormat(value), BigWorld.wg_getLongTimeFormat(value)
         ),
     )
    def __populateArenaData(self, commonData, pData):
        arenaTypeID = commonData.get('arenaTypeID', 0)
        guiType = commonData.get('guiType', 0)
        arenaType = ArenaType.g_cache[arenaTypeID] if arenaTypeID > 0 else None
        if guiType == ARENA_GUI_TYPE.RANDOM:
            arenaGuiName = ARENA_TYPE.format(arenaType.gameplayName)
        else:
            arenaGuiName = ARENA_SPECIAL_TYPE.format(guiType)
        commonData['arenaStr'] = ARENA_NAME_PATTERN.format(i18n.makeString(arenaType.name), i18n.makeString(arenaGuiName))
        createTime = commonData.get('arenaCreateTime')
        createTime = time_utils.makeLocalServerTime(createTime)
        commonData['arenaCreateTimeStr'] = BigWorld.wg_getShortDateFormat(createTime) + ' ' + BigWorld.wg_getShortTimeFormat(createTime)
        commonData['arenaCreateTimeOnlyStr'] = BigWorld.wg_getShortTimeFormat(createTime)
        commonData['arenaIcon'] = ARENA_SCREEN_FILE.format(arenaType.geometryName)
        duration = commonData.get('duration', 0)
        minutes = int(duration / 60)
        seconds = int(duration % 60)
        commonData['duration'] = i18n.makeString(TIME_DURATION_STR, minutes, seconds)
        commonData['playerKilled'] = '-'
        if pData.get('killerID', 0):
            lifeTime = pData.get('lifeTime', 0)
            minutes = int(lifeTime / 60)
            seconds = int(lifeTime % 60)
            commonData['playerKilled'] = i18n.makeString(TIME_DURATION_STR, minutes, seconds)
        commonData['timeStats'] = []
        for key in TIME_STATS_KEYS:
            commonData['timeStats'].append({'label': i18n.makeString(TIME_STATS_KEY_BASE.format(key)),
             'value': commonData[key]})

        return
Example #8
0
    def __packStaffData(self, club, syncUserInfo=False):
        members = []
        membersDict = club.getMembers()
        membersCount = len(membersDict)
        for dbID, member in membersDict.iteritems():
            memberType = _getFlashMemberType(member)
            isSelf = dbID == self.__viewerDbID
            limits = self.clubsState.getLimits()
            profile = self.clubsCtrl.getProfile()
            memberStats = member.getSeasonDossier().getRated7x7Stats()
            battlesCount = memberStats.getBattlesCount()
            rating = self.getUserRating(dbID)
            damageCoef = memberStats.getDamageEfficiency() or 0
            avgDamage = memberStats.getAvgDamage() or 0
            avgAssistDamage = memberStats.getDamageAssistedEfficiency() or 0
            avgExperience = memberStats.getAvgXP() or 0
            armorUsingEfficiency = memberStats.getArmorUsingEfficiency() or 0
            joinDate = member.getJoiningTime()
            if isSelf:
                removeBtnTooltip = TOOLTIPS.STATICFORMATIONSTAFFVIEW_REMOVEHIMSELFBTN
            else:
                removeBtnTooltip = TOOLTIPS.STATICFORMATIONSTAFFVIEW_REMOVEMEMBERBTN
            userData = self.getGuiUserData(dbID)
            userData.update({"igrType": getIGRCtrl().getRoomType()})
            members.append(
                {
                    "memberId": dbID,
                    "canRemoved": self.__canBeRemoved(profile, club, member, membersCount, limits),
                    "canPassOwnership": limits.canTransferOwnership(profile, club).success,
                    "canShowContextMenu": not isSelf,
                    "removeMemberBtnIcon": RES_ICONS.MAPS_ICONS_LIBRARY_CROSS,
                    "removeMemberBtnTooltip": removeBtnTooltip,
                    "appointmentSortValue": memberType,
                    "appointment": _packAppointment(profile, club, member, memberType, limits),
                    "ratingSortValue": rating,
                    "rating": self.getGuiUserRating(dbID, text_styles.neutral),
                    "battlesCountSortValue": battlesCount,
                    "battlesCount": text_styles.main(BigWorld.wg_getIntegralFormat(battlesCount)),
                    "damageCoefSortValue": damageCoef,
                    "damageCoef": text_styles.main(BigWorld.wg_getNiceNumberFormat(damageCoef)),
                    "avrDamageSortValue": avgDamage,
                    "avrDamage": text_styles.main(BigWorld.wg_getIntegralFormat(avgDamage)),
                    "avrAssistDamageSortValue": avgAssistDamage,
                    "avrAssistDamage": text_styles.main(BigWorld.wg_getNiceNumberFormat(avgAssistDamage)),
                    "avrExperienceSortValue": avgExperience,
                    "avrExperience": text_styles.main(BigWorld.wg_getIntegralFormat(avgExperience)),
                    "tauntSortValue": armorUsingEfficiency,
                    "taunt": text_styles.main(BigWorld.wg_getNiceNumberFormat(armorUsingEfficiency)),
                    "joinDateSortValue": joinDate,
                    "joinDate": text_styles.standard(BigWorld.wg_getShortDateFormat(joinDate)),
                    "userDataSortValue": self.getUserFullName(dbID).lower(),
                    "userData": userData,
                    "clubDbID": self._clubDbID,
                }
            )

        if syncUserInfo:
            self.syncUsersInfo()
        return {"members": sorted(members, key=lambda k: k["userDataSortValue"].lower())}
Example #9
0
 def __makeDayOfBattle(self, dayOfBattle, timestamp):
     if dayOfBattle == self.DAY_OF_BATTLE.TODAY:
         availability = i18n.makeString(FORTIFICATIONS.fortclanbattlelist_renderdayofbattle('today'))
     elif dayOfBattle == self.DAY_OF_BATTLE.TOMORROW:
         availability = i18n.makeString(FORTIFICATIONS.fortclanbattlelist_renderdayofbattle('tomorrow'))
     else:
         availability = BigWorld.wg_getShortDateFormat(timestamp)
     return self.app.utilsManager.textManager.getText(TextType.MAIN_TEXT, availability)
Example #10
0
 def __makeDayOfBattle(self, dayOfBattle, timestamp):
     if dayOfBattle == self.DAY_OF_BATTLE.TODAY:
         availability = i18n.makeString(I18N_FORTIFICATIONS.fortclanbattlelist_renderdayofbattle('today'))
     elif dayOfBattle == self.DAY_OF_BATTLE.TOMORROW:
         availability = i18n.makeString(I18N_FORTIFICATIONS.fortclanbattlelist_renderdayofbattle('tomorrow'))
     else:
         availability = BigWorld.wg_getShortDateFormat(timestamp)
     return text_styles.main(availability)
Example #11
0
def _getLastBattleText(battlesCount, globalStats):
    lastBattleDate = text_styles.main(
        BigWorld.wg_getShortDateFormat(globalStats.getLastBattleTime()))
    if battlesCount > 0:
        return text_styles.standard(
            _ms(CYBERSPORT.STATICFORMATIONSUMMARYVIEW_LASTBATTLE,
                date=lastBattleDate))
    return ''
Example #12
0
    def __packStaffData(self, club, syncUserInfo = False):
        members = []
        membersDict = club.getMembers()
        membersCount = len(membersDict)
        for dbID, member in membersDict.iteritems():
            memberType = _getFlashMemberType(member)
            isSelf = dbID == self.__viewerDbID
            limits = self.clubsState.getLimits()
            profile = self.clubsCtrl.getProfile()
            memberStats = member.getSeasonDossier().getRated7x7Stats()
            battlesCount = memberStats.getBattlesCount()
            rating = self.getUserRating(dbID)
            damageCoef = memberStats.getDamageEfficiency() or 0
            avgDamage = memberStats.getAvgDamage() or 0
            avgAssistDamage = memberStats.getDamageAssistedEfficiency() or 0
            avgExperience = memberStats.getAvgXP() or 0
            armorUsingEfficiency = memberStats.getArmorUsingEfficiency() or 0
            joinDate = member.getJoiningTime()
            contact = self.getContact(dbID)
            if isSelf:
                removeBtnTooltip = TOOLTIPS.STATICFORMATIONSTAFFVIEW_REMOVEHIMSELFBTN
            else:
                removeBtnTooltip = TOOLTIPS.STATICFORMATIONSTAFFVIEW_REMOVEMEMBERBTN
            isValid, userData = self.getGuiUserDataWithStatus(dbID)
            userData.update({'igrType': getIGRCtrl().getRoomType()})
            members.append({'memberId': dbID,
             'canRemoved': self.__canBeRemoved(profile, club, member, membersCount, limits),
             'canPassOwnership': limits.canTransferOwnership(profile, club).success,
             'canShowContextMenu': not isSelf and isValid,
             'removeMemberBtnIcon': RES_ICONS.MAPS_ICONS_LIBRARY_CROSS,
             'removeMemberBtnTooltip': removeBtnTooltip,
             'appointmentSortValue': memberType,
             'appointment': _packAppointment(profile, club, member, memberType, limits),
             'ratingSortValue': rating,
             'rating': self.getGuiUserRating(dbID, text_styles.neutral),
             'battlesCountSortValue': battlesCount,
             'battlesCount': text_styles.main(BigWorld.wg_getIntegralFormat(battlesCount)),
             'damageCoefSortValue': damageCoef,
             'damageCoef': text_styles.main(BigWorld.wg_getNiceNumberFormat(damageCoef)),
             'avrDamageSortValue': avgDamage,
             'avrDamage': text_styles.main(BigWorld.wg_getIntegralFormat(avgDamage)),
             'avrAssistDamageSortValue': avgAssistDamage,
             'avrAssistDamage': text_styles.main(BigWorld.wg_getNiceNumberFormat(avgAssistDamage)),
             'avrExperienceSortValue': avgExperience,
             'avrExperience': text_styles.main(BigWorld.wg_getIntegralFormat(avgExperience)),
             'tauntSortValue': armorUsingEfficiency,
             'taunt': text_styles.main(BigWorld.wg_getNiceNumberFormat(armorUsingEfficiency)),
             'joinDateSortValue': joinDate,
             'joinDate': text_styles.standard(BigWorld.wg_getShortDateFormat(joinDate)),
             'userDataSortValue': self.getUserFullName(dbID).lower(),
             'userData': userData,
             'clubDbID': self._clubDbID,
             'statusIcon': _getStatusIcon(contact)})

        if syncUserInfo:
            self.syncUsersInfo()
        return {'members': sorted(members, key=lambda k: k['userDataSortValue'].lower())}
Example #13
0
    def __packStaffData(self, club, syncUserInfo = False):
        members = []
        membersDict = club.getMembers()
        membersCount = len(membersDict)
        for dbID, member in membersDict.iteritems():
            memberType = _getFlashMemberType(member)
            isSelf = dbID == self.__viewerDbID
            limits = self.clubsState.getLimits()
            profile = self.clubsCtrl.getProfile()
            memberStats = member.getSeasonDossier().getRated7x7Stats()
            battlesCount = memberStats.getBattlesCount()
            rating = self.getUserRating(dbID)
            damageCoef = memberStats.getDamageEfficiency() or 0
            avgDamage = memberStats.getAvgDamage() or 0
            avgAssistDamage = memberStats.getDamageAssistedEfficiency() or 0
            avgExperience = memberStats.getAvgXP() or 0
            armorUsingEfficiency = memberStats.getArmorUsingEfficiency() or 0
            joinDate = member.getJoiningTime()
            if isSelf:
                removeBtnTooltip = TOOLTIPS.STATICFORMATIONSTAFFVIEW_REMOVEHIMSELFBTN
            else:
                removeBtnTooltip = TOOLTIPS.STATICFORMATIONSTAFFVIEW_REMOVEMEMBERBTN
            userData = self.getGuiUserData(dbID)
            userData.update({'igrType': getIGRCtrl().getRoomType()})
            members.append({'memberId': dbID,
             'canRemoved': self.__canBeRemoved(profile, club, member, membersCount, limits),
             'canPassOwnership': limits.canTransferOwnership(profile, club).success,
             'canShowContextMenu': not isSelf,
             'removeMemberBtnIcon': RES_ICONS.MAPS_ICONS_LIBRARY_CROSS,
             'removeMemberBtnTooltip': removeBtnTooltip,
             'appointmentSortValue': memberType,
             'appointment': _packAppointment(profile, club, member, memberType, limits),
             'ratingSortValue': rating,
             'rating': self.getGuiUserRating(dbID, text_styles.neutral),
             'battlesCountSortValue': battlesCount,
             'battlesCount': text_styles.main(BigWorld.wg_getIntegralFormat(battlesCount)),
             'damageCoefSortValue': damageCoef,
             'damageCoef': text_styles.main(BigWorld.wg_getNiceNumberFormat(damageCoef)),
             'avrDamageSortValue': avgDamage,
             'avrDamage': text_styles.main(BigWorld.wg_getIntegralFormat(avgDamage)),
             'avrAssistDamageSortValue': avgAssistDamage,
             'avrAssistDamage': text_styles.main(BigWorld.wg_getNiceNumberFormat(avgAssistDamage)),
             'avrExperienceSortValue': avgExperience,
             'avrExperience': text_styles.main(BigWorld.wg_getIntegralFormat(avgExperience)),
             'tauntSortValue': armorUsingEfficiency,
             'taunt': text_styles.main(BigWorld.wg_getNiceNumberFormat(armorUsingEfficiency)),
             'joinDateSortValue': joinDate,
             'joinDate': text_styles.standard(BigWorld.wg_getShortDateFormat(joinDate)),
             'userDataSortValue': self.getUserFullName(dbID).lower(),
             'userData': userData,
             'clubDbID': self._clubDbID})

        if syncUserInfo:
            self.syncUsersInfo()
        return {'members': sorted(members, key=lambda k: k['userDataSortValue'].lower())}
 def _updateHeader(self):
     title = _ms(
         FORTIFICATIONS.FORTDECLARATIONOFWARWINDOW_HEADER,
         date=BigWorld.wg_getShortDateFormat(self.__selectedDayStart),
         startTime=BigWorld.wg_getShortTimeFormat(self.__defHourStart),
         endTime=BigWorld.wg_getShortTimeFormat(self.__defHourStart +
                                                time_utils.ONE_HOUR),
         clanName='[%s]' % self.__item.getClanAbbrev())
     description = _ms(
         FORTIFICATIONS.FORTDECLARATIONOFWARWINDOW_DESCRIPTION)
     self.as_setupHeaderS(title, description)
Example #15
0
 def __setData(self, club):
     ladderInfo = club.getLadderInfo()
     seasonDossier = club.getSeasonDossier()
     totalStats = seasonDossier.getTotalStats()
     battlesNumData, winsPercentData, attackDamageEfficiency, defenceDamageEfficiency = _makeStats(
         totalStats)
     battleCounts = totalStats.getBattlesCount()
     ladderIconSource = getLadderChevron256x256(
         ladderInfo.getDivision() if battleCounts else None)
     globalStats = seasonDossier.getGlobalStats()
     registeredDate = text_styles.main(
         BigWorld.wg_getShortDateFormat(club.getCreationTime()))
     registeredText = text_styles.standard(
         _ms(CYBERSPORT.STATICFORMATIONSUMMARYVIEW_REGISTERED,
             date=registeredDate))
     lastBattleText = _getLastBattleText(battleCounts, globalStats)
     bestTanksText = text_styles.stats(
         CYBERSPORT.STATICFORMATIONSUMMARYVIEW_BESTTANKS)
     bestMapsText = text_styles.stats(
         CYBERSPORT.STATICFORMATIONSUMMARYVIEW_BESTMAPS)
     notEnoughTanksText = notEnoughMapsText = text_styles.standard(
         CYBERSPORT.STATICFORMATIONSUMMARYVIEW_NOTENOUGHTANKSMAPS)
     bestTanks = _getVehiclesList(totalStats)
     bestMaps = _getMapsList(totalStats)
     noAwardsText = text_styles.stats(
         CYBERSPORT.STATICFORMATIONSUMMARYVIEW_NOAWARDS)
     ribbonSource = RES_ICONS.MAPS_ICONS_LIBRARY_CYBERSPORT_RIBBON
     self.as_setDataS({
         'clubId': club.getClubDbID(),
         'placeText': _getPositionText(ladderInfo),
         'leagueDivisionText': _getDivisionText(ladderInfo),
         'ladderPtsText': _getLadderPointsText(ladderInfo),
         'bestTanksText': bestTanksText,
         'bestMapsText': bestMapsText,
         'notEnoughTanksText': notEnoughTanksText,
         'notEnoughMapsText': notEnoughMapsText,
         'registeredText': registeredText,
         'lastBattleText': lastBattleText,
         'ladderIconSource': ladderIconSource,
         'noAwardsText': noAwardsText,
         'ribbonSource': ribbonSource,
         'battlesNumData': battlesNumData,
         'winsPercentData': winsPercentData,
         'attackDamageEfficiencyData': attackDamageEfficiency,
         'defenceDamageEfficiencyData': defenceDamageEfficiency,
         'bestTanks': bestTanks,
         'notEnoughTanksTFVisible': not len(bestTanks),
         'bestMaps': bestMaps,
         'notEnoughMapsTFVisible': not len(bestMaps),
         'achievements': _makeAchievements(seasonDossier),
         'bestTanksGroupWidth': BEST_TANKS_GROUP_WIDTH,
         'bestMapsGroupWidth': BEST_MAPS_GROUP_WIDTH
     })
     return
Example #16
0
 def __setData(self, club):
     ladderInfo = club.getLadderInfo()
     seasonDossier = club.getSeasonDossier()
     totalStats = seasonDossier.getTotalStats()
     battlesNumData, winsPercentData, attackDamageEfficiency, defenceDamageEfficiency = _makeStats(totalStats)
     battleCounts = totalStats.getBattlesCount()
     ladderIconSource = getLadderChevron256x256(ladderInfo.getDivision() if battleCounts else None)
     globalStats = seasonDossier.getGlobalStats()
     registeredDate = text_styles.main(BigWorld.wg_getShortDateFormat(club.getCreationTime()))
     registeredText = text_styles.standard(
         _ms(CYBERSPORT.STATICFORMATIONSUMMARYVIEW_REGISTERED, date=registeredDate)
     )
     lastBattleText = _getLastBattleText(battleCounts, globalStats)
     bestTanksText = text_styles.stats(CYBERSPORT.STATICFORMATIONSUMMARYVIEW_BESTTANKS)
     bestMapsText = text_styles.stats(CYBERSPORT.STATICFORMATIONSUMMARYVIEW_BESTMAPS)
     notEnoughTanksText = notEnoughMapsText = text_styles.standard(
         CYBERSPORT.STATICFORMATIONSUMMARYVIEW_NOTENOUGHTANKSMAPS
     )
     bestTanks = _getVehiclesList(totalStats)
     bestMaps = _getMapsList(totalStats)
     noAwardsText = text_styles.stats(CYBERSPORT.STATICFORMATIONSUMMARYVIEW_NOAWARDS)
     ribbonSource = RES_ICONS.MAPS_ICONS_LIBRARY_CYBERSPORT_RIBBON
     self.as_setDataS(
         {
             "clubId": club.getClubDbID(),
             "placeText": _getPositionText(ladderInfo),
             "leagueDivisionText": _getDivisionText(ladderInfo),
             "ladderPtsText": _getLadderPointsText(ladderInfo),
             "bestTanksText": bestTanksText,
             "bestMapsText": bestMapsText,
             "notEnoughTanksText": notEnoughTanksText,
             "notEnoughMapsText": notEnoughMapsText,
             "registeredText": registeredText,
             "lastBattleText": lastBattleText,
             "ladderIconSource": ladderIconSource,
             "noAwardsText": noAwardsText,
             "ribbonSource": ribbonSource,
             "battlesNumData": battlesNumData,
             "winsPercentData": winsPercentData,
             "attackDamageEfficiencyData": attackDamageEfficiency,
             "defenceDamageEfficiencyData": defenceDamageEfficiency,
             "bestTanks": bestTanks,
             "notEnoughTanksTFVisible": not len(bestTanks),
             "bestMaps": bestMaps,
             "notEnoughMapsTFVisible": not len(bestMaps),
             "achievements": _makeAchievements(seasonDossier),
             "bestTanksGroupWidth": BEST_TANKS_GROUP_WIDTH,
             "bestMapsGroupWidth": BEST_MAPS_GROUP_WIDTH,
         }
     )
     return
 def __makeDefencePeriodData(self):
     alertMessage = ''
     blockBtnEnabled = True
     fort = self.fortCtrl.getFort()
     inProcess, inCooldown = fort.getDefenceHourProcessing()
     if self._isFortFrozen():
         conditionPostfix = text_styles.standard(fort.getDefencePeriodStr())
     else:
         conditionPostfix = text_styles.neutral(fort.getDefencePeriodStr())
     blockBtnToolTip = TOOLTIPS.FORTIFICATION_FORTSETTINGSWINDOW_DEFENCEBTNENABLED
     descriptionTooltip = TOOLTIPS.FORTIFICATION_FORTSETTINGSWINDOW_DEFENCEPERIODDESCRIPTION
     if inProcess:
         defenceHourChangeDay, nextDefenceHour, _ = fort.events[
             FORT_EVENT_TYPE.DEFENCE_HOUR_CHANGE]
         timestampStart = time_utils.getTimeTodayForUTC(nextDefenceHour)
         value = '%s - %s' % (
             BigWorld.wg_getShortTimeFormat(timestampStart),
             BigWorld.wg_getShortTimeFormat(timestampStart +
                                            time_utils.ONE_HOUR))
         msgString = i18n.makeString(
             FORTIFICATIONS.SETTINGSWINDOW_BLOCKCONDITION_INPROGRESS,
             value=value,
             date=BigWorld.wg_getShortDateFormat(defenceHourChangeDay))
         alertMessage = text_styles.alert(msgString)
         blockBtnEnabled = False
         blockBtnToolTip = TOOLTIPS.FORTIFICATION_FORTSETTINGSWINDOW_DEFENCEBTNDISABLED
     elif inCooldown:
         msgString = i18n.makeString(
             FORTIFICATIONS.SETTINGSWINDOW_BLOCKCONDITION_RECENTLYSCHEDULED)
         alertMessage = text_styles.alert(msgString)
         blockBtnEnabled = False
         blockBtnToolTip = TOOLTIPS.FORTIFICATION_FORTSETTINGSWINDOW_DEFENCEBTNDISABLED
     conditionPrefix = text_styles.main(
         i18n.makeString(
             FORTIFICATIONS.settingswindow_blockcondition(
                 'defencePeriodTime')))
     blockDescr = text_styles.standard(
         i18n.makeString(
             FORTIFICATIONS.settingswindow_blockdescr('defencePeriodTime')))
     if alertMessage:
         alertMessage = icons.alert() + ' ' + alertMessage
     return {
         'blockBtnEnabled': blockBtnEnabled,
         'blockDescr': blockDescr,
         'blockCondition': conditionPrefix + ' ' + conditionPostfix,
         'alertMessage': alertMessage,
         'blockBtnToolTip': blockBtnToolTip,
         'descriptionTooltip': descriptionTooltip
     }
 def __makeDefencePeriodData(self):
     alertMessage = ""
     blockBtnEnabled = True
     fort = self.fortCtrl.getFort()
     inProcess, inCooldown = fort.getDefenceHourProcessing()
     if self._isFortFrozen():
         conditionPostfix = text_styles.standard(fort.getDefencePeriodStr())
     else:
         conditionPostfix = text_styles.neutral(fort.getDefencePeriodStr())
     blockBtnToolTip = TOOLTIPS.FORTIFICATION_FORTSETTINGSWINDOW_DEFENCEBTNENABLED
     descriptionTooltip = TOOLTIPS.FORTIFICATION_FORTSETTINGSWINDOW_DEFENCEPERIODDESCRIPTION
     if inProcess:
         defenceHourChangeDay, nextDefenceHour, _ = fort.events[FORT_EVENT_TYPE.DEFENCE_HOUR_CHANGE]
         timestampStart = time_utils.getTimeTodayForUTC(nextDefenceHour)
         value = "%s - %s" % (
             BigWorld.wg_getShortTimeFormat(timestampStart),
             BigWorld.wg_getShortTimeFormat(timestampStart + time_utils.ONE_HOUR),
         )
         msgString = i18n.makeString(
             FORTIFICATIONS.SETTINGSWINDOW_BLOCKCONDITION_INPROGRESS,
             value=value,
             date=BigWorld.wg_getShortDateFormat(defenceHourChangeDay),
         )
         alertMessage = text_styles.alert(msgString)
         blockBtnEnabled = False
         blockBtnToolTip = TOOLTIPS.FORTIFICATION_FORTSETTINGSWINDOW_DEFENCEBTNDISABLED
     elif inCooldown:
         msgString = i18n.makeString(FORTIFICATIONS.SETTINGSWINDOW_BLOCKCONDITION_RECENTLYSCHEDULED)
         alertMessage = text_styles.alert(msgString)
         blockBtnEnabled = False
         blockBtnToolTip = TOOLTIPS.FORTIFICATION_FORTSETTINGSWINDOW_DEFENCEBTNDISABLED
     conditionPrefix = text_styles.main(
         i18n.makeString(FORTIFICATIONS.settingswindow_blockcondition("defencePeriodTime"))
     )
     blockDescr = text_styles.standard(
         i18n.makeString(FORTIFICATIONS.settingswindow_blockdescr("defencePeriodTime"))
     )
     if alertMessage:
         alertMessage = icons.alert() + " " + alertMessage
     return {
         "blockBtnEnabled": blockBtnEnabled,
         "blockDescr": blockDescr,
         "blockCondition": conditionPrefix + " " + conditionPostfix,
         "alertMessage": alertMessage,
         "blockBtnToolTip": blockBtnToolTip,
         "descriptionTooltip": descriptionTooltip,
     }
 def _packBlocks(self, *args, **kwargs):
     items = super(RankedUnavailableTooltip, self)._packBlocks(*args, **kwargs)
     hasSuitableVehicles = self.rankedController.hasSuitableVehicles()
     tooltipData = TOOLTIPS.BATTLETYPES_RANKED
     header = i18n.makeString(tooltipData + '/header')
     bodyKey = tooltipData + '/body'
     body = i18n.makeString(bodyKey)
     nextSeason = self.rankedController.getNextSeason()
     if hasSuitableVehicles:
         if self.rankedController.isFrozen():
             additionalInfo = i18n.makeString(bodyKey + '/frozen')
         elif nextSeason is not None:
             additionalInfo = i18n.makeString(bodyKey + '/coming', date=BigWorld.wg_getShortDateFormat(time_utils.makeLocalServerTime(nextSeason.getStartDate())))
         else:
             additionalInfo = i18n.makeString(bodyKey + '/disabled')
         body = '%s\n\n%s' % (body, additionalInfo)
     items.append(formatters.packImageTextBlockData(title=text_styles.middleTitle(header), desc=text_styles.main(body)))
     return items
 def __getRankedAvailabilityData(self):
     hasSuitableVehicles = self.rankedController.hasSuitableVehicles()
     if self.rankedController.isAvailable() and hasSuitableVehicles:
         return (TOOLTIPS_CONSTANTS.RANKED_SELECTOR_INFO, True)
     else:
         tooltipData = TOOLTIPS.BATTLETYPES_RANKED
         header = i18n.makeString(tooltipData + '/header')
         bodyKey = tooltipData + '/body'
         body = i18n.makeString(bodyKey)
         nextSeason = self.rankedController.getNextSeason()
         if hasSuitableVehicles:
             if self.rankedController.isFrozen():
                 additionalInfo = i18n.makeString(bodyKey + '/frozen')
             elif nextSeason is not None:
                 additionalInfo = i18n.makeString(bodyKey + '/coming', date=BigWorld.wg_getShortDateFormat(time_utils.makeLocalServerTime(nextSeason.getStartDate())))
             else:
                 additionalInfo = i18n.makeString(bodyKey + '/disabled')
             body = '%s\n\n%s' % (body, additionalInfo)
         res = makeTooltip(header, body)
         return (res, False)
Example #21
0
def _makeCantJoinReasonTooltip(stateReasons, playerData, limits):
    def _addItem(name, error):
        formatter = formatNotAvailableTextWithIcon if error else formatOkTextWithIcon
        return (error, formatter(name))

    header = TOOLTIPS.ELEN_STATUS_REQUIREMENTS_HEADER
    body = ''
    date = BigWorld.wg_getShortDateFormat(limits.getRegistrationDateMaxTs())
    winRateMin = limits.getWinRateMin()
    winRateMax = limits.getWinRateMax()
    battlesCount = limits.getBattlesCountMin()
    winRate = playerData.getWinRate()
    items = list()
    items.append(
        _addItem(_ms(TOOLTIPS.ELEN_STATUS_CANTJOIN_REASON_BYAGE, date=date),
                 _psr.BYAGE in stateReasons))
    items.append(
        _addItem(_ms(TOOLTIPS.ELEN_STATUS_CANTJOIN_REASON_BYVEHICLE),
                 _psr.VEHICLESMISSING in stateReasons))
    if battlesCount:
        items.append(
            _addItem(
                _ms(TOOLTIPS.ELEN_STATUS_CANTJOIN_REASON_BYBATTLESCOUNT,
                    number=battlesCount), _psr.BYBATTLESCOUNT in stateReasons))
    if winRateMin:
        items.append(
            _addItem(
                _ms(TOOLTIPS.ELEN_STATUS_CANTJOIN_REASON_BYWINRATELOW,
                    number=winRateMin), _psr.BYWINRATE in stateReasons
                and winRate < winRateMin))
    if winRateMax:
        items.append(
            _addItem(
                _ms(TOOLTIPS.ELEN_STATUS_CANTJOIN_REASON_BYWINRATEHIGH,
                    number=winRateMax), _psr.BYWINRATE in stateReasons
                and winRate > winRateMax))
    items.sort(key=lambda item: item[0], reverse=True)
    body = '\n'.join([item[1] for item in items])
    return makeTooltip(header, body)
Example #22
0
 def getMessageLongDatetimeFormat(cls, time):
     return '({0:>s} {1:>s}) '.format(
         BigWorld.wg_getShortDateFormat(time),
         BigWorld.wg_getLongTimeFormat(time)).decode('utf-8', 'ignore')
Example #23
0
 def getShortDatetimeFormat(cls, time):
     return '{0:>s} {1:>s}'.format(BigWorld.wg_getShortDateFormat(time),
                                   BigWorld.wg_getShortTimeFormat(time))
Example #24
0
 def getFormattedDate(self):
     return BigWorld.wg_getShortDateFormat(
         self.joinTime) + ' - ' + BigWorld.wg_getShortDateFormat(
             self.leaveTime)
Example #25
0
 def _getDateTimeString(timeValue):
     return '{0:>s} {1:>s}'.format(
         BigWorld.wg_getShortDateFormat(timeValue),
         BigWorld.wg_getShortTimeFormat(timeValue))
Example #26
0
 def _getValue(self, value):
     return BigWorld.wg_getShortDateFormat(self._getLocalTime(value))
 def _convert(self, record, reusable):
     return ' '.join((BigWorld.wg_getShortDateFormat(record),
                      BigWorld.wg_getShortTimeFormat(record)))
    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)
Example #29
0
 def getDateTimeFormat(cls, value):
     return cls._makeLocalTimeString(
         value, lambda localTime: '{0:>s} {1:>s}'.format(
             BigWorld.wg_getShortDateFormat(value),
             BigWorld.wg_getLongTimeFormat(value)))
Example #30
0
    def __getDirectionTooltipData(self, dirName, buildings, attackerClanDBID, attackerClanName, attackTime, availableTime):
        infoMessage = ''
        bodyParts = []
        if self.fortCtrl.getFort().isFrozen() or self.__weAreAtWar:
            return (None, None, None)
        else:
            buildingsMsgs = []
            for building in buildings:
                if building is not None:
                    extraInfo = ''
                    if building['buildingLevel'] < FORTIFICATION_ALIASES.CLAN_BATTLE_BUILDING_MIN_LEVEL:
                        extraInfo = _ms(FORTIFICATIONS.FORTINTELLIGENCE_CLANDESCRIPTION_DIRECTION_TOOLTIP_BUILDINGLOWLEVEL, minLevel=fort_formatters.getTextLevel(FORTIFICATION_ALIASES.CLAN_BATTLE_BUILDING_MIN_LEVEL))
                    buildingsMsgs.insert(0, _ms(FORTIFICATIONS.FORTINTELLIGENCE_CLANDESCRIPTION_DIRECTION_TOOLTIP_BUILDINGITEM, name=_ms(FORTIFICATIONS.buildings_buildingname(building['uid'])), level=_ms(FORTIFICATIONS.FORTMAINVIEW_HEADER_LEVELSLBL, buildLevel=str(fort_formatters.getTextLevel(building['buildingLevel']))), extraInfo=extraInfo))

            buildingsNames = '\n'.join(buildingsMsgs)
            if availableTime is not None:
                infoMessage = _ms(FORTIFICATIONS.FORTINTELLIGENCE_CLANDESCRIPTION_DIRECTION_NOTAVAILABLE, date=BigWorld.wg_getShortDateFormat(availableTime))
                bodyParts.append(_ms(FORTIFICATIONS.FORTINTELLIGENCE_CLANDESCRIPTION_DIRECTION_TOOLTIP_NOTAVAILABLE_INFO, date=BigWorld.wg_getShortDateFormat(availableTime)))
                header = _ms(FORTIFICATIONS.FORTINTELLIGENCE_CLANDESCRIPTION_DIRECTION_TOOLTIP_NOTAVAILABLE_HEADER, direction=dirName)
            elif attackerClanDBID is None:
                if buildingsNames:
                    bodyParts.append(_ms(FORTIFICATIONS.FORTINTELLIGENCE_CLANDESCRIPTION_DIRECTION_TOOLTIP_BUILDINGS, buildings=buildingsNames))
                if self.fortCtrl.getPermissions().canPlanAttack():
                    bodyParts.append(_ms(FORTIFICATIONS.FORTINTELLIGENCE_CLANDESCRIPTION_DIRECTION_TOOLTIP_ATTACKINFO))
                    header = _ms(FORTIFICATIONS.FORTINTELLIGENCE_CLANDESCRIPTION_DIRECTION_TOOLTIP_ATTACK, direction=dirName)
                else:
                    bodyParts.append(_ms(FORTIFICATIONS.FORTINTELLIGENCE_CLANDESCRIPTION_DIRECTION_TOOLTIP_NOTCOMMANDERINFO))
                    header = _ms(FORTIFICATIONS.FORTINTELLIGENCE_CLANDESCRIPTION_DIRECTION_TOOLTIP_NOTCOMMANDER, direction=dirName)
            else:
                bodyParts.append(_ms(FORTIFICATIONS.FORTINTELLIGENCE_CLANDESCRIPTION_DIRECTION_TOOLTIP_BUSY_INFO, date=BigWorld.wg_getShortDateFormat(attackTime), clanName=attackerClanName))
                if buildingsNames:
                    bodyParts.append(_ms(FORTIFICATIONS.FORTINTELLIGENCE_CLANDESCRIPTION_DIRECTION_TOOLTIP_BUILDINGS, buildings=buildingsNames))
                header = _ms(FORTIFICATIONS.FORTINTELLIGENCE_CLANDESCRIPTION_DIRECTION_TOOLTIP_BUSY_HEADER, direction=dirName)
            return (header, '\n'.join(bodyParts), infoMessage)
Example #31
0
def formatTimeAndDate(ts):
    return '{0:>s} {1:>s}'.format(BigWorld.wg_getShortDateFormat(ts),
                                  BigWorld.wg_getShortTimeFormat(ts))
Example #32
0
 def _formatFinishTime(self):
     return '{} {}'.format(
         text_styles.main(i18n.makeString(QUESTS.ACTION_TIME_FINISH)),
         BigWorld.wg_getShortDateFormat(self.getFinishTime()))
Example #33
0
 def _getStartTime(self):
     startTimeStr = BigWorld.wg_getShortDateFormat(self.__startTime)
     return text_styles.main(
         i18n.makeString(
             QUESTS.ACTION_COMINGSOON_TIME,
             startTime=startTimeStr)) if startTimeStr is not None else ''
Example #34
0
def getVacationPeriodString(startTime, endTime):
    return "{0:>s} - {1:>s}".format(BigWorld.wg_getShortDateFormat(startTime), BigWorld.wg_getShortDateFormat(endTime))
 def _updateHeader(self):
     title = _ms(FORTIFICATIONS.FORTDECLARATIONOFWARWINDOW_HEADER, date=BigWorld.wg_getShortDateFormat(self.__selectedDayStart), startTime=BigWorld.wg_getShortTimeFormat(self.__defHourStart), endTime=BigWorld.wg_getShortTimeFormat(self.__defHourStart + time_utils.ONE_HOUR), clanName='[%s]' % self.__item.getClanAbbrev())
     description = _ms(FORTIFICATIONS.FORTDECLARATIONOFWARWINDOW_DESCRIPTION)
     self.as_setupHeaderS(title, description)
Example #36
0
 def getDateTimeFormat(cls, value):
     value = time_utils.makeLocalServerTime(value)
     return '{0:>s} {1:>s}'.format(BigWorld.wg_getShortDateFormat(value), BigWorld.wg_getLongTimeFormat(value))
    def _updateDirections(self):
        directions = []
        selectedDirection = -1
        enemyBuildings = [None, None]
        for buildingID, buildingData in self.__item.getDictBuildingsBrief().iteritems():
            dirId = getDirectionFromDirPos(buildingData['dirPosByte'])
            if self.__direction == dirId:
                pos = getPositionFromDirPos(buildingData['dirPosByte'])
                level = buildingData['level']
                if 0 <= level < 5:
                    isAvailable = False
                else:
                    isAvailable = self.__isBuildingAvailableForAttack(buildingData['hp'], g_fortCache.buildings[buildingID].levels[level].hp)
                enemyBuildings[pos] = {'uid': self.getBuildingUIDbyID(buildingID),
                 'progress': self._getProgress(buildingID, level),
                 'buildingLevel': level,
                 'isAvailable': isAvailable}

        enemyDirection = {'name': _ms('#fortifications:General/directionName%d' % self.__direction),
         'isMine': False,
         'buildings': enemyBuildings}
        fort = self.fortCtrl.getFort()
        for direction in range(1, g_fortCache.maxDirections + 1):
            isOpened = fort.isDirectionOpened(direction)
            isBusy = False
            availableTime = None
            name = _ms('#fortifications:General/directionName%d' % direction)
            ttHeader = _ms(FORTIFICATIONS.FORTDECLARATIONOFWARWINDOW_ITEM_NOTOPENED_TOOLTIP_HEADER)
            ttBody = _ms(FORTIFICATIONS.FORTDECLARATIONOFWARWINDOW_ITEM_NOTOPENED_TOOLTIP_BODY)
            infoMessage = ''
            allieBuildings = []
            if isOpened:
                for building in fort.getBuildingsByDirections().get(direction, ()):
                    data = None
                    if building is not None:
                        buildingTypeId = building.typeID
                        data = {'uid': self.getBuildingUIDbyID(buildingTypeId),
                         'progress': self._getProgress(buildingTypeId, building.level),
                         'buildingLevel': building.level,
                         'isAvailable': self.__isBuildingAvailableForAttack(building.hp, building.levelRef.hp)}
                    allieBuildings.append(data)

                eventTypeID = FORT_EVENT_TYPE.DIR_OPEN_ATTACKS_BASE + direction
                availableTime, _, _ = fort.events.get(eventTypeID, (None, None, None))
                if availableTime <= self.__selectedDayStart:
                    availableTime = None
                if availableTime is None:
                    attackerClanName = None
                    todayAttacks = fort.getAttacks(filterFunc=lambda a: self.__selectedDayStart <= a.getStartTime() <= self.__selectedDayFinish and a.isPlanned())
                    roamingDateAttacks = fort.getAttacks(filterFunc=lambda a: a.getStartTime() - time_utils.ONE_DAY < self.__defHourStart < a.getStartTime() + time_utils.ONE_DAY and a.isPlanned())
                    for attack in todayAttacks + roamingDateAttacks:
                        if direction == attack.getDirection():
                            isBusy = True
                            _, defClanAbbrev, _ = attack.getOpponentClanInfo()
                            attackerClanName = '[%s]' % defClanAbbrev

                    if isBusy:
                        ttHeader = _ms(FORTIFICATIONS.FORTDECLARATIONOFWARWINDOW_ITEM_BUSY_TOOLTIP_HEADER)
                        ttBody = _ms(FORTIFICATIONS.FORTDECLARATIONOFWARWINDOW_ITEM_BUSY_TOOLTIP_BODY, clanName=attackerClanName)
                    else:
                        clanForAttackTag = '[%s]' % self.__item.getClanAbbrev()
                        ttHeader = _ms(FORTIFICATIONS.FORTDECLARATIONOFWARWINDOW_ITEM_ATTACK_TOOLTIP_HEADER, direction=name)
                        ttBody = _ms(FORTIFICATIONS.FORTDECLARATIONOFWARWINDOW_ITEM_ATTACK_TOOLTIP_BODY, direction=name, clanName=clanForAttackTag)
                else:
                    infoMessage = _ms(FORTIFICATIONS.FORTDECLARATIONOFWARWINDOW_DIRECTION_NOTAVAILABLE, date=BigWorld.wg_getShortDateFormat(availableTime))
                    ttHeader = _ms(FORTIFICATIONS.FORTDECLARATIONOFWARWINDOW_ITEM_NOTAVAILABLE_TOOLTIP_HEADER)
                    ttBody = _ms(FORTIFICATIONS.FORTDECLARATIONOFWARWINDOW_ITEM_NOTAVAILABLE_TOOLTIP_BODY, date=BigWorld.wg_getShortDateFormat(availableTime))
                if not isBusy and selectedDirection == -1:
                    selectedDirection = direction
            directions.append({'leftDirection': {'name': name,
                               'uid': direction,
                               'isOpened': isOpened,
                               'isBusy': isBusy or availableTime is not None,
                               'buildings': allieBuildings,
                               'ttHeader': ttHeader,
                               'ttBody': ttBody,
                               'infoMessage': infoMessage},
             'rightDirection': enemyDirection,
             'connectionIcon': RES_ICONS.MAPS_ICONS_LIBRARY_FORTIFICATION_OFFENCE})

        self.as_setDirectionsS(directions)
        self.as_selectDirectionS(selectedDirection)
        return
Example #38
0
 def getMessageLongDatetimeFormat(cls, time):
     return '({0:>s} {1:>s}) '.format(BigWorld.wg_getShortDateFormat(time), BigWorld.wg_getLongTimeFormat(time)).decode('utf-8', 'ignore')
 def getVacationDateStr(self):
     if not self.isVacationEnabled():
         return None
     else:
         start, finish = self.getVacationDate()
         return '%s - %s' % (BigWorld.wg_getShortDateFormat(start), BigWorld.wg_getShortDateFormat(finish))
Example #40
0
 def _getValue(self, value):
     return BigWorld.wg_getShortDateFormat(self._getLocalTime(value))
Example #41
0
 def _getValue(self, value):
     value = self._getLocalTime(value)
     return '{0:>s} {1:>s}'.format(BigWorld.wg_getShortDateFormat(value), BigWorld.wg_getLongTimeFormat(value))
Example #42
0
 def getFormattedDate(self):
     return BigWorld.wg_getShortDateFormat(self.joinTime) + ' - ' + BigWorld.wg_getShortDateFormat(self.leaveTime)
Example #43
0
def getVacationPeriodString(startTime, endTime):
    return '{0:>s} - {1:>s}'.format(BigWorld.wg_getShortDateFormat(startTime),
                                    BigWorld.wg_getShortDateFormat(endTime))
Example #44
0
    def getDisplayableData(self, clanDBID):
        fortCtrl = g_clanCache.fortProvider.getController()
        isFortFrozen = False
        if clanDBID is None:
            fort = fortCtrl.getFort()
            fortDossier = fort.getFortDossier()
            battlesStats = fortDossier.getBattlesStats()
            isFortFrozen = self._isFortFrozen()
            clanName, clanMotto, clanTag = g_clanCache.clanName, '', g_clanCache.clanTag
            clanLvl = fort.level if fort is not None else 0
            homePeripheryID = fort.peripheryID
            playersAtClan, buildingsNum = len(g_clanCache.clanMembers), len(fort.getBuildingsCompleted())
            wEfficiencyVal = ProfileUtils.getFormattedWinsEfficiency(battlesStats)
            combatCount, winsEff, profitEff = battlesStats.getBattlesCount(), ProfileUtils.UNAVAILABLE_SYMBOL if wEfficiencyVal == str(ProfileUtils.UNAVAILABLE_VALUE) else wEfficiencyVal, battlesStats.getProfitFactor()
            creationTime = fortDossier.getGlobalStats().getCreationTime()
            defence, vacation, offDay = fort.getDefencePeriod(), fort.getVacationDate(), fort.getLocalOffDay()
        elif type(clanDBID) in (types.IntType, types.LongType, types.FloatType):
            clanInfo = fortCtrl.getPublicInfoCache().getItem(clanDBID)
            if clanInfo is None:
                LOG_WARNING('Requested clan info is empty', clanDBID)
                return
            clanName, clanMotto = clanInfo.getClanName(), ''
            clanTag, clanLvl = '[%s]' % clanInfo.getClanAbbrev(), clanInfo.getLevel()
            homePeripheryID = clanInfo.getHomePeripheryID()
            playersAtClan, buildingsNum = (None, None)
            combatCount, profitEff = clanInfo.getBattleCount(), clanInfo.getProfitFactor()
            creationTime = None
            defence, offDay = clanInfo.getDefencePeriod(), clanInfo.getLocalOffDay()
            vacation = clanInfo.getVacationPeriod()
            winsEff = None
        else:
            LOG_WARNING('Invalid clanDBID identifier', clanDBID, type(clanDBID))
            return
        topStats = []
        host = g_preDefinedHosts.periphery(homePeripheryID)
        if host is not None:
            topStats.append((i18n.makeString(TOOLTIPS.FORTIFICATION_TOOLTIPENEMYCLANINFO_HOMEPEREPHIRY), host.name))
        if playersAtClan is not None:
            topStats.append((i18n.makeString(TOOLTIPS.FORTIFICATION_TOOLTIPENEMYCLANINFO_PLAYERSATCLAN), playersAtClan))
        if buildingsNum is not None:
            topStats.append((i18n.makeString(TOOLTIPS.FORTIFICATION_TOOLTIPENEMYCLANINFO_BUILDINGSATFORTIFICATION), buildingsNum))
        if combatCount is not None:
            topStats.append((i18n.makeString(TOOLTIPS.FORTIFICATION_TOOLTIPENEMYCLANINFO_FIGHTSFORFORTIFICATION), combatCount))
        if winsEff is not None:
            topStats.append((i18n.makeString(TOOLTIPS.FORTIFICATION_TOOLTIPENEMYCLANINFO_WINPERCENTAGE), winsEff))
        if profitEff is not None:
            topStats.append((i18n.makeString(TOOLTIPS.FORTIFICATION_TOOLTIPENEMYCLANINFO_PROFITPERCENTAGE), BigWorld.wg_getNiceNumberFormat(profitEff) if profitEff > 0 else ProfileUtils.UNAVAILABLE_SYMBOL))
        if creationTime is not None:
            fortCreationData = self.app.utilsManager.textManager.getText(TextType.NEUTRAL_TEXT, i18n.makeString(TOOLTIPS.FORTIFICATION_TOOLTIPCLANINFO_FORTCREATIONDATE, creationDate=BigWorld.wg_getLongDateFormat(creationTime)))
        else:
            fortCreationData = None

        def _makeLabels(stats, itemIdx):
            return '\n'.join((str(a[itemIdx]) for a in stats))

        infoTexts, protectionHeader = [], ''
        if defence[0]:
            if isFortFrozen:
                protectionHeader = self.app.utilsManager.textManager.getText(TextType.ERROR_TEXT, i18n.makeString(TOOLTIPS.FORTIFICATION_TOOLTIPENEMYCLANINFO_DEFENSETIMESTOPPED))
            else:
                protectionHeader = self.app.utilsManager.textManager.getText(TextType.HIGH_TITLE, i18n.makeString(TOOLTIPS.FORTIFICATION_TOOLTIPENEMYCLANINFO_DEFENSETIME))
            statsValueColor = TextType.DISABLE_TEXT if isFortFrozen else TextType.STATS_TEXT
            defencePeriodString = i18n.makeString(TOOLTIPS.FORTIFICATION_TOOLTIPENEMYCLANINFO_PERIOD, startTime=BigWorld.wg_getShortTimeFormat(defence[0]), finishTime=BigWorld.wg_getShortTimeFormat(defence[1]))
            defencePeriodString = self.app.utilsManager.textManager.getText(statsValueColor, defencePeriodString)
            infoTexts.append(i18n.makeString(TOOLTIPS.FORTIFICATION_TOOLTIPENEMYCLANINFO_DEFENSEHOUR, period=defencePeriodString))
            if offDay > -1:
                dayOffString = i18n.makeString('#menu:dateTime/weekDays/full/%d' % (offDay + 1))
            else:
                dayOffString = i18n.makeString(TOOLTIPS.FORTIFICATION_TOOLTIPENEMYCLANINFO_NODAYOFF)
            dayOffString = self.app.utilsManager.textManager.getText(statsValueColor, dayOffString)
            infoTexts.append(i18n.makeString(TOOLTIPS.FORTIFICATION_TOOLTIPENEMYCLANINFO_DAYOFF, dayOff=dayOffString))
            if vacation[0] and vacation[1]:
                vacationString = i18n.makeString(TOOLTIPS.FORTIFICATION_TOOLTIPENEMYCLANINFO_PERIOD, startTime=BigWorld.wg_getShortDateFormat(vacation[0]), finishTime=BigWorld.wg_getShortDateFormat(vacation[1]))
            else:
                vacationString = i18n.makeString(TOOLTIPS.FORTIFICATION_TOOLTIPENEMYCLANINFO_NOVACATION)
            vacationString = self.app.utilsManager.textManager.getText(statsValueColor, vacationString)
            infoTexts.append(i18n.makeString(TOOLTIPS.FORTIFICATION_TOOLTIPENEMYCLANINFO_VACATION, period=vacationString))
        return {'headerText': self.app.utilsManager.textManager.getText(TextType.HIGH_TITLE, i18n.makeString(TOOLTIPS.FORTIFICATION_TOOLTIPENEMYCLANINFO_HEADER, clanTag=clanTag, clanLevel=fort_formatters.getTextLevel(clanLvl))),
         'fullClanName': self.app.utilsManager.textManager.getText(TextType.NEUTRAL_TEXT, clanName),
         'sloganText': self.app.utilsManager.textManager.getText(TextType.STANDARD_TEXT, clanMotto),
         'infoDescriptionTopText': self.app.utilsManager.textManager.getText(TextType.MAIN_TEXT, _makeLabels(topStats, 0)),
         'infoTopText': self.app.utilsManager.textManager.getText('statsText', _makeLabels(topStats, 1)),
         'infoDescriptionBottomText': '',
         'infoBottomText': '',
         'protectionHeaderText': protectionHeader,
         'infoText': makeHtmlString('html_templates:lobby/fortifications/tooltips/defense_description', 'main', {'text': '\n'.join(infoTexts)}),
         'fortCreationDate': fortCreationData}
Example #45
0
 def getShortDateFormat(cls, value):
     return BigWorld.wg_getShortDateFormat(time_utils.makeLocalServerTime(value))
Example #46
0
def getSeasonUserName(seasonInfo):
    return makeString(
        '#cybersport:clubs/seasons/name',
        startTime=BigWorld.wg_getShortDateFormat(seasonInfo.start),
        finishTime=BigWorld.wg_getShortDateFormat(seasonInfo.finish))
Example #47
0
 def getShortDatetimeFormat(cls, time):
     return '{0:>s} {1:>s}'.format(BigWorld.wg_getShortDateFormat(time), BigWorld.wg_getShortTimeFormat(time))
Example #48
0
 def getStartDate(self):
     return BigWorld.wg_getShortDateFormat(self.getStartTime())
    def __getDirectionTooltipData(self, dirName, buildings, attackerClanDBID, attackerClanName, attackTime, availableTime):
        infoMessage = ''
        bodyParts = []
        if self.fortCtrl.getFort().isFrozen() or self.__weAreAtWar:
            return (None, None, None)
        else:
            buildingsMsgs = []
            for building in buildings:
                if building is not None:
                    extraInfo = ''
                    if building['buildingLevel'] < FORTIFICATION_ALIASES.CLAN_BATTLE_BUILDING_MIN_LEVEL:
                        extraInfo = _ms(FORTIFICATIONS.FORTINTELLIGENCE_CLANDESCRIPTION_DIRECTION_TOOLTIP_BUILDINGLOWLEVEL, minLevel=fort_formatters.getTextLevel(FORTIFICATION_ALIASES.CLAN_BATTLE_BUILDING_MIN_LEVEL))
                    buildingsMsgs.insert(0, _ms(FORTIFICATIONS.FORTINTELLIGENCE_CLANDESCRIPTION_DIRECTION_TOOLTIP_BUILDINGITEM, name=_ms(FORTIFICATIONS.buildings_buildingname(building['uid'])), level=_ms(FORTIFICATIONS.FORTMAINVIEW_HEADER_LEVELSLBL, buildLevel=str(fort_formatters.getTextLevel(building['buildingLevel']))), extraInfo=extraInfo))

            buildingsNames = '\n'.join(buildingsMsgs)
            if availableTime is not None:
                infoMessage = _ms(FORTIFICATIONS.FORTINTELLIGENCE_CLANDESCRIPTION_DIRECTION_NOTAVAILABLE, date=BigWorld.wg_getShortDateFormat(availableTime))
                bodyParts.append(_ms(FORTIFICATIONS.FORTINTELLIGENCE_CLANDESCRIPTION_DIRECTION_TOOLTIP_NOTAVAILABLE_INFO, date=BigWorld.wg_getShortDateFormat(availableTime)))
                header = _ms(FORTIFICATIONS.FORTINTELLIGENCE_CLANDESCRIPTION_DIRECTION_TOOLTIP_NOTAVAILABLE_HEADER, direction=dirName)
            elif attackerClanDBID is None:
                if buildingsNames:
                    bodyParts.append(_ms(FORTIFICATIONS.FORTINTELLIGENCE_CLANDESCRIPTION_DIRECTION_TOOLTIP_BUILDINGS, buildings=buildingsNames))
                if self.fortCtrl.getPermissions().canPlanAttack():
                    bodyParts.append(_ms(FORTIFICATIONS.FORTINTELLIGENCE_CLANDESCRIPTION_DIRECTION_TOOLTIP_ATTACKINFO))
                    header = _ms(FORTIFICATIONS.FORTINTELLIGENCE_CLANDESCRIPTION_DIRECTION_TOOLTIP_ATTACK, direction=dirName)
                else:
                    bodyParts.append(_ms(FORTIFICATIONS.FORTINTELLIGENCE_CLANDESCRIPTION_DIRECTION_TOOLTIP_NOTCOMMANDERINFO))
                    header = _ms(FORTIFICATIONS.FORTINTELLIGENCE_CLANDESCRIPTION_DIRECTION_TOOLTIP_NOTCOMMANDER, direction=dirName)
            else:
                bodyParts.append(_ms(FORTIFICATIONS.FORTINTELLIGENCE_CLANDESCRIPTION_DIRECTION_TOOLTIP_BUSY_INFO, date=BigWorld.wg_getShortDateFormat(attackTime), clanName=attackerClanName))
                if buildingsNames:
                    bodyParts.append(_ms(FORTIFICATIONS.FORTINTELLIGENCE_CLANDESCRIPTION_DIRECTION_TOOLTIP_BUILDINGS, buildings=buildingsNames))
                header = _ms(FORTIFICATIONS.FORTINTELLIGENCE_CLANDESCRIPTION_DIRECTION_TOOLTIP_BUSY_HEADER, direction=dirName)
            return (header, '\n'.join(bodyParts), infoMessage)
Example #50
0
 def getFinishDate(self):
     return BigWorld.wg_getShortDateFormat(self.getFinishTime())
Example #51
0
 def _getValue(self, value):
     value = self._getLocalTime(value)
     return '{0:>s} {1:>s}'.format(BigWorld.wg_getShortDateFormat(value),
                                   BigWorld.wg_getLongTimeFormat(value))
 def _getDateTimeString(timeValue):
     return '{0:>s} {1:>s}'.format(BigWorld.wg_getShortDateFormat(timeValue), BigWorld.wg_getShortTimeFormat(timeValue))
Example #53
0
def _getLastBattleText(battlesCount, globalStats):
    lastBattleDate = text_styles.main(BigWorld.wg_getShortDateFormat(globalStats.getLastBattleTime()))
    if battlesCount > 0:
        return text_styles.standard(_ms(CYBERSPORT.STATICFORMATIONSUMMARYVIEW_LASTBATTLE, date=lastBattleDate))
    return ''
Example #54
0
 def __makeDefencePeriodData(self):
     alertMessage = ''
     blockBtnEnabled = True
     fort = self.fortCtrl.getFort()
     inProcess, inCooldown = fort.getDefenceHourProcessing()
     conditionPostfix = self.app.utilsManager.textManager.getText(TextType.NEUTRAL_TEXT, fort.getDefencePeriodStr())
     blockBtnToolTip = TOOLTIPS.FORTIFICATION_FORTSETTINGSWINDOW_DEFENCEBTNENABLED
     descriptionTooltip = TOOLTIPS.FORTIFICATION_FORTSETTINGSWINDOW_DEFENCEPERIODDESCRIPTION
     if inProcess:
         defenceHourChangeDay, nextDefenceHour, _ = fort.events[FORT_EVENT_TYPE.DEFENCE_HOUR_CHANGE]
         timestampStart = time_utils.getTimeTodayForUTC(nextDefenceHour)
         value = '%s - %s' % (BigWorld.wg_getShortTimeFormat(timestampStart), BigWorld.wg_getShortTimeFormat(timestampStart + time_utils.ONE_HOUR))
         msgString = i18n.makeString(FORTIFICATIONS.SETTINGSWINDOW_BLOCKCONDITION_INPROGRESS, value=value, date=BigWorld.wg_getShortDateFormat(defenceHourChangeDay))
         alertMessage = self.app.utilsManager.textManager.getText(TextType.ALERT_TEXT, msgString)
         blockBtnEnabled = False
         blockBtnToolTip = TOOLTIPS.FORTIFICATION_FORTSETTINGSWINDOW_DEFENCEBTNDISABLED
     elif inCooldown:
         msgString = i18n.makeString(FORTIFICATIONS.SETTINGSWINDOW_BLOCKCONDITION_RECENTLYSCHEDULED)
         alertMessage = self.app.utilsManager.textManager.getText(TextType.ALERT_TEXT, msgString)
         blockBtnEnabled = False
         blockBtnToolTip = TOOLTIPS.FORTIFICATION_FORTSETTINGSWINDOW_DEFENCEBTNDISABLED
     conditionPrefix = self.app.utilsManager.textManager.getText(TextType.MAIN_TEXT, i18n.makeString(FORTIFICATIONS.settingswindow_blockcondition('defencePeriodTime')))
     blockDescr = self.app.utilsManager.textManager.getText(TextType.STANDARD_TEXT, i18n.makeString(FORTIFICATIONS.settingswindow_blockdescr('defencePeriodTime')))
     if alertMessage:
         alertMessage = self.app.utilsManager.textManager.getIcon(TextIcons.ALERT_ICON) + ' ' + alertMessage
     return {'blockBtnEnabled': blockBtnEnabled,
      'blockDescr': blockDescr,
      'blockCondition': conditionPrefix + ' ' + conditionPostfix,
      'alertMessage': alertMessage,
      'blockBtnToolTip': blockBtnToolTip,
      'descriptionTooltip': descriptionTooltip}
Example #55
0
def getSeasonUserName(seasonInfo):
    return makeString('#cybersport:clubs/seasons/name', startTime=BigWorld.wg_getShortDateFormat(seasonInfo.start), finishTime=BigWorld.wg_getShortDateFormat(seasonInfo.finish))
 def getExpiryTime(self):
     return BigWorld.wg_getShortDateFormat(
         self._expiryTime
     ) if self._expiryTime and self._expiryTime < ENDLESS_TOKEN_TIME else ''
    def _updateDirections(self):
        directions = []
        selectedDirection = -1
        fort = self.fortCtrl.getFort()
        inProcess, _ = fort.getDefenceHourProcessing()
        isDefenceOn = fort.isDefenceHourEnabled() or inProcess
        enemyBuildings = [None, None]
        for buildingID, buildingData in self.__item.getDictBuildingsBrief(
        ).iteritems():
            dirId = getDirectionFromDirPos(buildingData['dirPosByte'])
            if self.__direction == dirId:
                pos = getPositionFromDirPos(buildingData['dirPosByte'])
                level = buildingData['level']
                if 0 <= level < 5:
                    isAvailable = False
                else:
                    isAvailable = self.__isBuildingAvailableForAttack(
                        buildingData['hp'],
                        g_fortCache.buildings[buildingID].levels[level].hp)
                uid = self.getBuildingUIDbyID(buildingID)
                enemyBuildings[pos] = {
                    'uid':
                    uid,
                    'progress':
                    self._getProgress(buildingID, level),
                    'buildingLevel':
                    level,
                    'isAvailable':
                    isAvailable,
                    'iconSource':
                    FortViewHelper.getSmallIconSource(uid, level, isDefenceOn)
                }

        enemyDirection = {
            'name':
            _ms('#fortifications:General/directionName%d' % self.__direction),
            'isMine':
            False,
            'buildings':
            enemyBuildings
        }
        for direction in range(1, g_fortCache.maxDirections + 1):
            isOpened = fort.isDirectionOpened(direction)
            isBusy = False
            availableTime = None
            name = _ms('#fortifications:General/directionName%d' % direction)
            ttHeader = _ms(
                FORTIFICATIONS.
                FORTDECLARATIONOFWARWINDOW_ITEM_NOTOPENED_TOOLTIP_HEADER)
            ttBody = _ms(
                FORTIFICATIONS.
                FORTDECLARATIONOFWARWINDOW_ITEM_NOTOPENED_TOOLTIP_BODY)
            infoMessage = ''
            allieBuildings = []
            if isOpened:
                for building in fort.getBuildingsByDirections().get(
                        direction, ()):
                    data = None
                    if building is not None:
                        buildingTypeId = building.typeID
                        uid = self.getBuildingUIDbyID(buildingTypeId)
                        level = building.level
                        data = {
                            'uid':
                            uid,
                            'progress':
                            self._getProgress(buildingTypeId, level),
                            'buildingLevel':
                            level,
                            'isAvailable':
                            self.__isBuildingAvailableForAttack(
                                building.hp, building.levelRef.hp),
                            'iconSource':
                            FortViewHelper.getSmallIconSource(
                                uid, level, isDefenceOn)
                        }
                    allieBuildings.append(data)

                eventTypeID = FORT_EVENT_TYPE.DIR_OPEN_ATTACKS_BASE + direction
                availableTime, _, _ = fort.events.get(eventTypeID,
                                                      (None, None, None))
                if availableTime <= self.__selectedDayStart:
                    availableTime = None
                if availableTime is None:
                    attackerClanName = None
                    todayAttacks = fort.getAttacks(
                        filterFunc=lambda a: self.__selectedDayStart <= a.
                        getStartTime(
                        ) <= self.__selectedDayFinish and a.isPlanned())
                    roamingDateAttacks = fort.getAttacks(
                        filterFunc=lambda a: a.getStartTime() - time_utils.
                        ONE_DAY < self.__defHourStart < a.getStartTime(
                        ) + time_utils.ONE_DAY and a.isPlanned())
                    for attack in todayAttacks + roamingDateAttacks:
                        if direction == attack.getDirection():
                            isBusy = True
                            _, defClanAbbrev, _ = attack.getOpponentClanInfo()
                            attackerClanName = '[%s]' % defClanAbbrev

                    if isBusy:
                        ttHeader = _ms(
                            FORTIFICATIONS.
                            FORTDECLARATIONOFWARWINDOW_ITEM_BUSY_TOOLTIP_HEADER
                        )
                        ttBody = _ms(
                            FORTIFICATIONS.
                            FORTDECLARATIONOFWARWINDOW_ITEM_BUSY_TOOLTIP_BODY,
                            clanName=attackerClanName)
                    else:
                        clanForAttackTag = '[%s]' % self.__item.getClanAbbrev()
                        ttHeader = _ms(
                            FORTIFICATIONS.
                            FORTDECLARATIONOFWARWINDOW_ITEM_ATTACK_TOOLTIP_HEADER,
                            direction=name)
                        ttBody = _ms(
                            FORTIFICATIONS.
                            FORTDECLARATIONOFWARWINDOW_ITEM_ATTACK_TOOLTIP_BODY,
                            direction=name,
                            clanName=clanForAttackTag)
                else:
                    infoMessage = _ms(
                        FORTIFICATIONS.
                        FORTDECLARATIONOFWARWINDOW_DIRECTION_NOTAVAILABLE,
                        date=BigWorld.wg_getShortDateFormat(availableTime))
                    ttHeader = _ms(
                        FORTIFICATIONS.
                        FORTDECLARATIONOFWARWINDOW_ITEM_NOTAVAILABLE_TOOLTIP_HEADER
                    )
                    ttBody = _ms(
                        FORTIFICATIONS.
                        FORTDECLARATIONOFWARWINDOW_ITEM_NOTAVAILABLE_TOOLTIP_BODY,
                        date=BigWorld.wg_getShortDateFormat(availableTime))
                if not isBusy and selectedDirection == -1:
                    selectedDirection = direction
            directions.append({
                'leftDirection': {
                    'name': name,
                    'uid': direction,
                    'isOpened': isOpened,
                    'isBusy': isBusy or availableTime is not None,
                    'buildings': allieBuildings,
                    'ttHeader': ttHeader,
                    'ttBody': ttBody,
                    'infoMessage': infoMessage
                },
                'rightDirection':
                enemyDirection,
                'connectionIcon':
                RES_ICONS.MAPS_ICONS_LIBRARY_FORTIFICATION_OFFENCE
            })

        self.as_setDirectionsS(directions)
        self.as_selectDirectionS(selectedDirection)
        return
Example #58
0
def formatShortDateShortTimeString(timestamp):
    return str(' ').join((BigWorld.wg_getShortDateFormat(timestamp), '  ',
                          BigWorld.wg_getShortTimeFormat(timestamp)))