merge conflicts fixed

This commit is contained in:
ferricles 2021-01-17 17:29:23 -08:00
commit 0da2b53247
8 changed files with 272 additions and 11 deletions

241
ci_parse.py Normal file
View file

@ -0,0 +1,241 @@
import os
import re
def parse_ci(infile):
itemName = infile.split("/")[1].split(".")[0]
print("-------------------------------")
print(infile)
print("-------------------------------")
id_reverse_map = {
"Neutral Damage": "nDam",
"Fire Damage": "fDam",
"Water Damage": "wDam",
"Air Damage": "aDam",
"Thunder Damage": "tDam",
"Earth Damage": "eDam",
"ealth": "hp", # HACKY
"Fire Defense": "fDef",
"Water Defense": "wDef",
"Air Defense": "aDef",
"Thunder Defense": "tDef",
"Earth Defense": "eDef",
"Combat Lv. Min": "lvl",
"Strength Min": "strReq",
"Dexterity Min": "dexReq",
"Intelligence Min": "intReq",
"Defense Min": "defReq",
"Agility Min": "agiReq",
"% Health Regen": "hprPct",
"/4s Mana Regen": "mr",
"% Spell Damage": "sdPct",
"% Main Attack Damage": "mdPct",
"/4s Life Steal": "ls",
"/4s Mana Steal": "ms",
"% XP Bonus": "xpb",
"% Loot Bonus": "lb",
"% Reflection": "ref",
"Strength": "str",
"Dexterity": "dex",
"Intelligence": "int",
"Agility": "agi",
"Defense": "def",
"% Thorns": "thorns",
"% Exploding": "expd",
"% Walk Speed": "spd",
"tier Attack Speed": "atkTier",
"/3s Poison": "poison",
"Health": "hpBonus",
"% Soul Point Regen": "spRegen",
"% Stealing": "eSteal",
"Health Regen": "hprRaw",
"Spell Damage": "sdRaw",
"Main Attack Damage": "mdRaw",
"% Fire Damage": "fDamPct",
"% Water Damage": "wDamPct",
"% Air Damage": "aDamPct",
"% Thunder Damage": "tDamPct",
"% Earth Damage": "eDamPct",
"% Fire Defense": "fDefPct",
"% Water Defense": "wDefPct",
"% Air Defense": "aDefPct",
"% Thunder Defense": "tDefPct",
"% Earth Defense": "eDefPct",
"% 1st Spell Cost": "spPct1",
"1st Spell Cost": "spRaw1",
"% 2nd Spell Cost": "spPct2",
"2nd Spell Cost": "spRaw2",
"% 3rd Spell Cost": "spPct3",
"3rd Spell Cost": "spRaw3",
"% 4th Spell Cost": "spPct4",
"4th Spell Cost": "spRaw4",
"rainbowSpellDamageRaw": "rainbowRaw",
"% Sprint": "sprint",
"% Sprint Regen": "sprintReg",
"Jump Height": "jh",
"lootQuality": "lq",
"gatherXpBonus": "gXp",
"gatherSpeed": "gSpd",
}
weapons = [ "bow", "wand", "spear", "dagger", "relik" ]
armors = [ "helmet", "chestplate", "leggings", "boots" ]
accessories = [ "ring", "bracelet", "necklace" ]
item_dict = dict()
with open(infile, "r") as _infile:
item_data = _infile.read()
item_data = item_data.split("<p class='restrictions")[0]
item_data = item_data.split("<p class='tier'>")[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("</i>","",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("<tr>")[1:]
item_dict["str"] = 0;
item_dict["dex"] = 0;
item_dict["int"] = 0;
item_dict["def"] = 0;
item_dict["agi"] = 0;
if fix_id:
for id_row in id_info:
label, high = re.split(r'<td', id_row)[1:]
high = high.split(">")[1].split("<")[0]
label = label.rsplit("<",1)[0][1:]
if "i class" in label:
_, two, three = label.split(">", 2)
label = two.split("<")[0][2:] + three
value_combine = high + " " + label
result = re.match(number_regex, value_combine)
high = int(result.group(1))
key = result.group(2).strip()
print(high, key)
item_dict[id_reverse_map[key]] = high
else:
for id_row in id_info:
low, label, high = re.split(r'<td', id_row)[1:]
low = low.split(">")[1].split("<")[0]
high = high.split(">")[1].split("<")[0]
label = label.rsplit("<",1)[0][1:]
if "i class" in label:
_, two, three = label.split(">", 2)
label = two.split("<")[0][2:] + three
value_combine = high + " " + label
result = re.match(number_regex, value_combine)
_high = int(result.group(1))
if low == "~":
_low = _high
else:
_low = int(re.match(number_regex, low).group(1))
key = result.group(2).strip()
low = min(_low, _high)
high = max(_low, _high)
print(low, high, key)
if low < 0:
# negative range: 1.3 to 0.7
base_guess = high
while base_guess > low:
if abs(base_guess * 1.3 - low) <= 0.5:
break
base_guess -= 1
else:
# positive range: 0.3 to 1.3
base_guess = low
while base_guess < high:
if abs(base_guess * 1.3 - high) <= 0.5:
break
base_guess += 1
item_dict[id_reverse_map[key]] = base_guess
return item_dict
#import sys
#print(parse_ci(sys.argv[1]))
#exit(1)
items_all = []
id_start_number = 10398
for filename in os.listdir('ci.2'):
item = parse_ci('ci.2/'+filename)
item['id'] = id_start_number + len(items_all)
items_all.append(item)
import json
with open("1_20_ci.json.2", "w") as outfile:
json.dump(items_all, outfile, indent=2)

20
ci_scrape.py Normal file
View file

@ -0,0 +1,20 @@
import os
with open("ci.txt.2") as infile:
current_mode = ""
for line in infile:
if line.startswith("#"):
continue
if "-" in line:
name, url = line.split(" - ")
url = "www.wynn".join(url.split("wynn", 1))
response = os.popen("curl "+url).read()
for line in response.split("\n"):
if "itembox macrocategory" in line:
response = line
break
with open(f"ci.2/{name}.html", "w") as outfile:
outfile.write(response)
if "_" in line:
break

View file

@ -271259,11 +271259,6 @@
"int": 12, "int": 12,
"def": 12, "def": 12,
"agi": 12, "agi": 12,
"eDamPct": 8,
"tDamPct": 8,
"wDamPct": 8,
"fDamPct": 8,
"aDamPct": 8,
"spPct2": -1, "spPct2": -1,
"id": 10262 "id": 10262
}, },

