From 94eaeb0cbee55c76ef7c7ddcb5e19761bb779b58 Mon Sep 17 00:00:00 2001 From: alzer Date: Sun, 11 May 2025 15:34:05 +0200 Subject: [PATCH] Packs-test --- module.json | 92 +++++++++++++++++- modules/addon-register.js | 76 +++++++-------- .../000876.ldb | Bin .../001000.log | 0 .../CURRENT | 0 .../LOCK | 0 .../LOG | 0 .../LOG.old | 0 .../MANIFEST-000999 | Bin .../lost/000340.log | 0 .../lost/000870.log | 0 11 files changed, 129 insertions(+), 39 deletions(-) rename packs/{plats-dauberges => gerichte-gasthaeuser}/000876.ldb (100%) rename packs/{plats-dauberges => gerichte-gasthaeuser}/001000.log (100%) rename packs/{plats-dauberges => gerichte-gasthaeuser}/CURRENT (100%) rename packs/{plats-dauberges => gerichte-gasthaeuser}/LOCK (100%) rename packs/{plats-dauberges => gerichte-gasthaeuser}/LOG (100%) rename packs/{plats-dauberges => gerichte-gasthaeuser}/LOG.old (100%) rename packs/{plats-dauberges => gerichte-gasthaeuser}/MANIFEST-000999 (100%) rename packs/{plats-dauberges => gerichte-gasthaeuser}/lost/000340.log (100%) rename packs/{plats-dauberges => gerichte-gasthaeuser}/lost/000870.log (100%) diff --git a/module.json b/module.json index bc9b351..9535de4 100644 --- a/module.json +++ b/module.json @@ -26,12 +26,102 @@ "flags": {} } ], + "packs": [ + { + "label": "Geriche und Gasthäuser", + "type": "RollTable", + "name": "gerichte-gasthaeuser", + "path": "packs/gerichte-gasthaeuser", + "system": "wfrp4e", + "flags": {}, + "ownership": { + "PLAYER": "NONE", + "ASSISTANT": "OWNER" + } + }, + { + "label": "Dons de Rhya", + "type": "JournalEntry", + "name": "dons-de-rhya", + "path": "packs/dons-de-rhya", + "system": "wfrp4e", + "flags": {}, + "ownership": { + "PLAYER": "OBSERVER", + "ASSISTANT": "OWNER" + } + }, + { + "label": "Aides de Jeu FR", + "type": "JournalEntry", + "name": "aides-de-jeu-fr", + "path": "packs/aides-de-jeu-fr", + "system": "wfrp4e", + "flags": {}, + "ownership": { + "PLAYER": "OBSERVER", + "ASSISTANT": "OWNER" + } + }, + { + "label": "Herbes & Potions", + "type": "Item", + "name": "antidotes-and-remedes", + "path": "packs/antidotes-and-remedes", + "system": "wfrp4e", + "flags": {}, + "ownership": { + "PLAYER": "NONE", + "ASSISTANT": "OWNER" + } + }, + { + "label": "Tables des Traductions", + "type": "JournalEntry", + "name": "tables-des-traductions", + "path": "packs/tables-des-traductions", + "system": "wfrp4e", + "flags": {}, + "ownership": { + "PLAYER": "OBSERVER", + "ASSISTANT": "OWNER" + } + }, + { + "label": "Apothicarium", + "type": "JournalEntry", + "name": "apothicarium", + "path": "packs/apothicarium", + "system": "wfrp4e", + "flags": {}, + "ownership": { + "PLAYER": "NONE", + "ASSISTANT": "OWNER" + } + } + ], + "packFolders": [ + { + "name": "Module WFRP4 DE", + "sorting": "m", + "color": "#00435c", + "packs": [ + "apothicarium", + "tables-des-traductions", + "antidotes-and-remedes", + "aides-de-jeu-fr", + "dons-de-rhya", + "plats-dauberges" + ], + "folders": [] + } + ], "manifest": "https://gitea.palmenalzer.de/alzer/wfrp-4e-de/raw/branch/main/module.json", "download": "https://gitea.palmenalzer.de/alzer/wfrp-4e-de/archive/main.zip", "id": "wh4-de-translation", "compatibility": { "minimum": "11", - "verified": "13" + "verified": "12" }, "relationships": { "systems": [ diff --git a/modules/addon-register.js b/modules/addon-register.js index 7c77220..2b0bae6 100644 --- a/modules/addon-register.js +++ b/modules/addon-register.js @@ -88,39 +88,39 @@ const _patch_up_in_arms = () => { /************************************************************************************/ /* Manages /auberge command */ -// const _manage_inn_roll = async (content, msg) => { -// // Split input into arguments -// let command = content.split(" ").map(function (item) { -// return item.trim(); -// }) +const _manage_inn_roll = async (content, msg) => { + // Split input into arguments + let command = content.split(" ").map(function (item) { + return item.trim(); + }) -// console.log("COMMANDES", command); -// if (command[0] == "/gasthaus" && command[1]) { -// msg["type"] = 0; -// msg["rollMode"] = "gmroll"; -// var compendium = game.packs.get('wh4-de-translation.gerichte-gasthaeuser') -// const pack = game.packs.get(compendium); -// let rollList = await compendium.getDocuments() -// //console.log("AUBERGE", rollList) -// for (var i = 0; i < rollList.length; i++) { -// var rollTab = rollList[i]; -// console.log("Got compendium...", rollList, rollTab.name); -// if (rollTab.name.toLowerCase().includes(command[1].toLowerCase())) { -// let my_rollTable; -// await compendium.getDocument(rollTab._id).then(mytab => my_rollTable = mytab); -// my_rollTable.draw({ rollMode: "gmroll" }); -// return false; -// } -// } -// } -// if (content.includes("/gasthaus")) { -// msg["type"] = 0; -// msg["rollMode"] = "gmroll"; -// msg["content"] = "Syntax : /gasthaus KEYWORD, mit KEYWORD unter:
BasisGetraenke, StarkeGetraenke, Desserts, AllgemeineGerichte, ExzellenteGerichte, MaritimeGerichte, MittelmaessigeGerichte, Qualitaetsgerichte, Flussgerichte. Verknüpfungen sind mit einem Teil des Namens möglich: Basis (entspricht BasisGetraenke) oder /gasthaus Mari (entspricht MaritimeGerichte) usw." -// ChatMessage.create(msg); -// return false; -// } -// } + console.log("COMMANDES", command); + if (command[0] == "/gasthaus" && command[1]) { + msg["type"] = 0; + msg["rollMode"] = "gmroll"; + var compendium = game.packs.get('wh4-de-translation.gerichte-gasthaeuser') + const pack = game.packs.get(compendium); + let rollList = await compendium.getDocuments() + //console.log("AUBERGE", rollList) + for (var i = 0; i < rollList.length; i++) { + var rollTab = rollList[i]; + console.log("Got compendium...", rollList, rollTab.name); + if (rollTab.name.toLowerCase().includes(command[1].toLowerCase())) { + let my_rollTable; + await compendium.getDocument(rollTab._id).then(mytab => my_rollTable = mytab); + my_rollTable.draw({ rollMode: "gmroll" }); + return false; + } + } + } + if (content.includes("/gasthaus")) { + msg["type"] = 0; + msg["rollMode"] = "gmroll"; + msg["content"] = "Syntax : /gasthaus KEYWORD, mit KEYWORD unter:
BasisGetraenke, StarkeGetraenke, Desserts, AllgemeineGerichte, ExzellenteGerichte, MaritimeGerichte, MittelmaessigeGerichte, Qualitaetsgerichte, Flussgerichte. Verknüpfungen sind mit einem Teil des Namens möglich: Basis (entspricht BasisGetraenke) oder /gasthaus Mari (entspricht MaritimeGerichte) usw." + ChatMessage.create(msg); + return false; + } +} /************************************************************************************/ let __eis_tables = { @@ -379,13 +379,13 @@ const __add_actors_translation = () => { /************************************************************************************/ /* Hook for specific command */ -// Hooks.on("chatMessage", (html, content, msg) => { +Hooks.on("chatMessage", (html, content, msg) => { -// if (content.toLowerCase().includes('gasthaus')) { -// _manage_inn_roll(content, msg); -// return false; -// } -// }); + if (content.toLowerCase().includes('gasthaus')) { + _manage_inn_roll(content, msg); + return false; + } +}); /************************************************************************************/ /* Additionnal hooks ready */ diff --git a/packs/plats-dauberges/000876.ldb b/packs/gerichte-gasthaeuser/000876.ldb similarity index 100% rename from packs/plats-dauberges/000876.ldb rename to packs/gerichte-gasthaeuser/000876.ldb diff --git a/packs/plats-dauberges/001000.log b/packs/gerichte-gasthaeuser/001000.log similarity index 100% rename from packs/plats-dauberges/001000.log rename to packs/gerichte-gasthaeuser/001000.log diff --git a/packs/plats-dauberges/CURRENT b/packs/gerichte-gasthaeuser/CURRENT similarity index 100% rename from packs/plats-dauberges/CURRENT rename to packs/gerichte-gasthaeuser/CURRENT diff --git a/packs/plats-dauberges/LOCK b/packs/gerichte-gasthaeuser/LOCK similarity index 100% rename from packs/plats-dauberges/LOCK rename to packs/gerichte-gasthaeuser/LOCK diff --git a/packs/plats-dauberges/LOG b/packs/gerichte-gasthaeuser/LOG similarity index 100% rename from packs/plats-dauberges/LOG rename to packs/gerichte-gasthaeuser/LOG diff --git a/packs/plats-dauberges/LOG.old b/packs/gerichte-gasthaeuser/LOG.old similarity index 100% rename from packs/plats-dauberges/LOG.old rename to packs/gerichte-gasthaeuser/LOG.old diff --git a/packs/plats-dauberges/MANIFEST-000999 b/packs/gerichte-gasthaeuser/MANIFEST-000999 similarity index 100% rename from packs/plats-dauberges/MANIFEST-000999 rename to packs/gerichte-gasthaeuser/MANIFEST-000999 diff --git a/packs/plats-dauberges/lost/000340.log b/packs/gerichte-gasthaeuser/lost/000340.log similarity index 100% rename from packs/plats-dauberges/lost/000340.log rename to packs/gerichte-gasthaeuser/lost/000340.log diff --git a/packs/plats-dauberges/lost/000870.log b/packs/gerichte-gasthaeuser/lost/000870.log similarity index 100% rename from packs/plats-dauberges/lost/000870.log rename to packs/gerichte-gasthaeuser/lost/000870.log