jbhaywood / 5e-statblock-importer

A module for FoundryVTT that creates a new actor from any 5e monster or NPC statblock.
MIT License
18 stars 14 forks source link

Integrate with ddb-importer to optionally add icons on import #19

Closed Oshcakes closed 2 years ago

Oshcakes commented 2 years ago

Hey there! I reached out to Mr Primate and he made the API available from his module.

See this: https://github.com/MrPrimate/ddb-importer/blob/main/FAQ.md#can-i-use-the-icon-mapping-api

Thanks

jbhaywood commented 2 years ago

Interesting. I'll take a look when I get a chance. I should be able to get icons for the standard weapons and such directly from the compendiums that come as part of the 5e system. I'd rather avoid tying this to another module since you never know when it might change or go away completely.

Oshcakes commented 2 years ago

Yeah this uses the core icons. The API just maps items, features, spells, etc to the existing icons based on the keyword and/or type. So all of that mind numbing work of matching icons is already done. (I had a hand in some of it myself)

Example:

await DDBImporter.getIconPath(item)
'systems/dnd5e/icons/skills/weapon_18.jpg'

I very much doubt this goes away anytime soon as this is backed by a very healthy patreon and the code base is updated often. Plus Mr P. is a cool dude :)

jbhaywood commented 2 years ago

I added icon loading in v1.3.0. It pulls from the SRD compendiums that get installed with the 5e system, so most people will have them, unless they manually deleted them for some reason.

A few reasons I didn't go with the DDB Importer are 1) like I said, I don't want to tie this module to another one if I don't need to, 2) there's no guarantee people are up to date on the module, 3) if you're importing from DnD Beyond you're probably using the monster muncher and don't need this anyway, and 4) it doesn't seem to work. I tried "await DDBImporter.getIconPath("shield")" (along with some other common items) and it didn't return anything.

Thanks for the suggestion though. I thought of using the SRD compendium items but didn't want to overwrite custom stats if something happened to be using the same name. It didn't occur to me to just pull out the icon and leave the rest.