File diff suppressed because one or more lines are too long

View file

@ -177,7 +177,7 @@
</div> </div>
<br><br> <br><br>
<div class="externalBuffs" id="buff-box"> <div class="externalBuffs" id="buff-box">
<table> <table class="externalBuffs">
<tr> <tr>
<p class = "buffs-title itemp title"> <p class = "buffs-title itemp title">
Spell Boosts & Powder Specials: Spell Boosts & Powder Specials:

View file

@ -1,4 +1,4 @@
const DB_VERSION = 19; const DB_VERSION = 20;
const BUILD_VERSION = "6.9.2"; const BUILD_VERSION = "6.9.2";
// @See https://github.com/mdn/learning-area/blob/master/javascript/apis/client-side-storage/indexeddb/video-store/index.js // @See https://github.com/mdn/learning-area/blob/master/javascript/apis/client-side-storage/indexeddb/video-store/index.js

View file

@ -34,7 +34,9 @@
} }
.skp-input { .skp-input {
width: 15vw;
height: 7vw;
max-height: 30px;
} }
.hide-container-block { .hide-container-block {

View file

@ -293,8 +293,11 @@ button.toggleOn{
} }
.Star { .Star {
color:rgb(255, 198, 85) color:rgb(255, 198, 85);
} }
.Star:after { .Star:after {
content: "\272B"; content: "\272B";
} }
.externalBuffs {
width: 100%;
}