#Compendium Woes
1 messages ยท Page 1 of 1 (latest)
new - Compendium.rates-compendiums.classes.Item.49epOthYTBiIhyKh
old - Compendium.world.classes-2014.Item.pvEzGSv71zBhaolc
Oof.
Not the same id. Guessing that isn't an option when exporting.
Actually, yes it is. So you must have forgot to check that.
the ID box when importing?
and when exporting
doing it again from scratch for classes only
for some reason it is only importing 1 class out of all the ones I had created now..
Clear out the items sidebar
probably tossing things into various weird places due to importing multiple times
Clean slate please.
(and if we could speed this up a bit that would be good)
new - Compendium.rates-compendiums.classes.Item.pvEzGSv71zBhaolc
old - Compendium.world.classes-2014.Item.pvEzGSv71zBhaolc
There we go.
I could've sworn that I did it before though (looks like I didn't)
OK. Repeat this process for each of the compendiums.
I assume that you have the same compendiums, i.e., they map 1-to-1 world-to-module?
That will be the first step.
correct, I want to send the world compendiums I created to the module in exactly the same structure
๐
by the way, how formatting proof is the module?
Formatting?
do I need to do some kind of back up external hard drives, or cloud to make sure I don't lose it if I ever need to format?
the pc
I will suggest making a backup every now and then. I use github.
If I ever need to format the PC, do I ever risk losing the module? or is it always within my Foundry VTT account?
It exists only on your PC.
ok, so file/folder back up is a must
thank you very much for this Zhell
I have a lot more questions, but I'll focus on completing this portion and will bring the other questions at a later time ๐
You dont want help fixing the linking after all?
No, I said this was the first step.
Great.
Q: Does your world contain any compendiums that are not related to this? (Ignoring system or module compendiums.)
I cleared all the modules in order to avoid confusions.
I have the SRD, the Compendium I've created and the module I want to move the compendium I created to.
๐
While I type, make a backup:
- Shut down foundry entirely.
- Make a copy of your module somewhere.
- Boot foundry back up and enter the world.
I will also need a mapping of compendium keys.
This macro will post to chat the compendium key of the compendium that you open immediately after running it:
Hooks.once('renderCompendium', (app) => ChatMessage.create({content: app.collection.collection}))
I need to explicitly know, e.g., the key of the old vs new classes pack, old vs new features pack, etc.
Was setting up the model exactly the same way as the compendium in the world
now, question, where do I place the macro lines you sent me?
In a macro.
Sorry Zhell, but I'm too much of a noob with this things xD
I need a bit more guidance on how to make a macro
you just click an empty spot
Anyway, once you have gotten all those, copy and paste them into this new macro.
It should hopefully be obvious what are just placeholders.
const keys = {
"old key goes here": "new pack's key goes here",
"other old key": "other new key",
"...": "..."
};
/* ------------------------- */
for (const key of Object.values(keys)) {
const newPack = game.packs.get(key);
const docs = await newPack.getDocuments();
for (const doc of docs) {
try {
let data = doc.toObject();
data = JSON.stringify(data);
for (const [k, v] of Object.entries(keys)) {
data = data.replaceAll(k, v);
}
data = JSON.parse(data);
await doc.update(data, {diff: false, recursive: false});
} catch(err) {
console.warn(`Failed to update item: "${doc.uuid}"`);
}
}
}
ui.notifications.info("Relinking complete.");
down here?
Yes that is the macro hotbar.
sorry about the dumb questions
I'll get there though
so, right now, should I paste the first or the second macro you sent?
No worries. I'm off now tho, but the rest of the steps are outlined above. If there's anything else I can answer questions tomorrow
its late here
Hey @long plover , Thursday you had to leave, and to be honest I could not really understand how to make these macros work ๐ฆ
any chance you have the time today, or should we leave it for another time?
I have done the mapping of the compendiums, but get this error when trying to save the second macro...
so the mapping would be like this:
"old key goes here": "new pack's key goes here",
world.backgrounds-2014: rates-compendiums.backgrounds,
world.classes-2014: rates-compendiums.classes,
world.class-and-subclass-features-2014: rates-compendiums.classes-and-sub-classes-features,
world.feats: rates-compendiums.feats-2014,
world.races-2014: rates-compendiums.races-2014,
world.subclasses-2014: rates-compendiums.sub-classes,
world.items-2014: rates-compendiums.items-2014,
world.spell-items-2014: rates-compendiums.spell-items-2014,
world.spell-list: rates-compendiums.spell-lists,
world.spells-2014: rates-compendiums.spells,
world.trade-goods-2014: rates-compendiums.trade-goods-2014,
world.tables-2014: rates-compendiums.tables-2014,
@long plover when you have the chance to answer I'll try to take actions as soon as possible and give you feedback on the result ๐
const keys = {
"world.backgrounds-2014": "rates-compendiums.backgrounds",
"world.classes-2014": "rates-compendiums.classes",
"world.class-and-subclass-features-2014": "rates-compendiums.classes-and-sub-classes-features",
"world.feats": "rates-compendiums.feats-2014",
"world.races-2014": "rates-compendiums.races-2014",
"world.subclasses-2014": "rates-compendiums.sub-classes",
"world.items-2014": "rates-compendiums.items-2014",
"world.spell-items-2014": "rates-compendiums.spell-items-2014",
"world.spell-list": "rates-compendiums.spell-lists",
"world.spells-2014": "rates-compendiums.spells",
"world.trade-goods-2014": "rates-compendiums.trade-goods-2014",
"world.tables-2014": "rates-compendiums.tables-2014",
};
/* ------------------------- */
ui.notifications.info("Linking...", {permanent: true});
for (const key of Object.values(keys)) {
const newPack = game.packs.get(key);
const docs = await newPack.getDocuments();
for (const doc of docs) {
try {
let data = doc.toObject();
data = JSON.stringify(data);
for (const [k, v] of Object.entries(keys)) {
data = data.replaceAll(k, v);
}
data = JSON.parse(data);
await doc.update(data, {diff: false, recursive: false});
} catch(err) {
console.warn(`Failed to update item: "${doc.uuid}"`);
}
}
}
ui.notifications.clear();
ui.notifications.info("Linking complete!", {permanent: true});
I guess I was getting the error because of a missing ",", now it's linking
That was quick.
yeah, I was expecting loner as well
OK. Check if the advancements look fine?
Advancements are still showing from the SRD
Oh well. Have to do it the right way then.
although all the other stuff is linking to the compendium module
that's something, I guess ๐
rollable tables as well as items I've placed in descriptions, have been changed to the ones in the new module
const keys = {
"world.backgrounds-2014": "rates-compendiums.backgrounds",
"world.classes-2014": "rates-compendiums.classes",
"world.class-and-subclass-features-2014": "rates-compendiums.classes-and-sub-classes-features",
"world.feats": "rates-compendiums.feats-2014",
"world.races-2014": "rates-compendiums.races-2014",
"world.subclasses-2014": "rates-compendiums.sub-classes",
"world.items-2014": "rates-compendiums.items-2014",
"world.spell-items-2014": "rates-compendiums.spell-items-2014",
"world.spell-list": "rates-compendiums.spell-lists",
"world.spells-2014": "rates-compendiums.spells",
"world.trade-goods-2014": "rates-compendiums.trade-goods-2014",
"world.tables-2014": "rates-compendiums.tables-2014",
};
/* ------------------------- */
ui.notifications.info("Linking...", {permanent: true});
const repl = (str) => {
for (const [k, v] of Object.entries(keys)) str = str.replaceAll(k, v);
return str;
};
for (const key of Object.values(keys)) {
const newPack = game.packs.get(key);
const docs = await newPack.getDocuments();
for (const doc of docs) {
const {ItemGrant=[], ItemChoice=[]} = doc.advancement?.byType ?? {};
for (const i of ItemGrant ?? []) {
const items = i.configuration.items.map(item => ({uuid: repl(item.uuid), optional: item.optional ?? false}));
await doc.updateAdvancement(i.id, {configuration: {items: items}});
}
for (const c of ItemChoice ?? []) {
const items = c.configuration.pool.map(item => ({uuid: repl(item.uuid)}));
await doc.updateAdvancement(c.id, {configuration: {pool: items}});
}
}
}
ui.notifications.clear();
ui.notifications.info("Linking complete!", {permanent: true});
oh hold on
there
did not see the message coming in, so still didn't do anything ๐
(fixed another typo)
Typo. Fixed.
I've installed Foundry about 1 month ago, a bit more maybe, but not too much
I am working on V12 since the beginning
I can do the advancements manually though
I going to rip my eye lashes out if I had to do all the descrioption item links though ๐
Yeah not sure why these point to non-existing items, sorry. Both of the methods tried worked fine on my end
I think I understand why though
I went the lazy way in the beginning and copied all the SRD data to my compendium and started working from my world compendium after that
seems that only classes and subclasses that came from the SRD, haven't moved the item links
all the others have
you helped me cut a lot of correction time already
thank you @long plover
Ah. So everything is in fact re-linked. Good!
You're amazing, thank you very much
I gues deleting the world compendium will not be an issue right?
It should not be an issue.
Besides, you made a backup.
You can also test that everything is correct by making a new world with only your module active. If things still look right, then the old world compendiums are no longer relevant.
Though note that if you have an ongoing game right now, you may want to replace the items on any characters.
no game ongoing
No issue then!
I am preparing everything for my first game in Foundry ๐