Skip to content

Commit

Permalink
Updated regex's and ready for v11!
Browse files Browse the repository at this point in the history
  • Loading branch information
JamzTheMan committed Aug 13, 2023
1 parent e7d0523 commit d962c2b
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 145 deletions.
2 changes: 1 addition & 1 deletion module.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
}
],
"url": "https://github.com/JamzTheMan/Nerps-For-Foundry",
"version": "4.0.3",
"version": "5.0.3",
"esmodules": [
"/scripts/nerps-for-foundry.js",
"/scripts/hooks-for-nerps.js",
Expand Down
45 changes: 5 additions & 40 deletions packs/shared-items.db

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions scripts/autocorrect-journal-content.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import {getSetting} from "./utils/extensions.js";
import {log} from "./nerps-for-foundry.js";
import {DEFAULT_RULES, FUMBLE_DECK_CONVERSION_RULES, CRITICAL_DECK_CONVERSION_RULES, JOURNAL_MARKER, LINK_RULES, MIGRATE_PF1E_SKILL_CHECKS} from "./constants.js";
import {DEFAULT_RULES, JOURNAL_MARKER, LINK_RULES, MIGRATE_PF1E_SKILL_CHECKS} from "./constants.js";

export function autoCorrectJournalContent(journalContent) {
const additionalRules = JSON.parse(getSetting("additional-auto-correct-rules"));
let rules = [...DEFAULT_RULES, ...FUMBLE_DECK_CONVERSION_RULES, ...CRITICAL_DECK_CONVERSION_RULES, ...LINK_RULES, ...MIGRATE_PF1E_SKILL_CHECKS, ...additionalRules];

let rules = [...DEFAULT_RULES, ...LINK_RULES, ...MIGRATE_PF1E_SKILL_CHECKS, ...additionalRules];

// Remove any existing markers...
const originalContent = journalContent;
Expand Down
105 changes: 27 additions & 78 deletions scripts/constants.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export const MODULE_NAME = "Nerps-For-Foundry";
export const MODULE_NAME = 'nerps-for-foundry';
export const MODULE_PATH = `modules/${MODULE_NAME}`;
export const JOURNAL_MARKER = `<footer style="visibility: hidden;">Infused with Nerps!</footer>`;
// alt marker <footer style="color: #ced4d9; text-align: right;"><small><em>Infused with Nerps!&trade; </em></small></footer>
Expand Down Expand Up @@ -37,62 +37,11 @@ export let DEFAULT_RULES = [
"findExpression": ' f ',
"replaceExpression": " f",
"doOnce": true
}
]

export const FUMBLE_DECK_CONVERSION_RULES = [
{
"name": "Set Fumble deck class up",
"findExpression": '<table.*thead>(?=.*<h3>Melee</h3>)',
"replaceExpression": "<section class=\"fumble-deck\">",
"lowerCaseFirst": false,
"options": "gs"
},
{
"name": "Add Wrap Names in H1",
"findExpression": "<td><strong>([a-zA-Z0-9-.,'()?! ]+)</strong></td>",
"lowerCaseFirst": false,
"replaceExpression": "<h1>$1</h1>"
},
{
"name": "Wrap Effect in blockquote tag",
"findExpression": "<td>([a-zA-Z0-9-.,'()+?! ]+)<\\/td>",
"lowerCaseFirst": false,
"replaceExpression": "<blockquote><p>$1</p></blockquote>"
},
{
"name": "Wrap Type in code tag",
"findExpression": "<h3>(Melee|Ranged|Unarmed|Spell)</h3>",
"lowerCaseFirst": false,
"replaceExpression": "<p><code>$1</code></p>"
}
]

export const CRITICAL_DECK_CONVERSION_RULES = [
{
"name": "Set Critical deck class up",
"findExpression": '<table.*\\/thead>(?=.*<h3>Bomb or Spell</h3>)',
"replaceExpression": "<section class=\"critical-deck\">",
"lowerCaseFirst": false,
"options": "gs"
},
{
"name": "Add Wrap Names in H1",
"findExpression": "<td><strong>([a-zA-Z0-9-.,'()?! ]+)</strong></td>",
"lowerCaseFirst": false,
"replaceExpression": "<h1>$1</h1>"
},
{
"name": "Wrap Effect in blockquote tag",
"findExpression": "<td>([a-zA-Z0-9-.,'()+?! ]+)<\\/td>",
"lowerCaseFirst": false,
"replaceExpression": "<blockquote><p>$1</p></blockquote>"
},
{
"name": "Wrap Type in code tag",
"findExpression": "<h3>(Bludgeoning|Piercing|Slashing|Bomb or Spell)</h3>",
"lowerCaseFirst": false,
"replaceExpression": "<p><code>$1</code></p>"
"name": "Add paragraph breaks",
"findExpression": "(?<=[.!])[\\r\\n]",
"replaceExpression": '</p><p class="nerps-ident">'
}
]

Expand Down Expand Up @@ -142,25 +91,25 @@ export let LINK_RULES = [
},
{
"name": "Link Blinded to Compendium",
"findExpression": " (Blinded)",
"findExpression": " (Blinded) ",
"lowerCaseFirst": true,
"replaceExpression": " @Compendium[pf2e.conditionitems.XgEqL1kFApUbl5Z2]{Blinded}"
},
{
"name": "Link Controlled to Compendium",
"findExpression": " (Controlled)",
"findExpression": " (Controlled) ",
"lowerCaseFirst": true,
"replaceExpression": " @Compendium[pf2e.conditionitems.9qGBRpbX9NEwtAAr]{Controlled}"
},
{
"name": "Link Dazzled to Compendium",
"findExpression": " (dazzled)",
"findExpression": " (dazzled) ",
"lowerCaseFirst": true,
"replaceExpression": " @Compendium[pf2e.conditionitems.TkIyaNPgTZFBCCuh]{Dazzled}"
},
{
"name": "Link Deafened to Compendium",
"findExpression": " (deafened)",
"findExpression": " (deafened) ",
"lowerCaseFirst": true,
"replaceExpression": " @Compendium[pf2e.conditionitems.9PR9y0bi4JPKnHPR]{Deafened}"
},
Expand All @@ -184,13 +133,13 @@ export let LINK_RULES = [
},
{
"name": "Link Invisible to Compendium",
"findExpression": " (invisible)",
"findExpression": " (invisible) ",
"lowerCaseFirst": true,
"replaceExpression": " @Compendium[pf2e.conditionitems.zJxUflt9np0q4yML]{Invisible}"
},
{
"name": "Link Confused to Compendium",
"findExpression": " (Confused)",
"findExpression": " (Confused) ",
"lowerCaseFirst": true,
"replaceExpression": " @Compendium[pf2e.conditionitems.yblD8fOR1J8rDwEQ]{Confused}"
},
Expand All @@ -208,55 +157,55 @@ export let LINK_RULES = [
},
{
"name": "Link Clumsy to Compendium",
"findExpression": " (clumsy) ([0-9]+)",
"findExpression": " (Clumsy) ([0-9]+)",
"lowerCaseFirst": true,
"replaceExpression": " @Compendium[pf2e.conditionitems.i3OJZU2nk64Df3xm]{Clumsy $2}"
},
{
"name": "Link Doomed to Compendium",
"findExpression": " (doomed) ([0-9]+)",
"findExpression": " (Doomed) ([0-9]+)",
"lowerCaseFirst": true,
"replaceExpression": " @Compendium[pf2e.conditionitems.3uh1r86TzbQvosxv]{Doomed $2}"
},
{
"name": "Link Encumbered to Compendium",
"findExpression": " (Encumbered)",
"findExpression": " (Encumbered) ",
"lowerCaseFirst": true,
"replaceExpression": " @Compendium[pf2e.conditionitems.D5mg6Tc7Jzrj6ro7]{Encumbered}"
},
{
"name": "Link Fatigued to Compendium",
"findExpression": " (Fatigued)",
"findExpression": " (Fatigued) ",
"lowerCaseFirst": true,
"replaceExpression": " @Compendium[pf2e.conditionitems.HL2l2VRSaQHu9lUw]{Fatigued}"
},
{
"name": "Link Flat-Footed to Compendium",
"findExpression": " (flat-footed)",
"findExpression": " (flat-footed) ",
"lowerCaseFirst": true,
"replaceExpression": " @Compendium[pf2e.conditionitems.AJh5ex99aV6VTggg]{Flat-Footed}"
},
{
"name": "Link Grab to Compendium",
"findExpression": " (Grab)",
"findExpression": " (Grab) ",
"lowerCaseFirst": true,
"replaceExpression": " @Compendium[pf2e.bestiary-ability-glossary-srd.Tkd8sH4pwFIPzqTr]{Grab}"
},
{
"name": "Link Grapple to Compendium",
"findExpression": " (Grapple)",
"findExpression": " (Grapple) ",
"lowerCaseFirst": true,
"replaceExpression": " @Compendium[pf2e.actionspf2e.PMbdMWc2QroouFGD]{Grapple}"
},
{
"name": "Link Grapple to Compendium",
"findExpression": " (Restrained)",
"findExpression": " (Restrained) ",
"lowerCaseFirst": true,
"replaceExpression": " @Compendium[pf2e.conditionitems.VcDeM8A5oI6VqhbM]{Restrained}"
},
{
"name": "Link Prone to Compendium",
"findExpression": " (prone)",
"findExpression": " (prone) ",
"lowerCaseFirst": true,
"replaceExpression": " @Compendium[pf2e.conditionitems.j91X7x0XSomq8d60]{Prone}"
},
Expand All @@ -280,19 +229,19 @@ export let LINK_RULES = [
},
{
"name": "Link Shove to Compendium",
"findExpression": " (Shove)",
"findExpression": " (Shove) ",
"lowerCaseFirst": true,
"replaceExpression": " @Compendium[pf2e.actionspf2e.7blmbDrQFNfdT731]{Shove}"
},
{
"name": "Link Unconscious to Compendium",
"findExpression": " (unconscious)",
"findExpression": " (unconscious) ",
"lowerCaseFirst": true,
"replaceExpression": " @Compendium[pf2e.conditionitems.fBnFDH2MTzgFijKf]{Unconscious}"
},
{
"name": "Link Unconscious to Compendium",
"findExpression": " (Interact)",
"findExpression": " (Interact) ",
"lowerCaseFirst": true,
"replaceExpression": " @Compendium[pf2e.actionspf2e.pvQ5rY2zrtPI614F]{Interact}"
},
Expand Down Expand Up @@ -423,31 +372,31 @@ export const MIGRATE_PF1E_SKILL_CHECKS = [
"name": "Migrate Knowledge (arcana) checks @Check",
"findExpression": "DC ([0-9]+) Knowledge \\(arcana\\)",
"lowerCaseFirst": true,
"replaceExpression": "@Check[type:arcana|dc:$1|traits:action:recall-knowledge]{Recall Knowledge: Arcana}"
"replaceExpression": "@Check[type:arcana|dc:$1|traits:action:recall-knowledge,secret]{Recall Knowledge: Arcana}"
},
{
"name": "Migrate Knowledge (local) checks @Check",
"findExpression": "DC ([0-9]+) Knowledge \\(local\\)",
"lowerCaseFirst": true,
"replaceExpression": "@Check[type:society|dc:$1|traits:action:recall-knowledge]{Recall Knowledge: Society}"
"replaceExpression": "@Check[type:society|dc:$1|traits:action:recall-knowledge,secret]{Recall Knowledge: Society}"
},
{
"name": "Migrate Knowledge (nature) checks @Check",
"findExpression": "DC ([0-9]+) Knowledge \\(nature\\)",
"lowerCaseFirst": true,
"replaceExpression": "@Check[type:nature|dc:$1|traits:action:recall-knowledge]{Recall Knowledge: Nature}"
"replaceExpression": "@Check[type:nature|dc:$1|traits:action:recall-knowledge,secret]{Recall Knowledge: Nature}"
},
{
"name": "Migrate Knowledge (religion) checks @Check",
"findExpression": "DC ([0-9]+) Knowledge \\(religion\\)",
"lowerCaseFirst": true,
"replaceExpression": "@Check[type:religion|dc:$1|traits:action:recall-knowledge]{Recall Knowledge: Religion}"
"replaceExpression": "@Check[type:religion|dc:$1|traits:action:recall-knowledge,secret]{Recall Knowledge: Religion}"
},
{
"name": "Migrate other Knowledge checks to lore @Check",
"findExpression": "DC ([0-9]+) Knowledge \\((.*)\\) ",
"lowerCaseFirst": true,
"replaceExpression": "@Check[type:$2-lore|dc:$1]"
"replaceExpression": "@Check[type:$2-lore|dc:$1|traits:action:recall-knowledge,secret]"
}
]

