Working on Compatibility for FVTT v10
Removed restriction on technique types on drop (Sheet and 20Q). Again some missing data->system
This commit is contained in:
@@ -248,10 +248,10 @@ export class BaseCharacterSheetL5r5e extends BaseSheetL5r5e {
|
||||
itemData.system.in_curriculum = true;
|
||||
} else {
|
||||
// Check if technique is allowed for this character
|
||||
if (!game.user.isGM && !this.actor.system.techniques[itemData.system.technique_type]) {
|
||||
ui.notifications.info(game.i18n.localize("l5r5e.techniques.not_allowed"));
|
||||
return;
|
||||
}
|
||||
// if (!game.user.isGM && !this.actor.system.techniques[itemData.system.technique_type]) {
|
||||
// ui.notifications.info(game.i18n.localize("l5r5e.techniques.not_allowed"));
|
||||
// return;
|
||||
// }
|
||||
|
||||
// Verify cost
|
||||
itemData.system.xp_cost =
|
||||
|
||||
@@ -290,10 +290,10 @@ export class TwentyQuestionsDialog extends FormApplication {
|
||||
);
|
||||
return;
|
||||
}
|
||||
} else if (!this.object.data.step3.allowed_techniques?.[item.system.technique_type]) {
|
||||
// Tech not allowed
|
||||
ui.notifications.info(game.i18n.localize("l5r5e.techniques.not_allowed"));
|
||||
return;
|
||||
// } else if (!this.object.data.step3.allowed_techniques?.[item.system.technique_type]) {
|
||||
// // Tech not allowed
|
||||
// ui.notifications.info(game.i18n.localize("l5r5e.techniques.not_allowed"));
|
||||
// return;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
@@ -389,9 +389,9 @@ export class GmMonitor extends FormApplication {
|
||||
const display = (e) => {
|
||||
return (
|
||||
e.name +
|
||||
` (<i class="fas fa-arrows-alt-h"> ${e.data.data.range}</i>` +
|
||||
` / <i class="fas fa-tint"> ${e.data.data.damage}</i>` +
|
||||
` / <i class="fas fa-skull"> ${e.data.data.deadliness}</i>)`
|
||||
` (<i class="fas fa-arrows-alt-h"> ${e.system.range}</i>` +
|
||||
` / <i class="fas fa-tint"> ${e.system.damage}</i>` +
|
||||
` / <i class="fas fa-skull"> ${e.system.deadliness}</i>)`
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
@@ -64,12 +64,6 @@ export const RegisterHandlebars = function () {
|
||||
return objects.join("");
|
||||
});
|
||||
|
||||
// enrichHTML
|
||||
Handlebars.registerHelper("enrichHTML", function (text, options = {}) {
|
||||
options.async = false;
|
||||
return TextEditor.enrichHTML(text, options);
|
||||
});
|
||||
|
||||
// Add a setter
|
||||
Handlebars.registerHelper("setVar", function (varName, varValue, options) {
|
||||
options.data.root[varName] = varValue;
|
||||
@@ -77,8 +71,8 @@ export const RegisterHandlebars = function () {
|
||||
|
||||
/**
|
||||
* Utility conditional, usable in nested expression
|
||||
* {{#ifCond (ifCond advancement.type '==' 'technique') '||' (ifCond item.data.technique_type '==' 'kata')}}
|
||||
* {{#ifCond '["distinction","passion"]' 'includes' item.data.peculiarity_type}}
|
||||
* {{#ifCond (ifCond advancement.type '==' 'technique') '||' (ifCond item.system.technique_type '==' 'kata')}}
|
||||
* {{#ifCond '["distinction","passion"]' 'includes' item.system.peculiarity_type}}
|
||||
*/
|
||||
Handlebars.registerHelper("ifCond", function (a, operator, b, options) {
|
||||
let result = false;
|
||||
|
||||
@@ -114,7 +114,7 @@ export class ItemSheetL5r5e extends BaseItemSheetL5r5e {
|
||||
}
|
||||
|
||||
// If we are a property, the child id need to be different to parent
|
||||
if (this.item.type === "property" && this.item.id === item.data._id) {
|
||||
if (this.item.type === "property" && this.item.id === item._id) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ export class MigrationL5r5e {
|
||||
|
||||
// Warn the users
|
||||
ui.notifications.info(
|
||||
`Applying L5R5e System Migration for version ${game.system.data.version}.` +
|
||||
`Applying L5R5e System Migration for version ${game.system.version}.` +
|
||||
` Please be patient and do not close your game or shut down your server.`,
|
||||
{ permanent: true }
|
||||
);
|
||||
@@ -56,7 +56,7 @@ export class MigrationL5r5e {
|
||||
// Migrate World Items
|
||||
for (let item of game.items.contents) {
|
||||
try {
|
||||
const updateData = MigrationL5r5e._migrateItemData(item.data, options);
|
||||
const updateData = MigrationL5r5e._migrateItemData(item, options);
|
||||
if (!foundry.utils.isEmpty(updateData)) {
|
||||
console.log(`L5R5E | Migrating Item entity ${item.name}`);
|
||||
await item.update(updateData);
|
||||
@@ -70,7 +70,7 @@ export class MigrationL5r5e {
|
||||
// Migrate Actor Override Tokens
|
||||
for (let scene of game.scenes.contents) {
|
||||
try {
|
||||
const updateData = MigrationL5r5e._migrateSceneData(scene.data, options);
|
||||
const updateData = MigrationL5r5e._migrateSceneData(scene, options);
|
||||
if (!foundry.utils.isEmpty(updateData)) {
|
||||
console.log(`L5R5E | Migrating Scene entity ${scene.name}`);
|
||||
await scene.update(updateData);
|
||||
@@ -96,9 +96,9 @@ export class MigrationL5r5e {
|
||||
try {
|
||||
const updatedChatList = [];
|
||||
for (let message of game.collections.get("ChatMessage")) {
|
||||
const updateData = MigrationL5r5e._migrateChatMessage(message.data, options);
|
||||
const updateData = MigrationL5r5e._migrateChatMessage(message, options);
|
||||
if (!foundry.utils.isEmpty(updateData)) {
|
||||
updateData["_id"] = message.data._id;
|
||||
updateData["_id"] = message._id;
|
||||
updatedChatList.push(updateData);
|
||||
}
|
||||
}
|
||||
@@ -113,8 +113,8 @@ export class MigrationL5r5e {
|
||||
}
|
||||
|
||||
// Set the migration as complete
|
||||
await game.settings.set("l5r5e", "systemMigrationVersion", game.system.data.version);
|
||||
ui.notifications.info(`L5R5e System Migration to version ${game.system.data.version} completed!`, {
|
||||
await game.settings.set("l5r5e", "systemMigrationVersion", game.system.version);
|
||||
ui.notifications.info(`L5R5e System Migration to version ${game.system.version} completed!`, {
|
||||
permanent: true,
|
||||
});
|
||||
}
|
||||
@@ -147,13 +147,13 @@ export class MigrationL5r5e {
|
||||
|
||||
switch (entity) {
|
||||
case "Actor":
|
||||
updateData = MigrationL5r5e._migrateActorData(ent.data);
|
||||
updateData = MigrationL5r5e._migrateActorData(ent);
|
||||
break;
|
||||
case "Item":
|
||||
updateData = MigrationL5r5e._migrateItemData(ent.data);
|
||||
updateData = MigrationL5r5e._migrateItemData(ent);
|
||||
break;
|
||||
case "Scene":
|
||||
updateData = MigrationL5r5e._migrateSceneData(ent.data);
|
||||
updateData = MigrationL5r5e._migrateSceneData(ent);
|
||||
break;
|
||||
}
|
||||
if (foundry.utils.isEmpty(updateData)) {
|
||||
@@ -161,7 +161,7 @@ export class MigrationL5r5e {
|
||||
}
|
||||
|
||||
// Add the entry, if data was changed
|
||||
updateData["_id"] = ent.data._id;
|
||||
updateData["_id"] = ent._id;
|
||||
updateDatasList.push(updateData);
|
||||
|
||||
console.log(`L5R5E | Migrating ${entity} entity ${ent.name} in Compendium ${pack.collection}`);
|
||||
@@ -291,7 +291,7 @@ export class MigrationL5r5e {
|
||||
*/
|
||||
static cleanActorData(actorData) {
|
||||
const model = game.system.model.Actor[actorData.type];
|
||||
actorData.data = foundry.utils.filterObject(actorData.data, model);
|
||||
actorData = foundry.utils.filterObject(actorData, model);
|
||||
return actorData;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user