Exemplo n.º 1
0
    def getRankedAwardVOs(self,
                          iconSize='small',
                          withCounts=False,
                          withKey=False):
        """
        Here we're supporting bonuses only that allowed in ranked battles
        """
        result = []
        badgesIconSizes = {'big': BADGES_ICONS.X80, 'small': BADGES_ICONS.X48}
        for (block, record), value in self.getRecords().iteritems():
            if _isBadge(block):
                header = i18n.makeString(BADGE.badgeName(record))
                body = i18n.makeString(BADGE.badgeDescriptor(record))
                note = i18n.makeString(BADGE.BADGE_NOTE)
                badgeVO = {
                    'imgSource':
                    getBadgeIconPath(badgesIconSizes[iconSize], record),
                    'label':
                    '',
                    'tooltip':
                    makeTooltip(header, body, note)
                }
                if withKey:
                    badgeVO['itemKey'] = BADGE.badgeName(record)
                if withCounts:
                    badgeVO['count'] = 1
                result.append(badgeVO)

        return result
Exemplo n.º 2
0
    def getEpicAwardVOs(self, withDescription=False):
        result = []
        for (block, record), _ in self.getRecords().iteritems():
            badgeVO = self.__getCommonAwardsVOs(block, record, iconSize='big')
            if not badgeVO:
                continue
            badgeVO['align'] = TEXT_ALIGN.CENTER
            badgeVO.update(_EPIC_AWARD_STATIC_VO_ENTRIES)
            if withDescription:
                badgeVO['title'] = i18n.makeString(BADGE.badgeName(record))
                badgeVO['description'] = i18n.makeString(
                    BADGE.badgeDescriptor(record))
            result.append(badgeVO)

        return result
Exemplo n.º 3
0
def _makeBadgeVO(badgeID, enabled, selected):
    return {
        'id':
        int(badgeID),
        'icon':
        settings.getBadgeIconPath(settings.BADGES_ICONS.X80, badgeID)
        if badgeID != _EMPTY_BADGE_ID else '',
        'title':
        text_styles.stats(BADGE.badgeName(badgeID)),
        'description':
        text_styles.main(BADGE.badgeDescriptor(badgeID)),
        'enabled':
        enabled,
        'selected':
        selected
    }
Exemplo n.º 4
0
    def getRankedAwardVOs(self,
                          iconSize='small',
                          withCounts=False,
                          withKey=False):
        result = []
        for (block, record), _ in self.getRecords().iteritems():
            badgeVO = self.__getCommonAwardsVOs(block,
                                                record,
                                                iconSize=iconSize,
                                                withCounts=withCounts)
            if not badgeVO:
                continue
            if withKey:
                badgeVO['itemKey'] = BADGE.badgeName(record)
            result.append(badgeVO)

        return result
Exemplo n.º 5
0
 def __getCommonAwardsVOs(self,
                          block,
                          record,
                          iconSize='small',
                          withCounts=False):
     badgesIconSizes = {'big': BADGES_ICONS.X80, 'small': BADGES_ICONS.X48}
     if _isBadge(block):
         header = i18n.makeString(BADGE.badgeName(record))
         body = i18n.makeString(BADGE.badgeDescriptor(record))
         note = i18n.makeString(BADGE.BADGE_NOTE)
         badgeVO = {
             'imgSource': getBadgeIconPath(badgesIconSizes[iconSize],
                                           record),
             'label': '',
             'tooltip': makeTooltip(header, body, note)
         }
         if withCounts:
             badgeVO['count'] = 1
         return badgeVO
     else:
         return None
Exemplo n.º 6
0
 def getUserName(self):
     key = BADGE.badgeName(self.badgeID)
     return i18n.makeString(key)