#Compendium image replacement
1 messages ยท Page 1 of 1 (latest)
- @frozen dawn
unfortunately, i can only thread from a single message, feel free to repost any context needed
@frozen dawn, so you got for example "modules/coriolis-corerules/images/icons/armor-icon.svg", what is the image path that should be replaced with?
Try doing it for one item so we can be sure (same as above).
And then for "modules/coriolis-ghazali/images/icons/armor-icon.svg" as well ๐
no sorry.. thats just my typing.. to be specific...
modules/coriolis-corerules/images/icons/armor-icon.png
modules/coriolis-ghazali/images/icons/armor-icon.png
Not webp?
Okay then, as long as the new images are in the same location, that should be fine, though I would recommend placing them somewhere outside the module's folder.
ok
That would change the path - so I would need that. ๐
and worry not about blowing stuff up.. i got backups of my endire foundry install core and data, whenever i work in it each day
That's good, so at worst this will do nothing, but I still want to get specifics. ๐
i have meesed it up manytimes before so i learned.. ๐
const key1 = "world.coriolis-items-local-gh";
const key2 = "world.coriolis-items-local-core";
const img1 = "modules/coriolis-corerules/images/icons/armor-icon.svg";
const img2 = "modules/coriolis-ghazali/images/icons/armor-icon.svg"
const imgNew1 = "modules/coriolis-corerules/images/icons/armor-icon.webp";
const imgNew2 = "modules/coriolis-ghazali/images/icons/armor-icon.webp";
/* ------- */
const pack1 = game.packs.get(key1);
const pack2 = game.packs.get(key2);
const docs1 = await pack.getDocuments();
const docs2 = await pack.getDocuments();
const updates1 = docs1.map(i => ({_id: i.id, img: i.data.img === img1 ? imgNew1 : i.data.img === img2 ? imgNew2 : i.data.img}));
const updates2 = docs2.map(i => ({_id: i.id, img: i.data.img === img1 ? imgNew1 : i.data.img === img2 ? imgNew2 : i.data.img}));
await Item.updateDocuments(updates1, {pack: key1});
await Item.updateDocuments(updates2, {pack: key2});
Make sure the two compendiums are unlocked. ๐
Click an empty slot on the hotbar to make a macro, set it to Script, paste this in the big text field, save it, and then run it.