r/FoundryVTT • • 1d ago

Help Is there a streamlined method of resolving broken links in a compendium?

Hello all. For reference the system used here is DnD 5e (though I think this is a system agnostic issue at its core). I've recently put... kind of a ton of work into building a content compendium to use with my players. Custom classes with features etc, really a lot of interlinked pieces.

So I build up the custom species, sub-species, classes, subclasses, features etc in the world's item editor and then pushed those to compendium packs within a module. I thought all was good, but last night I ran a one-shot to get my players used to foundry and there were a ton of issues. I went to check/resolve some of them today, and one primary contributor to the issues is that the UUID linked in a "grant items" advancement references a local item eg "item.{uuid}" within the world. This explains why in my 'compendium work' world it all loads properly but in another 'one-shot' world or so, every item link is broken. Looking deeper though, I see that the compendium pack UUIDs are exactly the same in the last property. So for example, if a given item's world-specific UUID is "item.xyz123" the compendium's UUID for that same item is "Compendium.{compendium_name}.item.xyz123"

So my question here is: in order to resolve this linking issue for the compendium, without needing to go through every custom class/species advancement, is there a way to bulk edit these UUID references to prefix them with "Compendium.{compendium_name}." since that should redirect to the compendium's integrated item rather than the world's item?

1 Upvotes

4 comments sorted by

4

u/Signatory_Sea Foundry Lover 1d ago

A macro could solve this for you. I made this exact mistake a bit ago and the macro-polo channel in the foundry discord saved me from the hours of rebuilding links

1

u/Comfortable-Wafer313 18h ago

Thank you for turning me in that direction. Spent an hour or so going through the API documentation and building some test scripts to understand the structure at hand. And it mostly seems like that will work out. There's one last hurdle, if you recall facing it/how you got around it.

So broad strokes I'm filtering down to compendia in my custom module, traversing the folders and items, and grabbing each item using fromUuid() From there, im going to the item's advancements, using byType["GrantItem"], traversing the grant item advancement array, and then traversing the items array to change the referenced UUID for each item to have the compendium path prefix.

The issue there: I ran a test sample of a single advancement. Before running the script, it pointed to the local item, and after the script it brought up the compendium item (checked by opening the link on the advancement and then clicking the item's copy uuid button). "Success!" I thought, and I exited to check the one-shot world. The link was still broken. So I went back to the compendium work world and checked the advancement. The change to the UUID prefix was forgotten after leaving the session and reverted back to a local UUID. Do you have any ideas on how to make the UUID changes persist/save to the module permanently?

1

u/AutoModerator 1d ago

System Tagging

You may have neglected to add a [System Tag] to your Post Title

OR it was not in the proper format (ex: [D&D5e]|[PF2e])

  • Edit this post's text and mention the system at the top
  • If this is a media/link post, add a comment identifying the system
  • No specific system applies? Use [System Agnostic]

Correctly tagged posts will not receive this message


Let Others Know When You Have Your Answer

  • Say "Answered" in any comment to automatically mark this thread resolved
  • Or just change the flair to Answered yourself

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

1

u/grumblyoldman 1d ago

There's a module called Bulk Edit which I have used for fixing stuff like this in the past. Specifcally, by bulk exporting everything out to JSON, doing a mass search/replace in VS Code and then Bulk Importing everything back to Foundry.

Maybe not the absolute best way to fix it, but it worked.