From 2111d117e2a76f58bb8f49edd743c59536025607 Mon Sep 17 00:00:00 2001 From: Michal Tuszowski Date: Thu, 21 Aug 2025 22:23:55 +0000 Subject: [PATCH] Import gk-greyknight-0.4.6-patch.zip do wg-greyknights (2025-08-21T22:23:55Z) --- .../packs/gk-items.db | 2 +- .../scripts/auto-loadout.js | 43 ++++++++++--------- 2 files changed, 23 insertions(+), 22 deletions(-) rename wg-greyknights/{gk-greyknight-0.4.5-patch => gk-greyknight-0.4.6-patch}/packs/gk-items.db (79%) rename wg-greyknights/{gk-greyknight-0.4.5-patch => gk-greyknight-0.4.6-patch}/scripts/auto-loadout.js (76%) diff --git a/wg-greyknights/gk-greyknight-0.4.5-patch/packs/gk-items.db b/wg-greyknights/gk-greyknight-0.4.6-patch/packs/gk-items.db similarity index 79% rename from wg-greyknights/gk-greyknight-0.4.5-patch/packs/gk-items.db rename to wg-greyknights/gk-greyknight-0.4.6-patch/packs/gk-items.db index 28a7f69..b72c337 100644 --- a/wg-greyknights/gk-greyknight-0.4.5-patch/packs/gk-items.db +++ b/wg-greyknights/gk-greyknight-0.4.6-patch/packs/gk-items.db @@ -1,5 +1,5 @@ {"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": "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": "DaEMUDPe8wmrWz70", "name": "Aegis of Titan"}, "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 (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": "DaEMUDPe8wmrWz70", "name": "Aegis of Titan"}, "wargear": {"freeItems": []}, "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": "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": "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"} diff --git a/wg-greyknights/gk-greyknight-0.4.5-patch/scripts/auto-loadout.js b/wg-greyknights/gk-greyknight-0.4.6-patch/scripts/auto-loadout.js similarity index 76% rename from wg-greyknights/gk-greyknight-0.4.5-patch/scripts/auto-loadout.js rename to wg-greyknights/gk-greyknight-0.4.6-patch/scripts/auto-loadout.js index 3b1335c..69cb0fd 100644 --- a/wg-greyknights/gk-greyknight-0.4.5-patch/scripts/auto-loadout.js +++ b/wg-greyknights/gk-greyknight-0.4.6-patch/scripts/auto-loadout.js @@ -1,4 +1,4 @@ -// gk-greyknight — auto-attach loadout (deduped) v0.4.5 +// gk-greyknight — auto-attach loadout (dedupe + legacy scrub) v0.4.6 Hooks.once("ready", () => { const PACK_KEY = "gk-greyknight.gk-items"; // moduleId.packName const ITEMS = { @@ -10,6 +10,20 @@ Hooks.once("ready", () => { }; const FLAG_SCOPE = "gk-greyknight"; const FLAG_DONE = "autoLoadoutDone"; + // --- REMOVE legacy createItem handlers that emit 'Choice 1/2' or 'ORDO MALLEUS' dialogs --- + const removeLegacy = () => { + const list = (Hooks.events && Hooks.events.createItem) || Hooks._hooks?.createItem || []; + // copy to avoid mutating while iterating + const arr = Array.from(list); + for (const cb of arr) { + const src = (cb && cb.toString && cb.toString()) || ""; + if (/ORDO\s+MALLEUS/i.test(src) || /Choice\s*1/i.test(src) || /macro-gk-auto-loadout-on-archetype/i.test(src)) { + try { Hooks.off("createItem", cb); console.warn("gk-greyknight: removed legacy createItem hook"); } catch(e){} + } + } + }; + removeLegacy(); + async function fetchFromCompendium(name) { const pack = game.packs.get(PACK_KEY); if (!pack) return null; @@ -37,22 +51,16 @@ Hooks.once("ready", () => { if (it && typeof it.system?.equipped !== "undefined") await it.update({"system.equipped": !!on}); } - // De-register old hook if present to avoid double dialogs - if (window._gkAutoLoadoutHookId) { - Hooks.off("createItem", window._gkAutoLoadoutHookId); - window._gkAutoLoadoutHookId = null; - } + 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; - // Only the client that performed the creation - if (game.userId !== userId) return; + if (game.userId !== userId) return; // only the originating client + const actor = item.parent; if (!actor) return; - const actor = item.parent; - if (!actor) return; - // Avoid duplicate prompts per actor + // If a legacy dialog already fired very early, bail out to avoid double prompts if (actor.getFlag(FLAG_SCOPE, FLAG_DONE)) return; await actor.setFlag(FLAG_SCOPE, FLAG_DONE, true); @@ -99,22 +107,15 @@ Hooks.once("ready", () => { await ensureOnActor(actor, ITEMS.nemesis, choice!=="incog"); await ensureOnActor(actor, ITEMS.storm, choice!=="incog"); - // Clear both armours equipped await setEquipped(actor, ITEMS.aegisPA, false); await setEquipped(actor, ITEMS.aegisTerm, false); - if (choice === "war") { - await ensureOnActor(actor, ITEMS.aegisPA, true); - } else if (choice === "term") { - await ensureOnActor(actor, ITEMS.aegisTerm, true); - } + if (choice === "war") await ensureOnActor(actor, ITEMS.aegisPA, true); + else if (choice === "term") await ensureOnActor(actor, ITEMS.aegisTerm, true); - // Synergy toggle const abil = actor.items.getName(ITEMS.ability); const anyAegisOn = !!actor.items.find(i => ["armour","armor"].includes(i.type) && /Aegis/.test(i.name) && i.system?.equipped); - if (abil?.effects?.length) { - for (const ef of abil.effects) if (ef.name?.toLowerCase().includes("synergy")) await ef.update({disabled: !anyAegisOn}); - } + if (abil?.effects?.length) for (const ef of abil.effects) if (ef.name?.toLowerCase().includes("synergy")) await ef.update({disabled: !anyAegisOn}); ui.notifications.info(`GK loadout: ${choice.toUpperCase()} ustawiony.`); } catch (e) { console.error("gk-greyknight auto-loadout error:", e); }