mirror of
https://github.com/Such-Software/wownerogue.git
synced 2026-10-18 06:41:27 +02:00
Removes operator-private material from the shipped tree, corrects documentation
that had drifted from the code, deletes dead code, and applies a consistent
prose style.
Private material moved out of the public tree (docs/private/, git-ignored):
- the wallet keyfile recovery runbook and its helper scripts, which together
published the mainnet wallet file path, the service account, backup snapshot
filenames, and the wallet RPC listener state. The helper duplicated the same
constants, so relocating the document alone would not have removed them.
- the stagenet parallel-candidate runbook and its fixtures.
- the dated production-state record, the internal remediation plan, and the
TODO list. None are reference documentation for an outside reader.
Redacted or genericised:
- operator home-directory paths in shipped scripts and units. The asset build
script now takes KENNEY_ASSETS_DIR instead of a hard-coded path.
- private LAN addresses in tests, env examples and deploy docs, replaced with
RFC 5737 documentation addresses.
- the default alert sender and the notification hub example.
- the Monero wallet unit now matches the Wownero one: a dedicated service
account and a config file, instead of the operator's login account with the
wallet password in argv where any local user can read it from /proc.
Ignore rules now cover every .env variant rather than the bare name, plus local
agent state. The deployment docs instruct operators to create .env.mainnet and
.env.stagenet, which the exact-name rule would have allowed to be committed.
Documentation corrected against the code: per-chain dungeon level counts, the
premium unlock rule, Tavern chat scope, backup retention, the chain-profile
fallback, the environment template location, and several sections describing
shipped work as pending.
Dead code removed: configPersistence, rpccalls, a duplicate vendored ROT.js
bundle, the unused tile-picker overlay, the unreachable legacy game-size path
and its vestigial parameter, spectator stubs that shadowed the real
SpectatorManager, and commented-out debugging. nip98 now imports the shared
nostr loader rather than duplicating it.
Prose style: em-dashes removed throughout in favour of colons, semicolons and
commas; comments restated as present-tense descriptions of the code rather than
narration of past changes.
127 suites / 1015 tests pass.
76 lines
3.4 KiB
JavaScript
76 lines
3.4 KiB
JavaScript
// Pack registry: the engine behind "add more 2D tilesets / iso packs / 3D skins as products".
|
|
//
|
|
// A PACK is a rich, self-contained render environment for a projection (topdown | iso | 3d). Because
|
|
// every scene (tavern OR dungeon) is kind-based (floor/wall/table/torch/monster…), the SAME pack
|
|
// renders both; packs are interchangeable across town and dungeon. Each pack maps 1:1 to a catalog
|
|
// entry (id/tier/threshold), so it's a monetizable product gated by entitlements.
|
|
//
|
|
// This module makes packs MULTI (like RK.THEMES already is for topdown) and adds active-pack
|
|
// selection per projection. Renderers ask for the active pack's assets; a picker lets an unlocked
|
|
// user switch. Adding a pack then = register(def) + drop assets + a catalog row.
|
|
(function (root) {
|
|
'use strict';
|
|
var RK = root.RK = root.RK || {};
|
|
|
|
// id -> { id, label, projection: 'topdown'|'iso'|'3d', kind, assets }
|
|
// `assets` is the render-kit payload for that projection (theme tiles / iso set / 3d models).
|
|
RK.PACK_REGISTRY = RK.PACK_REGISTRY || {};
|
|
|
|
// Storage: localStorage in the browser, an in-memory map under Node/tests.
|
|
var mem = {};
|
|
function store() {
|
|
try { if (root.localStorage) return root.localStorage; } catch (_) {}
|
|
return { getItem: function (k) { return k in mem ? mem[k] : null; }, setItem: function (k, v) { mem[k] = String(v); } };
|
|
}
|
|
function key(projection) { return 'rk_pack_' + projection; }
|
|
|
|
RK.registerPack = function (def) {
|
|
if (!def || !def.id || !def.projection) return null;
|
|
RK.PACK_REGISTRY[def.id] = def;
|
|
return def;
|
|
};
|
|
RK.getPackDef = function (id) { return (id && RK.PACK_REGISTRY[id]) || null; };
|
|
|
|
RK.packsForProjection = function (projection) {
|
|
var out = [];
|
|
for (var id in RK.PACK_REGISTRY) {
|
|
if (RK.PACK_REGISTRY[id].projection === projection) out.push(RK.PACK_REGISTRY[id]);
|
|
}
|
|
return out;
|
|
};
|
|
|
|
// Packs the user can actually use for a projection (free ones + entitlement-unlocked ones).
|
|
RK.unlockedPacks = function (projection) {
|
|
return RK.packsForProjection(projection).filter(function (p) {
|
|
return !RK.canUsePack || RK.canUsePack(p.id);
|
|
});
|
|
};
|
|
|
|
// The user's chosen pack if it's registered for this projection AND unlocked; otherwise the
|
|
// first unlocked pack; otherwise null.
|
|
RK.activePackId = function (projection) {
|
|
var saved = store().getItem(key(projection));
|
|
var def = saved && RK.PACK_REGISTRY[saved];
|
|
if (def && def.projection === projection && (!RK.canUsePack || RK.canUsePack(saved))) return saved;
|
|
var unlocked = RK.unlockedPacks(projection);
|
|
return unlocked.length ? unlocked[0].id : null;
|
|
};
|
|
|
|
RK.activePack = function (projection) { return RK.getPackDef(RK.activePackId(projection)); };
|
|
RK.activePackAssets = function (projection) {
|
|
var def = RK.activePack(projection);
|
|
return def ? def.assets : null;
|
|
};
|
|
|
|
// Select a pack (persisted per projection). Refused if unregistered or locked. Returns success.
|
|
RK.setActivePack = function (id) {
|
|
var def = RK.getPackDef(id);
|
|
if (!def) return false;
|
|
if (RK.canUsePack && !RK.canUsePack(id)) return false;
|
|
store().setItem(key(def.projection), id);
|
|
return true;
|
|
};
|
|
|
|
if (typeof module !== 'undefined' && module.exports) module.exports = RK;
|
|
})(typeof window !== 'undefined' ? window : this);
|