def makeEventBoardsTableDataVO(rewardCategories, method): rewardsFormatter = QuestsBonusComposer(getEventBoardsAwardPacker()) data = [] stripes = [] for categoryNumber, category in rewardCategories.iteritems(): players = category.get('players') if not players: continue rewards = category['rewards'] isIndividual = len( rewards) > 1 and categoryNumber == EVENT_BOARDS_GROUP_TYPES.GOLD stripeVO = { 'rendererLinkage': EVENTBOARDS_ALIASES.AWARD_STRIPE_RENDERER, 'id': categoryNumber, 'groupIcon': RES_ICONS.getEventBoardGroup(categoryNumber), 'tooltip': _ms(TOOLTIPS.ELEN_ANCOR_ALLGROUPS_HEADER, group=int2roman(categoryNumber), min=category.get('rank_min'), max=category.get('rank_max')) } if not isIndividual and rewards: stripeVO['icons'] = rewardsFormatter.getFormattedBonuses( rewards[0]) data.append(stripeVO) stripes.append(stripeVO) for currentPlayerData in players: name = currentPlayerData.getName() clanAbbrev = currentPlayerData.getClanTag() clanColor = currentPlayerData.getClanColor() rank = currentPlayerData.getRank() formattedParameters = formatParameters( method, (currentPlayerData.getP1(), currentPlayerData.getP2(), currentPlayerData.getP3())) player = { 'position': rank, 'value1': formattedParameters[0], 'value2': formattedParameters[1], 'value3': formattedParameters[2], 'userVO': { 'dbID': currentPlayerData.getSpaId(), 'fullName': getFullName(name, clanAbbrev, clanColor), 'userName': name, 'clanAbbrev': getClanTag(clanAbbrev, clanColor) } } if isIndividual: player['icons'] = rewardsFormatter.getFormattedBonuses( rewards[min(rank, len(rewards)) - 1]) player[ 'rendererLinkage'] = EVENTBOARDS_ALIASES.TOP_PLAYER_AWARD_RENDERER else: player[ 'rendererLinkage'] = EVENTBOARDS_ALIASES.BASE_PLAYER_AWARD_RENDERER data.append(player) return ({'tableDP': data}, {'tableDP': stripes})
def getHeader(self): recalculationTS = self._leaderboard.getLastLeaderboardRecalculationTS() status = formatUpdateTime( recalculationTS) if not self._event.isFinished() else '' title = getFullName(self._excelItem.getName(), self._excelItem.getClanTag(), self._excelItem.getClanColor()) return { 'title': title, 'description': self._getDescription(), 'description2': self._getDescription2(), 'status': status, 'isTable': self.isTable(), 'isSquad': self._event.getIsSquadAllowed(), 'statusTooltip': self._getStatusTooltip() if not self._event.isFinished() else '' }
def __updateStatus(self): event = self.__eventData playerState = self.__playerState myInfo = self.__myInfo state = playerState.getPlayerState() if playerState else None canJoin = playerState.getCanJoin() if playerState else True stateReasons = playerState.getPlayerStateReasons( ) if playerState else [] joined = state is _es.JOINED cardinality = event.getCardinality() battleCount = myInfo.battlesCount if myInfo else 0 notFull = cardinality is not None and battleCount < cardinality outOfScore = not myInfo.fullData.getIsInsideViewsize( ) if myInfo else False visible = True title = '' tooltip = None showPoints = False titleTooltip = None buttonVisible = False buttonEnabled = False buttonLabel = TOOLTIPS.ELEN_BUTTON_REGISTRATION_STARTED_HEADER buttonTooltip = makeTooltip( buttonLabel, TOOLTIPS.ELEN_BUTTON_REGISTRATION_STARTED_BODY) method = event.getMethod() if event.isFinished(): if not joined: title = getStatusTitleStyle( _ms(EVENT_BOARDS.EXCEL_PARTICIPATE_NOTPARTICIPATED)) elif notFull: title = getStatusTitleStyle( _ms(EVENT_BOARDS.EXCEL_PARTICIPATE_NOTPARTICIPATED)) elif outOfScore: showPoints = True title = getStatusTitleStyle( _ms(EVENT_BOARDS.STATUS_CANTJOIN_REASON_OUTOFRATING)) else: visible = False elif joined: if notFull: showPoints = True count = getStatusCountStyle(str(cardinality - battleCount)) title = getStatusTitleStyle( _ms(EVENT_BOARDS.EXCEL_HEADER_REASON_BATTLESLEFT, number=count)) elif outOfScore: showPoints = True title = getStatusTitleStyle( _ms(EVENT_BOARDS.STATUS_CANTJOIN_REASON_OUTOFRATING)) else: visible = False elif event.isRegistrationFinished(): title = formatErrorTextWithIcon( EVENT_BOARDS.STATUS_CANTJOIN_REASON_ENDREGISTRATION) tooltip = makeTooltip( EVENT_BOARDS.STATUS_CANTJOIN_REASON_ENDREGISTRATION, EVENT_BOARDS.STATUS_CANTJOIN_REASON_ENDREGISTRATION_TOOLTIP) elif canJoin: buttonVisible = _psr.SPECIALACCOUNT not in stateReasons buttonEnabled = True else: title, tooltip, buttonVisible = makeCantJoinReasonTextVO( event, self.__playerData) if joined and outOfScore and notFull and not event.isFinished(): amount = myInfo.fullData.getLastInLeaderboardValue() parameter = event.getObjectiveParameter() titleTooltip = makeParameterTooltipVO(method, amount, parameter) playerName = getattr(BigWorld.player(), 'name', '') playerName = getFullName(playerName, myInfo.fullData.getClanTag(), myInfo.fullData.getClanColor()) myPosition = self.__myInfo.rank self.as_setStatusVisibleS(visible) self.as_setMyPlaceVisibleS(not visible and myPosition is not None) if visible: p1 = myInfo.fullData.getP1() p2 = myInfo.fullData.getP2() p3 = myInfo.fullData.getP3() self.as_setStatusDataS( makeEventBoardsTableViewStatusVO(title, tooltip, playerName, p1, p2, p3, showPoints, buttonLabel, buttonTooltip, buttonVisible, buttonEnabled, titleTooltip, method)) return