Skip to content

Commit

Permalink
fix array duplicated items
Browse files Browse the repository at this point in the history
  • Loading branch information
mrcomac committed Apr 12, 2024
1 parent 80ae686 commit 1a1407a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
3 changes: 3 additions & 0 deletions scripts/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ export const MAIN_ACTIONS = []
export const FREE_ACTIONS = []

export function init_help_buttons(delimiter) {
delete MAIN_ACTIONS[MAIN_ACTIONS.findIndex(item => item !== item)];
delete FREE_ACTIONS[FREE_ACTIONS.findIndex(item => item !== item)];

MAIN_ACTIONS.push({
id:'attack',
name: game.i18n.localize(
Expand Down
14 changes: 6 additions & 8 deletions scripts/core-rollhandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ Hooks.once('tokenActionHudCoreApiReady', async (coreModule) => {
if (this.isRenderItem() && hasSheet.includes(macroType)) {
return this.renderItem(tokenId, actionId);
}
console.log(macroType)

switch (macroType) {
case "ae":
Expand Down Expand Up @@ -89,18 +88,17 @@ Hooks.once('tokenActionHudCoreApiReady', async (coreModule) => {
break;
case "main_action":
case "free_action":
const all_actions = [...MAIN_ACTIONS, ...FREE_ACTIONS]
const all_actions = MAIN_ACTIONS.concat(FREE_ACTIONS)
all_actions.forEach(item => {
if(item['id'] == actionId) {
console.log(item)
const results_html = `<h2>${item["name"]}</h2>
<p>${item["description"]}</p></div>`

ChatMessage.create({
user: game.user._id,
speaker: ChatMessage.getSpeaker({token: actor}),
content: results_html
});
ChatMessage.create({
user: game.user._id,
speaker: ChatMessage.getSpeaker({token: actor}),
content: results_html
});
}
})
break;
Expand Down

0 comments on commit 1a1407a

Please sign in to comment.