small bug fixes for atree swapping - some unwanted behavior still exists

This commit is contained in:
ferricles 2022-06-17 20:46:52 -07:00
parent 0417a68e65
commit ec13bdea1e
2 changed files with 176 additions and 1248 deletions

File diff suppressed because it is too large Load diff

View file

@ -73,11 +73,9 @@ document.addEventListener('DOMContentLoaded', function() {
}; };
}); });
construct_AT(document.getElementById("atree-ui"), atrees["Assassin"]); //dagger is default atree
document.getElementById("atree-dropdown").style.display = "none"; document.getElementById("atree-dropdown").style.display = "none";
}); });
// phanta scheduler
let calcBuildTask = null; let calcBuildTask = null;
let updateStatTask = null; let updateStatTask = null;
let doSearchTask = null; let doSearchTask = null;
@ -235,8 +233,13 @@ function update_field(field) {
// set weapon img and set ability tree // set weapon img and set ability tree
if (category == 'weapon') { if (category == 'weapon') {
document.querySelector("#weapon-img").setAttribute('src', '../media/items/new/generic-'+type+'.png'); document.querySelector("#weapon-img").setAttribute('src', '../media/items/new/generic-'+type+'.png');
construct_AT(document.getElementById("atree-ui"), atrees[wep_to_class[type.toLowerCase()]]); //dagger is default atree //for some reason we have to cast to string
document.getElementById("atree-dropdown").style.display = "none"; construct_AT(document.getElementById("atree-ui"), atrees[wep_to_class.get(type)]);
if (document.getElementById("toggle-atree").classList.contains("toggleOn")) {
toggle_tab('atree-dropdown');
toggleButton('toggle-atree');
}
//TODO: reset chosen abilities (once ability implementation is here) //TODO: reset chosen abilities (once ability implementation is here)
} }
@ -538,6 +541,8 @@ function init_autocomplete() {
// atree parsing // atree parsing
function construct_AT(elem, tree) { function construct_AT(elem, tree) {
console.log("constructing ability tree UI");
elem.innerHTML = ""; //reset the atree in the DOM
for (let i = 0; i < tree.length; i++) { for (let i = 0; i < tree.length; i++) {
let node = tree[i]; let node = tree[i];