diff --git a/builder/doc.html b/builder/doc.html
index 991a999..8921050 100644
--- a/builder/doc.html
+++ b/builder/doc.html
@@ -1314,13 +1314,13 @@
-
-
+
+
diff --git a/js/builder/build_encode_decode.js b/js/builder/build_encode_decode.js
index 0823c4e..f0818be 100644
--- a/js/builder/build_encode_decode.js
+++ b/js/builder/build_encode_decode.js
@@ -53,6 +53,7 @@ async function parse_hash(url_tag) {
let powdering = ["", "", "", "", ""];
let info = url_tag.split("_");
let version = info[0];
+ // Whether skillpoints are manually updated. True if they should be set to something other than default values
let save_skp = false;
let skillpoints = [0, 0, 0, 0, 0];
let level = 106;
@@ -157,7 +158,9 @@ async function parse_hash(url_tag) {
}
//level, skill point assignments, and powdering
- if (version_number == 1) {
+ if (version_number == 0) {
+ // do nothing! lol
+ } else if (version_number == 1) {
let powder_info = data_str;
let res = parsePowdering(powder_info);
powdering = res[0];
@@ -222,6 +225,8 @@ async function parse_hash(url_tag) {
for (let i in skillpoints) {
setValue(skp_order[i] + "-skp", skillpoints[i]);
}
+
+ return save_skp;
}
/* Stores the entire build in a string using B64 encoding and adds it to the URL.
diff --git a/js/builder/builder.js b/js/builder/builder.js
index dc84cee..b1116bc 100644
--- a/js/builder/builder.js
+++ b/js/builder/builder.js
@@ -358,14 +358,16 @@ async function init() {
});
} catch (e) {
console.log("Could not initialize macy components. Maybe you're offline?");
+ console.log(e);
}
- await parse_hash(url_tag);
+ const save_skp = await parse_hash(url_tag);
try {
init_autocomplete();
} catch (e) {
console.log("Could not initialize autocomplete. Maybe you're offline?");
+ console.log(e);
}
- builder_graph_init();
+ builder_graph_init(save_skp);
for (const item_node of item_nodes) {
if (item_node.get_value() === null) {
// likely DB load failure...
diff --git a/js/builder/builder_graph.js b/js/builder/builder_graph.js
index 0c5c37b..f969c42 100644
--- a/js/builder/builder_graph.js
+++ b/js/builder/builder_graph.js
@@ -865,6 +865,7 @@ let radiance_affected = [ /*"hp"*/, "fDef", "wDef", "aDef", "tDef", "eDef", "hpr
];
/**
* Scale stats if radiance is enabled.
+ * TODO: skillpoints...
*/
const radiance_node = new (class extends ComputeNode {
constructor() { super('radiance-node->:('); }
@@ -936,6 +937,7 @@ class AggregateEditableIDNode extends ComputeNode {
let edit_id_output;
function resetEditableIDs() {
+ edit_id_output.mark_dirty().update();
edit_id_output.notify();
}
/**
@@ -947,6 +949,9 @@ class EditableIDSetterNode extends ComputeNode {
constructor(notify_nodes) {
super("builder-id-setter");
this.notify_nodes = notify_nodes.slice();
+ for (const child of this.notify_nodes) {
+ child.link_to(this);
+ }
}
compute_func(input_map) {
@@ -959,20 +964,7 @@ class EditableIDSetterNode extends ComputeNode {
}
}
- /**
- * Overriding this to bridge the transparent gap.
- */
- mark_dirty(dirty_state=2) {
- super.mark_dirty(dirty_state);
- for (const node of this.notify_nodes) {
- node.mark_dirty(dirty_state);
- }
- return this;
- }
-
notify() {
- this.mark_dirty();
- this.update();
// NOTE: DO NOT merge these loops for performance reasons!!!
for (const node of this.notify_nodes) {
node.mark_dirty();
@@ -993,6 +985,9 @@ class SkillPointSetterNode extends ComputeNode {
constructor(notify_nodes) {
super("builder-skillpoint-setter");
this.notify_nodes = notify_nodes.slice();
+ for (const child of this.notify_nodes) {
+ child.link_to(this);
+ }
}
compute_func(input_map) {
@@ -1001,13 +996,6 @@ class SkillPointSetterNode extends ComputeNode {
for (const [idx, elem] of skp_order.entries()) {
document.getElementById(elem+'-skp').value = build.total_skillpoints[idx];
}
- // NOTE: DO NOT merge these loops for performance reasons!!!
- for (const node of this.notify_nodes) {
- node.mark_dirty();
- }
- for (const node of this.notify_nodes) {
- node.update();
- }
}
}
@@ -1052,7 +1040,11 @@ let stat_agg_node;
let edit_agg_node;
let atree_graph_creator;
-function builder_graph_init() {
+/**
+ * Parameters:
+ * save_skp: bool True if skillpoints are modified away from skp engine defaults.
+ */
+function builder_graph_init(save_skp) {
// Phase 1/3: Set up item input, propagate updates, etc.
// Level input node.
@@ -1133,6 +1125,7 @@ function builder_graph_init() {
// Edit IDs setter declared up here to set ids so they will be populated by default.
edit_id_output = new EditableIDSetterNode(edit_input_nodes); // Makes shallow copy of list.
edit_id_output.link_to(build_node);
+ edit_agg_node.link_to(edit_id_output, 'edit-id-setter');
for (const skp of skp_order) {
const elem = document.getElementById(skp+'-skp');
@@ -1208,8 +1201,11 @@ function builder_graph_init() {
node.update();
}
- let skp_output = new SkillPointSetterNode(edit_input_nodes);
+ let skp_output = new SkillPointSetterNode(skp_inputs);
skp_output.link_to(build_node);
+ if (!save_skp) {
+ skp_output.update().mark_dirty().update();
+ }
let build_warnings_node = new DisplayBuildWarningsNode();
build_warnings_node.link_to(build_node, 'build');
diff --git a/js/computation_graph.js b/js/computation_graph.js
index 36fe2b3..2c598e9 100644
--- a/js/computation_graph.js
+++ b/js/computation_graph.js
@@ -30,10 +30,10 @@ class ComputeNode {
*/
update() {
if (this.inputs_dirty_count != 0) {
- return;
+ return this;
}
if (this.dirty === 0) {
- return;
+ return this;
}
if (COMPUTE_GRAPH_DEBUG) { node_debug_stack.push(this.name); }
if (this.dirty == 2) {
@@ -150,10 +150,10 @@ class ValueCheckComputeNode extends ComputeNode {
*/
update() {
if (this.inputs_dirty_count != 0) {
- return;
+ return this;
}
if (this.dirty === 0) {
- return;
+ return this;
}
let calc_inputs = new Map();
@@ -179,7 +179,6 @@ class ValueCheckComputeNode extends ComputeNode {
mark_dirty(dirty_state="unused") {
return super.mark_dirty(1);
}
-
}
let graph_live_update = false;
@@ -196,8 +195,10 @@ function calcSchedule(node, timeout) {
node.mark_dirty();
node.update_task = setTimeout(function() {
if (COMPUTE_GRAPH_DEBUG) { node_debug_stack = []; }
+ graph_live_update = false;
node.update();
node.update_task = null;
+ graph_live_update = true;
}, timeout);
}
diff --git a/js/load.js b/js/load.js
index 5aebbb5..7f07ddd 100644
--- a/js/load.js
+++ b/js/load.js
@@ -208,11 +208,6 @@ async function load_init() {
});
}
-// List of 'raw' "none" items (No Helmet, etc), in order helmet, chestplate... ring1, ring2, brace, neck, weapon.
-for (const it of item_types) {
- itemLists.set(it, []);
-}
-
let none_items = [
["armor", "helmet", "No Helmet"],
["armor", "chestplate", "No Chestplate"],
@@ -251,7 +246,11 @@ for (let i = 0; i < none_items.length; i++) {
}
function init_maps() {
- //warp
+ // List of 'raw' "none" items (No Helmet, etc), in order helmet, chestplate... ring1, ring2, brace, neck, weapon.
+ for (const it of item_types) {
+ itemLists.set(it, []);
+ }
+
itemMap = new Map();
/* Mapping from item names to set names. */
idMap = new Map();