From d1170b53cc73250df297627480818d7570702df4 Mon Sep 17 00:00:00 2001 From: Azmoria <65363489+Azmoria@users.noreply.github.com> Date: Tue, 2 Jul 2024 18:20:51 -0400 Subject: [PATCH] QoL - icon and cast button rolls will now send the save type and DC to the gamelog --- CharactersPage.js | 67 +++++++++++++++++++++++++++++++++++++++++------ DiceRoller.js | 27 ++++++++++++++++--- MessageBroker.js | 12 ++++++++- Startup.js | 2 +- abovevtt.css | 10 +++++-- 5 files changed, 103 insertions(+), 15 deletions(-) diff --git a/CharactersPage.js b/CharactersPage.js index a60a3e466..00a926514 100644 --- a/CharactersPage.js +++ b/CharactersPage.js @@ -798,7 +798,12 @@ function observe_character_sheet_changes(documentToObserve) { e.stopPropagation(); $(this).closest('.ct-content-group').find(`.ct-slot-manager [aria-checked='false']`).first().click(); - let rollButtons = $(this).parent().find(`.integrated-dice__container:not('.avtt-roll-formula-button'):not('.above-vtt-visited'):not('.above-vtt-dice-visited')`); + let rollButtons = $(this).parent().find(`.integrated-dice__container:not('.avtt-roll-formula-button'):not('.above-vtt-visited'):not('.above-vtt-dice-visited'):not('.above-aoe'), .integrated-dice__container.abovevtt-icon-roll`); + let spellSave = $(this).parent().find(`.ct-spells-spell__save`); + let spellSaveText; + if(spellSave.length>0){ + spellSaveText = `${spellSave.find('.ct-spells-spell__save-label').text().toUpperCase()} DC${spellSave.find('.ct-spells-spell__save-value').text()}`; + } for(let i = 0; iCasts ${$(this).parent().find('[class*="styles_spellName"]').text()}: ${spellSaveText}`, + playerId: window.PLAYER_ID, + sendTo: window.sendToTab + } + if(is_abovevtt_page()){ + window.MB.inject_chat(msgdata) } + else if(window.sendToTab != undefined){ + tabCommunicationChannel.postMessage({ + msgType: 'SendToGamelog', + player: msgdata.player, + img: msgdata.img, + text: msgdata.text, + sendTo: msgdata.sendTo + }); + } } }); if($(`style#advantageHover`).length == 0){ @@ -1028,7 +1055,12 @@ function observe_character_sheet_changes(documentToObserve) { e.stopPropagation(); let versatileRoll = window.CHARACTER_AVTT_SETTINGS.versatile; - let rollButtons = $(this).parent().find(`.integrated-dice__container:not('.avtt-roll-formula-button'):not('.above-vtt-visited'):not('.above-vtt-dice-visited'), .integrated-dice__container.abovevtt-icon-roll`); + let rollButtons = $(this).parent().find(`.integrated-dice__container:not('.avtt-roll-formula-button'):not('.above-vtt-visited'):not('.above-vtt-dice-visited'):not('.above-aoe'), .integrated-dice__container.abovevtt-icon-roll`); + let spellSave = $(this).parent().find(`[class*='__save']`); + let spellSaveText; + if(spellSave.length>0){ + spellSaveText = `${spellSave.find('[class*="__save-label"]').text().toUpperCase()} DC${spellSave.find('[class*="__save-value"]').text()}`; + } for(let i = 0; iCasts ${$($(this).parent().find('[class*="__name"]>[class*="__label"]')[0]).text()}: ${spellSaveText}`, + playerId: window.PLAYER_ID, + sendTo: window.sendToTab + } + if(is_abovevtt_page()){ + window.MB.inject_chat(msgdata) + } + else if(window.sendToTab != undefined){ + tabCommunicationChannel.postMessage({ + msgType: 'SendToGamelog', + player: msgdata.player, + img: msgdata.img, + text: msgdata.text, + sendTo: msgdata.sendTo + }); + } + } + }) if($(`style#advantageHover`).length == 0){ $('body').append(`