Added color ring based on proficiency levels for skills and saves (pf2e and dnd5e)
This commit is contained in:
@@ -10,6 +10,7 @@ his.png: https://game-icons.net/1x1/delapouite/backward-time.html
|
|||||||
ins.png: https://game-icons.net/1x1/lorc/light-bulb.html
|
ins.png: https://game-icons.net/1x1/lorc/light-bulb.html
|
||||||
itm.png: https://game-icons.net/1x1/lorc/one-eyed.html
|
itm.png: https://game-icons.net/1x1/lorc/one-eyed.html
|
||||||
inv.png: https://game-icons.net/1x1/lorc/magnifying-glass.html
|
inv.png: https://game-icons.net/1x1/lorc/magnifying-glass.html
|
||||||
|
lor.png: https://game-icons.net/1x1/lorc/bookmarklet.html
|
||||||
med.png: https://game-icons.net/1x1/delapouite/first-aid-kit.html
|
med.png: https://game-icons.net/1x1/delapouite/first-aid-kit.html
|
||||||
nat.png: https://game-icons.net/1x1/delapouite/forest.html
|
nat.png: https://game-icons.net/1x1/delapouite/forest.html
|
||||||
occ.png: https://game-icons.net/1x1/skoll/pentacle.html
|
occ.png: https://game-icons.net/1x1/skoll/pentacle.html
|
||||||
|
|||||||
BIN
img/token/skills/lor.png
Normal file
BIN
img/token/skills/lor.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 30 KiB |
@@ -134,4 +134,15 @@ export class demonlord{
|
|||||||
rollItem(item) {
|
rollItem(item) {
|
||||||
return item.roll()
|
return item.roll()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ring Colors
|
||||||
|
*/
|
||||||
|
getSkillRingColor(token, skill) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
getSaveRingColor(token, save) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -199,4 +199,15 @@ export class dnd35e{
|
|||||||
rollItem(item) {
|
rollItem(item) {
|
||||||
return item.roll()
|
return item.roll()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ring Colors
|
||||||
|
*/
|
||||||
|
getSkillRingColor(token, skill) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
getSaveRingColor(token, save) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,12 @@
|
|||||||
import {compatibleCore} from "../misc.js";
|
import {compatibleCore} from "../misc.js";
|
||||||
|
|
||||||
|
const proficiencyColors = {
|
||||||
|
0: "#000000",
|
||||||
|
0.5: "#804A00",
|
||||||
|
1: "#C0C0C0",
|
||||||
|
2: "#FFD700"
|
||||||
|
}
|
||||||
|
|
||||||
export class dnd5e{
|
export class dnd5e{
|
||||||
constructor(){
|
constructor(){
|
||||||
|
|
||||||
@@ -202,4 +209,19 @@ export class dnd5e{
|
|||||||
rollItem(item) {
|
rollItem(item) {
|
||||||
return item.roll()
|
return item.roll()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ring Colors
|
||||||
|
*/
|
||||||
|
getSkillRingColor(token, skill) {
|
||||||
|
const profLevel = token.actor.data.data?.skills[skill]?.proficient;
|
||||||
|
if (profLevel == undefined) return;
|
||||||
|
return proficiencyColors?.[profLevel];
|
||||||
|
}
|
||||||
|
|
||||||
|
getSaveRingColor(token, save) {
|
||||||
|
const profLevel = token.actor.data.data?.abilities[save]?.proficient;
|
||||||
|
if (profLevel == undefined) return;
|
||||||
|
return proficiencyColors?.[profLevel];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -235,4 +235,15 @@ export class forbiddenlands{
|
|||||||
sheet.rollSpecificAttack(item.id);
|
sheet.rollSpecificAttack(item.id);
|
||||||
return item.sendToChat();
|
return item.sendToChat();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ring Colors
|
||||||
|
*/
|
||||||
|
getSkillRingColor(token, skill) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
getSaveRingColor(token, save) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -2,6 +2,14 @@ import {compatibleCore} from "../misc.js";
|
|||||||
import {otherControls} from "../../MaterialDeck.js";
|
import {otherControls} from "../../MaterialDeck.js";
|
||||||
|
|
||||||
const limitedSheets = ['loot', 'vehicle'];
|
const limitedSheets = ['loot', 'vehicle'];
|
||||||
|
const proficiencyColors =
|
||||||
|
{
|
||||||
|
untrained: "#424242",
|
||||||
|
trained: "#171F69",
|
||||||
|
expert: "#3C005E",
|
||||||
|
master: "#664400",
|
||||||
|
legendary: "#5E0000"
|
||||||
|
};
|
||||||
|
|
||||||
export class pf2e{
|
export class pf2e{
|
||||||
|
|
||||||
@@ -98,29 +106,50 @@ export class pf2e{
|
|||||||
}
|
}
|
||||||
|
|
||||||
getAbilitySave(token, ability) {
|
getAbilitySave(token, ability) {
|
||||||
if (this.isLimitedSheet(token.actor)) return '';
|
ability = this.fixSave(ability);
|
||||||
if (ability == undefined) ability = 'fortitude';
|
const save = this.findSave(token, ability);
|
||||||
else if (ability == 'fort') ability = 'fortitude';
|
if (save == undefined) return '';
|
||||||
else if (ability == 'ref') ability = 'reflex';
|
let val = save?.value;
|
||||||
else if (ability == 'will') ability = 'will';
|
|
||||||
let val = token.actor.data.data.saves?.[ability]?.value;
|
|
||||||
return (val >= 0) ? `+${val}` : val;
|
return (val >= 0) ? `+${val}` : val;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
findSave(token, ability) {
|
||||||
|
if (this.isLimitedSheet(token.actor)) return;
|
||||||
|
return token.actor.data.data.saves?.[ability];
|
||||||
|
}
|
||||||
|
|
||||||
|
fixSave(ability) {
|
||||||
|
if (ability == undefined) return 'fortitude';
|
||||||
|
else if (ability == 'fort') return 'fortitude';
|
||||||
|
else if (ability == 'ref') return 'reflex';
|
||||||
|
else if (ability == 'will') return 'will';
|
||||||
|
}
|
||||||
|
|
||||||
getSkill(token, skill) {
|
getSkill(token, skill) {
|
||||||
if (this.isLimitedSheet(token.actor)) return '';
|
const tokenSkill = this.findSkill(token, skill);
|
||||||
|
if (tokenSkill == undefined) return '';
|
||||||
|
|
||||||
|
if (skill.startsWith('lor')) {
|
||||||
|
return `${tokenSkill.name}: +${tokenSkill.totalModifier}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
const val = tokenSkill.totalModifier;
|
||||||
|
return (val >= 0) ? `+${val}` : val;
|
||||||
|
}
|
||||||
|
|
||||||
|
findSkill(token, skill) {
|
||||||
|
if (this.isLimitedSheet(token.actor)) return;
|
||||||
if (skill == undefined) skill = 'acr';
|
if (skill == undefined) skill = 'acr';
|
||||||
if (skill.startsWith('lor')) {
|
if (skill.startsWith('lor')) {
|
||||||
const index = parseInt(skill.split('_')[1])-1;
|
const index = parseInt(skill.split('_')[1])-1;
|
||||||
const loreSkills = this.getLoreSkills(token);
|
const loreSkills = this.getLoreSkills(token);
|
||||||
if (loreSkills.length > index) {
|
if (loreSkills.length > index) {
|
||||||
return `${loreSkills[index].name}: +${loreSkills[index].totalModifier}`;
|
return loreSkills[index];
|
||||||
} else {
|
} else {
|
||||||
return '';
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const val = token.actor.data.data.skills?.[skill].totalModifier;
|
return token.actor.data.data.skills?.[skill];
|
||||||
return (val >= 0) ? `+${val}` : val;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getLoreSkills(token) {
|
getLoreSkills(token) {
|
||||||
@@ -336,4 +365,27 @@ export class pf2e{
|
|||||||
isLimitedSheet(actor) {
|
isLimitedSheet(actor) {
|
||||||
return limitedSheets.includes(actor.type);
|
return limitedSheets.includes(actor.type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ring Colors
|
||||||
|
*/
|
||||||
|
getSkillRingColor(token, skill) {
|
||||||
|
return this.getRingColor(this.findSkill(token, skill));
|
||||||
|
}
|
||||||
|
|
||||||
|
getSaveRingColor(token, save) {
|
||||||
|
save = this.fixSave(save);
|
||||||
|
return this.getRingColor(this.findSave(token, save));
|
||||||
|
}
|
||||||
|
|
||||||
|
getRingColor(stat) {
|
||||||
|
if (stat == undefined) return;
|
||||||
|
let statModifiers = stat?.modifiers || stat?._modifiers;
|
||||||
|
const profLevel = statModifiers?.find(m => m.type == 'proficiency')?.slug;
|
||||||
|
// console.log(`Proficiency Level for ${stat.name}: ${profLevel}`);
|
||||||
|
if (profLevel != undefined) {
|
||||||
|
return proficiencyColors?.[profLevel];
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -318,4 +318,14 @@ export class TokenHelper{
|
|||||||
rollItem(item) {
|
rollItem(item) {
|
||||||
return this.system.rollItem(item);
|
return this.system.rollItem(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ring Colors
|
||||||
|
*/
|
||||||
|
getSkillRingColor(token,skill) {
|
||||||
|
return this.system.getSkillRingColor(token,skill);
|
||||||
|
}
|
||||||
|
getSaveRingColor(token,save) {
|
||||||
|
return this.system.getSaveRingColor(token,save);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -168,5 +168,14 @@ export class wfrp4e {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ring Colors
|
||||||
|
*/
|
||||||
|
getSkillRingColor(token, skill) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
getSaveRingColor(token, save) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
16
src/token.js
16
src/token.js
@@ -198,8 +198,16 @@ export class TokenControl{
|
|||||||
else if (stats == 'PassiveInvestigation') txt += tokenHelper.getPassiveInvestigation(token);
|
else if (stats == 'PassiveInvestigation') txt += tokenHelper.getPassiveInvestigation(token);
|
||||||
else if (stats == 'Ability') txt += tokenHelper.getAbility(token, settings.ability);
|
else if (stats == 'Ability') txt += tokenHelper.getAbility(token, settings.ability);
|
||||||
else if (stats == 'AbilityMod') txt += tokenHelper.getAbilityModifier(token, settings.ability);
|
else if (stats == 'AbilityMod') txt += tokenHelper.getAbilityModifier(token, settings.ability);
|
||||||
else if (stats == 'Save') txt += tokenHelper.getAbilitySave(token, settings.save);
|
else if (stats == 'Save') {
|
||||||
else if (stats == 'Skill') txt += tokenHelper.getSkill(token, settings.skill);
|
txt += tokenHelper.getAbilitySave(token, settings.save);
|
||||||
|
ringColor = tokenHelper.getSaveRingColor(token, settings.save);
|
||||||
|
if (ringColor != undefined) ring = 2;
|
||||||
|
}
|
||||||
|
else if (stats == 'Skill') {
|
||||||
|
txt += tokenHelper.getSkill(token, settings.skill);
|
||||||
|
ringColor = tokenHelper.getSkillRingColor(token, settings.skill);
|
||||||
|
if (ringColor != undefined) ring = 2;
|
||||||
|
}
|
||||||
else if (stats == 'Prof') txt += tokenHelper.getProficiency(token);
|
else if (stats == 'Prof') txt += tokenHelper.getProficiency(token);
|
||||||
else if (stats == 'Fate') txt += tokenHelper.getFate(token) /* WFRP4e */
|
else if (stats == 'Fate') txt += tokenHelper.getFate(token) /* WFRP4e */
|
||||||
else if (stats == 'Fortune') txt += tokenHelper.getFortune(token) /* WFRP4e */
|
else if (stats == 'Fortune') txt += tokenHelper.getFortune(token) /* WFRP4e */
|
||||||
@@ -444,7 +452,6 @@ export class TokenControl{
|
|||||||
}
|
}
|
||||||
else if (stats == 'Ability' || stats == 'AbilityMod' || stats == 'Save') {
|
else if (stats == 'Ability' || stats == 'AbilityMod' || stats == 'Save') {
|
||||||
overlay = true;
|
overlay = true;
|
||||||
ring = 1;
|
|
||||||
let ability = (stats == 'Save') ? settings.save : settings.ability;
|
let ability = (stats == 'Save') ? settings.save : settings.ability;
|
||||||
if (ability == undefined) ability = 'str';
|
if (ability == undefined) ability = 'str';
|
||||||
if (ability == 'con') iconSrc = "modules/MaterialDeck/img/token/abilities/cons.png";
|
if (ability == 'con') iconSrc = "modules/MaterialDeck/img/token/abilities/cons.png";
|
||||||
@@ -452,10 +459,9 @@ export class TokenControl{
|
|||||||
}
|
}
|
||||||
else if (stats == 'Skill') {
|
else if (stats == 'Skill') {
|
||||||
overlay = true;
|
overlay = true;
|
||||||
ring = 1;
|
|
||||||
let skill = settings.skill;
|
let skill = settings.skill;
|
||||||
if (skill == undefined) skill = 'acr';
|
if (skill == undefined) skill = 'acr';
|
||||||
else iconSrc = "modules/MaterialDeck/img/token/skills/" + skill + ".png";
|
else iconSrc = "modules/MaterialDeck/img/token/skills/" + (skill.startsWith('lor')? 'lor' : skill) + ".png";
|
||||||
}
|
}
|
||||||
else if (settings.onClick == 'center' || settings.onClick == 'centerSelect') {
|
else if (settings.onClick == 'center' || settings.onClick == 'centerSelect') {
|
||||||
overlay = true;
|
overlay = true;
|
||||||
|
|||||||
Reference in New Issue
Block a user