From 7b18fd25c38490722cedd029238ee59632eb4238 Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Wed, 18 Oct 2023 21:08:01 +0200 Subject: [PATCH 1/2] =?UTF-8?q?Macro=20pour=20comp=C3=A9tences=20de=20cr?= =?UTF-8?q?=C3=A9ature?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- module/rdd-hotbar-drop.js | 64 +++++++++++++++++++++++---------------- 1 file changed, 38 insertions(+), 26 deletions(-) diff --git a/module/rdd-hotbar-drop.js b/module/rdd-hotbar-drop.js index de0378bb..bb8c61ec 100644 --- a/module/rdd-hotbar-drop.js +++ b/module/rdd-hotbar-drop.js @@ -1,3 +1,4 @@ +import { TYPES } from "./item.js"; export class RdDHotbar { @@ -16,21 +17,29 @@ export class RdDHotbar { } static async addToHotbar(item, slot) { - if (item?.type == "arme") { // Used to manage weapons with multiple skills - if (item.system.competence != "") { - await this.createItemMacro(item, slot, "competence") - slot++ - } - if (item.system.lancer != "") { - await this.createItemMacro(item, slot, "lancer") - slot++ - } - if (item.system.tir != "") { - await this.createItemMacro(item, slot, "lancer") - slot++ - } - } else { - await this.createItemMacro(item, slot) + switch (item?.type ?? "") { + case TYPES.arme: + { + // Les armes peuvent avoir plusieurs usages + if (item.system.competence != "") { + await this.createItemMacro(item, slot, "competence") + slot++ + } + if (item.system.lancer != "") { + await this.createItemMacro(item, slot, "lancer") + slot++ + } + if (item.system.tir != "") { + await this.createItemMacro(item, slot, "lancer") + slot++ + } + } + return + case TYPES.competence: + case TYPES.competencecreature: + default: + await this.createItemMacro(item, slot) + return } } @@ -46,16 +55,16 @@ export class RdDHotbar { // Create item macro if rollable item - weapon, spell, prayer, trait, or skill if (documentData.type == "Item") { - let item = fromUuidSync(documentData.uuid) - if (item == undefined) { - item = this.actor.items.get(documentData.uuid) - } + const item = fromUuidSync(documentData.uuid) ?? this.actor.items.get(documentData.uuid) console.log("DROP", documentData, item) - if (!item || (item.type != "arme" && item.type != "competence")) { - return true + switch (item?.type ?? "") + { + case TYPES.arme: + case TYPES.competence: + case TYPES.competencecreature: + this.addToHotbar(item, slot) + return false } - this.addToHotbar(item, slot) - return false } return true @@ -68,7 +77,9 @@ export class RdDHotbar { let actor; if (speaker.token) actor = game.actors.tokens[speaker.token]; if (!actor) actor = game.actors.get(speaker.actor); - + if (!actor) { + return ui.notifications.warn(`Impossible de trouver le personnage concerné`); + } let item = actor?.items.find(it => it.name === itemName && it.type == itemType) ?? undefined; if (!item) { return ui.notifications.warn(`Impossible de trouver l'objet de cette macro`); @@ -76,9 +87,10 @@ export class RdDHotbar { // Trigger the item roll switch (item.type) { - case "arme": + case TYPES.arme: return actor.rollArme(item, competenceName); - case "competence": + case TYPES.competence: + case TYPES.competencecreature: return actor.rollCompetence(itemName); } } From c7fd9f759641f652f7d0dc20544ae879207d166e Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Wed, 18 Oct 2023 21:13:50 +0200 Subject: [PATCH 2/2] Version 11.0.22 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit les automatismes de Khrachtchoum le Problémeux --- changelog.md | 8 ++++++++ system.json | 4 ++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/changelog.md b/changelog.md index 4c707e4b..c4859095 100644 --- a/changelog.md +++ b/changelog.md @@ -1,4 +1,12 @@ # v11.0 +## v11.0.21 +- Macro pour attaquer avec les compétences de créatures + +## v11.0.20 +- Macro pour attaquer avec les armes des personnages + +## v11.0.17 +- Fix: les actions de commerce ne s'appliquait pas bien aux personnages des tokens non liés ## v11.0.15 - L'apprentissage de Khrachtchoum - Fix: l'expérience ne s'appliquait plus sur certaines réussites particulières (régression depuis la 11.0.7) diff --git a/system.json b/system.json index a372efcb..8eddda37 100644 --- a/system.json +++ b/system.json @@ -1,8 +1,8 @@ { "id": "foundryvtt-reve-de-dragon", "title": "Rêve de Dragon", - "version": "11.0.20", - "download": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/archive/foundryvtt-reve-de-dragon-11.0.20.zip", + "version": "11.0.21", + "download": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/archive/foundryvtt-reve-de-dragon-11.0.21.zip", "manifest": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/raw/v11/system.json", "changelog": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/raw/branch/v11/changelog.md", "compatibility": {