Skip to content

Commit

Permalink
2.1.2
Browse files Browse the repository at this point in the history
Restored compatibility with Pf2e.
  • Loading branch information
jopeek committed Dec 4, 2020
1 parent 6705431 commit dff4360
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
2 changes: 1 addition & 1 deletion module.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "token-info-icons",
"title": "Token Info Icons",
"description": "Simple module that displays Speed, AC, and Passive Perception on Tokens for the GM or optionally players.",
"version": "2.1.1",
"version": "2.1.2",
"minimumCoreVersion": "0.7.7",
"compatibleCoreVersion": "0.7.7",
"author": "Jan Ole Peek (ChalkOne)",
Expand Down
21 changes: 12 additions & 9 deletions token-info-icons.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,19 @@ class TokenInfoIcons {

console.log("TokenInfoIcons", actor);

let movement5e = "";

if (actor.data.data.attributes.movement.walk != 0 && actor.data.data.attributes.movement.walk != null) movement5e += '<span style="white-space: pre;" title="Walk"><i class="fas fa-walking"></i> ' + actor.data.data.attributes.movement.walk + '<span style="font-size: 0.5em;"> ' + actor.data.data.attributes.movement.units + "</span></span>";
if (actor.data.data.attributes.movement.swim != 0 && actor.data.data.attributes.movement.swim != null) movement5e += '<span style="white-space: pre;" title="Swim"><i class="fas fa-swimmer"></i> ' + actor.data.data.attributes.movement.swim + '<span style="font-size: 0.5em;"> ' + actor.data.data.attributes.movement.units + "</span></span>";
if (actor.data.data.attributes.movement.fly != 0 && actor.data.data.attributes.movement.fly != null) movement5e += '<span style="white-space: pre;" title="Fly"><i class="fas fa-crow"></i> ' + actor.data.data.attributes.movement.fly + '<span style="font-size: 0.5em;"> ' + actor.data.data.attributes.movement.units + "</span></span>";
if (actor.data.data.attributes.movement.burrow != 0 && actor.data.data.attributes.movement.burrow != null) movement5e += '<span style="white-space: pre;" title="Burrow"><i class="fas fa-mountain"></i> ' + actor.data.data.attributes.movement.burrow + '<span style="font-size: 0.5em;"> ' + actor.data.data.attributes.movement.units + "</span></span>";
if (actor.data.data.attributes.movement.climb != 0 && actor.data.data.attributes.movement.climb != null) movement5e += '<span style="white-space: pre;" title="Climb"><i class="fas fa-grip-lines"></i> ' + actor.data.data.attributes.movement.climb + '<span style="font-size: 0.5em;"> ' + actor.data.data.attributes.movement.units + "</span></span>";

let speed = "";

let speed = game.world.system === "pf1" ? actor.data.data.attributes.speed.land.total : movement5e;
if (game.world.system === "pf2e") {
speed = '<span style="white-space: pre;" title="Land"><i class="fas fa-walking"></i> ' + actor.data.data.attributes.speed.total + '</span>';
} else if (game.world.system === "pf1") {
speed = '<span style="white-space: pre;" title="Land"><i class="fas fa-walking"></i> ' + actor.data.data.attributes.speed.land.total + '</span>';
} else {
if (actor.data.data.attributes.movement.walk != 0 && actor.data.data.attributes.movement.walk != null) speed += '<span style="white-space: pre;" title="Walk"><i class="fas fa-walking"></i> ' + actor.data.data.attributes.movement.walk + '<span style="font-size: 0.5em;"> ' + actor.data.data.attributes.movement.units + "</span></span>";
if (actor.data.data.attributes.movement.swim != 0 && actor.data.data.attributes.movement.swim != null) speed += '<span style="white-space: pre;" title="Swim"><i class="fas fa-swimmer"></i> ' + actor.data.data.attributes.movement.swim + '<span style="font-size: 0.5em;"> ' + actor.data.data.attributes.movement.units + "</span></span>";
if (actor.data.data.attributes.movement.fly != 0 && actor.data.data.attributes.movement.fly != null) speed += '<span style="white-space: pre;" title="Fly"><i class="fas fa-crow"></i> ' + actor.data.data.attributes.movement.fly + '<span style="font-size: 0.5em;"> ' + actor.data.data.attributes.movement.units + "</span></span>";
if (actor.data.data.attributes.movement.burrow != 0 && actor.data.data.attributes.movement.burrow != null) speed += '<span style="white-space: pre;" title="Burrow"><i class="fas fa-mountain"></i> ' + actor.data.data.attributes.movement.burrow + '<span style="font-size: 0.5em;"> ' + actor.data.data.attributes.movement.units + "</span></span>";
if (actor.data.data.attributes.movement.climb != 0 && actor.data.data.attributes.movement.climb != null) speed += '<span style="white-space: pre;" title="Climb"><i class="fas fa-grip-lines"></i> ' + actor.data.data.attributes.movement.climb + '<span style="font-size: 0.5em;"> ' + actor.data.data.attributes.movement.units + "</span></span>";
}

let newdiv = '<div class="token-info-container">';

Expand Down

0 comments on commit dff4360

Please sign in to comment.