Ejemplo n.º 1
0
def __makeAwardsVO(item, level, vehicleIntCD):
    count = item.descriptor.progression.autoGrantCount
    if count < 1:
        return []
    if level > 1:
        bonusDesc = backport.text(
            R.strings.battle_results.customizationProgress.award.newLevel(),
            name=item.userName,
            level=level)
    else:
        bonusDesc = backport.text(
            R.strings.battle_results.customizationProgress.award.received(),
            name=item.userName,
            count=backport.text(
                R.strings.vehicle_customization.elementBonus.factor(),
                count=count))
    award = {
        'intCD': item.intCD,
        'texture': item.icon,
        'value': count,
        'showPrice': False,
        'description': bonusDesc,
        'vehicleIntCD': vehicleIntCD
    }
    return formatters.todict([formatters.packCustomizations([award])])
Ejemplo n.º 2
0
    def _getBonuses(self, svrEvents, bonuses = None):
        bonuses = bonuses or self.event.getBonuses()
        result, simpleBonusesList, customizationsList = [], [], []
        for b in bonuses:
            if b.isShowInGUI():
                if b.getName() == 'dossier':
                    for record in b.getRecords():
                        if record[0] != ACHIEVEMENT_BLOCK.RARE:
                            result.append(formatters.packAchieveElement(RECORD_DB_IDS[record]))

                elif b.getName() == 'customizations':
                    customizationsList.extend(b.getList())
                else:
                    flist = b.formattedList()
                    if flist:
                        simpleBonusesList.extend(flist)

        label = ', '.join(simpleBonusesList)
        fullLabel = None
        if len(simpleBonusesList) > self.SIMPLE_BONUSES_MAX_ITEMS:
            label = ', '.join(simpleBonusesList[:self.SIMPLE_BONUSES_MAX_ITEMS]) + '..'
            fullLabel = ', '.join(simpleBonusesList)
        result.append(formatters.packTextBlock(label, fullLabel=fullLabel))
        if len(customizationsList):
            result.append(formatters.packCustomizations(customizationsList))
        parents = [ qID for _, qIDs in self.event.getParents().iteritems() for qID in qIDs ]
        for qID, q in self._getEventsByIDs(parents, svrEvents or {}).iteritems():
            result.append(formatters.packTextBlock(i18n.makeString('#quests:bonuses/item/task', q.getUserName()), questID=qID))

        if len(result):
            return formatters.todict(result)
        else:
            return []
Ejemplo n.º 3
0
    def _getBonuses(self, svrEvents, bonuses=None, useIconFormat=False):
        bonuses = bonuses or self.event.getBonuses()
        result, simpleBonusesList, customizationsList, vehiclesList, iconBonusesList = (
            [], [], [], [], [])
        for b in bonuses:
            if b.isShowInGUI():
                if b.getName() == 'dossier':
                    for achieve in b.getAchievements():
                        result.append(
                            formatters.packAchieveElementByItem(achieve))

                elif b.getName() == 'customizations':
                    customizationsList.extend(b.getList())
                elif b.getName() == 'vehicles':
                    flist = b.formattedList()
                    if flist:
                        vehiclesList.extend(flist)
                elif b.hasIconFormat() and useIconFormat:
                    iconBonusesList.extend(b.getList())
                else:
                    flist = b.formattedList()
                    if flist:
                        simpleBonusesList.extend(flist)

        if len(customizationsList):
            result.append(formatters.packCustomizations(customizationsList))
        if len(iconBonusesList):
            result.append(formatters.packIconAwardBonusBlock(iconBonusesList))
        if len(vehiclesList) > 0:
            vehiclesLbl, _ = self._joinUpToMax(vehiclesList)
            result.append(
                formatters.packVehiclesBonusBlock(vehiclesLbl,
                                                  str(self.event.getID())))
        if len(simpleBonusesList) > 0:
            result.append(formatters.packSimpleBonusesBlock(simpleBonusesList))
        parents = [
            qID for _, qIDs in self.event.getParents().iteritems()
            for qID in qIDs
        ]
        for qID, q in self._getEventsByIDs(parents, svrEvents
                                           or {}).iteritems():
            result.append(
                formatters.packTextBlock(i18n.makeString(
                    '#quests:bonuses/item/task', q.getUserName()),
                                         questID=qID))

        if len(result):
            return formatters.todict(result)
        return formatters.todict([
            formatters.packTextBlock(
                text_styles.alert('#quests:bonuses/notAvailable'))
        ])
