barebones tome functionality [tome load, tome inputs, tome expandedItem display]

This commit is contained in:
ferricles 2022-05-20 02:03:46 -07:00
parent 9cb8bc8601
commit 58e75eb0a2
17 changed files with 1437 additions and 820 deletions

View file

@ -324,42 +324,6 @@
</div> </div>
</div> </div>
</div> </div>
<div class = "col py-3">
<div class="row row-cols-1 gy-2 rounded dark-shadow justify-content-center">
<div class="row h-100 my-2 dark-shadow dark-6 rounded" id="tomes-button">
<button class = "col-auto button rounded scaled-font fw-bold text-light dark-5" id = "toggle-tomes" onclick = "toggle_tab('tomes-dropdown'); toggleButton('toggle-tomes')">Show Tomes</button>
</div>
<div class="row h-100 row-cols-1 row-cols-xl-2 dark-shadow rounded" id="tomes-dropdown" style = "display:none">
<div class="col-auto rounded order-xl-0 order-1">
<div class="row h-100 dark-shadow rounded" id='weapon-dropdown'>
<div class="col-auto g-0 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-wand.png">
</div>
<div class="col-3">
<div class="row row-cols-1 h-100 align-items-center">
<div class="col scaled-font fw-bold gx-3" id="weapon-dps">
base dps: 0
</div>
<div class="col text-nowrap scaled-font lvl fw-bold gx-3" id="weapon-lv">
0
</div>
</div>
</div>
<div class="col g-0 rounded">
<div class="row row-cols-1 h-100 align-items-center">
<div class="col d-flex justify-content-end">
<input class="equipment-input border-dark text-light dark-5 rounded scaled-font form-control form-control-sm" id="weapon-choice" name="weapon-choice" placeholder="No Weapon" value="" tabindex="2"/>
</div>
<div class="col d-flex justify-content-end">
<input class="equipment-input border-dark text-light dark-5 rounded scaled-font form-control form-control-sm" type="text" id="weapon-powder" name="weapon-powder" placeholder="powders" tabindex="2"/>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="col py-3"> <div class="col py-3">
<div class="row row-cols-1 gy-2 rounded dark-5 dark-shadow"> <div class="row row-cols-1 gy-2 rounded dark-5 dark-shadow">
<div class="col"> <div class="col">
@ -458,8 +422,8 @@
</button> </button>
</div> </div>
<div class = "col-4 py-2"> <div class = "col-4 py-2">
<button class = "button rounded scaled-font fw-bold text-light dark-5" id = "edit-ID-button" onclick = "updateStats();"> <button class = "col-auto button rounded scaled-font fw-bold text-light dark-5" id = "toggle-tomes" onclick = "toggle_tab('tomes-dropdown'); toggleButton('toggle-tomes')">
Update Stats Show Tomes
</button> </button>
</div> </div>
<div class = "col-4 py-2"> <div class = "col-4 py-2">
@ -469,6 +433,178 @@
</div> </div>
</div> </div>
</div> </div>
<div class = "col dark-6 rounded-bottom my-3 my-xl-1" id = "tomes-dropdown" style = "display: none;">
<div class="row h-100 row-cols-1 row-cols-xl-2 rounded">
<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>
<div class="col-3">
<div class="row row-cols-1 h-100 align-items-center">
<div class="col scaled-font fw-bold gx-3">
Weapon
</div>
<div class="col scaled-font fw-bold gx-3">
Tome
</div>
</div>
</div>
<div class="col g-0 rounded">
<div class="row row-cols-1 h-100 align-items-center">
<div class="col d-flex justify-content-end">
<input class="equipment-input border-dark text-light dark-5 rounded scaled-font form-control form-control-sm" id="weaponTome1-choice" name="weaponTome1-choice" placeholder="No Tome" value=""/>
</div>
</div>
</div>
</div>
</div>
<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>
<div class="col-3">
<div class="row row-cols-1 h-100 align-items-center">
<div class="col scaled-font fw-bold gx-3">
Weapon
</div>
<div class="col scaled-font fw-bold gx-3">
Tome
</div>
</div>
</div>
<div class="col g-0 rounded">
<div class="row row-cols-1 h-100 align-items-center">
<div class="col d-flex justify-content-end">
<input class="equipment-input border-dark text-light dark-5 rounded scaled-font form-control form-control-sm" id="weaponTome2-choice" name="weaponTome2-choice" placeholder="No Tome" value=""/>
</div>
</div>
</div>
</div>
</div>
<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>
<div class="col-3">
<div class="row row-cols-1 h-100 align-items-center">
<div class="col scaled-font fw-bold gx-3">
Armor
</div>
<div class="col scaled-font fw-bold gx-3">
Tome
</div>
</div>
</div>
<div class="col g-0 rounded">
<div class="row row-cols-1 h-100 align-items-center">
<div class="col d-flex justify-content-end">
<input class="equipment-input border-dark text-light dark-5 rounded scaled-font form-control form-control-sm" id="armorTome1-choice" name="armorTome1-choice" placeholder="No Tome" value=""/>
</div>
</div>
</div>
</div>
</div>
<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>
<div class="col-3">
<div class="row row-cols-1 h-100 align-items-center">
<div class="col scaled-font fw-bold gx-3">
Armor
</div>
<div class="col scaled-font fw-bold gx-3">
Tome
</div>
</div>
</div>
<div class="col g-0 rounded">
<div class="row row-cols-1 h-100 align-items-center">
<div class="col d-flex justify-content-end">
<input class="equipment-input border-dark text-light dark-5 rounded scaled-font form-control form-control-sm" id="armorTome2-choice" name="armorTome2-choice" placeholder="No Tome" value=""/>
</div>
</div>
</div>
</div>
</div>
<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>
<div class="col-3">
<div class="row row-cols-1 h-100 align-items-center">
<div class="col scaled-font fw-bold gx-3">
Armor
</div>
<div class="col scaled-font fw-bold gx-3">
Tome
</div>
</div>
</div>
<div class="col g-0 rounded">
<div class="row row-cols-1 h-100 align-items-center">
<div class="col d-flex justify-content-end">
<input class="equipment-input border-dark text-light dark-5 rounded scaled-font form-control form-control-sm" id="armorTome3-choice" name="armorTome3-choice" placeholder="No Tome" value=""/>
</div>
</div>
</div>
</div>
</div>
<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>
<div class="col-3">
<div class="row row-cols-1 h-100 align-items-center">
<div class="col scaled-font fw-bold gx-3">
Armor
</div>
<div class="col scaled-font fw-bold gx-3">
Tome
</div>
</div>
</div>
<div class="col g-0 rounded">
<div class="row row-cols-1 h-100 align-items-center">
<div class="col d-flex justify-content-end">
<input class="equipment-input border-dark text-light dark-5 rounded scaled-font form-control form-control-sm" id="armorTome4-choice" name="armorTome4-choice" placeholder="No Tome" value=""/>
</div>
</div>
</div>
</div>
</div>
<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>
<div class="col-3">
<div class="row row-cols-1 h-100 align-items-center">
<div class="col scaled-font fw-bold gx-3">
Guild
</div>
<div class="col scaled-font fw-bold gx-3">
Tome
</div>
</div>
</div>
<div class="col g-0 rounded">
<div class="row row-cols-1 h-100 align-items-center">
<div class="col d-flex justify-content-end">
<input class="equipment-input border-dark text-light dark-5 rounded scaled-font form-control form-control-sm" id="guildTome1-choice" name="guildTome1-choice" placeholder="No Tome" value=""/>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="col dark-6 rounded-bottom my-3 my-xl-1" id = "edit_id_tab" style = "display:none;"> <div class="col dark-6 rounded-bottom my-3 my-xl-1" id = "edit_id_tab" style = "display:none;">
<div class = "row big-title justify-content-center"> <div class = "row big-title justify-content-center">
Damage Stats Damage Stats
@ -479,7 +615,7 @@
Spell Damage %: Spell Damage %:
</div> </div>
<div class = "row"> <div class = "row">
<input type = "number" placeholder = "0" id="sdPct" name="sdPct" value="0" class="border-semi-dark border-2 text-light dark-5 rounded scaled-font form-control form-control-sm"/> <input type = "number" placeholder = "0" id="sdPct" name="sdPct" value="0" class="border-semi-dark border-2 text-light dark-5 rounded scaled-font form-control form-control-sm" oninput = "updateStats()"/>
</div> </div>
<div class = "row" id = "sdPct-base"> <div class = "row" id = "sdPct-base">
Original Value: 0 Original Value: 0
@ -490,7 +626,7 @@
Spell Damage Raw: Spell Damage Raw:
</div> </div>
<div class = "row"> <div class = "row">
<input type = "number" placeholder = "0" id="sdRaw" name="sdRaw" value="0" class="border-semi-dark border-2 text-light dark-5 rounded scaled-font form-control form-control-sm"/> <input type = "number" placeholder = "0" id="sdRaw" name="sdRaw" value="0" class="border-semi-dark border-2 text-light dark-5 rounded scaled-font form-control form-control-sm" oninput = "updateStats()"/>
</div> </div>
<div class = "row" id = "sdRaw-base"> <div class = "row" id = "sdRaw-base">
Original Value: 0 Original Value: 0
@ -501,7 +637,7 @@
Melee Damage %: Melee Damage %:
</div> </div>
<div class = "row"> <div class = "row">
<input type = "number" placeholder = "0" id="mdPct" name="mdPct" value="0" class="border-semi-dark border-2 text-light dark-5 rounded scaled-font form-control form-control-sm"/> <input type = "number" placeholder = "0" id="mdPct" name="mdPct" value="0" class="border-semi-dark border-2 text-light dark-5 rounded scaled-font form-control form-control-sm" oninput = "updateStats()"/>
</div> </div>
<div class = "row" id = "mdPct-base"> <div class = "row" id = "mdPct-base">
Original Value: 0 Original Value: 0
@ -512,7 +648,7 @@
Melee Damage Raw: Melee Damage Raw:
</div> </div>
<div class = "row"> <div class = "row">
<input type = "number" placeholder = "0" id="mdRaw" name="mdRaw" value="0" class="border-semi-dark border-2 text-light dark-5 rounded scaled-font form-control form-control-sm"/> <input type = "number" placeholder = "0" id="mdRaw" name="mdRaw" value="0" class="border-semi-dark border-2 text-light dark-5 rounded scaled-font form-control form-control-sm" oninput = "updateStats()"/>
</div> </div>
<div class = "row" id = "mdRaw-base"> <div class = "row" id = "mdRaw-base">
Original Value: 0 Original Value: 0
@ -525,7 +661,7 @@
Poison: Poison:
</div> </div>
<div class = "row"> <div class = "row">
<input type = "number" placeholder = "0" id="poison" name="poison" value="0" class="border-semi-dark border-2 text-light dark-5 rounded scaled-font form-control form-control-sm"/> <input type = "number" placeholder = "0" id="poison" name="poison" value="0" class="border-semi-dark border-2 text-light dark-5 rounded scaled-font form-control form-control-sm" oninput = "updateStats()"/>
</div> </div>
<div class = "row" id = "poison-base"> <div class = "row" id = "poison-base">
Original Value: 0 Original Value: 0
@ -536,7 +672,7 @@
Damage %: Damage %:
</div> </div>
<div class = "row"> <div class = "row">
<input type = "number" placeholder = "0" id="eDamPct" name="eDamPct" value="0" class="border-semi-dark border-2 text-light dark-5 rounded scaled-font form-control form-control-sm"/> <input type = "number" placeholder = "0" id="eDamPct" name="eDamPct" value="0" class="border-semi-dark border-2 text-light dark-5 rounded scaled-font form-control form-control-sm" oninput = "updateStats()"/>
</div> </div>
<div class = "row" id = "eDamPct-base"> <div class = "row" id = "eDamPct-base">
Original Value: 0 Original Value: 0
@ -547,7 +683,7 @@
Damage %: Damage %:
</div> </div>
<div class = "row"> <div class = "row">
<input type = "number" placeholder = "0" id="tDamPct" name="tDamPct" value="0" class="border-semi-dark border-2 text-light dark-5 rounded scaled-font form-control form-control-sm"/> <input type = "number" placeholder = "0" id="tDamPct" name="tDamPct" value="0" class="border-semi-dark border-2 text-light dark-5 rounded scaled-font form-control form-control-sm" oninput = "updateStats()"/>
</div> </div>
<div class = "row" id = "tDamPct-base"> <div class = "row" id = "tDamPct-base">
Original Value: 0 Original Value: 0
@ -558,7 +694,7 @@
Damage %: Damage %:
</div> </div>
<div class = "row"> <div class = "row">
<input type = "number" placeholder = "0" id="wDamPct" name="wDamPct" value="0" class="border-semi-dark border-2 text-light dark-5 rounded scaled-font form-control form-control-sm"/> <input type = "number" placeholder = "0" id="wDamPct" name="wDamPct" value="0" class="border-semi-dark border-2 text-light dark-5 rounded scaled-font form-control form-control-sm" oninput = "updateStats()"/>
</div> </div>
<div class = "row" id = "wDamPct-base"> <div class = "row" id = "wDamPct-base">
Original Value: 0 Original Value: 0
@ -571,7 +707,7 @@
Damage %: Damage %:
</div> </div>
<div class = "row"> <div class = "row">
<input type = "number" placeholder = "0" id="fDamPct" name="fDamPct" value="0" class="border-semi-dark border-2 text-light dark-5 rounded scaled-font form-control form-control-sm"/> <input type = "number" placeholder = "0" id="fDamPct" name="fDamPct" value="0" class="border-semi-dark border-2 text-light dark-5 rounded scaled-font form-control form-control-sm" oninput = "updateStats()"/>
</div> </div>
<div class = "row" id = "fDamPct-base"> <div class = "row" id = "fDamPct-base">
Original Value: 0 Original Value: 0
@ -582,7 +718,7 @@
Damage %: Damage %:
</div> </div>
<div class = "row"> <div class = "row">
<input type = "number" placeholder = "0" id="aDamPct" name="aDamPct" value="0" class="border-semi-dark border-2 text-light dark-5 rounded scaled-font form-control form-control-sm"/> <input type = "number" placeholder = "0" id="aDamPct" name="aDamPct" value="0" class="border-semi-dark border-2 text-light dark-5 rounded scaled-font form-control form-control-sm" oninput = "updateStats()"/>
</div> </div>
<div class = "row" id = "aDamPct-base"> <div class = "row" id = "aDamPct-base">
Original Value: 0 Original Value: 0
@ -593,7 +729,7 @@
+ Tier: + Tier:
</div> </div>
<div class = "row"> <div class = "row">
<input type = "number" placeholder = "0" id="atkTier" name="atkTier" value="0" class="border-semi-dark border-2 text-light dark-5 rounded scaled-font form-control form-control-sm"/> <input type = "number" placeholder = "0" id="atkTier" name="atkTier" value="0" class="border-semi-dark border-2 text-light dark-5 rounded scaled-font form-control form-control-sm" oninput = "updateStats()"/>
</div> </div>
<div class = "row" id = "atkTier-base"> <div class = "row" id = "atkTier-base">
Original Value: 0 Original Value: 0
@ -612,7 +748,7 @@
Defense %: Defense %:
</div> </div>
<div class = "row"> <div class = "row">
<input type = "number" placeholder = "0" id="eDefPct" name="eDefPct" value="0" class="border-semi-dark border-2 text-light dark-5 rounded scaled-font form-control form-control-sm"/> <input type = "number" placeholder = "0" id="eDefPct" name="eDefPct" value="0" class="border-semi-dark border-2 text-light dark-5 rounded scaled-font form-control form-control-sm" oninput = "updateStats()"/>
</div> </div>
<div class = "row" id = "eDefPct-base"> <div class = "row" id = "eDefPct-base">
Original Value: 0 Original Value: 0
@ -623,7 +759,7 @@
Defense %: Defense %:
</div> </div>
<div class = "row"> <div class = "row">
<input type = "number" placeholder = "0" id="tDefPct" name="tDefPct" value="0" class="border-semi-dark border-2 text-light dark-5 rounded scaled-font form-control form-control-sm"/> <input type = "number" placeholder = "0" id="tDefPct" name="tDefPct" value="0" class="border-semi-dark border-2 text-light dark-5 rounded scaled-font form-control form-control-sm" oninput = "updateStats()"/>
</div> </div>
<div class = "row" id = "tDefPct-base"> <div class = "row" id = "tDefPct-base">
Original Value: 0 Original Value: 0
@ -634,7 +770,7 @@
Defense %: Defense %:
</div> </div>
<div class = "row"> <div class = "row">
<input type = "number" placeholder = "0" id="wDefPct" name="wDefPct" value="0" class="border-semi-dark border-2 text-light dark-5 rounded scaled-font form-control form-control-sm"/> <input type = "number" placeholder = "0" id="wDefPct" name="wDefPct" value="0" class="border-semi-dark border-2 text-light dark-5 rounded scaled-font form-control form-control-sm" oninput = "updateStats()"/>
</div> </div>
<div class = "row" id = "wDefPct-base"> <div class = "row" id = "wDefPct-base">
Original Value: 0 Original Value: 0
@ -645,7 +781,7 @@
Defense %: Defense %:
</div> </div>
<div class = "row"> <div class = "row">
<input type = "number" placeholder = "0" id="fDefPct" name="fDefPct" value="0" class="border-semi-dark border-2 text-light dark-5 rounded scaled-font form-control form-control-sm"/> <input type = "number" placeholder = "0" id="fDefPct" name="fDefPct" value="0" class="border-semi-dark border-2 text-light dark-5 rounded scaled-font form-control form-control-sm" oninput = "updateStats()"/>
</div> </div>
<div class = "row" id = "fDefPct-base"> <div class = "row" id = "fDefPct-base">
Original Value: 0 Original Value: 0
@ -658,7 +794,7 @@
Defense %: Defense %:
</div> </div>
<div class = "row"> <div class = "row">
<input type = "number" placeholder = "0" id="aDefPct" name="aDefPct" value="0" class="border-semi-dark border-2 text-light dark-5 rounded scaled-font form-control form-control-sm"/> <input type = "number" placeholder = "0" id="aDefPct" name="aDefPct" value="0" class="border-semi-dark border-2 text-light dark-5 rounded scaled-font form-control form-control-sm" oninput = "updateStats()"/>
</div> </div>
<div class = "row" id = "aDefPct-base"> <div class = "row" id = "aDefPct-base">
Original Value: 0 Original Value: 0
@ -669,7 +805,7 @@
Health Regen Raw: Health Regen Raw:
</div> </div>
<div class = "row"> <div class = "row">
<input type = "number" placeholder = "0" id="hprRaw" name="hprRaw" value="0" class="border-semi-dark border-2 text-light dark-5 rounded scaled-font form-control form-control-sm"/> <input type = "number" placeholder = "0" id="hprRaw" name="hprRaw" value="0" class="border-semi-dark border-2 text-light dark-5 rounded scaled-font form-control form-control-sm" oninput = "updateStats()"/>
</div> </div>
<div class = "row" id = "hprRaw-base"> <div class = "row" id = "hprRaw-base">
Original Value: 0 Original Value: 0
@ -680,7 +816,7 @@
Health Regen %: Health Regen %:
</div> </div>
<div class = "row"> <div class = "row">
<input type = "number" placeholder = "0" id="hprPct" name="hprPct" value="0" class="border-semi-dark border-2 text-light dark-5 rounded scaled-font form-control form-control-sm"/> <input type = "number" placeholder = "0" id="hprPct" name="hprPct" value="0" class="border-semi-dark border-2 text-light dark-5 rounded scaled-font form-control form-control-sm" oninput = "updateStats()"/>
</div> </div>
<div class = "row" id = "hprPct-base"> <div class = "row" id = "hprPct-base">
Original Value: 0 Original Value: 0
@ -691,7 +827,7 @@
Health Bonus: Health Bonus:
</div> </div>
<div class = "row"> <div class = "row">
<input type = "number" placeholder = "0" id="hpBonus" name="hpBonus" value="0" class="border-semi-dark border-2 text-light dark-5 rounded scaled-font form-control form-control-sm"/> <input type = "number" placeholder = "0" id="hpBonus" name="hpBonus" value="0" class="border-semi-dark border-2 text-light dark-5 rounded scaled-font form-control form-control-sm" oninput = "updateStats()"/>
</div> </div>
<div class = "row" id = "hpBonus-base"> <div class = "row" id = "hpBonus-base">
Original Value: 0 Original Value: 0
@ -707,7 +843,7 @@
1st Spell Cost %: 1st Spell Cost %:
</div> </div>
<div class = "row"> <div class = "row">
<input type = "number" placeholder = "0" id="spPct1" name="spPct1" value="0" class="border-semi-dark border-2 text-light dark-5 rounded scaled-font form-control form-control-sm"/> <input type = "number" placeholder = "0" id="spPct1" name="spPct1" value="0" class="border-semi-dark border-2 text-light dark-5 rounded scaled-font form-control form-control-sm" oninput = "updateStats()"/>
</div> </div>
<div class = "row" id = "spPct1-base"> <div class = "row" id = "spPct1-base">
Original Value: 0 Original Value: 0
@ -718,7 +854,7 @@
2nd Spell Cost %: 2nd Spell Cost %:
</div> </div>
<div class = "row"> <div class = "row">
<input type = "number" placeholder = "0" id="spPct2" name="spPct2" value="0" class="border-semi-dark border-2 text-light dark-5 rounded scaled-font form-control form-control-sm"/> <input type = "number" placeholder = "0" id="spPct2" name="spPct2" value="0" class="border-semi-dark border-2 text-light dark-5 rounded scaled-font form-control form-control-sm" oninput = "updateStats()"/>
</div> </div>
<div class = "row" id = "spPct2-base"> <div class = "row" id = "spPct2-base">
Original Value: 0 Original Value: 0
@ -729,7 +865,7 @@
3rd Spell Cost %: 3rd Spell Cost %:
</div> </div>
<div class = "row"> <div class = "row">
<input type = "number" placeholder = "0" id="spPct3" name="spPct3" value="0" class="border-semi-dark border-2 text-light dark-5 rounded scaled-font form-control form-control-sm"/> <input type = "number" placeholder = "0" id="spPct3" name="spPct3" value="0" class="border-semi-dark border-2 text-light dark-5 rounded scaled-font form-control form-control-sm" oninput = "updateStats()"/>
</div> </div>
<div class = "row" id = "spPct3-base"> <div class = "row" id = "spPct3-base">
Original Value: 0 Original Value: 0
@ -740,7 +876,7 @@
4th Spell Cost %: 4th Spell Cost %:
</div> </div>
<div class = "row"> <div class = "row">
<input type = "number" placeholder = "0" id="spPct4" name="spPct4" value="0" class="border-semi-dark border-2 text-light dark-5 rounded scaled-font form-control form-control-sm"/> <input type = "number" placeholder = "0" id="spPct4" name="spPct4" value="0" class="border-semi-dark border-2 text-light dark-5 rounded scaled-font form-control form-control-sm" oninput = "updateStats()"/>
</div> </div>
<div class = "row" id = "spPct4-base"> <div class = "row" id = "spPct4-base">
Original Value: 0 Original Value: 0
@ -753,7 +889,7 @@
1st Spell Cost Raw: 1st Spell Cost Raw:
</div> </div>
<div class = "row"> <div class = "row">
<input type = "number" placeholder = "0" id="spRaw1" name="spRaw1" value="0" class="border-semi-dark border-2 text-light dark-5 rounded scaled-font form-control form-control-sm"/> <input type = "number" placeholder = "0" id="spRaw1" name="spRaw1" value="0" class="border-semi-dark border-2 text-light dark-5 rounded scaled-font form-control form-control-sm" oninput = "updateStats()"/>
</div> </div>
<div class = "row" id = "spRaw1-base"> <div class = "row" id = "spRaw1-base">
Original Value: 0 Original Value: 0
@ -764,7 +900,7 @@
2nd Spell Cost Raw: 2nd Spell Cost Raw:
</div> </div>
<div class = "row"> <div class = "row">
<input type = "number" placeholder = "0" id="spRaw2" name="spRaw2" value="0" class="border-semi-dark border-2 text-light dark-5 rounded scaled-font form-control form-control-sm"/> <input type = "number" placeholder = "0" id="spRaw2" name="spRaw2" value="0" class="border-semi-dark border-2 text-light dark-5 rounded scaled-font form-control form-control-sm" oninput = "updateStats()"/>
</div> </div>
<div class = "row" id = "spRaw2-base"> <div class = "row" id = "spRaw2-base">
Original Value: 0 Original Value: 0
@ -775,7 +911,7 @@
3rd Spell Cost Raw: 3rd Spell Cost Raw:
</div> </div>
<div class = "row"> <div class = "row">
<input type = "number" placeholder = "0" id="spRaw3" name="spRaw3" value="0" class="border-semi-dark border-2 text-light dark-5 rounded scaled-font form-control form-control-sm"/> <input type = "number" placeholder = "0" id="spRaw3" name="spRaw3" value="0" class="border-semi-dark border-2 text-light dark-5 rounded scaled-font form-control form-control-sm" oninput = "updateStats()"/>
</div> </div>
<div class = "row" id = "spRaw3-base"> <div class = "row" id = "spRaw3-base">
Original Value: 0 Original Value: 0
@ -786,7 +922,7 @@
4th Spell Cost Raw: 4th Spell Cost Raw:
</div> </div>
<div class = "row"> <div class = "row">
<input type = "number" placeholder = "0" id="spRaw4" name="spRaw4" value="0" class="border-semi-dark border-2 text-light dark-5 rounded scaled-font form-control form-control-sm"/> <input type = "number" placeholder = "0" id="spRaw4" name="spRaw4" value="0" class="border-semi-dark border-2 text-light dark-5 rounded scaled-font form-control form-control-sm" oninput = "updateStats()"/>
</div> </div>
<div class = "row" id = "spRaw4-base"> <div class = "row" id = "spRaw4-base">
Original Value: 0 Original Value: 0
@ -1151,6 +1287,20 @@
</div> </div>
<div id="weapon-tooltip" class="rounded row row-cols-1 g-0 scaled-font float-tooltip border border-3 border-dark dark-shadow p-3"> <div id="weapon-tooltip" class="rounded row row-cols-1 g-0 scaled-font float-tooltip border border-3 border-dark dark-shadow p-3">
</div> </div>
<div id="weaponTome1-tooltip" class="rounded row row-cols-1 g-0 scaled-font float-tooltip border border-3 border-dark dark-shadow p-3">
</div>
<div id="weaponTome2-tooltip" class="rounded row row-cols-1 g-0 scaled-font float-tooltip border border-3 border-dark dark-shadow p-3">
</div>
<div id="armorTome1-tooltip" class="rounded row row-cols-1 g-0 scaled-font float-tooltip border border-3 border-dark dark-shadow p-3">
</div>
<div id="armorTome2-tooltip" class="rounded row row-cols-1 g-0 scaled-font float-tooltip border border-3 border-dark dark-shadow p-3">
</div>
<div id="armorTome3-tooltip" class="rounded row row-cols-1 g-0 scaled-font float-tooltip border border-3 border-dark dark-shadow p-3">
</div>
<div id="armorTome4-tooltip" class="rounded row row-cols-1 g-0 scaled-font float-tooltip border border-3 border-dark dark-shadow p-3">
</div>
<div id="guildTome1-tooltip" class="rounded row row-cols-1 g-0 scaled-font float-tooltip border border-3 border-dark dark-shadow p-3">
</div>
<div class="rounded row row-cols-1 g-0 scaled-font float-tooltip border border-3 border-dark dark-shadow p-3" id = "build-order"> <div class="rounded row row-cols-1 g-0 scaled-font float-tooltip border border-3 border-dark dark-shadow p-3" id = "build-order">
</div> </div>
<div class = "rounded row row-cols-1 g-0 scaled-font float-tooltip border border-3 border-dark p-3" id = "set-info"></div> <div class = "rounded row row-cols-1 g-0 scaled-font float-tooltip border border-3 border-dark p-3" id = "set-info"></div>
@ -1242,6 +1392,7 @@
<script type="text/javascript" src="../js/query_2.js"></script> <script type="text/javascript" src="../js/query_2.js"></script>
<script type="text/javascript" src="../js/load.js"></script> <script type="text/javascript" src="../js/load.js"></script>
<script type="text/javascript" src="../js/load_ing.js"></script> <script type="text/javascript" src="../js/load_ing.js"></script>
<script type="text/javascript" src="../js/load_tome.js"></script>
<script type="text/javascript" src="../js/custom.js"></script> <script type="text/javascript" src="../js/custom.js"></script>
<script type="text/javascript" src="../js/craft.js"></script> <script type="text/javascript" src="../js/craft.js"></script>
<script type="text/javascript" src="../js/sq2build.js"></script> <script type="text/javascript" src="../js/sq2build.js"></script>

