Skip to content

Commit

Permalink
fix(macro): drag-and-drop
Browse files Browse the repository at this point in the history
* fix macro skill roll creation for drag-and-drop

#1786
  • Loading branch information
wrycu committed Feb 6, 2025
1 parent 8e778fc commit 56ce1da
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* Remove usage of deprecated `math.clamped` in favor of `math.clamp`
* Fix skill roll sometimes showing a pool of only 2 difficulty when clicked ([#1763](/~https://github.com/StarWarsFoundryVTT/StarWarsFFG/issues/1763))
* XP Spending now uses a generic symbol instead of a dollar sign ([#1732](/~https://github.com/StarWarsFoundryVTT/StarWarsFFG/issues/1732))
* Fix for skill-roll macros not being created on drag-and-drop into macro hotbar ([#1786](/~https://github.com/StarWarsFoundryVTT/StarWarsFFG/issues/1786))

`1.905`
* Fixes
Expand Down
9 changes: 5 additions & 4 deletions modules/helpers/macros.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const createMacroItem = async (macro) => {
// Simple function for handling the creation of rollable weapon macros on hotbarDrop event.
export async function createFFGMacro(bar, data, slot) {
let macro;
console.log(data)
if (["Item", "Actor"].includes(data.type)) {
const entity = await fromUuid(data.uuid);
if (!entity) {
Expand Down Expand Up @@ -63,13 +64,14 @@ export async function createFFGMacro(bar, data, slot) {
img: item.img,
command: command,
});
} else if (data.data.type === "skill") {
}
} else if (data.data.type === "skill") {
const actor = game.actors.get(data.actorId);
const command = `
// game.ffg.DiceHelpers.rollSkillDirect(skill, characteristic, difficulty, actorSheet, flavortext, sound);
const ffgactor = game.actors.get("${data.actorId}");
const skill = ffgactor.data.data.skills["${data.data.skill}"];
const characteristic = ffgactor.data.data.characteristics["${data.data.characteristic}"];
const skill = ffgactor.system.skills["${data.data.skill}"];
const characteristic = ffgactor.system.characteristics["${data.data.characteristic}"];
const actorSheet = ffgactor.sheet.getData();
game.ffg.DiceHelpers.rollSkillDirect(skill, characteristic, 2, actorSheet);`;
macro = await createMacroItem({
Expand All @@ -78,7 +80,6 @@ export async function createFFGMacro(bar, data, slot) {
command: command,
});
}
}
if (macro) {
game.user.assignHotbarMacro(macro, slot);
}
Expand Down

0 comments on commit 56ce1da

Please sign in to comment.