Skip to content

Commit

Permalink
2.3.10
Browse files Browse the repository at this point in the history
  • Loading branch information
jopeek committed Mar 12, 2023
1 parent 3d850dd commit 293cb23
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 55 deletions.
61 changes: 36 additions & 25 deletions module.json
Original file line number Diff line number Diff line change
@@ -1,30 +1,16 @@
{
"name": "token-info-icons",
"id": "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.3.9",
"minimumCoreVersion": "0.8.0",
"compatibleCoreVersion": "10",
"author": "Jan Ole Peek (ChalkOne)",
"authors": [ { "name" : "Jan Ole Peek (ChalkOne)" } ],
"system": [
"dnd5e",
"pf2e",
"pf1",
"dcc"
"version": "2.3.10",
"authors": [
{
"name": "Jan Ole Peek (ChalkOne)",
"flags": {}
}
],
"compatibility" : {
"minimum" : "0.8.0",
"verified" : "10"
},
"relationships" : {
"systems" : [
{ "id" : "dnd5e", "type": "system" },
{ "id" : "pf2e", "type": "system" },
{ "id" : "pf1", "type": "system" },
{ "id" : "dcc", "type": "system" }
]
"compatibility": {
"minimum": "10",
"verified": "10"
},
"scripts": [
"/token-info-icons.js"
Expand All @@ -34,5 +20,30 @@
],
"url": "https://github.com/jopeek/fvtt-token-info-icons",
"manifest": "https://raw.githubusercontent.com/jopeek/fvtt-token-info-icons/master/module.json",
"download": "https://github.com/jopeek/fvtt-token-info-icons/archive/refs/heads/master.zip"
}
"download": "https://github.com/jopeek/fvtt-token-info-icons/archive/refs/heads/master.zip",
"id": "token-info-icons",
"relationships": {
"systems": [
{
"id": "dnd5e",
"type": "system",
"compatibility": {}
},
{
"id": "pf2e",
"type": "system",
"compatibility": {}
},
{
"id": "pf1",
"type": "system",
"compatibility": {}
},
{
"id": "dcc",
"type": "system",
"compatibility": {}
}
]
}
}
60 changes: 30 additions & 30 deletions token-info-icons.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,64 +5,64 @@ class TokenInfoIcons {
if (actor === undefined) return;

let ac = 10
if (game.world.data.system === "pf1") {
ac = actor.data.data.attributes.ac.normal.total
if (game.world.system === "pf1") {
ac = actor.system.attributes.ac.normal.total
}
else if (game.world.data.system === "dcc") {
ac = actor.data.data.attributes.ac.value
else if (game.world.system === "dcc") {
ac = actor.system.attributes.ac.value
} else {
ac = (isNaN(parseInt(actor.data.data.attributes.ac.value)) || parseInt(actor.data.data.attributes.ac.value) === 0) ? 10 : parseInt(actor.data.data.attributes.ac.value);
ac = (isNaN(parseInt(actor.system.attributes.ac.value)) || parseInt(actor.system.attributes.ac.value) === 0) ? 10 : parseInt(actor.system.attributes.ac.value);
}

let perceptionTitle = "Passive Perception";
let perception = 10;
if (game.world.data.system === "pf1") {
perception = actor.data.data.skills.per.mod
if (game.world.system === "pf1") {
perception = actor.system.skills.per.mod
perceptionTitle = "Perception Mod";
} else if (game.world.data.system === "pf2e") {
perception = perception + actor.data.data.attributes.perception.value;
} else if (game.world.system === "pf2e") {
perception = perception + actor.system.attributes.perception.value;
perceptionTitle = "Perception DC";
}
else if (game.world.data.system === "dcc") {
else if (game.world.system === "dcc") {
perception = 0
perceptionTitle = "Perception DC";
}
else {
perception = actor.data.data.skills.prc.passive;
perception = actor.system.skills.prc.passive;
}

//console.log("TokenInfoIcons", actor);

let speed = "";

if (game.world.data.system === "pf2e") {
if (game.world.system === "pf2e") {
if (actor.data.type === "npc") {
speed = '<span class="token-info-speed" title="Speed"><i class="fas fa-walking"></i><span style="font-size: 0.65em;"> ' + actor.data.data.attributes.speed.value + '</span></span>';
speed = '<span class="token-info-speed" title="Speed"><i class="fas fa-walking"></i><span style="font-size: 0.65em;"> ' + actor.system.attributes.speed.value + '</span></span>';
} else if (actor.data.type === "familiar") {
// Familiars seem to get either 25 ft. land or water speed
// It can be modified by other abilities but they will be revising these later so this will likely change
speed = '<span class="token-info-speed" title="Speed"><i class="fas fa-walking"></i> 25</span>';
} else {
speed = '<span class="token-info-speed" title="Land"><i class="fas fa-walking"></i> ' + actor.data.data.attributes.speed.total + '</span>';
speed = '<span class="token-info-speed" title="Land"><i class="fas fa-walking"></i> ' + actor.system.attributes.speed.total + '</span>';
}
} else if (game.world.data.system === "pf1") {
speed = '<span class="token-info-speed" title="Land"><i class="fas fa-walking"></i> ' + actor.data.data.attributes.speed.land.total + '</span>';
} else if (game.world.data.system === "dcc") {
speed = '<span class="token-info-speed" title="Movement"><i class="fas fa-walking"></i> ' + actor.data.data.attributes.speed.base + '</span>';
} else if (game.world.system === "pf1") {
speed = '<span class="token-info-speed" title="Land"><i class="fas fa-walking"></i> ' + actor.system.attributes.speed.land.total + '</span>';
} else if (game.world.system === "dcc") {
speed = '<span class="token-info-speed" title="Movement"><i class="fas fa-walking"></i> ' + actor.system.attributes.speed.base + '</span>';
} else {
if (actor.data.data.attributes.movement.walk != 0 && actor.data.data.attributes.movement.walk != null) speed += '<span class="token-info-speed" 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 class="token-info-speed" 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 class="token-info-speed" 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 class="token-info-speed" 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 class="token-info-speed" 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>";
if (actor.system.attributes.movement.walk != 0 && actor.system.attributes.movement.walk != null) speed += '<span class="token-info-speed" title="Walk"><i class="fas fa-walking"></i> ' + actor.system.attributes.movement.walk + '<span style="font-size: 0.5em;"> ' + actor.system.attributes.movement.units + "</span></span>";
if (actor.system.attributes.movement.swim != 0 && actor.system.attributes.movement.swim != null) speed += '<span class="token-info-speed" title="Swim"><i class="fas fa-swimmer"></i> ' + actor.system.attributes.movement.swim + '<span style="font-size: 0.5em;"> ' + actor.system.attributes.movement.units + "</span></span>";
if (actor.system.attributes.movement.fly != 0 && actor.system.attributes.movement.fly != null) speed += '<span class="token-info-speed" title="Fly"><i class="fas fa-crow"></i> ' + actor.system.attributes.movement.fly + '<span style="font-size: 0.5em;"> ' + actor.system.attributes.movement.units + "</span></span>";
if (actor.system.attributes.movement.burrow != 0 && actor.system.attributes.movement.burrow != null) speed += '<span class="token-info-speed" title="Burrow"><i class="fas fa-mountain"></i> ' + actor.system.attributes.movement.burrow + '<span style="font-size: 0.5em;"> ' + actor.system.attributes.movement.units + "</span></span>";
if (actor.system.attributes.movement.climb != 0 && actor.system.attributes.movement.climb != null) speed += '<span class="token-info-speed" title="Climb"><i class="fas fa-grip-lines"></i> ' + actor.system.attributes.movement.climb + '<span style="font-size: 0.5em;"> ' + actor.system.attributes.movement.units + "</span></span>";
}

// DCC luck

let luck = null;
if (game.world.data.system === "dcc") {
if (game.world.system === "dcc") {
if (actor.data.type === "Player") {
luck = actor.data.data.abilities.lck.value;
luck = actor.system.abilities.lck.value;
}
}

Expand All @@ -71,7 +71,7 @@ class TokenInfoIcons {
let position = game.settings.get('token-info-icons', 'position');

let defaultButtons = '<div class="control-icon token-info-icon">' + speed + '</div><div class="control-icon token-info-icon" title="Armor Class: ' + ac + '"><i class="fas fa-shield-alt"></i> ' + ac + '</div>';
if (game.world.data.system !== "dcc"){
if (game.world.system !== "dcc"){
defaultButtons += '<div class="control-icon token-info-icon" title="Passive Perception: ' + perception + '"><i class="fas fa-eye"></i> ' + perception + '</div>'
}else{
// dcc specific
Expand All @@ -82,10 +82,10 @@ class TokenInfoIcons {


let passiveSensesButtons = '';
if (!['pf2e', 'pf1'].includes(game.world.data.system) && game.settings.get('token-info-icons', 'allPassiveSenses')) {
const investigation = actor.data.data.skills.inv.passive;
const insight = actor.data.data.skills.ins.passive;
const stealth = actor.data.data.skills.ste.passive;
if (!['pf2e', 'pf1'].includes(game.world.system) && game.settings.get('token-info-icons', 'allPassiveSenses')) {
const investigation = actor.system.skills.inv.passive;
const insight = actor.system.skills.ins.passive;
const stealth = actor.system.skills.ste.passive;

const passiveInvestigationButton = `<div class="control-icon token-info-icon" title="Passive Investigation: ${investigation}"><i class="fas fa-search"></i> ${investigation}</div>`;
const passiveInsightButton = `<div class="control-icon token-info-icon" title="Passive Insight: ${insight}"><i class="fas fa-lightbulb"></i> ${insight}</div>`;
Expand Down

0 comments on commit 293cb23

Please sign in to comment.