View file

@ -173,3 +173,7 @@ Wynn-Related CSS
} }
.aDam:before, .Air:before, .Air_powder:before { content: "\274b" ' '; } .aDam:before, .Air:before, .Air_powder:before { content: "\274b" ' '; }
.restrict {
color: #ff8180;
}

View file

@ -51,7 +51,7 @@ const armorTypes = [ "helmet", "chestplate", "leggings", "boots" ];
const accessoryTypes = [ "ring", "bracelet", "necklace" ]; const accessoryTypes = [ "ring", "bracelet", "necklace" ];
const weaponTypes = [ "wand", "spear", "bow", "dagger", "relik" ]; const weaponTypes = [ "wand", "spear", "bow", "dagger", "relik" ];
const consumableTypes = [ "potion", "scroll", "food"]; const consumableTypes = [ "potion", "scroll", "food"];
const tomeTypes = ["armorTome", "weaponTome", "guildTome", "dungeonTome", "gatheringTome", "slayingTome"] const tomeTypes = ["armorTome", "weaponTome", "guildTome"]; //"dungeonTome", "gatheringTome", "slayingTome"
const attackSpeeds = ["SUPER_SLOW", "VERY_SLOW", "SLOW", "NORMAL", "FAST", "VERY_FAST", "SUPER_FAST"]; const attackSpeeds = ["SUPER_SLOW", "VERY_SLOW", "SLOW", "NORMAL", "FAST", "VERY_FAST", "SUPER_FAST"];
const baseDamageMultiplier = [ 0.51, 0.83, 1.5, 2.05, 2.5, 3.1, 4.3 ]; const baseDamageMultiplier = [ 0.51, 0.83, 1.5, 2.05, 2.5, 3.1, 4.3 ];
//0.51, 0.82, 1.50, 2.05, 2.50, 3.11, 4.27 //0.51, 0.82, 1.50, 2.05, 2.50, 3.11, 4.27

