Lavaeolous / PF1-StatBlock-Converter-Module

FoundryVTT Module to convert PF1 Statblocks into Foundry Actors (PC or NPC).
MIT License
14 stars 12 forks source link

Parsing gear adds placeholders even though all items can be found #504

Closed KayelGee closed 2 years ago

KayelGee commented 2 years ago

The following line taken from https://www.d20pfsrd.com/bestiary/npc-s/npcs-cr-3/guard-officer-human-fighter-4/ (nets have been changed to net) will cause Placeholders to be generated for Javelin and Sap: Combat Gear potion of cure light wounds; Other Gear full plate, masterwork guisarme, javelin, net (2), sap when you remove the masterwork guisarme it'll generate no placeholders. Everything seems valid and will be found on it's own but in this combination it doesn't.

Lavaeolous commented 2 years ago

The error seems to be with the guisarme and not the masterwork state. When the guisarme is included in the statblock (regardless of mwk or not), the following items are handled as from type loot (and no longer as type weapon), which will lead to a failed search (as sbc is then not searching the weapons-ammo compendium.

Lavaeolous commented 2 years ago

Ok, there's something very funky going on. Currently it seems that every second item parsed defaults to the loot type. I'll investigate further.

Lavaeolous commented 2 years ago

The bug is related to the pattern.test(input) method, and the regex-patterns used, which are stateful. the index of these increases everytime the method results in true, which in turn breaks the following use. When false is returned, the index gets reset, so the third test will pass again, and so on.

I'll check if i can circumvent this somehow or if i need to switch back to another regex-matching method.

Lavaeolous commented 2 years ago

Fixed in 3.3.5