diff --git a/CHANGELOG.md b/CHANGELOG.md index 137fe57..324c693 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,12 +1,13 @@ # Changelog -## 1.3.2 - Ronin Bubble Everywhere +## 1.3.2 - Ronin's Bubble - Replaced moving description in items by a big popup on hover. -- Added PoW Revised 20Q +- Added PoW Revised 20Q (for old Ronin, just modify the template in 20Q to change the character sheet fields). - Added Bushido tenets on Social tab in sheet for all (I think this is useful for players, and it's in Core rulebook so... why this is not by default ;) ). - Added English/French Journal Compendiums for Conditions and Terrain Qualities (thanks to TesserWract). - Added FoV Terrain Compendium. - Added PoW Name Tables compendium : Qamarist Names, Ivory Kingdoms Names, Rokugani Names and Ujik Names. +- Added ability to drop a (Curriculum) Journal to have a button in school experience tab. - Fixed school compendium: "Kuni Warden School" from "Scorpion" to "Crab". - Fixed roll for RollTable not showing the text. - Fixed some Pdf Copy-Paste error in school cursus that make L instead of I: Lkoma/Lsawa/Luchi... diff --git a/system/lang/en-en.json b/system/lang/en-en.json index b87ae28..24bffad 100644 --- a/system/lang/en-en.json +++ b/system/lang/en-en.json @@ -345,7 +345,8 @@ "curriculum_validate": "Complete this rank", "rarity_modifier": "Rarity modifier", "item_pattern": "Item Patterns", - "signature_scroll": "Signature Scrolls" + "signature_scroll": "Signature Scrolls", + "school_curriculum_journal": "Drop curriculum's journal in sheet to link it" }, "character_types": { "character": "Player Character", diff --git a/system/lang/es-es.json b/system/lang/es-es.json index f47dfbe..dc46994 100644 --- a/system/lang/es-es.json +++ b/system/lang/es-es.json @@ -345,7 +345,8 @@ "curriculum_validate": "Completar este rango", "rarity_modifier": "Rarity modifier", "item_pattern": "Item patterns", - "signature_scroll": "Signature scrolls" + "signature_scroll": "Signature scrolls", + "school_curriculum_journal": "Drop curriculum's journal in sheet to link it" }, "character_types": { "character": "Personaje jugador", diff --git a/system/lang/fr-fr.json b/system/lang/fr-fr.json index 5f39ae7..86bfbaa 100644 --- a/system/lang/fr-fr.json +++ b/system/lang/fr-fr.json @@ -345,7 +345,8 @@ "curriculum_validate": "Valider la progression", "rarity_modifier": "Modificateur de rareté", "item_pattern": "Procédés de fabrication", - "signature_scroll": "Rouleaux de marque" + "signature_scroll": "Rouleaux de marque", + "school_curriculum_journal": "Déposer le journal du curriculum dans la feuille pour le lier" }, "character_types": { "character": "Personnage Joueur", diff --git a/system/scripts/actors/character-sheet.js b/system/scripts/actors/character-sheet.js index 3a99e62..479d5a4 100644 --- a/system/scripts/actors/character-sheet.js +++ b/system/scripts/actors/character-sheet.js @@ -103,6 +103,81 @@ export class CharacterSheetL5r5e extends BaseSheetL5r5e { this._tabs .find((e) => e._navSelector === ".advancements-tabs") .activate("advancement_rank_" + (this.actor.data.data.identity.school_rank || 0)); + + // Open linked school curriculum journal + html.find(`.school-journal-link`).on("click", async (event) => { + event.preventDefault(); + event.stopPropagation(); + + const actorJournal = this.actor.data.data.identity.school_curriculum_journal; + const journal = await this._getJournal(actorJournal.id, actorJournal.pack); + if (journal) { + journal.sheet.render(true); + } + }); + } + + /** + * Handle dropped data on the Actor sheet + * @param {DragEvent} event + */ + async _onDrop(event) { + // *** Everything below here is only needed if the sheet is editable *** + if (!this.options.editable) { + return; + } + + // Curriculum Journal + const json = event.dataTransfer.getData("text/plain"); + if (!json) { + return; + } + + const data = JSON.parse(json); + if (data.type !== "JournalEntry") { + return; + } + + const journal = await this._getJournal(data.id, data.pack); + if (!journal) { + return; + } + + this.actor.data.data.identity.school_curriculum_journal = { + id: journal.data._id, + name: journal.data.name, + pack: data.pack || null, + }; + + await this.actor.update({ + data: { + identity: { + school_curriculum_journal: this.actor.data.data.identity.school_curriculum_journal, + }, + }, + }); + } + + /** + * Return the Journal in Pack or in World + * @param id + * @param pack + * @return {Promise} + * @private + */ + async _getJournal(id, pack = null) { + let journal; + if (pack) { + // Compendium + journal = await game.packs.get(pack)?.getDocument(id); + } else { + // World + journal = game.journal.get(id); + } + if (!journal || !(journal instanceof game.l5r5e.JournalL5r5e) || !journal.data?._id) { + return; + } + return journal; } /** diff --git a/system/scripts/actors/twenty-questions-dialog.js b/system/scripts/actors/twenty-questions-dialog.js index f899638..1c3c582 100644 --- a/system/scripts/actors/twenty-questions-dialog.js +++ b/system/scripts/actors/twenty-questions-dialog.js @@ -366,6 +366,7 @@ export class TwentyQuestionsDialog extends FormApplication { this.actor.data.data.twenty_questions = this.object.data; await this.actor.update({ data: { + template: formData["template"], twenty_questions: this.object.data, }, }); diff --git a/system/scripts/main-l5r5e.js b/system/scripts/main-l5r5e.js index a68808d..6e4fa57 100644 --- a/system/scripts/main-l5r5e.js +++ b/system/scripts/main-l5r5e.js @@ -79,11 +79,12 @@ Hooks.once("init", async () => { AbilityDie, HelpersL5r5e, ItemL5r5e, + JournalL5r5e, RollL5r5e, + ActorL5r5e, DicePickerDialog, RollnKeepDialog, GmToolsDialog, - ActorL5r5e, HelpDialog, sockets: new SocketHandlerL5r5e(), migrations: MigrationL5r5e, diff --git a/system/template.json b/system/template.json index f66eca4..130bcce 100644 --- a/system/template.json +++ b/system/template.json @@ -8,6 +8,7 @@ "family": "", "school": "", "school_rank": 1, + "school_curriculum_journal": {}, "roles": "" } }, @@ -115,8 +116,8 @@ "character": { "templates": ["identity", "rings", "social", "skills", "techniques", "conflict", "advancement"], "template": "core", - "zeni": 0, - "twenty_questions": {} + "twenty_questions": {}, + "zeni": 0 }, "npc": { "templates": ["rings", "social", "techniques", "conflict"], diff --git a/system/templates/actors/character/experience.html b/system/templates/actors/character/experience.html index 110cef3..1642ee8 100644 --- a/system/templates/actors/character/experience.html +++ b/system/templates/actors/character/experience.html @@ -15,7 +15,14 @@ {{!-- School progession --}}
- {{localize 'l5r5e.school'}} + + {{#if data.data.identity.school_curriculum_journal.id}} + {{data.data.identity.school_curriculum_journal.name}} + {{else}} + {{localize 'l5r5e.school'}} ({{localize 'l5r5e.advancements.school_curriculum_journal'}}) + {{/if}} + +