Merge branch 'atree' into atree-ui-tweak
also, minify builder/index.html
|
@ -49,7 +49,7 @@
|
|||
<div class="col-auto rounded order-xl-0 order-0">
|
||||
<div class="row h-100 px-1" id="helmet-dropdown">
|
||||
<div class="col-auto px-lg-1 g-0 dark-7 rounded-end my-auto text-center scaled-item-icon" id="helmet-img-loc">
|
||||
<img id="helmet-img" class="img-fluid rounded item-img" src="../media/items/new/generic-helmet.png">
|
||||
<div id="helmet-img" class="img-fluid rounded item-display-new-toggleable" style="background-image: url('../media/items/new.png'); background-position: 45.45454545454546% 0;"></div>
|
||||
</div>
|
||||
<div class="col-3">
|
||||
<div class="row row-cols-1 h-100 align-items-center">
|
||||
|
@ -76,7 +76,7 @@
|
|||
<div class="col-auto order-xl-0 order-1">
|
||||
<div class="row h-100 px-1" id="ring1-dropdown">
|
||||
<div class="col-auto px-lg-1 g-0 dark-7 rounded-end my-auto text-center scaled-item-icon" id="ring1-img-loc">
|
||||
<img id="ring1-img" class="img-fluid rounded" src="../media/items/new/generic-ring.png">
|
||||
<div id="ring1-img" class="img-fluid rounded item-display-new-toggleable" style="background-image: url('../media/items/new.png'); background-position: 81.81818181818181% 0;"></div>
|
||||
</div>
|
||||
<div class="col-3">
|
||||
<div class="row row-cols-1 h-100 align-items-center">
|
||||
|
@ -102,7 +102,7 @@
|
|||
<div class="col-auto order-xl-0 order-0">
|
||||
<div class="row h-100 px-1" id="chestplate-dropdown">
|
||||
<div class="col-auto px-lg-1 g-0 dark-7 rounded-end my-auto text-center scaled-item-icon" id="chestplate-img-loc">
|
||||
<img id="chestplate-img" class="img-fluid rounded" src="../media/items/new/generic-chestplate.png">
|
||||
<div id="chestplate-img" class="img-fluid rounded item-display-new-toggleable" style="background-image: url('../media/items/new.png'); background-position: 54.54545454545454% 0;"></div>
|
||||
</div>
|
||||
<div class="col-3">
|
||||
<div class="row row-cols-1 h-100 align-items-center">
|
||||
|
@ -129,7 +129,7 @@
|
|||
<div class="col-auto order-xl-0 order-1">
|
||||
<div class="row h-100 px-1" id="ring2-dropdown">
|
||||
<div class="col-auto px-lg-1 g-0 dark-7 rounded-end my-auto text-center scaled-item-icon" id="ring2-img-loc">
|
||||
<img id="ring2-img" class="img-fluid rounded" src="../media/items/new/generic-ring.png">
|
||||
<div id="ring2-img" class="img-fluid rounded item-display-new-toggleable" style="background-image: url('../media/items/new.png'); background-position: 81.81818181818181% 0;"></div>
|
||||
</div>
|
||||
<div class="col-3">
|
||||
<div class="row row-cols-1 h-100 align-items-center">
|
||||
|
@ -155,7 +155,7 @@
|
|||
<div class="col-auto order-xl-0 order-0">
|
||||
<div class="row h-100 px-1" id="leggings-dropdown">
|
||||
<div class="col-auto px-lg-1 g-0 dark-7 rounded-end my-auto text-center scaled-item-icon" id="leggings-img-loc">
|
||||
<img id="leggings-img" class="img-fluid rounded" src="../media/items/new/generic-leggings.png">
|
||||
<div id="leggings-img" class="img-fluid rounded item-display-new-toggleable" style="background-image: url('../media/items/new.png'); background-position: 63.63636363636363% 0;"></div>
|
||||
</div>
|
||||
<div class="col-3">
|
||||
<div class="row row-cols-1 h-100 align-items-center">
|
||||
|
@ -182,7 +182,7 @@
|
|||
<div class="col-auto order-xl-0 order-1">
|
||||
<div class="row h-100 px-1" id="bracelet-dropdown">
|
||||
<div class="col-auto px-lg-1 g-0 dark-7 rounded-end my-auto text-center scaled-item-icon" id="bracelet-img-loc">
|
||||
<img id="bracelet-img" class="img-fluid rounded" src="../media/items/new/generic-bracelet.png">
|
||||
<div id="bracelet-img" class="img-fluid rounded item-display-new-toggleable" style="background-image: url('../media/items/new.png'); background-position: 90.90909090909092% 0;"></div>
|
||||
</div>
|
||||
<div class="col-3">
|
||||
<div class="row row-cols-1 h-100 align-items-center">
|
||||
|
@ -209,7 +209,7 @@
|
|||
<div class="col-auto order-xl-0 order-0">
|
||||
<div class="row h-100 px-1" id="boots-dropdown">
|
||||
<div class="col-auto px-lg-1 g-0 dark-7 rounded-end my-auto text-center scaled-item-icon" id="boots-img-loc">
|
||||
<img id="boots-img" class="img-fluid rounded" src="../media/items/new/generic-boots.png">
|
||||
<div id="boots-img" class="img-fluid rounded item-display-new-toggleable" style="background-image: url('../media/items/new.png'); background-position: 72.72727272727272% 0;"></div>
|
||||
</div>
|
||||
<div class="col-3">
|
||||
<div class="row row-cols-1 h-100 align-items-center">
|
||||
|
@ -236,7 +236,7 @@
|
|||
<div class="col-auto order-xl-0 order-1">
|
||||
<div class="row h-100 px-1" id="necklace-dropdown">
|
||||
<div class="col-auto px-lg-1 g-0 dark-7 rounded-end my-auto text-center scaled-item-icon" id="necklace-img-loc">
|
||||
<img id="necklace-img" class="img-fluid rounded" src="../media/items/new/generic-necklace.png">
|
||||
<div id="necklace-img" class="img-fluid rounded item-display-new-toggleable" style="background-image: url('../media/items/new.png'); background-position: 100% 0;"></div>
|
||||
</div>
|
||||
<div class="col-3">
|
||||
<div class="row row-cols-1 h-100 align-items-center">
|
||||
|
@ -262,7 +262,7 @@
|
|||
<div class="col-auto order-xl-0 order-1">
|
||||
<div class="row h-auto px-1" id='weapon-dropdown'>
|
||||
<div class="col-auto px-lg-1 g-0 dark-7 rounded-end my-auto text-center scaled-item-icon" id="weapon-img-loc">
|
||||
<img id="weapon-img" class="img-fluid rounded" src="../media/items/new/generic-dagger.png">
|
||||
<div id="weapon-img" class="img-fluid rounded item-display-new-toggleable" style = "background-image: url('../media/items/new.png');"></div>
|
||||
</div>
|
||||
<div class="col-3">
|
||||
<div class="row row-cols-1 h-100 align-items-center">
|
||||
|
@ -611,7 +611,7 @@
|
|||
<div class="col-auto rounded">
|
||||
<div class="row h-100 dark-shadow rounded" id='weaponTome1-dropdown'>
|
||||
<div class="col-auto g-0 rounded-end my-auto text-center scaled-item-icon" id="weaponTome1-img-loc">
|
||||
<img id="weaponTome1-img" class="img-fluid rounded" src="../media/items/new/generic-weaponTome.png">
|
||||
<div id="weaponTome1-img" class="img-fluid rounded tome-image"></div>
|
||||
</div>
|
||||
<div class="col-3">
|
||||
<div class="row row-cols-1 h-100 align-items-center">
|
||||
|
@ -635,7 +635,7 @@
|
|||
<div class="col-auto rounded">
|
||||
<div class="row h-100 dark-shadow rounded" id='weaponTome2-dropdown'>
|
||||
<div class="col-auto g-0 rounded-end my-auto text-center scaled-item-icon" id="weaponTome2-img-loc">
|
||||
<img id="weaponTome2-img" class="img-fluid rounded" src="../media/items/new/generic-weaponTome.png">
|
||||
<div id="weaponTome2-img" class="img-fluid rounded tome-image"></div>
|
||||
</div>
|
||||
<div class="col-3">
|
||||
<div class="row row-cols-1 h-100 align-items-center">
|
||||
|
@ -659,7 +659,7 @@
|
|||
<div class="col-auto rounded">
|
||||
<div class="row h-100 dark-shadow rounded" id='armorTome1-dropdown'>
|
||||
<div class="col-auto g-0 rounded-end my-auto text-center scaled-item-icon" id="armorTome1-img-loc">
|
||||
<img id="armorTome1-img" class="img-fluid rounded" src="../media/items/new/generic-armorTome.png">
|
||||
<div id="armorTome1-img" class="img-fluid rounded tome-image"></div>
|
||||
</div>
|
||||
<div class="col-3">
|
||||
<div class="row row-cols-1 h-100 align-items-center">
|
||||
|
@ -683,7 +683,7 @@
|
|||
<div class="col-auto rounded">
|
||||
<div class="row h-100 dark-shadow rounded" id='armorTome2-dropdown'>
|
||||
<div class="col-auto g-0 rounded-end my-auto text-center scaled-item-icon" id="armorTome2-img-loc">
|
||||
<img id="armorTome2-img" class="img-fluid rounded" src="../media/items/new/generic-armorTome.png">
|
||||
<div id="armorTome2-img" class="img-fluid rounded tome-image"></div>
|
||||
</div>
|
||||
<div class="col-3">
|
||||
<div class="row row-cols-1 h-100 align-items-center">
|
||||
|
@ -707,7 +707,7 @@
|
|||
<div class="col-auto rounded">
|
||||
<div class="row h-100 dark-shadow rounded" id='armorTome3-dropdown'>
|
||||
<div class="col-auto g-0 rounded-end my-auto text-center scaled-item-icon" id="armorTome3-img-loc">
|
||||
<img id="armorTome3-img" class="img-fluid rounded" src="../media/items/new/generic-armorTome.png">
|
||||
<div id="armorTome3-img" class="img-fluid rounded tome-image"></div>
|
||||
</div>
|
||||
<div class="col-3">
|
||||
<div class="row row-cols-1 h-100 align-items-center">
|
||||
|
@ -731,7 +731,7 @@
|
|||
<div class="col-auto rounded">
|
||||
<div class="row h-100 dark-shadow rounded" id='armorTome4-dropdown'>
|
||||
<div class="col-auto g-0 rounded-end my-auto text-center scaled-item-icon" id="armorTome4-img-loc">
|
||||
<img id="armorTome4-img" class="img-fluid rounded" src="../media/items/new/generic-armorTome.png">
|
||||
<div id="armorTome4-img" class="img-fluid rounded tome-image"></div>
|
||||
</div>
|
||||
<div class="col-3">
|
||||
<div class="row row-cols-1 h-100 align-items-center">
|
||||
|
@ -755,7 +755,7 @@
|
|||
<div class="col-auto rounded">
|
||||
<div class="row h-100 dark-shadow rounded" id='guildTome1-dropdown'>
|
||||
<div class="col-auto g-0 rounded-end my-auto text-center scaled-item-icon" id="guildTome1-img-loc">
|
||||
<img id="guildTome1-img" class="img-fluid rounded" src="../media/items/new/generic-guildTome.png">
|
||||
<div id="guildTome1-img" class="img-fluid rounded tome-image"></div>
|
||||
</div>
|
||||
<div class="col-3">
|
||||
<div class="row row-cols-1 h-100 align-items-center">
|
||||
|
@ -1253,7 +1253,7 @@
|
|||
<script type="text/javascript" src="../js/utils.js"></script>
|
||||
<script type="text/javascript" src="../js/build_utils.js"></script>
|
||||
<script type="text/javascript" src="../js/computation_graph.js"></script>
|
||||
<script type="text/javascript" src="../js/sq2icons.js"></script>
|
||||
<script type="text/javascript" src="../js/icons.js"></script>
|
||||
<script type="text/javascript" src="../js/powders.js"></script>
|
||||
<script type="text/javascript" src="../js/skillpoints.js"></script>
|
||||
<script type="text/javascript" src="../js/damage_calc.js"></script>
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
<div class="col" id="recipe-dropdown">
|
||||
<div class="row dark-shadow dark-5 rounded">
|
||||
<div id = "recipe-img-loc" class = "col-auto px-lg-1 g-0 dark-7 rounded-end my-auto text-center scaled-item-icon">
|
||||
<img id = "recipe-img" class = "img-fluid rounded Crafted-shadow" src = "../media/items/new/generic-potion.png">
|
||||
<div id = "recipe-img" class = "img-fluid rounded Crafted-shadow" style = "background-image: url('../media/items/common.png'); image-rendering: pixelated; background-position: 25% 0; aspect-ratio: 1/1;"></div>
|
||||
</div>
|
||||
<div class = "col ps-3">
|
||||
<div class = "row row-cols-2 align-items-center">
|
||||
|
@ -283,7 +283,7 @@
|
|||
<script type="text/javascript" src="../js/query_2.js"></script>
|
||||
<script type="text/javascript" src="../js/utils.js"></script>
|
||||
<script type="text/javascript" src="../js/build_utils.js"></script>
|
||||
<script type="text/javascript" src="../js/sq2icons.js"></script>
|
||||
<script type="text/javascript" src="../js/icons.js"></script>
|
||||
<script type="text/javascript" src="../js/powders.js"></script>
|
||||
<script type="text/javascript" src="../js/skillpoints.js"></script>
|
||||
<script type="text/javascript" src="../js/damage_calc.js"></script>
|
||||
|
|
|
@ -100,17 +100,24 @@ input.equipment-input {
|
|||
font-weight: bold;
|
||||
background-color: hsl(0, 0%, 21%) !important;
|
||||
border-radius: 0.375rem !important;
|
||||
border-color: rgba(33, 37, 41, 1) !important;
|
||||
min-height: calc(1.2 * var(--scaled-fontsize) + 2px);
|
||||
padding: 0rem 0.5rem;
|
||||
font-size: var(--scaled-fontsize);
|
||||
}
|
||||
|
||||
.equipment-input {
|
||||
--bs-gutter-y: 1rem;
|
||||
--bs-gutter-x: 3rem
|
||||
}
|
||||
|
||||
input.equipment-input:not(.is-invalid) {
|
||||
border-color: rgba(33, 37, 41, 1) !important;
|
||||
}
|
||||
|
||||
.my-container {
|
||||
position: fixed; /* Stay in place */
|
||||
left: var(--sidebar-width);
|
||||
overflow-y: scroll;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.text-right {
|
||||
float: right;
|
||||
}
|
||||
|
@ -311,7 +318,6 @@ input.equipment-input {
|
|||
width: 3.5rem;
|
||||
}
|
||||
|
||||
|
||||
.warning {
|
||||
font-size: .8rem;
|
||||
}
|
||||
|
@ -482,3 +488,16 @@ a:hover {
|
|||
.ferricles{
|
||||
color: #5be553;
|
||||
}
|
||||
|
||||
.item-display-new-toggleable {
|
||||
image-rendering: pixelated;
|
||||
background-size: 1200% 100%;
|
||||
aspect-ratio: 1/1;
|
||||
}
|
||||
.tome-image {
|
||||
background-image: url('../media/items/common.png');
|
||||
image-rendering: pixelated;
|
||||
background-size: 500% 100%;
|
||||
background-position: 100% 0;
|
||||
aspect-ratio: 1/1;
|
||||
}
|
||||
|
|
|
@ -959,7 +959,7 @@
|
|||
</div> -->
|
||||
</div>
|
||||
<script type="text/javascript" src="../js/dev.js"></script>
|
||||
<script type="text/javascript" src="../js/sq2icons.js"></script>
|
||||
<script type="text/javascript" src="../js/icons.js"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
|
|
@ -221,6 +221,6 @@
|
|||
docsFns.append(genDocEntry(entry[0], entry[1], null, entry[2]));
|
||||
}
|
||||
</script>
|
||||
<script type="text/javascript" src="../js/sq2icons.js"></script>
|
||||
<script type="text/javascript" src="../js/icons.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
136
js/atree.js
|
@ -199,7 +199,6 @@ const atree_node = new (class extends ComputeNode {
|
|||
const atree_render = new (class extends ComputeNode {
|
||||
constructor() {
|
||||
super('builder-atree-render');
|
||||
this.fail_cb = true;
|
||||
this.UI_elem = document.getElementById("atree-ui");
|
||||
this.list_elem = document.getElementById("atree-header");
|
||||
}
|
||||
|
@ -310,7 +309,7 @@ function abil_can_activate(atree_node, atree_state, reachable, archetype_count,
|
|||
}
|
||||
let failed_deps = [];
|
||||
for (const dep_id of ability.dependencies) {
|
||||
if (!atree_state.get(dep_id).active) { failed_deps.push(dep_id) }
|
||||
if (!reachable.has(dep_id)) { failed_deps.push(dep_id) }
|
||||
}
|
||||
if (failed_deps.length > 0) {
|
||||
const dep_strings = failed_deps.map(i => '"' + atree_state.get(i).ability.display_name + '"');
|
||||
|
@ -318,7 +317,7 @@ function abil_can_activate(atree_node, atree_state, reachable, archetype_count,
|
|||
}
|
||||
let blocking_ids = [];
|
||||
for (const blocker_id of ability.blockers) {
|
||||
if (atree_state.get(blocker_id).active) { blocking_ids.push(blocker_id); }
|
||||
if (reachable.has(blocker_id)) { blocking_ids.push(blocker_id); }
|
||||
}
|
||||
if (blocking_ids.length > 0) {
|
||||
const blockers_strings = blocking_ids.map(i => '"' + atree_state.get(i).ability.display_name + '"');
|
||||
|
@ -372,11 +371,11 @@ const atree_validate = new (class extends ComputeNode {
|
|||
const abil = node.ability;
|
||||
if (atree_state.get(abil.id).active) {
|
||||
atree_to_add.push([node, 'not reachable', false]);
|
||||
atree_state.get(abil.id).img.src = '../media/atree/' + abil.display.icon + '_selected.png';
|
||||
atree_state.get(abil.id).img.style.backgroundPosition = atlasBGPositionCalc([atreeNodeAtlasPositions[abil.display.icon], 2], atreeNodeAtlasSize);
|
||||
}
|
||||
else {
|
||||
atree_not_present.push(abil.id);
|
||||
atree_state.get(abil.id).img.src = '../media/atree/' + abil.display.icon + '_blocked.png';
|
||||
atree_state.get(abil.id).img.style.backgroundPosition = atlasBGPositionCalc([atreeNodeAtlasPositions[abil.display.icon], 0], atreeNodeAtlasSize);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -425,7 +424,7 @@ const atree_validate = new (class extends ComputeNode {
|
|||
const node = atree_state.get(node_id);
|
||||
const [success, hard_error, reason] = abil_can_activate(node, atree_state, reachable, archetype_count, ap_left);
|
||||
if (success) {
|
||||
node.img.src = '../media/atree/'+node.ability.display.icon+'.png';
|
||||
node.img.style.backgroundPosition = atlasBGPositionCalc([atreeNodeAtlasPositions[node.ability.display.icon], 1], atreeNodeAtlasSize);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -977,7 +976,7 @@ function render_AT(UI_elem, list_elem, tree) {
|
|||
const parent_id = parent_abil.id;
|
||||
|
||||
let connect_elem = document.createElement("div");
|
||||
connect_elem.style = "background-size: cover; width: 200%; height: 200%; position: absolute; top: -50%; left: -50%; image-rendering: pixelated;";
|
||||
connect_elem.style = "width: 112.5%; height: 112.5%; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); image-rendering: pixelated; background-image: url('../media/atree/connectors.png'); background-size: 1700% 500%;"
|
||||
// connect up
|
||||
for (let i = ability.display.row - 1; i > parent_abil.display.row; i--) {
|
||||
const coord = i + "," + ability.display.col;
|
||||
|
@ -1012,17 +1011,9 @@ function render_AT(UI_elem, list_elem, tree) {
|
|||
}
|
||||
|
||||
// create node
|
||||
let node_elem = document.createElement('div');
|
||||
let icon = ability.display.icon;
|
||||
if (icon === undefined) {
|
||||
icon = "node";
|
||||
}
|
||||
let node_img = document.createElement('img');
|
||||
node_img.src = '../media/atree/'+icon+'.png';
|
||||
node_img.style = "width: 200%; height: 200%; position: absolute; top: -50%; left: -50%; image-rendering: pixelated; z-index: 1;";
|
||||
node_elem.appendChild(node_img);
|
||||
|
||||
node_wrap.img = node_img;
|
||||
let node_elem = document.getElementById("atree-row-" + ability.display.row).children[ability.display.col];
|
||||
node_wrap.img = make_elem("div", [], {style: "width: 200%; height: 200%; position: absolute; top: -50%; left: -50%; image-rendering: pixelated; z-index: 1; background-image: url('../media/atree/icons.png'); background-size: 900% 300%;"})
|
||||
node_elem.appendChild(node_wrap.img);
|
||||
|
||||
// create hitbox
|
||||
// this is necessary since images exceed the size of their square, but should only be interactible within that square
|
||||
|
@ -1060,8 +1051,6 @@ function render_AT(UI_elem, list_elem, tree) {
|
|||
delete node_wrap.tooltip_elem;
|
||||
}
|
||||
});
|
||||
|
||||
document.getElementById("atree-row-" + ability.display.row).children[ability.display.col].appendChild(node_elem);
|
||||
};
|
||||
atree_render_connection(atree_connectors_map);
|
||||
|
||||
|
@ -1237,26 +1226,6 @@ function set_connector_type(connector_info) { // left right up down
|
|||
}
|
||||
}
|
||||
|
||||
// draw the connector onto the screen
|
||||
function atree_render_connection(atree_connectors_map) {
|
||||
for (let i of atree_connectors_map.keys()) {
|
||||
let connector_info = atree_connectors_map.get(i);
|
||||
let connector_elem = connector_info.connector;
|
||||
let connector_img = document.createElement('img');
|
||||
set_connector_type(connector_info);
|
||||
connector_img.src = '../media/atree/connect_'+connector_info.type+'.png';
|
||||
connector_img.style = "width: 100%; height: 100%;"
|
||||
connector_elem.replaceChildren(connector_img);
|
||||
connector_info.highlight = [0, 0, 0, 0];
|
||||
let target_elem = document.getElementById("atree-row-" + i.split(",")[0]).children[i.split(",")[1]];
|
||||
if (target_elem.children.length != 0) {
|
||||
// janky special case...
|
||||
connector_elem.style.display = 'none';
|
||||
}
|
||||
target_elem.appendChild(connector_elem);
|
||||
};
|
||||
};
|
||||
|
||||
// toggle the state of a node.
|
||||
function atree_set_state(node_wrapper, new_state) {
|
||||
let icon = node_wrapper.ability.display.icon;
|
||||
|
@ -1265,11 +1234,11 @@ function atree_set_state(node_wrapper, new_state) {
|
|||
}
|
||||
if (new_state) {
|
||||
node_wrapper.active = true;
|
||||
node_wrapper.elem.children[0].src = "../media/atree/" + icon + "_selected.png";
|
||||
node_wrapper.img.style.backgroundPosition = atlasBGPositionCalc([atreeNodeAtlasPositions[icon], 2], atreeNodeAtlasSize);
|
||||
}
|
||||
else {
|
||||
node_wrapper.active = false;
|
||||
node_wrapper.elem.children[0].src = "../media/atree/" + icon + ".png";
|
||||
node_wrapper.img.style.backgroundPosition = atlasBGPositionCalc([atreeNodeAtlasPositions[icon], 1], atreeNodeAtlasSize);
|
||||
}
|
||||
let atree_connectors_map = node_wrapper.all_connectors_ref;
|
||||
for (const parent of node_wrapper.parents) {
|
||||
|
@ -1284,6 +1253,62 @@ function atree_set_state(node_wrapper, new_state) {
|
|||
}
|
||||
};
|
||||
|
||||
// first key is connector type, second key is highlight, then [x, y] pair of 0-index positions in the tile atlas
|
||||
const atreeConnectorAtlasPositions = {
|
||||
"1100": {"0000": [0, 0], "1100": [1, 0]},
|
||||
"1010": {"0000": [2, 0], "1010": [3, 0]},
|
||||
"0110": {"0000": [4, 0], "0110": [5, 0]},
|
||||
"1001": {"0000": [6, 0], "1001": [7, 0]},
|
||||
"0101": {"0000": [8, 0], "0101": [9, 0]},
|
||||
"0011": {"0000": [10, 0], "0011": [11, 0]},
|
||||
"1101": {"0000": [0, 1], "1101": [1, 1], "1100": [2, 1], "1001": [3, 1], "0101": [4, 1]},
|
||||
"0111": {"0000": [5, 1], "0111": [6, 1], "0110": [7, 1], "0101": [8, 1], "0011": [9, 1]},
|
||||
"1110": {"0000": [0, 2], "1110": [1, 2], "1100": [2, 2], "1010": [3, 2], "0110": [4, 2]},
|
||||
"1011": {"0000": [5, 2], "1011": [6, 2], "1010": [7, 2], "1001": [8, 2], "0011": [9, 2]},
|
||||
"1111": {"0000": [0, 3], "1111": [1, 3], "1110": [2, 3], "1101": [3, 3], "1100": [4, 3], "1011": [5, 3], "1010": [6, 3], "1001": [7, 3], "0111": [8, 3], "0110": [9, 3], "0101": [10, 3], "0011": [11, 3]}
|
||||
}
|
||||
const atreeConnectorAtlasSize = [17, 5]
|
||||
// just has the x position, y is based on state
|
||||
const atreeNodeAtlasPositions = {
|
||||
"node_0": 0,
|
||||
"node_1": 1,
|
||||
"node_2": 2,
|
||||
"node_3": 3,
|
||||
"node_archer": 4,
|
||||
"node_warrior": 5,
|
||||
"node_mage": 6,
|
||||
"node_assassin": 7,
|
||||
"node_shaman": 8
|
||||
}
|
||||
const atreeNodeAtlasSize = [9, 3]
|
||||
function atlasBGPositionCalc(pos, atlasSize) {
|
||||
// https://css-tricks.com/focusing-background-image-precise-location-percentages/
|
||||
// p = (c + 0.5/z - 0.5) * z/(z - 1) + 0.5
|
||||
// z = num tiles in direction
|
||||
// c = starting pos of tile in percent of total atlas (equal to index/z)
|
||||
let x = ((pos[0]/atlasSize[0]) + 0.5/atlasSize[0] - 0.5) * atlasSize[0]/(atlasSize[0] - 1) + 0.5
|
||||
let y = ((pos[1]/atlasSize[1]) + 0.5/atlasSize[1] - 0.5) * atlasSize[1]/(atlasSize[1] - 1) + 0.5
|
||||
return (x * 100) + "% " + (y * 100) + "%" // multiply by 100 to convert decimal to percent
|
||||
}
|
||||
|
||||
// draw the connector onto the screen
|
||||
function atree_render_connection(atree_connectors_map) {
|
||||
for (let i of atree_connectors_map.keys()) {
|
||||
let connector_info = atree_connectors_map.get(i);
|
||||
let connector_elem = connector_info.connector;
|
||||
set_connector_type(connector_info);
|
||||
connector_info.highlight = [0, 0, 0, 0];
|
||||
connector_elem.style.backgroundPosition = atlasBGPositionCalc(atreeConnectorAtlasPositions[connector_info.type]["0000"], atreeConnectorAtlasSize);
|
||||
let target_elem = document.getElementById("atree-row-" + i.split(",")[0]).children[i.split(",")[1]];
|
||||
if (target_elem.children.length != 0) {
|
||||
// janky special case...
|
||||
connector_elem.style.display = 'none';
|
||||
}
|
||||
target_elem.appendChild(connector_elem);
|
||||
};
|
||||
};
|
||||
|
||||
// update the connector (after being drawn the first time by atree_render_connection)
|
||||
function atree_set_edge(atree_connectors_map, parent, child, state) {
|
||||
const connectors = child.connectors.get(parent);
|
||||
const parent_row = parent.ability.display.row;
|
||||
|
@ -1298,8 +1323,6 @@ function atree_set_edge(atree_connectors_map, parent, child, state) {
|
|||
let connector_info = atree_connectors_map.get(connector_label);
|
||||
let connector_elem = connector_info.connector;
|
||||
let highlight_state = connector_info.highlight; // left right up down
|
||||
let connector_img_elem = document.createElement("img");
|
||||
connector_img_elem.style = "width: 100%; height: 100%;";
|
||||
const ctype = connector_info.type;
|
||||
let num_1s = 0;
|
||||
for (let i = 0; i < 4; i++) {
|
||||
|
@ -1327,23 +1350,16 @@ function atree_set_edge(atree_connectors_map, parent, child, state) {
|
|||
for (let i = 0; i < 4; i++) {
|
||||
render += highlight_state[i] === 0 ? "0" : "1";
|
||||
}
|
||||
if (render == "0000") {
|
||||
connector_img_elem.src = "../media/atree/connect_" + ctype + ".png";
|
||||
} else {
|
||||
connector_img_elem.src = "../media/atree/connect_" + ctype + "_" + render + ".png";
|
||||
}
|
||||
connector_elem.replaceChildren(connector_img_elem);
|
||||
connector_elem.style.backgroundPosition = atlasBGPositionCalc(atreeConnectorAtlasPositions[ctype][render], atreeConnectorAtlasSize);
|
||||
continue;
|
||||
}
|
||||
// lol bad overloading, [0] is just the whole state
|
||||
highlight_state[0] += state_delta;
|
||||
if (highlight_state[0] > 0) {
|
||||
connector_img_elem.src = '../media/atree/connect_' + ctype + '_1.png';
|
||||
connector_elem.replaceChildren(connector_img_elem);
|
||||
}
|
||||
else {
|
||||
connector_img_elem.src = '../media/atree/connect_'+ctype+'.png';
|
||||
connector_elem.replaceChildren(connector_img_elem);
|
||||
} else {
|
||||
// lol bad overloading, [0] is just the whole state
|
||||
highlight_state[0] += state_delta;
|
||||
if (highlight_state[0] > 0) {
|
||||
connector_elem.style.backgroundPosition = atlasBGPositionCalc(atreeConnectorAtlasPositions[ctype][ctype], atreeConnectorAtlasSize);
|
||||
} else {
|
||||
connector_elem.style.backgroundPosition = atlasBGPositionCalc(atreeConnectorAtlasPositions[ctype]["0000"], atreeConnectorAtlasSize);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7665,21 +7665,14 @@ const atrees = {
|
|||
"type": "replace_spell",
|
||||
"name": "Backstab",
|
||||
"base_spell": 3,
|
||||
"display": "Total Damage",
|
||||
"display": "Backstab Damage",
|
||||
"parts": [
|
||||
{
|
||||
"name": "Per Hit",
|
||||
"name": "Backstab Damage",
|
||||
"type": "damage",
|
||||
"multipliers": [
|
||||
200, 50, 0, 0, 0, 0
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Total Damage",
|
||||
"type": "total",
|
||||
"hits": {
|
||||
"Per Hit": 1
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -9139,8 +9132,23 @@ const atrees = {
|
|||
"bonuses": [
|
||||
{
|
||||
"type": "stat",
|
||||
"name": "dmgMult.Satsujin",
|
||||
"value": 300
|
||||
"name": "damMult.Satsujin:3.Backstab Damage",
|
||||
"value": 200
|
||||
},
|
||||
{
|
||||
"type": "stat",
|
||||
"name": "damMult.Satsujin:3.Per Hit",
|
||||
"value": 200
|
||||
},
|
||||
{
|
||||
"type": "stat",
|
||||
"name": "damMult.Satsujin:3.Fatality",
|
||||
"value": 200
|
||||
},
|
||||
{
|
||||
"type": "stat",
|
||||
"name": "damMult.Satsujin:0.Melee",
|
||||
"value": 200
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
@ -121,7 +121,7 @@ class PowderSpecialDisplayNode extends ComputeNode {
|
|||
/**
|
||||
* Node for getting an item's stats from an item input field.
|
||||
*
|
||||
* Signature: ItemInputNode(powdering: Optional[list[powder]]) => Item | null
|
||||
* Signature: ItemInputNode() => Item | null
|
||||
*/
|
||||
class ItemInputNode extends InputNode {
|
||||
/**
|
||||
|
@ -143,8 +143,6 @@ class ItemInputNode extends InputNode {
|
|||
}
|
||||
|
||||
compute_func(input_map) {
|
||||
const powdering = input_map.get('powdering');
|
||||
|
||||
// built on the assumption of no one will type in CI/CR letter by letter
|
||||
let item_text = this.input_field.value;
|
||||
if (!item_text) {
|
||||
|
@ -158,10 +156,6 @@ class ItemInputNode extends InputNode {
|
|||
else if (tomeMap.has(item_text)) { item = new Item(tomeMap.get(item_text)); }
|
||||
|
||||
if (item) {
|
||||
if (powdering !== undefined) {
|
||||
const max_slots = item.statMap.get('slots');
|
||||
item.statMap.set('powders', powdering.slice(0, max_slots));
|
||||
}
|
||||
let type_match;
|
||||
if (this.category == 'weapon') {
|
||||
type_match = item.statMap.get('category') == 'weapon';
|
||||
|
@ -169,12 +163,6 @@ class ItemInputNode extends InputNode {
|
|||
type_match = item.statMap.get('type') == this.none_item.statMap.get('type');
|
||||
}
|
||||
if (type_match) {
|
||||
if (item.statMap.get('category') == 'armor') {
|
||||
applyArmorPowders(item.statMap);
|
||||
}
|
||||
else if (item.statMap.get('category') == 'weapon') {
|
||||
apply_weapon_powders(item.statMap);
|
||||
}
|
||||
return item;
|
||||
}
|
||||
}
|
||||
|
@ -205,6 +193,31 @@ class ItemInputNode extends InputNode {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Node for updating item input fields from parsed items.
|
||||
*
|
||||
* Signature: ItemInputDisplayNode(item: Item, powdering: List[powder]) => Item
|
||||
*/
|
||||
class ItemPowderingNode extends ComputeNode {
|
||||
constructor(name) { super(name); }
|
||||
|
||||
compute_func(input_map) {
|
||||
const powdering = input_map.get('powdering');
|
||||
const item = {};
|
||||
item.statMap = new Map(input_map.get('item').statMap); // TODO: performance
|
||||
|
||||
const max_slots = item.statMap.get('slots');
|
||||
item.statMap.set('powders', powdering.slice(0, max_slots));
|
||||
if (item.statMap.get('category') == 'armor') {
|
||||
applyArmorPowders(item.statMap);
|
||||
}
|
||||
else if (item.statMap.get('category') == 'weapon') {
|
||||
apply_weapon_powders(item.statMap);
|
||||
}
|
||||
return item;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Node for updating item input fields from parsed items.
|
||||
*
|
||||
|
@ -217,7 +230,6 @@ class ItemInputDisplayNode extends ComputeNode {
|
|||
this.input_field = document.getElementById(eq+"-choice");
|
||||
this.health_field = document.getElementById(eq+"-health");
|
||||
this.level_field = document.getElementById(eq+"-lv");
|
||||
this.powder_field = document.getElementById(eq+"-powder"); // possibly None
|
||||
this.image = item_image;
|
||||
this.fail_cb = true;
|
||||
}
|
||||
|
@ -242,18 +254,11 @@ class ItemInputDisplayNode extends ComputeNode {
|
|||
this.input_field.classList.add("is-invalid");
|
||||
return null;
|
||||
}
|
||||
if (this.powder_field && item.statMap.has('powders')) {
|
||||
this.powder_field.placeholder = "powders";
|
||||
}
|
||||
|
||||
if (item.statMap.has('NONE')) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (this.powder_field && item.statMap.has('powders')) {
|
||||
this.powder_field.placeholder = item.statMap.get('slots') + ' slots';
|
||||
}
|
||||
|
||||
const tier = item.statMap.get('tier');
|
||||
this.input_field.classList.add(tier);
|
||||
if (this.health_field) {
|
||||
|
@ -307,7 +312,8 @@ class WeaponInputDisplayNode extends ComputeNode {
|
|||
const [item] = input_map.values(); // Extract values, pattern match it into size one list and bind to first element
|
||||
|
||||
const type = item.statMap.get('type');
|
||||
this.image.setAttribute('src', '../media/items/new/generic-'+type+'.png');
|
||||
this.image.style.backgroundPosition = itemBGPositions[type];
|
||||
|
||||
let dps = get_base_dps(item.statMap);
|
||||
if (isNaN(dps)) {
|
||||
dps = dps[1];
|
||||
|
@ -374,39 +380,39 @@ 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.
|
||||
*
|
||||
* Signature: BuildAssembleNode(helmet-input: Item,
|
||||
* chestplate-input: Item,
|
||||
* leggings-input: Item,
|
||||
* boots-input: Item,
|
||||
* ring1-input: Item,
|
||||
* ring2-input: Item,
|
||||
* bracelet-input: Item,
|
||||
* necklace-input: Item,
|
||||
* weapon-input: Item,
|
||||
* level-input: int) => Build | null
|
||||
* Signature: BuildAssembleNode(helmet: Item,
|
||||
* chestplate: Item,
|
||||
* leggings: Item,
|
||||
* boots: Item,
|
||||
* ring1: Item,
|
||||
* ring2: Item,
|
||||
* bracelet: Item,
|
||||
* necklace: Item,
|
||||
* weapon: Item,
|
||||
* level: int) => Build | null
|
||||
*/
|
||||
class BuildAssembleNode extends ComputeNode {
|
||||
constructor() { super("builder-make-build"); }
|
||||
|
||||
compute_func(input_map) {
|
||||
let equipments = [
|
||||
input_map.get('helmet-input'),
|
||||
input_map.get('chestplate-input'),
|
||||
input_map.get('leggings-input'),
|
||||
input_map.get('boots-input'),
|
||||
input_map.get('ring1-input'),
|
||||
input_map.get('ring2-input'),
|
||||
input_map.get('bracelet-input'),
|
||||
input_map.get('necklace-input'),
|
||||
input_map.get('weaponTome1-input'),
|
||||
input_map.get('weaponTome2-input'),
|
||||
input_map.get('armorTome1-input'),
|
||||
input_map.get('armorTome2-input'),
|
||||
input_map.get('armorTome3-input'),
|
||||
input_map.get('armorTome4-input'),
|
||||
input_map.get('guildTome1-input')
|
||||
input_map.get('helmet'),
|
||||
input_map.get('chestplate'),
|
||||
input_map.get('leggings'),
|
||||
input_map.get('boots'),
|
||||
input_map.get('ring1'),
|
||||
input_map.get('ring2'),
|
||||
input_map.get('bracelet'),
|
||||
input_map.get('necklace'),
|
||||
input_map.get('weaponTome1'),
|
||||
input_map.get('weaponTome2'),
|
||||
input_map.get('armorTome1'),
|
||||
input_map.get('armorTome2'),
|
||||
input_map.get('armorTome3'),
|
||||
input_map.get('armorTome4'),
|
||||
input_map.get('guildTome1')
|
||||
];
|
||||
let weapon = input_map.get('weapon-input');
|
||||
let weapon = input_map.get('weapon');
|
||||
let level = parseInt(input_map.get('level-input'));
|
||||
if (isNaN(level)) {
|
||||
level = 106;
|
||||
|
@ -429,6 +435,7 @@ class PlayerClassNode extends ValueCheckComputeNode {
|
|||
compute_func(input_map) {
|
||||
if (input_map.size !== 1) { throw "PlayerClassNode accepts exactly one input (build)"; }
|
||||
const [build] = input_map.values(); // Extract values, pattern match it into size one list and bind to first element
|
||||
if (build.weapon.statMap.has('NONE')) { return null; }
|
||||
return wep_to_class.get(build.weapon.statMap.get('type'));
|
||||
}
|
||||
}
|
||||
|
@ -437,15 +444,25 @@ class PlayerClassNode extends ValueCheckComputeNode {
|
|||
* Read an input field and parse into a list of powderings.
|
||||
* Every two characters makes one powder. If parsing fails, NULL is returned.
|
||||
*
|
||||
* Signature: PowderInputNode() => List[powder] | null
|
||||
* Signature: PowderInputNode(item: Item) => List[powder] | null
|
||||
*/
|
||||
class PowderInputNode extends InputNode {
|
||||
|
||||
constructor(name, input_field) { super(name, input_field); }
|
||||
constructor(name, input_field) { super(name, input_field); this.fail_cb = true; }
|
||||
|
||||
compute_func(input_map) {
|
||||
if (input_map.size !== 1) { throw "PowderInputNode accepts exactly one input (item)"; }
|
||||
const [item] = input_map.values(); // Extract values, pattern match it into size one list and bind to first element
|
||||
if (item === null) {
|
||||
this.input_field.placeholder = 'powders';
|
||||
return [];
|
||||
}
|
||||
|
||||
if (item.statMap.has('slots')) {
|
||||
this.input_field.placeholder = item.statMap.get('slots') + ' slots';
|
||||
}
|
||||
|
||||
// TODO: haha improve efficiency to O(n) dumb
|
||||
// also, error handling is missing
|
||||
let input = this.input_field.value.trim();
|
||||
let powdering = [];
|
||||
let errorederrors = [];
|
||||
|
@ -453,12 +470,29 @@ class PowderInputNode extends InputNode {
|
|||
let first = input.slice(0, 2);
|
||||
let powder = powderIDs.get(first);
|
||||
if (powder === undefined) {
|
||||
return null;
|
||||
if (first.length > 0) {
|
||||
errorederrors.push(first);
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
powdering.push(powder);
|
||||
}
|
||||
input = input.slice(2);
|
||||
}
|
||||
|
||||
if (this.input_field.getAttribute("placeholder") != null) {
|
||||
if (item.statMap.get('slots') < powdering.length) {
|
||||
errorederrors.push("Too many powders: " + powdering.length);
|
||||
}
|
||||
}
|
||||
|
||||
if (errorederrors.length) {
|
||||
this.input_field.classList.add("is-invalid");
|
||||
} else {
|
||||
this.input_field.classList.remove("is-invalid");
|
||||
}
|
||||
|
||||
return powdering;
|
||||
}
|
||||
}
|
||||
|
@ -921,9 +955,11 @@ class SumNumberInputNode extends InputNode {
|
|||
}
|
||||
|
||||
let item_nodes = [];
|
||||
let item_nodes_map = new Map();
|
||||
let powder_nodes = [];
|
||||
let edit_input_nodes = [];
|
||||
let skp_inputs = [];
|
||||
let equip_inputs = [];
|
||||
let build_node;
|
||||
let stat_agg_node;
|
||||
let edit_agg_node;
|
||||
|
@ -932,25 +968,53 @@ let atree_graph_creator;
|
|||
function builder_graph_init() {
|
||||
// Phase 1/3: Set up item input, propagate updates, etc.
|
||||
|
||||
// Level input node.
|
||||
let level_input = new InputNode('level-input', document.getElementById('level-choice'));
|
||||
|
||||
// "Build" now only refers to equipment and level (no powders). Powders are injected before damage calculation / stat display.
|
||||
build_node = new BuildAssembleNode();
|
||||
for (const input of item_nodes) {
|
||||
}
|
||||
build_node.link_to(level_input);
|
||||
|
||||
let build_encode_node = new BuildEncodeNode();
|
||||
build_encode_node.link_to(build_node, 'build');
|
||||
|
||||
// Bind item input fields to input nodes, and some display stuff (for auto colorizing stuff).
|
||||
for (const [eq, display_elem, none_item] of zip3(equipment_fields, build_fields, none_items)) {
|
||||
let input_field = document.getElementById(eq+"-choice");
|
||||
let item_image = document.getElementById(eq+"-img");
|
||||
|
||||
let item_input = new ItemInputNode(eq+'-input', input_field, none_item);
|
||||
equip_inputs.push(item_input);
|
||||
if (powder_inputs.includes(eq+'-powder')) { // TODO: fragile
|
||||
const powder_name = eq+'-powder';
|
||||
let powder_node = new PowderInputNode(powder_name, document.getElementById(powder_name))
|
||||
.link_to(item_input, 'item');
|
||||
powder_nodes.push(powder_node);
|
||||
build_encode_node.link_to(powder_node, powder_name);
|
||||
let item_powdering = new ItemPowderingNode(eq+'-powder-apply')
|
||||
.link_to(powder_node, 'powdering').link_to(item_input, 'item');
|
||||
item_input = item_powdering;
|
||||
}
|
||||
item_nodes.push(item_input);
|
||||
item_nodes_map.set(eq, item_input);
|
||||
new ItemInputDisplayNode(eq+'-input-display', eq, item_image).link_to(item_input);
|
||||
new ItemDisplayNode(eq+'-item-display', display_elem).link_to(item_input);
|
||||
//new PrintNode(eq+'-debug').link_to(item_input);
|
||||
//document.querySelector("#"+eq+"-tooltip").setAttribute("onclick", "collapse_element('#"+ eq +"-tooltip');"); //toggle_plus_minus('" + eq + "-pm');
|
||||
build_node.link_to(item_input, eq);
|
||||
}
|
||||
|
||||
for (const [eq, none_item] of zip2(tome_fields, [none_tomes[0], none_tomes[0], none_tomes[1], none_tomes[1], none_tomes[1], none_tomes[1], none_tomes[2]])) {
|
||||
let input_field = document.getElementById(eq+"-choice");
|
||||
let item_image = document.getElementById(eq+"-img");
|
||||
|
||||
let item_input = new ItemInputNode(eq+'-input', input_field, none_item);
|
||||
equip_inputs.push(item_input);
|
||||
item_nodes.push(item_input);
|
||||
new ItemInputDisplayNode(eq+'-input-display', eq, item_image).link_to(item_input);
|
||||
build_node.link_to(item_input, eq);
|
||||
}
|
||||
|
||||
// weapon image changer node.
|
||||
|
@ -958,38 +1022,12 @@ function builder_graph_init() {
|
|||
let weapon_dps = document.getElementById("weapon-dps");
|
||||
new WeaponInputDisplayNode('weapon-type', weapon_image, weapon_dps).link_to(item_nodes[8]);
|
||||
|
||||
// Level input node.
|
||||
let level_input = new InputNode('level-input', document.getElementById('level-choice'));
|
||||
|
||||
// linking to atree verification
|
||||
atree_validate.link_to(level_input, 'level');
|
||||
|
||||
// "Build" now only refers to equipment and level (no powders). Powders are injected before damage calculation / stat display.
|
||||
build_node = new BuildAssembleNode();
|
||||
for (const input of item_nodes) {
|
||||
build_node.link_to(input);
|
||||
}
|
||||
build_node.link_to(level_input);
|
||||
|
||||
let build_encode_node = new BuildEncodeNode();
|
||||
build_encode_node.link_to(build_node, 'build');
|
||||
|
||||
let url_update_node = new URLUpdateNode();
|
||||
url_update_node.link_to(build_encode_node, 'build-str');
|
||||
|
||||
|
||||
for (const input of powder_inputs) {
|
||||
let powder_node = new PowderInputNode(input, document.getElementById(input));
|
||||
powder_nodes.push(powder_node);
|
||||
build_encode_node.link_to(powder_node, input);
|
||||
}
|
||||
|
||||
item_nodes[0].link_to(powder_nodes[0], 'powdering');
|
||||
item_nodes[1].link_to(powder_nodes[1], 'powdering');
|
||||
item_nodes[2].link_to(powder_nodes[2], 'powdering');
|
||||
item_nodes[3].link_to(powder_nodes[3], 'powdering');
|
||||
item_nodes[8].link_to(powder_nodes[4], 'powdering');
|
||||
|
||||
// Phase 2/3: Set up editable IDs, skill points; use decodeBuild() skill points, calculate damage
|
||||
|
||||
// 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)
|
||||
|
@ -1036,7 +1074,7 @@ function builder_graph_init() {
|
|||
// ---------------------------------------------------------------
|
||||
// Trigger the update cascade for build!
|
||||
// ---------------------------------------------------------------
|
||||
for (const input_node of item_nodes.concat(powder_nodes)) {
|
||||
for (const input_node of equip_inputs) {
|
||||
input_node.update();
|
||||
}
|
||||
armor_powder_node.update();
|
||||
|
|
|
@ -135,7 +135,7 @@ class ComputeNode {
|
|||
}
|
||||
|
||||
class ValueCheckComputeNode extends ComputeNode {
|
||||
constructor(name) { super(name); }
|
||||
constructor(name) { super(name); this.valid_val = null; }
|
||||
|
||||
/**
|
||||
* Request update of this compute node. Pushes updates to children,
|
||||
|
@ -154,14 +154,11 @@ class ValueCheckComputeNode extends ComputeNode {
|
|||
calc_inputs.set(this.input_translation.get(input.name), input.value);
|
||||
}
|
||||
let val = this.compute_func(calc_inputs);
|
||||
if (val !== this.value) {
|
||||
super.mark_dirty(2);
|
||||
}
|
||||
else {
|
||||
console.log("soft update");
|
||||
if (val !== null) {
|
||||
if (val !== this.valid_val) { super.mark_dirty(2); } // don't mark dirty if NULL (no update)
|
||||
this.valid_val = val;
|
||||
}
|
||||
this.value = val;
|
||||
|
||||
this.dirty = 0;
|
||||
for (const child of this.children) {
|
||||
child.mark_input_clean(this.name, this.value);
|
||||
|
|
|
@ -345,9 +345,16 @@ function toggleMaterial(buttonId) {
|
|||
function updateCraftedImage() {
|
||||
let input = document.getElementById("recipe-choice");
|
||||
if (all_types.includes(input.value)) {
|
||||
document.getElementById("recipe-img").src = "../media/items/" + (newIcons ? "new/":"old/") + "generic-" + input.value.toLowerCase() + ".png";
|
||||
let img = document.getElementById("recipe-img");
|
||||
if (["potion", "scroll", "food"].includes(input.value.toLowerCase())) {
|
||||
img.style.backgroundImage = "url('../media/items/common.png')";
|
||||
img.style.backgroundSize = "500% 100%";
|
||||
} else {
|
||||
img.style.backgroundImage = "url('../media/items/" + (newIcons ? "new.png')" : "old.png')");
|
||||
img.style.backgroundSize = "1200% 100%";
|
||||
}
|
||||
img.style.backgroundPosition = itemBGPositions[input.value.toLowerCase()]
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* Reset all fields
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
const itemBGPositions = {"bow": "0 0", "spear": "9.090909090909088% 0", "wand": "18.181818181818183% 0", "dagger": "27.27272727272727% 0", "relik": "36.36363636363637% 0",
|
||||
"helmet": "45.45454545454546% 0", "chestplate": "54.54545454545454% 0", "leggings": "63.63636363636363% 0", "boots": "72.72727272727272% 0",
|
||||
"ring": "81.81818181818181% 0", "bracelet": "90.90909090909092% 0", "necklace": "100% 0",
|
||||
"potion": "25% 0", "scroll": "50% 0", "food": "75% 0"};
|
||||
|
||||
function apply_elemental_format(p_elem, id, suffix) {
|
||||
suffix = (typeof suffix !== 'undefined') ? suffix : "";
|
||||
|
@ -286,11 +290,18 @@ function displayExpandedItem(item, parent_id){
|
|||
parent_div.appendChild(nolink_row);
|
||||
|
||||
if (item.has("type")) {
|
||||
let img = make_elem("img", [], {
|
||||
src: "../media/items/" + (newIcons ? "new/":"old/") + "generic-" + item.get("type") + ".png",
|
||||
let img = make_elem("div", [], {
|
||||
alt: item.get("type"),
|
||||
style: " z=index: 1; position: relative;"
|
||||
style: "z-index: 1; position: relative; image-rendering: pixelated; width: 50%; height: 50%; background-position: " + itemBGPositions[item.get("type")] + ";"
|
||||
});
|
||||
if (["potion", "scroll", "food"].includes(item.get("type"))) {
|
||||
img.style.backgroundImage = "url('../media/items/common.png')";
|
||||
img.style.backgroundSize = "500% 100%";
|
||||
} else {
|
||||
img.style.backgroundImage = "url('../media/items/" + (newIcons ? "new.png')" : "old.png')");
|
||||
img.style.backgroundSize = "1200% 100%";
|
||||
}
|
||||
|
||||
let container = make_elem("div");
|
||||
|
||||
let bckgrd = make_elem("div", ["col", "px-0", "d-flex", "align-items-center", "justify-content-center", 'scaled-bckgrd'], { // , "no-collapse"
|
||||
|
|
39
js/icons.js
|
@ -1,33 +1,26 @@
|
|||
//which icons to use
|
||||
let window_storage = window.localStorage;
|
||||
icon_state_stored = window_storage.getItem("newicons");
|
||||
newIcons = true;
|
||||
if (icon_state_stored === "false") {toggleIcons()}
|
||||
if (window_storage.getItem("newicons") === "false") {
|
||||
toggleIcons();
|
||||
}
|
||||
|
||||
/** Toggle icons on the ENTIRE page.
|
||||
*
|
||||
*/
|
||||
function toggleIcons() {
|
||||
newIcons = !newIcons;
|
||||
let imgs = document.getElementsByTagName("IMG");
|
||||
let favicon = document.querySelector("link[rel~='icon']");
|
||||
let toggleiconbutton = document.getElementById("toggle-icon-button");
|
||||
window_storage.setItem("newicons", newIcons.toString());
|
||||
let newOrOld = (newIcons ? "new" : "old");
|
||||
|
||||
if (newIcons) { //switch to new
|
||||
favicon.href = favicon.href.replace("media/icons/old","media/icons/new");
|
||||
for (const img of imgs) {
|
||||
if (img.src.includes("media/icons/old")) {img.src = img.src.replace("media/icons/old","media/icons/new");}
|
||||
if (img.src.includes("media/items/old")) {img.src = img.src.replace("media/items/old","media/items/new");}
|
||||
}
|
||||
toggleiconbutton.textContent = "Use Old Icons";
|
||||
window_storage.setItem("newicons","true");
|
||||
} else { //switch to old
|
||||
favicon.href = favicon.href.replace("media/icons/new","media/icons/old");
|
||||
for (const img of imgs) {
|
||||
if (img.src.includes("media/icons/new")) {img.src = img.src.replace("media/icons/new","media/icons/old");}
|
||||
if (img.src.includes("media/items/new")) {img.src = img.src.replace("media/items/new","media/items/old");}
|
||||
}
|
||||
toggleiconbutton.textContent = "Use New Icons";
|
||||
window_storage.setItem("newicons","false");
|
||||
}
|
||||
let imgs = document.getElementsByTagName("img");
|
||||
let divs = document.getElementsByClassName("item-display-new-toggleable");
|
||||
let favicon = document.querySelector("link[rel~='icon']");
|
||||
favicon.href = favicon.href.replace("media/icons/" + (newIcons ? "old" : "new"), "media/icons/" + newOrOld);
|
||||
for (const img of imgs) {
|
||||
// if doesn't contain, replace() does nothing
|
||||
img.src = img.src.replace("media/icons/" + (newIcons ? "old" : "new"), "media/icons/" + newOrOld);
|
||||
}
|
||||
for (let i = 0; i < divs.length; i++) {
|
||||
divs.item(i).style.backgroundImage = "url('../media/items/" + (newIcons ? "new" : "old") + ".png')";
|
||||
}
|
||||
}
|
|
@ -1,34 +0,0 @@
|
|||
//which icons to use
|
||||
let window_storage = window.localStorage;
|
||||
console.log(window_storage);
|
||||
icon_state_stored = window_storage.getItem("newicons");
|
||||
newIcons = true;
|
||||
if (icon_state_stored === "false") {toggleIcons()}
|
||||
|
||||
|
||||
/** Toggle icons on the ENTIRE page.
|
||||
*
|
||||
*/
|
||||
function toggleIcons() {
|
||||
newIcons = !newIcons;
|
||||
let imgs = document.getElementsByTagName("IMG");
|
||||
let favicon = document.querySelector("link[rel~='icon']");
|
||||
|
||||
if (newIcons) { //switch to new
|
||||
favicon.href = favicon.href.replace("media/icons/old","media/icons/new");
|
||||
for (const img of imgs) {
|
||||
if (img.src.includes("media/icons/old")) {img.src = img.src.replace("media/icons/old","media/icons/new");}
|
||||
if (img.src.includes("media/items/old")) {img.src = img.src.replace("media/items/old","media/items/new");}
|
||||
}
|
||||
//toggleiconbutton.textContent = "Use Old Icons";
|
||||
window_storage.setItem("newicons","true");
|
||||
} else { //switch to old
|
||||
favicon.href = favicon.href.replace("media/icons/new","media/icons/old");
|
||||
for (const img of imgs) {
|
||||
if (img.src.includes("media/icons/new")) {img.src = img.src.replace("media/icons/new","media/icons/old");}
|
||||
if (img.src.includes("media/items/new")) {img.src = img.src.replace("media/items/new","media/items/old");}
|
||||
}
|
||||
//toggleiconbutton.textContent = "Use New Icons";
|
||||
window_storage.setItem("newicons","false");
|
||||
}
|
||||
}
|
Before Width: | Height: | Size: 182 B |
Before Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 183 B |
Before Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 178 B |
Before Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 202 B |
Before Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 184 B |
Before Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 177 B |
Before Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 202 B |
Before Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 184 B |
Before Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 205 B |
Before Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 203 B |
Before Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 221 B |
Before Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 1.6 KiB |
BIN
media/atree/connectors.png
Normal file
After Width: | Height: | Size: 1.9 KiB |
BIN
media/atree/icons.png
Normal file
After Width: | Height: | Size: 2.8 KiB |
Before Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 231 B |
Before Width: | Height: | Size: 266 B |
Before Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 254 B |
Before Width: | Height: | Size: 313 B |
Before Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 276 B |
Before Width: | Height: | Size: 328 B |
Before Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 309 B |
Before Width: | Height: | Size: 385 B |
Before Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 267 B |
Before Width: | Height: | Size: 297 B |
Before Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 260 B |
Before Width: | Height: | Size: 291 B |
Before Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 263 B |
Before Width: | Height: | Size: 295 B |
Before Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 264 B |
Before Width: | Height: | Size: 297 B |
Before Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 261 B |
Before Width: | Height: | Size: 294 B |
BIN
media/items/common.png
Normal file
After Width: | Height: | Size: 988 B |
BIN
media/items/new.png
Normal file
After Width: | Height: | Size: 27 KiB |
Before Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 3.5 KiB |
Before Width: | Height: | Size: 3 KiB |
Before Width: | Height: | Size: 3.2 KiB |
Before Width: | Height: | Size: 3.3 KiB |
Before Width: | Height: | Size: 2.8 KiB |
Before Width: | Height: | Size: 521 B |