Update v11

This commit is contained in:
2023-06-23 08:37:50 +02:00
parent 1b8e0840b0
commit 3be7f4bf9f
5 changed files with 101 additions and 36 deletions

View File

@ -1,5 +1,6 @@
/* -------------------------------------------- */
import { BoLRoll } from "../controllers/bol-rolls.js";
import { BoLUtility } from "../system/bol-utility.js";
/* -------------------------------------------- */
export class BoLTokenHud {
@ -30,10 +31,17 @@ export class BoLTokenHud {
(event) => {
let actionIndex = Number(event.currentTarget.attributes['data-action-index'].value)
let action = hudData.actionsList[actionIndex]
const weapon = actor.items.get( action._id )
BoLRoll.weaponCheckWithWeapon(hudData.actor, duplicate(weapon))
//console.log("Clicked", action)
} )
const actionItem = actor.items.get(action._id)
if (actionItem.system.subtype == "weapon") {
BoLRoll.weaponCheckWithWeapon(hudData.actor, duplicate(actionItem))
} else if (actionItem.system.subtype == "fightoption") {
let chatData = duplicate(actionItem)
if (actionItem.actor) {
chatData.actor = { id: actionItem.actor._id };
}
BoLUtility.postItem(chatData);
}
})
const controlIconTarget = html.find('.control-icon[data-action=target]');
// att+apt+career
@ -41,18 +49,18 @@ export class BoLTokenHud {
(event) => {
let rollIndex = Number(event.currentTarget.attributes['data-roll-index'].value)
let roll = hudData.rollsList[rollIndex]
if ( roll.type == "aptitude") {
BoLRoll.aptitudeCheck(actor, roll.key )
} else if ( roll.type == "attribute") {
BoLRoll.attributeCheck(actor, roll.key )
if (roll.type == "aptitude") {
BoLRoll.aptitudeCheck(actor, roll.key)
} else if (roll.type == "attribute") {
BoLRoll.attributeCheck(actor, roll.key)
}
})
}
/* -------------------------------------------- */
static async addTokenHudExtensions(app, html, tokenId) {
const controlIconCombat = html.find('.control-icon[data-action=combat]')
if (controlIconCombat.length>0 ) {
const controlIconCombat = html.find('.control-icon[data-action=combat]')
if (controlIconCombat.length > 0) {
BoLTokenHud.addExtensionHud(app, html, tokenId);
}
}
@ -61,9 +69,9 @@ export class BoLTokenHud {
static async _configureSubMenu(insertionPoint, template, hudData, onMenuItem) {
const hud = $(await renderTemplate(template, hudData))
const list = hud.find('div.bol-hud-list')
BoLTokenHud._toggleHudListActive(hud, list);
hud.find('img.bol-hud-togglebutton').click(event => BoLTokenHud._toggleHudListActive(hud, list));
list.find('.bol-hud-menu').click(onMenuItem);