diff --git a/src/languages/en.json b/src/languages/en.json index a9885d6..0546858 100644 --- a/src/languages/en.json +++ b/src/languages/en.json @@ -10,6 +10,10 @@ "MAGICITEMS.SettingScaleSpellDamageHint": "Some spells (like Acid Splash) have their damage scale with character levels, when this setting is on, the scaling will work", "MAGICITEMS.SettingShowLeftChargesInChat": "Show charges left", "MAGICITEMS.SettingShowLeftChargesInChatHint": "Shows the amount of charges left on item/spell in a chat message", + "MAGICITEMS.SettingDisplayMainSheetItem": "Item Display Location", + "MAGICITEMS.SettingDisplayMainSheetItemHint": "Where to display Magic Item Spells/Feats on their respective sheets (only for Main Sheet)", + "MAGICITEMS.SettingDisplayMainSheetItemBottom": "Bottom", + "MAGICITEMS.SettingDisplayMainSheetItemTop": "Top", "MAGICITEMS.SheetActivation": "Activation Options", "MAGICITEMS.SheetActivationEquipped": "Equipped", "MAGICITEMS.SheetActivationAttuned": "Attuned", diff --git a/src/module.js b/src/module.js index 51cb2a3..c45f4a5 100644 --- a/src/module.js +++ b/src/module.js @@ -74,6 +74,20 @@ Hooks.once("init", () => { config: true, }); + game.settings.register(CONSTANTS.MODULE_ID, "optionDisplayMainSheetItems", { + name: "MAGICITEMS.SettingDisplayMainSheetItem", + hint: "MAGICITEMS.SettingDisplayMainSheetItemHint", + scope: "client", + type: Number, + default: CONSTANTS.DISPLAY_OPTIONS.BOTTOM, + requiresReload: true, + choices: { + 0: "MAGICITEMS.SettingDisplayMainSheetItemBottom", + 1: "MAGICITEMS.SettingDisplayMainSheetItemTop", + }, + config: true, + }); + if (typeof Babele !== "undefined") { Babele.get().register({ module: CONSTANTS.MODULE_ID, diff --git a/src/scripts/constants/constants.js b/src/scripts/constants/constants.js index 80df147..c3e72d9 100644 --- a/src/scripts/constants/constants.js +++ b/src/scripts/constants/constants.js @@ -14,6 +14,10 @@ const CONSTANTS = { WEIGHT_PROPERTY_PATH: "system.weight", PRICE_PROPERTY_PATH: "system.price", SPELL_LEVEL_PROPERTY_PATH: "system.level", + DISPLAY_OPTIONS: { + BOTTOM: 0, + TOP: 1, + }, }; CONSTANTS.PATH = `modules/${CONSTANTS.MODULE_NAME}/`; diff --git a/src/scripts/magicitemsheet.js b/src/scripts/magicitemsheet.js index d6bdda7..bdad86b 100644 --- a/src/scripts/magicitemsheet.js +++ b/src/scripts/magicitemsheet.js @@ -121,7 +121,13 @@ export class MagicItemSheet { if (el.length) { el.replaceWith(template); } else { - this.html.find(`.${tab} .${listName}`).append(template); + if (game.settings.get(CONSTANTS.MODULE_ID, "optionDisplayMainSheetItems") === CONSTANTS.DISPLAY_OPTIONS.BOTTOM) { + this.html.find(`.${tab} .${listName}`).append(template); + } else if ( + game.settings.get(CONSTANTS.MODULE_ID, "optionDisplayMainSheetItems") === CONSTANTS.DISPLAY_OPTIONS.TOP + ) { + this.html.find(`.${tab} .${listName}`).prepend(template); + } } }