Skip to content

Commit

Permalink
Add option to lock down XP on PC sheets
Browse files Browse the repository at this point in the history
  • Loading branch information
JamzTheMan committed Feb 13, 2025
1 parent 49aaf4c commit 6a1e9e0
Show file tree
Hide file tree
Showing 2 changed files with 81 additions and 58 deletions.
14 changes: 14 additions & 0 deletions scripts/hooks-for-nerps.js
Original file line number Diff line number Diff line change
Expand Up @@ -189,3 +189,17 @@ Hooks.on('initializeDynamicTokenRingConfig', (ringConfig) => {
});
ringConfig.addConfig('aoaRing', aoaRing);
});

Hooks.on('renderCharacterSheetPF2e', (app, html, data) => {
if (getSetting("disable-xp-inputs") && !game.user.isGM) {
html
.find('.char-header')
.find('input[name="system.details.xp.value"]')
.prop('disabled', true);

html
.find('.char-header')
.find('input[name="system.details.xp.max"]')
.prop('disabled', true);
}
});
125 changes: 67 additions & 58 deletions scripts/settings-for-nerps.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,62 +2,71 @@ import {MODULE_NAME} from "./constants.js";

// Register any custom module settings here
export const registerSettings = function () {
const debouncedReload = foundry.utils.debounce(function () {
window.location.reload();
}, 100);

game.settings.register(MODULE_NAME, "auto-remove-reaction-effects", {
name: "Auto-Remove Reaction Effects",
hint: "Automatically remove effects that start with the name 'Reaction: ' at the start (or end based on duration settings) of the tokens turn in combat.",
type: Boolean,
default: true,
scope: "world",
config: true,
});

game.settings.register(MODULE_NAME, "load-custom-css-override", {
name: "Load Custom CSS",
hint: "Loads custom CSS rules to override various module CSS I fixed to my liking.",
type: Boolean,
default: true,
scope: "world",
config: true
});

game.settings.register(MODULE_NAME, "journal-editor-tools", {
name: "Add Autocorrect toolbar buttons to Journal Editor",
hint: "Tools to attempt to correct text pasted from PDF.",
type: Boolean,
default: false,
scope: "world",
config: true,
onChange: debouncedReload
});

game.settings.register(MODULE_NAME, "additional-auto-correct-rules", {
name: "Autocorrect RegEx Rules",
hint: "Add these regular expressions to auto-correct default rules.",
type: String,
default: `[]`,
scope: "world",
config: true
});

game.settings.register(MODULE_NAME, "auto-correct-f-words", {
name: "Autocorrect F words",
hint: "[EXPERIMENTAL] Copy from PDFoundry oddly adds a space after the 'f' in many words.",
type: String,
default: `Jorgenf ist, inf luence, aff luent, campf ire`,
scope: "world",
config: true
});

game.settings.register(MODULE_NAME, "debug-mode", {
name: "Toggle Debug Mode",
hint: "If checked, will enable Debug level logging.",
type: Boolean,
default: false,
scope: "client",
config: true
});
const debouncedReload = foundry.utils.debounce(function () {
window.location.reload();
}, 100);

game.settings.register(MODULE_NAME, "auto-remove-reaction-effects", {
name: "Auto-Remove Reaction Effects",
hint: "Automatically remove effects that start with the name 'Reaction: ' at the start (or end based on duration settings) of the tokens turn in combat.",
type: Boolean,
default: true,
scope: "world",
config: true,
});

game.settings.register(MODULE_NAME, "disable-xp-inputs", {
name: "Disable PC XP Inputs for Players",
hint: "If checked, will disable XP value and max inputs for players.",
type: Boolean,
default: false,
scope: "world",
config: true
});

game.settings.register(MODULE_NAME, "load-custom-css-override", {
name: "Load Custom CSS",
hint: "Loads custom CSS rules to override various module CSS I fixed to my liking.",
type: Boolean,
default: true,
scope: "world",
config: true
});

game.settings.register(MODULE_NAME, "journal-editor-tools", {
name: "Add Autocorrect toolbar buttons to Journal Editor",
hint: "Tools to attempt to correct text pasted from PDF.",
type: Boolean,
default: false,
scope: "world",
config: true,
onChange: debouncedReload
});

game.settings.register(MODULE_NAME, "additional-auto-correct-rules", {
name: "Autocorrect RegEx Rules",
hint: "Add these regular expressions to auto-correct default rules.",
type: String,
default: `[]`,
scope: "world",
config: true
});

game.settings.register(MODULE_NAME, "auto-correct-f-words", {
name: "Autocorrect F words",
hint: "[EXPERIMENTAL] Copy from PDFoundry oddly adds a space after the 'f' in many words.",
type: String,
default: `Jorgenf ist, inf luence, aff luent, campf ire`,
scope: "world",
config: true
});

game.settings.register(MODULE_NAME, "debug-mode", {
name: "Toggle Debug Mode",
hint: "If checked, will enable Debug level logging.",
type: Boolean,
default: false,
scope: "client",
config: true
});
};

0 comments on commit 6a1e9e0

Please sign in to comment.