Skip to content

Commit

Permalink
Merge pull request #2842 from Azmoria/QoL---add-condition-icons-to-co…
Browse files Browse the repository at this point in the history
…mbat-tracker

QoL - add condition icons to combat tracker
  • Loading branch information
Azmoria authored Jan 24, 2025
2 parents 30174a6 + cff2163 commit 3ee7433
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 8 deletions.
4 changes: 3 additions & 1 deletion CombatTracker.js
Original file line number Diff line number Diff line change
Expand Up @@ -698,7 +698,9 @@ function ct_add_token(token,persist=true,disablerolling=false, adv=false, dis=fa
entry.css('display', 'none');
}
entry.addClass("CTToken");

if(window.DM && !token.options.combatGroupToken){
token.build_conditions(entry, true);
}
if (typeof(token.options.ct_show) == 'undefined'){
if(token.options.hidden) {
token.options.ct_show = false;
Expand Down
4 changes: 1 addition & 3 deletions DDBApi.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,9 @@ class DDBApi {
const token = await DDBApi.#refreshToken();
const config = {
method: 'DELETE',
credentials: 'include',
headers: {
'Authorization': `Bearer ${token}`,
'Accept': 'application/json',
'Content-Type': 'application/json'
'Accept': 'application/json'
}
}
// Explicitly not calling `lookForErrors` here because we don't actually care if this succeeds.
Expand Down
12 changes: 9 additions & 3 deletions Token.js
Original file line number Diff line number Diff line change
Expand Up @@ -1520,7 +1520,7 @@ class Token {
}


build_conditions(parent) {
build_conditions(parent, singleRow = false) {
function badge_condition(condition, conditionContainer, conditionSymbolName) {
if(!isNaN(parseInt(condition.duration))) {
let expired = (parseInt(condition.duration) <= 0) ? "expired" : "";
Expand Down Expand Up @@ -1580,7 +1580,7 @@ class Token {
symbolImage.width(symbolSize + "px");
conditionContainer.append(symbolImage);
badge_condition(condition, conditionContainer, conditionSymbolName);
if (conditionCount >= 3) {
if (conditionCount >= 3 && !singleRow) {
moreCond.append(conditionContainer);
} else {
cond.append(conditionContainer);
Expand Down Expand Up @@ -2139,8 +2139,14 @@ class Token {


this.update_opacity(old);

this.build_conditions(old);
const combatRow = $(`#combat_area tr[data-target='${this.options.id}']`);
if(combatRow.length){
this.build_conditions($(`#combat_area tr[data-target='${this.options.id}']`), true);
}




if (this.selected) {
old.addClass("tokenselected");
Expand Down
54 changes: 53 additions & 1 deletion abovevtt.css
Original file line number Diff line number Diff line change
Expand Up @@ -2180,6 +2180,58 @@ padding-top:10px;
background: #e4c700;
}

#combat_area .condition-img {
background: #01ffff;
}

#combat_area .custom-condition.condition-img {
background: #F58231;
}

#combat_area .note-condition.condition-img {
background: #e4c700;
}

#combat_area .conditions {
display:flex;
position:absolute;
top: -3px !important;
height: 20px !important;
flex-wrap: nowrap;
left: calc(100% - 99px) !important;
align-items: center;
align-content: center;
}

#combat_area .conditions div img{
height:100% !important;
width:100% !important;
pointer-events:auto !important;
position:relative;

}
#combat_area .conditions{
width: 100px !important;
}
#combat_area .conditions>div{
display: flex;
align-items: center;
justify-content: center;
overflow: hidden;
width: 14px !important;
height: 14px !important;
margin-right:2px;
border-radius:5px;
border: 1px solid black;
align-content: center;
flex-wrap: nowrap;
}
#combat_area .conditions ~ .player-conditionstions {
display: none;
}
#note.condition-container{
pointer-events: auto;
}
#note.condition-container{
pointer-events: auto;
}
Expand Down Expand Up @@ -6462,7 +6514,7 @@ div#tokenOptionsContainer .remove-from-ct>button{
}

#combat_area td button{
margin: 0px 1px;
margin: -2px 1px
}
#site #combat_area tr td{
padding-bottom: 4px;
Expand Down

0 comments on commit 3ee7433

Please sign in to comment.