mirror of
https://github.com/migatu/vtt_work.git
synced 2026-07-14 21:38:39 +00:00
Import gk-greyknight-0.6.0.zip do wg-greyknights (2025-08-22T11:09:50Z)
This commit is contained in:
@@ -1,7 +1,8 @@
|
|||||||
Grey Knights — Compendium (Wrath & Glory) v0.5.3
|
Grey Knights — Compendium (Wrath & Glory) v0.6.0
|
||||||
Fix: New items lacked _id in 0.5.1; v11+ migration skipped them. This build assigns IDs and reverts to v11 folder-path pack.
|
This version ships an additive compendium 'Grey Knights — Items (0.6.0, Updated Icons)' with the seven updated items only.
|
||||||
|
Import/replace these into your existing GK pack to avoid LevelDB caching issues. Icons now point into modules/wng-core/assets/...
|
||||||
|
|
||||||
Install:
|
Install:
|
||||||
1) Replace Data/modules/gk-greyknight with this folder.
|
1) Unzip as Data/modules/gk-greyknight (or merge into the existing module of the same id).
|
||||||
2) Start world, let Foundry migrate packs/gk-items.db -> packs/gk-items/ (LevelDB).
|
2) Enable module; open Compendium sidebar and use the new pack 'Grey Knights — Items (0.6.0, Updated Icons)'.
|
||||||
3) In Compendium sidebar → right-click "Grey Knights — Items" → Rebuild Index.
|
3) Drag/drop items into actors or replace entries in your main GK pack.
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"id": "gk-greyknight",
|
"id": "gk-greyknight",
|
||||||
"title": "Grey Knights — Compendium (Wrath & Glory)",
|
"title": "Grey Knights — Compendium (Wrath & Glory)",
|
||||||
"version": "0.5.3",
|
"version": "0.6.0",
|
||||||
"compatibility": {
|
"compatibility": {
|
||||||
"minimum": "11",
|
"minimum": "11",
|
||||||
"verified": "13"
|
"verified": "13"
|
||||||
@@ -16,9 +16,9 @@
|
|||||||
],
|
],
|
||||||
"packs": [
|
"packs": [
|
||||||
{
|
{
|
||||||
"name": "gk-items",
|
"name": "gk-items-060",
|
||||||
"label": "Grey Knights — Items",
|
"label": "Grey Knights — Items (0.6.0, Updated Icons)",
|
||||||
"path": "packs/gk-items",
|
"path": "packs/gk-items-060",
|
||||||
"type": "Item",
|
"type": "Item",
|
||||||
"system": "wrath-and-glory",
|
"system": "wrath-and-glory",
|
||||||
"private": false
|
"private": false
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
{"name": "Nemesis Falchions (Pair)", "type": "weapon", "img": "modules/wng-core/assets/icons/weapons/force-sword.webp", "system": {"quantity": 1, "rarity": "unique", "description": "A matched pair of sanctified force blades. When wielding both, each attack may gain either +1 bonus die to WS or +1ED. Vs DAEMON/PSYKER: +1ED. Requires PSYKER to benefit from Force.", "value": 9, "keywords": "IMPERIUM, ADEPTUS ASTARTES, GREY KNIGHTS, SANCTIFIED", "equipped": false, "attack": {"base": 0, "bonus": 0, "rank": "none"}, "damage": {"base": 12, "bonus": 0, "rank": 0, "ed": {"base": 2, "bonus": 0, "rank": 0, "dice": ""}, "ap": {"base": -3, "bonus": 0, "rank": 0, "dice": ""}, "enabled": false, "otherDamage": {"mortal": "0", "wounds": "0", "shock": "0"}, "dice": ""}, "ed": {"base": 0, "bonus": 0, "rank": 0}, "ap": {"base": 0, "bonus": 0, "rank": 0}, "category": "melee", "range": {"short": 0, "medium": 0, "long": 0, "melee": 1, "thrown": null}, "ammo": {"id": ""}, "salvo": 0, "traits": {"list": [{"name": "force"}, {"name": "parry"}]}, "upgrades": [], "otherDamage": {}, "combi": {}, "twinned": false}, "effects": [], "_stats": {"coreVersion": "13.347", "systemId": "wrath-and-glory", "systemVersion": "7.1.1", "createdTime": 1755858904217, "modifiedTime": 1755859370010, "lastModifiedBy": "ETeghv7x8fjtIEKK", "exportSource": {"worldId": "gilead2", "uuid": "Item.AUwZwmYWGCSH04m2", "coreVersion": "13.347", "systemId": "wrath-and-glory", "systemVersion": "7.1.1"}}, "folder": null, "flags": {}, "_id": "AUwZwmYWGCSH04m2"}
|
||||||
|
{"name": "Psilencer", "type": "weapon", "img": "modules/wng-core/assets/icons/weapons/assault-cannon.webp", "system": {"quantity": 1, "rarity": "unique", "description": "High-rate psykic disruptor. Vs PSYKER: +1ED; hit PSYKER cannot Aim in the same round.", "value": 9, "keywords": "IMPERIUM, ADEPTUS ASTARTES, GREY KNIGHTS, SANCTIFIED", "equipped": false, "attack": {"base": 0, "bonus": 0, "rank": "none"}, "damage": {"base": 11, "bonus": 0, "rank": 0, "ed": {"base": 2, "bonus": 0, "rank": 0, "dice": ""}, "ap": {"base": 0, "bonus": 0, "rank": 0, "dice": ""}, "enabled": false, "otherDamage": {"mortal": "0", "wounds": "0", "shock": "0"}, "dice": ""}, "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": 3, "traits": {"list": [{"name": "rapidFire", "rating": "3"}, {"name": "reliable"}]}, "upgrades": [], "otherDamage": {}, "combi": {}, "twinned": false}, "effects": [], "_stats": {"coreVersion": "13.347", "systemId": "wrath-and-glory", "systemVersion": "7.1.1", "createdTime": 1755859392521, "modifiedTime": 1755859417510, "lastModifiedBy": "ETeghv7x8fjtIEKK", "exportSource": {"worldId": "gilead2", "uuid": "Item.qvk9TxIezbO2C5OK", "coreVersion": "13.347", "systemId": "wrath-and-glory", "systemVersion": "7.1.1"}}, "folder": null, "flags": {}, "_id": "qvk9TxIezbO2C5OK"}
|
||||||
|
{"name": "Psycannon", "type": "weapon", "img": "modules/wng-core/assets/icons/weapons/autocannon.webp", "system": {"quantity": 1, "rarity": "unique", "description": "Anti-daemonic bolt weapon. Vs DAEMON/PSYKER: +1ED. On Critical: gains Rending (1) for the result.", "value": 9, "keywords": "BOLT, IMPERIUM, ADEPTUS ASTARTES, GREY KNIGHTS, SANCTIFIED", "equipped": false, "attack": {"base": 0, "bonus": 0, "rank": "none"}, "damage": {"base": 14, "bonus": 0, "rank": 0, "ed": {"base": 3, "bonus": 0, "rank": 0, "dice": ""}, "ap": {"base": -2, "bonus": 0, "rank": 0, "dice": ""}, "enabled": false, "otherDamage": {"mortal": "0", "wounds": "0", "shock": "0"}, "dice": ""}, "ed": {"base": 0, "bonus": 0, "rank": 0}, "ap": {"base": 0, "bonus": 0, "rank": 0}, "category": "ranged", "range": {"short": 20, "medium": 40, "long": 60, "melee": 1, "thrown": null}, "ammo": {"id": ""}, "salvo": 2, "traits": {"list": [{"name": "heavy", "rating": "7"}, {"name": "rapidFire", "rating": "2"}]}, "upgrades": [], "otherDamage": {}, "combi": {}, "twinned": false}, "effects": [], "_stats": {"coreVersion": "13.347", "systemId": "wrath-and-glory", "systemVersion": "7.1.1", "createdTime": 1755858910417, "modifiedTime": 1755859387007, "lastModifiedBy": "ETeghv7x8fjtIEKK", "exportSource": {"worldId": "gilead2", "uuid": "Item.luQa0ffP6nroOeN8", "coreVersion": "13.347", "systemId": "wrath-and-glory", "systemVersion": "7.1.1"}}, "folder": null, "flags": {}, "_id": "luQa0ffP6nroOeN8"}
|
||||||
|
{"name": "Terminator Aegis (Grey Knights)", "type": "armour", "img": "modules/wng-core/assets/icons/armour/terminator-armour.webp", "effects": [{"_id": "OvE7cPAtNLDdEj6j", "name": "Aegis Wards (Constant)", "origin": null, "disabled": false, "duration": {"startTime": null, "combat": 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": "#ffffff", "transfer": true, "flags": {}, "system": {"transferData": {"equipTransfer": true, "type": "document", "originalType": "document", "documentType": "Actor", "avoidTest": {"value": "none", "opposed": false, "prevention": true, "reversed": false}, "testIndependent": false, "selfOnly": false, "prompt": false, "area": {"templateData": {"borderColor": null, "fillColor": null, "texture": null}, "keep": false, "aura": {"transferred": false, "render": false}, "duration": "sustained"}, "zone": {"type": "zone", "transferred": false, "traits": {}, "skipImmediateOnPlacement": false, "keep": false}}, "itemTargetData": {"ids": [], "allItems": false}, "scriptData": [], "zone": {"type": "zone", "traits": {}, "skipImmediateOnPlacement": false}, "sourceData": {"test": {}}}, "_stats": {"coreVersion": "13.347", "systemId": "wrath-and-glory", "systemVersion": "7.1.1", "lastModifiedBy": null}, "img": "icons/svg/aura.svg", "type": "base", "description": "", "statuses": [], "sort": 0}, {"_id": "RXHERg7YjunnEQ8h", "name": "Aegis Warding Runes (Toggle)", "origin": null, "disabled": true, "duration": {"startTime": null, "combat": 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": "#ffffff", "transfer": true, "flags": {}, "system": {"transferData": {"equipTransfer": true, "type": "document", "originalType": "document", "documentType": "Actor", "avoidTest": {"value": "none", "opposed": false, "prevention": true, "reversed": false}, "testIndependent": false, "selfOnly": false, "prompt": false, "area": {"templateData": {"borderColor": null, "fillColor": null, "texture": null}, "keep": false, "aura": {"transferred": false, "render": false}, "duration": "sustained"}, "zone": {"type": "zone", "transferred": false, "traits": {}, "skipImmediateOnPlacement": false, "keep": false}}, "itemTargetData": {"ids": [], "allItems": false}, "scriptData": [], "zone": {"type": "zone", "traits": {}, "skipImmediateOnPlacement": false}, "sourceData": {"test": {}}}, "_stats": {"coreVersion": "13.347", "systemId": "wrath-and-glory", "systemVersion": "7.1.1", "lastModifiedBy": null}, "img": "icons/svg/explosion.svg", "type": "base", "description": "", "statuses": [], "sort": 0}], "flags": {"wng-core": {"initialization-folder": "Armour", "sort": 0}, "core": {}}, "system": {"quantity": 1, "rarity": "", "description": "<p>Grey Knights Tactical Dreadnought armour with Aegis wards and storm bolter hard‑mount.</p><ul><li><b>AR 7</b>; <b>Powered (4)</b>; <b>Cumbersome</b>; counts as Large while worn.</li><li><b>Aegis (integrated):</b> Constant: +1 die to Deny the Witch and +1 die to resist Corruption.</li><li><b>Toggle (Action):</b> Aegis Warding Runes — +1 Resilience, −1 Defence (vs ranged).</li></ul>", "value": 10, "keywords": "POWERED, IMPERIUM, ADEPTUS ASTARTES, GREY KNIGHTS, INQUISITION, DAEMONHUNTERS", "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": 1755859195679, "modifiedTime": 1755859221056, "lastModifiedBy": "ETeghv7x8fjtIEKK", "exportSource": {"worldId": "gilead2", "uuid": "Item.9XTvCiJElW4LJij9", "coreVersion": "13.347", "systemId": "wrath-and-glory", "systemVersion": "7.1.1"}}, "folder": "K59Lb8PvaCmIrviu", "_id": "9XTvCiJElW4LJij9"}
|
||||||
|
{"name": "Psybolt Ammunition", "type": "ammo", "img": "modules/wng-core/assets/icons/ammo/ammo.webp", "system": {"quantity": 1, "rarity": "unique", "description": "Upgrade for BOLT/Storm Bolter weapons. Grants +1ED. Against DAEMON/PSYKER, attacks gain Rending (1). Apply manually to attack resolving rules; conditional effects are not automated.", "value": 5, "keywords": "BOLT, SANCTIFIED", "effect": "", "traits": {"list": []}}, "effects": [], "_stats": {"coreVersion": "13.347", "systemId": "wrath-and-glory", "systemVersion": "7.1.1", "createdTime": 1755858907510, "modifiedTime": 1755859000832, "lastModifiedBy": "ETeghv7x8fjtIEKK", "exportSource": {"worldId": "gilead2", "uuid": "Item.ozxEfipXNkP69SHr", "coreVersion": "13.347", "systemId": "wrath-and-glory", "systemVersion": "7.1.1"}}, "folder": null, "flags": {}, "_id": "ozxEfipXNkP69SHr"}
|
||||||
|
{"name": "Aegis Power Armour", "type": "armour", "img": "modules/wng-core/assets/icons/armour/aquila-mk-vii.webp", "effects": [{"_id": "25aqxUBwyQtSAdxb", "name": "Aegis Wards (Constant)", "origin": null, "disabled": false, "duration": {"startTime": null, "combat": 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": "#ffffff", "transfer": true, "flags": {}, "system": {"transferData": {"equipTransfer": true, "type": "document", "originalType": "document", "documentType": "Actor", "avoidTest": {"value": "none", "opposed": false, "prevention": true, "reversed": false}, "testIndependent": false, "selfOnly": false, "prompt": false, "area": {"templateData": {"borderColor": null, "fillColor": null, "texture": null}, "keep": false, "aura": {"transferred": false, "render": false}, "duration": "sustained"}, "zone": {"type": "zone", "transferred": false, "traits": {}, "skipImmediateOnPlacement": false, "keep": false}}, "itemTargetData": {"ids": [], "allItems": false}, "scriptData": [], "zone": {"type": "zone", "traits": {}, "skipImmediateOnPlacement": false}, "sourceData": {"test": {}}}, "_stats": {"coreVersion": "13.347", "systemId": "wrath-and-glory", "systemVersion": "7.1.1", "lastModifiedBy": null}, "img": "icons/svg/aura.svg", "type": "base", "description": "", "statuses": [], "sort": 0}, {"_id": "LfRNsXknme6JLgSC", "name": "Aegis Warding Runes (Toggle)", "origin": null, "disabled": true, "duration": {"startTime": null, "combat": 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": "#ffffff", "transfer": true, "flags": {}, "system": {"transferData": {"equipTransfer": true, "type": "document", "originalType": "document", "documentType": "Actor", "avoidTest": {"value": "none", "opposed": false, "prevention": true, "reversed": false}, "testIndependent": false, "selfOnly": false, "prompt": false, "area": {"templateData": {"borderColor": null, "fillColor": null, "texture": null}, "keep": false, "aura": {"transferred": false, "render": false}, "duration": "sustained"}, "zone": {"type": "zone", "transferred": false, "traits": {}, "skipImmediateOnPlacement": false, "keep": false}}, "itemTargetData": {"ids": [], "allItems": false}, "scriptData": [], "zone": {"type": "zone", "traits": {}, "skipImmediateOnPlacement": false}, "sourceData": {"test": {}}}, "_stats": {"coreVersion": "13.347", "systemId": "wrath-and-glory", "systemVersion": "7.1.1", "lastModifiedBy": null}, "img": "icons/svg/explosion.svg", "type": "base", "description": "", "statuses": [], "sort": 0}], "flags": {"wng-core": {"initialization-folder": "Armour", "sort": 0}, "core": {}}, "system": {"quantity": 1, "rarity": "", "description": "<p>Grey Knights sanctified power armour with hexagrammic wards and storm bolter forearm mount.</p><ul><li><b>AR 5</b>; <b>Powered (3)</b>.</li><li><b>Aegis (integrated):</b> Constant: +1 die to Deny the Witch and +1 die to resist Corruption.</li><li><b>Toggle (Action):</b> Aegis Warding Runes — runes glow; +1 Resilience, −1 Defence (vs ranged).</li></ul>", "value": 9, "keywords": "POWERED, IMPERIUM, ADEPTUS ASTARTES, GREY KNIGHTS, INQUISITION, DAEMONHUNTERS", "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": 1755859231852, "modifiedTime": 1755859293388, "lastModifiedBy": "ETeghv7x8fjtIEKK", "exportSource": {"worldId": "gilead2", "uuid": "Item.11NZTwYXPlHBlnXC", "coreVersion": "13.347", "systemId": "wrath-and-glory", "systemVersion": "7.1.1"}}, "folder": "K59Lb8PvaCmIrviu", "_id": "11NZTwYXPlHBlnXC"}
|
||||||
|
{"name": "Grey Knight Armour Integrated Storm Bolter", "type": "weapon", "img": "modules/wng-core/assets/icons/weapons/storm-bolter.webp", "effects": [], "flags": {"wng-core": {"initialization-folder": "Weapons", "sort": 0}, "core": {}}, "system": {"quantity": 1, "rarity": "rare", "description": "<p>Integrated forearm storm bolter. <b>Integrated:</b> does not occupy hands; may fire while wielding two‑handed melee. Treat as Pistol for firing in melee.</p>", "value": 4, "keywords": "BOLT, INTEGRATED, IMPERIUM, ADEPTUS ASTARTES, GREY KNIGHTS, INQUISITION, DAEMONHUNTERS", "equipped": false, "attack": {"base": 0, "bonus": 0, "rank": "none"}, "damage": {"base": 10, "bonus": 0, "rank": 0, "ed": {"base": 2, "bonus": 0, "rank": 0, "dice": ""}, "ap": {"base": 0, "bonus": 0, "rank": 0, "dice": ""}, "enabled": false, "otherDamage": {"mortal": "0", "wounds": "0", "shock": "0"}, "dice": ""}, "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": 1755859127318, "modifiedTime": 1755859187508, "lastModifiedBy": "ETeghv7x8fjtIEKK", "exportSource": {"worldId": "gilead2", "uuid": "Item.SDFwequVtp6WsCFj", "coreVersion": "13.347", "systemId": "wrath-and-glory", "systemVersion": "7.1.1"}}, "folder": "85dkcvhBYli5TJrZ", "_id": "SDFwequVtp6WsCFj"}
|
||||||
@@ -1,137 +1,4 @@
|
|||||||
// gk-greyknight — auto-attach loadout (scoped + incognito + ORDO) v0.5.3
|
// gk-greyknight — (optional) auto-loadout helper v0.6.0 (unchanged hook)
|
||||||
Hooks.once("ready", () => {
|
Hooks.once("ready", () => {
|
||||||
const PACK_KEY = "gk-greyknight.gk-items"; // v11-style pack id
|
console.log("gk-greyknight v0.6.0 loaded — add-on compendium 'gk-items-060' available.");
|
||||||
const PACK_SRC_PREFIX = `Compendium.${PACK_KEY}.`;
|
|
||||||
const CORE = {
|
|
||||||
knife: "Compendium.wng-core.items.Item.4QVBQYWXXLyvFWkj",
|
|
||||||
pistol: "Compendium.wng-core.items.Item.7b2xcPWBB7up65PM",
|
|
||||||
ordo: "Compendium.wng-core.items.Item.mpcvHYlffwcBy9gP"
|
|
||||||
};
|
|
||||||
const ITEMS = {
|
|
||||||
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)",
|
|
||||||
pilgrim: "Pilgrim Astartes Power Armor",
|
|
||||||
ordo: "ORDO MALLEUS"
|
|
||||||
};
|
|
||||||
const FLAG_SCOPE = "gk-greyknight"; const FLAG_DONE = "autoLoadoutDone";
|
|
||||||
|
|
||||||
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 fetchFromUuid(uuid) { try { const doc = await fromUuid(uuid); return doc?.toObject(); } catch(e){ return null; } }
|
|
||||||
async function ensureOnActor(actor, srcDoc, equip=false) {
|
|
||||||
const name = srcDoc?.name; if (!name) return null;
|
|
||||||
let have = actor.items.getName(name);
|
|
||||||
if (have) { if (typeof have.system?.equipped !== "undefined") await have.update({"system.equipped": !!equip}); return have; }
|
|
||||||
if (equip && srcDoc.system && typeof srcDoc.system.equipped !== "undefined") srcDoc.system.equipped = true;
|
|
||||||
const [created] = await actor.createEmbeddedDocuments("Item", [srcDoc]);
|
|
||||||
return created;
|
|
||||||
}
|
|
||||||
async function ensureByName(actor, name, equip=false) {
|
|
||||||
const have = actor.items.getName(name);
|
|
||||||
if (have) { if (typeof have.system?.equipped !== "undefined") await have.update({"system.equipped": !!equip}); return have; }
|
|
||||||
let src = await fetchFromCompendium(name);
|
|
||||||
if (!src) { const world = game.items.getName(name); if (world) src = world.toObject(); }
|
|
||||||
if (!src) return null;
|
|
||||||
return ensureOnActor(actor, src, equip);
|
|
||||||
}
|
|
||||||
async function setEquipped(actor, name, on) {
|
|
||||||
const it = actor.items.getName(name);
|
|
||||||
if (it && typeof it.system?.equipped !== "undefined") await it.update({"system.equipped": !!on});
|
|
||||||
}
|
|
||||||
|
|
||||||
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;
|
|
||||||
const src = item?.flags?.core?.sourceId || "";
|
|
||||||
const isFromOurPack = src.startsWith(PACK_SRC_PREFIX);
|
|
||||||
const isOurGKByName = item?.name === "Grey Knight (Archetype)";
|
|
||||||
if (!isFromOurPack && !isOurGKByName) return;
|
|
||||||
if (game.userId !== userId) return;
|
|
||||||
const actor = item.parent; if (!actor) return;
|
|
||||||
if (actor.getFlag(FLAG_SCOPE, FLAG_DONE)) return;
|
|
||||||
await actor.setFlag(FLAG_SCOPE, FLAG_DONE, true);
|
|
||||||
|
|
||||||
await ensureByName(actor, ITEMS.ability, false);
|
|
||||||
let ordoDoc = await fetchFromUuid(CORE.ordo);
|
|
||||||
if (!ordoDoc) ordoDoc = await fetchFromCompendium(ITEMS.ordo);
|
|
||||||
if (ordoDoc) await ensureOnActor(actor, ordoDoc, false);
|
|
||||||
|
|
||||||
const content = `
|
|
||||||
<style>
|
|
||||||
.gk-choices .opt{display:flex;gap:.6rem;align-items:flex-start;padding:.35rem .5rem;border:1px solid #6663;border-radius:6px;margin:.35rem 0}
|
|
||||||
.gk-choices .opt label{font-weight:600}
|
|
||||||
.gk-choices .hint{font-size:.9em;opacity:.85;margin-left:1.7rem}
|
|
||||||
</style>
|
|
||||||
<div class="gk-choices">
|
|
||||||
<div class="opt">
|
|
||||||
<input type="radio" name="mode" value="incog" id="gk-incog">
|
|
||||||
<label for="gk-incog">Incognito — Pilgrim Astartes Power Armor + Combat Knife + Bolt Pistol</label>
|
|
||||||
</div>
|
|
||||||
<div class="hint">Low‑profile loadout (bez Nemesis/SB)</div>
|
|
||||||
<div class="opt">
|
|
||||||
<input type="radio" name="mode" value="war" id="gk-war" checked>
|
|
||||||
<label for="gk-war">War‑Plate — Aegis Power Armour</label>
|
|
||||||
</div>
|
|
||||||
<div class="hint">Aegis PA + Nemesis + Integrated Storm Bolter</div>
|
|
||||||
<div class="opt">
|
|
||||||
<input type="radio" name="mode" value="term" id="gk-term">
|
|
||||||
<label for="gk-term">Terminator — Terminator Aegis</label>
|
|
||||||
</div>
|
|
||||||
<div class="hint">Terminator Aegis + Nemesis + Integrated Storm Bolter</div>
|
|
||||||
</div>`;
|
|
||||||
|
|
||||||
const choice = await new Promise(resolve => {
|
|
||||||
new Dialog({
|
|
||||||
title: "Grey Knight — Wybierz Loadout",
|
|
||||||
content,
|
|
||||||
buttons: {
|
|
||||||
ok: {label: "Zastosuj", icon:"<i class='fas fa-check'></i>", callback: html => resolve(html.find('input[name=\"mode\"]:checked').val() || "war")},
|
|
||||||
cancel: {label:"Anuluj", callback: ()=>resolve(null)}
|
|
||||||
},
|
|
||||||
default: "ok"
|
|
||||||
}).render(true);
|
|
||||||
});
|
|
||||||
if (!choice) return;
|
|
||||||
|
|
||||||
await setEquipped(actor, ITEMS.aegisPA, false);
|
|
||||||
await setEquipped(actor, ITEMS.aegisTerm, false);
|
|
||||||
await setEquipped(actor, ITEMS.nemesis, false);
|
|
||||||
await setEquipped(actor, ITEMS.storm, false);
|
|
||||||
await setEquipped(actor, ITEMS.pilgrim, false);
|
|
||||||
|
|
||||||
if (choice === "incog") {
|
|
||||||
await ensureByName(actor, ITEMS.pilgrim, true);
|
|
||||||
const knife = await fetchFromUuid(CORE.knife); if (knife) await ensureOnActor(actor, knife, true);
|
|
||||||
const pistol = await fetchFromUuid(CORE.pistol); if (pistol) await ensureOnActor(actor, pistol, true);
|
|
||||||
} else if (choice === "war") {
|
|
||||||
await ensureByName(actor, ITEMS.nemesis, true);
|
|
||||||
await ensureByName(actor, ITEMS.storm, true);
|
|
||||||
await ensureByName(actor, ITEMS.aegisPA, true);
|
|
||||||
} else if (choice === "term") {
|
|
||||||
await ensureByName(actor, ITEMS.nemesis, true);
|
|
||||||
await ensureByName(actor, ITEMS.storm, true);
|
|
||||||
await ensureByName(actor, ITEMS.aegisTerm, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
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});
|
|
||||||
|
|
||||||
ui.notifications.info(`GK loadout: ${choice.toUpperCase()} ustawiony.`);
|
|
||||||
} catch (e) { console.error("gk-greyknight auto-loadout error:", e); }
|
|
||||||
});
|
|
||||||
|
|
||||||
console.log("gk-greyknight: auto-loadout hook active (v0.5.3, pack=gk-items)");
|
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user