Skip to content

Commit

Permalink
Add gear section from 2024 statblocks when available
Browse files Browse the repository at this point in the history
  • Loading branch information
Azmoria committed Feb 13, 2025
1 parent 406b5a4 commit 8577039
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
2 changes: 2 additions & 0 deletions EncounterHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,15 @@ async function fetch_monsters(monsterIds, callback, open5e=false) {
return this.href;
})
treasure = treasure.html();
let gear = $(moreInfo)?.find('.mon-stat-block-2024__tidbit-label:contains("Gear")').siblings('.mon-stat-block-2024__tidbit-data').html();
if(initiative.length>0){
initArray = initiative.trim().split(' ');
const initMod = initArray[0];
const initScore = initArray[1];
monsterData[i].initiativeMod = initMod;
monsterData[i].initiativeScore = initScore;
monsterData[i].treasure = treasure;
monsterData[i].gear = gear;
}
resolve();
}))
Expand Down
31 changes: 31 additions & 0 deletions MonsterStatBlock.js
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,12 @@ function build_monster_stat_block(statBlock, token) {
${statBlock.skillsHtml}
</span>
</div>
<div class="mon-stat-block__tidbit ddbc-creature-block__tidbit">
<span class="mon-stat-block__tidbit-label ddbc-creature-block__tidbit-label">Gear</span>
<span class="mon-stat-block__tidbit-data">
${statBlock.gearHtml}
</span>
</div>
<div class="mon-stat-block__tidbit ddbc-creature-block__tidbit">
<span class="mon-stat-block__tidbit-label ddbc-creature-block__tidbit-label">Damage Vulnerabilities</span>
<span class="mon-stat-block__tidbit-data">
Expand Down Expand Up @@ -603,6 +609,12 @@ function build_monster_stat_block(statBlock, token) {
${statBlock.skillsHtml}
</span>
</div>
<div class="mon-stat-block__tidbit ddbc-creature-block__tidbit">
<span class="mon-stat-block__tidbit-label ddbc-creature-block__tidbit-label">Gear</span>
<span class="mon-stat-block__tidbit-data">
${statBlock.gearHtml}
</span>
</div>
<div class="mon-stat-block__tidbit ddbc-creature-block__tidbit">
<span class="mon-stat-block__tidbit-label ddbc-creature-block__tidbit-label">Damage Vulnerabilities</span>
<span class="mon-stat-block__tidbit-data">
Expand Down Expand Up @@ -897,6 +909,12 @@ function build_monster_copy_stat_block(statBlock) {
${statBlock.skillsHtml}
</span>
</div>
<div class="mon-stat-block__tidbit ddbc-creature-block__tidbit">
<span class="mon-stat-block__tidbit-label ddbc-creature-block__tidbit-label">Gear</span>
<span class="mon-stat-block__tidbit-data">
${statBlock.gearHtml}
</span>
</div>
<div class="mon-stat-block__tidbit ddbc-creature-block__tidbit">
<span class="mon-stat-block__tidbit-label ddbc-creature-block__tidbit-label">Damage Vulnerabilities</span>
<span class="mon-stat-block__tidbit-data">
Expand Down Expand Up @@ -1144,6 +1162,12 @@ function build_monster_copy_stat_block(statBlock) {
${statBlock.skillsHtml}
</span>
</div>
<div class="mon-stat-block__tidbit ddbc-creature-block__tidbit">
<span class="mon-stat-block__tidbit-label ddbc-creature-block__tidbit-label">Gear</span>
<span class="mon-stat-block__tidbit-data">
${statBlock.gearHtml}
</span>
</div>
<div class="mon-stat-block__tidbit ddbc-creature-block__tidbit">
<span class="mon-stat-block__tidbit-label ddbc-creature-block__tidbit-label">Damage Vulnerabilities</span>
<span class="mon-stat-block__tidbit-data">
Expand Down Expand Up @@ -1446,6 +1470,13 @@ class MonsterStatBlock {
.join(", ");
}

get gearHtml() {
if (!this.data.gear || this.data.gear.length === 0) {
return "<span class='hideme'></span>";
}
return this.data.gear
}

damageAdjustmentsHtml(damageAdjustmentType) {
if (!this.data.damageAdjustments || this.data.damageAdjustments.length === 0) {
return "<span class='hideme'></span>";
Expand Down

0 comments on commit 8577039

Please sign in to comment.