def _getFortSortiesSchemaTexts(activatedDefModeParams, peripheryID, buildingsCount, dirsCount): if activatedDefModeParams: dayOff, defHour, vacation = activatedDefModeParams if dayOff == NOT_ACTIVATED: dayOffString = _ms(TOOLTIPS.FORTIFICATION_TOOLTIPENEMYCLANINFO_NODAYOFF) else: dayOffString = fort_fmts.getDayOffString(dayOff) defHourStart, _ = defHour or (None, None) if defHourStart is not None: defHour = fort_fmts.getDefencePeriodString(defHourStart) else: defHour = '' vacStart, vacEnd = vacation if vacStart is not None: vacationString = fort_fmts.getVacationPeriodString(vacStart, vacEnd) else: vacationString = _ms(TOOLTIPS.FORTIFICATION_TOOLTIPENEMYCLANINFO_NOVACATION) else: defHour = CLANS.SECTION_FORT_DEFENCE_NOTACTIVATED vacationString = dayOffString = None periphery = g_preDefinedHosts.periphery(peripheryID) if periphery is not None: serverName = periphery.name else: serverName = connectionManager.serverUserName return {'totalBuildingsCount': str(buildingsCount), 'totalDirectionsCount': str(dirsCount), 'defenceHour': defHour, 'server': serverName, 'vacation': vacationString, 'dayOff': dayOffString}
def getTitle(self, invite): extraData = invite.getExtraData() regularInviteTitle = super(PrbFortBattleInviteHtmlTextFormatter, self).getTitle(invite) if 'enemyClanAbbrev' in extraData: enemyClanAbbrev = '[%s]' % extraData['enemyClanAbbrev'] else: enemyClanAbbrev = '' return makeHtmlString('html_templates:lobby/prebattle', 'inviteFortTitle', ctx={'inviteRegularTitle': regularInviteTitle, 'dir': fort_fmt.getDirectionString(extraData['direction']), 'clanAbbrev': enemyClanAbbrev, 'time': fort_fmt.getDefencePeriodString(extraData['attackTime'])}, sourceKey='defence' if extraData.get('isDefence') else 'offence')