Пример #1
0
 def __init__(self):
     self._grouped = {5: {}, 4: {}}
     self._grouped_lookup = {}
     for qual, wp in wyrmprints.items():
         try:
             wpa_lst = next(iter(wp['a']))
             wpa = wpa_lst[0]
             wpv = wpa_lst[1]
             try:
                 parts = wpa_lst[2].split('_')
                 wpc = tuple(c for c in parts if c not in ELEMENTS and c not in WEAPON_TYPES)
                 wpr = tuple(c for c in parts if c in ELEMENTS or c in WEAPON_TYPES)
             except (AttributeError, IndexError):
                 wpc = tuple()
                 wpr = tuple()
         except StopIteration:
             wpv = 0
             wpa = (None,)
             wpc = None
             wpr = None
         grouped_value = APGroup(value=wpv, att=wp['att'], restrict=wpr, condition=wpc, union=wp['union'], qual=qual)
         group_key = 5 if wp['rarity'] == 5 else 4
         self._grouped_lookup[qual] = (group_key, wpa, grouped_value)
         try:
             from bisect import bisect
             idx = bisect(self._grouped[group_key][wpa], grouped_value)
             self._grouped[group_key][wpa].insert(idx, grouped_value)
         except KeyError:
             self._grouped[group_key][wpa] = [grouped_value]
Пример #2
0
def get_adv_wp_list():
    if not (request.method == 'GET' or request.method == 'POST'):
        return 'Wrong request method.'
    result = {}
    result['adv'] = {}
    for name, variants in ADV_MODULES.items():
        result['adv'][name] = {
            'fullname':
            get_fullname(name),
            'variants': [
                vkey for vkey in variants.keys()
                if vkey is not None and vkey != 'mass'
            ]
        }
    wplists = {'gold': {}, 'silver': {}}
    for wp, data in wyrmprints.items():
        ab_str = f'-{data["union"]}'
        if data['a']:
            ab_str = '[' + '|'.join(map(str, data['a'][0])) + ']' + ab_str
        else:
            ab_str = '[]' + ab_str
        if data['rarity'] == 5:
            wplists['gold'][wp] = data['name'] + ' ' + ab_str
        else:
            wplists['silver'][wp] = data['name'] + ' ' + ab_str
    result['wyrmprints'] = wplists
    result['skillshare'] = {
        k: {
            'fullname': get_fullname(k),
            **v
        }
        for k, v in skillshare.items()
    }
    return jsonify(result)
Пример #3
0
def get_adv_wp_list():
    if not (request.method == "GET" or request.method == "POST"):
        return "Wrong request method."
    result = {}
    result["adv"] = {}
    for name, variants in ADV_MODULES.items():
        result["adv"][name] = {
            "fullname":
            get_fullname(name),
            "variants": [
                vkey for vkey in variants.keys()
                if vkey is not None and vkey != "mass"
            ],
        }
    wplists = {"formA": {}, "formB": {}, "formC": {}}
    for wp, data in wyrmprints.items():
        ab_str = f'-{data["union"]}'
        if data["a"]:
            ab_str = "[" + "‖".join(
                ["|".join(map(str, ab)) for ab in data["a"]]) + "]" + ab_str
        else:
            ab_str = "[]" + ab_str
        display_name = data["name"] + " " + ab_str
        wplists[RARITY_MAP[data["rarity"]]][wp] = display_name
    result["wyrmprints"] = wplists
    result["skillshare"] = {
        k: {
            "fullname": get_fullname(k),
            **v
        }
        for k, v in skillshare.items()
    }
    return jsonify(result)
Пример #4
0
def get_adv_wp_list():
    if not (request.method == 'GET' or request.method == 'POST'):
        return 'Wrong request method.'
    result = {}
    result['adv'] = {}
    for name in ADV_MODULES.keys():
        try:
            result['adv'][name] = load_adv_json(name)['c']['name']
        except FileNotFoundError:
            result['adv'][name] = SPECIAL_ADV[name]['fullname']
    wplists = {'gold': {}, 'silver': {}}
    for wp, data in wyrmprints.items():
        ab_str = f'-{data["union"]}'
        if data['a']:
            ab_str = '[' + '|'.join(map(str, data['a'][0])) + ']' + ab_str
        else:
            ab_str = '[]' + ab_str
        if data['rarity'] == 5:
            wplists['gold'][wp] = data['name'] + ' ' + ab_str
        else:
            wplists['silver'][wp] = data['name'] + ' ' + ab_str
    result['wyrmprints'] = wplists
    result['skillshare'] = {
        k: {
            'fullname': get_fullname(k),
            **v
        }
        for k, v in skillshare.items()
    }
    return jsonify(result)
Пример #5
0
    def __init__(self):
        self._grouped = {1: {}, 2: {}, 3: {}}
        self._grouped_lookup = {}
        special_counter = 0
        for qual, wp in wyrmprints.items():
            ab_length = len(wp["a"])
            if ab_length == 1:
                wpa_lst = wp["a"][0]
                wpa = wpa_lst[0]
                wpv = wpa_lst[1]
                try:
                    parts = wpa_lst[2].split("_")
                    wpc = tuple(c for c in parts
                                if c not in ELEMENTS and c not in WEAPON_TYPES)
                    wpr = tuple(c for c in parts
                                if c in ELEMENTS or c in WEAPON_TYPES)
                except (AttributeError, IndexError):
                    wpc = tuple()
                    wpr = tuple()
            else:
                wpv = 0
                if ab_length > 1:
                    wpa = ("special", special_counter)
                    special_counter += 1
                else:
                    wpa = (None, )
                wpc = None
                wpr = None

            grouped_value = APGroup(
                value=wpv,
                att=wp["att"],
                restrict=wpr,
                condition=wpc,
                union=wp["union"],
                qual=qual,
            )
            group_key = wp["rarity"]
            self._grouped_lookup[qual] = (group_key, wpa, grouped_value)
            try:
                from bisect import bisect

                idx = bisect(self._grouped[group_key][wpa], grouped_value)
                self._grouped[group_key][wpa].insert(idx, grouped_value)
            except KeyError:
                self._grouped[group_key][wpa] = [grouped_value]