merge conflicts + first part of refactor
This commit is contained in:
parent
9f399846a3
commit
d4357d5d6b
8 changed files with 89 additions and 29 deletions
23
js/builder_graph.js
Normal file
23
js/builder_graph.js
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
|
||||||
|
|
||||||
|
let item_nodes = [];
|
||||||
|
|
||||||
|
document.addEventListener('DOMContentLoaded', function() {
|
||||||
|
for (const [eq, none_item] of zip(equipment_fields, none_items)) {
|
||||||
|
let input_field = document.getElementById(eq+"-choice");
|
||||||
|
let item_image = document.getElementById(eq+"-img");
|
||||||
|
|
||||||
|
// let item_dropdown
|
||||||
|
|
||||||
|
let item_input = new ItemInputNode(eq+'-input', input_field, none_item);
|
||||||
|
item_nodes.push(item_input);
|
||||||
|
new ItemInputDisplayNode(eq+'-display', input_field, item_image).link_to(item_input);
|
||||||
|
new PrintNode(eq+'-debug').link_to(item_input);
|
||||||
|
//document.querySelector("#"+eq+"-tooltip").setAttribute("onclick", "collapse_element('#"+ eq +"-tooltip');"); //toggle_plus_minus('" + eq + "-pm');
|
||||||
|
|
||||||
|
}
|
||||||
|
let weapon_image = document.getElementById("weapon-img");
|
||||||
|
new WeaponDisplayNode('weapon-type', weapon_image).link_to(item_nodes[8]);
|
||||||
|
console.log("Set up graph");
|
||||||
|
|
||||||
|
});
|
|
@ -1,3 +1,5 @@
|
||||||
|
#parses all CI and creates a json file with all of them
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
#looks like something that hpp does with curl
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
with open("ci.txt.2") as infile:
|
with open("ci.txt.2") as infile:
|
||||||
|
|
13
py_script/clean_json.py
Normal file
13
py_script/clean_json.py
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
'''
|
||||||
|
A generic file used for turning a json into a compressed version of itself (minimal whitespaces).
|
||||||
|
Compressed files are useful for lowering the amount of data sent.
|
||||||
|
|
||||||
|
Usage: python clean_json.py [infile rel path] [outfile rel path]
|
||||||
|
'''
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
import sys
|
||||||
|
import json
|
||||||
|
infile = sys.argv[1]
|
||||||
|
outfile = sys.argv[2]
|
||||||
|
json.dump(json.load(open(infile)), open(outfile, "w"), indent = 2)
|
|
@ -1,8 +1,13 @@
|
||||||
import sys
|
'''
|
||||||
import json
|
A generic file used for turning a json into a "clean" version of itself (human-friendly whitespace).
|
||||||
infile = sys.argv[1]
|
Clean files are useful for human reading and dev debugging.
|
||||||
outfile = sys.argv[2]
|
|
||||||
if len(sys.argv) > 3 and sys.argv[3] == "decompress":
|
Usage: python compress_json.py [infile rel path] [outfile rel path]
|
||||||
json.dump(json.load(open(infile)), open(outfile, "w"), indent=4)
|
'''
|
||||||
else:
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
import sys
|
||||||
|
import json
|
||||||
|
infile = sys.argv[1]
|
||||||
|
outfile = sys.argv[2]
|
||||||
json.dump(json.load(open(infile)), open(outfile, "w"))
|
json.dump(json.load(open(infile)), open(outfile, "w"))
|
||||||
|
|
|
@ -1,22 +0,0 @@
|
||||||
import requests
|
|
||||||
import json
|
|
||||||
import numpy as np
|
|
||||||
|
|
||||||
response = requests.get("https://api.wynncraft.com/public_api.php?action=itemDB&category=all")
|
|
||||||
|
|
||||||
with open("dump.json", "w") as outfile:
|
|
||||||
outfile.write(json.dumps(response.json()))
|
|
||||||
|
|
||||||
arr = np.array([])
|
|
||||||
for i in range(4):
|
|
||||||
response = requests.get("https://api.wynncraft.com/v2/ingredient/search/tier/" + str(i))
|
|
||||||
arr = np.append(arr, np.array(response.json()['data']))
|
|
||||||
|
|
||||||
with open("../ingreds.json", "w") as outfile:
|
|
||||||
outfile.write(json.dumps(list(arr)))
|
|
||||||
|
|
||||||
with open("../ingreds_compress.json", "w") as outfile:
|
|
||||||
outfile.write(json.dumps(list(arr)))
|
|
||||||
|
|
||||||
with open("../ingreds_clean.json", "w") as outfile:
|
|
||||||
json.dump(list(arr), outfile, indent = 2) #needs further cleaning
|
|
33
py_script/get.py
Normal file
33
py_script/get.py
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
"""
|
||||||
|
Used to GET data from the Wynncraft API. Has shorthand options and allows
|
||||||
|
for requesting from a specific url.
|
||||||
|
|
||||||
|
Usage: python get.py [url or command] [outfile rel path]
|
||||||
|
|
||||||
|
Relevant page: https://docs.wynncraft.com/
|
||||||
|
"""
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
import requests
|
||||||
|
import json
|
||||||
|
import numpy as np
|
||||||
|
import sys
|
||||||
|
|
||||||
|
#req can either be a link to an API page OR a preset default
|
||||||
|
req = sys.argv[1]
|
||||||
|
outfile = sys.argv[2]
|
||||||
|
response = {} #default to empty file output
|
||||||
|
|
||||||
|
if req.lower() is "items":
|
||||||
|
response = requests.get("https://api.wynncraft.com/public_api.php?action=itemDB&category=all")
|
||||||
|
elif req.lower() is "ings":
|
||||||
|
response = requests.get("https://api.wynncraft.com/v2/ingredient/list")
|
||||||
|
elif req.lower() is "recipes":
|
||||||
|
response = requests.get("https://api.wynncraft.com/v2/recipe/list")
|
||||||
|
else:
|
||||||
|
response = requests.get(req)
|
||||||
|
|
||||||
|
with open("dump.json", "w") as outfile:
|
||||||
|
outfile.write(json.dumps(response.json()))
|
||||||
|
|
||||||
|
json.dump(response.json(), open(outfile, "w"))
|
|
@ -1,3 +1,7 @@
|
||||||
|
"""
|
||||||
|
Used for grabbing image files at some point. Not used recently.
|
||||||
|
"""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import json
|
import json
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue