From 42ffc79499cbc8199199899e3e304775bfbfe778 Mon Sep 17 00:00:00 2001 From: Jacob Date: Tue, 18 Jul 2017 20:22:44 +0100 Subject: [PATCH] Spell list now displays whether a spell requires GP. --- rpg-docs/client/views/character/spells/spells.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/rpg-docs/client/views/character/spells/spells.js b/rpg-docs/client/views/character/spells/spells.js index a633f017..301d5fee 100644 --- a/rpg-docs/client/views/character/spells/spells.js +++ b/rpg-docs/client/views/character/spells/spells.js @@ -11,6 +11,12 @@ var spellLevels = [ {name: "Level 9", level: 9}, ]; +var materialNeedsGp = function(string) { + if (!string) return false; + gpRegExp = /\b[0-9]+ ?(cp|sp|gp)\b/i; + return gpRegExp.test(string); +} + const showUnprepared = (listId) => { return Session.get(`showUnprepared.${listId}`); } @@ -70,6 +76,7 @@ Template.spells.helpers({ } if (this.components.material){ components += components ? ", M" : "M"; + if (materialNeedsGp(this.components.material)) {components+="gp";} } if (this.components.concentration){ components += components ? ", C" : "C";