Esempio n. 1
0
    def __getDocGroupValues(tankman, config, subGroupName, sortNeeded=True):
        result = []
        isPremium, isFemale = tankman.descriptor.isPremium, tankman.descriptor.isFemale
        groupName = "premiumGroups" if isPremium else "normalGroups"
        for gIdx, group in enumerate(config[groupName]):
            if not group["notInShop"] and group["isFemales"] == isFemale:
                for idx in group["%sList" % subGroupName]:
                    result.append({"id": idx, "group": gIdx, "value": config[subGroupName][idx]})

        if sortNeeded:
            result = sorted(
                result, key=lambda sortField: sortField["value"], cmp=lambda a, b: strcmp(unicode(a), unicode(b))
            )
        return result
Esempio n. 2
0
    def __getDocGroupValues(tankman, config, subGroupName, sortNeeded=True):
        result = []
        isPremium, isFemale = tankman.descriptor.isPremium, tankman.descriptor.isFemale
        groupName = 'premiumGroups' if isPremium else 'normalGroups'
        for gIdx, group in enumerate(config[groupName]):
            if not group['notInShop'] and group['isFemales'] == isFemale:
                for idx in group['%sList' % subGroupName]:
                    result.append({
                        'id': idx,
                        'group': gIdx,
                        'value': config[subGroupName][idx]
                    })

        if sortNeeded:
            result = sorted(result,
                            key=lambda sortField: sortField['value'],
                            cmp=lambda a, b: strcmp(unicode(a), unicode(b)))
        return result
Esempio n. 3
0
    def __getDocGroupValues(tankman,
                            config,
                            listGetter,
                            valueGetter,
                            sortNeeded=True):
        result = []
        isPremium, isFemale = tankman.descriptor.isPremium, tankman.descriptor.isFemale
        for gIdx, group in enumerate(config.getGroups(isPremium)):
            if not group.notInShop and group.isFemales == isFemale:
                for idx in listGetter(group):
                    result.append({
                        'id': idx,
                        'group': gIdx,
                        'value': valueGetter(idx)
                    })

        if sortNeeded:
            result = sorted(result,
                            key=lambda sortField: sortField['value'],
                            cmp=lambda a, b: strcmp(unicode(a), unicode(b)))
        return result
Esempio n. 4
0
    def __getDocGroupValues(tankman, config, subGroupName, sortNeeded = True):
        result = []
        (isPremium, isFemale,) = (tankman.descriptor.isPremium, tankman.descriptor.isFemale)
        groupName = 'premiumGroups' if isPremium else 'normalGroups'
        for (gIdx, group,) in enumerate(config[groupName]):
            if not group['notInShop'] and group['isFemales'] == isFemale:
                for idx in group[('%sList' % subGroupName)]:
                    result.append({'id': idx,
                     'group': gIdx,
                     'value': config[subGroupName][idx]})


        if sortNeeded:
            result = sorted(result, key=lambda sortField: sortField['value'], cmp=lambda a, b: strcmp(unicode(a), unicode(b)))
        return result
Esempio n. 5
0
    def __getDocNormalGroupValues(config, groupName):
        result = []
        for gIdx, group in enumerate(config['normalGroups']):
            if not group.get('notInShop'):
                for idx in group['%sList' % groupName]:
                    result.append({'id': idx,
                     'group': gIdx,
                     'value': config[groupName][idx]})

        if groupName != 'icons':
            result = sorted(result, key=lambda sortField: sortField['value'], cmp=lambda a, b: strcmp(unicode(a), unicode(b)))
        return result