HOTFIX: tome patch
This commit is contained in:
parent
0e97dae2f9
commit
ef5dd8f6c6
3 changed files with 18 additions and 15 deletions
|
@ -105,7 +105,7 @@ class Build{
|
|||
* In order: 2x Weapon Mastery Tome, 4x Armor Mastery Tome, 1x Guild Tome.
|
||||
* 2x Slaying Mastery Tome, 2x Dungeoneering Mastery Tome, 2x Gathering Mastery Tome are in game, but do not have "useful" stats (those that affect damage calculations or building)
|
||||
*/
|
||||
constructor(level, items, tomes, weapon){
|
||||
constructor(level, items, weapon){
|
||||
|
||||
if (level < 1) { //Should these be constants?
|
||||
this.level = 1;
|
||||
|
@ -123,13 +123,12 @@ class Build{
|
|||
|
||||
this.availableSkillpoints = levelToSkillPoints(this.level);
|
||||
this.equipment = items;
|
||||
this.tomes = tomes;
|
||||
this.weapon = weapon;
|
||||
this.items = this.equipment.concat([this.weapon]).concat(this.tomes);
|
||||
this.items = this.equipment.concat([this.weapon]);
|
||||
// return [equip_order, best_skillpoints, final_skillpoints, best_total];
|
||||
|
||||
// calc skillpoints requires statmaps only
|
||||
let result = calculate_skillpoints(this.equipment.concat(this.tomes).map((x) => x.statMap), this.weapon.statMap);
|
||||
let result = calculate_skillpoints(this.equipment.map((x) => x.statMap), this.weapon.statMap);
|
||||
this.equip_order = result[0];
|
||||
// How many skillpoints the player had to assign (5 number)
|
||||
this.base_skillpoints = result[1];
|
||||
|
@ -145,7 +144,7 @@ class Build{
|
|||
/*Returns build in string format
|
||||
*/
|
||||
toString(){
|
||||
return [this.equipment,this.weapon,this.tomes].flat();
|
||||
return [this.equipment,this.weapon].flat();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -119,11 +119,11 @@ function decodeBuild(url_tag) {
|
|||
// Tomes.
|
||||
if (version == 6) {
|
||||
//tome values do not appear in anything before v6.
|
||||
for (let i = 0; i < 7; ++i) {
|
||||
for (let i in tomes) {
|
||||
let tome_str = info[1].charAt(i);
|
||||
for (let i in tomes) {
|
||||
setValue(tomeInputs[i], getTomeNameFromID(Base64.toInt(tome_str)));
|
||||
}
|
||||
let tome_name = getTomeNameFromID(Base64.toInt(tome_str));
|
||||
console.log(tome_name);
|
||||
setValue(tomeInputs[i], tome_name);
|
||||
}
|
||||
info[1] = info[1].slice(7);
|
||||
}
|
||||
|
|
|
@ -382,8 +382,6 @@ class URLUpdateNode extends ComputeNode {
|
|||
* Create a "build" object from a set of equipments.
|
||||
* Returns a new Build object, or null if all items are NONE items.
|
||||
*
|
||||
* TODO: add tomes
|
||||
*
|
||||
* Signature: BuildAssembleNode(helmet-input: Item,
|
||||
* chestplate-input: Item,
|
||||
* leggings-input: Item,
|
||||
|
@ -426,7 +424,7 @@ class BuildAssembleNode extends ComputeNode {
|
|||
if (all_none && !location.hash) {
|
||||
return null;
|
||||
}
|
||||
return new Build(level, equipments, [], weapon);
|
||||
return new Build(level, equipments, weapon);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1007,8 +1005,6 @@ function builder_graph_init() {
|
|||
|
||||
let build_disp_node = new BuildDisplayNode()
|
||||
build_disp_node.link_to(build_node, 'build');
|
||||
let build_warnings_node = new DisplayBuildWarningsNode();
|
||||
build_warnings_node.link_to(build_node, 'build');
|
||||
|
||||
// Create one node that will be the "aggregator node" (listen to all the editable id nodes, as well as the build_node (for non editable stats) and collect them into one statmap)
|
||||
let stat_agg_node = new AggregateStatsNode();
|
||||
|
@ -1026,14 +1022,15 @@ function builder_graph_init() {
|
|||
edit_id_output = new EditableIDSetterNode(edit_input_nodes); // Makes shallow copy of list.
|
||||
edit_id_output.link_to(build_node);
|
||||
|
||||
let skp_inputs = [];
|
||||
for (const skp of skp_order) {
|
||||
const elem = document.getElementById(skp+'-skp');
|
||||
const node = new SumNumberInputNode('builder-'+skp+'-input', elem);
|
||||
|
||||
edit_agg_node.link_to(node, skp);
|
||||
build_encode_node.link_to(node, skp);
|
||||
build_warnings_node.link_to(node, skp);
|
||||
edit_input_nodes.push(node);
|
||||
skp_inputs.push(node);
|
||||
}
|
||||
stat_agg_node.link_to(edit_agg_node);
|
||||
build_disp_node.link_to(stat_agg_node, 'stats');
|
||||
|
@ -1079,6 +1076,13 @@ function builder_graph_init() {
|
|||
let skp_output = new SkillPointSetterNode(edit_input_nodes);
|
||||
skp_output.link_to(build_node);
|
||||
|
||||
let build_warnings_node = new DisplayBuildWarningsNode();
|
||||
build_warnings_node.link_to(build_node, 'build');
|
||||
for (const [skp_input, skp] of zip2(skp_inputs, skp_order)) {
|
||||
build_warnings_node.link_to(skp_input, skp);
|
||||
}
|
||||
build_warnings_node.update();
|
||||
|
||||
// call node.update() for each skillpoint node and stat edit listener node manually
|
||||
// NOTE: the text boxes for skill points are already filled out by decodeBuild() so this will fix them
|
||||
// this will propagate the update to the `stat_agg_node`, and then to damage calc
|
||||
|
|
Loading…
Reference in a new issue