From cf7c469655ff5d5f32812a98686709aad978fc78 Mon Sep 17 00:00:00 2001 From: Michal Tuszowski Date: Thu, 21 Aug 2025 21:19:36 +0000 Subject: [PATCH] Import gk-greyknight-0.4.2-patch.zip do wg-greyknights (2025-08-21T21:19:36Z) --- .../module.json.patch.json | 5 ++ .../packs/gk-items.db | 2 +- .../scripts/auto-loadout.js | 68 +++++++++++++++++++ wg-greyknights/scripts/auto-loadout.js | 48 ------------- 4 files changed, 74 insertions(+), 49 deletions(-) create mode 100644 wg-greyknights/gk-greyknight-0.4.2-patch/module.json.patch.json rename wg-greyknights/{ => gk-greyknight-0.4.2-patch}/packs/gk-items.db (87%) create mode 100644 wg-greyknights/gk-greyknight-0.4.2-patch/scripts/auto-loadout.js delete mode 100644 wg-greyknights/scripts/auto-loadout.js diff --git a/wg-greyknights/gk-greyknight-0.4.2-patch/module.json.patch.json b/wg-greyknights/gk-greyknight-0.4.2-patch/module.json.patch.json new file mode 100644 index 0000000..64234a9 --- /dev/null +++ b/wg-greyknights/gk-greyknight-0.4.2-patch/module.json.patch.json @@ -0,0 +1,5 @@ +{ + "esmodules": [ + "scripts/auto-loadout.js" + ] +} \ No newline at end of file diff --git a/wg-greyknights/packs/gk-items.db b/wg-greyknights/gk-greyknight-0.4.2-patch/packs/gk-items.db similarity index 87% rename from wg-greyknights/packs/gk-items.db rename to wg-greyknights/gk-greyknight-0.4.2-patch/packs/gk-items.db index cb634fe..4e0062b 100644 --- a/wg-greyknights/packs/gk-items.db +++ b/wg-greyknights/gk-greyknight-0.4.2-patch/packs/gk-items.db @@ -1,6 +1,6 @@ {"name": "Aegis of Titan (Ability)", "type": "ability", "img": "icons/svg/aura.svg", "_id": "DaEMUDPe8wmrWz70", "effects": [{"_id": "WD4ApIMZ3pnaPDtl", "name": "Aegis of Titan — Innate Purity", "icon": "icons/svg/aura.svg", "origin": "", "disabled": false, "duration": {"startTime": null}, "changes": [{"key": "system.combat.resolve.bonus", "mode": 2, "value": 1, "priority": 20}], "transfer": true, "flags": {}}, {"_id": "OybEJ8Tl1hRkI5zJ", "name": "Aegis of Titan — Aegis Synergy", "icon": "icons/svg/upgrade.svg", "origin": "", "disabled": true, "duration": {"startTime": null}, "changes": [{"key": "system.combat.resolve.bonus", "mode": 2, "value": 1, "priority": 20}], "transfer": true, "flags": {}}], "flags": {"core": {}}, "folder": null, "system": {"description": "Innate purity (+1 vs Corruption). While equipped with Aegis armour, enable Synergy for an additional +1 vs Corruption.", "keywords": "IMPERIUM, ADEPTUS ASTARTES, GREY KNIGHTS, INQUISITION, DAEMONHUNTERS, ORDO MALLEUS"}, "_stats": {"coreVersion": "13.347", "systemId": "wrath-and-glory", "systemVersion": "7.1.1"}} {"name": "Aegis Power Armour", "type": "armour", "img": "icons/svg/shield.svg", "effects": [{"_id": "25aqxUBwyQtSAdxb", "name": "Aegis Wards (Constant)", "icon": "icons/svg/aura.svg", "origin": "", "disabled": false, "duration": {"startTime": null}, "changes": [{"key": "system.skills.psychicMastery.bonus", "mode": 2, "value": 1, "priority": 20}, {"key": "system.combat.resolve.bonus", "mode": 2, "value": 1, "priority": 20}], "tint": null, "transfer": true, "flags": {}}, {"_id": "LfRNsXknme6JLgSC", "name": "Aegis Warding Runes (Toggle)", "icon": "icons/svg/explosion.svg", "origin": "", "disabled": true, "duration": {"startTime": null}, "changes": [{"key": "system.combat.resilience.bonus", "mode": 2, "value": 1, "priority": 20}, {"key": "system.combat.defence.bonus", "mode": 2, "value": -1, "priority": 20}], "tint": null, "transfer": true, "flags": {}}], "flags": {"wng-core": {"initialization-folder": "Armour", "sort": 0}, "core": {}}, "system": {"quantity": 1, "rarity": "veryRare", "description": "

Grey Knights sanctified power armour with hexagrammic wards and storm bolter forearm mount.

", "value": 9, "keywords": "POWERED, IMPERIUM, ADEPTUS ASTARTES, GREY KNIGHTS, INQUISITION, DAEMONHUNTERS, ORDO MALLEUS", "equipped": false, "rating": 5, "base": 0, "traits": {"list": [{"name": "powered", "rating": "3"}]}, "invulnerable": false}, "_stats": {"coreVersion": "13.347", "systemId": "wrath-and-glory", "systemVersion": "7.1.1", "createdTime": 1755779886550, "modifiedTime": 1755779886550, "lastModifiedBy": "8fThFXcxV83JCCcX", "exportSource": {"worldId": "gilead-wandg", "uuid": "Item.sTGTpOfbIveLcFul", "coreVersion": "13.347", "systemId": "wrath-and-glory", "systemVersion": "7.1.1"}}, "folder": "K59Lb8PvaCmIrviu", "_id": "11NZTwYXPlHBlnXC"} {"name": "Grey Knight (Archetype)", "type": "archetype", "img": "icons/svg/book.svg", "effects": [{"_id": "uMkkBfS2rRXluXA6", "name": "Aegis of Titan — Innate Purity", "icon": "icons/svg/aura.svg", "origin": "", "disabled": false, "duration": {"startTime": null}, "changes": [{"key": "system.combat.resolve.bonus", "mode": 2, "value": 1, "priority": 20}], "transfer": true, "flags": {}}], "flags": {"wng-forsaken": {"initialization-folder": "Archetypes", "sort": 0}, "core": {}}, "system": {"tier": 4, "journal": "DMmW708Q5AQvQfuy", "species": {"name": "Adeptus Astartes", "id": "KpwHo0A92bR7iVMB"}, "faction": {"name": "Adeptus Astartes", "id": "CN5E9Z5GqfiR1MDn"}, "influence": 2, "cost": 359, "keywords": ["IMPERIUM", "ADEPTUS ASTARTES", "GREY KNIGHTS", "INQUISITION", "DAEMONHUNTERS", "ORDO MALLEUS"], "attributes": {"strength": 5, "toughness": 5, "agility": 5, "initiative": 5, "willpower": 6, "intellect": 3, "fellowship": null}, "skills": {"athletics": 3, "awareness": 3, "ballisticSkill": 5, "cunning": null, "deception": null, "insight": null, "intimidation": null, "investigation": null, "leadership": null, "medicae": null, "persuasion": null, "pilot": null, "psychicMastery": 4, "scholar": 2, "stealth": 3, "survival": 1, "tech": null, "weaponSkill": 5}, "ability": {"id": "", "name": "Aegis of Titan", "description": "Innate Purity: +1 vs Corruption. Aegis Synergy: +1 vs Corruption while equipped with Aegis armour. Re-roll 1 die on Deny the Witch each round."}, "wargear": {"structure": {"type": "and", "groupId": "root", "id": "root", "options": [{"type": "option", "index": 0, "groupId": "cj0fha0grf41pcv4", "id": "cj0fha0grf41pcv4"}, {"type": "option", "index": 1, "groupId": "a89wca5qifs6kga9", "id": "a89wca5qifs6kga9"}, {"type": "option", "index": 2, "groupId": "7za8qa72jedhuct9", "id": "7za8qa72jedhuct9"}, {"type": "option", "index": 3, "groupId": "q3jc5brs0mr50azx", "id": "q3jc5brs0mr50azx"}, {"type": "option", "index": 4, "groupId": "lz6z45ef5goceln6", "id": "lz6z45ef5goceln6"}, {"type": "option", "index": 5, "groupId": "xuev8a8qyfhywpzn", "id": "xuev8a8qyfhywpzn"}]}, "options": [{"name": "Mk VII Astartes Power Armour", "type": "item", "id": "cj0fha0grf41pcv4", "diff": {"name": "Mk VII Astartes Power Armour"}, "documentId": "7Bp1rDIfKEB2MB9N", "idType": "id", "filters": []}, {"name": "Psychic Hood", "type": "item", "id": "a89wca5qifs6kga9", "diff": {"name": "Psychic Hood"}, "documentId": "qKIlaAhu9RZ63l1N", "idType": "id", "filters": []}, {"name": "Bolt Pistol", "type": "item", "id": "7za8qa72jedhuct9", "diff": {"name": "Bolt Pistol"}, "documentId": "7b2xcPWBB7up65PM", "idType": "id", "filters": []}, {"name": "Force Stave", "type": "item", "id": "q3jc5brs0mr50azx", "diff": {"name": "Force Stave"}, "documentId": "9vfkaU0vc61t7hKO", "idType": "id", "filters": []}, {"name": "Frag Grenades", "type": "item", "id": "lz6z45ef5goceln6", "diff": {"name": "Frag Grenades", "data": {"quantity": 3}}, "documentId": "oDG9YpSKSiSUFLIY", "idType": "id", "filters": []}, {"name": "Krak Grenades", "type": "item", "id": "xuev8a8qyfhywpzn", "diff": {"name": "Krak Grenades", "data": {"quantity": 3}}, "documentId": "SJ8UaYHEMtF71W1M", "idType": "id", "filters": []}], "freeItems": [{"id": "", "name": "Nemesis Force Halberd"}, {"id": "", "name": "Aegis Power Armour"}, {"id": "", "name": "Grey Knight Armour Integrated Storm Bolter"}, {"id": "", "name": "Aegis of Titan (Ability)"}, {"id": "", "name": "Frag Grenade"}, {"id": "", "name": "Krak Grenade"}, {"id": "", "name": "Trinket (Chapter Relic Shard)"}]}, "suggested": {"attributes": {"strength": null, "toughness": null, "agility": null, "initiative": null, "willpower": null, "intellect": null, "fellowship": null}, "skills": {"athletics": null, "awareness": null, "ballisticSkill": null, "cunning": null, "deception": null, "insight": null, "intimidation": null, "investigation": null, "leadership": null, "medicae": null, "persuasion": null, "pilot": null, "psychicMastery": null, "scholar": null, "stealth": null, "survival": null, "tech": null, "weaponSkill": null}, "talents": {"list": []}}}, "_stats": {"coreVersion": "13.347", "systemId": "wrath-and-glory", "systemVersion": "7.1.1", "createdTime": 1755771384639, "modifiedTime": 1755771384639, "lastModifiedBy": "8fThFXcxV83JCCcX", "exportSource": {"worldId": "gilead-wandg", "uuid": "Item.TCmE7YmUDUVQ3xoz", "coreVersion": "13.347", "systemId": "wrath-and-glory", "systemVersion": "7.1.1"}}, "folder": "DEb55m6iVZ0NUOxA", "_id": "qSv5JzFRjTYdw1zI"} -{"name": "Grey Knight Armour Integrated Storm Bolter", "type": "weapon", "img": "icons/svg/gun.svg", "effects": [], "flags": {"wng-core": {"initialization-folder": "Weapons", "sort": 0}, "core": {}}, "system": {"quantity": 1, "rarity": "rare", "description": "

Integrated forearm storm bolter. Integrated: does not occupy hands; may fire while wielding two‑handed melee. Treat as Pistol for firing in melee.

", "value": 4, "keywords": "BOLT, INTEGRATED, IMPERIUM, ADEPTUS ASTARTES, GREY KNIGHTS, INQUISITION, DAEMONHUNTERS, ORDO MALLEUS", "equipped": false, "attack": {"base": 0, "bonus": 0, "rank": "none"}, "damage": {"base": 10, "bonus": 0, "rank": 0, "ed": {"base": 2, "bonus": 0, "rank": 0}, "ap": {"base": 0, "bonus": 0, "rank": 0}, "enabled": false, "otherDamage": {"mortal": "0", "wounds": "0", "shock": "0"}}, "ed": {"base": 0, "bonus": 0, "rank": 0}, "ap": {"base": 0, "bonus": 0, "rank": 0}, "category": "ranged", "range": {"short": 12, "medium": 24, "long": 36, "melee": 1, "thrown": null}, "ammo": {"id": ""}, "salvo": 1, "traits": {"list": [{"name": "brutal"}, {"name": "pistol"}, {"name": "rapidFire", "rating": "2"}]}, "upgrades": [], "otherDamage": {}, "combi": {}, "twinned": false}, "_stats": {"coreVersion": "13.347", "systemId": "wrath-and-glory", "systemVersion": "7.1.1", "createdTime": 1755779945407, "modifiedTime": 1755779945407, "lastModifiedBy": "8fThFXcxV83JCCcX", "exportSource": {"worldId": "gilead-wandg", "uuid": "Item.Seza6hxnXhHInk8m", "coreVersion": "13.347", "systemId": "wrath-and-glory", "systemVersion": "7.1.1"}}, "folder": "85dkcvhBYli5TJrZ", "_id": "SDFwequVtp6WsCFj"} +{"name": "Grey Knight Armour Integrated Storm Bolter", "type": "weapon", "img": "icons/svg/dice-target.svg", "effects": [], "flags": {"wng-core": {"initialization-folder": "Weapons", "sort": 0}, "core": {}}, "system": {"quantity": 1, "rarity": "rare", "description": "

Integrated forearm storm bolter. Integrated: does not occupy hands; may fire while wielding two‑handed melee. Treat as Pistol for firing in melee.

", "value": 4, "keywords": "BOLT, INTEGRATED, IMPERIUM, ADEPTUS ASTARTES, GREY KNIGHTS, INQUISITION, DAEMONHUNTERS, ORDO MALLEUS", "equipped": false, "attack": {"base": 0, "bonus": 0, "rank": "none"}, "damage": {"base": 10, "bonus": 0, "rank": 0, "ed": {"base": 2, "bonus": 0, "rank": 0}, "ap": {"base": 0, "bonus": 0, "rank": 0}, "enabled": false, "otherDamage": {"mortal": "0", "wounds": "0", "shock": "0"}}, "ed": {"base": 0, "bonus": 0, "rank": 0}, "ap": {"base": 0, "bonus": 0, "rank": 0}, "category": "ranged", "range": {"short": 12, "medium": 24, "long": 36, "melee": 1, "thrown": null}, "ammo": {"id": ""}, "salvo": 1, "traits": {"list": [{"name": "brutal"}, {"name": "pistol"}, {"name": "rapidFire", "rating": "2"}]}, "upgrades": [], "otherDamage": {}, "combi": {}, "twinned": false}, "_stats": {"coreVersion": "13.347", "systemId": "wrath-and-glory", "systemVersion": "7.1.1", "createdTime": 1755779945407, "modifiedTime": 1755779945407, "lastModifiedBy": "8fThFXcxV83JCCcX", "exportSource": {"worldId": "gilead-wandg", "uuid": "Item.Seza6hxnXhHInk8m", "coreVersion": "13.347", "systemId": "wrath-and-glory", "systemVersion": "7.1.1"}}, "folder": "85dkcvhBYli5TJrZ", "_id": "SDFwequVtp6WsCFj"} {"name": "Nemesis Force Halberd", "type": "weapon", "img": "icons/svg/sword.svg", "effects": [], "flags": {"wng-core": {"initialization-folder": "Weapons", "sort": 0}, "core": {}}, "system": {"quantity": 1, "rarity": "uncommon", "description": "Force Staves are laced with a complex psy-matrix that allows them to act as a psychic battery, storing psychic energy that can be released with brutal efficiency.

Nemesis: vs DAEMON/PSYKER: +1 ED (homebrew). Two‑Handed.

", "value": 2, "keywords": "IMPERIUM, ADEPTUS ASTARTES, GREY KNIGHTS, INQUISITION, DAEMONHUNTERS, ORDO MALLEUS, MELEE, FORCE", "equipped": false, "attack": {"base": 0, "bonus": 0, "rank": "none"}, "damage": {"base": 4, "bonus": 0, "rank": 0, "ap": {"base": -1, "bonus": 0, "rank": 0}, "ed": {"base": 2, "bonus": 0, "rank": 0}, "enabled": false, "otherDamage": {"mortal": "0", "wounds": "0", "shock": "0"}}, "ed": {"base": 0, "bonus": 0, "rank": 0}, "ap": {"base": 0, "bonus": 0, "rank": 0}, "category": "melee", "range": {"short": 0, "medium": 0, "long": 0, "melee": 2, "thrown": null}, "ammo": {"id": ""}, "salvo": 0, "traits": {"list": [{"name": "brutal"}, {"name": "force"}, {"name": "twoHanded"}]}, "upgrades": [], "otherDamage": {}, "combi": {}, "twinned": false}, "_stats": {"coreVersion": "13.347", "systemId": "wrath-and-glory", "systemVersion": "7.1.1", "createdTime": 1755779931196, "modifiedTime": 1755779931196, "lastModifiedBy": "8fThFXcxV83JCCcX", "exportSource": {"worldId": "gilead-wandg", "uuid": "Item.9vfkaU0vc61t7hKO", "coreVersion": "13.347", "systemId": "wrath-and-glory", "systemVersion": "7.1.1"}}, "folder": "85dkcvhBYli5TJrZ", "_id": "NX6bWADcIa03iGCK"} {"name": "Terminator Aegis (Grey Knights)", "type": "armour", "img": "icons/svg/tower.svg", "effects": [{"_id": "OvE7cPAtNLDdEj6j", "name": "Aegis Wards (Constant)", "icon": "icons/svg/aura.svg", "origin": "", "disabled": false, "duration": {"startTime": null}, "changes": [{"key": "system.skills.psychicMastery.bonus", "mode": 2, "value": 1, "priority": 20}, {"key": "system.combat.resolve.bonus", "mode": 2, "value": 1, "priority": 20}], "tint": null, "transfer": true, "flags": {}}, {"_id": "RXHERg7YjunnEQ8h", "name": "Aegis Warding Runes (Toggle)", "icon": "icons/svg/explosion.svg", "origin": "", "disabled": true, "duration": {"startTime": null}, "changes": [{"key": "system.combat.resilience.bonus", "mode": 2, "value": 1, "priority": 20}, {"key": "system.combat.defence.bonus", "mode": 2, "value": -1, "priority": 20}], "tint": null, "transfer": true, "flags": {}}], "flags": {"wng-core": {"initialization-folder": "Armour", "sort": 0}, "core": {}}, "system": {"quantity": 1, "rarity": "artifact", "description": "

Grey Knights Tactical Dreadnought armour with Aegis wards and storm bolter hard‑mount.

", "value": 10, "keywords": "POWERED, IMPERIUM, ADEPTUS ASTARTES, GREY KNIGHTS, INQUISITION, DAEMONHUNTERS, ORDO MALLEUS", "equipped": false, "rating": 7, "base": 0, "traits": {"list": [{"name": "cumbersome"}, {"name": "powered", "rating": "4"}]}, "invulnerable": false}, "_stats": {"coreVersion": "13.347", "systemId": "wrath-and-glory", "systemVersion": "7.1.1", "createdTime": 1755779886550, "modifiedTime": 1755779886550, "lastModifiedBy": "8fThFXcxV83JCCcX", "exportSource": {"worldId": "gilead-wandg", "uuid": "Item.sTGTpOfbIveLcFul", "coreVersion": "13.347", "systemId": "wrath-and-glory", "systemVersion": "7.1.1"}}, "folder": "K59Lb8PvaCmIrviu", "_id": "9XTvCiJElW4LJij9"} diff --git a/wg-greyknights/gk-greyknight-0.4.2-patch/scripts/auto-loadout.js b/wg-greyknights/gk-greyknight-0.4.2-patch/scripts/auto-loadout.js new file mode 100644 index 0000000..790704b --- /dev/null +++ b/wg-greyknights/gk-greyknight-0.4.2-patch/scripts/auto-loadout.js @@ -0,0 +1,68 @@ +// gk-greyknight — auto-attach loadout on Grey Knight Archetype +Hooks.once("ready", () => { + const PACK_KEY = "gk-greyknight.gk-items"; // moduleId.packName + const NAMES = [ + "Aegis of Titan (Ability)", + "Nemesis Force Halberd", + "Grey Knight Armour Integrated Storm Bolter", + "Aegis Power Armour" + ]; + + async function fetchFromCompendium(name) { + const pack = game.packs.get(PACK_KEY); + if (!pack) return null; + const index = await pack.getIndex(); + const hit = index.find(e => e.name === name); + if (!hit) return null; + const doc = await pack.getDocument(hit._id); + return doc?.toObject(); + } + + async function ensureOnActor(actor, name, equip=false) { + const have = actor.items.getName(name); + if (have) return have; + let src = await fetchFromCompendium(name); + if (!src) { + // fallback: look in world items directory + const world = game.items.getName(name); + if (world) src = world.toObject(); + } + if (!src) return null; + // set equipped if item supports it + if (equip && src.system && typeof src.system.equipped !== "undefined") { + src.system.equipped = true; + } + const created = await actor.createEmbeddedDocuments("Item", [src]); + return created[0]; + } + + // Hook: when the Grey Knight Archetype is added to an actor + Hooks.on("createItem", async (item, opts, userId) => { + try { + if (item?.type !== "archetype") return; + if (item?.name !== "Grey Knight (Archetype)") return; + const actor = item.parent; + if (!actor || game.userId !== userId) return; + + // Attach base loadout (War-Plate default) + ability + await ensureOnActor(actor, "Aegis of Titan (Ability)", false); + await ensureOnActor(actor, "Nemesis Force Halberd", true); + await ensureOnActor(actor, "Grey Knight Armour Integrated Storm Bolter", true); + await ensureOnActor(actor, "Aegis Power Armour", true); + + // Optional: enable Aegis Synergy effect if present and Aegis is equipped + const abil = actor.items.getName("Aegis of Titan (Ability)"); + const aegis = actor.items.getName("Aegis Power Armour"); + const hasAegis = !!(aegis?.system?.equipped); + if (abil && abil.effects) { + for (const ef of abil.effects) { + if (ef.name?.toLowerCase().includes("synergy")) await ef.update({disabled: !hasAegis}); + } + } + + ui.notifications.info("Grey Knight loadout attached."); + } catch (e) { + console.error("gk-greyknight auto-loadout error:", e); + } + }); +}); diff --git a/wg-greyknights/scripts/auto-loadout.js b/wg-greyknights/scripts/auto-loadout.js deleted file mode 100644 index 3fa31cc..0000000 --- a/wg-greyknights/scripts/auto-loadout.js +++ /dev/null @@ -1,48 +0,0 @@ -// gk-greyknight — auto hooks + small tools menu -Hooks.once("ready", () => { - // Hook: when our Archetype is added, open Loadout Manager - if (!window._gkAutoLoadoutHook) { - window._gkAutoLoadoutHook = Hooks.on("createItem", async (item, opts, userId) => { - try { - if (item?.type !== "archetype") return; - if (item?.name !== "Grey Knight (Archetype)") return; - const actor = item.parent; - if (!actor || game.userId !== userId) return; - const code = await (await fetch("/modules/gk-greyknight/scripts/macros/gk-loadout-manager.js")).text(); - (0, eval)(code); - } catch (e) { console.error("gk-greyknight auto-loadout error", e); } - }); - } - - game.settings.registerMenu("gk-greyknight", "tools", { - name: "Grey Knight Tools", - label: "Open Tools", - icon: "fas fa-shield-alt", - type: class extends FormApplication { - async _updateObject(event, formData) {} - static get defaultOptions(){ return foundry.utils.mergeObject(super.defaultOptions, { id:"gk-tools", title:"Grey Knight Tools", template: null}); } - async render(...args){ - new Dialog({ - title: "Grey Knight Tools", - content: `

Quick actions for GK content.

`, - buttons: { - import: {label:"Import Items from Module", icon:"", callback: async ()=>{ - const code = await (await fetch("/modules/gk-greyknight/scripts/macros/gk-import-from-module.js")).text(); - (0, eval)(code); - }}, - loadout: {label:"Open Loadout Manager", icon:"", callback: async ()=>{ - const code = await (await fetch("/modules/gk-greyknight/scripts/macros/gk-loadout-manager.js")).text(); - (0, eval)(code); - }}, - glow: {label:"Toggle Aegis Glow", icon:"", callback: async ()=>{ - const code = await (await fetch("/modules/gk-greyknight/scripts/macros/gk-glow-toggle.js")).text(); - (0, eval)(code); - }} - }, - default: "import" - }).render(true); - } - }, - restricted: true - }); -}); \ No newline at end of file