Misc. fixes

Remove big map print in load.js
Fix crafted weapon re-encoding -- broke from item powdering fix...
This commit is contained in:
hppeng 2022-07-28 22:48:01 -07:00
parent 00dffe62fa
commit 0d27c35c4e
5 changed files with 19 additions and 6 deletions

View file

@ -231,8 +231,15 @@ function expandItem(item) {
} }
class Item { class Item {
constructor(item_obj) { constructor(item_obj = null) {
this.statMap = expandItem(item_obj); if (item_obj) { this.statMap = expandItem(item_obj); }
else { this.statMap = new Map(); }
}
copy() {
const ret = new Item();
ret.statMap = new Map(this.statMap);
return ret;
} }
} }

View file

@ -203,8 +203,8 @@ class ItemPowderingNode extends ComputeNode {
compute_func(input_map) { compute_func(input_map) {
const powdering = input_map.get('powdering'); const powdering = input_map.get('powdering');
const item = {}; const input_item = input_map.get('item');
item.statMap = new Map(input_map.get('item').statMap); // TODO: performance const item = input_item.copy(); // TODO: performance
const max_slots = item.statMap.get('slots'); const max_slots = item.statMap.get('slots');
item.statMap.set('powders', powdering.slice(0, max_slots)); item.statMap.set('powders', powdering.slice(0, max_slots));

View file

@ -397,4 +397,8 @@ class Craft{
statMap.set("crafted", true); statMap.set("crafted", true);
this.statMap = statMap; this.statMap = statMap;
} }
copy() {
return new Craft(this.recipe, this.mat_tiers, this.ingreds, this.atkSpd, this.hash.slice(3));
}
} }

View file

@ -336,4 +336,7 @@ class Custom {
this.statMap.set("restrict", "Custom Item") this.statMap.set("restrict", "Custom Item")
} }
copy() {
return new Custom(new Map(this.statMap));
}
} }

View file

@ -254,5 +254,4 @@ function init_maps() {
redirectMap.set(item.id, item.remapID); redirectMap.set(item.id, item.remapID);
} }
} }
console.log(itemMap);
} }