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 getCounterText(self): if self.gotCount == self.needCount: tokensGot = text_styles.bonusAppliedText(self.gotCount) else: tokensGot = text_styles.stats(self.gotCount) tokensNeed = text_styles.standard(self.needCount) return text_styles.disabled('{} / {}'.format(tokensGot, tokensNeed))
def __packQuestSlot(self, quest = None): ttHeader, ttBody, ttAttention, ttNote = (None, None, None, None) if quest is not None: tile = _getQuestsCache().getTiles()[quest.getTileID()] season = _getQuestsCache().getSeasons()[tile.getSeasonID()] isInProgress = True ttHeader = quest.getUserName() ttBody = quests_fmts.getFullTileUserName(season, tile) if quest.needToGetReward(): icon = icons.makeImageTag(RES_ICONS.MAPS_ICONS_LIBRARY_ATTENTIONICONFILLED, 16, 16, -3, 0) description = text_styles.neutral(i18n.makeString(QUESTS.PERSONAL_SEASONS_SLOTS_GETAWARD, icon=icon)) ttAttention = i18n.makeString(TOOLTIPS.PRIVATEQUESTS_SLOT_MISSIONCOMPLETE_ATTENTION) else: description = text_styles.standard(quests_fmts.getPQFullDescription(quest)) ttNote = i18n.makeString(TOOLTIPS.PRIVATEQUESTS_SLOT_MISSION_NOTE) title = text_styles.middleTitle(i18n.makeString(QUESTS.PERSONAL_SEASONS_SLOTS_TITLE, questName=quest.getUserName())) else: title, isInProgress = '', False description = text_styles.disabled(i18n.makeString(QUESTS.PERSONAL_SEASONS_SLOTS_NODATA)) ttHeader = i18n.makeString(TOOLTIPS.PRIVATEQUESTS_SLOT_EMPTY_HEADER) ttBody = i18n.makeString(TOOLTIPS.PRIVATEQUESTS_SLOT_EMPTY_BODY) return {'id': quest.getID() if quest else None, 'title': title, 'description': description, 'inProgress': isInProgress, 'completed': quest and quest.needToGetReward(), 'ttHeader': ttHeader, 'ttBody': ttBody, 'ttNote': ttNote, 'ttAttention': ttAttention}
def _getMissionsCountLabel(completed, total): completed = text_styles.stats(completed) total = text_styles.standard(total) return text_styles.concatStylesToSingleLine( text_styles.standard( QUESTS.MISSIONS_TAB_CATEGORY_HEADER_PERFORMEDTASKS), text_styles.disabled(' %s / %s' % (completed, total)))
def minimizedTitleCumulativeFormat(current, total): if current == total: current = text_styles.bonusAppliedText(BigWorld.wg_getNiceNumberFormat(int(current))) else: current = text_styles.stats(BigWorld.wg_getNiceNumberFormat(int(current))) total = text_styles.standard(int(total)) return text_styles.disabled('%s / %s' % (current, total))
def __setFilterButtonStatus(self, isMax): if isMax: status = i18n.makeString(FORTIFICATIONS.FORTINTELLIGENCE_FORTINTELFILTER_FILTERBUTTONSTATUS_MAX) status = text_styles.disabled(status) else: status = i18n.makeString(FORTIFICATIONS.FORTINTELLIGENCE_FORTINTELFILTER_FILTERBUTTONSTATUS_MIN) status = text_styles.neutral(status) self.as_setFilterButtonStatusS(status, not isMax)
def __makeTableData(self): ms = i18n.makeString result = [] refSystem = game_control.g_instance.refSystem referrals = refSystem.getReferrals() numOfReferrals = len(referrals) for i, item in enumerate(referrals): referralNumber = text_styles.stats(ms('%d.' % (i + 1))) dbID = item.getAccountDBID() user = self.usersStorage.getUser(dbID) if not user: raise AssertionError('User must be defined') contactConverter = ContactConverter() contactData = contactConverter.makeVO(user) xpIcon = RES_ICONS.MAPS_ICONS_LIBRARY_NORMALXPICON icon = icons.makeImageTag(xpIcon, 16, 16, -3, 0) bonus, timeLeft = item.getBonus() if bonus == 1: multiplier = '-' multiplierTooltip = TOOLTIPS.REFERRALMANAGEMENTWINDOW_MULTIPLIER_X1 icon = '' else: multiplier = 'x%s' % BigWorld.wg_getNiceNumberFormat(bonus) multiplierTooltip = '' if timeLeft: multiplierTime = text_styles.main(ms(item.getBonusTimeLeftStr())) expMultiplierText = text_styles.standard(ms(MENU.REFERRALMANAGEMENTWINDOW_REFERRALSTABLE_LEFTTIME, time=multiplierTime)) else: expMultiplierText = '' multiplierFactor = text_styles.credits(multiplier) multiplierStr = ms(icon + '<nobr>' + multiplierFactor + ' ' + expMultiplierText) referralData = {'accID': dbID, 'fullName': user.getFullName(), 'userName': user.getName(), 'clanAbbrev': user.getClanAbbrev()} canInviteToSquad = self.prbFunctional.getEntityType() in (PREBATTLE_TYPE.NONE, PREBATTLE_TYPE.TRAINING) or self.prbFunctional.getEntityType() == PREBATTLE_TYPE.SQUAD and self.prbFunctional.getPermissions().canSendInvite() btnEnabled = canInviteToSquad or False btnTooltip = TOOLTIPS.REFERRALMANAGEMENTWINDOW_CREATESQUADBTN_DISABLED_SQUADISFULL else: btnEnabled = True btnTooltip = TOOLTIPS.REFERRALMANAGEMENTWINDOW_CREATESQUADBTN_ENABLED result.append({'isEmpty': False, 'contactData': contactData, 'referralNo': referralNumber, 'referralVO': referralData, 'exp': BigWorld.wg_getNiceNumberFormat(item.getXPPool()), 'multiplier': multiplierStr, 'multiplierTooltip': multiplierTooltip, 'btnEnabled': btnEnabled, 'btnTooltip': btnTooltip}) if numOfReferrals < self.MIN_REF_NUMBER: for i in xrange(numOfReferrals, self.MIN_REF_NUMBER): referralNumber = text_styles.disabled(ms(MENU.REFERRALMANAGEMENTWINDOW_REFERRALSTABLE_EMPTYLINE, lineNo=str(i + 1))) result.append({'isEmpty': True, 'referralNo': referralNumber}) self.as_setTableDataS(result)
def __makeTableData(self): ms = i18n.makeString result = [] refSystem = game_control.g_instance.refSystem referrals = refSystem.getReferrals() numOfReferrals = len(referrals) for i, item in enumerate(referrals): referralNumber = text_styles.stats(ms('%d.' % (i + 1))) dbID = item.getAccountDBID() user = self.usersStorage.getUser(dbID) if not user: raise AssertionError('User must be defined') isOnline = user.isOnline() xpIcon = RES_ICONS.MAPS_ICONS_LIBRARY_NORMALXPICON icon = icons.makeImageTag(xpIcon, 16, 16, -3, 0) bonus, timeLeft = item.getBonus() if bonus == 1: multiplier = '-' multiplierTooltip = TOOLTIPS.REFERRALMANAGEMENTWINDOW_MULTIPLIER_X1 icon = '' else: multiplier = 'x%s' % BigWorld.wg_getNiceNumberFormat(bonus) multiplierTooltip = '' if timeLeft: multiplierTime = text_styles.main(ms(item.getBonusTimeLeftStr())) expMultiplierText = text_styles.standard(ms(MENU.REFERRALMANAGEMENTWINDOW_REFERRALSTABLE_LEFTTIME, time=multiplierTime)) else: expMultiplierText = '' multiplierFactor = text_styles.credits(multiplier) multiplierStr = ms(icon + '<nobr>' + multiplierFactor + ' ' + expMultiplierText) referralData = {'accID': dbID, 'fullName': user.getFullName(), 'userName': user.getName(), 'clanAbbrev': user.getClanAbbrev()} canInviteToSquad = self.prbFunctional.getEntityType() in (PREBATTLE_TYPE.NONE, PREBATTLE_TYPE.TRAINING) or self.prbFunctional.getEntityType() == PREBATTLE_TYPE.SQUAD and self.prbFunctional.getPermissions().canSendInvite() btnEnabled = canInviteToSquad or False btnTooltip = TOOLTIPS.REFERRALMANAGEMENTWINDOW_CREATESQUADBTN_DISABLED_SQUADISFULL else: btnEnabled = True btnTooltip = TOOLTIPS.REFERRALMANAGEMENTWINDOW_CREATESQUADBTN_ENABLED result.append({'isEmpty': False, 'isOnline': isOnline, 'referralNo': referralNumber, 'referralVO': referralData, 'exp': BigWorld.wg_getNiceNumberFormat(item.getXPPool()), 'multiplier': multiplierStr, 'multiplierTooltip': multiplierTooltip, 'btnEnabled': btnEnabled, 'btnTooltip': btnTooltip}) if numOfReferrals < self.MIN_REF_NUMBER: for i in xrange(numOfReferrals, self.MIN_REF_NUMBER): referralNumber = text_styles.disabled(ms(MENU.REFERRALMANAGEMENTWINDOW_REFERRALSTABLE_EMPTYLINE, lineNo=str(i + 1))) result.append({'isEmpty': True, 'referralNo': referralNumber}) self.as_setTableDataS(result)
def packTokenProgress(tokenId, questId, title, image, gotCount, needCount, isBigSize = False): if gotCount == needCount: tokensGot = text_styles.bonusAppliedText(gotCount) else: tokensGot = text_styles.stats(gotCount) tokensNeed = text_styles.standard(needCount) counterText = text_styles.disabled('{} / {}'.format(tokensGot, tokensNeed)) return {'tokenId': tokenId, 'questId': questId, 'titleText': title, 'isNormalSize': not isBigSize, 'imgSrc': image, 'countText': counterText}