#Compendium image replacement

1 messages ยท Page 1 of 1 (latest)

timber mirage
#
  • @frozen dawn
#

unfortunately, i can only thread from a single message, feel free to repost any context needed

lost scarab
#

@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 ๐Ÿ™‚

frozen dawn
#

they would be replaced with "Armor_icon.png"

#

same path for each

lost scarab
#

No change in path, just changing to upper-case A and ".png"?

#

(and underscore)

frozen dawn
#

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

lost scarab
#

Not webp?

frozen dawn
#

woos sorry yes webp

#

i was looking at my base files

lost scarab
#

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.

frozen dawn
#

ok

lost scarab
#

That would change the path - so I would need that. ๐Ÿ™‚

frozen dawn
#

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

lost scarab
#

That's good, so at worst this will do nothing, but I still want to get specifics. ๐Ÿ˜›

frozen dawn
#

i have meesed it up manytimes before so i learned.. ๐Ÿ™‚

lost scarab
#
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.