def set(slots): ele = slots.c.ele wt = slots.c.wt # stars = slots.c.stars name = slots.c.name slots.d = ele_dragon[ele]() wp1, wp2 = wt_prints[wt] if isinstance(wp2, dict): try: wp2 = wp2[ele] except KeyError: wp2 = wp2['all'] slots.a = wp1() + wp2() chain_dict = coability_dict(ele) try: chain, _ = chain_dict[name] if chain is None or len(chain) < 3 or chain[2] != 'hp≤40': slots.c.coabs[name] = chain_dict[name] except: try: upper_wt = wt[0].upper() + wt[1:].lower() slots.c.coabs[upper_wt] = chain_dict[upper_wt] except: pass typeweapon = getattr(slot.w, wt) weapon = getattr(typeweapon, ele) slots.w = weapon() return
def get_adv_slotlist(): result = {} result['adv'] = {} if request.method == 'GET': result['adv']['name'] = request.args.get('adv', default=None) elif request.method == 'POST': params = request.get_json(silent=True) result['adv']['name'] = params['adv'].lower( ) if 'adv' in params else None else: return 'Wrong request method.' adv_ele = None dragon_module = slot.d weap_module = slot.w if result['adv']['name'] is not None: adv_instance = ADV_MODULES[result['adv']['name'].lower()]() adv_ele = adv_instance.slots.c.ele.lower() result['adv']['fullname'] = adv_instance.__class__.__name__ result['adv']['ele'] = adv_ele dragon_module = getattr(slot.d, adv_ele) result['adv']['wt'] = adv_instance.slots.c.wt.lower() weap_module = getattr(slot.w, result['adv']['wt']) result['coab'] = coability_dict(adv_ele) result['adv']['pref_dra'] = type(adv_instance.slots.d).__qualname__ result['adv']['pref_wep'] = type(adv_instance.slots.w).__qualname__ result['adv']['pref_wp'] = { 'wp1': type(adv_instance.slots.a).__qualname__, 'wp2': type(adv_instance.slots.a.a2).__qualname__ } result['adv']['pref_coab'] = adv_instance.coab result['adv']['pref_share'] = adv_instance.share result['adv']['acl'] = adv_instance.conf.acl if 'afflict_res' in adv_instance.conf: res_conf = adv_instance.conf.afflict_res res_dict = {} for afflic in AFFLICT_LIST: if afflic in res_conf: res_dict[afflic] = res_conf[afflic] if len(res_dict.keys()) > 0: result['adv']['afflict_res'] = res_dict if result['adv']['name'] in SPECIAL_ADV: result['adv']['no_config'] = SPECIAL_ADV[result['adv'] ['name']]['nc'] result['adv']['prelim'] = result['adv']['name'] in PRELIM_ADV # result['amulets'] = list_members(slot.a, is_amulet) result['dragons'] = list_members(dragon_module, is_dragon, element=adv_ele) result['weapons'] = list_members(weap_module, is_weapon, element=adv_ele) return jsonify(result)