From 8a0213bdc284a66e314fd1bb0a6f5f4faa257f4a Mon Sep 17 00:00:00 2001 From: sladecraven Date: Sat, 5 Dec 2020 00:37:10 +0100 Subject: [PATCH] #43 : Initiative sur token --- module/rdd-token-hud.js | 17 +++++++++-------- styles/simple.css | 23 +++++++++++++++++++++++ 2 files changed, 32 insertions(+), 8 deletions(-) diff --git a/module/rdd-token-hud.js b/module/rdd-token-hud.js index c1206948..312bb9e4 100644 --- a/module/rdd-token-hud.js +++ b/module/rdd-token-hud.js @@ -23,16 +23,17 @@ export class RdDTokenHud { // Get combatant stuff let combatant = game.combat.data.combatants.find(c => c.tokenId == token.data._id ); if ( combatant ) { - console.log("Token !!!", combatant); // Create space for Hud Extensions next to combat icon let divTokenHudExt = '
'; html.find('.control-icon.combat').wrap(divTokenHudExt); let armesList = RdDUtility.buildArmeList( combatant ); let htmlList = ""; - for (let arme of armesList) { + console.log("Token !!!", combatant, armesList); + for( let armeIndex=0; armeIndex'; - htmlList += ''; + htmlList += '
'; } let hudInitiative = $(htmlList); //let hudInitiative = $('
' + Dague + '
'); @@ -40,11 +41,11 @@ export class RdDTokenHud { html.find('.control-icon.combat').after(hudInitiative); // Add Initiative and Agility token tip // Add interactions for Initiative and Agility hudInitiative.find('label').click(async (event) => { - let armeId = event.currentTarget.attributes['data-arme-id'].value; - let combatantId = event.currentTarget.attributes['data-combatant-id'].value; - let arme = actor.getOwnedItem(armeId); - console.log("CLICKED !", actor, armeId, arme); - RdDUtility.rollInitiativeCompetence( combatantId, arme.data ); + let armeIndex = event.currentTarget.attributes['data-arme-id'].value; + let combatantId = event.currentTarget.attributes['data-combatant-id'].value; + let arme = armesList[armeIndex]; + console.log("CLICKED !", armeIndex, arme); + RdDUtility.rollInitiativeCompetence( combatantId, arme ); }); } } diff --git a/styles/simple.css b/styles/simple.css index a195a6bd..afd0b880 100644 --- a/styles/simple.css +++ b/styles/simple.css @@ -630,6 +630,29 @@ ul, li { margin-left: 4px; } +/* ======================================== */ +.tokenhudext { + display: flex; + flex: 0 !important; + font-family: CaslonPro; + font-weight: 600; +} +.tokenhudext.right { + justify-content: flex-start; +} +.control-icon.tokenhudicon { + width: fit-content; + min-width: 42px; + flex-basis: auto; + padding: 0 8px; + margin: 8px 0px; +} +.control-icon.tokenhudicon.right { + margin-left: 8px; +} +.hud-text-small { + font-size: 0.75rem; +} /* ======================================== */ .item-checkbox { height: 25px;