arnonram / swade-npc-importer

Savage Worlds Stat-block importer for FoundryVTT
7 stars 8 forks source link

Parser is case sensitive - won't parse block with alternate casing #97

Closed jondoud closed 2 years ago

jondoud commented 2 years ago

I am trying to import the following Stat Block. It errors out stating: "Failed to parse. Not a valid statblock."

CARTEL ENFORCER What if I put in a description? ATTRIBUTES: Agility d6, Smarts d4, Spirit d6, Strength d6, Vigor d6 SKILLS: Athletics d6, Driving d6, Fighting d6, Intimidation d8, Notice d6, Persuasion d4, Shooting d8, Stealth d4, Thievery d6 Pace: 6; Parry: 5; Toughness: 5 HINDRANCES: Vow (Major) EDGES: Menacing GEAR: 1911 .45 (Range 12/24/48, Damage 2d6+1, RoF 1, AP 1), UZI (Range 12/24/48, Damage 2d6, RoF 1, AP 1), business suit, nightclub attire

However, if I change the casing of Skills, Hindrances, Edges and Gear, to initial caps, it will parse correctly.

CARTEL ENFORCER What if I put in a description? Attributes: Agility d6, Smarts d4, Spirit d6, Strength d6, Vigor d6 Skills: Athletics d6, Driving d6, Fighting d6, Intimidation d8, Notice d6, Persuasion d4, Shooting d8, Stealth d4, Thievery d6 Pace: 6; Parry: 5; Toughness: 5 Hindrances: Vow (Major) Edges: Menacing Gear: 1911 .45 (Range 12/24/48, Damage 2d6+1, RoF 1, AP 1), UZI (Range 12/24/48, Damage 2d6, RoF 1, AP 1), business suit, nightclub attire


I have a solution that works completely for English books. I can't get the localization to work, though.

I have attached my file (renamed as .txt) for comparison.

parseStatBlock.js.txt

arnonram commented 2 years ago

I think the simplest solution might be to search with ignore case.

Didn't get to look to much into it yet

arnonram commented 2 years ago

rather not edit copied data, so added ignore case to the regexes