Add roll windows from actor sheet

This commit is contained in:
2026-03-15 23:20:32 +01:00
parent 82fddb0cb3
commit 49347370c7
57 changed files with 6372 additions and 184 deletions

View File

@@ -1,5 +1,6 @@
const { HandlebarsApplicationMixin } = foundry.applications.api
import { ARMOR_TYPE_CHOICES, WEAPON_PROFICIENCY_GROUPS } from "../../config/system.mjs"
import { rollRarityCheck } from "../../rolls.mjs"
export default class OathHammerItemSheet extends HandlebarsApplicationMixin(foundry.applications.sheets.ItemSheetV2) {
static SHEET_MODES = { EDIT: 0, PLAY: 1 }
@@ -28,6 +29,7 @@ export default class OathHammerItemSheet extends HandlebarsApplicationMixin(foun
actions: {
toggleSheet: OathHammerItemSheet.#onToggleSheet,
editImage: OathHammerItemSheet.#onEditImage,
rollRarity: OathHammerItemSheet.#onRollRarity,
},
}
@@ -134,4 +136,20 @@ export default class OathHammerItemSheet extends HandlebarsApplicationMixin(foun
})
return fp.browse()
}
static async #onRollRarity(event, target) {
const rarity = this.document.system.rarity
if (!rarity) return
// Find the owning actor (embedded item) or prompt user to select a character
let actor = this.document.parent
if (!actor || actor.documentName !== "Actor") {
// Item not embedded — use the user's selected character
actor = game.user.character
if (!actor) {
ui.notifications.warn(game.i18n.localize("OATHHAMMER.Roll.NoActor"))
return
}
}
await rollRarityCheck(actor, rarity, this.document.name)
}
}