Skip to content

Commit

Permalink
Merge pull request #2851 from Azmoria/Internal---more-hp-observer-fixes
Browse files Browse the repository at this point in the history
Internal - more hp observer fixes
  • Loading branch information
Azmoria authored Jan 29, 2025
2 parents 047fffd + 4e4d514 commit eb8e111
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions CharactersPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -2041,7 +2041,7 @@ function observe_character_sheet_changes(documentToObserve) {
if (mutationTarget.hasClass('ct-conditions-summary')) { // conditions update from sidebar
const conditionsSet = read_conditions(documentToObserve);
character_sheet_changed({conditions: conditionsSet});
} else if((firstRemoved.hasClass('ct-health-summary__hp-item') && firstRemoved.children('#ct-health-summary-max-label').length) || firstRemoved.find('[aria-label*="Hit Points Adjustment"]')){ // this is to catch if the player just died look at the removed node to get value - to prevent 0/0 hp
} else if((firstRemoved.hasClass('ct-health-summary__hp-item') && firstRemoved.children('#ct-health-summary-max-label').length) || firstRemoved.find('[aria-label*="Hit Points Adjustment"]').length){ // this is to catch if the player just died look at the removed node to get value - to prevent 0/0 hp
let maxhp = parseInt(firstRemoved.find(`.ct-health-summary__hp-number, [aria-label*='Max Hit']`).text());
send_character_hp(maxhp);
}else if (
Expand All @@ -2051,7 +2051,7 @@ function observe_character_sheet_changes(documentToObserve) {
mutationTarget.hasClass('ct-health-summary__deathsaves') ||
mutationTarget.hasClass('ct-health-summary__deathsaves-mark') ||
mutationTarget.hasClass('[class*="styles_mark"]') ||
mutationTarget.parents('[class*="styles_hitPointsBox"]').length>0
(mutationTarget.parents('[class*="styles_hitPointsBox"]').length>0 && mutationTarget.find("input[class*=styles_input]").length == 0)
) {
send_character_hp();
}
Expand Down

0 comments on commit eb8e111

Please sign in to comment.