diff --git a/wg-greyknights/foundry/fvtt-Item-ability-aegis-of-titan_v5.json b/wg-greyknights/foundry/fvtt-Item-ability-aegis-of-titan_v5.json
new file mode 100644
index 0000000..a3534c2
--- /dev/null
+++ b/wg-greyknights/foundry/fvtt-Item-ability-aegis-of-titan_v5.json
@@ -0,0 +1,61 @@
+{
+ "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"
+ }
+}
\ No newline at end of file
diff --git a/wg-greyknights/foundry/fvtt-Item-aegis-power-armour_v2.json b/wg-greyknights/foundry/fvtt-Item-aegis-power-armour_v2.json
new file mode 100644
index 0000000..3d921a7
--- /dev/null
+++ b/wg-greyknights/foundry/fvtt-Item-aegis-power-armour_v2.json
@@ -0,0 +1,104 @@
+{
+ "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.
- AR 5; Powered (3).
- Aegis (integrated): Constant: +1 die to Deny the Witch and +1 die to resist Corruption.
- Toggle (Action): Aegis Warding Runes — runes glow; +1 Resilience, −1 Defence (vs ranged).
",
+ "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"
+}
\ No newline at end of file
diff --git a/wg-greyknights/foundry/fvtt-Item-archetype-grey-knight_v5.json b/wg-greyknights/foundry/fvtt-Item-archetype-grey-knight_v5.json
new file mode 100644
index 0000000..1a1bcee
--- /dev/null
+++ b/wg-greyknights/foundry/fvtt-Item-archetype-grey-knight_v5.json
@@ -0,0 +1,290 @@
+{
+ "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"
+}
\ No newline at end of file
diff --git a/wg-greyknights/foundry/fvtt-Item-gk-armour-integrated-storm-bolter_v2.json b/wg-greyknights/foundry/fvtt-Item-gk-armour-integrated-storm-bolter_v2.json
new file mode 100644
index 0000000..5231ed4
--- /dev/null
+++ b/wg-greyknights/foundry/fvtt-Item-gk-armour-integrated-storm-bolter_v2.json
@@ -0,0 +1,104 @@
+{
+ "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"
+}
\ No newline at end of file
diff --git a/wg-greyknights/foundry/fvtt-Item-nemesis-force-halberd_v4.json b/wg-greyknights/foundry/fvtt-Item-nemesis-force-halberd_v4.json
new file mode 100644
index 0000000..e9bb82a
--- /dev/null
+++ b/wg-greyknights/foundry/fvtt-Item-nemesis-force-halberd_v4.json
@@ -0,0 +1,103 @@
+{
+ "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"
+}
\ No newline at end of file
diff --git a/wg-greyknights/foundry/fvtt-Item-terminator-aegis-gk_v4.json b/wg-greyknights/foundry/fvtt-Item-terminator-aegis-gk_v4.json
new file mode 100644
index 0000000..3143458
--- /dev/null
+++ b/wg-greyknights/foundry/fvtt-Item-terminator-aegis-gk_v4.json
@@ -0,0 +1,107 @@
+{
+ "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.
- AR 7; Powered (4); Cumbersome; counts as Large while worn.
- Aegis (integrated): Constant: +1 die to Deny the Witch and +1 die to resist Corruption.
- Toggle (Action): Aegis Warding Runes — +1 Resilience, −1 Defence (vs ranged).
",
+ "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"
+}
\ No newline at end of file
diff --git a/wg-greyknights/macro/macro-gk-auto-loadout-on-archetype.js b/wg-greyknights/macro/macro-gk-auto-loadout-on-archetype.js
new file mode 100644
index 0000000..d75bf8c
--- /dev/null
+++ b/wg-greyknights/macro/macro-gk-auto-loadout-on-archetype.js
@@ -0,0 +1,20 @@
+// GK – Auto Loadout on Archetype Assignment
+// Rejestruje Hook createItem: jeśli do aktora dodano 'Grey Knight (Archetype)', uruchomi 'GK – Loadout Manager'.
+(() => {
+ if (window._gkAutoLoadoutHook) { ui.notifications.info("GK Auto-Loadout: już aktywne."); return; }
+ 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 m = game.macros.getName("GK – Loadout Manager") || game.macros.getName("GK-Loadout-Manager") || null;
+ if (m) {
+ await m.execute();
+ } else {
+ ui.notifications.warn("Brak makra 'GK – Loadout Manager'. Utwórz je i uruchom ponownie.");
+ }
+ } catch (e) { console.error("GK Auto-Loadout error", e); }
+ });
+ ui.notifications.info("GK Auto-Loadout: hook zarejestrowany (createItem).");
+})();
\ No newline at end of file
diff --git a/wg-greyknights/macro/macro-gk-glow-toggle.js b/wg-greyknights/macro/macro-gk-glow-toggle.js
new file mode 100644
index 0000000..4c1d23e
--- /dev/null
+++ b/wg-greyknights/macro/macro-gk-glow-toggle.js
@@ -0,0 +1,35 @@
+// Aegis Glow Toggle (robust) — v13
+(async () => {
+ const tok = canvas.tokens.controlled[0] ?? null;
+ const actor = tok?.actor ?? game.user.character;
+ const token = tok ?? canvas.tokens.placeables.find(t => t.actor?.id === actor?.id);
+ if (!actor || !token) return ui.notifications.warn("Wybierz token lub przypisz postać do użytkownika.");
+
+ const aegisArm = actor.items.find(i => ["armour","armor"].includes(i.type) && /Aegis/.test(i.name));
+ if (!aegisArm) return ui.notifications.warn("Nie znaleziono Aegis armour na postaci.");
+ const eff = aegisArm.effects.find(e => e.name?.toLowerCase().startsWith("aegis warding runes"));
+ if (!eff) return ui.notifications.warn("Nie znaleziono efektu toggle na Aegis armour.");
+ const wasDisabled = eff.disabled ?? true;
+ await eff.update({ disabled: !wasDisabled });
+
+ const FLAG_SCOPE = "wng-gk"; const FLAG_KEY = "prevLight";
+ const setGlowOn = async () => {
+ const prev = token.document.getFlag(FLAG_SCOPE, FLAG_KEY);
+ if (!prev) await token.document.setFlag(FLAG_SCOPE, FLAG_KEY, foundry.utils.deepClone(token.document.light));
+ await token.document.update({
+ light: { color:"#66ccff", coloration:2, alpha:0.7, dim:16, bright:0, angle:360,
+ luminosity:0.5, attenuation:0.35, saturation:0, contrast:0, shadows:0,
+ animation:{ type:"pulse", speed:3, intensity:4, reverse:false } }
+ });
+ await canvas.perception.update({ lighting: { refresh: true } });
+ };
+ const setGlowOff = async () => {
+ const prev = token.document.getFlag(FLAG_SCOPE, FLAG_KEY);
+ if (prev) { await token.document.update({ light: prev }); await token.document.unsetFlag(FLAG_SCOPE, FLAG_KEY); }
+ else { await token.document.update({ light: { dim:0, bright:0, color:null } }); }
+ await canvas.perception.update({ lighting: { refresh: true } });
+ };
+
+ if (wasDisabled) { await setGlowOn(); ChatMessage.create({ content: `Aegis: Warding Runes ENGAGED. (Akcja)` }); }
+ else { await setGlowOff(); ChatMessage.create({ content: `Aegis: Warding Runes DISENGAGED.` }); }
+})();
\ No newline at end of file
diff --git a/wg-greyknights/macro/macro-gk-import-world-items.js b/wg-greyknights/macro/macro-gk-import-world-items.js
new file mode 100644
index 0000000..65317c6
--- /dev/null
+++ b/wg-greyknights/macro/macro-gk-import-world-items.js
@@ -0,0 +1,68 @@
+// GK – Import World Items (from JSONs into Items Directory)
+(async () => {
+ const FILES = [
+ "fvtt-Item-archetype-grey-knight_v5.json",
+ "fvtt-Item-ability-aegis-of-titan_v5.json",
+ "fvtt-Item-nemesis-force-halberd_v4.json",
+ "fvtt-Item-gk-armour-integrated-storm-bolter_v2.json",
+ "fvtt-Item-aegis-power-armour_v2.json",
+ "fvtt-Item-terminator-aegis-gk_v4.json"
+ ];
+ const pick = await new Promise(resolve => {
+ const content = `
+ Folder z JSON-ami (np. worlds/TwojSwiat/foundry)
+
+
+
+
+ `;
+ const dlg = new Dialog({
+ title: "GK – Import World Items",
+ content,
+ buttons: {
+ go: { label: "Importuj", icon: '', callback: html => resolve({ok:true, html}) },
+ cancel: { label: "Anuluj", callback: () => resolve({ok:false}) }
+ },
+ render: html => {
+ html.find("button.browse").on("click", () => {
+ const fp = new FilePicker({
+ type: "any",
+ callback: path => html.find('input[name="path"]').val(path.replace(/\/[^\/]*$/, ""))
+ });
+ fp.browse();
+ });
+ },
+ default: "go"
+ });
+ dlg.render(true);
+ });
+ if (!pick?.ok) return;
+ const dir = pick.html.find('input[name="path"]').val()?.trim();
+ const overwrite = pick.html.find('input[name="overwrite"]')[0].checked;
+ if (!dir) return ui.notifications.warn("Podaj ścieżkę folderu w danych świata.");
+ const ensureFolder = async (name, color="#4b6eaf") => {
+ let f = game.folders.find(x => x.type === "Item" && x.name === name);
+ if (!f) f = await Folder.create({name, type:"Item", color});
+ return f;
+ };
+ const worldFolder = await ensureFolder("Grey Knight Pack", "#4b6eaf");
+ const fetchJSON = async (path) => {
+ const res = await fetch(`/${path}`);
+ if (!res.ok) throw new Error(`Nie mogę pobrać: ${path} (HTTP ${res.status})`);
+ return await res.json();
+ };
+ let created = 0, updated = 0, skipped = 0;
+ for (const fn of FILES) {
+ try {
+ const full = `${dir}/${fn}`;
+ const data = await fetchJSON(full);
+ if (data._id) delete data._id;
+ data.folder = worldFolder.id;
+ const existing = game.items.getName(data.name);
+ if (existing) {
+ if (overwrite) { await existing.update(data); updated++; } else { skipped++; }
+ } else { await Item.create(data); created++; }
+ } catch (e) { console.error(`Błąd importu ${fn}`, e); ui.notifications.warn(`Błąd importu: ${fn} (konsola).`); }
+ }
+ ui.notifications.info(`GK Import: utworzono ${created}, zaktualizowano ${updated}, pominięto ${skipped}.`);
+})();
\ No newline at end of file
diff --git a/wg-greyknights/macro/macro-gk-loadout-manager.js b/wg-greyknights/macro/macro-gk-loadout-manager.js
new file mode 100644
index 0000000..4429bc7
--- /dev/null
+++ b/wg-greyknights/macro/macro-gk-loadout-manager.js
@@ -0,0 +1,64 @@
+// GK – Loadout Manager (attach from Items Directory, set loadout, wire Synergy)
+(async () => {
+ const NAMES = {
+ archetype: "Grey Knight (Archetype)",
+ ability: "Aegis of Titan (Ability)",
+ nemesis: "Nemesis Force Halberd",
+ storm: "Grey Knight Armour Integrated Storm Bolter",
+ aegis: "Aegis Power Armour",
+ term: "Terminator Aegis (Grey Knights)"
+ };
+ const WORLD_FOLDER_NAME = "Grey Knight Pack";
+
+ const actor = canvas.tokens.controlled[0]?.actor ?? game.user.character;
+ if (!actor) return ui.notifications.warn("Zaznacz token albo przypisz postać.");
+
+ const mode = await Dialog.prompt({
+ title: "Grey Knight – Loadout Manager",
+ content: `Wybierz lub zmień loadout:
+
+
+ `,
+ label: "OK",
+ callback: html => html.find('input[name="m"]:checked').val()
+ });
+ if (!mode) return;
+
+ const findWorldItem = (name) => {
+ const inFolder = game.items.filter(i => i.name === name && i.folder?.name === WORLD_FOLDER_NAME);
+ if (inFolder.length) return inFolder[0];
+ return game.items.getName(name) ?? null;
+ };
+ const ensureOnActor = async (name) => {
+ const have = actor.items.getName(name);
+ if (have) return have;
+ const worldIt = findWorldItem(name);
+ if (!worldIt) { ui.notifications.warn(`Brak w Items Directory: ${name}`); return null; }
+ const created = await actor.createEmbeddedDocuments("Item", [worldIt.toObject()]);
+ return created[0];
+ };
+
+ for (const key of Object.keys(NAMES)) await ensureOnActor(NAMES[key]);
+
+ const setEquipped = async (name, on) => { const it = actor.items.getName(name); if (it) await it.update({"system.equipped": !!on}); };
+ await setEquipped(NAMES.aegis, false);
+ await setEquipped(NAMES.term, false);
+ await setEquipped(NAMES.storm, false);
+ await setEquipped(NAMES.nemesis, false);
+
+ if (mode === "war") {
+ await setEquipped(NAMES.aegis, true);
+ await setEquipped(NAMES.storm, true);
+ await setEquipped(NAMES.nemesis, true);
+ } else if (mode === "term") {
+ await setEquipped(NAMES.term, true);
+ await setEquipped(NAMES.storm, true);
+ await setEquipped(NAMES.nemesis, true);
+ }
+
+ const anyAegisEquipped = !!actor.items.find(i => ["armour","armor"].includes(i.type) && /Aegis/.test(i.name) && i.system?.equipped);
+ const abilItem = actor.items.getName(NAMES.ability);
+ if (abilItem) for (const ef of abilItem.effects ?? []) if (ef.name?.includes("Aegis Synergy")) await ef.update({ disabled: !anyAegisEquipped });
+
+ ui.notifications.info(`Loadout ustawiony: ${mode.toUpperCase()}.`);
+})();
\ No newline at end of file