def _getStatisticsBlock(self): event = self._event method = event.getMethod() op = event.getObjectiveParameter() order = list(filter(lambda t: op not in t, self._ParameterOrder)) info = self._excelItem.getInfo() param1 = order[0][0] statistic1 = EVENT_BOARDS.summary_param_all(method, param1) statistic1Value = str(_getParameterValue(param1, info)) statistic1Icon = _ICON_BY_PARAMETER[param1] param2 = order[1][0] statistic2 = EVENT_BOARDS.summary_param_all(method, param2) statistic2Value = str(_getParameterValue(param2, info)) statistic2Icon = _ICON_BY_PARAMETER[param2] return { 'statistic1Value': statistic1Value, 'statistic1': statistic1, 'statistic1Icon': statistic1Icon, 'statistic1Tooltip': makeTooltip( TOOLTIPS.elen_summary_param_all_all_header(method, param1), TOOLTIPS.elen_summary_param_all_all_body(method, param1)), 'statistic2Value': statistic2Value, 'statistic2': statistic2, 'statistic2Icon': statistic2Icon, 'statistic2Tooltip': makeTooltip( TOOLTIPS.elen_summary_param_all_all_header(method, param2), TOOLTIPS.elen_summary_param_all_all_body(method, param2)), 'statistic3Value': str(info.getBlockedDamage()), 'statistic3': EVENT_BOARDS.SUMMARY_DAMAGEBLOCKED, 'statistic3Icon': RES_ICONS.MAPS_ICONS_EVENTBOARDS_POPUPICONS_BLOCKED_DMG_POPUP, 'statistic3Tooltip': makeTooltip(TOOLTIPS.ELEN_SUMMARY_ADDPARAM_DAMAGEBLOCKED_HEADER, TOOLTIPS.ELEN_SUMMARY_ADDPARAM_DAMAGEBLOCKED_BODY), 'statistic4Value': str(info.getFrags()), 'statistic4': _ms(EVENT_BOARDS.SUMMARY_DESTROYEDVEHICLES), 'statistic4Icon': RES_ICONS.MAPS_ICONS_EVENTBOARDS_POPUPICONS_VEHICLE_POPUP, 'statistic4Tooltip': makeTooltip(TOOLTIPS.ELEN_SUMMARY_ADDPARAM_FRAGS_HEADER, TOOLTIPS.ELEN_SUMMARY_ADDPARAM_FRAGS_BODY) }
def _getHeader(self, currentEvent): eventID = currentEvent.getEventID() isRegistered = self._eventsController.getHangarFlagData().isRegistered( eventID) isRegistrationNeeded = currentEvent.getLimits( ).getIsRegistrationNeeded() if isRegistrationNeeded and not isRegistered: if currentEvent.isRegistrationFinishSoon(): flagIcon = icons.makeImageTag( RES_ICONS.MAPS_ICONS_EVENTBOARDS_FLAGICONS_TIME_ICON) else: flagIcon = icons.makeImageTag( RES_ICONS.MAPS_ICONS_EVENTBOARDS_FLAGICONS_FLAG_ICON) textData = currentEvent.getFormattedRemainingTime( EVENT_DATE_TYPE.PARTICIPANTS_FREEZE) msgText = TOOLTIPS.HANGAR_ELEN_HEADER_TOENDOFREGISTRATION time = textData[0] if textData[0] is not 0 else 1 timeText = textData[1] if textData[1] else FORMAT_MINUTE_STR timeName = EVENT_BOARDS.time_period(str(timeText)) text = '{} {} {} {}'.format(flagIcon, text_styles.tutorial(_ms(msgText)), text_styles.tutorial(time), text_styles.tutorial(timeName)) else: textData = currentEvent.getFormattedRemainingTime( EVENT_DATE_TYPE.END) msgText = TOOLTIPS.HANGAR_ELEN_HEADER_TOEND time = textData[0] if textData[0] is not 0 else 1 timeText = textData[1] if textData[1] else FORMAT_MINUTE_STR timeName = EVENT_BOARDS.time_period(str(timeText)) if currentEvent.isEndSoon(): flagIcon = icons.makeImageTag( RES_ICONS.MAPS_ICONS_EVENTBOARDS_FLAGICONS_TIME_ICON) text = '{} {} {} {}'.format(flagIcon, text_styles.tutorial(_ms(msgText)), text_styles.tutorial(time), text_styles.tutorial(timeName)) else: flagIcon = icons.makeImageTag( RES_ICONS.MAPS_ICONS_EVENTBOARDS_FLAGICONS_FLAG_ICON) text = '{} {} {} {}'.format(flagIcon, text_styles.main(_ms(msgText)), text_styles.stats(time), text_styles.stats(timeName)) return formatters.packImageTextBlockData( title=text_styles.highTitle( _ms(TOOLTIPS.HANGAR_ELEN_HEADER_NAME, name=currentEvent.getName())), img=currentEvent.getKeyArtSmall(), txtPadding=formatters.packPadding(top=22), txtOffset=20, txtGap=-8, desc=text)
def _getTableData(self): data = [] items = self.itemsCache.items params = self.__getSortedParams() infos = self._excelItem.getInfo() infos = sorted(infos, key=lambda info: info.getBattleTs()) for info in infos: vehicleCd = info.getVehicleCd() vehicle = items.getItemByCD(vehicleCd) timeValue = info.getBattleTs() date = formatTimeAndDate(timeValue) methodType = info.getMethodType() if methodType != _cm.SUMMSEQN or methodType == _cm.SUMMSEQN and info.getUsedInCalculations( ): isEnable = True iconAlpha = ICON_ALPHA_USED_IN_CALCULATION date = text_styles.main(date) technicsName = text_styles.main(vehicle.shortUserName) result = text_styles.main( EVENT_BOARDS.summary_result(info.getBattleResult())) platoonIcon = RES_ICONS.MAPS_ICONS_EVENTBOARDS_BATTLE_TYPE_PLATOON else: isEnable = False iconAlpha = ICON_ALPHA_NOT_USED_IN_CALCULATION date = text_styles.disabled(date) technicsName = text_styles.disabled(vehicle.shortUserName) result = text_styles.disabled( EVENT_BOARDS.summary_result(info.getBattleResult())) platoonIcon = RES_ICONS.MAPS_ICONS_EVENTBOARDS_BATTLE_TYPE_PLATOON_DARK icon = platoonIcon if info.getIsInSquad() else None technics = formatVehicleNationAndTypeIcon( vehicle, 'html_templates:lobby/elen/summary') player = { 'icon': icon, 'date': date, 'technics': technics, 'vehicle': vehicle.iconSmall, 'technicsName': technicsName, 'result': result, 'value1': str(_getParameterValue(params[0], info)), 'value2': str(_getParameterValue(params[1], info)), 'value3': str(_getParameterValue(params[2], info)), 'value4': str(info.getFrags()), 'rendererLinkage': EVENTBOARDS_ALIASES.BASE_PLAYER_BATTLE_RENDERER, 'isEnable': isEnable, 'iconAlpha': iconAlpha } data.append(player) return {'tableDP': data}
def formatTimeToEnd(timeValue, period): if timeValue is 0: timeValue = 1 period = FORMAT_MINUTE_STR timeName = EVENT_BOARDS.time_period(period) text = '{} {}'.format(timeValue, _ms(timeName)) return text
def getInfo(self): event = self._event method = event.getMethod() parameter = event.getObjectiveParameter() maxOrSum = 'max' if method == _cm.MAX else 'sum' return text_styles.main( _ms(EVENT_BOARDS.task_objective_all(maxOrSum, parameter)))
def formatUpdateTime(recalculationTS): statusDay = event_boards_timer.getUpdateStatus_ts(recalculationTS) statusTime = backport.getShortTimeFormat(recalculationTS) day = _ms(EVENT_BOARDS.time_day(statusDay) ) if statusDay else backport.getLongDateFormat(recalculationTS) status = _ms(EVENT_BOARDS.SUMMARY_STATUS, day=day, time=statusTime) return status
def getExperienceBlock(self): event = self._event eventType = self._event.getType() method = event.getMethod() op = event.getObjectiveParameter() opName = EVENT_BOARDS.summary_param_all(method, op) opValue = self._excelItem.getP1() rank = self._excelItem.getRank() battles = self._excelItem.getP3() battleIcon = self._iconByType[op] groupPos = self.__getRibbon() positionTooltip = makeTooltip( TOOLTIPS.elen_summary_rank(groupPos) if groupPos else TOOLTIPS. ELEN_SUMMARY_RANK_NORANK) battleTooltip = makeTooltip( TOOLTIPS.ELEN_SUMMARY_BATTLES_HEADER, TOOLTIPS.elen_summary_battles_all_body(eventType)) experienceTooltip = makeTooltip( TOOLTIPS.elen_excel_objparam_all_all_header(method, op), TOOLTIPS.elen_excel_objparam_all_all_body(method, op)) return { 'experienceValue': str(opValue), 'experience': opName, 'position': _ms(EVENT_BOARDS.SUMMARY_POSITION, position=str(rank)), 'battleValue': str(battles), 'battle': _ms(EVENT_BOARDS.SUMMARY_BATTLES), 'experienceIcon': battleIcon, 'ribbon': groupPos, 'battleIcon': RES_ICONS.MAPS_ICONS_EVENTBOARDS_POPUPICONS_BATTLE_POPUP, 'experienceTooltip': experienceTooltip, 'positionTooltip': positionTooltip, 'battleTooltip': battleTooltip }
def makeParameterTooltipVO(method, amount, parameter): parametersWithTooltip = [_op.ORIGINALXP, _op.XP] maxOrSum = 'max' if method == _cm.MAX else 'sum' return makeTooltip( header=_ms(EVENT_BOARDS.TOOLTIP_TOP_NOREWARDGROUP), body=_ms(EVENT_BOARDS.tooltip_top_description_all(maxOrSum, parameter), number=int(amount)) ) if parameter in parametersWithTooltip and amount is not None else None
def __getAmountTooltip(self): parametersWithTooltip = [_op.ORIGINALXP, _op.XP] parameter = self._event.getObjectiveParameter() if parameter in parametersWithTooltip: return makeTooltip( body=_ms(EVENT_BOARDS.tooltip_top_amount(parameter))) else: return None
def makeParameterTooltipVO(method, amount, parameter): parametersWithTooltip = [_op.ORIGINALXP, _op.XP] maxOrSum = 'max' if method == _cm.MAX else 'sum' if parameter in parametersWithTooltip and amount is not None: return makeTooltip(body=_ms(EVENT_BOARDS.tooltip_top_description_all( maxOrSum, parameter), number=amount)) else: return
def getInfo(self): event = self._event method = event.getMethod() result = _ms(EVENT_BOARDS.task_selection(method)) if method in self.selectionWithCardinality: cardinality = event.getCardinality() distance = event.getDistance() result = result % {'cardinality': str(cardinality), 'distance': str(distance)} return text_styles.main(result)
def _getDescription2(self): info = self._excelItem.getInfo() timeValue = info.getBattleTs() date = formatTimeAndDate(timeValue) inSquad = info.getIsInSquad() squadInfo = _ms( EVENT_BOARDS.SUMMARY_FIGHTINSQUAAD) if inSquad else _ms( EVENT_BOARDS.SUMMARY_FIGHTNOTINSQUAAD) result = _ms(EVENT_BOARDS.summary_result(info.getBattleResult())) return '{}. {} {}'.format(result, squadInfo, date)
def getInfo(self): eventType = self._event.getType() return text_styles.main(_ms(EVENT_BOARDS.task_eventtype(eventType)))
def getTimerInfo(self): def formatToEnd(iconPath, text, dateType, isEndSoon): iconPath = icons.makeImageTag(iconPath) timeData = event.getFormattedRemainingTime(dateType) text = _ms(text, time=formatTimeToEnd(timeData[0], timeData[1])) if isEndSoon: formatedText = timeEndStyle(text) else: formatedText = text_styles.vehicleStatusInfoText(text) return '{} {}'.format(iconPath, formatedText) event = self._event sday, smonth, _ = event_boards_timer.getDayMonthYear( event.getStartDate()) eday, emonth, _ = event_boards_timer.getDayMonthYear( event.getEndDate()) finished = event.isFinished() if not finished: icon = icons.makeImageTag( RES_ICONS.MAPS_ICONS_EVENTBOARDS_FLAGICONS_DATE_ICON) timePeriod = '{} {} {} - {} {} {}'.format( str(sday), _ms(EVENT_BOARDS.datetime_months(str(smonth))), event_boards_timer.getShortTimeString(event.getStartDate()), str(eday), _ms(EVENT_BOARDS.datetime_months(str(emonth))), event_boards_timer.getShortTimeString(event.getEndDate())) result = '{} {} '.format( icon, text_styles.vehicleStatusInfoText(timePeriod)) startSoon = event.isStartSoon() if startSoon: result += formatToEnd( RES_ICONS.MAPS_ICONS_EVENTBOARDS_FLAGICONS_TIME_ICON, EVENT_BOARDS.TIME_TIMETO_START, EVENT_DATE_TYPE.START, startSoon) elif not self._joined and not event.isRegistrationFinished(): finishSoon = event.isRegistrationFinishSoon() if finishSoon: result += formatToEnd( RES_ICONS.MAPS_ICONS_EVENTBOARDS_FLAGICONS_TIME_ICON, EVENT_BOARDS.TIME_TIMETO_ENDREGISTRATION, EVENT_DATE_TYPE.PARTICIPANTS_FREEZE, finishSoon) else: result += formatToEnd( RES_ICONS.MAPS_ICONS_EVENTBOARDS_FLAGICONS_ICON_FLAG, EVENT_BOARDS.TIME_TIMETO_ENDREGISTRATION, EVENT_DATE_TYPE.PARTICIPANTS_FREEZE, finishSoon) else: endSoon = event.isEndSoon() if endSoon: result += formatToEnd( RES_ICONS.MAPS_ICONS_EVENTBOARDS_FLAGICONS_TIME_ICON, EVENT_BOARDS.TIME_TIMETO_END, EVENT_DATE_TYPE.END, endSoon) else: result += formatToEnd( RES_ICONS.MAPS_ICONS_EVENTBOARDS_FLAGICONS_ICON_FLAG, EVENT_BOARDS.TIME_TIMETO_END, EVENT_DATE_TYPE.END, endSoon) else: date = BigWorld.wg_getLongDateFormat(event.getEndDateTs()) result = text_styles.main( _ms(EVENT_BOARDS.TIME_EVENTFINISHED, date=date)) return {'timer': result}
def __getRaitingType(self): parameter = self._event.getObjectiveParameter() return _ms(EVENT_BOARDS.top_objectiveparameter(parameter))