From 5fcdc8d2f30c1b624b1db3fad037dc4c26765096 Mon Sep 17 00:00:00 2001 From: Michal Tuszowski Date: Thu, 21 Aug 2025 22:05:46 +0000 Subject: [PATCH] Import gk-greyknight-0.4.5-patch.zip do wg-greyknights (2025-08-21T22:05:46Z) --- .../packs/gk-items.db | 1 + .../scripts/auto-loadout.js | 40 ++++++++++++------- 2 files changed, 27 insertions(+), 14 deletions(-) rename wg-greyknights/{gk-greyknight-0.4.3-patch => gk-greyknight-0.4.5-patch}/packs/gk-items.db (87%) rename wg-greyknights/{gk-greyknight-0.4.4-patch => gk-greyknight-0.4.5-patch}/scripts/auto-loadout.js (78%) diff --git a/wg-greyknights/gk-greyknight-0.4.3-patch/packs/gk-items.db b/wg-greyknights/gk-greyknight-0.4.5-patch/packs/gk-items.db similarity index 87% rename from wg-greyknights/gk-greyknight-0.4.3-patch/packs/gk-items.db rename to wg-greyknights/gk-greyknight-0.4.5-patch/packs/gk-items.db index 0e14b63..28a7f69 100644 --- a/wg-greyknights/gk-greyknight-0.4.3-patch/packs/gk-items.db +++ b/wg-greyknights/gk-greyknight-0.4.5-patch/packs/gk-items.db @@ -4,3 +4,4 @@ {"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": "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": "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"} +{"name": "Pilgrim Astartes Power Armor", "type": "armour", "img": "modules/wng-core/assets/icons/armour/terminator-armour.webp", "effects": [{"_id": "44rACWx99MiXXe4E", "name": "Pilgrim Disguise Penalties", "icon": "icons/svg/downgrade.svg", "origin": "", "disabled": false, "duration": {"startTime": null, "seconds": null, "turns": null, "startRound": null, "startTurn": null}, "changes": [{"key": "system.attributes.agility.bonus", "mode": 2, "value": -1, "priority": 20}, {"key": "system.skills.stealth.bonus", "mode": 2, "value": -1, "priority": 20}, {"key": "system.combat.speed", "mode": 2, "value": -1, "priority": 20}], "tint": null, "transfer": true, "flags": {}}], "flags": {"wng-core": {"initialization-folder": "Armour", "sort": 0}, "core": {}}, "system": {"quantity": 1, "rarity": "rare", "description": "

Scavenged Black Templars plate, patched & lightened. Designed for incognito operations.

", "value": 6, "keywords": "POWERED, IMPERIUM, ADEPTUS ASTARTES, BLACK TEMPLARS (DISGUISE)", "equipped": true, "rating": 4, "base": 0, "traits": {"list": [{"name": "cumbersome"}, {"name": "powered", "rating": "1"}]}, "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": "2P2HioialQdFUCv6"} diff --git a/wg-greyknights/gk-greyknight-0.4.4-patch/scripts/auto-loadout.js b/wg-greyknights/gk-greyknight-0.4.5-patch/scripts/auto-loadout.js similarity index 78% rename from wg-greyknights/gk-greyknight-0.4.4-patch/scripts/auto-loadout.js rename to wg-greyknights/gk-greyknight-0.4.5-patch/scripts/auto-loadout.js index fd4ca28..3b1335c 100644 --- a/wg-greyknights/gk-greyknight-0.4.4-patch/scripts/auto-loadout.js +++ b/wg-greyknights/gk-greyknight-0.4.5-patch/scripts/auto-loadout.js @@ -1,13 +1,14 @@ -// gk-greyknight — auto-attach loadout with clear choices +// gk-greyknight — auto-attach loadout (deduped) v0.4.5 Hooks.once("ready", () => { const PACK_KEY = "gk-greyknight.gk-items"; // moduleId.packName const ITEMS = { - ability: "Aegis of Titan (Ability)", - nemesis: "Nemesis Force Halberd", - storm: "Grey Knight Armour Integrated Storm Bolter", - aegisPA: "Aegis Power Armour", + ability: "Aegis of Titan (Ability)", + nemesis: "Nemesis Force Halberd", + storm: "Grey Knight Armour Integrated Storm Bolter", + aegisPA: "Aegis Power Armour", aegisTerm: "Terminator Aegis (Grey Knights)" }; + const FLAG_SCOPE = "gk-greyknight"; const FLAG_DONE = "autoLoadoutDone"; async function fetchFromCompendium(name) { const pack = game.packs.get(PACK_KEY); @@ -36,14 +37,25 @@ Hooks.once("ready", () => { if (it && typeof it.system?.equipped !== "undefined") await it.update({"system.equipped": !!on}); } - Hooks.on("createItem", async (item, opts, userId) => { + // De-register old hook if present to avoid double dialogs + if (window._gkAutoLoadoutHookId) { + Hooks.off("createItem", window._gkAutoLoadoutHookId); + window._gkAutoLoadoutHookId = null; + } + + window._gkAutoLoadoutHookId = 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; + // Only the client that performed the creation + if (game.userId !== userId) return; + + const actor = item.parent; + if (!actor) return; + // Avoid duplicate prompts per actor + if (actor.getFlag(FLAG_SCOPE, FLAG_DONE)) return; + await actor.setFlag(FLAG_SCOPE, FLAG_DONE, true); - // Build labeled dialog (no more "Choice1 / Choice2") const content = `