reverse token is now a drop-down, and some clean up

This commit is contained in:
Vlyan
2024-08-07 09:30:09 +02:00
parent 0a1a74c84b
commit 7a2587083b
9 changed files with 63 additions and 17 deletions

View File

@@ -1,11 +1,11 @@
/**
* L5R5e Base Die
*/
export class L5rBaseDie extends DiceTerm {
/** Need to be override */
export class L5rBaseDie extends foundry.dice.terms.DiceTerm {
/** Need to be overridden */
static DENOMINATION = "";
/** Need to be override */
/** Need to be overridden */
static FACES = {};
/** @override */

View File

@@ -208,7 +208,8 @@ Hooks.once("init", async () => {
// Override the default Token _drawBar function to allow fatigue bar reversing.
Token.prototype._drawBar = function (number, bar, data) {
const reverseBar = data.attribute === "fatigue" && game.settings.get(L5R5E.namespace, "token-reverseFatigueBar");
const barSettings = game.settings.get(L5R5E.namespace, "token-reverse-token-bars");
const reverseBar = barSettings === 'both' || barSettings === data.attribute;
// Bar value
const pct = Math.clamp(Number(data.value), 0, data.max) / data.max;

View File

@@ -23,13 +23,6 @@ export const RegisterSettings = function () {
type: Boolean,
default: true,
});
game.settings.register(CONFIG.l5r5e.namespace, "token-reverseFatigueBar", {
name: "SETTINGS.ReverseFatigueBar",
scope: "world",
config: true,
type: Boolean,
default: false,
});
game.settings.register(CONFIG.l5r5e.namespace, "techniques-customs", {
name: "SETTINGS.CustomTechniques.Title",
hint: "SETTINGS.CustomTechniques.Hint",
@@ -47,7 +40,7 @@ export const RegisterSettings = function () {
type: String,
default: "l5r5e-custom-compendiums",
onChange: (name) => {
if (!Babele.get().modules.find((module) => module.module === name)) {
if (game.babele && !game.babele.modules.find((module) => module.module === name)) {
ui.notifications.warn(game.i18n.format("SETTINGS.CustomCompendiumName.Notification", { name }), { permanent: true });
}
}
@@ -70,6 +63,20 @@ export const RegisterSettings = function () {
},
default: 800,
});
game.settings.register(CONFIG.l5r5e.namespace, "token-reverse-token-bars", {
name: "SETTINGS.ReverseTokenBars.Title",
hint: "SETTINGS.ReverseTokenBars.Hint",
scope: "client",
config: true,
default: "none",
choices: {
"none": "SETTINGS.ReverseTokenBars.None",
"fatigue": "SETTINGS.ReverseTokenBars.Fatigue",
"strife": "SETTINGS.ReverseTokenBars.Strife",
"both": "SETTINGS.ReverseTokenBars.Both"
},
type: String,
});
/* ------------------------------------ */
/* Update */