")[0].split("/items/v4//",1)[1] + + type_info = item_data.split("/", 1)[0] + item_data = item_data.split("p class='name ",1)[1] + tier_info = item_data.split("'",1)[0] + + item_dict["tier"] = tier_info + item_dict["type"] = type_info + + item_dict["name"] = itemName + " (1.20)" + item_dict["displayName"] = item_dict["name"] + + item_dict["set"] = None + item_dict["quest"] = None + item_dict["classReq"] = None # Ignoring cause I'm not checking anyway + item_dict["restrict"] = "1.20 item" + + static_info, id_info = item_data.split("table class='") + fix_id = id_info[:3] == 'td2' + item_dict["fixID"] = fix_id + id_info = id_info.split("/thead",1)[-1] + + def process_reqs(req_info): + req_info = [x.split("<",1)[0] for x in req_info.split('mark">')[1:]] + for req in req_info: + key, val = req.split(":") + item_dict[id_reverse_map[key]] = int(val) + + item_dict["strReq"] = 0; + item_dict["dexReq"] = 0; + item_dict["intReq"] = 0; + item_dict["defReq"] = 0; + item_dict["agiReq"] = 0; + if type_info in weapons: + attack_speed, static_info = static_info.split(" Speed",1) + attack_speed = attack_speed.split("attackSpeed'>",1)[1].split("Attack")[0].strip().replace(" ","_").upper() + item_dict["atkSpd"] = attack_speed + item_dict["category"] = "weapon" + + stat_info, req_info = static_info.split("Class Req: ") + process_reqs(req_info) + item_dict["nDam"] = "0-0"; + item_dict["eDam"] = "0-0"; + item_dict["tDam"] = "0-0"; + item_dict["wDam"] = "0-0"; + item_dict["fDam"] = "0-0"; + item_dict["aDam"] = "0-0"; + + else: # Armor and accessory both do health and eledef + if type_info in accessories: + item_dict["category"] = "accessory" + else: + item_dict["category"] = "armor" + + stat_info, req_info = static_info.split('requirements') + process_reqs(req_info) + + stat_info = stat_info.split("i class='")[1:] + for stat in stat_info: + key, stat = stat.split(">",1)[1][2:].replace("","",1).split("<",1)[0].split(": ") + try: + item_dict[id_reverse_map[key]] = int(stat) + except: + item_dict[id_reverse_map[key]] = stat + + if type_info not in accessories: + id_info, slot_info = id_info.split("'bottom'>") + if 'sockets' in slot_info: + item_dict["slots"] = int(slot_info.split("/",1)[1].split("]",1)[0]) + else: + item_dict["slots"] = 0 + + number_regex = re.compile(r"(-?\d+)(.*)") + id_info = id_info.split("