Working on 0.8.x

-dot separator in settings
-mergeObject ns
-added a option to enable/disable custom techs
-removed "foundry-pc-types" as it was absolutely obsolete
-fixed some roll errors (_rolled -> _evaluated)
This commit is contained in:
Vlyan
2021-04-30 17:20:34 +02:00
parent df86ba81e7
commit 93cfe5bb86
35 changed files with 140 additions and 10256 deletions

View File

@@ -13,6 +13,10 @@
"Initiative": {
"SetTn1OnTypeChange": "Set TN to 1 on encounter change",
"SetTn1OnTypeChangeHint": "Set the TN to 1 when the encounter type is selected (Intrigue, Duel, Skirmish or Mass battle)"
},
"CustomTechniques": {
"Title": "Use custom techniques",
"Hint": "Add 'Link' and 'Specificity' techniques types."
}
},
"ACTOR": {

View File

@@ -13,6 +13,10 @@
"Initiative": {
"SetTn1OnTypeChange": "Poner el NO a 1 al seleccionar el tipo de encuentro",
"SetTn1OnTypeChangeHint": "Poner el NO a 1 cuando se elige el tipo de encuentro (Intriga, Duelo, Escaramuza o Batalla a gran escala)"
},
"CustomTechniques": {
"Title": "Use custom techniques",
"Hint": "Add 'Link' and 'Specificity' techniques types."
}
},
"ACTOR": {

View File

@@ -13,6 +13,10 @@
"Initiative": {
"SetTn1OnTypeChange": "ND 1 à la sélection du type de rencontre",
"SetTn1OnTypeChangeHint": "Met le ND à 1 lorsqu'on modifie le type de rencontre (Intrigue, Duel, Escarmouche ou Bataille rangée)"
},
"CustomTechniques": {
"Title": "Utiliser les techniques personnalisées",
"Hint": "Ajoute les types de technique 'Lien' et 'Particularités'."
}
},
"ACTOR": {

View File

@@ -20,7 +20,7 @@ export class ActorL5r5e extends Actor {
data.token = data.token || {};
switch (data.type) {
case "character":
mergeObject(
foundry.utils.mergeObject(
data.token,
{
// vision: true,
@@ -40,7 +40,7 @@ export class ActorL5r5e extends Actor {
break;
case "npc":
mergeObject(
foundry.utils.mergeObject(
data.token,
{
actorLink: false,

View File

@@ -25,7 +25,7 @@ export class BaseSheetL5r5e extends ActorSheet {
sheetData.data.dtypes = ["String", "Number", "Boolean"];
sheetData.data.stances = CONFIG.l5r5e.stances;
sheetData.data.techniquesList = CONFIG.l5r5e.techniques;
sheetData.data.techniquesList = game.l5r5e.HelpersL5r5e.getTechniquesList();
// Sort Items by name
sheetData.items.sort((a, b) => {
@@ -49,9 +49,11 @@ export class BaseSheetL5r5e extends ActorSheet {
const out = {};
// Build the list order
[...CONFIG.l5r5e.techniques, ...CONFIG.l5r5e.techniques_school].forEach((tech) => {
out[tech] = [];
});
[...CONFIG.l5r5e.techniques, ...CONFIG.l5r5e.techniques_custom, ...CONFIG.l5r5e.techniques_school].forEach(
(tech) => {
out[tech] = [];
}
);
// Add tech the character knows
sheetData.items.forEach((item) => {

View File

@@ -6,7 +6,7 @@ import { TwentyQuestionsDialog } from "./twenty-questions-dialog.js";
*/
export class CharacterSheetL5r5e extends BaseSheetL5r5e {
static get defaultOptions() {
return mergeObject(super.defaultOptions, {
return foundry.utils.mergeObject(super.defaultOptions, {
classes: ["l5r5e", "sheet", "actor"],
template: CONFIG.l5r5e.paths.templates + "actors/character-sheet.html",
tabs: [

View File

@@ -10,7 +10,7 @@ export class NpcSheetL5r5e extends BaseSheetL5r5e {
static types = ["adversary", "minion"];
static get defaultOptions() {
return mergeObject(super.defaultOptions, {
return foundry.utils.mergeObject(super.defaultOptions, {
classes: ["l5r5e", "sheet", "npc"],
template: CONFIG.l5r5e.paths.templates + "actors/npc-sheet.html",
});

View File

@@ -32,7 +32,7 @@ export class TwentyQuestionsDialog extends FormApplication {
* @override
*/
static get defaultOptions() {
return mergeObject(super.defaultOptions, {
return foundry.utils.mergeObject(super.defaultOptions, {
id: "l5r5e-twenty-questions-dialog",
classes: ["l5r5e", "twenty-questions-dialog"],
template: CONFIG.l5r5e.paths.templates + "actors/twenty-questions-dialog.html",
@@ -142,7 +142,7 @@ export class TwentyQuestionsDialog extends FormApplication {
skillsListStep7,
skillsListStep17,
noHonorSkillsList: ["commerce", "skulduggery", "medicine", "seafaring", "survival", "labor"],
techniquesList: CONFIG.l5r5e.techniques,
techniquesList: game.l5r5e.HelpersL5r5e.getTechniquesList(),
data: this.object.data,
cache: this.cache,
summary: {

View File

@@ -177,7 +177,7 @@ export class TwentyQuestions {
* Update object with form data
*/
updateFromForm(formData) {
this.data = mergeObject(this.data, expandObject(formData));
this.data = foundry.utils.mergeObject(this.data, foundry.utils.expandObject(formData));
}
/**

View File

@@ -24,19 +24,19 @@ export class CombatL5r5e extends Combat {
// Get global modifiers
const cfg = {
difficulty: game.settings.get("l5r5e", "initiative.difficulty.value"),
difficultyHidden: game.settings.get("l5r5e", "initiative.difficulty.hidden"),
difficulty: game.settings.get("l5r5e", "initiative-difficulty-value"),
difficultyHidden: game.settings.get("l5r5e", "initiative-difficulty-hidden"),
prepared: {
character: game.settings.get("l5r5e", "initiative.prepared.character"),
adversary: game.settings.get("l5r5e", "initiative.prepared.adversary"),
minion: game.settings.get("l5r5e", "initiative.prepared.minion"),
character: game.settings.get("l5r5e", "initiative-prepared-character"),
adversary: game.settings.get("l5r5e", "initiative-prepared-adversary"),
minion: game.settings.get("l5r5e", "initiative-prepared-minion"),
},
};
// SkillId from DicePicker or global
const skillId = messageOptions.skillId
? messageOptions.skillId
: CONFIG.l5r5e.initiativeSkills[game.settings.get("l5r5e", "initiative.encounter")];
: CONFIG.l5r5e.initiativeSkills[game.settings.get("l5r5e", "initiative-encounter")];
const skillCat = CONFIG.l5r5e.skills.get(skillId);
// Get score for each combatant

View File

@@ -7,18 +7,8 @@ L5R5E.paths = {
L5R5E.money = [50, 10];
L5R5E.stances = ["earth", "air", "water", "fire", "void"];
L5R5E.techniques = [
"kata",
"kiho",
"inversion",
"invocation",
"ritual",
"shuji",
"maho",
"ninjutsu",
"link",
"specificity",
];
L5R5E.techniques = ["kata", "kiho", "inversion", "invocation", "ritual", "shuji", "maho", "ninjutsu"];
L5R5E.techniques_custom = ["link", "specificity"];
L5R5E.techniques_school = ["school_ability", "mastery_ability"];
L5R5E.xp = {

View File

@@ -46,7 +46,7 @@ export class DicePickerDialog extends FormApplication {
* @override
*/
static get defaultOptions() {
return mergeObject(super.defaultOptions, {
return foundry.utils.mergeObject(super.defaultOptions, {
id: "l5r5e-dice-picker-dialog",
classes: ["l5r5e", "dice-picker-dialog"],
template: CONFIG.l5r5e.paths.templates + "dice/dice-picker-dialog.html",
@@ -131,7 +131,7 @@ export class DicePickerDialog extends FormApplication {
if (options.difficulty) {
this.difficulty = options.difficulty;
} else {
this.difficulty = game.settings.get("l5r5e", "initiative.difficulty.value");
this.difficulty = game.settings.get("l5r5e", "initiative-difficulty-value");
}
// DifficultyHidden
@@ -145,7 +145,7 @@ export class DicePickerDialog extends FormApplication {
* Refresh data (used from socket)
*/
async refresh() {
this.difficulty = game.settings.get("l5r5e", "initiative.difficulty.value");
this.difficulty = game.settings.get("l5r5e", "initiative-difficulty-value");
this.difficultyHidden = false;
this.render(false);
}
@@ -244,7 +244,7 @@ export class DicePickerDialog extends FormApplication {
*/
set difficultyHidden(isHidden) {
// If GM hide, then player choice don't matter
this._difficultyHiddenIsLock = game.settings.get("l5r5e", "initiative.difficulty.hidden");
this._difficultyHiddenIsLock = game.settings.get("l5r5e", "initiative-difficulty-hidden");
if (this._difficultyHiddenIsLock) {
isHidden = true;
}
@@ -390,7 +390,7 @@ export class DicePickerDialog extends FormApplication {
// If initiative roll, check if player already have
if (this.object.isInitiativeRoll) {
const combatant = game.combat.combatants.find((c) => c.actor._id === this._actor._id && c.initiative > 0);
const combatant = game.combat.combatants.find((c) => c.actor.id === this._actor.id && c.initiative > 0);
if (combatant) {
ui.notifications.error(game.i18n.localize("l5r5e.conflict.initiative.already_set"));
return this.close();
@@ -470,7 +470,7 @@ export class DicePickerDialog extends FormApplication {
}
if (message) {
new game.l5r5e.RollnKeepDialog(message._id).render(true);
new game.l5r5e.RollnKeepDialog(message.id).render(true);
}
return this.close();
@@ -508,8 +508,8 @@ export class DicePickerDialog extends FormApplication {
const params = {};
let name = "DicePicker";
if (this._actor?._id) {
params.actorId = this._actor._id;
if (this._actor?.id) {
params.actorId = this._actor.id;
name = this._actor.name;
}
@@ -536,7 +536,7 @@ export class DicePickerDialog extends FormApplication {
}
// Search if already in player hotbar
if (Object.values(game.user.data.hotbar).includes(macro._id)) {
if (Object.values(game.user.data.hotbar).includes(macro.id)) {
return;
}

View File

@@ -15,7 +15,7 @@ export class GmToolsDialog extends FormApplication {
static get defaultOptions() {
const x = $(window).width();
const y = $(window).height();
return mergeObject(super.defaultOptions, {
return foundry.utils.mergeObject(super.defaultOptions, {
id: "l5r5e-gm-tools-dialog",
classes: ["l5r5e", "gm-tools-dialog"],
template: CONFIG.l5r5e.paths.templates + "dice/gm-tools-dialog.html",
@@ -54,8 +54,8 @@ export class GmToolsDialog extends FormApplication {
*/
_initialize() {
this.object = {
difficulty: game.settings.get("l5r5e", "initiative.difficulty.value"),
difficultyHidden: game.settings.get("l5r5e", "initiative.difficulty.hidden"),
difficulty: game.settings.get("l5r5e", "initiative-difficulty-value"),
difficultyHidden: game.settings.get("l5r5e", "initiative-difficulty-hidden"),
};
}
@@ -126,7 +126,7 @@ export class GmToolsDialog extends FormApplication {
event.stopPropagation();
this.object.difficultyHidden = !this.object.difficultyHidden;
game.settings
.set("l5r5e", "initiative.difficulty.hidden", this.object.difficultyHidden)
.set("l5r5e", "initiative-difficulty-hidden", this.object.difficultyHidden)
.then(() => this.submit());
});
@@ -148,7 +148,7 @@ export class GmToolsDialog extends FormApplication {
this.object.difficulty = Math.max(0, this.object.difficulty - 1);
break;
}
game.settings.set("l5r5e", "initiative.difficulty.value", this.object.difficulty).then(() => this.submit());
game.settings.set("l5r5e", "initiative-difficulty-value", this.object.difficulty).then(() => this.submit());
});
// Scene End & Sleep

View File

@@ -45,7 +45,7 @@ export class RollnKeepDialog extends FormApplication {
* @override
*/
static get defaultOptions() {
return mergeObject(super.defaultOptions, {
return foundry.utils.mergeObject(super.defaultOptions, {
id: "l5r5e-roll-n-keep-dialog",
classes: ["l5r5e", "roll-n-keep-dialog"],
template: CONFIG.l5r5e.paths.templates + "dice/roll-n-keep-dialog.html",
@@ -58,7 +58,7 @@ export class RollnKeepDialog extends FormApplication {
* Define a unique and dynamic element ID for the rendered application
*/
get id() {
return `l5r5e-roll-n-keep-dialog-${this._message._id}`;
return `l5r5e-roll-n-keep-dialog-${this._message.id}`;
}
/**
@@ -85,6 +85,7 @@ export class RollnKeepDialog extends FormApplication {
constructor(messageId, options = {}) {
super({}, options);
this.message = game.messages.get(messageId);
this.options.editable =
this._message?.isAuthor || this._message?._roll.l5r5e.actor?.isOwner || this._message?.isOwner || false;
@@ -146,7 +147,7 @@ export class RollnKeepDialog extends FormApplication {
// New
this.object.dicesList = [[]];
this.roll.terms.forEach((term) => {
if (typeof term !== "object") {
if (!(term instanceof game.l5r5e.L5rBaseDie)) {
return;
}
term.results.forEach((res) => {
@@ -514,7 +515,7 @@ export class RollnKeepDialog extends FormApplication {
}
roll.terms.forEach((term) => {
if (typeof term !== "object") {
if (!(term instanceof game.l5r5e.L5rBaseDie)) {
return;
}
term.results.forEach((res) => {
@@ -610,7 +611,7 @@ export class RollnKeepDialog extends FormApplication {
async _toChatMessage() {
// Keep old Ids
const appOldId = this.id;
const msgOldId = this._message._id;
const msgOldId = this._message.id;
if (this.roll.l5r5e.isInitiativeRoll) {
let msgOptions = {
@@ -633,11 +634,11 @@ export class RollnKeepDialog extends FormApplication {
// Refresh viewers
if (this._message) {
game.l5r5e.sockets.updateMessageIdAndRefresh(appOldId, this._message._id);
game.l5r5e.sockets.updateMessageIdAndRefresh(appOldId, this._message.id);
}
// Delete old chat message related to this series
if (game.settings.get("l5r5e", "rnk.deleteOldMessage")) {
if (game.settings.get("l5r5e", "rnk-deleteOldMessage")) {
if (game.user.isGM) {
const message = game.messages.get(msgOldId);
if (message) {

View File

@@ -55,8 +55,8 @@ export class RollL5r5e extends Roll {
* Execute the Roll, replacing dice and evaluating the total result
* @override
**/
evaluate({ minimize = false, maximize = false } = {}) {
if (this._rolled) {
evaluate({ minimize = false, maximize = false, async = false } = {}) {
if (this._evaluated) {
throw new Error("This Roll object has already been rolled.");
}
if (this.terms.length < 1) {
@@ -64,14 +64,14 @@ export class RollL5r5e extends Roll {
}
// Clean terms (trim symbols)
this.terms = this._identifyTerms(this.constructor.cleanFormula(this.terms));
this.terms = this.constructor.simplifyTerms(this.terms);
// Roll dices and inner dices
this._total = 0;
// Roll
super.evaluate({ minimize, maximize });
this._rolled = true;
super.evaluate({ minimize, maximize, async });
this._evaluated = true;
// Save initial formula
if (!this.l5r5e.initialFormula) {
@@ -152,7 +152,7 @@ export class RollL5r5e extends Roll {
* @override
*/
get total() {
if (!this._rolled) {
if (!this._evaluated) {
return null;
}
@@ -230,9 +230,9 @@ export class RollL5r5e extends Roll {
* @override
*/
async render(chatOptions = {}) {
chatOptions = mergeObject(
chatOptions = foundry.utils.mergeObject(
{
user: game.user._id,
user: game.user.id,
flavor: null,
template: CONFIG.l5r5e.paths.templates + this.constructor.CHAT_TEMPLATE,
blind: false,
@@ -242,7 +242,7 @@ export class RollL5r5e extends Roll {
const isPrivate = chatOptions.isPrivate;
// Execute the roll, if needed
if (!this._rolled) {
if (!this._evaluated) {
this.roll();
}
@@ -289,30 +289,32 @@ export class RollL5r5e extends Roll {
* This function can either create the ChatMessage directly, or return the data object that will be used to create.
* @override
*/
toMessage(messageData = {}, { rollMode = null, create = true } = {}) {
async toMessage(messageData = {}, { rollMode = null, create = true } = {}) {
// Perform the roll, if it has not yet been rolled
if (!this._rolled) {
if (!this._evaluated) {
this.evaluate();
}
const rMode = rollMode || messageData.rollMode || game.settings.get("core", "rollMode");
let template = CONST.CHAT_MESSAGE_TYPES.ROLL;
if (["gmroll", "blindroll"].includes(rMode)) {
messageData.whisper = ChatMessage.getWhisperRecipients("GM");
}
if (rMode === "blindroll") messageData.blind = true;
if (rMode === "selfroll") messageData.whisper = [game.user.id];
if (rMode === "blindroll") {
messageData.blind = true;
}
if (rMode === "selfroll") {
messageData.whisper = [game.user.id];
}
// Prepare chat data
messageData = mergeObject(
messageData = foundry.utils.mergeObject(
{
user: game.user._id,
type: template,
user: game.user.id,
type: CONST.CHAT_MESSAGE_TYPES.ROLL,
content: this._total,
sound: CONFIG.sounds.dice,
speaker: {
actor: this.l5r5e.actor?._id || null,
actor: this.l5r5e.actor?.id || null,
token: this.l5r5e.actor?.token || null,
alias: this.l5r5e.actor?.name || null,
},
@@ -321,11 +323,11 @@ export class RollL5r5e extends Roll {
);
messageData.roll = this;
// Prepare message options
const messageOptions = { rollMode: rMode };
// TODO Bug on non link pnj : infinity deepClone recursion
// Either create the message or just return the chat data
return create ? CONFIG.ChatMessage.entityClass.create(messageData, messageOptions) : messageData;
const message = await ChatMessage.implementation.create(messageData, { rollMode: rMode, temporary: !create });
return create ? message : message.data;
}
/** @override */
@@ -365,7 +367,7 @@ export class RollL5r5e extends Roll {
// lightweight the Actor
if (json.l5r5e.actor) {
json.l5r5e.actor = {
id: json.l5r5e.actor._id,
id: json.l5r5e.actor._id, // method "id" not exist in json, need to use "_id" here
};
}

View File

@@ -13,7 +13,7 @@ export class HelpDialog extends FormApplication {
* @override
*/
static get defaultOptions() {
return mergeObject(super.defaultOptions, {
return foundry.utils.mergeObject(super.defaultOptions, {
id: "l5r5e-help-dialog",
classes: ["l5r5e", "help-dialog"],
template: CONFIG.l5r5e.paths.templates + "help/help-dialog.html",

View File

@@ -45,7 +45,10 @@ export class HelpersL5r5e {
* Get Techniques for List / Select
*/
static getTechniquesList() {
return CONFIG.l5r5e.techniques.map((e) => ({
return [
...CONFIG.l5r5e.techniques,
...(game.settings.get("l5r5e", "techniques-customs") ? CONFIG.l5r5e.techniques_custom : []),
].map((e) => ({
id: e,
label: game.i18n.localize(`l5r5e.techniques.${e}`),
}));

View File

@@ -88,14 +88,14 @@ export default class HooksL5r5e {
// *** Conf ***
const encounterTypeList = Object.keys(CONFIG.l5r5e.initiativeSkills);
const prepared = {
character: game.settings.get("l5r5e", "initiative.prepared.character"),
adversary: game.settings.get("l5r5e", "initiative.prepared.adversary"),
minion: game.settings.get("l5r5e", "initiative.prepared.minion"),
character: game.settings.get("l5r5e", "initiative-prepared-character"),
adversary: game.settings.get("l5r5e", "initiative-prepared-adversary"),
minion: game.settings.get("l5r5e", "initiative-prepared-minion"),
};
// *** Template ***
const tpl = await renderTemplate(`${CONFIG.l5r5e.paths.templates}gm/combat-tracker-bar.html`, {
encounterType: game.settings.get("l5r5e", "initiative.encounter"),
encounterType: game.settings.get("l5r5e", "initiative-encounter"),
encounterTypeList,
prepared,
});
@@ -118,7 +118,7 @@ export default class HooksL5r5e {
return;
}
game.settings
.set("l5r5e", "initiative.encounter", encounter)
.set("l5r5e", "initiative-encounter", encounter)
.then(() => HooksL5r5e._gmCombatBar(app, html, data));
});
@@ -136,7 +136,7 @@ export default class HooksL5r5e {
null: rev ? "false" : "true",
};
game.settings
.set("l5r5e", `initiative.prepared.${preparedId}`, nextValue[prepared[preparedId]])
.set("l5r5e", `initiative-prepared-${preparedId}`, nextValue[prepared[preparedId]])
.then(() => HooksL5r5e._gmCombatBar(app, html, data));
});
}

View File

@@ -11,7 +11,7 @@ export class AdvancementSheetL5r5e extends ItemSheetL5r5e {
/** @override */
static get defaultOptions() {
return mergeObject(super.defaultOptions, {
return foundry.utils.mergeObject(super.defaultOptions, {
classes: ["l5r5e", "sheet", "advancement"],
template: CONFIG.l5r5e.paths.templates + "items/advancement/advancement-sheet.html",
width: 520,

View File

@@ -6,7 +6,7 @@ import { ItemSheetL5r5e } from "./item-sheet.js";
export class ArmorSheetL5r5e extends ItemSheetL5r5e {
/** @override */
static get defaultOptions() {
return mergeObject(super.defaultOptions, {
return foundry.utils.mergeObject(super.defaultOptions, {
classes: ["l5r5e", "sheet", "armor"],
template: CONFIG.l5r5e.paths.templates + "items/armor/armor-sheet.html",
width: 520,

View File

@@ -5,7 +5,7 @@
export class ItemSheetL5r5e extends ItemSheet {
/** @override */
static get defaultOptions() {
return mergeObject(super.defaultOptions, {
return foundry.utils.mergeObject(super.defaultOptions, {
classes: ["l5r5e", "sheet", "item"],
template: CONFIG.l5r5e.paths.templates + "items/item/item-sheet.html",
width: 520,
@@ -15,7 +15,7 @@ export class ItemSheetL5r5e extends ItemSheet {
}
/** @override */
async getData() {
async getData(options = {}) {
const sheetData = super.getData();
sheetData.data.dtypes = ["String", "Number", "Boolean"];

View File

@@ -12,7 +12,7 @@ export class PeculiaritySheetL5r5e extends ItemSheetL5r5e {
/** @override */
static get defaultOptions() {
return mergeObject(super.defaultOptions, {
return foundry.utils.mergeObject(super.defaultOptions, {
classes: ["l5r5e", "sheet", "peculiarity"],
template: CONFIG.l5r5e.paths.templates + "items/peculiarity/peculiarity-sheet.html",
width: 520,

View File

@@ -6,7 +6,7 @@ import { ItemSheetL5r5e } from "./item-sheet.js";
export class PropertySheetL5r5e extends ItemSheetL5r5e {
/** @override */
static get defaultOptions() {
return mergeObject(super.defaultOptions, {
return foundry.utils.mergeObject(super.defaultOptions, {
classes: ["l5r5e", "sheet", "property"],
template: CONFIG.l5r5e.paths.templates + "items/property/property-sheet.html",
width: 520,

View File

@@ -6,7 +6,7 @@ import { ItemSheetL5r5e } from "./item-sheet.js";
export class TechniqueSheetL5r5e extends ItemSheetL5r5e {
/** @override */
static get defaultOptions() {
return mergeObject(super.defaultOptions, {
return foundry.utils.mergeObject(super.defaultOptions, {
classes: ["l5r5e", "sheet", "technique"],
template: CONFIG.l5r5e.paths.templates + "items/technique/technique-sheet.html",
width: 520,

View File

@@ -6,7 +6,7 @@ import { ItemSheetL5r5e } from "./item-sheet.js";
export class WeaponSheetL5r5e extends ItemSheetL5r5e {
/** @override */
static get defaultOptions() {
return mergeObject(super.defaultOptions, {
return foundry.utils.mergeObject(super.defaultOptions, {
classes: ["l5r5e", "sheet", "weapon"],
template: CONFIG.l5r5e.paths.templates + "items/weapon/weapon-sheet.html",
width: 520,

View File

@@ -116,7 +116,7 @@ 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", "token.reverseFatigueBar");
const reverseBar = data.attribute === "fatigue" && game.settings.get("l5r5e", "token-reverseFatigueBar");
// Bar value
const pct = Math.clamped(Number(data.value), 0, data.max) / data.max;

View File

@@ -166,7 +166,7 @@ export class MigrationL5r5e {
t.actorData = {};
} else if (!t.actorLink) {
const updateData = MigrationL5r5e._migrateActorData(token.data.actorData);
t.actorData = mergeObject(token.data.actorData, updateData);
t.actorData = foundry.utils.mergeObject(token.data.actorData, updateData);
}
return t;
}),

View File

@@ -5,7 +5,7 @@ export const RegisterSettings = function () {
/* ------------------------------------ */
/* User settings */
/* ------------------------------------ */
game.settings.register("l5r5e", "rnk.deleteOldMessage", {
game.settings.register("l5r5e", "rnk-deleteOldMessage", {
name: "SETTINGS.RollNKeep.DeleteOldMessage",
hint: "SETTINGS.RollNKeep.DeleteOldMessageHint",
scope: "world",
@@ -13,7 +13,7 @@ export const RegisterSettings = function () {
default: true,
type: Boolean,
});
game.settings.register("l5r5e", "initiative.setTn1OnTypeChange", {
game.settings.register("l5r5e", "initiative-setTn1OnTypeChange", {
name: "SETTINGS.Initiative.SetTn1OnTypeChange",
hint: "SETTINGS.Initiative.SetTn1OnTypeChangeHint",
scope: "world",
@@ -21,13 +21,21 @@ export const RegisterSettings = function () {
type: Boolean,
default: true,
});
game.settings.register("l5r5e", "token.reverseFatigueBar", {
game.settings.register("l5r5e", "token-reverseFatigueBar", {
name: "SETTINGS.ReverseFatigueBar",
scope: "world",
config: true,
type: Boolean,
default: false,
});
game.settings.register("l5r5e", "techniques-customs", {
name: "SETTINGS.CustomTechniques.Title",
hint: "SETTINGS.CustomTechniques.Hint",
scope: "world",
config: true,
type: Boolean,
default: false,
});
/* ------------------------------------ */
/* Update */
@@ -43,7 +51,7 @@ export const RegisterSettings = function () {
/* ------------------------------------ */
/* Initiative Roll Dialog (GM only) */
/* ------------------------------------ */
game.settings.register("l5r5e", "initiative.difficulty.hidden", {
game.settings.register("l5r5e", "initiative-difficulty-hidden", {
name: "Initiative difficulty is hidden",
scope: "world",
config: false,
@@ -51,7 +59,7 @@ export const RegisterSettings = function () {
default: false,
onChange: () => game.l5r5e.HelpersL5r5e.notifyDifficultyChange(),
});
game.settings.register("l5r5e", "initiative.difficulty.value", {
game.settings.register("l5r5e", "initiative-difficulty-value", {
name: "Initiative difficulty value",
scope: "world",
config: false,
@@ -59,33 +67,33 @@ export const RegisterSettings = function () {
default: 2,
onChange: () => game.l5r5e.HelpersL5r5e.notifyDifficultyChange(),
});
game.settings.register("l5r5e", "initiative.encounter", {
game.settings.register("l5r5e", "initiative-encounter", {
name: "Initiative encounter type",
scope: "world",
config: false,
type: String,
default: "skirmish",
onChange: () => {
if (game.settings.get("l5r5e", "initiative.setTn1OnTypeChange")) {
game.settings.set("l5r5e", "initiative.difficulty.value", 1);
if (game.settings.get("l5r5e", "initiative-setTn1OnTypeChange")) {
game.settings.set("l5r5e", "initiative-difficulty-value", 1);
}
},
});
game.settings.register("l5r5e", "initiative.prepared.character", {
game.settings.register("l5r5e", "initiative-prepared-character", {
name: "Initiative PC prepared or not",
scope: "world",
config: false,
type: String,
default: "null",
});
game.settings.register("l5r5e", "initiative.prepared.adversary", {
game.settings.register("l5r5e", "initiative-prepared-adversary", {
name: "Initiative NPC adversary are prepared or not",
scope: "world",
config: false,
type: String,
default: "null",
});
game.settings.register("l5r5e", "initiative.prepared.minion", {
game.settings.register("l5r5e", "initiative-prepared-minion", {
name: "Initiative NPC minion are prepared or not",
scope: "world",
config: false,

View File

@@ -46,7 +46,7 @@ export class SocketHandlerL5r5e {
_onDeleteChatMessage(data) {
// Only delete the message if the user is a GM (otherwise it have no real effect)
// Currently only used in RnK
if (!game.user.isGM || !game.settings.get("l5r5e", "rnk.deleteOldMessage")) {
if (!game.user.isGM || !game.settings.get("l5r5e", "rnk-deleteOldMessage")) {
return;
}
const message = game.messages.get(data.messageId);

View File

@@ -3,8 +3,8 @@
<i>{{localize 'l5r5e.techniques.type'}}</i>
{{#each data.techniquesList as |technique|}}
<label>
<input type="checkbox" name="data.techniques.{{technique}}" {{checked (lookup ../data.data.techniques technique)}} />
{{localizeTechnique technique}}
<input type="checkbox" name="data.techniques.{{technique.id}}" {{checked (lookup ../data.data.techniques technique.id)}} />
{{technique.label}}
</label>
{{/each}}
</div>

View File

@@ -6,8 +6,8 @@
<i>{{localize 'l5r5e.techniques.type'}}</i>
{{#each data.techniquesList as |technique|}}
<label>
<input type="checkbox" name="data.techniques.{{technique}}" {{checked (lookup ../data.data.techniques technique)}} />
{{localizeTechnique technique}}
<input type="checkbox" name="data.techniques.{{technique.id}}" {{checked (lookup ../data.data.techniques technique.id)}} />
{{technique.label}}
</label>
{{/each}}
</div>

View File

@@ -221,8 +221,8 @@
<strong>{{localize 'l5r5e.twenty_questions.part2.access'}}</strong>
{{#each techniquesList as |technique|}}
<label class="technique">
<input type="checkbox" name="step3.allowed_techniques.{{technique}}" {{checked (lookup ../data.step3.allowed_techniques technique)}} />
{{localizeTechnique technique}}
<input type="checkbox" name="step3.allowed_techniques.{{technique.id}}" {{checked (lookup ../data.step3.allowed_techniques technique.id)}} />
{{technique.label}}
</label>
{{/each}}
</td>