FIx pour Babele 2.8.X
This commit is contained in:
@@ -20,7 +20,15 @@ export function initTravelV2() {
|
||||
|
||||
// Enregistrer la commande dans le système WFRP4e si disponible
|
||||
if (game.wfrp4e?.commands) {
|
||||
console.log("TravelV2: Enregistrement de la commande /voyage");
|
||||
// Patch warhammer-lib 3.0.2 bug: parseArgs crashes when no args provided
|
||||
// (already applied by inn-init if it ran first, but safe to apply again)
|
||||
if (game.wfrp4e.commands.parseArgs && !game.wfrp4e.commands._parseArgsPatched) {
|
||||
const _origParseArgs = game.wfrp4e.commands.parseArgs.bind(game.wfrp4e.commands);
|
||||
game.wfrp4e.commands.parseArgs = function(command, text) {
|
||||
return _origParseArgs(command, text ?? "");
|
||||
};
|
||||
game.wfrp4e.commands._parseArgsPatched = true;
|
||||
}
|
||||
game.wfrp4e.commands.add({
|
||||
voyage: {
|
||||
description: "Outil de calcul de distances de voyage (FR)",
|
||||
@@ -61,6 +69,15 @@ export function initTravelV2() {
|
||||
const target = event.currentTarget;
|
||||
TravelDistanceV2.handleTravelClick(event, target);
|
||||
});
|
||||
|
||||
// Bouton "Enregistrer dans le journal"
|
||||
html.find('button[data-action="saveVoyageToJournal"]').click(async (event) => {
|
||||
event.preventDefault();
|
||||
const btn = event.currentTarget;
|
||||
const from = btn.dataset.from;
|
||||
const to = btn.dataset.to;
|
||||
await TravelDistanceV2.saveVoyageToJournal(from, to, message.content);
|
||||
});
|
||||
});
|
||||
|
||||
console.log("TravelV2: Module de voyage initialisé");
|
||||
|
||||
Reference in New Issue
Block a user