Import wrath-and-glory-gk-0.2.0.zip do wg-greyknights (2025-08-21T20:12:55Z)

This commit is contained in:
2025-08-21 20:12:55 +00:00
parent 24ad39dc6f
commit b4ee703fdc
14 changed files with 208 additions and 43 deletions
@@ -0,0 +1,20 @@
// Auto loadout on archetype creation (hook Actor creation)
Hooks.on("createActor", async (actor, options, userId) => {
try {
const arch = actor.items.find(i => i.type === "archetype" && i.name?.includes("Grey Knight"));
if (!arch) return;
const names = ["Nemesis Force Halberd","Aegis Power Armour","Grey Knight Armour Integrated Storm Bolter","Aegis of Titan"];
const toAdd = [];
for (const n of names) {
const packItem = game.items.getName?.(n);
if (packItem) toAdd.push(packItem.toObject());
else {
// fallback: create minimal items
toAdd.push({name:n, type: n.includes("Armour") ? "armor" : (n.includes("Bolter") ? "weapon" : "ability"), img:"icons/svg/placeholder.svg", system:{}});
}
}
await actor.createEmbeddedDocuments("Item", toAdd);
} catch(e) {
console.error(e);
}
});