Fix bug with name vs displayName

This commit is contained in:
b 2021-03-04 05:58:29 -08:00
parent 5631dcaac4
commit 3765e2bb1b
2 changed files with 12 additions and 10 deletions

View file

@ -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);

View file

@ -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]);
} }