Portraits et corrections sur valeurs des PNJ
Some checks failed
Release Creation / build (release) Failing after 1m24s
Some checks failed
Release Creation / build (release) Failing after 1m24s
This commit is contained in:
@@ -34,6 +34,7 @@ export default class CelestopolActorSheet extends HandlebarsApplicationMixin(fou
|
||||
dragDrop: [{ dragSelector: '[data-drag="true"], .rollable', dropSelector: null }],
|
||||
actions: {
|
||||
editImage: CelestopolActorSheet.#onEditImage,
|
||||
sendBiographyPortrait: CelestopolActorSheet.#onSendBiographyPortrait,
|
||||
toggleSheet: CelestopolActorSheet.#onToggleSheet,
|
||||
edit: CelestopolActorSheet.#onItemEdit,
|
||||
delete: CelestopolActorSheet.#onItemDelete,
|
||||
@@ -136,6 +137,35 @@ export default class CelestopolActorSheet extends HandlebarsApplicationMixin(fou
|
||||
return fp.browse()
|
||||
}
|
||||
|
||||
static async #onSendBiographyPortrait() {
|
||||
const portrait = this.document.system?.portraitImage || ""
|
||||
if (!portrait) {
|
||||
ui.notifications.warn(game.i18n.localize("CELESTOPOL.Actor.portraitImageMissing"))
|
||||
return
|
||||
}
|
||||
|
||||
const rawContent = `
|
||||
<div class="cel-portrait-message chat-system-card">
|
||||
<div class="portrait-message-header">
|
||||
<span class="portrait-message-mark">✦</span>
|
||||
<span class="portrait-message-title">${game.i18n.localize("CELESTOPOL.Actor.portraitChatTitle")}</span>
|
||||
</div>
|
||||
<div class="portrait-message-body">
|
||||
<div class="portrait-message-name">${foundry.utils.escapeHTML(this.document.name)}</div>
|
||||
<div class="portrait-message-frame">
|
||||
<img src="${portrait}" alt="${foundry.utils.escapeHTML(this.document.name)}" class="portrait-message-image">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
`
|
||||
|
||||
await ChatMessage.create({
|
||||
speaker: ChatMessage.getSpeaker({ actor: this.document }),
|
||||
style: CONST.CHAT_MESSAGE_STYLES.OTHER,
|
||||
content: await foundry.applications.ux.TextEditor.implementation.enrichHTML(rawContent, { async: true }),
|
||||
})
|
||||
}
|
||||
|
||||
static #onToggleSheet() {
|
||||
const modes = this.constructor.SHEET_MODES
|
||||
this._sheetMode = this.isEditMode ? modes.PLAY : modes.EDIT
|
||||
|
||||
@@ -159,10 +159,14 @@ export default class CelestopolCharacterSheet extends CelestopolActorSheet {
|
||||
case "biography":
|
||||
context.tab = context.tabs.biography
|
||||
context.xpLogEmpty = (doc.system.xp?.log?.length ?? 0) === 0
|
||||
context.biographyPortrait = doc.system.portraitImage || ""
|
||||
context.hasBiographyPortrait = !!doc.system.portraitImage
|
||||
context.enrichedDescriptionPhysique = await foundry.applications.ux.TextEditor.implementation.enrichHTML(
|
||||
doc.system.descriptionPhysique, { relativeTo: this.document })
|
||||
context.enrichedDescriptionPsychologique = await foundry.applications.ux.TextEditor.implementation.enrichHTML(
|
||||
doc.system.descriptionPsychologique, { relativeTo: this.document })
|
||||
context.enrichedHistorique = await foundry.applications.ux.TextEditor.implementation.enrichHTML(
|
||||
doc.system.historique, { relativeTo: this.document })
|
||||
context.enrichedNotes = await foundry.applications.ux.TextEditor.implementation.enrichHTML(
|
||||
doc.system.notes, { relativeTo: this.document })
|
||||
break
|
||||
|
||||
@@ -111,6 +111,8 @@ export default class CelestopolNPCSheet extends CelestopolActorSheet {
|
||||
break
|
||||
case "biographie":
|
||||
context.tab = context.tabs.biographie
|
||||
context.biographyPortrait = context.system.portraitImage || ""
|
||||
context.hasBiographyPortrait = !!context.system.portraitImage
|
||||
context.enrichedHistoire = await foundry.applications.ux.TextEditor.implementation.enrichHTML(
|
||||
context.system.histoire, { relativeTo: this.document }
|
||||
)
|
||||
|
||||
@@ -127,9 +127,11 @@ export default class CelestopolCharacter extends foundry.abstract.TypeDataModel
|
||||
})
|
||||
|
||||
// Description & notes
|
||||
schema.descriptionPhysique = new fields.HTMLField({ required: true, textSearch: true })
|
||||
schema.descriptionPhysique = new fields.HTMLField({ required: true, textSearch: true })
|
||||
schema.descriptionPsychologique = new fields.HTMLField({ required: true, textSearch: true })
|
||||
schema.notes = new fields.HTMLField({ required: true, textSearch: true })
|
||||
schema.historique = new fields.HTMLField({ required: true, initial: "", textSearch: true })
|
||||
schema.portraitImage = new fields.StringField({ required: true, nullable: false, initial: "" })
|
||||
schema.notes = new fields.HTMLField({ required: true, textSearch: true })
|
||||
|
||||
// Données biographiques
|
||||
schema.biodata = new fields.SchemaField({
|
||||
|
||||
@@ -34,7 +34,7 @@ export default class CelestopolNPC extends foundry.abstract.TypeDataModel {
|
||||
// PNJs : 4 domaines uniquement (pas de sous-compétences)
|
||||
const domainField = (statId) => new fields.SchemaField({
|
||||
label: new fields.StringField({ required: true, initial: SYSTEM.STATS[statId].label }),
|
||||
res: new fields.NumberField({ ...reqInt, initial: 0, min: 0, max: 8 }),
|
||||
res: new fields.NumberField({ ...reqInt, initial: 0, min: 0 }),
|
||||
actuel: new fields.NumberField({ ...reqInt, initial: 0, min: 0 }),
|
||||
})
|
||||
|
||||
@@ -51,6 +51,7 @@ export default class CelestopolNPC extends foundry.abstract.TypeDataModel {
|
||||
|
||||
schema.histoire = new fields.HTMLField({ required: true, textSearch: true })
|
||||
schema.descriptionPhysique = new fields.HTMLField({ required: true, textSearch: true })
|
||||
schema.portraitImage = new fields.StringField({ required: true, nullable: false, initial: "" })
|
||||
schema.notes = new fields.HTMLField({ required: true, textSearch: true })
|
||||
|
||||
return schema
|
||||
|
||||
Reference in New Issue
Block a user