merge conflict fixed
This commit is contained in:
commit
be99964e5e
3 changed files with 35 additions and 22 deletions
34
crafter.js
34
crafter.js
|
@ -47,6 +47,7 @@ function init() {
|
||||||
//no ing
|
//no ing
|
||||||
let ing = Object();
|
let ing = Object();
|
||||||
ing.name = "No Ingredient";
|
ing.name = "No Ingredient";
|
||||||
|
ing.displayName = "No Ingredient";
|
||||||
ing.tier = 0;
|
ing.tier = 0;
|
||||||
ing.lvl = 0;
|
ing.lvl = 0;
|
||||||
ing.skills = ["ARMOURING", "TAILORING", "WEAPONSMITHING", "WOODWORKING", "JEWELING", "COOKING", "ALCHEMISM", "SCRIBING"];
|
ing.skills = ["ARMOURING", "TAILORING", "WEAPONSMITHING", "WOODWORKING", "JEWELING", "COOKING", "ALCHEMISM", "SCRIBING"];
|
||||||
|
@ -55,14 +56,15 @@ function init() {
|
||||||
ing.consumableIDs = {"dura": 0, "charges": 0};
|
ing.consumableIDs = {"dura": 0, "charges": 0};
|
||||||
ing.posMods = {"left": 0, "right": 0, "above": 0, "under": 0, "touching": 0, "notTouching": 0};
|
ing.posMods = {"left": 0, "right": 0, "above": 0, "under": 0, "touching": 0, "notTouching": 0};
|
||||||
ing.id = 4000;
|
ing.id = 4000;
|
||||||
ingMap.set(ing["name"], ing);
|
ingMap.set(ing["displayName"], ing);
|
||||||
ingList.push(ing["name"]);
|
ingList.push(ing["displayName"]);
|
||||||
ingIDMap.set(ing["id"], ing["name"]);
|
ingIDMap.set(ing["id"], ing["displayName"]);
|
||||||
let numerals = new Map([[1, "I"], [2, "II"], [3, "III"], [4, "IV"], [5, "V"], [6, "VI"]]);
|
let numerals = new Map([[1, "I"], [2, "II"], [3, "III"], [4, "IV"], [5, "V"], [6, "VI"]]);
|
||||||
for (let i = 0; i < 5; i ++) {
|
for (let i = 0; i < 5; i ++) {
|
||||||
for (const powderIng of powderIngreds) {
|
for (const powderIng of powderIngreds) {
|
||||||
let ing = Object();
|
let ing = Object();
|
||||||
ing.name = "" + damageClasses[i+1] + " Powder " + numerals.get(powderIngreds.indexOf(powderIng) + 1);
|
ing.name = "" + damageClasses[i+1] + " Powder " + numerals.get(powderIngreds.indexOf(powderIng) + 1);
|
||||||
|
ing.displayName = ing.name
|
||||||
ing.tier = 0;
|
ing.tier = 0;
|
||||||
ing.lvl = 0;
|
ing.lvl = 0;
|
||||||
ing.skills = ["ARMOURING", "TAILORING", "WEAPONSMITHING", "WOODWORKING"];
|
ing.skills = ["ARMOURING", "TAILORING", "WEAPONSMITHING", "WOODWORKING"];
|
||||||
|
@ -90,17 +92,17 @@ function init() {
|
||||||
}
|
}
|
||||||
ing.consumableIDs = {"dura": 0, "charges": 0};
|
ing.consumableIDs = {"dura": 0, "charges": 0};
|
||||||
ing.posMods = {"left": 0, "right": 0, "above": 0, "under": 0, "touching": 0, "notTouching": 0};
|
ing.posMods = {"left": 0, "right": 0, "above": 0, "under": 0, "touching": 0, "notTouching": 0};
|
||||||
ingMap.set(ing["name"],ing);
|
ingMap.set(ing["displayName"],ing);
|
||||||
ingList.push(ing["name"]);
|
ingList.push(ing["displayName"]);
|
||||||
ingIDMap.set(ing["id"], ing["name"]);
|
ingIDMap.set(ing["id"], ing["displayName"]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
for (const ing of ings) {
|
for (const ing of ings) {
|
||||||
ingMap.set(ing["name"], ing);
|
ingMap.set(ing["displayName"], ing);
|
||||||
ingList.push(ing["name"]);
|
ingList.push(ing["displayName"]);
|
||||||
ingIDMap.set(ing["id"], ing["name"]);
|
ingIDMap.set(ing["id"], ing["displayName"]);
|
||||||
}
|
}
|
||||||
for (const recipe of recipes) {
|
for (const recipe of recipes) {
|
||||||
recipeMap.set(recipe["name"], recipe);
|
recipeMap.set(recipe["name"], recipe);
|
||||||
|
@ -111,6 +113,7 @@ function init() {
|
||||||
console.log(ings);
|
console.log(ings);
|
||||||
console.log("all recipes");
|
console.log("all recipes");
|
||||||
console.log(recipes);
|
console.log(recipes);
|
||||||
|
console.log(ingMap);
|
||||||
/*console.log(ingList);
|
/*console.log(ingList);
|
||||||
console.log(recipeList);
|
console.log(recipeList);
|
||||||
console.log(ingIDMap);
|
console.log(ingIDMap);
|
||||||
|
@ -191,6 +194,7 @@ function calculateCraft() {
|
||||||
}
|
}
|
||||||
let ingreds = [];
|
let ingreds = [];
|
||||||
for (i = 1; i < 7; i++) {
|
for (i = 1; i < 7; i++) {
|
||||||
|
console.log(getValue("ing-choice-"+i));
|
||||||
getValue("ing-choice-" + i) === "" ? ingreds.push(expandIngredient(ingMap.get("No Ingredient"))) : ingreds.push(expandIngredient(ingMap.get(getValue("ing-choice-" + i))));
|
getValue("ing-choice-" + i) === "" ? ingreds.push(expandIngredient(ingMap.get("No Ingredient"))) : ingreds.push(expandIngredient(ingMap.get(getValue("ing-choice-" + i))));
|
||||||
}
|
}
|
||||||
let atkSpd = "NORMAL"; //default attack speed will be normal.
|
let atkSpd = "NORMAL"; //default attack speed will be normal.
|
||||||
|
@ -342,12 +346,12 @@ function shareRecipe(){
|
||||||
let name = player_craft.recipe.get("name").split("-");
|
let name = player_craft.recipe.get("name").split("-");
|
||||||
copyString += " > " + name[0] + " " + "Lv. " + name[1] + "-" + name[2] + " (" + player_craft.mat_tiers[0] + "\u272B, " + player_craft.mat_tiers[1] + "\u272B)\n";
|
copyString += " > " + name[0] + " " + "Lv. " + name[1] + "-" + name[2] + " (" + player_craft.mat_tiers[0] + "\u272B, " + player_craft.mat_tiers[1] + "\u272B)\n";
|
||||||
let names = [
|
let names = [
|
||||||
player_craft.ingreds[0].get("name"),
|
player_craft.ingreds[0].get("displayName"),
|
||||||
player_craft.ingreds[1].get("name"),
|
player_craft.ingreds[1].get("displayName"),
|
||||||
player_craft.ingreds[2].get("name"),
|
player_craft.ingreds[2].get("displayName"),
|
||||||
player_craft.ingreds[3].get("name"),
|
player_craft.ingreds[3].get("displayName"),
|
||||||
player_craft.ingreds[4].get("name"),
|
player_craft.ingreds[4].get("displayName"),
|
||||||
player_craft.ingreds[5].get("name")
|
player_craft.ingreds[5].get("displayName")
|
||||||
];
|
];
|
||||||
//fancy justify code that doesn't work properly b/c most font isn't monospaced
|
//fancy justify code that doesn't work properly b/c most font isn't monospaced
|
||||||
let buffer1 = Math.max(names[0].length,names[2].length,names[4].length);
|
let buffer1 = Math.max(names[0].length,names[2].length,names[4].length);
|
||||||
|
|
|
@ -83,7 +83,7 @@ function expandIngredient(ing) {
|
||||||
}
|
}
|
||||||
expandedIng.set(id, idMap);
|
expandedIng.set(id, idMap);
|
||||||
}
|
}
|
||||||
let normIds = ['lvl','name','tier','skills','id'];
|
let normIds = ['lvl','name', 'displayName','tier','skills','id'];
|
||||||
for (const id of normIds) {
|
for (const id of normIds) {
|
||||||
expandedIng.set(id, ing[id]);
|
expandedIng.set(id, ing[id]);
|
||||||
}
|
}
|
||||||
|
@ -907,7 +907,7 @@ function displayExpandedIngredient(ingred, parent_id) {
|
||||||
parent_elem.textContent = "";
|
parent_elem.textContent = "";
|
||||||
let display_order = [
|
let display_order = [
|
||||||
"#cdiv",
|
"#cdiv",
|
||||||
"name", //tier will be displayed w/ name
|
"displayName", //tier will be displayed w/ name
|
||||||
"#table",
|
"#table",
|
||||||
"ids",
|
"ids",
|
||||||
"#ldiv",
|
"#ldiv",
|
||||||
|
@ -1010,11 +1010,11 @@ function displayExpandedIngredient(ingred, parent_id) {
|
||||||
}else {
|
}else {
|
||||||
let p_elem = document.createElement("p");
|
let p_elem = document.createElement("p");
|
||||||
p_elem.classList.add("left");
|
p_elem.classList.add("left");
|
||||||
if (command === "name") {
|
if (command === "displayName") {
|
||||||
p_elem.classList.add("title");
|
p_elem.classList.add("title");
|
||||||
p_elem.classList.remove("left");
|
p_elem.classList.remove("left");
|
||||||
let title_elem = document.createElement("b");
|
let title_elem = document.createElement("b");
|
||||||
title_elem.textContent = ingred.get("name");
|
title_elem.textContent = ingred.get("displayName");
|
||||||
p_elem.appendChild(title_elem);
|
p_elem.appendChild(title_elem);
|
||||||
|
|
||||||
let space = document.createElement("b");
|
let space = document.createElement("b");
|
||||||
|
|
15
load_ing.js
15
load_ing.js
|
@ -1,4 +1,4 @@
|
||||||
const ING_DB_VERSION = 4;
|
const ING_DB_VERSION = 5;
|
||||||
|
|
||||||
// @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
|
||||||
|
|
||||||
|
@ -35,6 +35,14 @@ async function ing_load_local(init_func) {
|
||||||
idb.close();
|
idb.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function clean_ing(ing) {
|
||||||
|
if (ing.remapID === undefined) {
|
||||||
|
if (ing.displayName === undefined) {
|
||||||
|
ing.displayName = ing.name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Load item set from remote DB (aka a big json file). Calls init() on success.
|
* Load item set from remote DB (aka a big json file). Calls init() on success.
|
||||||
*/
|
*/
|
||||||
|
@ -65,8 +73,9 @@ async function load_ings(init_func) {
|
||||||
let add_promises = [];
|
let add_promises = [];
|
||||||
let add_tx2 = idb.transaction(['ing_db'], 'readwrite');
|
let add_tx2 = idb.transaction(['ing_db'], 'readwrite');
|
||||||
let ings_store = add_tx2.objectStore('ing_db');
|
let ings_store = add_tx2.objectStore('ing_db');
|
||||||
for (const ing in ings) {
|
for (const id in ings) {
|
||||||
add_promises.push(ings_store.add(ings[ing], ing));
|
clean_ing(ings[id]);
|
||||||
|
add_promises.push(ings_store.add(ings[id], id));
|
||||||
}
|
}
|
||||||
let add_tx3 = idb.transaction(['recipe_db'], 'readwrite');
|
let add_tx3 = idb.transaction(['recipe_db'], 'readwrite');
|
||||||
let recipes_store = add_tx3.objectStore('recipe_db');
|
let recipes_store = add_tx3.objectStore('recipe_db');
|
||||||
|
|
Loading…
Reference in a new issue