DIvers rework de CSS/LESS et améliorations de messages/layout
This commit is contained in:
@@ -32,9 +32,11 @@ export default class LesOubliesActorSheet extends HandlebarsApplicationMixin(fou
|
||||
rollSkill: LesOubliesActorSheet.#onRollSkill,
|
||||
useWeapon: LesOubliesActorSheet.#onUseWeapon,
|
||||
resolveWeaponDamage: LesOubliesActorSheet.#onResolveWeaponDamage,
|
||||
toggleEquipped: LesOubliesActorSheet.#onToggleEquipped,
|
||||
useSpell: LesOubliesActorSheet.#onUseSpell,
|
||||
openCombatPreset: LesOubliesActorSheet.#onOpenCombatPreset,
|
||||
openThreadHarvest: LesOubliesActorSheet.#onOpenThreadHarvest,
|
||||
openLinkedActor: LesOubliesActorSheet.#onOpenLinkedActor,
|
||||
},
|
||||
}
|
||||
|
||||
@@ -49,6 +51,14 @@ export default class LesOubliesActorSheet extends HandlebarsApplicationMixin(fou
|
||||
}
|
||||
|
||||
async _prepareContext() {
|
||||
const config = CONFIG.LESOUBLIES
|
||||
const enriched = await LesOubliesUtility.prepareEnrichedHtml("Actor", this.document.type, this.document.system)
|
||||
const choiceSets = {
|
||||
profileOptions: config.profiles.map((profile) => ({ value: profile.id, label: profile.label })),
|
||||
personnageSizeOptions: LesOubliesUtility.createRangeChoices(1, 4, config.sizes),
|
||||
creatureSizeOptions: LesOubliesUtility.createRangeChoices(1, 8, config.sizes),
|
||||
}
|
||||
|
||||
return {
|
||||
actor: this.document,
|
||||
system: this.document.system,
|
||||
@@ -59,8 +69,10 @@ export default class LesOubliesActorSheet extends HandlebarsApplicationMixin(fou
|
||||
isEditMode: this.isEditMode,
|
||||
isPlayMode: this.isPlayMode,
|
||||
isGM: game.user.isGM,
|
||||
config: CONFIG.LESOUBLIES,
|
||||
enrichedDescription: await foundry.applications.ux.TextEditor.implementation.enrichHTML(this.document.system.biodata?.description ?? this.document.system.description ?? "", { async: true }),
|
||||
config,
|
||||
choiceSets,
|
||||
enriched,
|
||||
enrichedDescription: foundry.utils.getProperty(enriched, "biodata.description") ?? foundry.utils.getProperty(enriched, "description") ?? "",
|
||||
}
|
||||
}
|
||||
|
||||
@@ -99,6 +111,7 @@ export default class LesOubliesActorSheet extends HandlebarsApplicationMixin(fou
|
||||
static async #onEditImage(event, target) {
|
||||
const attr = target.dataset.edit
|
||||
const current = foundry.utils.getProperty(this.document, attr)
|
||||
const FilePicker = foundry.applications.apps.FilePicker.implementation
|
||||
const fp = new FilePicker({
|
||||
current,
|
||||
type: "image",
|
||||
@@ -113,11 +126,17 @@ export default class LesOubliesActorSheet extends HandlebarsApplicationMixin(fou
|
||||
const type = target.dataset.type
|
||||
if (!type) return
|
||||
const label = game.i18n.localize(`TYPES.Item.${type}`)
|
||||
return this.document.createEmbeddedDocuments("Item", [{
|
||||
const itemData = {
|
||||
name: label,
|
||||
type,
|
||||
img: LesOubliesUtility.getDefaultItemImage(type),
|
||||
}])
|
||||
}
|
||||
if (type === "competence") {
|
||||
itemData.system = {
|
||||
profileKey: CONFIG.LESOUBLIES.profiles[0]?.id ?? "",
|
||||
}
|
||||
}
|
||||
return this.document.createEmbeddedDocuments("Item", [itemData])
|
||||
}
|
||||
|
||||
static async #onEditItem(event, target) {
|
||||
@@ -168,6 +187,14 @@ export default class LesOubliesActorSheet extends HandlebarsApplicationMixin(fou
|
||||
await this.document.openDamageDialog({ itemId })
|
||||
}
|
||||
|
||||
static async #onToggleEquipped(event, target) {
|
||||
const itemId = target.dataset.itemId
|
||||
if (!itemId) return
|
||||
const item = this.document.items.get(itemId)
|
||||
if (!item || !("equipped" in (item.system ?? {}))) return
|
||||
await item.update({ "system.equipped": !item.system.equipped })
|
||||
}
|
||||
|
||||
static async #onUseSpell(event, target) {
|
||||
const itemId = target.dataset.itemId
|
||||
if (!itemId) return
|
||||
@@ -183,4 +210,11 @@ export default class LesOubliesActorSheet extends HandlebarsApplicationMixin(fou
|
||||
static async #onOpenThreadHarvest() {
|
||||
await this.document.openThreadHarvestDialog()
|
||||
}
|
||||
|
||||
static async #onOpenLinkedActor(event, target) {
|
||||
const actorId = target.dataset.actorId
|
||||
if (!actorId) return
|
||||
const actor = game.actors.get(actorId)
|
||||
if (actor) actor.sheet.render(true)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user