Ejemplo n.º 4
0
    def _getBonuses(self, svrEvents, bonuses = None):
        bonuses = bonuses or self.event.getBonuses()
        result, simpleBonusesList, customizationsList, vehiclesList = ([],
         [],
         [],
         [])
        for b in bonuses:
            if b.isShowInGUI():
                flist = []
                if b.getName() == 'dossier':
                    for record in b.getRecords():
                        if record[0] != ACHIEVEMENT_BLOCK.RARE:
                            result.append(formatters.packAchieveElement(RECORD_DB_IDS[record]))

                elif b.getName() == 'customizations':
                    customizationsList.extend(b.getList())
                elif b.getName() == 'vehicles':
                    flist = b.formattedList()
                    if flist:
                        vehiclesList.extend(flist)
                else:
                    flist = b.formattedList()
                    if flist:
                        simpleBonusesList.extend(flist)

        label = ', '.join(simpleBonusesList)
        fullLabel = None
        if len(simpleBonusesList) > self.SIMPLE_BONUSES_MAX_ITEMS:
            label = ', '.join(simpleBonusesList[:self.SIMPLE_BONUSES_MAX_ITEMS]) + '..'
            fullLabel = ', '.join(simpleBonusesList)
        result.append(formatters.packTextBlock(label, fullLabel=fullLabel))
        vehiclesLbl = ', '.join(vehiclesList)
        if len(vehiclesList) > self.SIMPLE_BONUSES_MAX_ITEMS:
            vehiclesLbl = ', '.join(vehiclesList[:self.SIMPLE_BONUSES_MAX_ITEMS]) + '..'
        result.append(formatters.packVehiclesBonusBlock(vehiclesLbl, str(self.event.getID())))
        if len(customizationsList):
            result.append(formatters.packCustomizations(customizationsList))
        parents = [ qID for _, qIDs in self.event.getParents().iteritems() for qID in qIDs ]
        for qID, q in self._getEventsByIDs(parents, svrEvents or {}).iteritems():
            result.append(formatters.packTextBlock(i18n.makeString('#quests:bonuses/item/task', q.getUserName()), questID=qID))

        if len(result):
            return formatters.todict(result)
        return []
Ejemplo n.º 5
0
    def _getBonuses(self, svrEvents, bonuses = None, useIconFormat = False):
        bonuses = bonuses or self.event.getBonuses()
        result, simpleBonusesList, customizationsList, vehiclesList, iconBonusesList = ([],
         [],
         [],
         [],
         [])
        for b in bonuses:
            if b.isShowInGUI():
                if b.getName() == 'dossier':
                    for record in b.getRecords():
                        if record[0] != ACHIEVEMENT_BLOCK.RARE:
                            result.append(formatters.packAchieveElement(RECORD_DB_IDS[record]))

                elif b.getName() == 'customizations':
                    customizationsList.extend(b.getList())
                elif b.getName() == 'vehicles':
                    flist = b.formattedList()
                    if flist:
                        vehiclesList.extend(flist)
                elif b.hasIconFormat() and useIconFormat:
                    iconBonusesList.extend(b.getList())
                else:
                    flist = b.formattedList()
                    if flist:
                        simpleBonusesList.extend(flist)

        if len(customizationsList):
            result.append(formatters.packCustomizations(customizationsList))
        if len(iconBonusesList):
            result.append(formatters.packIconAwardBonusBlock(iconBonusesList))
        if len(vehiclesList) > 0:
            vehiclesLbl, _ = self._joinUpToMax(vehiclesList)
            result.append(formatters.packVehiclesBonusBlock(vehiclesLbl, str(self.event.getID())))
        if len(simpleBonusesList) > 0:
            result.append(formatters.packSimpleBonusesBlock(simpleBonusesList))
        parents = [ qID for _, qIDs in self.event.getParents().iteritems() for qID in qIDs ]
        for qID, q in self._getEventsByIDs(parents, svrEvents or {}).iteritems():
            result.append(formatters.packTextBlock(i18n.makeString('#quests:bonuses/item/task', q.getUserName()), questID=qID))

        if len(result):
            return formatters.todict(result)
        return formatters.todict([formatters.packTextBlock(text_styles.alert('#quests:bonuses/notAvailable'))])
Ejemplo n.º 6
0
 def accumulateBonuses(self, bonus):
     customizationsList = bonus.getList()
     if customizationsList:
         self._result.append(
             formatters.packCustomizations(customizationsList))