feat: Introduce customizable visual progress indicators for countdowns, update module metadata, and enhance control button tooltips.
This commit is contained in:
parent
988f2c3011
commit
02a3855ea1
5 changed files with 216 additions and 17 deletions
|
|
@ -51,6 +51,15 @@ export class CountdownTrackerApp extends HandlebarsApplicationMixin(ApplicationV
|
|||
const isGM = game.user.isGM;
|
||||
const isMinimized = game.settings.get("dh-improved-countdowns", "minimized");
|
||||
const isLocked = game.settings.get("dh-improved-countdowns", "locked");
|
||||
const iconShape = game.settings.get("dh-improved-countdowns", "iconShape");
|
||||
const displayMode = game.settings.get("dh-improved-countdowns", "displayMode");
|
||||
const barOrientation = game.settings.get("dh-improved-countdowns", "barOrientation");
|
||||
const visualColor = game.settings.get("dh-improved-countdowns", "visualColor");
|
||||
const enableVisualOverlay = game.settings.get("dh-improved-countdowns", "enableVisualOverlay");
|
||||
const enableVisualBorder = game.settings.get("dh-improved-countdowns", "enableVisualBorder");
|
||||
const gmAlwaysShowNumbers = game.settings.get("dh-improved-countdowns", "gmAlwaysShowNumbers");
|
||||
|
||||
const showNumbers = (isGM && gmAlwaysShowNumbers) || displayMode === "number";
|
||||
|
||||
// Fetch countdowns from system settings
|
||||
const systemCountdownSetting = game.settings.get("daggerheart", "Countdowns");
|
||||
|
|
@ -60,9 +69,15 @@ export class CountdownTrackerApp extends HandlebarsApplicationMixin(ApplicationV
|
|||
for (const [id, countdown] of Object.entries(systemCountdownSetting.countdowns)) {
|
||||
const ownership = this.#getPlayerOwnership(game.user, systemCountdownSetting, countdown);
|
||||
if (ownership !== CONST.DOCUMENT_OWNERSHIP_LEVELS.NONE) {
|
||||
const current = countdown.progress.current;
|
||||
const max = countdown.progress.start;
|
||||
const percentage = Math.max(0, Math.min(100, (current / max) * 100));
|
||||
|
||||
countdowns[id] = {
|
||||
...countdown,
|
||||
editable: isGM || ownership === CONST.DOCUMENT_OWNERSHIP_LEVELS.OWNER
|
||||
editable: isGM || ownership === CONST.DOCUMENT_OWNERSHIP_LEVELS.OWNER,
|
||||
percentage,
|
||||
cssClass: `shape-${iconShape}`
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
@ -72,7 +87,13 @@ export class CountdownTrackerApp extends HandlebarsApplicationMixin(ApplicationV
|
|||
countdowns,
|
||||
isGM,
|
||||
isMinimized,
|
||||
isLocked
|
||||
isLocked,
|
||||
showNumbers,
|
||||
iconShape,
|
||||
barOrientation,
|
||||
visualColor,
|
||||
enableVisualOverlay,
|
||||
enableVisualBorder
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -28,6 +28,88 @@ Hooks.once('init', () => {
|
|||
default: false,
|
||||
onChange: () => CountdownTrackerApp.instance?.render()
|
||||
});
|
||||
|
||||
game.settings.register("dh-improved-countdowns", "iconShape", {
|
||||
name: "Icon Shape",
|
||||
hint: "Choose the shape of the countdown icons.",
|
||||
scope: "client",
|
||||
config: true,
|
||||
type: String,
|
||||
choices: {
|
||||
"rounded": "Rounded Square",
|
||||
"circle": "Circle"
|
||||
},
|
||||
default: "rounded",
|
||||
onChange: () => CountdownTrackerApp.instance?.render()
|
||||
});
|
||||
|
||||
game.settings.register("dh-improved-countdowns", "displayMode", {
|
||||
name: "Display Mode",
|
||||
hint: "Choose how the countdown value is displayed.",
|
||||
scope: "world",
|
||||
config: true,
|
||||
type: String,
|
||||
choices: {
|
||||
"number": "Number",
|
||||
"visual": "Visual (Bar/Clock)"
|
||||
},
|
||||
default: "number",
|
||||
onChange: () => CountdownTrackerApp.instance?.render()
|
||||
});
|
||||
|
||||
game.settings.register("dh-improved-countdowns", "barOrientation", {
|
||||
name: "Bar Orientation",
|
||||
hint: "Choose the orientation of the progress bar (for square icons).",
|
||||
scope: "client",
|
||||
config: true,
|
||||
type: String,
|
||||
choices: {
|
||||
"vertical": "Vertical",
|
||||
"horizontal": "Horizontal"
|
||||
},
|
||||
default: "vertical",
|
||||
onChange: () => CountdownTrackerApp.instance?.render()
|
||||
});
|
||||
|
||||
game.settings.register("dh-improved-countdowns", "visualColor", {
|
||||
name: "Visual Color",
|
||||
hint: "Choose the color for the progress overlay and border.",
|
||||
scope: "client",
|
||||
config: true,
|
||||
type: String,
|
||||
default: "#ffffff",
|
||||
onChange: () => CountdownTrackerApp.instance?.render()
|
||||
});
|
||||
|
||||
game.settings.register("dh-improved-countdowns", "enableVisualOverlay", {
|
||||
name: "Enable Fill Overlay",
|
||||
hint: "Show the filled progress overlay (Bar or Clock).",
|
||||
scope: "client",
|
||||
config: true,
|
||||
type: Boolean,
|
||||
default: true,
|
||||
onChange: () => CountdownTrackerApp.instance?.render()
|
||||
});
|
||||
|
||||
game.settings.register("dh-improved-countdowns", "enableVisualBorder", {
|
||||
name: "Enable Border Progress",
|
||||
hint: "Show a progress border around the icon.",
|
||||
scope: "client",
|
||||
config: true,
|
||||
type: Boolean,
|
||||
default: false,
|
||||
onChange: () => CountdownTrackerApp.instance?.render()
|
||||
});
|
||||
|
||||
game.settings.register("dh-improved-countdowns", "gmAlwaysShowNumbers", {
|
||||
name: "GM Always Shows Numbers",
|
||||
hint: "If enabled, the GM will always see the numerical value even if Display Mode is set to Visual.",
|
||||
scope: "client", // This should be client-scoped as it's a preference for the GM user
|
||||
config: true,
|
||||
type: Boolean,
|
||||
default: true,
|
||||
onChange: () => CountdownTrackerApp.instance?.render()
|
||||
});
|
||||
});
|
||||
|
||||
Hooks.once('ready', () => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue