def __showDismissedTankmen(self, criteria): tankmen = getRestoreController().getDismissedTankmen() tankmenList = list() for tankman in tankmen: if not criteria(tankman): continue skillsList = [] for skill in tankman.skills: skillsList.append({'tankmanID': tankman.invID, 'id': str(tankman.skills.index(skill)), 'name': skill.userName, 'desc': skill.description, 'icon': skill.icon, 'level': skill.level, 'active': skill.isEnable and skill.isActive}) newSkillsCount, lastNewSkillLvl = tankman.newSkillCount if newSkillsCount > 0: skillsList.append({'buy': True, 'buyCount': newSkillsCount - 1, 'tankmanID': tankman.invID, 'level': lastNewSkillLvl}) restoreInfo = getTankmenRestoreInfo(tankman) actionBtnTooltip = makeTooltip(TOOLTIPS.BARRACKS_TANKMEN_RECOVERYBTN_HEADER, getRecoveryStatusText(restoreInfo)) tankmanData = _packTankmanData(tankman) tankmanData.update({'isRankNameVisible': False, 'recoveryPeriodText': _makeRecoveryPeriodText(restoreInfo), 'actionBtnLabel': MENU.BARRACKS_BTNRECOVERY, 'actionBtnTooltip': actionBtnTooltip, 'skills': skillsList, 'isSkillsVisible': True}) tankmenList.append(tankmanData) tankmenCountStr = _ms(MENU.BARRACKS_DISMISSEDTANKMENCOUNT, curValue=len(tankmenList), total=len(tankmen)) placeCount = getRestoreController().getMaxTankmenBufferLength() placeCountStr = _ms(MENU.BARRACKS_RECOVERYCOUNT, total=placeCount, info=icons.info()) noInfoData = None hasNoInfoData = len(tankmenList) == 0 if hasNoInfoData: if len(tankmen) == 0: tankmenRestoreConfig = g_itemsCache.items.shop.tankmenRestoreConfig freeDays = tankmenRestoreConfig.freeDuration / time_utils.ONE_DAY creditsDays = tankmenRestoreConfig.creditsDuration / time_utils.ONE_DAY - freeDays noInfoData = {'title': text_styles.highTitle(MENU.BARRACKS_NORECOVERYTANKMEN_TITLE), 'message': text_styles.main(_ms(MENU.BARRACKS_NORECOVERYTANKMEN_MESSAGE, price=moneyWithIcon(tankmenRestoreConfig.cost), totalDays=freeDays + creditsDays, freeDays=freeDays, paidDays=creditsDays))} else: noInfoData = {'message': text_styles.main(MENU.BARRACKS_NOFILTEREDRECOVERYTANKMEN_MESSAGE)} placesCountTooltip = makeTooltip(TOOLTIPS.BARRACKS_PLACESCOUNT_DISMISS_HEADER, _ms(TOOLTIPS.BARRACKS_PLACESCOUNT_DISMISS_BODY, placeCount=placeCount)) self.as_setTankmenS({'tankmenCount': text_styles.playerOnline(tankmenCountStr), 'placesCount': text_styles.playerOnline(placeCountStr), 'placesCountTooltip': placesCountTooltip, 'tankmenData': tankmenList, 'hasNoInfoData': hasNoInfoData, 'noInfoData': noInfoData}) return
def __showDismissedTankmen(self, criteria): tankmen = self.restore.getDismissedTankmen() tankmenList = list() for tankman in tankmen: if not criteria(tankman): continue skillsList = [] for skill in tankman.skills: skillsList.append({'tankmanID': tankman.invID, 'id': str(tankman.skills.index(skill)), 'name': skill.userName, 'desc': skill.description, 'icon': skill.icon, 'level': skill.level, 'active': skill.isEnable and skill.isActive}) newSkillsCount, lastNewSkillLvl = tankman.newSkillCount if newSkillsCount > 0: skillsList.append({'buy': True, 'buyCount': newSkillsCount - 1, 'tankmanID': tankman.invID, 'level': lastNewSkillLvl}) restoreInfo = getTankmenRestoreInfo(tankman) actionBtnTooltip = makeTooltip(TOOLTIPS.BARRACKS_TANKMEN_RECOVERYBTN_HEADER, getRecoveryStatusText(restoreInfo)) tankmanData = _packTankmanData(tankman) tankmanData.update({'isRankNameVisible': False, 'recoveryPeriodText': _makeRecoveryPeriodText(restoreInfo), 'actionBtnLabel': MENU.BARRACKS_BTNRECOVERY, 'actionBtnTooltip': actionBtnTooltip, 'skills': skillsList, 'isSkillsVisible': True}) tankmenList.append(tankmanData) tankmenCountStr = _ms(MENU.BARRACKS_DISMISSEDTANKMENCOUNT, curValue=len(tankmenList), total=len(tankmen)) placeCount = self.restore.getMaxTankmenBufferLength() placeCountStr = _ms(MENU.BARRACKS_RECOVERYCOUNT, total=placeCount, info=icons.info()) noInfoData = None hasNoInfoData = len(tankmenList) == 0 if hasNoInfoData: if len(tankmen) == 0: tankmenRestoreConfig = g_itemsCache.items.shop.tankmenRestoreConfig freeDays = tankmenRestoreConfig.freeDuration / time_utils.ONE_DAY creditsDays = tankmenRestoreConfig.creditsDuration / time_utils.ONE_DAY - freeDays noInfoData = {'title': text_styles.highTitle(MENU.BARRACKS_NORECOVERYTANKMEN_TITLE), 'message': text_styles.main(_ms(MENU.BARRACKS_NORECOVERYTANKMEN_MESSAGE, price=moneyWithIcon(tankmenRestoreConfig.cost), totalDays=freeDays + creditsDays, freeDays=freeDays, paidDays=creditsDays))} else: noInfoData = {'message': text_styles.main(MENU.BARRACKS_NOFILTEREDRECOVERYTANKMEN_MESSAGE)} placesCountTooltip = makeTooltip(TOOLTIPS.BARRACKS_PLACESCOUNT_DISMISS_HEADER, _ms(TOOLTIPS.BARRACKS_PLACESCOUNT_DISMISS_BODY, placeCount=placeCount)) self.as_setTankmenS({'tankmenCount': text_styles.playerOnline(tankmenCountStr), 'placesCount': text_styles.playerOnline(placeCountStr), 'placesCountTooltip': placesCountTooltip, 'tankmenData': tankmenList, 'hasNoInfoData': hasNoInfoData, 'noInfoData': noInfoData}) return
def __showActiveTankmen(self, criteria): tankmen = self.itemsCache.items.getTankmen().values() tankmenInBarracks = 0 tankmenList = [_packBuyBerthsSlot()] for tankman in sorted(tankmen, cmp=TankmenComparator( self.itemsCache.items.getVehicle)): if not tankman.isInTank: tankmenInBarracks += 1 if not criteria(tankman): continue tankmanData = _packTankmanData(tankman) if tankmanData is not None: if tankman.isInTank: actionBtnLabel = MENU.BARRACKS_BTNUNLOAD actionBtnTooltip = TOOLTIPS.BARRACKS_TANKMEN_UNLOAD else: actionBtnLabel = MENU.BARRACKS_BTNDISSMISS actionBtnTooltip = TOOLTIPS.BARRACKS_TANKMEN_DISMISS tankmanData.update({ 'isRankNameVisible': True, 'recoveryPeriodText': None, 'actionBtnLabel': actionBtnLabel, 'actionBtnTooltip': actionBtnTooltip, 'skills': None, 'isSkillsVisible': False }) tankmenList.append(tankmanData) tankmenInSlots = len(tankmenList) - 1 slots = self.itemsCache.items.stats.tankmenBerthsCount if tankmenInBarracks < slots: tankmenList.insert(1, { 'empty': True, 'freePlaces': slots - tankmenInBarracks }) tankmenCountStr = _ms(MENU.BARRACKS_TANKMENCOUNT, curValue=tankmenInSlots, total=len(tankmen)) placeCountStr = _ms(MENU.BARRACKS_PLACESCOUNT, free=max(slots - tankmenInBarracks, 0), total=slots) self.as_setTankmenS({ 'tankmenCount': text_styles.playerOnline(tankmenCountStr), 'placesCount': text_styles.playerOnline(placeCountStr), 'placesCountTooltip': None, 'tankmenData': tankmenList, 'hasNoInfoData': False }) return
def _setTipsInfo(self): arenaDP = self._battleCtx.getArenaDP() if self._arenaVisitor.hasResourcePoints(): bgUrl = RES_ICONS.MAPS_ICONS_EVENTINFOPANEL_FALLOUTRESOURCEPOINTSEVENT elif self._arenaVisitor.hasFlags(): bgUrl = RES_ICONS.MAPS_ICONS_EVENTINFOPANEL_FALLOUTFLAGSEVENT else: bgUrl = '' if self._arenaVisitor.gui.isFalloutClassic(): self.as_setEventInfoPanelDataS({ 'bgUrl': bgUrl, 'items': getHelpTextAsDicts(self._arenaVisitor) }) self.as_setVisualTipInfoS(self.__makeVisualTipVO(arenaDP)) elif not self.__isTipInited: battlesCount = DEFAULT_BATTLES_COUNT if g_lobbyContext.getBattlesCount() is not None: battlesCount = g_lobbyContext.getBattlesCount() classTag, vLvl, nation = arenaDP.getVehicleInfo().getTypeInfo() criteria = tips.getTipsCriteria(self._arenaVisitor) criteria.setBattleCount(battlesCount) criteria.setClassTag(classTag) criteria.setLevel(vLvl) criteria.setNation(nation) tip = criteria.find() self.as_setTipTitleS(text_styles.highTitle(tip.status)) self.as_setTipS(text_styles.playerOnline(tip.body)) self.as_setVisualTipInfoS(self.__makeVisualTipVO(arenaDP, tip)) self.__isTipInited = True return
def _setTipsInfo(self): arena = arena_info.getClientArena() arenaDP = self._battleCtx.getArenaDP() if arena_info.hasResourcePoints(): bgUrl = RES_ICONS.MAPS_ICONS_EVENTINFOPANEL_FALLOUTRESOURCEPOINTSEVENT elif arena_info.hasFlags(): bgUrl = RES_ICONS.MAPS_ICONS_EVENTINFOPANEL_FALLOUTFLAGSEVENT else: bgUrl = '' if self.__isFallout: self.as_setEventInfoPanelDataS({'bgUrl': bgUrl, 'items': getHelpTextAsDicts(arena_info.getArenaType())}) self.as_setVisualTipInfoS(self.__makeVisualTipVO(arenaDP, arena)) elif not self.__isTipInited: battlesCount = DEFAULT_BATTLES_COUNT if g_lobbyContext.getBattlesCount() is not None: battlesCount = g_lobbyContext.getBattlesCount() classTag, vLvl, nation = arenaDP.getVehicleInfo().getTypeInfo() criteria = tips.getTipsCriteria(arena) criteria.setBattleCount(battlesCount) criteria.setClassTag(classTag) criteria.setLevel(vLvl) criteria.setNation(nation) tip = criteria.find() self.as_setTipTitleS(text_styles.highTitle(tip.status)) self.as_setTipS(text_styles.playerOnline(tip.body)) self.as_setVisualTipInfoS(self.__makeVisualTipVO(arenaDP, arena, tip)) self.__isTipInited = True return
def _setTipsInfo(self): arenaDP = self._battleCtx.getArenaDP() battlesCount = DEFAULT_BATTLES_COUNT if not isBattleLoadingShowed(): criteria = tips.getTipsCriteria(self._arenaVisitor) if VEHICLE_TAGS.LOW_TIER_EVENT in arenaDP.getVehicleInfo( ).vehicleType.tags and isEnabledMMEvent(): arenaGuiType = criteria.getArenaGuiType() if arenaGuiType == ARENA_GUI_TYPE.RANDOM: tip = _TipData( backport.text(R.strings.tips.lowTierEventStatus()), backport.text(R.strings.tips.lowTierEventBody()), R.images.gui.maps.icons.battleLoading.tips. lowTierEvent()) self.as_setTipTitleS(text_styles.highTitle(tip.status)) self.as_setTipS(text_styles.playerOnline(tip.body)) self.as_setVisualTipInfoS( self._makeVisualTipVO(arenaDP, tip)) else: if self.lobbyContext.getBattlesCount() is not None: battlesCount = self._getBattlesCount() criteria.setBattleCount(battlesCount) criteria.setVehicleType(arenaDP.getVehicleInfo().vehicleType) translation = self.gui.resourceManager.getTranslatedText tip = criteria.find() self.as_setTipTitleS( self._formatTipTitle(translation(tip.status))) self.as_setTipS(self._formatTipBody(translation(tip.body))) self.as_setVisualTipInfoS(self._makeVisualTipVO(arenaDP, tip)) _setBattleLoading(True) return
def makeEventBoardsTableViewStatusVO(title, tooltip, info, value1, value2, value3, showPoints, buttonLabel, buttonTooltip, buttonVisible, buttonEnabled, titleTooltip): buttonTop = not title result = { 'title': title, 'titleTooltip': tooltip, 'buttonLabel': buttonLabel, 'buttonTooltip': buttonTooltip, 'buttonVisible': buttonVisible, 'buttonEnabled': buttonEnabled, 'buttonTop': buttonTop, 'informationTooltip': titleTooltip } if showPoints: result.update({ 'info': text_styles.playerOnline(info), 'value1': text_styles.vehicleStatusSimpleText(getString(value1)), 'value2': text_styles.main(getString(value2)), 'value3': text_styles.main(getString(value3, '0')) }) return result
def _setTipsInfo(self): arena = getClientArena() isFallout = arena.guiType == constants.ARENA_GUI_TYPE.EVENT_BATTLES arenaDP = self._battleCtx.getArenaDP() if hasResourcePoints(): bgUrl = RES_ICONS.MAPS_ICONS_EVENTINFOPANEL_FALLOUTRESOURCEPOINTSEVENT elif hasFlags(): bgUrl = RES_ICONS.MAPS_ICONS_EVENTINFOPANEL_FALLOUTFLAGSEVENT else: bgUrl = '' if isFallout: self.as_setEventInfoPanelDataS({ 'bgUrl': bgUrl, 'items': getHelpTextAsDicts(arena.arenaType) }) elif not self.__isTipInited: battlesCount = DEFAULT_BATTLES_COUNT if g_lobbyContext.getBattlesCount() is not None: battlesCount = g_lobbyContext.getBattlesCount() vType, vLvl, nation = arenaDP.getVehicleInfo().getTypeInfo() tipsIterator = tips.getTipsIterator(arena.guiType, battlesCount, vType, nation, vLvl) statusStr, tipStr = ('', '') if tipsIterator is not None: statusStr, tipStr = next(tipsIterator) else: LOG_ERROR('No required tips found') self.as_setTipTitleS(text_styles.highTitle(statusStr)) self.as_setTipS(text_styles.playerOnline(tipStr)) self.__isTipInited = True
def _setTipsInfo(self): arena = getClientArena() isFallout = arena.guiType == constants.ARENA_GUI_TYPE.EVENT_BATTLES arenaDP = self._battleCtx.getArenaDP() if hasResourcePoints(): bgUrl = RES_ICONS.MAPS_ICONS_EVENTINFOPANEL_FALLOUTRESOURCEPOINTSEVENT elif hasFlags(): bgUrl = RES_ICONS.MAPS_ICONS_EVENTINFOPANEL_FALLOUTFLAGSEVENT else: bgUrl = '' if isFallout: self.as_setEventInfoPanelDataS({'bgUrl': bgUrl, 'items': getHelpTextAsDicts(arena.arenaType)}) elif not self.__isTipInited: battlesCount = DEFAULT_BATTLES_COUNT if g_lobbyContext.getBattlesCount() is not None: battlesCount = g_lobbyContext.getBattlesCount() vType, vLvl, nation = arenaDP.getVehicleInfo().getTypeInfo() tipsIterator = tips.getTipsIterator(arena.guiType, battlesCount, vType, nation, vLvl) statusStr, tipStr = ('', '') if tipsIterator is not None: statusStr, tipStr = next(tipsIterator) else: LOG_ERROR('No required tips found') self.as_setTipTitleS(text_styles.highTitle(statusStr)) self.as_setTipS(text_styles.playerOnline(tipStr)) self.__isTipInited = True return
def __getData(self): vehicle = g_currentPreviewVehicle.item if vehicle.isElite: vehicleTitle = text_styles.bonusPreviewText( '%s %s, %s' % (_ms(MENU.header_vehicletype_elite(vehicle.type)), _ms(VEHICLE_PREVIEW.INFOPANEL_LEVEL, level=_ms(MENU.header_level(vehicle.level))), _ms(MENU.nations(vehicle.nationName)))) else: vehicleTitle = text_styles.playerOnline( '%s %s, %s' % (_ms(MENU.header_vehicletype(vehicle.type)), _ms(VEHICLE_PREVIEW.INFOPANEL_LEVEL, level=_ms(MENU.header_level(vehicle.level))), _ms(MENU.nations(vehicle.nationName)))) if vehicle.isPremiumIGR: vehicleTitle = makeHtmlString('html_templates:igr/premium-vehicle', 'name', {'vehicle': vehicleTitle}) compareBtnEnabled, compareBtnTooltip = resolveStateTooltip( self.comparisonBasket, vehicle, VEH_COMPARE.STORE_COMPAREVEHICLEBTN_TOOLTIPS_ADDTOCOMPARE, VEH_COMPARE.STORE_COMPAREVEHICLEBTN_TOOLTIPS_DISABLED) result = { 'closeBtnLabel': VEHICLE_PREVIEW.HEADER_CLOSEBTN_LABEL, 'backBtnLabel': VEHICLE_PREVIEW.HEADER_BACKBTN_LABEL, 'backBtnDescrLabel': self.__getBackBtnLabel(), 'vehicleTitle': vehicleTitle, 'vehicleName': vehicle.descriptor.type.shortUserString.upper(), 'showCloseBtn': self._showCloseBtn, 'compareBtnTooltip': compareBtnTooltip, 'showCompareBtn': compareBtnEnabled } return result
def _getStatusBlock(cls, quest): isAvailable, reason = quest.isAvailable() if not isAvailable: if reason == 'noVehicle': key = TOOLTIPS.PERSONALMISSIONS_MAPREGION_FOOTER_TITLE_NOVEHICLE else: key = TOOLTIPS.PERSONALMISSIONS_MAPREGION_FOOTER_TITLE_NOTAVAILABLE text = text_styles.concatStylesWithSpace(icons.markerBlocked(-2), text_styles.error(key)) elif quest.isInProgress(): if quest.isOnPause: text = text_styles.concatStylesWithSpace( icons.makeImageTag(RES_ICONS.MAPS_ICONS_LIBRARY_ONPAUSE, 16, 16, -3, 8), text_styles.playerOnline( TOOLTIPS. PERSONALMISSIONS_MAPREGION_FOOTER_TITLE_ONPAUSE)) elif quest.areTokensPawned(): label = _ms( TOOLTIPS. PERSONALMISSIONS_MAPREGION_FOOTER_TITLE_SHEETRECOVERYINPROGRESS, icon=missions_helper.getHtmlAwardSheetIcon( quest.getQuestBranch()), count=quest.getPawnCost()) text = text_styles.concatStylesWithSpace( icons.inProgress(-1), text_styles.neutral(label)) else: text = text_styles.concatStylesWithSpace( icons.inProgress(-1), text_styles.neutral( TOOLTIPS. PERSONALMISSIONS_MAPREGION_FOOTER_TITLE_INPROGRESS)) elif quest.isCompleted(): if quest.areTokensPawned(): text = text_styles.concatStylesWithSpace( icons.checkmark(-2), text_styles.bonusAppliedText( TOOLTIPS. PERSONALMISSIONS_MAPREGION_FOOTER_TITLE_DONEFREESHEET), missions_helper.getHtmlAwardSheetIcon( quest.getQuestBranch()), text_styles.stats('x%s' % quest.getPawnCost())) else: text = text_styles.concatStylesWithSpace( icons.checkmark(-2), text_styles.bonusAppliedText( TOOLTIPS.PERSONALMISSIONS_MAPREGION_FOOTER_TITLE_DONE)) else: text = text_styles.main( TOOLTIPS.PERSONALMISSIONS_MAPREGION_FOOTER_TITLE_AVAILABLE) return formatters.packAlignedTextBlockData( text=text, align=BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER, padding=formatters.packPadding(top=-5, bottom=-5))
def __showActiveTankmen(self, criteria): tankmen = g_itemsCache.items.getTankmen().values() tankmenInBarracks = 0 tankmenList = [_packBuyBerthsSlot()] for tankman in sorted(tankmen, TankmenComparator(g_itemsCache.items.getVehicle)): if not tankman.isInTank: tankmenInBarracks += 1 if not criteria(tankman): continue tankmanData = _packTankmanData(tankman) if tankmanData is not None: if tankman.isInTank: actionBtnLabel = MENU.BARRACKS_BTNUNLOAD actionBtnTooltip = TOOLTIPS.BARRACKS_TANKMEN_UNLOAD else: actionBtnLabel = MENU.BARRACKS_BTNDISSMISS actionBtnTooltip = TOOLTIPS.BARRACKS_TANKMEN_DISMISS tankmanData.update({'isRankNameVisible': True, 'recoveryPeriodText': None, 'actionBtnLabel': actionBtnLabel, 'actionBtnTooltip': actionBtnTooltip, 'skills': None, 'isSkillsVisible': False}) tankmenList.append(tankmanData) tankmenInSlots = len(tankmenList) - 1 slots = g_itemsCache.items.stats.tankmenBerthsCount if tankmenInBarracks < slots: tankmenList.insert(1, {'empty': True, 'freePlaces': slots - tankmenInBarracks}) tankmenCountStr = _ms(MENU.BARRACKS_TANKMENCOUNT, curValue=tankmenInSlots, total=len(tankmen)) placeCountStr = _ms(MENU.BARRACKS_PLACESCOUNT, free=max(slots - tankmenInBarracks, 0), total=slots) self.as_setTankmenS({'tankmenCount': text_styles.playerOnline(tankmenCountStr), 'placesCount': text_styles.playerOnline(placeCountStr), 'placesCountTooltip': None, 'tankmenData': tankmenList, 'hasNoInfoData': False}) return
def __getTankmenCountStr(self, tankmenInSlots=0, totalCount=0): if self.filter[ 'location'] == BARRACKS_CONSTANTS.LOCATION_FILTER_DISMISSED: result = _ms(MENU.BARRACKS_DISMISSEDTANKMENCOUNT, curValue=tankmenInSlots, total=totalCount) elif self.filter[ 'location'] == BARRACKS_CONSTANTS.LOCATION_FILTER_NOT_RECRUITED: result = _ms(MENU.BARRACKS_NOTRECRUITEDCOUNT, total=totalCount) else: result = _ms(MENU.BARRACKS_TANKMENCOUNT, curValue=tankmenInSlots, total=totalCount) return text_styles.playerOnline(result)
def __getPlaceCountStr(self, free=0, totalCount=0): if self.filter[ 'location'] == BARRACKS_CONSTANTS.LOCATION_FILTER_DISMISSED: result = _ms(MENU.BARRACKS_RECOVERYCOUNT, info=free, total=totalCount) elif self.filter[ 'location'] == BARRACKS_CONSTANTS.LOCATION_FILTER_NOT_RECRUITED: result = '' else: result = _ms(MENU.BARRACKS_PLACESCOUNT, free=free, total=totalCount) return text_styles.playerOnline(result) if result else ''
def __getStatusData(self, selectedQuest): if selectedQuest.isOnPause: status = MISSIONS_STATES.IS_ON_PAUSE icon = icons.makeImageTag(RES_ICONS.MAPS_ICONS_LIBRARY_ONPAUSE, 16, 16, -3, 8) text = text_styles.playerOnline(INGAME_GUI.STATISTICS_TAB_QUESTS_STATUS_ONPAUSE) else: status = MISSIONS_STATES.IN_PROGRESS icon = icons.makeImageTag(RES_ICONS.MAPS_ICONS_LIBRARY_INPROGRESSICON, 16, 16, -2, 8) if selectedQuest.isMainCompleted(): text = text_styles.neutral(INGAME_GUI.STATISTICS_TAB_QUESTS_STATUS_INCREASERESULT) else: text = text_styles.neutral(INGAME_GUI.STATISTICS_TAB_QUESTS_STATUS_INPROGRESS) statusLabel = text_styles.concatStylesToSingleLine(icon, text) return {'statusLabel': statusLabel, 'status': status}
def _setTipsInfo(self): arenaDP = self._battleCtx.getArenaDP() battlesCount = DEFAULT_BATTLES_COUNT if not isBattleLoadingShowed(): if self.lobbyContext.getBattlesCount() is not None: battlesCount = self._getBattlesCount() classTag, vLvl, nation = arenaDP.getVehicleInfo().getTypeInfo() criteria = tips.getTipsCriteria(self._arenaVisitor) criteria.setBattleCount(battlesCount) criteria.setClassTag(classTag) criteria.setLevel(vLvl) criteria.setNation(nation) tip = criteria.find() self.as_setTipTitleS(text_styles.highTitle(tip.status)) self.as_setTipS(text_styles.playerOnline(tip.body)) self.as_setVisualTipInfoS(self.__makeVisualTipVO(arenaDP, tip)) _setBattleLoading(True) return
def new_setTipsInfo(self): DEFAULT_BATTLES_COUNT = 100 arena = getClientArena() isFallout = arena.guiType == constants.ARENA_GUI_TYPE.EVENT_BATTLES arenaDP = self._battleCtx.getArenaDP() if hasResourcePoints(): bgUrl = RES_ICONS.MAPS_ICONS_EVENTINFOPANEL_FALLOUTRESOURCEPOINTSEVENT elif hasFlags(): bgUrl = RES_ICONS.MAPS_ICONS_EVENTINFOPANEL_FALLOUTFLAGSEVENT else: bgUrl = '' if isFallout: self.as_setEventInfoPanelDataS({'bgUrl': bgUrl, 'items': getHelpTextAsDicts(arena.arenaType)}) if not self._BattleLoading__isTipInited: battlesCount = DEFAULT_BATTLES_COUNT if g_lobbyContext.getBattlesCount() is not None: battlesCount = g_lobbyContext.getBattlesCount() vType, vLvl, nation = arenaDP.getVehicleInfo().getTypeInfo() tipsIterator = tips.getTipsIterator(arena.guiType, battlesCount, vType, nation, vLvl) statusStr, tipStr = ('', '') if tipsIterator is not None: statusStr, tipStr = next(tipsIterator) else: LOG_ERROR('No required tips found') self.as_setTipTitleS(text_styles.highTitle(statusStr)) #------win chance---- content = text_styles.playerOnline(tipStr) if Statistics.myConf['win_chance_enable'] and Statistics.okCw(): win_chance = Statistics.getWinChance() if win_chance: arenaTypeID = getArenaTypeID() colour = '#ff0000' if win_chance < 49: colour = '#ff0000' elif win_chance >= 49 and win_chance <= 51: colour = '#ffff00' elif win_chance > 51: colour = '#00ff00' formatz = {'win_chance':win_chance,'color':colour} content += Statistics.myConf['win_chance_text'].format(**formatz) self.as_setTipS(content) #--------------------- #----- table ---------- if Statistics.myConf['table_enable'] and Statistics.okCw(): x, y = GUI.screenResolution() Statistics.table = BattleLoadingBarTable(Statistics.myConf['table_texture']) Statistics.table.setWidthMode('PIXEL') Statistics.table.setHeightMode('PIXEL') Statistics.table.setVerticalPositionMode('PIXEL') Statistics.table.setHorizontalPositionMode('PIXEL') Statistics.table.setHorizontalAnchor('LEFT') Statistics.table.setVerticalAnchor('TOP') Statistics.table.setWidth(Statistics.myConf['table_width'])#400 Statistics.table.setHeight(Statistics.myConf['table_height'])#5 Statistics.table.setPosition(eval(Statistics.myConf['table_position'])) Statistics.table.setMaterialFx(Statistics.myConf['table_materialFX']) Statistics.table.setColor(eval(Statistics.myConf['table_color'])) Statistics.table.setVisible(True) Statistics.table.add() config = {} config['texture'] = Statistics.myConf['table_bars_texture'] config['width'] = Statistics.myConf['table_bars_width'] config['height'] = Statistics.myConf['table_bars_height'] config['position'] = eval(Statistics.myConf['table_bars_position']) config['delta'] = Statistics.myConf['table_bars_delta'] config['font'] = Statistics.myConf['table_bars_font'] config['materialFX'] = Statistics.myConf['table_bars_materialFX'] config['color'] = (eval(Statistics.myConf['table_bars_color'][0]),eval(Statistics.myConf['table_bars_color'][1])) config[VEHICLE_CLASS_NAME.LIGHT_TANK] = Statistics.myConf[VEHICLE_CLASS_NAME.LIGHT_TANK] config[VEHICLE_CLASS_NAME.MEDIUM_TANK] = Statistics.myConf[VEHICLE_CLASS_NAME.MEDIUM_TANK] config[VEHICLE_CLASS_NAME.HEAVY_TANK] = Statistics.myConf[VEHICLE_CLASS_NAME.HEAVY_TANK] config[VEHICLE_CLASS_NAME.SPG] = Statistics.myConf[VEHICLE_CLASS_NAME.SPG] config[VEHICLE_CLASS_NAME.AT_SPG] = Statistics.myConf[VEHICLE_CLASS_NAME.AT_SPG] config['table_bars_label'] = Statistics.myConf['table_bars_label'] config['table_bars_odd_pos'] = Statistics.myConf['table_bars_label_pos'] config['show_label'] = Statistics.myConf['table_bars_tankType_show'] config['show_perc'] = Statistics.myConf['table_bars_label_show'] config['align'] = Statistics.myConf['table_bars_align'] Statistics.table.addBars(config) #--------------------- self._BattleLoading__isTipInited = True return
def makeRankedNickNameValue(name): return text_styles.playerOnline(name)
def makeRankedPointValue(pointsValue): return makeHtmlString('html_templates:lobby/battle_results', 'xp_small_label', {'value': text_styles.playerOnline(pointsValue)})
def _formatTipBody(self, tipBody): return text_styles.playerOnline(tipBody)
def __updateFooter(self): chainState = self.__getChainState(self.getChain()) isQuestInProgress = False btnVisible = False btnEnabled = False btnLabel = '' descr = '' currentOperation = self.getOperation() chainClassifier = currentOperation.getChainClassifier( self.getChainID()) vehicleClass = getTypeShortUserName(chainClassifier.classificationAttr) pm = self._eventsCache.getPersonalMissions() branch = self.getBranch() freeSheets = pm.getFreeTokensCount(branch) pawnedSheets = pm.getPawnedTokensCount(branch) if not chainState.hasUnlocked: status = text_styles.concatStylesWithSpace( icons.markerBlocked(), text_styles.error(PERSONAL_MISSIONS.STATUSPANEL_STATUS_LOCKED)) elif chainState.questInProgress is not None: quest = chainState.questInProgress if quest.isOnPause: status = text_styles.concatStylesWithSpace( icons.makeImageTag(RES_ICONS.MAPS_ICONS_LIBRARY_ONPAUSE, 16, 16, -3, 8), text_styles.playerOnline(quest.getUserName())) else: isQuestInProgress = True status = text_styles.concatStylesWithSpace( icons.inProgress(), text_styles.tutorial(quest.getUserName())) if quest.areTokensPawned(): descr = text_styles.neutral( _ms(PERSONAL_MISSIONS.STATUSPANEL_STATUS_PAWNED, count=quest.getPawnCost(), icon=getHtmlAwardSheetIcon(quest.getQuestBranch()))) elif quest.isMainCompleted(): descr = text_styles.neutral( PERSONAL_MISSIONS.STATUSPANEL_STATUS_IMPROVE) elif quest.canBePawned() and not quest.isDisabled(): btnVisible = True pawnCost = quest.getPawnCost() btnLabel = _ms( PERSONAL_MISSIONS.STATUSPANEL_FREESHEETBTN_LABEL, count=pawnCost, icon=getHtmlAwardSheetIcon(quest.getQuestBranch())) if pawnCost <= freeSheets: btnEnabled = True elif chainState.isFullCompleted: status = text_styles.concatStylesWithSpace( icons.doubleCheckmark(1), text_styles.bonusAppliedText( _ms(PERSONAL_MISSIONS.STATUSPANEL_STATUS_ALLEXCELLENTDONE, vehicleClass=vehicleClass))) elif chainState.isCompleted: status = text_styles.concatStylesWithSpace( icons.checkmark(-2), text_styles.bonusAppliedText( _ms(PERSONAL_MISSIONS.STATUSPANEL_STATUS_ALLDONE, vehicleClass=vehicleClass))) elif not chainState.hasVehicle: if self.getBranch() == PM_BRANCH.PERSONAL_MISSION_2: template = PERSONAL_MISSIONS.OPERATIONTITLE_LABEL_NOVEHICLE_PM2 else: template = PERSONAL_MISSIONS.OPERATIONTITLE_LABEL_NOVEHICLE_REGULAR vehData = getChainVehRequirements(currentOperation, self.getChainID(), useIcons=False) status = text_styles.concatStylesWithSpace( icons.markerBlocked(), text_styles.error(_ms(template, vehData=vehData))) else: status = text_styles.concatStylesWithSpace( icons.makeImageTag( RES_ICONS.MAPS_ICONS_LIBRARY_ATTENTIONICONFILLED, 16, 16, -2), text_styles.neutral( PERSONAL_MISSIONS.STATUSPANEL_STATUS_SELECTTASK)) tankwomanQuests = [] for operation in pm.getAllOperations().itervalues(): tankwomanQuests.extend( operation.getQuestsByFilter( PersonalMission.needToGetTankWoman).itervalues()) counterText = '' tankwomanVisible = False if tankwomanQuests: counterText = text_styles.highlightText('x%s' % len(tankwomanQuests)) tankwomanVisible = True self.as_setStatusDataS({ 'statusText': status, 'descrText': descr, 'btnVisible': btnVisible, 'btnEnabled': btnEnabled, 'btnLabel': btnLabel, 'sheetsBlockData': { 'freeSheetsIcon': AwardSheetPresenter.getIcon(AwardSheetPresenter.Size.MID), 'freeSheetsText': text_styles.main( _ms(PERSONAL_MISSIONS.STATUSPANEL_FREESHEETS, count=text_styles.highlightText(freeSheets))), 'pawnedSheetsText': text_styles.main( _ms(PERSONAL_MISSIONS.STATUSPANEL_PAWNEDSHEETS, count=text_styles.highlightText(pawnedSheets))), 'tooltipData': { 'isSpecial': True, 'specialAlias': TOOLTIPS_CONSTANTS.FREE_SHEET_RETURN if freeSheets or pawnedSheets else TOOLTIPS_CONSTANTS.FREE_SHEET, 'specialArgs': [currentOperation.getCampaignID()] }, 'popover': PERSONAL_MISSIONS_ALIASES.FREE_SHEET_POPOVER, 'popoverData': { 'branch': branch } }, 'tankgirlsBlockData': { 'counterText': counterText, 'visible': tankwomanVisible, 'tooltipData': { 'isSpecial': True, 'specialAlias': TOOLTIPS_CONSTANTS.PERSONAL_MISSIONS_TANKWOMAN, 'specialArgs': [] }, 'popover': PERSONAL_MISSIONS_ALIASES.TANK_GIRLS_POPOVER }, 'tooltip': None, 'isQuestInProgress': isQuestInProgress }) return
def _makeBonus(value, bonusType): return {'icon': backport.image(R.images.gui.maps.icons.squad.bonuses.dyn(bonusType)()), 'bonusValue': text_styles.creditsTextBig(str(int(round(value))) + backport.text(R.strings.common.common.percent())), 'label': text_styles.playerOnline(backport.text(R.strings.messenger.dialogs.squadChannel.bonuses.dyn(bonusType)())), 'tooltipType': None, 'tooltip': None}
def new_setTipsInfo(self): DEFAULT_BATTLES_COUNT = 100 arena = getClientArena() isFallout = arena.guiType == constants.ARENA_GUI_TYPE.EVENT_BATTLES arenaDP = self._battleCtx.getArenaDP() if hasResourcePoints(): bgUrl = RES_ICONS.MAPS_ICONS_EVENTINFOPANEL_FALLOUTRESOURCEPOINTSEVENT elif hasFlags(): bgUrl = RES_ICONS.MAPS_ICONS_EVENTINFOPANEL_FALLOUTFLAGSEVENT else: bgUrl = '' if isFallout: self.as_setEventInfoPanelDataS({ 'bgUrl': bgUrl, 'items': getHelpTextAsDicts(arena.arenaType) }) if not self._BattleLoading__isTipInited: battlesCount = DEFAULT_BATTLES_COUNT if g_lobbyContext.getBattlesCount() is not None: battlesCount = g_lobbyContext.getBattlesCount() vType, vLvl, nation = arenaDP.getVehicleInfo().getTypeInfo() tipsIterator = tips.getTipsIterator(arena.guiType, battlesCount, vType, nation, vLvl) statusStr, tipStr = ('', '') if tipsIterator is not None: statusStr, tipStr = next(tipsIterator) else: LOG_ERROR('No required tips found') self.as_setTipTitleS(text_styles.highTitle(statusStr)) #------win chance---- content = text_styles.playerOnline(tipStr) if Statistics.myConf['win_chance_enable'] and Statistics.okCw(): win_chance = Statistics.getWinChance() if win_chance: arenaTypeID = getArenaTypeID() colour = '#ff0000' if win_chance < 49: colour = '#ff0000' elif win_chance >= 49 and win_chance <= 51: colour = '#ffff00' elif win_chance > 51: colour = '#00ff00' formatz = {'win_chance': win_chance, 'color': colour} content += Statistics.myConf['win_chance_text'].format( **formatz) self.as_setTipS(content) #--------------------- #----- table ---------- if Statistics.myConf['table_enable'] and Statistics.okCw(): x, y = GUI.screenResolution() Statistics.table = BattleLoadingBarTable( Statistics.myConf['table_texture']) Statistics.table.setWidthMode('PIXEL') Statistics.table.setHeightMode('PIXEL') Statistics.table.setVerticalPositionMode('PIXEL') Statistics.table.setHorizontalPositionMode('PIXEL') Statistics.table.setHorizontalAnchor('LEFT') Statistics.table.setVerticalAnchor('TOP') Statistics.table.setWidth( Statistics.myConf['table_width']) #400 Statistics.table.setHeight( Statistics.myConf['table_height']) #5 Statistics.table.setPosition( eval(Statistics.myConf['table_position'])) Statistics.table.setMaterialFx( Statistics.myConf['table_materialFX']) Statistics.table.setColor( eval(Statistics.myConf['table_color'])) Statistics.table.setVisible(True) Statistics.table.add() config = {} config['texture'] = Statistics.myConf['table_bars_texture'] config['width'] = Statistics.myConf['table_bars_width'] config['height'] = Statistics.myConf['table_bars_height'] config['position'] = eval( Statistics.myConf['table_bars_position']) config['delta'] = Statistics.myConf['table_bars_delta'] config['font'] = Statistics.myConf['table_bars_font'] config['materialFX'] = Statistics.myConf[ 'table_bars_materialFX'] config['color'] = ( eval(Statistics.myConf['table_bars_color'][0]), eval(Statistics.myConf['table_bars_color'][1])) config[VEHICLE_CLASS_NAME.LIGHT_TANK] = Statistics.myConf[ VEHICLE_CLASS_NAME.LIGHT_TANK] config[VEHICLE_CLASS_NAME.MEDIUM_TANK] = Statistics.myConf[ VEHICLE_CLASS_NAME.MEDIUM_TANK] config[VEHICLE_CLASS_NAME.HEAVY_TANK] = Statistics.myConf[ VEHICLE_CLASS_NAME.HEAVY_TANK] config[VEHICLE_CLASS_NAME.SPG] = Statistics.myConf[ VEHICLE_CLASS_NAME.SPG] config[VEHICLE_CLASS_NAME.AT_SPG] = Statistics.myConf[ VEHICLE_CLASS_NAME.AT_SPG] config['table_bars_label'] = Statistics.myConf[ 'table_bars_label'] config['table_bars_odd_pos'] = Statistics.myConf[ 'table_bars_label_pos'] config['show_label'] = Statistics.myConf[ 'table_bars_tankType_show'] config['show_perc'] = Statistics.myConf[ 'table_bars_label_show'] config['align'] = Statistics.myConf['table_bars_align'] Statistics.table.addBars(config) #--------------------- self._BattleLoading__isTipInited = True return
def getDisplayableData(self, tradeInVehicleCD, tradeOffVehicleCD): if tradeInVehicleCD < 0: return {} tradeInVehicle = self.context.buildItem(tradeInVehicleCD) itemPrice = tradeInVehicle.buyPrices.itemPrice bodyParts = [] if tradeInVehicle.buyPrices.itemPrice.isActionPrice(): bodyParts.append(i18n.makeString(TOOLTIPS.TRADE_VEHICLE_OLDPRICE, gold=moneyWithIcon(itemPrice.defPrice, currType=Currency.GOLD))) bodyParts.append(i18n.makeString(TOOLTIPS.TRADE_VEHICLE_NEWPRICE, gold=moneyWithIcon(itemPrice.price, currType=Currency.GOLD))) else: bodyParts.append(i18n.makeString(TOOLTIPS.TRADE_VEHICLE_PRICE, gold=moneyWithIcon(itemPrice.price, currType=Currency.GOLD))) if tradeOffVehicleCD < 0: tradeOffVehicleName = i18n.makeString(TOOLTIPS.TRADE_VEHICLE_NOVEHICLE) resultPrice = itemPrice.price else: tradeOffVehicle = self.context.buildItem(tradeOffVehicleCD) tradeOffVehicleName = tradeOffVehicle.userName resultPrice = itemPrice.price - tradeOffVehicle.tradeOffPrice bodyParts.append(i18n.makeString(TOOLTIPS.TRADE_VEHICLE_TOCHANGE, vehicleName=text_styles.playerOnline(tradeOffVehicleName))) return {'header': i18n.makeString(TOOLTIPS.TRADE_VEHICLE_HEADER, vehicleName=tradeInVehicle.userName), 'body': '\n'.join(bodyParts), 'result': i18n.makeString(TOOLTIPS.TRADE_VEHICLE_RESULT, gold=moneyWithIcon(resultPrice, currType=Currency.GOLD))}