Skip to content

Commit

Permalink
v2.4.2
Browse files Browse the repository at this point in the history
  • Loading branch information
TheGiddyLimit committed Nov 4, 2024
1 parent 982d0f1 commit 0341427
Show file tree
Hide file tree
Showing 21 changed files with 198 additions and 113 deletions.
2 changes: 1 addition & 1 deletion css/dmscreen.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion css/main.css

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions data/bestiary/bestiary-tftyp.json
Original file line number Diff line number Diff line change
Expand Up @@ -1457,6 +1457,9 @@
]
}
},
"attachedItems": [
"+2 greataxe"
],
"hasToken": true
},
{
Expand Down
7 changes: 6 additions & 1 deletion data/changelog.json
Original file line number Diff line number Diff line change
Expand Up @@ -2838,7 +2838,12 @@
},
{
"ver": "2.4.1",
"date": "2024-01-01",
"date": "2024-11-01",
"txt": "- Statgen now uses '24 \"Backgrounds and Species from Older Books\" rules when using \"Modern\" style\n- Fixed Statgen crash when selecting backgrounds with specific feat versions\n- (Fixed typos/added tags)"
},
{
"ver": "2.4.2",
"date": "2024-11-04",
"txt": "- Fixed Items page failing to render range for items with range but no ammunition\n- Fixed Bestiary failing to render \"mythic encounter\" XP\n- (Brew) Fixed Backgrounds page crash on `\"one\"`-edition background with no ability scores\n- (Fixed typos/added tags)"
}
]
4 changes: 2 additions & 2 deletions data/items-base.json
Original file line number Diff line number Diff line change
Expand Up @@ -3854,7 +3854,7 @@
"source": "XPHB",
"page": 213,
"freeRules2024": true,
"template": "{{prop_name}} ({{item.range}}\u00A0ft.)",
"template": "{{prop_name}} (Range {{item.range}}\u00A0ft.; {{item.ammoType}})",
"entries": [
{
"type": "entries",
Expand Down Expand Up @@ -4161,7 +4161,7 @@
"source": "XPHB",
"page": 214,
"freeRules2024": true,
"template": "{{prop_name}}",
"template": "{{prop_name}} ({{item.dmg2}})",
"entries": [
{
"type": "entries",
Expand Down
12 changes: 2 additions & 10 deletions data/items.json
Original file line number Diff line number Diff line change
Expand Up @@ -28785,8 +28785,6 @@
"weaponCategory": "martial",
"age": "renaissance",
"property": [
"AF|DMG",
"LD",
"2H"
],
"range": "40/120",
Expand All @@ -28801,8 +28799,7 @@
"type": "entries",
"name": "Invoking the Rune",
"entries": [
"As an action, you can invoke the weapon's rune to cast the {@spell sunbeam} spell (save DC 17) with it. Once the rune has been invoked, it can't be invoked again until the next dawn.",
"It's up to you to decide whether a character has proficiency with a firearm. Characters in most D&D worlds wouldn't have such proficiency. During their downtime, characters can use the training rules in the Player's Handbook to acquire proficiency, assuming that they have enough ammunition to keep the weapons working while mastering their use."
"As an action, you can invoke the weapon's rune to cast the {@spell sunbeam} spell (save DC 17) with it. Once the rune has been invoked, it can't be invoked again until the next dawn."
]
}
],
Expand Down Expand Up @@ -49739,10 +49736,6 @@
"weight": 3,
"weaponCategory": "martial",
"age": "renaissance",
"property": [
"AF|DMG",
"LD"
],
"range": "30/90",
"dmg1": "1d10",
"dmgType": "P",
Expand All @@ -49755,8 +49748,7 @@
"name": "Invoking the Rune",
"entries": [
"As a bonus action, you can invoke the weapon's rune to launch a ball of energy to a point you can see within 30 feet of yourself. The energy then detonates into a 10-foot-radius sphere of turbulent wind and thunder centered on that point, and each creature in that sphere must make a DC 14 Constitution saving throw. On a failed save, a creature takes {@damage 3d6} thunder damage, and it can't take reactions until the end of your next turn. On a successful save, a creature takes half as much damage only.",
"Once the rune has been invoked, it can't be invoked again until the next dawn.",
"It's up to you to decide whether a character has proficiency with a firearm. Characters in most D&D worlds wouldn't have such proficiency. During their downtime, characters can use the training rules in the Player's Handbook to acquire proficiency, assuming that they have enough ammunition to keep the weapons working while mastering their use."
"Once the rune has been invoked, it can't be invoked again until the next dawn."
]
}
],
Expand Down
2 changes: 1 addition & 1 deletion data/spells/spells-xphb.json
Original file line number Diff line number Diff line change
Expand Up @@ -6996,7 +6996,7 @@
"restrained"
],
"savingThrow": [
"dexterity"
"strength"
],
"abilityCheck": [
"strength"
Expand Down
24 changes: 13 additions & 11 deletions js/dmscreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -416,17 +416,19 @@ class Board {

exilePanel (id) {
const panelK = Object.keys(this.panels).find(k => this.panels[k].id === id);
if (panelK) {
const toExile = this.panels[panelK];
if (!toExile.getEmpty()) {
delete this.panels[panelK];
this.exiledPanels.unshift(toExile);
const toDestroy = this.exiledPanels.splice(10);
toDestroy.forEach(p => p.destroy());
this.sideMenu.doUpdateHistory();
} else this.destroyPanel(id);
this.doSaveStateDebounced();
if (!panelK) return;

const toExile = this.panels[panelK];
if (toExile.getEmpty()) {
this.destroyPanel(id);
} else {
delete this.panels[panelK];
this.exiledPanels.unshift(toExile);
const toDestroy = this.exiledPanels.splice(10);
toDestroy.forEach(p => p.destroy());
this.sideMenu.doUpdateHistory();
}
this.doSaveStateDebounced();
}

recallPanel (panel) {
Expand Down Expand Up @@ -839,7 +841,7 @@ class SideMenu {
});
renderDivider();

this.$wrpHistory = $(`<div class="sidemenu__history"></div>`).appendTo(this.$mnu);
this.$wrpHistory = $(`<div class="sidemenu__history ve-overflow-y-auto ve-overflow-x-hidden"></div>`).appendTo(this.$mnu);
}

doUpdateDimensions () {
Expand Down
5 changes: 3 additions & 2 deletions js/filter-backgrounds.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,9 @@ class PageFilterBackgrounds extends PageFilterBase {
if (bg.weaponProficiencies) bg._fOtherBenifits.push("Weapon Proficiencies");
bg._skillDisplay = skillDisplay;

const ability = Renderer.getAbilityData(bg.ability, {isOnlyShort: true, isBackgroundShortForm: bg.edition === "one"});
bg._slAbility = ability.asTextShort || VeCt.STR_NONE;
bg._slAbility = bg.ability
? (Renderer.getAbilityData(bg.ability, {isOnlyShort: true, isBackgroundShortForm: bg.edition === "one"}).asTextShort || VeCt.STR_NONE)
: VeCt.STR_NONE;

bg._fFeats = this._mutateForFilters_getFilterFeats(bg);
}
Expand Down
2 changes: 1 addition & 1 deletion js/filter-items.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class PageFilterEquipment extends PageFilterBase {
});
this._weightFilter = new RangeFilter({header: "Weight", min: 0, max: 100, isAllowGreater: true, suffix: " lb."});
this._focusFilter = new Filter({header: "Spellcasting Focus", items: [...Parser.ITEM_SPELLCASTING_FOCUS_CLASSES]});
this._damageTypeFilter = new Filter({header: "Weapon Damage Type", displayFn: it => Parser.dmgTypeToFull(it).uppercaseFirst(), itemSortFn: (a, b) => SortUtil.ascSortLower(Parser.dmgTypeToFull(a), Parser.dmgTypeToFull(b))});
this._damageTypeFilter = new Filter({header: "Weapon Damage Type", displayFn: it => Parser.dmgTypeToFull(it).uppercaseFirst(), itemSortFn: (a, b) => SortUtil.ascSortLower(Parser.dmgTypeToFull(a.item), Parser.dmgTypeToFull(b.item))});
this._damageDiceFilter = new Filter({header: "Weapon Damage Dice", items: ["1", "1d4", "1d6", "1d8", "1d10", "1d12", "2d6"], itemSortFn: (a, b) => PageFilterEquipment._sortDamageDice(a, b)});
this._acFilter = new RangeFilter({header: "Armor Class", displayFn: it => it === 0 ? "None" : it});
this._miscFilter = new Filter({
Expand Down
4 changes: 3 additions & 1 deletion js/items.js
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,9 @@ class ItemsPage extends ListPage {
rarity: {name: "Rarity"},
_type: {name: "Type", transform: it => [it._typeHtml || "", it._subTypeHtml || ""].filter(Boolean).join(", ")},
_attunement: {name: "Attunement", transform: it => it._attunement ? it._attunement.slice(1, it._attunement.length - 1) : ""},
_properties: {name: "Properties", transform: it => Renderer.item.getDamageAndPropertiesText(it).filter(Boolean).join(", ")},
_damage: {name: "Damage", transform: it => Renderer.item.getRenderedDamageAndProperties(it)[0]},
_properties: {name: "Properties", transform: it => Renderer.item.getRenderedDamageAndProperties(it)[1]},
_mastery: {name: "Mastery", transform: it => Renderer.item.getRenderedMastery(it)},
_weight: {name: "Weight", transform: it => Parser.itemWeightToFull(it)},
_value: {name: "Value", transform: it => Parser.itemValueToFullMultiCurrency(it)},
_entries: {name: "Text", transform: (it) => Renderer.item.getRenderedEntries(it, {isCompact: true}), flex: 3},
Expand Down
12 changes: 7 additions & 5 deletions js/makecards.js
Original file line number Diff line number Diff line change
Expand Up @@ -511,11 +511,12 @@ class MakeCards extends BaseComponent {
MakeCards.utils.enhanceItemAlt(item);

const [typeRarityText, subTypeText, tierText] = Renderer.item.getTypeRarityAndAttunementText(item);
const [damage, damageType, propertiesTxt] = Renderer.item.getDamageAndPropertiesText(item);
const [ptDamage, ptProperties] = Renderer.item.getRenderedDamageAndProperties(item);
const ptMastery = Renderer.item.getRenderedMastery(item, {isSkipPrefix: true});
const ptWeight = Parser.itemWeightToFull(item);
const ptValue = Parser.itemValueToFullMultiCurrency(item);
const ptDamage = this._ct_htmlToText([damage, damageType].filter(Boolean).join(" "));
const ptProperties = this._ct_htmlToText([propertiesTxt].filter(Boolean)).substring(2);
const ptDamageCt = this._ct_htmlToText(ptDamage);
const ptPropertiesCt = this._ct_htmlToText(ptProperties);

const itemEntries = [];
if (item._fullEntries || (item.entries && item.entries.length)) {
Expand All @@ -528,8 +529,9 @@ class MakeCards extends BaseComponent {

return [
typeRarityText ? this._ct_htmlToText(this._ct_subtitle(typeRarityText.uppercaseFirst())) : null,
ptDamage ? this._ct_property(ptDamage.startsWith("AC") ? "Armor Class" : "Damage", ptDamage) : null,
ptProperties ? this._ct_property("Properties", ptProperties.uppercaseFirst()) : null,
ptDamageCt ? this._ct_property(ptDamageCt.startsWith("AC") ? "Armor Class" : "Damage", ptDamageCt) : null,
ptPropertiesCt ? this._ct_property("Properties", ptPropertiesCt.uppercaseFirst()) : null,
ptMastery ? this._ct_property("Mastery", ptMastery) : null,
subTypeText ? this._ct_property("Type", subTypeText.uppercaseFirst()) : null,
tierText ? this._ct_property("Tier", tierText.uppercaseFirst()) : null,
ptWeight ? this._ct_property("Weight", ptWeight) : null,
Expand Down
10 changes: 8 additions & 2 deletions js/parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -1073,8 +1073,14 @@ Parser.weightValueToNumber = function (value) {
else throw new Error(`Badly formatted value ${value}`);
};

Parser.dmgTypeToFull = function (dmgType) {
return Parser._parse_aToB(Parser.DMGTYPE_JSON_TO_FULL, dmgType);
Parser.dmgTypeToFull = function (dmgType, {styleHint = null} = {}) {
if (!dmgType) return dmgType;

styleHint ||= VetoolsConfig.get("styleSwitcher", "style");

const out = Parser._parse_aToB(Parser.DMGTYPE_JSON_TO_FULL, dmgType);
if (styleHint !== "classic") return out.toTitleCase();
return out;
};

Parser.skillProficienciesToFull = function (skillProficiencies, {styleHint = null} = {}) {
Expand Down
26 changes: 20 additions & 6 deletions js/render-items.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,32 @@ export class RenderItems {
}

static $getRenderedItem (item) {
const [damage, damageType, propertiesTxt] = Renderer.item.getDamageAndPropertiesText(item);
const [ptDamage, ptProperties] = Renderer.item.getRenderedDamageAndProperties(item);
const ptMastery = Renderer.item.getRenderedMastery(item);
const [typeRarityText, subTypeText, tierText] = Renderer.item.getTypeRarityAndAttunementText(item);

let renderedText = Renderer.item.getRenderedEntries(item);
renderedText += this._getRenderedSeeAlso({item, prop: "seeAlsoDeck", tag: "deck"});
renderedText += this._getRenderedSeeAlso({item, prop: "seeAlsoVehicle", tag: "vehicle"});

const textLeft = [Parser.itemValueToFullMultiCurrency(item), Parser.itemWeightToFull(item)].filter(Boolean).join(", ").uppercaseFirst();
const textRight = [damage, damageType, propertiesTxt].filter(Boolean).join(" ");
const textRight = [
ptDamage,
ptProperties,
ptMastery,
]
.filter(Boolean)
.map(pt => `<div class="ve-text-wrap-balance ve-text-right">${pt.uppercaseFirst()}</div>`)
.join("");

const trTextLeftRight = textLeft && textRight
? `<tr>
<td colspan="2">${textLeft}</td>
<td class="ve-text-right" colspan="4">${textRight}</td>
</tr>`
: `<tr>
<td colspan="6">${textLeft || textRight}</td>
</tr>`;

return $$`
${Renderer.utils.getBorderTr()}
Expand All @@ -29,10 +46,7 @@ export class RenderItems {
<tr><td class="rd-item__type-rarity-attunement" colspan="6">${Renderer.item.getTypeRarityAndAttunementHtml(typeRarityText, subTypeText, tierText)}</td></tr>
${textLeft && textRight ? `<tr>
<td colspan="2">${textLeft}</td>
<td class="ve-text-right" colspan="4">${textRight}</td>
</tr>` : `<tr><td colspan="6" class="${textRight ? "ve-text-right" : ""}">${textLeft || textRight}</td></tr>`}
${trTextLeftRight}
${renderedText ? `<tr><td colspan="6" class="py-0"><div class="ve-tbl-divider"></div></td></tr>
<tr><td colspan="6">${renderedText}</td></tr>` : ""}
Expand Down
6 changes: 3 additions & 3 deletions js/render-markdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -1118,13 +1118,13 @@ RendererMarkdown.item = class {

const subStack = [""];

const [damage, damageType, propertiesTxt] = Renderer.item.getDamageAndPropertiesText(item, {renderer: RendererMarkdown.get()});
const [ptDamage, ptProperties] = Renderer.item.getRenderedDamageAndProperties(item, {renderer: RendererMarkdown.get()});
const ptMastery = Renderer.item.getRenderedMastery(item, {renderer: RendererMarkdown.get()});
const [typeRarityText, subTypeText, tierText] = RendererMarkdown.item.getTypeRarityAndAttunementText(item);

const typeRarityTierValueWeight = [typeRarityText, subTypeText, tierText, Parser.itemValueToFullMultiCurrency(item), Parser.itemWeightToFull(item)].filter(Boolean).join(", ").uppercaseFirst();
const damageProperties = [damage, damageType, propertiesTxt].filter(Boolean).join(" ").uppercaseFirst();

const ptSubtitle = [typeRarityTierValueWeight, damageProperties].filter(Boolean).join("\n\n");
const ptSubtitle = [typeRarityTierValueWeight, ptDamage, ptProperties, ptMastery].filter(Boolean).join("\n\n");

subStack[0] += `#### ${item._displayName || item.name}${ptSubtitle ? `\n\n${ptSubtitle}` : ""}\n\n${ptSubtitle ? `---\n\n` : ""}`;

Expand Down
Loading

0 comments on commit 0341427

Please sign in to comment.