diff --git a/img/token/skills/SOURCES.txt b/img/token/skills/SOURCES.txt index a3317cf..28ac895 100644 --- a/img/token/skills/SOURCES.txt +++ b/img/token/skills/SOURCES.txt @@ -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 itm.png: https://game-icons.net/1x1/lorc/one-eyed.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 nat.png: https://game-icons.net/1x1/delapouite/forest.html occ.png: https://game-icons.net/1x1/skoll/pentacle.html diff --git a/img/token/skills/lor.png b/img/token/skills/lor.png new file mode 100644 index 0000000..4d25e52 Binary files /dev/null and b/img/token/skills/lor.png differ diff --git a/src/systems/demonlord.js b/src/systems/demonlord.js index 2cabe4a..985ac49 100644 --- a/src/systems/demonlord.js +++ b/src/systems/demonlord.js @@ -134,4 +134,15 @@ export class demonlord{ rollItem(item) { return item.roll() } + + /** + * Ring Colors + */ + getSkillRingColor(token, skill) { + return; + } + + getSaveRingColor(token, save) { + return; + } } \ No newline at end of file diff --git a/src/systems/dnd35e.js b/src/systems/dnd35e.js index 32d1604..72bdc75 100644 --- a/src/systems/dnd35e.js +++ b/src/systems/dnd35e.js @@ -199,4 +199,15 @@ export class dnd35e{ rollItem(item) { return item.roll() } + + /** + * Ring Colors + */ + getSkillRingColor(token, skill) { + return; + } + + getSaveRingColor(token, save) { + return; + } } \ No newline at end of file diff --git a/src/systems/dnd5e.js b/src/systems/dnd5e.js index b32ee24..f0c27b4 100644 --- a/src/systems/dnd5e.js +++ b/src/systems/dnd5e.js @@ -1,5 +1,12 @@ import {compatibleCore} from "../misc.js"; +const proficiencyColors = { + 0: "#000000", + 0.5: "#804A00", + 1: "#C0C0C0", + 2: "#FFD700" +} + export class dnd5e{ constructor(){ @@ -202,4 +209,19 @@ export class dnd5e{ rollItem(item) { 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]; + } } \ No newline at end of file diff --git a/src/systems/forbidden-lands.js b/src/systems/forbidden-lands.js index 0eb1a00..98025a1 100644 --- a/src/systems/forbidden-lands.js +++ b/src/systems/forbidden-lands.js @@ -235,4 +235,15 @@ export class forbiddenlands{ sheet.rollSpecificAttack(item.id); return item.sendToChat(); } + + /** + * Ring Colors + */ + getSkillRingColor(token, skill) { + return; + } + + getSaveRingColor(token, save) { + return; + } } \ No newline at end of file diff --git a/src/systems/pf2e.js b/src/systems/pf2e.js index 4953fe6..321b42a 100644 --- a/src/systems/pf2e.js +++ b/src/systems/pf2e.js @@ -2,6 +2,14 @@ import {compatibleCore} from "../misc.js"; import {otherControls} from "../../MaterialDeck.js"; const limitedSheets = ['loot', 'vehicle']; +const proficiencyColors = +{ + untrained: "#424242", + trained: "#171F69", + expert: "#3C005E", + master: "#664400", + legendary: "#5E0000" +}; export class pf2e{ @@ -98,29 +106,50 @@ export class pf2e{ } getAbilitySave(token, ability) { - if (this.isLimitedSheet(token.actor)) return ''; - if (ability == undefined) ability = 'fortitude'; - else if (ability == 'fort') ability = 'fortitude'; - else if (ability == 'ref') ability = 'reflex'; - else if (ability == 'will') ability = 'will'; - let val = token.actor.data.data.saves?.[ability]?.value; + ability = this.fixSave(ability); + const save = this.findSave(token, ability); + if (save == undefined) return ''; + let val = save?.value; 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) { - 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.startsWith('lor')) { const index = parseInt(skill.split('_')[1])-1; const loreSkills = this.getLoreSkills(token); if (loreSkills.length > index) { - return `${loreSkills[index].name}: +${loreSkills[index].totalModifier}`; + return loreSkills[index]; } else { - return ''; + return; } } - const val = token.actor.data.data.skills?.[skill].totalModifier; - return (val >= 0) ? `+${val}` : val; + return token.actor.data.data.skills?.[skill]; } getLoreSkills(token) { @@ -336,4 +365,27 @@ export class pf2e{ isLimitedSheet(actor) { 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; + } } \ No newline at end of file diff --git a/src/systems/tokenHelper.js b/src/systems/tokenHelper.js index eed2f70..aa4c5ad 100644 --- a/src/systems/tokenHelper.js +++ b/src/systems/tokenHelper.js @@ -318,4 +318,14 @@ export class TokenHelper{ 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); + } } \ No newline at end of file diff --git a/src/systems/wfrp4e.js b/src/systems/wfrp4e.js index eefaee2..7b62cc0 100644 --- a/src/systems/wfrp4e.js +++ b/src/systems/wfrp4e.js @@ -168,5 +168,14 @@ export class wfrp4e { return; } + /** + * Ring Colors + */ + getSkillRingColor(token, skill) { + return; + } + getSaveRingColor(token, save) { + return; + } } \ No newline at end of file diff --git a/src/token.js b/src/token.js index abb2765..a9da86b 100644 --- a/src/token.js +++ b/src/token.js @@ -198,8 +198,16 @@ export class TokenControl{ else if (stats == 'PassiveInvestigation') txt += tokenHelper.getPassiveInvestigation(token); else if (stats == 'Ability') txt += tokenHelper.getAbility(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 == 'Skill') txt += tokenHelper.getSkill(token, settings.skill); + else if (stats == 'Save') { + 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 == 'Fate') txt += tokenHelper.getFate(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') { overlay = true; - ring = 1; let ability = (stats == 'Save') ? settings.save : settings.ability; if (ability == undefined) ability = 'str'; if (ability == 'con') iconSrc = "modules/MaterialDeck/img/token/abilities/cons.png"; @@ -452,10 +459,9 @@ export class TokenControl{ } else if (stats == 'Skill') { overlay = true; - ring = 1; let skill = settings.skill; 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') { overlay = true;