View file

@ -238,7 +238,7 @@ function init_maps() {
item.has_negstat = false; item.has_negstat = false;
item.reqs = [0, 0, 0, 0, 0]; item.reqs = [0, 0, 0, 0, 0];
item.fixID = true; item.fixID = true;
item.tier = "Normal";//do not get rid of this @hpp item.tier = "Normal";
item.id = 10000 + i; item.id = 10000 + i;
item.nDam = "0-0"; item.nDam = "0-0";
item.eDam = "0-0"; item.eDam = "0-0";

184
js/load_tome.js Normal file
View file

@ -0,0 +1,184 @@
const TOME_DB_VERSION = 1;
// @See https://github.com/mdn/learning-area/blob/master/javascript/apis/client-side-storage/indexeddb/video-store/index.jsA
let tdb;
let treload = false;
let tload_complete = false;
let tload_in_progress = false;
let tomes;
let tomeMap;
let tomeIDMap;
let tomeLists = new Map();
/*
* Load tome set from local DB. Calls init() on success.
*/
async function load_tome_local(init_func) {
let get_tx = tdb.transaction(['tome_db'], 'readonly');
let get_store = get_tx.objectStore('tome_db');
let request = get_store.getAll();
request.onerror = function(event) {
console.log("Could not read local tome db...");
}
request.onsuccess = function(event) {
console.log("Successfully read local tome db.");
tomes = request.result;
init_tome_maps();
init_func();
tload_complete = true;
}
await get_tx.complete;
tdb.close();
}
/*
* Load tome set from remote DB (json). Calls init() on success.
*/
async function load_tome(init_func) {
let getUrl = window.location;
let baseUrl = getUrl.protocol + "//" + getUrl.host + "/";// + getUrl.pathname.split('/')[1];
// "Random" string to prevent caching!
let url = baseUrl + "/tomes.json?"+new Date();
let result = await (await fetch(url)).json();
tomes = result.tomes
let add_tx = tdb.transaction(['tome_db'], 'readwrite');
add_tx.onabort = function(e) {
console.log(e);
console.log("Not enough space...");
};
let tomes_store = add_tx.objectStore('tome_db');
let add_promises = [];
for (const tome of tomes) {
//dependency on clean_item in load.js
clean_item(tome);
let req = tomes_store.add(tome, tome.name);
req.onerror = function() {
console.log("ADD TOME ERROR? " + tome.name);
};
add_promises.push(req);
}
Promise.all(add_promises).then((values) => {
init_tome_maps();
init_func();
tload_complete = true;
});
// DB not closed? idfk man
}
function load_tome_init(init_func) {
if (tload_complete) {
console.log("Tome db already loaded, skipping load sequence");
init_func();
return;
}
let request = window.indexedDB.open('tome_db', TOME_DB_VERSION);
request.onerror = function() {
console.log("DB failed to open...");
};
request.onsuccess = function() {
(async function() {
tdb = request.result;
if (!treload) {
console.log("Using stored data...")
load_tome_local(init_func);
}
else {
if (tload_in_progress) {
while (!tload_complete) {
await sleep(100);
}
console.log("Skipping load...")
init_func();
}
else {
// Not 100% safe... whatever!
tload_in_progress = true
console.log("Using new data...")
load_tome(init_func);
}
}
})()
}
request.onupgradeneeded = function(e) {
treload = true;
let tdb = e.target.result;
try {
tdb.deleteObjectStore('tome_db');
}
catch (error) {
console.log("Could not delete tome DB. This is probably fine");
}
tdb.createObjectStore('tome_db');
console.log("DB setup complete...");
}
}
function init_tome_maps() {
//warp
tomeMap = new Map();
/* Mapping from item names to set names. */
tomeIDMap = new Map();
for (const it of tomeTypes) {
tomeLists.set(it, []);
}
let noneTomes = [
["tome", "weaponTome", "No Weapon Tome"],
["tome", "armorTome", "No Armor Tome"],
["tome", "guildTome", "No Guild Tome"]
];
for (let i = 0; i < 3; i++) {
let tome = Object();
tome.slots = 0;
tome.category = noneTomes[i][0];
tome.type = noneTomes[i][1];
tome.name = noneTomes[i][2];
tome.displayName = tome.name;
tome.set = null;
tome.quest = null;
tome.skillpoints = [0, 0, 0, 0, 0];
tome.has_negstat = false;
tome.reqs = [0, 0, 0, 0, 0];
tome.fixID = true;
tome.tier = "Normal";
tome.id = 10000 + i;
tome.nDam = "0-0";
tome.eDam = "0-0";
tome.tDam = "0-0";
tome.wDam = "0-0";
tome.fDam = "0-0";
tome.aDam = "0-0";
//dependency - load.js
clean_item(tome);
noneTomes[i] = tome;
}
tomes = tomes.concat(noneTomes);
//console.log(tomes);
for (const tome of tomes) {
if (tome.remapID === undefined) {
tomeLists.get(tome.type).push(tome.displayName);
tomeMap.set(tome.displayName, tome);
if (noneTomes.includes(tome)) {
idMap.set(tome.id, "");
}
else {
idMap.set(tome.id, tome.displayName);
}
}
else {
redirectMap.set(tome.id, tome.remapID);
}
}
console.log(tomeLists);
console.log(tomeMap);
}

View file

@ -1,7 +1,6 @@
function calculate_skillpoints(equipment, weapon) { function calculate_skillpoints(equipment, weapon, tomes = []) {
// Calculate equipment equipping order and required skillpoints. // Calculate equipment equipping order and required skillpoints.
// Return value: [equip_order, best_skillpoints, final_skillpoints, best_total]; // Return value: [equip_order, best_skillpoints, final_skillpoints, best_total];
let fixed = []; let fixed = [];
let consider = []; let consider = [];
let noboost = []; let noboost = [];

View file

@ -3,7 +3,9 @@ let armor_keys = ['helmet', 'chestplate', 'leggings', 'boots'];
let skp_keys = ['str', 'dex', 'int', 'def', 'agi']; let skp_keys = ['str', 'dex', 'int', 'def', 'agi'];
let accessory_keys= ['ring1', 'ring2', 'bracelet', 'necklace']; let accessory_keys= ['ring1', 'ring2', 'bracelet', 'necklace'];
let powderable_keys = ['helmet', 'chestplate', 'leggings', 'boots', 'weapon']; let powderable_keys = ['helmet', 'chestplate', 'leggings', 'boots', 'weapon'];
let equipment_keys = ['helmet', 'chestplate', 'leggings', 'boots', 'ring1', 'ring2', 'bracelet', 'necklace', 'weapon']; let tome_types = ['weaponTome', 'armorTome', 'guildTome'];
let tome_keys = ['weaponTome1', 'weaponTome2', 'armorTome1', 'armorTome2', 'armorTome3', 'armorTome4', 'guildTome1'];
let equipment_keys = ['helmet', 'chestplate', 'leggings', 'boots', 'ring1', 'ring2', 'bracelet', 'necklace', 'weapon'].concat(tome_keys);
let powder_keys = ['e', 't', 'w', 'f', 'a']; let powder_keys = ['e', 't', 'w', 'f', 'a'];
let spell_disp = ['spell0-info', 'spell1-info', 'spell2-info', 'spell3-info']; let spell_disp = ['spell0-info', 'spell1-info', 'spell2-info', 'spell3-info'];
@ -13,13 +15,18 @@ document.addEventListener('DOMContentLoaded', function() {
for (const eq of equipment_keys) { for (const eq of equipment_keys) {
document.querySelector("#"+eq+"-choice").setAttribute("oninput", "update_field('"+ eq +"'); calcBuildSchedule();"); document.querySelector("#"+eq+"-choice").setAttribute("oninput", "update_field('"+ eq +"'); calcBuildSchedule();");
document.querySelector("#"+eq+"-tooltip").setAttribute("onclick", "collapse_element('#"+ eq +"-tooltip'); toggle_plus_minus('" + eq + "-pm'); "); document.querySelector("#"+eq+"-tooltip").setAttribute("onclick", "collapse_element('#"+ eq +"-tooltip');"); //toggle_plus_minus('" + eq + "-pm');
} }
for (const eq of powderable_keys) { for (const eq of powderable_keys) {
document.querySelector("#"+eq+"-powder").setAttribute("oninput", "calcBuildSchedule(); update_field('"+ eq +"');"); document.querySelector("#"+eq+"-powder").setAttribute("oninput", "calcBuildSchedule(); update_field('"+ eq +"');");
} }
for (const eq of tome_keys) {
document.querySelector("#" + eq + "-choice").setAttribute("oninput", "update_field('" + eq + "'); calcBuildSchedule();");
document.querySelector("#"+eq+"-tooltip").setAttribute("onclick", "collapse_element('#"+ eq +"-tooltip');");
}
for (const i of spell_disp) { for (const i of spell_disp) {
document.querySelector("#"+i+"Avg").setAttribute("onclick", "toggle_spell_tab('"+i+"')"); document.querySelector("#"+i+"Avg").setAttribute("onclick", "toggle_spell_tab('"+i+"')");
} }
@ -144,6 +151,14 @@ function update_field(field) {
category = item.category; category = item.category;
type = item.type; type = item.type;
} }
else if (tomeMap.get(item)) {
tome = tomeMap.get(item);
if (!tome) {return false;}
powder_slots = 0;
tier = item.tier;
category = item.category;
type = item.type;
}
else { else {
// item not found // item not found
document.querySelector("#"+field+"-choice").classList.add("text-light"); document.querySelector("#"+field+"-choice").classList.add("text-light");
@ -299,6 +314,9 @@ function reset_powder_specials() {
function init_autocomplete() { function init_autocomplete() {
let dropdowns = new Map() let dropdowns = new Map()
for (const eq of equipment_keys) { for (const eq of equipment_keys) {
if (tome_keys.includes(eq)) {
continue;
}
// build dropdown // build dropdown
let item_arr = []; let item_arr = [];
if (eq == 'weapon') { if (eq == 'weapon') {
@ -375,6 +393,71 @@ function init_autocomplete() {
} }
})); }));
} }
for (const eq of tome_keys) {
// build dropdown
let tome_arr = [];
for (const tome of tomeLists.get(eq.replace(/[0-9]/g, ''))) {
let tome_obj = tomeMap.get(tome);
if (tome_obj["restrict"] && tome_obj["restrict"] === "DEPRECATED") {
continue;
}
//this should suffice for tomes - jank
if (tome_obj["name"].includes('No ' + eq.charAt(0).toUpperCase())) {
continue;
}
tome_arr.push(tome)
}
// create dropdown
dropdowns.set(eq, new autoComplete({
data: {
src: tome_arr
},
selector: "#"+ eq +"-choice",
wrapper: false,
resultsList: {
maxResults: 1000,
tabSelect: true,
noResults: true,
class: "search-box dark-7 rounded-bottom px-2 fw-bold dark-shadow-sm",
element: (list, data) => {
// dynamic result loc
let position = document.getElementById(eq+'-dropdown').getBoundingClientRect();
list.style.top = position.bottom + window.scrollY +"px";
list.style.left = position.x+"px";
list.style.width = position.width+"px";
list.style.maxHeight = position.height * 2 +"px";
if (!data.results.length) {
message = document.createElement('li');
message.classList.add('scaled-font');
message.textContent = "No results found!";
list.prepend(message);
}
},
},
resultItem: {
class: "scaled-font search-item",
selected: "dark-5",
element: (tome, data) => {
tome.classList.add(tomeMap.get(data.value).tier);
},
},
events: {
input: {
selection: (event) => {
if (event.detail.selection.value) {
event.target.value = event.detail.selection.value;
}
update_field(eq);
calcBuildSchedule();
},
},
}
}));
}
let filter_loc = ["filter1", "filter2", "filter3", "filter4"]; let filter_loc = ["filter1", "filter2", "filter3", "filter4"];
for (const i of filter_loc) { for (const i of filter_loc) {
dropdowns.set(i+"-choice", new autoComplete({ dropdowns.set(i+"-choice", new autoComplete({

View file

@ -100,8 +100,12 @@ class Build{
* @param {Number[]} powders : Powder application. List of lists of integers (powder IDs). * @param {Number[]} powders : Powder application. List of lists of integers (powder IDs).
* In order: boots, Chestplate, Leggings, Boots, Weapon. * In order: boots, Chestplate, Leggings, Boots, Weapon.
* @param {Object[]} inputerrors : List of instances of error-like classes. * @param {Object[]} inputerrors : List of instances of error-like classes.
*
* @param {Object[]} tomes: List of tomes.
* 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,equipment, powders, externalStats, inputerrors=[]){ constructor(level,equipment, powders, externalStats, inputerrors=[], tomes){
let errors = inputerrors; let errors = inputerrors;
//this contains the Craft objects, if there are any crafted items. this.boots, etc. will contain the statMap of the Craft (which is built to be an expandedItem). //this contains the Craft objects, if there are any crafted items. this.boots, etc. will contain the statMap of the Craft (which is built to be an expandedItem).
@ -327,6 +331,142 @@ class Build{
} }
} }
//cannot craft tomes
if(tomeMap.get(tomes[0]) && tomeMap.get(tomes[0]).type === "weaponTome") {
const weaponTome1 = tomeMap.get(tomes[0]);
this.weaponTome1 = expandItem(weaponTome1, []);
} else {
try {
let weaponTome1 = getCustomFromHash(tomes[0]) ? getCustomFromHash(tomes[0]) : undefined;
if (weaponTome1.statMap.get("type") !== "weaponTome1") {
throw new Error("Not a Weapon Tome");
}
if (this.weaponTome1.get("custom")) {
this.customItems.push(weaponTome1);
} //can't craft tomes
} catch (Error) {
const weaponTome1 = tomeMap.get("No Weapon Tome");
this.weaponTome1 = expandItem(weaponTome1, []);
errors.push(new ItemNotFound(tomes[0], "weaponTome1", true));
}
}
if(tomeMap.get(tomes[1]) && tomeMap.get(tomes[1]).type === "weaponTome") {
const weaponTome2 = tomeMap.get(tomes[1]);
this.weaponTome2 = expandItem(weaponTome2, []);
} else {
try {
let weaponTome2 = getCustomFromHash(tomes[1]) ? getCustomFromHash(tomes[1]) : undefined;
if (weaponTome2.statMap.get("type") !== "weaponTome2") {
throw new Error("Not a Weapon Tome");
}
if (this.weaponTome2.get("custom")) {
this.customItems.push(weaponTome2);
} //can't craft tomes
} catch (Error) {
const weaponTome2 = tomeMap.get("No Weapon Tome");
this.weaponTome2 = expandItem(weaponTome2, []);
errors.push(new ItemNotFound(tomes[1], "weaponTome2", true));
}
}
if(tomeMap.get(tomes[2]) && tomeMap.get(tomes[2]).type === "armorTome") {
const armorTome1 = tomeMap.get(tomes[2]);
this.armorTome1 = expandItem(armorTome1, []);
} else {
try {
let armorTome1 = getCustomFromHash(tomes[2]) ? getCustomFromHash(tomes[2]) : undefined;
if (armorTome1.statMap.get("type") !== "armorTome1") {
throw new Error("Not an Armor Tome");
}
if (this.armorTome1.get("custom")) {
this.customItems.push(armorTome1);
} //can't craft tomes
} catch (Error) {
const armorTome1 = tomeMap.get("No Armor Tome");
this.armorTome1 = expandItem(armorTome1, []);
errors.push(new ItemNotFound(tomes[2], "armorTome1", true));
}
}
if(tomeMap.get(tomes[3]) && tomeMap.get(tomes[3]).type === "armorTome") {
const armorTome2 = tomeMap.get(tomes[3]);
this.armorTome2 = expandItem(armorTome2, []);
} else {
try {
let armorTome2 = getCustomFromHash(tomes[3]) ? getCustomFromHash(tomes[3]) : undefined;
if (armorTome2.statMap.get("type") !== "armorTome2") {
throw new Error("Not an Armor Tome");
}
if (this.armorTome2.get("custom")) {
this.customItems.push(armorTome2);
} //can't craft tomes
} catch (Error) {
const armorTome2 = tomeMap.get("No Armor Tome");
this.armorTome2 = expandItem(armorTome2, []);
errors.push(new ItemNotFound(tomes[3], "armorTome2", true));
}
}
if(tomeMap.get(tomes[4]) && tomeMap.get(tomes[4]).type === "armorTome") {
const armorTome3 = tomeMap.get(tomes[4]);
this.armorTome3 = expandItem(armorTome3, []);
} else {
try {
let armorTome3 = getCustomFromHash(tomes[4]) ? getCustomFromHash(tomes[4]) : undefined;
if (armorTome3.statMap.get("type") !== "armorTome3") {
throw new Error("Not an Armor Tome");
}
if (this.armorTome3.get("custom")) {
this.customItems.push(armorTome3);
} //can't craft tomes
} catch (Error) {
const armorTome3 = tomeMap.get("No Armor Tome");
this.armorTome3 = expandItem(armorTome3, []);
errors.push(new ItemNotFound(tomes[4], "armorTome3", true));
}
}
if(tomeMap.get(tomes[5]) && tomeMap.get(tomes[5]).type === "armorTome") {
const armorTome4 = tomeMap.get(tomes[5]);
this.armorTome4 = expandItem(armorTome4, []);
} else {
try {
let armorTome4 = getCustomFromHash(tomes[5]) ? getCustomFromHash(tomes[5]) : undefined;
if (armorTome4.statMap.get("type") !== "armorTome4") {
throw new Error("Not an Armor Tome");
}
if (this.armorTome4.get("custom")) {
this.customItems.push(armorTome4);
} //can't craft tomes
} catch (Error) {
const armorTome4 = tomeMap.get("No Armor Tome");
this.armorTome4 = expandItem(armorTome4, []);
errors.push(new ItemNotFound(tomes[5], "armorTome4", true));
}
}
if(tomeMap.get(tomes[6]) && tomeMap.get(tomes[6]).type === "guildTome") {
const guildTome1 = tomeMap.get(tomes[6]);
this.guildTome1 = expandItem(guildTome1, []);
} else {
try {
let guildTome1 = getCustomFromHash(tomes[6]) ? getCustomFromHash(tomes[6]) : undefined;
if (guildTome1.statMap.get("type") !== "guildTome1") {
throw new Error("Not an Guild Tome");
}
if (this.guildTome1.get("custom")) {
this.customItems.push(guildTome1);
} //can't craft tomes
} catch (Error) {
const guildTome1 = tomeMap.get("No Guild Tome");
this.guildTome1 = expandItem(guildTome1, []);
errors.push(new ItemNotFound(tomes[6], "guildTome1", true));
}
}
//console.log(this.craftedItems) //console.log(this.craftedItems)
if (level < 1) { //Should these be constants? if (level < 1) { //Should these be constants?
@ -345,9 +485,10 @@ class Build{
this.availableSkillpoints = levelToSkillPoints(this.level); this.availableSkillpoints = levelToSkillPoints(this.level);
this.equipment = [ this.helmet, this.chestplate, this.leggings, this.boots, this.ring1, this.ring2, this.bracelet, this.necklace ]; this.equipment = [ this.helmet, this.chestplate, this.leggings, this.boots, this.ring1, this.ring2, this.bracelet, this.necklace ];
this.items = this.equipment.concat([this.weapon]); this.tomes = [this.weaponTome1, this.weaponTome2, this.armorTome1, this.armorTome2, this.armorTome3, this.armorTome4, this.guildTome1];
this.items = this.equipment.concat([this.weapon]).concat(this.tomes);
// return [equip_order, best_skillpoints, final_skillpoints, best_total]; // return [equip_order, best_skillpoints, final_skillpoints, best_total];
let result = calculate_skillpoints(this.equipment, this.weapon); let result = calculate_skillpoints(this.equipment, this.weapon, this.tomes);
console.log(result); console.log(result);
this.equip_order = result[0]; this.equip_order = result[0];
// How many skillpoints the player had to assign (5 number) // How many skillpoints the player had to assign (5 number)
@ -378,7 +519,7 @@ class Build{
/*Returns build in string format /*Returns build in string format
*/ */
toString(){ toString(){
return [this.equipment,this.weapon].flat(); return [this.equipment,this.weapon,this.tomes].flat();
} }
/* Getters */ /* Getters */

View file

@ -61,6 +61,15 @@ let equipment_fields = [
"necklace", "necklace",
"weapon" "weapon"
]; ];
let tome_fields = [
"weaponTome1",
"weaponTome2",
"armorTome1",
"armorTome2",
"armorTome3",
"armorTome4",
"guildTome1",
]
let equipment_names = [ let equipment_names = [
"Helmet", "Helmet",
"Chestplate", "Chestplate",
@ -72,8 +81,19 @@ let equipment_names = [
"Necklace", "Necklace",
"Weapon" "Weapon"
]; ];
let tome_names = [
"Weapon Tome",
"Weapon Tome",
"Armor Tome",
"Armor Tome",
"Armor Tome",
"Armor Tome",
"Guild Tome",
]
let equipmentInputs = equipment_fields.map(x => x + "-choice"); let equipmentInputs = equipment_fields.map(x => x + "-choice");
let buildFields = equipment_fields.map(x => x+"-tooltip"); let buildFields = equipment_fields.map(x => x+"-tooltip").concat(tome_fields.map(x => x + "-tooltip"));
let tomeInputs = tome_fields.map(x => x + "-choice");
let powderInputs = [ let powderInputs = [
"helmet-powder", "helmet-powder",
@ -83,15 +103,6 @@ let powderInputs = [
"weapon-powder", "weapon-powder",
]; ];
function init() {
console.log("builder.js init");
init_autocomplete();
decodeBuild(url_tag);
for (const i of equipment_keys) {
update_field(i);
}
}
function getItemNameFromID(id) { function getItemNameFromID(id) {
if (redirectMap.has(id)) { if (redirectMap.has(id)) {
return getItemNameFromID(redirectMap.get(id)); return getItemNameFromID(redirectMap.get(id));
@ -224,6 +235,10 @@ function encodeBuild() {
let crafted_idx = 0; let crafted_idx = 0;
let custom_idx = 0; let custom_idx = 0;
for (const item of player_build.items) { for (const item of player_build.items) {
//skip tomes (do we skip them?)
if (item.category === "tome") {
continue;
}
if (item.get("custom")) { if (item.get("custom")) {
let custom = "CI-"+encodeCustom(player_build.customItems[custom_idx],true); let custom = "CI-"+encodeCustom(player_build.customItems[custom_idx],true);
@ -260,6 +275,11 @@ function encodeBuild() {
build_string = "4_"; build_string = "4_";
let crafted_idx = 0; let crafted_idx = 0;
for (const item of player_build.items) { for (const item of player_build.items) {
//skip tomes for now
if (item.get("category") === "tome") {
continue;
}
if (item.get("crafted")) { if (item.get("crafted")) {
build_string += "-"+encodeCraft(player_build.craftedItems[crafted_idx]); build_string += "-"+encodeCraft(player_build.craftedItems[crafted_idx]);
crafted_idx += 1; crafted_idx += 1;
@ -312,6 +332,7 @@ function calculateBuild(save_skp, skp){
updatePowderSpecials("skip", false); updatePowderSpecials("skip", false);
} }
let weaponName = getValue(equipmentInputs[8]); let weaponName = getValue(equipmentInputs[8]);
//bruh @hpp
if (weaponName.startsWith("Morph-")) { if (weaponName.startsWith("Morph-")) {
let equipment = [ "Morph-Stardust", "Morph-Steel", "Morph-Iron", "Morph-Gold", "Morph-Topaz", "Morph-Emerald", "Morph-Amethyst", "Morph-Ruby", weaponName.substring(6) ]; let equipment = [ "Morph-Stardust", "Morph-Steel", "Morph-Iron", "Morph-Gold", "Morph-Topaz", "Morph-Emerald", "Morph-Amethyst", "Morph-Ruby", weaponName.substring(6) ];
for (let i in equipment) { for (let i in equipment) {
@ -362,11 +383,24 @@ function calculateBuild(save_skp, skp){
//console.log("POWDERING: " + powdering); //console.log("POWDERING: " + powdering);
powderings.push(powdering); powderings.push(powdering);
} }
let tomes = [ null, null, null, null, null, null, null];
for (let i in tomes) {
let equip = getValue(tomeInputs[i]).trim();
if (equip === "") {
equip = "No " + tome_names[i]
}
else {
setValue(tomeInputs[i], equip);
}
tomes[i] = equip;
}
let level = document.getElementById("level-choice").value; let level = document.getElementById("level-choice").value;
player_build = new Build(level, equipment, powderings, new Map(), errors); player_build = new Build(level, equipment, powderings, new Map(), errors, tomes);
console.log(player_build); console.log(player_build);
//isn't this deprecated?
for (let i of document.getElementsByClassName("hide-container-block")) { for (let i of document.getElementsByClassName("hide-container-block")) {
i.style.display = "block"; i.style.display = "block";
} }
@ -1080,7 +1114,20 @@ function optimizeStrDex() {
} }
// TODO: Learn and use await // TODO: Learn and use await
function init() {
console.log("builder.js init");
init_autocomplete();
decodeBuild(url_tag);
for (const i of equipment_keys) {
update_field(i);
}
}
function init2() { function init2() {
load_ing_init(init); load_ing_init(init);
} }
load_init(init2); function init3() {
load_tome_init(init2)
}
load_init(init3);

View file

@ -451,7 +451,12 @@ function displaysq2ExpandedItem(item, parent_id){
let item_desc_elem = document.createElement("div"); let item_desc_elem = document.createElement("div");
item_desc_elem.classList.add("col"); item_desc_elem.classList.add("col");
item_desc_elem.classList.add(item.get("tier")); item_desc_elem.classList.add(item.get("tier"));
if (tome_types.includes(item.get("type"))) {
tome_type_map = new Map([["weaponTome", "Weapon Tome"],["armorTome", "Armor Tome"],["guildTome", "Guild Tome"]]);
item_desc_elem.textContent = item.get("tier")+" "+tome_type_map.get(item.get("type"));
} else {
item_desc_elem.textContent = item.get("tier")+" "+item.get("type"); item_desc_elem.textContent = item.get("tier")+" "+item.get("type");
}
parent_div.append(item_desc_elem); parent_div.append(item_desc_elem);
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

View file

@ -1,3 +1,5 @@
{
"tomes":
[ [
{ {
"name": "Retaliating Tome of Armour Mastery I", "name": "Retaliating Tome of Armour Mastery I",
@ -5,7 +7,7 @@
"type": "armorTome", "type": "armorTome",
"category": "tome", "category": "tome",
"drop": "never", "drop": "never",
"restrict": "Soulbound", "restrict": "Soulbound Item",
"lvl": 60, "lvl": 60,
"thorns": 6, "thorns": 6,
"ref": 6, "ref": 6,
@ -19,7 +21,7 @@
"type": "armorTome", "type": "armorTome",
"category": "tome", "category": "tome",
"drop": "never", "drop": "never",
"restrict": "Soulbound", "restrict": "Soulbound Item",
"lvl": 100, "lvl": 100,
"thorns": 8, "thorns": 8,
"ref": 8, "ref": 8,
@ -32,7 +34,7 @@
"type": "armorTome", "type": "armorTome",
"category": "tome", "category": "tome",
"drop": "never", "drop": "never",
"restrict": "Soulbound", "restrict": "Soulbound Item",
"lvl": 60, "lvl": 60,
"exploding": 5, "exploding": 5,
"mdPct": 5, "mdPct": 5,
@ -46,7 +48,7 @@
"type": "armorTome", "type": "armorTome",
"category": "tome", "category": "tome",
"drop": "never", "drop": "never",
"restrict": "Soulbound", "restrict": "Soulbound Item",
"lvl": 100, "lvl": 100,
"thorns": 6, "thorns": 6,
"reflection": 6, "reflection": 6,
@ -59,7 +61,7 @@
"type": "armorTome", "type": "armorTome",
"category": "tome", "category": "tome",
"drop": "never", "drop": "never",
"restrict": "Soulbound", "restrict": "Soulbound Item",
"lvl": 60, "lvl": 60,
"sdPct": 5, "sdPct": 5,
"hpBonus": 120, "hpBonus": 120,
@ -72,7 +74,7 @@
"type": "armorTome", "type": "armorTome",
"category": "tome", "category": "tome",
"drop": "never", "drop": "never",
"restrict": "Soulbound", "restrict": "Soulbound Item",
"lvl": 100, "lvl": 100,
"sdPct": 6, "sdPct": 6,
"fixID": false, "fixID": false,
@ -84,7 +86,7 @@
"type": "armorTome", "type": "armorTome",
"category": "tome", "category": "tome",
"drop": "never", "drop": "never",
"restrict": "Soulbound", "restrict": "Soulbound Item",
"lvl": 60, "lvl": 60,
"hprRaw": 15, "hprRaw": 15,
"hpBonus": 120, "hpBonus": 120,
@ -97,7 +99,7 @@
"type": "armorTome", "type": "armorTome",
"category": "tome", "category": "tome",
"drop": "never", "drop": "never",
"restrict": "Soulbound", "restrict": "Soulbound Item",
"lvl": 100, "lvl": 100,
"hprRaw": 60, "hprRaw": 60,
"fixID": false, "fixID": false,
@ -109,7 +111,7 @@
"type": "armorTome", "type": "armorTome",
"category": "tome", "category": "tome",
"drop": "never", "drop": "never",
"restrict": "Soulbound", "restrict": "Soulbound Item",
"lvl": 60, "lvl": 60,
"ls": 25, "ls": 25,
"hpBonus": 120, "hpBonus": 120,
@ -122,7 +124,7 @@
"type": "armorTome", "type": "armorTome",
"category": "tome", "category": "tome",
"drop": "never", "drop": "never",
"restrict": "Soulbound", "restrict": "Soulbound Item",
"lvl": 100, "lvl": 100,
"ls": 85, "ls": 85,
"fixID": false, "fixID": false,
@ -134,7 +136,7 @@
"type": "armorTome", "type": "armorTome",
"category": "tome", "category": "tome",
"drop": "never", "drop": "never",
"restrict": "Soulbound", "restrict": "Soulbound Item",
"lvl": 60, "lvl": 60,
"lb": 5, "lb": 5,
"hpBonus": 120, "hpBonus": 120,
@ -147,7 +149,7 @@
"type": "armorTome", "type": "armorTome",
"category": "tome", "category": "tome",
"drop": "never", "drop": "never",
"restrict": "Soulbound", "restrict": "Soulbound Item",
"lvl": 100, "lvl": 100,
"lb": 6, "lb": 6,
"fixID": false, "fixID": false,
@ -159,7 +161,7 @@
"type": "armorTome", "type": "armorTome",
"category": "tome", "category": "tome",
"drop": "never", "drop": "never",
"restrict": "Soulbound", "restrict": "Soulbound Item",
"lvl": 60, "lvl": 60,
"spd": 5, "spd": 5,
"hpBonus": 120, "hpBonus": 120,
@ -172,7 +174,7 @@
"type": "armorTome", "type": "armorTome",
"category": "tome", "category": "tome",
"drop": "never", "drop": "never",
"restrict": "Soulbound", "restrict": "Soulbound Item",
"lvl": 100, "lvl": 100,
"spd": 6, "spd": 6,
"fixID": false, "fixID": false,
@ -184,7 +186,7 @@
"type": "armorTome", "type": "armorTome",
"category": "tome", "category": "tome",
"drop": "never", "drop": "never",
"restrict": "Soulbound", "restrict": "Soulbound Item",
"lvl": 100, "lvl": 100,
"eDefPct": 10, "eDefPct": 10,
"hpBonus": 150, "hpBonus": 150,
@ -197,7 +199,7 @@
"type": "armorTome", "type": "armorTome",
"category": "tome", "category": "tome",
"drop": "never", "drop": "never",
"restrict": "Soulbound", "restrict": "Soulbound Item",
"lvl": 100, "lvl": 100,
"tDefPct": 10, "tDefPct": 10,
"hpBonus": 150, "hpBonus": 150,
@ -210,7 +212,7 @@
"type": "armorTome", "type": "armorTome",
"category": "tome", "category": "tome",
"drop": "never", "drop": "never",
"restrict": "Soulbound", "restrict": "Soulbound Item",
"lvl": 100, "lvl": 100,
"wDefPct": 10, "wDefPct": 10,
"hpBonus": 150, "hpBonus": 150,
@ -223,7 +225,7 @@
"type": "armorTome", "type": "armorTome",
"category": "tome", "category": "tome",
"drop": "never", "drop": "never",
"restrict": "Soulbound", "restrict": "Soulbound Item",
"lvl": 100, "lvl": 100,
"fDefPct": 10, "fDefPct": 10,
"hpBonus": 150, "hpBonus": 150,
@ -236,7 +238,7 @@
"type": "armorTome", "type": "armorTome",
"category": "tome", "category": "tome",
"drop": "never", "drop": "never",
"restrict": "Soulbound", "restrict": "Soulbound Item",
"lvl": 100, "lvl": 100,
"aDefPct": 10, "aDefPct": 10,
"hpBonus": 150, "hpBonus": 150,
@ -249,7 +251,7 @@
"type": "armorTome", "type": "armorTome",
"category": "tome", "category": "tome",
"drop": "never", "drop": "never",
"restrict": "Soulbound", "restrict": "Soulbound Item",
"lvl": 100, "lvl": 100,
"eDefPct": 6, "eDefPct": 6,
"tDefPct": 6, "tDefPct": 6,
@ -266,7 +268,7 @@
"type": "weaponTome", "type": "weaponTome",
"category": "tome", "category": "tome",
"drop": "never", "drop": "never",
"restrict": "Soulbound", "restrict": "Soulbound Item",
"lvl": 60, "lvl": 60,
"dmgMobs": 6, "dmgMobs": 6,
"fixID": false, "fixID": false,
@ -278,7 +280,7 @@
"type": "weaponTome", "type": "weaponTome",
"category": "tome", "category": "tome",
"drop": "never", "drop": "never",
"restrict": "Soulbound", "restrict": "Soulbound Item",
"lvl": 80, "lvl": 80,
"dmgMobs": 7, "dmgMobs": 7,
"str": 3, "str": 3,
@ -291,7 +293,7 @@
"type": "weaponTome", "type": "weaponTome",
"category": "tome", "category": "tome",
"drop": "never", "drop": "never",
"restrict": "Soulbound", "restrict": "Soulbound Item",
"lvl": 80, "lvl": 80,
"dmgMobs": 8, "dmgMobs": 8,
"str": 3, "str": 3,
@ -304,7 +306,7 @@
"type": "weaponTome", "type": "weaponTome",
"category": "tome", "category": "tome",
"drop": "never", "drop": "never",
"restrict": "Soulbound", "restrict": "Soulbound Item",
"lvl": 80, "lvl": 80,
"dmgMobs": 7, "dmgMobs": 7,
"dex": 3, "dex": 3,
@ -317,7 +319,7 @@
"type": "weaponTome", "type": "weaponTome",
"category": "tome", "category": "tome",
"drop": "never", "drop": "never",
"restrict": "Soulbound", "restrict": "Soulbound Item",
"lvl": 80, "lvl": 80,
"dmgMobs": 8, "dmgMobs": 8,
"dex": 3, "dex": 3,
@ -330,7 +332,7 @@
"type": "weaponTome", "type": "weaponTome",
"category": "tome", "category": "tome",
"drop": "never", "drop": "never",
"restrict": "Soulbound", "restrict": "Soulbound Item",
"lvl": 80, "lvl": 80,
"dmgMobs": 7, "dmgMobs": 7,
"int": 3, "int": 3,
@ -343,7 +345,7 @@
"type": "weaponTome", "type": "weaponTome",
"category": "tome", "category": "tome",
"drop": "never", "drop": "never",
"restrict": "Soulbound", "restrict": "Soulbound Item",
"lvl": 80, "lvl": 80,
"dmgMobs": 8, "dmgMobs": 8,
"int": 3, "int": 3,
@ -356,7 +358,7 @@
"type": "weaponTome", "type": "weaponTome",
"category": "tome", "category": "tome",
"drop": "never", "drop": "never",
"restrict": "Soulbound", "restrict": "Soulbound Item",
"lvl": 80, "lvl": 80,
"dmgMobs": 7, "dmgMobs": 7,
"def": 3, "def": 3,
@ -369,7 +371,7 @@
"type": "weaponTome", "type": "weaponTome",
"category": "tome", "category": "tome",
"drop": "never", "drop": "never",
"restrict": "Soulbound", "restrict": "Soulbound Item",
"lvl": 80, "lvl": 80,
"dmgMobs": 8, "dmgMobs": 8,
"def": 3, "def": 3,
@ -382,7 +384,7 @@
"type": "weaponTome", "type": "weaponTome",
"category": "tome", "category": "tome",
"drop": "never", "drop": "never",
"restrict": "Soulbound", "restrict": "Soulbound Item",
"lvl": 80, "lvl": 80,
"dmgMobs": 7, "dmgMobs": 7,
"agi": 3, "agi": 3,
@ -395,7 +397,7 @@
"type": "weaponTome", "type": "weaponTome",
"category": "tome", "category": "tome",
"drop": "never", "drop": "never",
"restrict": "Soulbound", "restrict": "Soulbound Item",
"lvl": 80, "lvl": 80,
"dmgMobs": 8, "dmgMobs": 8,
"agi": 3, "agi": 3,
@ -408,7 +410,7 @@
"type": "weaponTome", "type": "weaponTome",
"category": "tome", "category": "tome",
"drop": "never", "drop": "never",
"restrict": "Soulbound", "restrict": "Soulbound Item",
"lvl": 80, "lvl": 80,
"dmgMobs": 7, "dmgMobs": 7,
"str": 1, "str": 1,
@ -425,7 +427,7 @@
"type": "weaponTome", "type": "weaponTome",
"category": "tome", "category": "tome",
"drop": "never", "drop": "never",
"restrict": "Soulbound", "restrict": "Soulbound Item",
"lvl": 80, "lvl": 80,
"dmgMobs": 8, "dmgMobs": 8,
"str": 1, "str": 1,
@ -442,7 +444,7 @@
"type": "weaponTome", "type": "weaponTome",
"category": "tome", "category": "tome",
"drop": "never", "drop": "never",
"restrict": "Soulbound", "restrict": "Soulbound Item",
"lvl": 80, "lvl": 80,
"dmgMobs": 12, "dmgMobs": 12,
"eDamPct": 7, "eDamPct": 7,
@ -455,7 +457,7 @@
"type": "weaponTome", "type": "weaponTome",
"category": "tome", "category": "tome",
"drop": "never", "drop": "never",
"restrict": "Soulbound", "restrict": "Soulbound Item",
"lvl": 80, "lvl": 80,
"dmgMobs": 12, "dmgMobs": 12,
"tDamPct": 7, "tDamPct": 7,
@ -468,7 +470,7 @@
"type": "weaponTome", "type": "weaponTome",
"category": "tome", "category": "tome",
"drop": "never", "drop": "never",
"restrict": "Soulbound", "restrict": "Soulbound Item",
"lvl": 80, "lvl": 80,
"dmgMobs": 12, "dmgMobs": 12,
"wDamPct": 7, "wDamPct": 7,
@ -481,7 +483,7 @@
"type": "weaponTome", "type": "weaponTome",
"category": "tome", "category": "tome",
"drop": "never", "drop": "never",
"restrict": "Soulbound", "restrict": "Soulbound Item",
"lvl": 80, "lvl": 80,
"dmgMobs": 12, "dmgMobs": 12,
"fDamPct": 7, "fDamPct": 7,
@ -494,7 +496,7 @@
"type": "weaponTome", "type": "weaponTome",
"category": "tome", "category": "tome",
"drop": "never", "drop": "never",
"restrict": "Soulbound", "restrict": "Soulbound Item",
"lvl": 80, "lvl": 80,
"dmgMobs": 12, "dmgMobs": 12,
"aDamPct": 7, "aDamPct": 7,
@ -507,7 +509,7 @@
"type": "weaponTome", "type": "weaponTome",
"category": "tome", "category": "tome",
"drop": "never", "drop": "never",
"restrict": "Soulbound", "restrict": "Soulbound Item",
"lvl": 80, "lvl": 80,
"dmgMobs": 12, "dmgMobs": 12,
"eDamPct": 6, "eDamPct": 6,
@ -730,3 +732,4 @@
"tomeID": 54 "tomeID": 54
} }
] ]
}