DIvers rework de CSS/LESS et améliorations de messages/layout
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
const { HandlebarsApplicationMixin } = foundry.applications.api
|
||||
|
||||
import { LesOubliesUtility } from "../../les-oublies-utility.js"
|
||||
|
||||
export default class LesOubliesItemSheet extends HandlebarsApplicationMixin(foundry.applications.sheets.ItemSheetV2) {
|
||||
static SHEET_MODES = { EDIT: 0, PLAY: 1 }
|
||||
|
||||
@@ -33,6 +35,62 @@ export default class LesOubliesItemSheet extends HandlebarsApplicationMixin(foun
|
||||
}
|
||||
|
||||
async _prepareContext() {
|
||||
const config = CONFIG.LESOUBLIES
|
||||
const enriched = await LesOubliesUtility.prepareEnrichedHtml("Item", this.document.type, this.document.system)
|
||||
const skillLabels = Object.fromEntries(Object.entries(config.skills).map(([key, skill]) => [key, skill.label]))
|
||||
const choiceSets = {
|
||||
profileOptions: config.profiles.map((profile) => ({ value: profile.id, label: profile.label })),
|
||||
skillOptions: LesOubliesUtility.createChoices(Object.keys(config.skills), skillLabels),
|
||||
spellSkillOptions: LesOubliesUtility.createChoices(["magie", "onirologie", "chimerisme"], skillLabels),
|
||||
weaponCategoryOptions: LesOubliesUtility.ensureChoice(
|
||||
LesOubliesUtility.createChoices(Object.keys(config.weaponCategoryLabels), config.weaponCategoryLabels),
|
||||
this.document.system.category,
|
||||
),
|
||||
weaponOriginOptions: LesOubliesUtility.ensureChoice(
|
||||
LesOubliesUtility.createChoices(Object.keys(config.weaponOriginLabels), config.weaponOriginLabels),
|
||||
this.document.system.origin,
|
||||
),
|
||||
armorStateOptions: LesOubliesUtility.ensureChoice(
|
||||
LesOubliesUtility.createChoices(Object.keys(config.armorStateLabels), config.armorStateLabels),
|
||||
this.document.system.state,
|
||||
),
|
||||
equipmentCategoryOptions: LesOubliesUtility.ensureChoice(
|
||||
LesOubliesUtility.createChoices(Object.keys(config.equipmentCategoryLabels), config.equipmentCategoryLabels),
|
||||
this.document.system.category,
|
||||
),
|
||||
spellTraditionOptions: LesOubliesUtility.ensureChoice(
|
||||
LesOubliesUtility.createChoices(Object.keys(config.spellTraditionLabels), config.spellTraditionLabels),
|
||||
this.document.system.tradition,
|
||||
),
|
||||
polarityOptions: LesOubliesUtility.ensureChoice(
|
||||
LesOubliesUtility.createChoices(Object.keys(config.polarityLabels), config.polarityLabels),
|
||||
this.document.system.polarity,
|
||||
),
|
||||
stackingOptions: LesOubliesUtility.ensureChoice(
|
||||
LesOubliesUtility.createChoices(Object.keys(config.stackingLabels), config.stackingLabels),
|
||||
this.document.system.stacking,
|
||||
),
|
||||
companyPowerScopeOptions: LesOubliesUtility.ensureChoice(
|
||||
LesOubliesUtility.createChoices(Object.keys(config.companyPowerScopeLabels), config.companyPowerScopeLabels),
|
||||
this.document.system.scope,
|
||||
),
|
||||
companyPowerModeOptions: LesOubliesUtility.ensureChoice(
|
||||
LesOubliesUtility.createChoices(Object.keys(config.companyPowerModeLabels), config.companyPowerModeLabels),
|
||||
this.document.system.effectMode,
|
||||
),
|
||||
raceSizeOptions: LesOubliesUtility.ensureChoice(
|
||||
LesOubliesUtility.createRangeChoices(1, 4, config.sizes),
|
||||
this.document.system.size,
|
||||
),
|
||||
mainRaceOptions: LesOubliesUtility.ensureChoice(
|
||||
LesOubliesUtility.sortByName(game.items.filter((item) => item.type === "race")).map((item) => ({
|
||||
value: item.name,
|
||||
label: item.name,
|
||||
})),
|
||||
this.document.system.mainRace,
|
||||
),
|
||||
}
|
||||
|
||||
return {
|
||||
item: this.document,
|
||||
system: this.document.system,
|
||||
@@ -43,8 +101,10 @@ export default class LesOubliesItemSheet extends HandlebarsApplicationMixin(foun
|
||||
isEditMode: this.isEditMode,
|
||||
isPlayMode: this.isPlayMode,
|
||||
isGM: game.user.isGM,
|
||||
config: CONFIG.LESOUBLIES,
|
||||
enrichedDescription: await foundry.applications.ux.TextEditor.implementation.enrichHTML(this.document.system.description ?? "", { async: true }),
|
||||
config,
|
||||
choiceSets,
|
||||
enriched,
|
||||
enrichedDescription: foundry.utils.getProperty(enriched, "description") ?? "",
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user