Expand Down
2 changes: 1 addition & 1 deletion scripts/hooks-for-nerps.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Hooks.once('init', async function () {
| .\` / -_) '_| '_ (_-<___|_ _|___| _/ _ \\ || | ' \\/ _\` | '_| || |
|_|\\_\\___|_| | .__/__/ |_| |_|\\___/\\_,_|_||_\\__,_|_| \\_, |
|_| |__/
v${game.modules.get("Nerps-For-Foundry").version}
v${game.modules.get(MODULE_NAME).version}
`, `font-family: monospace`); // Small

registerSettings();
Expand Down
49 changes: 26 additions & 23 deletions styles/custom-css-overrides.css
Original file line number Diff line number Diff line change
@@ -1,29 +1,32 @@
/* Custom CSS - Fixes to override various modules and base system styles */

.editor code {
/*color : var(--primary);*/
/*#color : #171F69;*/
color : var(--secondary);
font-family : sans-serif;
font-size : .95em;
font-weight : bold;
}
/*.editor code {*/
/* !*color : var(--primary);*!*/
/* !*#color : #171F69;*!*/
/* color : var(--secondary);*/
/* font-family : sans-serif;*/
/* font-size : .95em;*/
/* font-weight : bold;*/
/*}*/


/* NPC Sheet Skill buttons */
.pf2e.sheet form .tag-legacy {
background-color: oldlace;
color:black;
font-size: 14px;
padding-left: 5px;
padding-right: 5px;
}
/*.pf2e.actor form .tag-legacy {*/
/* background-color: oldlace;*/
/* color:black;*/
/* font-size: 14px;*/
/* padding-left: 5px;*/
/* padding-right: 5px;*/
/*}*/

.pf2e.sheet form .tag_transparent {
background-color: oldlace;
color: black;
}
/*.pf2e.sheet form .tag_transparent {*/
/* background-color: oldlace;*/
/* color: black;*/
/*}*/

.nerps-ident {
text-indent: 1em;
}

/* Roll of Fate */
.nerps-rof-title {
Expand Down Expand Up @@ -60,7 +63,7 @@


/* Put small time behind popup image */
#smalltime-app {
z-index: 1 !important;
margin-left: -3px;
}
/*#smalltime-app {*/
/* z-index: 1 !important;*/
/* margin-left: -3px;*/
/*}*/

0 comments on commit d962c2b

Please sign in to comment.