FVTT v11 Compatibility

- Added CONFIG.l5r5e.namespace
- Fix new labels for Types
- Fix Effects
- Fix TokenData : actorData->delta
This commit is contained in:
Vlyan
2023-06-11 09:27:49 +02:00
parent dc00657f84
commit 1662f59009
41 changed files with 459 additions and 319 deletions

View File

@@ -161,7 +161,7 @@ export class ArmySheetL5r5e extends BaseSheetL5r5e {
if (!item || item.documentName !== "Item" || !["army_cohort", "army_fortification"].includes(item.type)) {
// actor dual trigger...
if (item?.documentName !== "Actor") {
console.warn("L5R5E | Characters items are not allowed", item?.type, item);
console.warn("L5R5E | AS | Characters items are not allowed", item?.type, item);
}
return;
}
@@ -221,7 +221,7 @@ export class ArmySheetL5r5e extends BaseSheetL5r5e {
*/
async _updateLinkedActorData(type, actor, isInit = false) {
if (!actor || actor.documentName !== "Actor" || !actor.isCharacterType) {
console.warn("L5R5E | Wrong actor type", actor?.type, actor);
console.warn("L5R5E | AS | Wrong actor type", actor?.type, actor);
return;
}
@@ -252,7 +252,7 @@ export class ArmySheetL5r5e extends BaseSheetL5r5e {
break;
default:
console.warn("L5R5E | Unknown type", type);
console.warn("L5R5E | AS | Unknown type", type);
return;
}
return this.actor.update(actorData);
@@ -276,7 +276,7 @@ export class ArmySheetL5r5e extends BaseSheetL5r5e {
break;
default:
console.warn("L5R5E | Unknown type", type);
console.warn("L5R5E | AS | Unknown type", type);
return;
}
return this.actor.update({ system: actorData });
@@ -323,7 +323,7 @@ export class ArmySheetL5r5e extends BaseSheetL5r5e {
break;
default:
console.warn("L5R5E | Unsupported type", type);
console.warn("L5R5E | AS | Unsupported type", type);
break;
}
}

View File

@@ -49,7 +49,7 @@ export class BaseCharacterSheetL5r5e extends BaseSheetL5r5e {
// Build the list order
Array.from(CONFIG.l5r5e.techniques)
.filter(([id, cfg]) => cfg.type !== "custom" || game.settings.get("l5r5e", "techniques-customs"))
.filter(([id, cfg]) => cfg.type !== "custom" || game.settings.get(CONFIG.l5r5e.namespace, "techniques-customs"))
.forEach(([id, cfg]) => {
out[id] = [];
});
@@ -60,7 +60,7 @@ export class BaseCharacterSheetL5r5e extends BaseSheetL5r5e {
case "technique":
if (!out[item.system.technique_type]) {
console.warn(
`L5R5E | Empty or unknown technique type[${item.system.technique_type}] forced to "kata" in item id[${item._id}], name[${item.name}]`
`L5R5E | BCS | Empty or unknown technique type[${item.system.technique_type}] forced to "kata" in item id[${item._id}], name[${item.name}]`
);
item.system.technique_type = "kata";
}
@@ -73,7 +73,7 @@ export class BaseCharacterSheetL5r5e extends BaseSheetL5r5e {
if (embedItem.type === "technique") {
if (!out[embedItem.system.technique_type]) {
console.warn(
`L5R5E | Empty or unknown technique type[${embedItem.system.technique_type}] forced to "kata" in item id[${id}], name[${embedItem.name}], parent: id[${item._id}], name[${item.name}]`
`L5R5E | BCS | Empty or unknown technique type[${embedItem.system.technique_type}] forced to "kata" in item id[${id}], name[${embedItem.name}], parent: id[${item._id}], name[${item.name}]`
);
embedItem.system.technique_type = "kata";
}
@@ -135,14 +135,14 @@ export class BaseCharacterSheetL5r5e extends BaseSheetL5r5e {
async _onDrop(event) {
// *** Everything below here is only needed if the sheet is editable ***
if (!this.isEditable || this.actor.system.soft_locked) {
console.log("L5R5E | This sheet is not editable");
console.log("L5R5E | BCS | This sheet is not editable");
return;
}
// Check item type and subtype
const item = await game.l5r5e.HelpersL5r5e.getDragnDropTargetObject(event);
if (!item || !["Item", "JournalEntry"].includes(item.documentName) || item.type === "property") {
console.log(`L5R5E | Wrong subtype ${item?.type}`, item);
console.log(`L5R5E | BCS | Wrong subtype ${item?.type}`, item);
return;
}
@@ -150,7 +150,7 @@ export class BaseCharacterSheetL5r5e extends BaseSheetL5r5e {
if (item.documentName === "JournalEntry") {
// npc does not have this
if (!this.actor.system.identity?.school_curriculum_journal) {
console.log("L5R5E | NPC won't go to school :'(");
console.log("L5R5E | BCS | NPC won't go to school :'(");
return;
}
this.actor.system.identity.school_curriculum_journal = {
@@ -180,7 +180,7 @@ export class BaseCharacterSheetL5r5e extends BaseSheetL5r5e {
return embedItem._id === item._id;
})
) {
console.log("L5R5E | This element has been ignored because it already exists in this actor", item.uuid);
console.log("L5R5E | BCS | This element has been ignored because it already exists in this actor", item.uuid);
return;
}
@@ -207,7 +207,7 @@ export class BaseCharacterSheetL5r5e extends BaseSheetL5r5e {
switch (itemData.type) {
case "army_cohort":
case "army_fortification":
console.warn("L5R5E | Army items are not allowed", item?.type, item);
console.warn("L5R5E | BCS | Army items are not allowed", item?.type, item);
return;
case "advancement":
@@ -354,7 +354,7 @@ export class BaseCharacterSheetL5r5e extends BaseSheetL5r5e {
const created = await this.actor.createEmbeddedDocuments("Item", [
{
name: game.i18n.localize(`ITEM.Type${type.capitalize()}`),
name: game.i18n.localize(`TYPES.Item.${type.toLowerCase()}`),
type: type,
img: `${CONFIG.l5r5e.paths.assets}icons/items/${type}.svg`,
},
@@ -556,7 +556,7 @@ export class BaseCharacterSheetL5r5e extends BaseSheetL5r5e {
break;
default:
console.warn("L5R5E | Unsupported type", type);
console.warn("L5R5E | BCS | Unsupported type", type);
break;
}
}

View File

@@ -182,7 +182,7 @@ export class BaseSheetL5r5e extends ActorSheet {
const created = await this.actor.createEmbeddedDocuments("Item", [
{
name: game.i18n.localize(`ITEM.Type${type.capitalize()}`),
name: game.i18n.localize(`TYPES.Item.${type.toLowerCase()}`),
type: type,
img: `${CONFIG.l5r5e.paths.assets}icons/items/${type}.svg`,
},

View File

@@ -90,7 +90,7 @@ export class CharacterGenerator {
static async _getItemFromPack(packName, id = null) {
const comp = await game.packs.get(packName);
if (!comp) {
console.log(`L5R5E | Pack not found[${packName}]`);
console.log(`L5R5E | CG | Pack not found[${packName}]`);
return;
}
let document;

View File

@@ -104,19 +104,19 @@ export class TwentyQuestionsDialog extends FormApplication {
new DragDrop({
dragSelector: ".item",
dropSelector: ".items",
permissions: { dragstart: this._canDragStart.bind(this), drop: this._canDragDrop.bind(this) },
permissions: { dragstart: this.isEditable, drop: this.isEditable },
callbacks: { dragstart: this._onDragStart.bind(this), drop: this._onDropItem.bind(this, "item") },
}),
new DragDrop({
dragSelector: ".technique",
dropSelector: ".techniques",
permissions: { dragstart: this._canDragStart.bind(this), drop: this._canDragDrop.bind(this) },
permissions: { dragstart: this.isEditable, drop: this.isEditable },
callbacks: { dragstart: this._onDragStart.bind(this), drop: this._onDropItem.bind(this, "technique") },
}),
new DragDrop({
dragSelector: ".peculiarity",
dropSelector: ".peculiarities",
permissions: { dragstart: this._canDragStart.bind(this), drop: this._canDragDrop.bind(this) },
permissions: { dragstart: this.isEditable, drop: this.isEditable },
callbacks: {
dragstart: this._onDragStart.bind(this),
drop: this._onDropItem.bind(this, "peculiarity"),
@@ -125,7 +125,7 @@ export class TwentyQuestionsDialog extends FormApplication {
new DragDrop({
dragSelector: ".bond",
dropSelector: ".bonds",
permissions: { dragstart: this._canDragStart.bind(this), drop: this._canDragDrop.bind(this) },
permissions: { dragstart: this.isEditable, drop: this.isEditable },
callbacks: {
dragstart: this._onDragStart.bind(this),
drop: this._onDropItem.bind(this, "bond"),
@@ -253,14 +253,14 @@ export class TwentyQuestionsDialog extends FormApplication {
}
const stepKey = $(event.target).data("step");
if (!stepKey) {
console.warn("L5R5E | Event stepKey is undefined");
console.warn("L5R5E | 20Q | Event stepKey is undefined");
return;
}
try {
// Get item
const item = await game.l5r5e.HelpersL5r5e.getDragnDropTargetObject(event);
if (item.documentName !== "Item" || !item) {
console.warn(`L5R5E | Forbidden item for this drop zone ${type} : ${item.type}`);
console.warn(`L5R5E | 20Q | Forbidden item for this drop zone ${type} : ${item.type}`);
return;
}
@@ -273,7 +273,7 @@ export class TwentyQuestionsDialog extends FormApplication {
(type !== "item" && item.type !== type) ||
(type === "item" && !["item", "weapon", "armor"].includes(item.type))
) {
console.warn(`L5R5E | Forbidden item for this drop zone ${type} : ${item.type}`);
console.warn(`L5R5E | 20Q | Forbidden item for this drop zone ${type} : ${item.type}`);
return;
}
@@ -286,7 +286,7 @@ export class TwentyQuestionsDialog extends FormApplication {
if (stepKey === "step3.school_ability") {
if (item.system.technique_type !== "school_ability") {
console.warn(
`L5R5E | This technique is not a school ability : ${item.system.technique_type}`
`L5R5E | 20Q | This technique is not a school ability : ${item.system.technique_type}`
);
return;
}
@@ -301,37 +301,37 @@ export class TwentyQuestionsDialog extends FormApplication {
switch (stepKey) {
case "step9.distinction":
if (item.system.peculiarity_type !== "distinction") {
console.warn("L5R5E | Wrong type", item.system.peculiarity_type);
console.warn(`L5R5E | 20Q | Wrong type given "${item.system.peculiarity_type}" instead of "distinction"`);
return;
}
break;
case "step10.adversity":
if (item.system.peculiarity_type !== "adversity") {
console.warn("L5R5E | Wrong type", item.system.peculiarity_type);
console.warn(`L5R5E | 20Q | Wrong type given "${item.system.peculiarity_type}" instead of "adversity"`);
return;
}
break;
case "step11.passion":
if (item.system.peculiarity_type !== "passion") {
console.warn("L5R5E | Wrong type", item.system.peculiarity_type);
console.warn(`L5R5E | 20Q | Wrong type given "${item.system.peculiarity_type}" instead of "passion"`);
return;
}
break;
case "step12.anxiety":
if (item.system.peculiarity_type !== "anxiety") {
console.warn("L5R5E | Wrong type", item.system.peculiarity_type);
console.warn(`L5R5E | 20Q | Wrong type given "${item.system.peculiarity_type}" instead of "anxiety"`);
return;
}
break;
case "step13.advantage":
if (!["distinction", "passion"].includes(item.system.peculiarity_type)) {
console.warn("L5R5E | Wrong type", item.system.peculiarity_type);
console.warn(`L5R5E | 20Q | Wrong type given "${item.system.peculiarity_type}" instead of "distinction" or "passion"`);
return;
}
break;
case "step13.disadvantage":
if (!["adversity", "anxiety"].includes(item.system.peculiarity_type)) {
console.warn("L5R5E | Wrong type", item.system.peculiarity_type);
console.warn(`L5R5E | 20Q | Wrong type given "${item.system.peculiarity_type}" instead of "adversity" or "anxiety"`);
return;
}
break;
@@ -344,7 +344,7 @@ export class TwentyQuestionsDialog extends FormApplication {
this.submit();
} catch (err) {
console.warn("L5R5E | ", err);
console.warn("L5R5E | 20Q | ", err);
}
return false;
}
@@ -430,7 +430,7 @@ export class TwentyQuestionsDialog extends FormApplication {
}
const item = await game.l5r5e.HelpersL5r5e.getObjectGameOrPack({ id: id, type: "Item" });
if (!item) {
console.warn(`L5R5E | Unknown item id[${id}]`);
console.warn(`L5R5E | 20Q | Unknown item id[${id}]`);
continue;
}
newStep.push(id);