separated ingredient and recipe puling and cleaning; updated to 1.20.2 ingredient API
This commit is contained in:
parent
bc281aa275
commit
67d5fbe54f
10 changed files with 28013 additions and 27488 deletions
1
atlas.js
1
atlas.js
|
@ -19,6 +19,7 @@ const flavortexts = ["JALA?? \n ATLAS?? \n ANYONE??",
|
||||||
"",
|
"",
|
||||||
"Isn't this like that one game Amogus?",
|
"Isn't this like that one game Amogus?",
|
||||||
"Mom, what does 'hppeng' mean?",
|
"Mom, what does 'hppeng' mean?",
|
||||||
|
"hpgbegg",
|
||||||
"| |I || |_",
|
"| |I || |_",
|
||||||
"",
|
"",
|
||||||
];
|
];
|
||||||
|
|
|
@ -12,6 +12,7 @@ function setTitle() {
|
||||||
setTitle();
|
setTitle();
|
||||||
|
|
||||||
let player_custom_item;
|
let player_custom_item;
|
||||||
|
let player_custom_ing;
|
||||||
let base_item; //the item that a user starts from, if any
|
let base_item; //the item that a user starts from, if any
|
||||||
let pos_range = [0.3,1.3];
|
let pos_range = [0.3,1.3];
|
||||||
let neg_range = [1.3,0.7];
|
let neg_range = [1.3,0.7];
|
||||||
|
|
953
ing_map.json
953
ing_map.json
File diff suppressed because it is too large
Load diff
File diff suppressed because one or more lines are too long
7974
ingreds_clean.json
7974
ingreds_clean.json
File diff suppressed because it is too large
Load diff
File diff suppressed because one or more lines are too long
|
@ -1,4 +1,4 @@
|
||||||
const ING_DB_VERSION = 5;
|
const ING_DB_VERSION = 6;
|
||||||
|
|
||||||
// @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
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ async function load_ings(init_func) {
|
||||||
let result = await (await fetch(url)).json();
|
let result = await (await fetch(url)).json();
|
||||||
|
|
||||||
result = await (await fetch(url)).json();
|
result = await (await fetch(url)).json();
|
||||||
ings = result.ingredients;
|
ings = result;
|
||||||
|
|
||||||
url = url.replace("/ingreds_compress.json", "/recipes_compress.json");
|
url = url.replace("/ingreds_compress.json", "/recipes_compress.json");
|
||||||
result = await (await fetch(url)).json();
|
result = await (await fetch(url)).json();
|
||||||
|
|
|
@ -2,16 +2,19 @@
|
||||||
|
|
||||||
import json
|
import json
|
||||||
|
|
||||||
|
with open("../ingreds.json", "r") as infile:
|
||||||
with open("recipes_compress.json", "r") as infile:
|
|
||||||
recipe_data = json.loads(infile.read())
|
|
||||||
recipes = recipe_data["recipes"]
|
|
||||||
#this data does not have request :)
|
|
||||||
with open("ingreds_compress.json", "r") as infile:
|
|
||||||
ing_data = json.loads(infile.read())
|
ing_data = json.loads(infile.read())
|
||||||
ings = ing_data["ingredients"]
|
ings = ing_data
|
||||||
#this data does not have request :)
|
#this data does not have request :)
|
||||||
|
|
||||||
|
import os
|
||||||
|
if os.path.exists("ing_map.json"):
|
||||||
|
with open("ing_map.json","r") as ing_mapfile:
|
||||||
|
ing_map = json.load(ing_mapfile)
|
||||||
|
else:
|
||||||
|
ing_map = {ing["name"]: i for i, ing in enumerate(ings)}
|
||||||
|
texture_names = []
|
||||||
|
|
||||||
|
|
||||||
delete_keys = [
|
delete_keys = [
|
||||||
"addedLore",
|
"addedLore",
|
||||||
|
@ -143,29 +146,7 @@ ing_delete_keys = [
|
||||||
|
|
||||||
]
|
]
|
||||||
|
|
||||||
recipe_translate_mappings = {
|
print("loaded all files.")
|
||||||
"level" : "lvl",
|
|
||||||
"id" : "name",
|
|
||||||
}
|
|
||||||
recipe_delete_keys = [ #lol
|
|
||||||
|
|
||||||
]
|
|
||||||
|
|
||||||
import os
|
|
||||||
if os.path.exists("ing_map.json"):
|
|
||||||
with open("ing_map.json","r") as ing_mapfile:
|
|
||||||
ing_map = json.load(ing_mapfile)
|
|
||||||
else:
|
|
||||||
ing_map = {ing["name"]: i for i, ing in enumerate(ings)}
|
|
||||||
|
|
||||||
if os.path.exists("recipe_map.json"):
|
|
||||||
with open("recipe_map.json","r") as recipe_mapfile:
|
|
||||||
recipe_map = json.load(recipe_mapfile)
|
|
||||||
else:
|
|
||||||
recipe_map = {recipe["name"]: i for i, recipe in enumerate(recipes)}
|
|
||||||
|
|
||||||
texture_names = []
|
|
||||||
|
|
||||||
|
|
||||||
print(ings[0])
|
print(ings[0])
|
||||||
for ing in ings:
|
for ing in ings:
|
||||||
|
@ -180,7 +161,7 @@ for ing in ings:
|
||||||
|
|
||||||
for k, v in ing_metaID_mappings.items():
|
for k, v in ing_metaID_mappings.items():
|
||||||
if k in ing['itemIDs']:
|
if k in ing['itemIDs']:
|
||||||
print(ing['itemIDs'])
|
print(ing['name'])
|
||||||
ing['itemIDs'][v] = ing['itemIDs'][k]
|
ing['itemIDs'][v] = ing['itemIDs'][k]
|
||||||
del ing['itemIDs'][k]
|
del ing['itemIDs'][k]
|
||||||
elif k in ing['consumableIDs']:
|
elif k in ing['consumableIDs']:
|
||||||
|
@ -200,31 +181,13 @@ for ing in ings:
|
||||||
print(f'New Ingred: {ing["name"]}')
|
print(f'New Ingred: {ing["name"]}')
|
||||||
ing["id"] = ing_map[ing["name"]]
|
ing["id"] = ing_map[ing["name"]]
|
||||||
|
|
||||||
for recipe in recipes:
|
|
||||||
for key in recipe_delete_keys:
|
|
||||||
if key in recipe:
|
|
||||||
del recipe[key]
|
|
||||||
|
|
||||||
for k, v in recipe_translate_mappings.items():
|
with open("../ingreds_clean.json", "w") as outfile:
|
||||||
if k in recipe:
|
|
||||||
recipe[v] = recipe[k]
|
|
||||||
del recipe[k]
|
|
||||||
if not (recipe["name"] in recipe_map):
|
|
||||||
recipe_map[recipe["name"]] = len(recipe_map)
|
|
||||||
print(f'New Recipe: {recipe["name"]}')
|
|
||||||
recipe["id"] = recipe_map[recipe["name"]]
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
with open("ingreds_clean.json", "w") as outfile:
|
|
||||||
json.dump(ing_data, outfile, indent = 2)
|
json.dump(ing_data, outfile, indent = 2)
|
||||||
with open("ingreds_compress2.json", "w") as outfile:
|
with open("../ingreds_compress.json", "w") as outfile:
|
||||||
json.dump(ing_data, outfile)
|
json.dump(ing_data, outfile)
|
||||||
with open("recipes_clean.json", "w") as outfile:
|
with open("../ing_map.json", "w") as ing_mapfile:
|
||||||
json.dump(recipe_data, outfile, indent = 2)
|
|
||||||
with open("recipes_compress2.json", "w") as outfile:
|
|
||||||
json.dump(recipe_data, outfile)
|
|
||||||
with open("ing_map.json", "w") as ing_mapfile:
|
|
||||||
json.dump(ing_map, ing_mapfile, indent = 2)
|
json.dump(ing_map, ing_mapfile, indent = 2)
|
||||||
with open("recipe_map.json", "w") as recipe_mapfile:
|
|
||||||
json.dump(recipe_map,recipe_mapfile,indent = 2)
|
|
||||||
|
print('All ing jsons updated.')
|
|
@ -1,20 +1,19 @@
|
||||||
import json
|
import json
|
||||||
import requests
|
import requests
|
||||||
|
import numpy as np
|
||||||
#Nothing to ingreds.json
|
#Nothing to ingreds.json
|
||||||
|
|
||||||
arr = []
|
arr = np.array([])
|
||||||
for i in range(4):
|
for i in range(4):
|
||||||
response = requests.get("https://api.wynncraft.com/v2/ingredient/search/tier/" + str(i))
|
response = requests.get("https://api.wynncraft.com/v2/ingredient/search/tier/" + str(i))
|
||||||
arr.append(response.json())
|
arr = np.append(arr, np.array(response.json()['data']))
|
||||||
|
|
||||||
with open("ingreds.json", "w") as outfile:
|
|
||||||
outfile.write(json.dumps(arr))
|
|
||||||
|
|
||||||
|
|
||||||
|
with open("../ingreds.json", "w") as outfile:
|
||||||
|
outfile.write(json.dumps(list(arr)))
|
||||||
|
|
||||||
'''with open("ingreds_compress.json", "w") as infile:
|
with open("../ingreds_compress.json", "w") as outfile:
|
||||||
data = json.loads(infile.read())
|
outfile.write(json.dumps(list(arr)))
|
||||||
|
|
||||||
with open("ingreds_clean.json", "w") as outfile:
|
with open("../ingreds_clean.json", "w") as outfile:
|
||||||
json.dump(data, outfile,indent = 2) #needs further cleaning'''
|
json.dump(list(arr), outfile, indent = 2) #needs further cleaning
|
||||||
|
|
46
py_script/recipe_transform_combine.py
Normal file
46
py_script/recipe_transform_combine.py
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
|
||||||
|
import os
|
||||||
|
|
||||||
|
with open("../recipes_compress.json", "r") as infile:
|
||||||
|
recipe_data = json.loads(infile.read())
|
||||||
|
recipes = recipe_data["recipes"]
|
||||||
|
|
||||||
|
if os.path.exists("recipe_map.json"):
|
||||||
|
with open("recipe_map.json","r") as recipe_mapfile:
|
||||||
|
recipe_map = json.load(recipe_mapfile)
|
||||||
|
else:
|
||||||
|
recipe_map = {recipe["name"]: i for i, recipe in enumerate(recipes)}
|
||||||
|
|
||||||
|
recipe_translate_mappings = {
|
||||||
|
"level" : "lvl",
|
||||||
|
"id" : "name",
|
||||||
|
}
|
||||||
|
recipe_delete_keys = [ #lol
|
||||||
|
|
||||||
|
]
|
||||||
|
|
||||||
|
print("loaded all files.")
|
||||||
|
|
||||||
|
for recipe in recipes:
|
||||||
|
for key in recipe_delete_keys:
|
||||||
|
if key in recipe:
|
||||||
|
del recipe[key]
|
||||||
|
for k, v in recipe_translate_mappings.items():
|
||||||
|
if k in recipe:
|
||||||
|
recipe[v] = recipe[k]
|
||||||
|
del recipe[k]
|
||||||
|
if not (recipe["name"] in recipe_map):
|
||||||
|
recipe_map[recipe["name"]] = len(recipe_map)
|
||||||
|
print(f'New Recipe: {recipe["name"]}')
|
||||||
|
recipe["id"] = recipe_map[recipe["name"]]
|
||||||
|
|
||||||
|
|
||||||
|
with open("../recipes_clean.json", "w") as outfile:
|
||||||
|
json.dump(recipe_data, outfile, indent = 2)
|
||||||
|
with open("../recipes_compress.json", "w") as outfile:
|
||||||
|
json.dump(recipe_data, outfile)
|
||||||
|
with open("../recipe_map.json", "w") as recipe_mapfile:
|
||||||
|
json.dump(recipe_map,recipe_mapfile,indent = 2)
|
||||||
|
|
||||||
|
|
||||||
|
print('All ing jsons updated.')
|
Loading…
Add table
Reference in a new issue