Files
vtt_work/wg-greyknights/scripts/gk-glow-toggle.js
T
gitea a67c18d691 fix(foundry): poprawki zgodności v13/v14 + skrypt NeDB→LevelDB
Poprawki punktowe (niskiego ryzyka, z fallbackiem na v11/v12):
- greyknights/auto-loadout: pochodzenie z paczki przez _stats.compendiumSource
  (flags.core.sourceId deprecated od v12)
- greyknights/gk-glow-toggle: canvas.perception.update -> płaska flaga
  refreshLighting (stary format {lighting:{refresh}} nie działa od v11)
- greyknights/helpers: TextEditor -> foundry.applications.ux.TextEditor;
  game.ui -> ui (martwy no-op)
- greyknights/ui-gkpanel: scene control tool v13 onClick -> onChange
- voidships-builder/voidships: loadTemplates -> foundry.applications.handlebars
- voidships-builder/voidship-actor: Actors -> foundry.documents.collections.Actors
- usunięto śmieciowe packs/*.db.bak

Skrypt help_scripts/pack_nedb_to_leveldb.mjs: przepakowuje kompendia NeDB(.db)
-> LevelDB (wymagane w v11+/v13/v14), czyta paczki z module.json, domyślnie
dry-run. Wykrywa też rozbieżność: gk-greyknights i wg-voidships-journal mają
w manifeście ścieżkę bez .db, a na dysku plik NeDB.

Nie ruszano vendored investigation-board (do aktualizacji z upstreamu).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-29 19:31:37 +02:00

34 lines
2.1 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// GK Aegis Glow Toggle (module)
(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({ refreshLighting: 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({ refreshLighting: true });
};
if (wasDisabled) { await setGlowOn(); ChatMessage.create({ content: `<b>Aegis:</b> Warding Runes <span style="color:#66ccff">ENGAGED</span>. (Akcja)` }); }
else { await setGlowOff(); ChatMessage.create({ content: `<b>Aegis:</b> Warding Runes DISENGAGED.` }); }
})();