diff --git a/CHANGELOG.md b/CHANGELOG.md
index db318ef..fe8f478 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,8 @@
# Changelog
+## 1.3.0 - Foundry 0.8.x compatibility
+- Updated the System to the new version of Foundry VTT (a lot of things broke)
+
## 1.2.2 - Before the Change
- Added some custom technique's types by request: Link & Specificity
- Added Mantis Clan compendium entries
diff --git a/system/assets/icons/techs/link.svg b/system/assets/icons/techs/link.svg
new file mode 100644
index 0000000..50dea95
--- /dev/null
+++ b/system/assets/icons/techs/link.svg
@@ -0,0 +1,541 @@
+
+
+
diff --git a/system/assets/icons/techs/specificity.svg b/system/assets/icons/techs/specificity.svg
new file mode 100644
index 0000000..50dea95
--- /dev/null
+++ b/system/assets/icons/techs/specificity.svg
@@ -0,0 +1,541 @@
+
+
+
diff --git a/system/scripts/actors/base-sheet.js b/system/scripts/actors/base-sheet.js
index 1d6a2c8..7c61b20 100644
--- a/system/scripts/actors/base-sheet.js
+++ b/system/scripts/actors/base-sheet.js
@@ -64,7 +64,7 @@ export class BaseSheetL5r5e extends ActorSheet {
Object.keys(out).forEach((tech) => {
if (
out[tech].length < 1 &&
- !sheetData.data.techniques[tech] &&
+ !sheetData.data.data.techniques[tech] &&
!CONFIG.l5r5e.techniques_school.includes(tech)
) {
delete out[tech];
@@ -72,11 +72,11 @@ export class BaseSheetL5r5e extends ActorSheet {
});
// Manage school add button
- sheetData.data.techniques["school_ability"] = out["school_ability"].length === 0;
- sheetData.data.techniques["mastery_ability"] = out["mastery_ability"].length === 0;
+ sheetData.data.data.techniques["school_ability"] = out["school_ability"].length === 0;
+ sheetData.data.data.techniques["mastery_ability"] = out["mastery_ability"].length === 0;
// Always display "school_ability", but display "mastery_ability" only if rank >= 5
- if (sheetData.data.identity?.school_rank < 5 && out["mastery_ability"].length === 0) {
+ if (sheetData.data.data.identity?.school_rank < 5 && out["mastery_ability"].length === 0) {
delete out["mastery_ability"];
}
return out;
@@ -155,7 +155,7 @@ export class BaseSheetL5r5e extends ActorSheet {
const item = await game.l5r5e.HelpersL5r5e.getDragnDropTargetObject(event);
if (
!item ||
- item.entity !== "Item" ||
+ item.documentName !== "Item" ||
!["item", "armor", "weapon", "technique", "peculiarity", "advancement"].includes(item.data.type)
) {
return;
@@ -221,7 +221,7 @@ export class BaseSheetL5r5e extends ActorSheet {
if (allowed === false) {
return;
}
- return this._onDropItem(event, item);
+ return this._onDropItemCreate(item.toJSON());
}
/**
@@ -321,12 +321,14 @@ export class BaseSheetL5r5e extends ActorSheet {
peculiarity: "l5r5e.peculiarities.title_new",
advancement: "l5r5e.advancements.title_new",
};
- const created = await this.actor.createEmbeddedEntity("OwnedItem", {
- name: game.i18n.localize(titles[type]),
- type: type,
- img: `${CONFIG.l5r5e.paths.assets}icons/items/${type}.svg`,
- });
- const item = this.actor.getOwnedItem(created._id);
+ const created = await this.actor.createEmbeddedDocuments("Item", [
+ {
+ name: game.i18n.localize(titles[type]),
+ type: type,
+ img: `${CONFIG.l5r5e.paths.assets}icons/items/${type}.svg`,
+ },
+ ]);
+ const item = this.actor.items.get(created[0].id);
// assign current school rank to the new adv/tech
if (this.actor.data.data.identity?.school_rank && ["advancement", "technique"].includes(item.data.type)) {
@@ -347,7 +349,7 @@ export class BaseSheetL5r5e extends ActorSheet {
const techType = $(event.currentTarget).data("tech-type");
if ([...CONFIG.l5r5e.techniques, ...CONFIG.l5r5e.techniques_school].includes(techType)) {
item.data.data.technique_type = techType;
- item.data.img = `${CONFIG.l5r5e.paths.assets}/icons/techs/${techType}.svg`;
+ item.data.img = `${CONFIG.l5r5e.paths.assets}icons/techs/${techType}.svg`;
}
break;
}
@@ -366,7 +368,7 @@ export class BaseSheetL5r5e extends ActorSheet {
event.stopPropagation();
const itemId = $(event.currentTarget).data("item-id");
- const item = this.actor.getOwnedItem(itemId);
+ const item = this.actor.items.get(itemId);
item.sheet.render(true);
}
@@ -382,7 +384,7 @@ export class BaseSheetL5r5e extends ActorSheet {
const itemId = $(event.currentTarget).data("item-id");
// Remove 1 qty if possible
- const tmpItem = this.actor.getOwnedItem(itemId);
+ const tmpItem = this.actor.items.get(itemId);
if (tmpItem && tmpItem.data.data.quantity > 1 && this._modifyQuantity(tmpItem._id, -1)) {
return;
}
@@ -411,8 +413,7 @@ export class BaseSheetL5r5e extends ActorSheet {
data: diffObject(this.actor.data.data, actor),
});
}
-
- return this.actor.deleteOwnedItem(itemId);
+ return this.actor.deleteEmbeddedDocuments("Item", [itemId]);
};
// Holing Ctrl = without confirm
@@ -433,7 +434,7 @@ export class BaseSheetL5r5e extends ActorSheet {
*/
_switchSubItemCurriculum(event) {
const itemId = $(event.currentTarget).data("item-id");
- const item = this.actor.getOwnedItem(itemId);
+ const item = this.actor.items.get(itemId);
if (item.type !== "item") {
item.update({
data: {
@@ -448,7 +449,7 @@ export class BaseSheetL5r5e extends ActorSheet {
* @private
*/
_modifyQuantity(itemId, add) {
- const tmpItem = this.actor.getOwnedItem(itemId);
+ const tmpItem = this.actor.items.get(itemId);
if (tmpItem) {
tmpItem.data.data.quantity = Math.max(1, tmpItem.data.data.quantity + add);
tmpItem.update({
@@ -476,7 +477,7 @@ export class BaseSheetL5r5e extends ActorSheet {
}
const itemId = $(event.currentTarget).data("item-id");
- const tmpItem = this.actor.getOwnedItem(itemId);
+ const tmpItem = this.actor.items.get(itemId);
if (!tmpItem || tmpItem.data.data[type] === undefined) {
return;
}
@@ -498,7 +499,7 @@ export class BaseSheetL5r5e extends ActorSheet {
* @private
*/
_getWeaponSkillId(weaponId) {
- const item = this.actor.getOwnedItem(weaponId);
+ const item = this.actor.items.get(weaponId);
if (!!item && item.type === "weapon") {
return item.data.data.skill;
}
diff --git a/system/scripts/actors/character-sheet.js b/system/scripts/actors/character-sheet.js
index a265074..be8d2a6 100644
--- a/system/scripts/actors/character-sheet.js
+++ b/system/scripts/actors/character-sheet.js
@@ -47,11 +47,13 @@ export class CharacterSheetL5r5e extends BaseSheetL5r5e {
this.actor.data.data.identity.school_rank = Math.max(1, this.actor.data.data.identity.school_rank);
// Split Money
- sheetData.data.money = this._zeniToMoney(this.actor.data.data.zeni);
+ sheetData.data.data.money = this._zeniToMoney(this.actor.data.data.zeni);
// split advancements list by rank, and calculate xp spent
this._prepareAdvancement(sheetData);
- sheetData.data.xp_saved = Math.floor(parseInt(sheetData.data.xp_total) - parseInt(sheetData.data.xp_spent));
+ sheetData.data.data.xp_saved = Math.floor(
+ parseInt(sheetData.data.data.xp_total) - parseInt(sheetData.data.data.xp_spent)
+ );
return sheetData;
}
@@ -100,14 +102,14 @@ export class CharacterSheetL5r5e extends BaseSheetL5r5e {
*/
_prepareAdvancement(sheetData) {
const adv = [];
- sheetData.data.xp_spent = 0;
+ sheetData.data.data.xp_spent = 0;
sheetData.items.forEach((item) => {
if (!["peculiarity", "technique", "advancement"].includes(item.type)) {
return;
}
let xp = parseInt(item.data.xp_used) || 0;
- sheetData.data.xp_spent = parseInt(sheetData.data.xp_spent) + xp;
+ sheetData.data.data.xp_spent = parseInt(sheetData.data.data.xp_spent) + xp;
// if not in curriculum, xp spent /2 for this item
if (!item.data.in_curriculum && xp > 0) {
@@ -126,7 +128,7 @@ export class CharacterSheetL5r5e extends BaseSheetL5r5e {
adv[rank].list.push(item);
adv[rank].spent = adv[rank].spent + xp;
});
- sheetData.advancementsListByRank = adv;
+ sheetData.data.advancementsListByRank = adv;
}
/**
diff --git a/system/scripts/actors/npc-sheet.js b/system/scripts/actors/npc-sheet.js
index a02ffa3..c5b7860 100644
--- a/system/scripts/actors/npc-sheet.js
+++ b/system/scripts/actors/npc-sheet.js
@@ -19,7 +19,7 @@ export class NpcSheetL5r5e extends BaseSheetL5r5e {
getData() {
const sheetData = super.getData();
- sheetData.data.types = NpcSheetL5r5e.types.map((e) => ({
+ sheetData.data.data.types = NpcSheetL5r5e.types.map((e) => ({
id: e,
label: game.i18n.localize("l5r5e.character_types." + e),
}));
diff --git a/system/scripts/actors/twenty-questions-dialog.js b/system/scripts/actors/twenty-questions-dialog.js
index a82020a..dc4077e 100644
--- a/system/scripts/actors/twenty-questions-dialog.js
+++ b/system/scripts/actors/twenty-questions-dialog.js
@@ -51,7 +51,7 @@ export class TwentyQuestionsDialog extends FormApplication {
* Define a unique and dynamic element ID for the rendered ActorSheet application
*/
get id() {
- return `l5r5e-twenty-questions-dialog-${this.actor._id}`;
+ return `l5r5e-twenty-questions-dialog-${this.actor.id}`;
}
/**
@@ -69,7 +69,7 @@ export class TwentyQuestionsDialog extends FormApplication {
if (!this.actor) {
return;
}
- this._initialize(game.actors.get(this.actor._id));
+ this._initialize(game.actors.get(this.actor.id));
await this._constructCache();
this.render(false);
}
@@ -234,7 +234,7 @@ export class TwentyQuestionsDialog extends FormApplication {
try {
// Get item
const item = await game.l5r5e.HelpersL5r5e.getDragnDropTargetObject(event);
- if (item.entity !== "Item" || !item) {
+ if (item.documentName !== "Item" || !item) {
console.warn("forbidden item for this drop zone", type, item.data.type);
return;
}
diff --git a/system/scripts/actors/twenty-questions.js b/system/scripts/actors/twenty-questions.js
index 084aa9e..7b51ea6 100644
--- a/system/scripts/actors/twenty-questions.js
+++ b/system/scripts/actors/twenty-questions.js
@@ -82,6 +82,8 @@ export class TwentyQuestions {
shuji: false,
maho: false,
ninjutsu: false,
+ link: false,
+ specificity: false,
},
techniques: [],
school_ability: [],
@@ -285,8 +287,8 @@ export class TwentyQuestions {
});
// Clear and add items to actor
- const deleteIds = actor.data.items.map((e) => e._id);
- await actor.deleteEmbeddedEntity("OwnedItem", deleteIds);
+ const deleteIds = actor.data.items.map((e) => e.id);
+ await actor.deleteEmbeddedDocuments("Item", deleteIds);
// Add items in 20Q to actor
for (const types of Object.values(itemsCache)) {
@@ -298,7 +300,7 @@ export class TwentyQuestions {
if (itemData.data?.xp_spent) {
itemData.data.xp_spent = 0;
}
- await actor.createEmbeddedEntity("OwnedItem", itemData);
+ await actor.createEmbeddedDocuments("Item", [itemData]);
}
}
diff --git a/system/scripts/helpers.js b/system/scripts/helpers.js
index 210f062..12a43eb 100644
--- a/system/scripts/helpers.js
+++ b/system/scripts/helpers.js
@@ -75,7 +75,7 @@ export class HelpersL5r5e {
// Named pack
if (pack) {
- const data = await game.packs.get(pack).getEntity(id);
+ const data = await game.packs.get(pack).getDocument(id);
if (data) {
return HelpersL5r5e.createItemFromCompendium(data);
}
@@ -107,13 +107,13 @@ export class HelpersL5r5e {
// Unknown pack object, iterate all packs
for (const comp of game.packs) {
- // TODO Bug with babele if "comp.getEntity(id)" return null...
- const babeleFix = (await comp.getIndex()).some((e) => e._id === id);
+ // TODO Bug with babele if "comp.getDocument(id)" return null...
+ const babeleFix = (await comp.getIndex()).some((e) => e.id === id);
if (!babeleFix) {
continue;
}
- const data = await comp.getEntity(id);
+ const data = await comp.getDocument(id);
if (data) {
return HelpersL5r5e.createItemFromCompendium(data);
}
@@ -140,7 +140,7 @@ export class HelpersL5r5e {
item = await ItemL5r5e.create(data, { temporary: true });
// reinject compendium id (required for properties)
- item.data._id = data._id;
+ item.data.id = data.id;
} else {
// Quick object
item = new ItemL5r5e(data);
@@ -158,7 +158,7 @@ export class HelpersL5r5e {
item.data.data.properties.map(async (property) => {
const gameProp = await game.l5r5e.HelpersL5r5e.getObjectGameOrPack(property.id, "Item");
if (gameProp) {
- return { id: gameProp._id, name: gameProp.name };
+ return { id: gameProp.id, name: gameProp.name };
}
return property;
})
diff --git a/system/scripts/hooks.js b/system/scripts/hooks.js
index 3470409..5aba2b7 100644
--- a/system/scripts/hooks.js
+++ b/system/scripts/hooks.js
@@ -147,18 +147,20 @@ export default class HooksL5r5e {
static async renderCompendium(app, html, data) {
// templates "item" : add Rarity
// Techniques / Peculiarities : add Ring / Rank
- if (app.entity === "Item") {
- const content = await app.getContent();
- content.forEach((item) => {
- if (["weapon", "armor", "item", "peculiarity", "technique", "peculiarity"].includes(item.type)) {
- html.find(`[data-entry-id="${item._id}"]`).append(
+ if (app.collection.documentName === "Item") {
+ const content = await app.collection.getDocuments();
+ content.forEach((document) => {
+ if (["weapon", "armor", "item", "peculiarity", "technique", "peculiarity"].includes(document.type)) {
+ html.find(`[data-document-id="${document.id}"]`).append(
`` +
- (item.data.data.rarity
- ? `${game.i18n.localize("l5r5e.rarity")} ${item.data.data.rarity}`
+ (document.data.data.rarity
+ ? `${game.i18n.localize("l5r5e.rarity")} ${document.data.data.rarity}`
+ : "") +
+ (document.data.data.rank
+ ? game.i18n.localize("l5r5e.rank") + " " + document.data.data.rank
: "") +
- (item.data.data.rank ? game.i18n.localize("l5r5e.rank") + " " + item.data.data.rank : "") +
``
);
}
diff --git a/system/scripts/items/item-sheet.js b/system/scripts/items/item-sheet.js
index 64eb864..31c293d 100644
--- a/system/scripts/items/item-sheet.js
+++ b/system/scripts/items/item-sheet.js
@@ -35,16 +35,16 @@ export class ItemSheetL5r5e extends ItemSheet {
async _prepareProperties(sheetData) {
sheetData.data.propertiesList = [];
- if (Array.isArray(sheetData.data.properties)) {
+ if (Array.isArray(sheetData.data.data.properties)) {
const props = [];
- for (const property of sheetData.data.properties) {
+ for (const property of sheetData.data.data.properties) {
const gameProp = await game.l5r5e.HelpersL5r5e.getObjectGameOrPack(property.id, "Item");
if (gameProp) {
sheetData.data.propertiesList.push(gameProp);
- props.push({ id: gameProp._id, name: gameProp.name });
+ props.push({ id: gameProp.id, name: gameProp.name });
}
}
- sheetData.data.properties = props;
+ sheetData.data.data.properties = props;
}
}
@@ -135,7 +135,7 @@ export class ItemSheetL5r5e extends ItemSheet {
// Check item type and subtype
const item = await game.l5r5e.HelpersL5r5e.getDragnDropTargetObject(event);
- if (!item || item.entity !== "Item" || item.data.type !== "property" || this.item.type === "property") {
+ if (!item || item.documentName !== "Item" || item.data.type !== "property" || this.item.type === "property") {
return;
}
@@ -148,19 +148,19 @@ export class ItemSheetL5r5e extends ItemSheet {
* @private
*/
_addProperty(item) {
- if (!Array.isArray(this.entity.data.data.properties)) {
- this.entity.data.data.properties = [];
+ if (!Array.isArray(this.document.data.data.properties)) {
+ this.document.data.data.properties = [];
}
- if (this.entity.data.data.properties.findIndex((p) => p.id === item.id) !== -1) {
+ if (this.document.data.data.properties.findIndex((p) => p.id === item.id) !== -1) {
return;
}
- this.entity.data.data.properties.push({ id: item.id, name: item.name });
+ this.document.data.data.properties.push({ id: item.id, name: item.name });
- this.entity.update({
+ this.document.update({
data: {
- properties: this.entity.data.data.properties,
+ properties: this.document.data.data.properties,
},
});
}
@@ -173,21 +173,21 @@ export class ItemSheetL5r5e extends ItemSheet {
event.preventDefault();
event.stopPropagation();
- if (!Array.isArray(this.entity.data.data.properties)) {
+ if (!Array.isArray(this.document.data.data.properties)) {
return;
}
const id = $(event.currentTarget).parents(".property").data("propertyId");
- const tmpProps = this.entity.data.data.properties.find((p) => p.id === id);
+ const tmpProps = this.document.data.data.properties.find((p) => p.id === id);
if (!tmpProps) {
return;
}
const callback = async () => {
- this.entity.data.data.properties = this.entity.data.data.properties.filter((p) => p.id !== id);
- this.entity.update({
+ this.document.data.data.properties = this.document.data.data.properties.filter((p) => p.id !== id);
+ this.document.update({
data: {
- properties: this.entity.data.data.properties,
+ properties: this.document.data.data.properties,
},
});
};
diff --git a/system/scripts/items/property-sheet.js b/system/scripts/items/property-sheet.js
index 783a76a..20663f6 100644
--- a/system/scripts/items/property-sheet.js
+++ b/system/scripts/items/property-sheet.js
@@ -14,5 +14,11 @@ export class PropertySheetL5r5e extends ItemSheetL5r5e {
tabs: [{ navSelector: ".sheet-tabs", contentSelector: ".sheet-body", initial: "description" }],
});
}
- // TODO certain propriétés en annule d'autres : aiguisé <-> abimé. voir comment faire.
+ // TODO Some properties cancel others :
+ // Concealable and Cumbersome
+ // Ceremonial and Mundane
+ // Damaged and Durable
+ // Resplendent and Subtle
+ // Subtle and Wargear
+ // Sacred and Unholy
}
diff --git a/system/scripts/main-l5r5e.js b/system/scripts/main-l5r5e.js
index c9a19d3..5a31e32 100644
--- a/system/scripts/main-l5r5e.js
+++ b/system/scripts/main-l5r5e.js
@@ -54,11 +54,11 @@ Hooks.once("init", async () => {
CONFIG.l5r5e = L5R5E;
// Assign custom classes and constants here
- CONFIG.Combat.entityClass = CombatL5r5e;
- CONFIG.Actor.entityClass = ActorL5r5e;
+ CONFIG.Combat.documentClass = CombatL5r5e;
+ CONFIG.Actor.documentClass = ActorL5r5e;
CONFIG.Actor.sheetClasses = CharacterSheetL5r5e;
- CONFIG.Item.entityClass = ItemL5r5e;
- CONFIG.JournalEntry.entityClass = JournalL5r5e;
+ CONFIG.Item.documentClass = ItemL5r5e;
+ CONFIG.JournalEntry.documentClass = JournalL5r5e;
CONFIG.JournalEntry.sheetClass = BaseJournalSheetL5r5e;
// Define custom Roll class
diff --git a/system/system.json b/system/system.json
index a296e02..565e341 100644
--- a/system/system.json
+++ b/system/system.json
@@ -2,9 +2,12 @@
"name": "l5r5e",
"title": "Legend of the Five Rings (5th Edition)",
"description": "This is an authorised multilingual game system En|Fr|Es, for Legend of the Five Rings (5th Edition) by Edge Studio
- Join the official Discord server: Official Discord
- Rejoignez la communauté Francophone: Francophone Discord
",
- "version": "1.2.2",
- "minimumCoreVersion": "0.7.9",
- "compatibleCoreVersion": "0.7.9",
+ "url": "https://gitlab.com/teaml5r/l5r5e",
+ "manifest": "https://gitlab.com/teaml5r/l5r5e/-/raw/master/system/system.json",
+ "download": "https://gitlab.com/teaml5r/l5r5e/-/jobs/artifacts/v1.3.0/raw/l5r5e.zip?job=build",
+ "version": "1.3.0",
+ "minimumCoreVersion": "0.8.1",
+ "compatibleCoreVersion": "0.8.1",
"manifestPlusVersion": "1.0.0",
"socket": true,
"author": "Team L5R",
@@ -182,8 +185,5 @@
"name": "Spanish (Spain)",
"path": "lang/es-es.json"
}
- ],
- "url": "https://gitlab.com/teaml5r/l5r5e",
- "manifest": "https://gitlab.com/teaml5r/l5r5e/-/raw/master/system/system.json",
- "download": "https://gitlab.com/teaml5r/l5r5e/-/jobs/artifacts/v1.2.1/raw/l5r5e.zip?job=build"
+ ]
}
diff --git a/system/template.json b/system/template.json
index f399663..17c9ed2 100644
--- a/system/template.json
+++ b/system/template.json
@@ -102,7 +102,9 @@
"ritual": false,
"shuji": false,
"maho": false,
- "ninjutsu": false
+ "ninjutsu": false,
+ "link": false,
+ "specificity": false
}
}
},
diff --git a/system/templates/actors/character-sheet.html b/system/templates/actors/character-sheet.html
index ab3d658..aa2b61f 100644
--- a/system/templates/actors/character-sheet.html
+++ b/system/templates/actors/character-sheet.html
@@ -4,45 +4,45 @@
{{!-- Sheet Body --}}
\ No newline at end of file
diff --git a/system/templates/actors/character/advancement.html b/system/templates/actors/character/advancement.html
index b51190f..ce816ba 100644
--- a/system/templates/actors/character/advancement.html
+++ b/system/templates/actors/character/advancement.html
@@ -1,8 +1,8 @@
| {{#if advancement.data.in_curriculum}} {{/if}} |
- {{ advancement.name }} |
- {{ advancement.data.xp_used }} |
- {{ advancement.data.rank }} |
+ {{advancement.name}} |
+ {{advancement.data.xp_used}} |
+ {{advancement.data.rank}} |
{{#if editable}}
diff --git a/system/templates/actors/character/attributes.html b/system/templates/actors/character/attributes.html
index 9948d52..59afd3f 100644
--- a/system/templates/actors/character/attributes.html
+++ b/system/templates/actors/character/attributes.html
@@ -1,49 +1,49 @@
\ No newline at end of file
diff --git a/system/templates/actors/character/conflict.html b/system/templates/actors/character/conflict.html
index 0cfb5e0..259a348 100644
--- a/system/templates/actors/character/conflict.html
+++ b/system/templates/actors/character/conflict.html
@@ -1,20 +1,20 @@
diff --git a/system/templates/actors/character/experience.html b/system/templates/actors/character/experience.html
index f5c3968..72d49d7 100644
--- a/system/templates/actors/character/experience.html
+++ b/system/templates/actors/character/experience.html
@@ -1,23 +1,23 @@
|