@team-antioch/sc2-adjutant 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (149) hide show
  1. package/README.md +2 -0
  2. package/data/blizzard-baseline.json +3061 -0
  3. package/data/button-hotkeys.json +5722 -0
  4. package/data/game-assets.json +50909 -0
  5. package/data/package-entries.json +32361 -2
  6. package/dist/capture/bank-fixtures.d.ts +13 -0
  7. package/dist/capture/bank-fixtures.js +35 -0
  8. package/dist/capture/bank-snapshots.d.ts +95 -0
  9. package/dist/capture/bank-snapshots.js +302 -0
  10. package/dist/capture/editor-broker-client.d.ts +27 -4
  11. package/dist/capture/editor-broker-client.js +3 -3
  12. package/dist/capture/editor-broker.js +154 -9
  13. package/dist/capture/effect-tour.d.ts +113 -0
  14. package/dist/capture/effect-tour.js +283 -0
  15. package/dist/capture/effect-video.d.ts +74 -0
  16. package/dist/capture/effect-video.js +173 -0
  17. package/dist/capture/exemplar-capture.d.ts +4 -0
  18. package/dist/capture/exemplar-capture.js +4 -1
  19. package/dist/capture/shots.d.ts +6 -1
  20. package/dist/capture/shots.js +1 -1
  21. package/dist/capture/stop-tour.d.ts +3 -1
  22. package/dist/capture/stop-tour.js +1 -1
  23. package/dist/capture/style-pack-captures.d.ts +67 -0
  24. package/dist/capture/style-pack-captures.js +172 -0
  25. package/dist/catalog/stock-catalog.d.ts +8 -0
  26. package/dist/catalog/stock-catalog.js +13 -0
  27. package/dist/cli/capture-exemplars.js +18 -32
  28. package/dist/cli/effect-tour.d.ts +2 -0
  29. package/dist/cli/effect-tour.js +378 -0
  30. package/dist/cli/make-frames.d.ts +1 -0
  31. package/dist/cli/make-frames.js +21 -0
  32. package/dist/cli/sound-mix.d.ts +1 -0
  33. package/dist/cli/sound-mix.js +75 -0
  34. package/dist/cli/study.js +6 -26
  35. package/dist/domain/blueprint-trigger.d.ts +355 -3
  36. package/dist/domain/blueprint-trigger.js +149 -8
  37. package/dist/domain/library-interface.d.ts +50 -29
  38. package/dist/domain/library-interface.js +54 -41
  39. package/dist/domain/mission-blueprint.d.ts +13 -6
  40. package/dist/domain/mission-blueprint.js +6 -0
  41. package/dist/domain/mod-blueprint.d.ts +4 -4
  42. package/dist/host/game-logs.d.ts +63 -0
  43. package/dist/host/game-logs.js +178 -0
  44. package/dist/host/game-ownership.d.ts +37 -0
  45. package/dist/host/game-ownership.js +84 -0
  46. package/dist/host/game-run-report.d.ts +63 -0
  47. package/dist/host/game-run-report.js +119 -0
  48. package/dist/host/known-errors.d.ts +34 -0
  49. package/dist/host/known-errors.js +73 -0
  50. package/dist/init/init-workspace.d.ts +3 -1
  51. package/dist/init/init-workspace.js +10 -1
  52. package/dist/map/convert-mission-triggers.d.ts +115 -7
  53. package/dist/map/convert-mission-triggers.js +527 -47
  54. package/dist/map/editor-changes.d.ts +1 -1
  55. package/dist/map/editor-form.d.ts +5 -0
  56. package/dist/map/editor-form.js +72 -0
  57. package/dist/map/game-packages.d.ts +3 -2
  58. package/dist/map/game-packages.js +5 -2
  59. package/dist/map/kept-references.js +47 -1
  60. package/dist/map/kept-session.js +3 -1
  61. package/dist/map/outline-diff.d.ts +24 -0
  62. package/dist/map/outline-diff.js +95 -0
  63. package/dist/map/outline-trigger.d.ts +7 -0
  64. package/dist/map/outline-trigger.js +29 -20
  65. package/dist/map/ownership-plan.d.ts +6 -2
  66. package/dist/map/ownership-plan.js +1 -1
  67. package/dist/map/package-output.js +13 -8
  68. package/dist/map/tune-kept-triggers.d.ts +7 -0
  69. package/dist/map/tune-kept-triggers.js +33 -6
  70. package/dist/map/write-blueprint-trigger.d.ts +9 -4
  71. package/dist/map/write-blueprint-trigger.js +46 -13
  72. package/dist/map/write-map-package.js +20 -9
  73. package/dist/mcp/capture-jobs.d.ts +2 -0
  74. package/dist/mcp/capture-jobs.js +2 -0
  75. package/dist/mcp/server.d.ts +11 -2
  76. package/dist/mcp/server.js +17 -4
  77. package/dist/mcp/tools/bank-report.d.ts +19 -0
  78. package/dist/mcp/tools/bank-report.js +51 -0
  79. package/dist/mcp/tools/blueprint.js +18 -14
  80. package/dist/mcp/tools/capture.d.ts +4 -0
  81. package/dist/mcp/tools/capture.js +22 -5
  82. package/dist/mcp/tools/catalog.d.ts +1 -1
  83. package/dist/mcp/tools/catalog.js +30 -1
  84. package/dist/mcp/tools/compile.d.ts +1 -1
  85. package/dist/mcp/tools/compile.js +100 -9
  86. package/dist/mcp/tools/editor-handoff.d.ts +4 -1
  87. package/dist/mcp/tools/editor-handoff.js +6 -3
  88. package/dist/mcp/tools/style-pack.d.ts +11 -0
  89. package/dist/mcp/tools/style-pack.js +245 -0
  90. package/dist/mcp/tools/tool-group.d.ts +9 -0
  91. package/dist/mods/button-hotkeys.d.ts +45 -0
  92. package/dist/mods/button-hotkeys.js +185 -0
  93. package/dist/mods/compile-mod.js +19 -5
  94. package/dist/mods/custom-doodads.d.ts +21 -1
  95. package/dist/mods/custom-doodads.js +53 -7
  96. package/dist/mods/data-rules.js +8 -1
  97. package/dist/mods/effective-entry.d.ts +18 -0
  98. package/dist/mods/effective-entry.js +52 -0
  99. package/dist/mods/function-search.js +12 -0
  100. package/dist/mods/library-xml.d.ts +34 -5
  101. package/dist/mods/library-xml.js +94 -22
  102. package/dist/mods/sound-mix.d.ts +92 -0
  103. package/dist/mods/sound-mix.js +195 -0
  104. package/dist/plugins/check-workspace.js +22 -3
  105. package/dist/plugins/plugin-api.d.ts +59 -5
  106. package/dist/plugins/plugin-api.js +6 -0
  107. package/dist/plugins/plugin-sdk.d.ts +13 -1
  108. package/dist/plugins/plugin-sdk.js +16 -1
  109. package/dist/plugins/plugin-sources.js +1 -0
  110. package/dist/plugins/registry.d.ts +4 -0
  111. package/dist/plugins/registry.js +6 -2
  112. package/dist/plugins/workspace.d.ts +5 -0
  113. package/dist/plugins/workspace.js +10 -2
  114. package/dist/study/blizzard-baseline.d.ts +76 -0
  115. package/dist/study/blizzard-baseline.js +137 -0
  116. package/dist/study/exemplar-report.d.ts +71 -0
  117. package/dist/study/exemplar-report.js +163 -0
  118. package/dist/study/find-places.d.ts +127 -0
  119. package/dist/study/find-places.js +306 -0
  120. package/dist/study/load-map-package.d.ts +3 -0
  121. package/dist/study/load-map-package.js +11 -0
  122. package/dist/study/map-study.d.ts +1 -0
  123. package/dist/study/map-study.js +3 -0
  124. package/dist/study/measure-lighting.d.ts +6 -0
  125. package/dist/study/measure-lighting.js +1 -1
  126. package/dist/study/measures.d.ts +225 -0
  127. package/dist/study/measures.js +366 -0
  128. package/dist/study/scaffold-style-pack.d.ts +58 -0
  129. package/dist/study/scaffold-style-pack.js +261 -0
  130. package/dist/study/study-exemplars.d.ts +67 -0
  131. package/dist/study/study-exemplars.js +133 -0
  132. package/dist/triggers/blueprint-triggers.d.ts +71 -11
  133. package/dist/triggers/blueprint-triggers.js +403 -48
  134. package/dist/triggers/kept-trigger-galaxy.d.ts +29 -0
  135. package/dist/triggers/kept-trigger-galaxy.js +103 -7
  136. package/dist/triggers/splice-map-script.d.ts +2 -0
  137. package/dist/triggers/splice-map-script.js +309 -8
  138. package/dist/triggers/write-triggers-xml.js +20 -5
  139. package/dist/ui/frame-path-check.d.ts +43 -4
  140. package/dist/ui/frame-path-check.js +121 -13
  141. package/dist/ui/frame-paths.d.ts +21 -1
  142. package/dist/ui/frame-paths.js +26 -6
  143. package/dist/ui/toast.d.ts +4 -5
  144. package/dist/ui/toast.js +6 -10
  145. package/examples/example-campaign/README.md +27 -0
  146. package/examples/example-campaign/missions/ashfall-relay/blueprint.json +11 -1
  147. package/examples/example-campaign/missions/ashfall-relay/triggers/ash-tremors.json +69 -0
  148. package/examples/example-campaign/missions/ashfall-relay/triggers/start-ash-tremors.json +31 -0
  149. package/package.json +3 -3
@@ -0,0 +1,67 @@
1
+ import type { Host } from "../host/host.js";
2
+ import type { Workspace } from "../plugins/workspace.js";
3
+ import { type ExemplarOptions } from "../study/study-exemplars.js";
4
+ import { type ExemplarTour, type ExemplarTourOutcome } from "./exemplar-capture.js";
5
+ /** Place tours, a frame centred on each of the pack's places; or grid tours over each map's playable area. */
6
+ export type TourKind = "places" | "grid";
7
+ export type PlannedTours = {
8
+ readonly tours: readonly ExemplarTour[];
9
+ /** With place tours: the maps the pack's mixtures list no places of, which get no tour. */
10
+ readonly withoutPlaces: readonly string[];
11
+ };
12
+ /**
13
+ * The tours of each Exemplar Map `ids` names (every one when not given): with "places", one frame
14
+ * centred on each place the pack's mixtures list (`placeTours`); with "grid", one tour per lighting
15
+ * the map's study lists, or its captureLights (`gridTours`). Refused, before anything runs, for an
16
+ * id the pack doesn't list, a missing source map, a map with no study where the plan reads it, or
17
+ * place tours when the pack has no places yet.
18
+ */
19
+ export declare function planStylePackTours(workspace: Workspace, options: ExemplarOptions & {
20
+ readonly tours: TourKind;
21
+ }): Promise<PlannedTours>;
22
+ export type CaptureStylePackOptions = ExemplarOptions & {
23
+ readonly tours: TourKind;
24
+ /** Where the tours go; `exemplarCaptureDir` by default. */
25
+ readonly captureDir?: string;
26
+ readonly startOnInit?: boolean;
27
+ readonly showErrors?: boolean;
28
+ readonly log?: (line: string) => void;
29
+ /** Hears the broker's id for each tour as it is queued. */
30
+ readonly onQueued?: (id: string) => void;
31
+ /** Cancels the tour running or waiting, and the tours after it. */
32
+ readonly signal?: AbortSignal;
33
+ };
34
+ export type CaptureStylePackResult = PlannedTours & {
35
+ readonly captureDir: string;
36
+ readonly outcomes: readonly ExemplarTourOutcome[];
37
+ readonly frames: MakeFramesResult;
38
+ };
39
+ /**
40
+ * Plans the tours (`planStylePackTours`), captures each that has no frames yet, so a rerun
41
+ * resumes, then makes their 1000px frames (`makeFrames`).
42
+ */
43
+ export declare function captureStylePack(workspace: Workspace, host: Host, options: CaptureStylePackOptions): Promise<CaptureStylePackResult>;
44
+ /** The rules a pack's Exemplar Maps folder needs so tours and their frames are never committed. */
45
+ export declare const CAPTURE_IGNORES: readonly ["*/captures/", "*/frames/"];
46
+ /** Adds `*\/captures/` and `*\/frames/` to the .gitignore in `dir`, where it lacks them. */
47
+ export declare function ignoreCaptures(dir: string): Promise<void>;
48
+ export type MakeFramesResult = {
49
+ readonly made: number;
50
+ readonly removed: number;
51
+ /** The frames under `<id>/frames/` afterwards, of the maps it worked on. */
52
+ readonly kept: number;
53
+ /** Captures that couldn't be read as images, relative to the capture folder: a tour cut short, say. */
54
+ readonly unreadable: readonly string[];
55
+ };
56
+ /**
57
+ * Makes the 1000px copies (JPEG quality 75) of the tours under `captureDir`, in
58
+ * `<id>/frames/<tour>/`: every frame of every tour, place and grid, so a grid tour's frames are
59
+ * there to read whether or not a place lists them. A frame older than its capture is made again,
60
+ * since a rerun tour overwrites its captures. stops.txt is copied whole. A frame whose capture is
61
+ * gone from its tour is removed, and so is a tour left without frames, but only where the tour's
62
+ * captures folder is there: a frame with no captures beside it may be the only copy. With `maps`,
63
+ * only those maps' frames are made or removed.
64
+ */
65
+ export declare function makeFrames(captureDir: string, { maps: only }?: {
66
+ readonly maps?: readonly string[];
67
+ }): Promise<MakeFramesResult>;
@@ -0,0 +1,172 @@
1
+ // A Style Pack's exemplar captures (#26): its place and grid tours, planned from its Map Studies
2
+ // and places, captured through the Editor Broker, and the 1000px copies of their frames. What the
3
+ // capture_exemplar tool, `npm run capture-exemplars` and make-frames.sh all call.
4
+ //
5
+ // Tours and frames go to `exemplarCaptureDir`: the pack's Exemplar Maps folder, as
6
+ // `<id>/captures/<tour>/` and `<id>/frames/<tour>/` (git-ignored in a scaffolded pack), or the
7
+ // research archive when SC2_RESEARCH_DIR is set.
8
+ import { existsSync, readFileSync } from "node:fs";
9
+ import { appendFile, copyFile, mkdir, readdir, readFile, rm, stat } from "node:fs/promises";
10
+ import path from "node:path";
11
+ import sharp from "sharp";
12
+ import { exemplarCaptureDir, mixturesFile, selectExemplars } from "../study/study-exemplars.js";
13
+ import { captureExemplarTours, gridTours, placeTours } from "./exemplar-capture.js";
14
+ async function readJson(file) {
15
+ let text;
16
+ try {
17
+ text = await readFile(file, "utf8");
18
+ }
19
+ catch (error) {
20
+ if (error.code === "ENOENT")
21
+ return undefined;
22
+ throw error;
23
+ }
24
+ try {
25
+ return JSON.parse(text);
26
+ }
27
+ catch (error) {
28
+ throw new Error(`${file} isn't valid JSON: ${error instanceof Error ? error.message : String(error)}`);
29
+ }
30
+ }
31
+ /**
32
+ * The tours of each Exemplar Map `ids` names (every one when not given): with "places", one frame
33
+ * centred on each place the pack's mixtures list (`placeTours`); with "grid", one tour per lighting
34
+ * the map's study lists, or its captureLights (`gridTours`). Refused, before anything runs, for an
35
+ * id the pack doesn't list, a missing source map, a map with no study where the plan reads it, or
36
+ * place tours when the pack has no places yet.
37
+ */
38
+ export async function planStylePackTours(workspace, options) {
39
+ const exemplars = await selectExemplars(workspace, options);
40
+ // Read only for the maps whose plan needs it: a grid tour with captureLights doesn't.
41
+ const studyOf = (id) => {
42
+ const file = path.join(exemplars.find((exemplar) => exemplar.id === id).studyDir, "study.json");
43
+ if (!existsSync(file))
44
+ throw new Error(`No Map Study for ${id} (${file}): run study_exemplar on it first`);
45
+ try {
46
+ return JSON.parse(readFileSync(file, "utf8"));
47
+ }
48
+ catch (error) {
49
+ throw new Error(`${file} isn't valid JSON: ${error instanceof Error ? error.message : String(error)}`);
50
+ }
51
+ };
52
+ // Each entry's capture settings (captureLights, placeLight, placeZones) are in its settings.
53
+ const entries = exemplars.map((exemplar) => ({ ...exemplar.settings, id: exemplar.id, path: exemplar.source }));
54
+ if (options.tours === "grid")
55
+ return { tours: gridTours(entries, studyOf), withoutPlaces: [] };
56
+ const file = mixturesFile(workspace);
57
+ const mixtures = await readJson(file);
58
+ if (!mixtures?.places)
59
+ throw new Error(`The Style Pack has no places yet (${file}): run find_places first, or capture grid tours`);
60
+ const ids = new Set(entries.map((entry) => entry.id));
61
+ const chosen = { maps: entries.map((entry) => entry.id), places: mixtures.places.filter((place) => ids.has(place.map)) };
62
+ const withoutPlaces = chosen.maps.filter((id) => !chosen.places.some((place) => place.map === id));
63
+ return { tours: placeTours(entries, chosen, studyOf), withoutPlaces };
64
+ }
65
+ /**
66
+ * Plans the tours (`planStylePackTours`), captures each that has no frames yet, so a rerun
67
+ * resumes, then makes their 1000px frames (`makeFrames`).
68
+ */
69
+ export async function captureStylePack(workspace, host, options) {
70
+ const planned = await planStylePackTours(workspace, options);
71
+ const captureDir = options.captureDir ?? exemplarCaptureDir(workspace);
72
+ // Into the pack's own folder, the screenshots must never be committed with it.
73
+ if (captureDir === path.dirname(mixturesFile(workspace)))
74
+ await ignoreCaptures(captureDir);
75
+ const outcomes = await captureExemplarTours(host, planned.tours, {
76
+ capturesRoot: captureDir,
77
+ ...(options.startOnInit ? { startOnInit: true } : {}),
78
+ ...(options.showErrors ? { showErrors: true } : {}),
79
+ ...(options.log ? { log: options.log } : {}),
80
+ ...(options.onQueued ? { onQueued: options.onQueued } : {}),
81
+ ...(options.signal ? { signal: options.signal } : {}),
82
+ });
83
+ const frames = await makeFrames(captureDir, { maps: [...new Set(planned.tours.map((tour) => tour.id))] });
84
+ return { ...planned, captureDir, outcomes, frames };
85
+ }
86
+ /** The rules a pack's Exemplar Maps folder needs so tours and their frames are never committed. */
87
+ export const CAPTURE_IGNORES = ["*/captures/", "*/frames/"];
88
+ /** Adds `*\/captures/` and `*\/frames/` to the .gitignore in `dir`, where it lacks them. */
89
+ export async function ignoreCaptures(dir) {
90
+ const file = path.join(dir, ".gitignore");
91
+ const text = existsSync(file) ? await readFile(file, "utf8") : "";
92
+ const lines = new Set(text.split("\n").map((line) => line.trim()));
93
+ const missing = CAPTURE_IGNORES.filter((rule) => !lines.has(rule));
94
+ if (!missing.length)
95
+ return;
96
+ const header = text ? "" : "# In-game tours and their 1000px frames (capture_exemplar): never committed.\n";
97
+ await mkdir(dir, { recursive: true });
98
+ await appendFile(file, `${text && !text.endsWith("\n") ? "\n" : ""}${header}${missing.join("\n")}\n`);
99
+ }
100
+ const FRAME_WIDTH = 1000;
101
+ const FRAME_QUALITY = 75;
102
+ const dirsIn = async (dir) => (existsSync(dir) ? (await readdir(dir, { withFileTypes: true })).filter((entry) => entry.isDirectory()).map((entry) => entry.name).sort() : []);
103
+ const jpgsIn = async (dir) => (existsSync(dir) ? (await readdir(dir)).filter((file) => file.endsWith(".jpg")).sort() : []);
104
+ /** `<id>/captures/<tour>/<file>` for `<id>/frames/<tour>/<file>`, and back. */
105
+ const toCaptures = (frame) => frame.replace(/^([^/]+)\/frames\//, "$1/captures/");
106
+ const toFrames = (capture) => capture.replace(/^([^/]+)\/captures\//, "$1/frames/");
107
+ /**
108
+ * Makes the 1000px copies (JPEG quality 75) of the tours under `captureDir`, in
109
+ * `<id>/frames/<tour>/`: every frame of every tour, place and grid, so a grid tour's frames are
110
+ * there to read whether or not a place lists them. A frame older than its capture is made again,
111
+ * since a rerun tour overwrites its captures. stops.txt is copied whole. A frame whose capture is
112
+ * gone from its tour is removed, and so is a tour left without frames, but only where the tour's
113
+ * captures folder is there: a frame with no captures beside it may be the only copy. With `maps`,
114
+ * only those maps' frames are made or removed.
115
+ */
116
+ export async function makeFrames(captureDir, { maps: only } = {}) {
117
+ const maps = (await dirsIn(captureDir)).filter((map) => !only || only.includes(map));
118
+ const wanted = new Set();
119
+ for (const map of maps) {
120
+ for (const tour of await dirsIn(path.join(captureDir, map, "captures"))) {
121
+ for (const file of await jpgsIn(path.join(captureDir, map, "captures", tour)))
122
+ wanted.add(`${map}/frames/${tour}/${file}`);
123
+ }
124
+ }
125
+ let made = 0;
126
+ const unreadable = [];
127
+ for (const frame of [...wanted].sort()) {
128
+ const capture = toCaptures(frame);
129
+ const src = path.join(captureDir, capture);
130
+ const dest = path.join(captureDir, frame);
131
+ if (!existsSync(src))
132
+ continue;
133
+ if (existsSync(dest) && (await stat(src)).mtimeMs <= (await stat(dest)).mtimeMs)
134
+ continue;
135
+ await mkdir(path.dirname(dest), { recursive: true });
136
+ try {
137
+ // From a buffer: sharp opened on a path keeps the file open on Windows, so the capture couldn't be replaced afterwards.
138
+ await sharp(await readFile(src)).resize(FRAME_WIDTH, FRAME_WIDTH, { fit: "inside" }).jpeg({ quality: FRAME_QUALITY }).toFile(dest);
139
+ made++;
140
+ }
141
+ catch {
142
+ unreadable.push(capture);
143
+ }
144
+ }
145
+ let removed = 0;
146
+ let kept = 0;
147
+ for (const map of maps) {
148
+ for (const tour of await dirsIn(path.join(captureDir, map, "captures"))) {
149
+ const stops = path.join(captureDir, map, "captures", tour, "stops.txt");
150
+ const frames = path.join(captureDir, toFrames(`${map}/captures/${tour}`));
151
+ if (existsSync(stops) && existsSync(frames))
152
+ await copyFile(stops, path.join(frames, "stops.txt"));
153
+ }
154
+ for (const tour of await dirsIn(path.join(captureDir, map, "frames"))) {
155
+ const dir = path.join(captureDir, map, "frames", tour);
156
+ const rebuildable = existsSync(path.join(captureDir, map, "captures", tour));
157
+ let left = 0;
158
+ for (const file of await jpgsIn(dir)) {
159
+ if (rebuildable && !wanted.has(`${map}/frames/${tour}/${file}`)) {
160
+ await rm(path.join(dir, file));
161
+ removed++;
162
+ }
163
+ else
164
+ left++;
165
+ }
166
+ if (left === 0)
167
+ await rm(dir, { recursive: true });
168
+ kept += left;
169
+ }
170
+ }
171
+ return { made, removed, kept, unreadable };
172
+ }
@@ -25,6 +25,14 @@ export declare const gameDoodadModels: () => Iterable<string>;
25
25
  export declare const GAME_MODELS_PATH: string;
26
26
  /** The model paths in a game-models.json; a missing or damaged one is refused, naming it and how to make it again. */
27
27
  export declare function readGameModelPaths(file?: string): string[];
28
+ export declare const GAME_ASSETS_PATH: string;
29
+ /**
30
+ * Whether any of the game's mods names an image (.dds, .tga, .png, .jpg) or model file at
31
+ * `storagePath` (either slash, any case) that isGameModel doesn't know: its catalogs, layouts and
32
+ * asset lists, of every stock mod, the Heroes of the Storm and co-op ones among them
33
+ * (data/game-assets.json, `node scripts/build-game-assets.mjs`). A texture only a model names isn't in it.
34
+ */
35
+ export declare function isGameAsset(storagePath: string): boolean;
28
36
  /** The CModel ids of every model in the set catalogue's sets (data/cinematic-sets/catalog.json), once each, sorted: a piece named by file alone has none. */
29
37
  export declare function setCatalogModelIds(): string[];
30
38
  /**
@@ -82,6 +82,19 @@ export function readGameModelPaths(file = GAME_MODELS_PATH) {
82
82
  throw new Error(`${file} can't be read (it isn't a list of model paths): ${again}`);
83
83
  return paths;
84
84
  }
85
+ // --- The game's other asset files (data/game-assets.json) ---
86
+ export const GAME_ASSETS_PATH = path.join(CORE_DATA_DIR, "game-assets.json");
87
+ let gameAssets;
88
+ /**
89
+ * Whether any of the game's mods names an image (.dds, .tga, .png, .jpg) or model file at
90
+ * `storagePath` (either slash, any case) that isGameModel doesn't know: its catalogs, layouts and
91
+ * asset lists, of every stock mod, the Heroes of the Storm and co-op ones among them
92
+ * (data/game-assets.json, `node scripts/build-game-assets.mjs`). A texture only a model names isn't in it.
93
+ */
94
+ export function isGameAsset(storagePath) {
95
+ gameAssets ??= new Set(JSON.parse(readFileSync(GAME_ASSETS_PATH, "utf8")).map(comparable));
96
+ return gameAssets.has(comparable(storagePath));
97
+ }
85
98
  /** The CModel ids of every model in the set catalogue's sets (data/cinematic-sets/catalog.json), once each, sorted: a piece named by file alone has none. */
86
99
  export function setCatalogModelIds() {
87
100
  const { sets } = JSON.parse(readFileSync(SET_CATALOG_PATH, "utf8"));
@@ -1,27 +1,23 @@
1
1
  // Captures camera tours of the active Style Pack's Exemplar Maps (the Workspace config's
2
2
  // `stylePack`, found above the current folder) through this machine's Host Adapter
3
- // (editor.captureTour), into <id>/captures/<tour>/ in the research archive ($SC2_RESEARCH_DIR,
4
- // which must be set). Source maps come from the folder the machine config's
5
- // `exemplarMaps` names, as for `npm run study`. Grid tours run once per lighting each map's
6
- // triggers use (its Map Study's lighting.lightsUsed, or the exemplar's captureLights); --places
7
- // runs place tours instead, one frame per dressed place in the pack's mixtures.json. Tours that
8
- // already have frames are skipped, so reruns resume. Capture copies are built in the machine
9
- // config's cacheDir.
3
+ // (editor.captureTour), then makes their 1000px frames: what the capture_exemplar tool does
4
+ // (captureStylePack), from the command line. Tours go to the pack's exemplar-maps/<id>/captures/<tour>/,
5
+ // or under $SC2_RESEARCH_DIR/docs/research/exemplar-maps/ when it is set, as for the Antioch pack.
6
+ // Grid tours run once per lighting each map's triggers use (its Map Study's lighting.lightsUsed,
7
+ // or the exemplar's captureLights); --places runs place tours instead, one frame per dressed place
8
+ // in the pack's mixtures.json. Tours that already have frames are skipped, so reruns resume.
9
+ // Capture copies are built in the machine config's cacheDir.
10
10
  //
11
11
  // npm run capture-exemplars -- [--places] [--start-on-init] [--show-errors] [id ...]
12
- // scripts/exemplar-capture/make-frames.sh # then the 1000px copies, beside the captures
13
12
  //
14
13
  // The macOS Host Adapter needs the Editor (`editorPath`) with its Test Document window mode set to
15
14
  // Windowed, Accessibility and Screen Recording for the app running this, and the screen awake.
16
- import { readFileSync } from "node:fs";
17
15
  import path from "node:path";
18
16
  import { parseArgs } from "node:util";
19
- import { captureExemplarTours, gridTours, placeTours } from "../capture/exemplar-capture.js";
20
- import { researchArchiveDir } from "../capture/research-archive.js";
17
+ import { captureStylePack } from "../capture/style-pack-captures.js";
21
18
  import { loadHost } from "../host/host.js";
22
19
  import { loadMachineConfig } from "../host/machine-config.js";
23
- import { exemplarMapSources, stylePackFiles, WORKSPACE_FILE, workspaceFor } from "../plugins/workspace.js";
24
- const readJson = (file) => JSON.parse(readFileSync(file, "utf8"));
20
+ import { WORKSPACE_FILE, workspaceFor } from "../plugins/workspace.js";
25
21
  async function main() {
26
22
  const { values, positionals } = parseArgs({
27
23
  allowPositionals: true,
@@ -29,29 +25,19 @@ async function main() {
29
25
  });
30
26
  const host = await loadHost(await loadMachineConfig());
31
27
  const workspace = await workspaceFor(path.join(process.cwd(), WORKSPACE_FILE));
32
- const sources = await exemplarMapSources(workspace, host.machine);
33
- // Each entry's capture settings (captureLights, placeLight, placeZones) are in its settings.
34
- const exemplars = sources.map((exemplar) => ({ ...exemplar.settings, id: exemplar.id, path: exemplar.source }));
35
- const studyDirs = new Map(sources.map((exemplar) => [exemplar.id, exemplar.studyDir]));
36
- const studyOf = (id) => readJson(path.join(studyDirs.get(id), "study.json"));
37
- const mixtures = () => {
38
- const { exemplarDir } = stylePackFiles(workspace);
39
- if (!exemplarDir)
40
- throw new Error("The Workspace's Style Pack lists no Exemplar Maps (contributions.exemplarMaps)");
41
- return readJson(path.join(exemplarDir, "mixtures.json"));
42
- };
43
- const planned = values.places ? placeTours(exemplars, mixtures(), studyOf) : gridTours(exemplars, studyOf);
44
- const wanted = new Set(positionals);
45
- const tours = planned.filter((tour) => wanted.size === 0 || wanted.has(tour.id));
46
- // Full-size captures go to the research archive (README "Research archive"), not the repo.
47
- const capturesRoot = path.join(researchArchiveDir(), "docs/research/exemplar-maps");
48
- const outcomes = await captureExemplarTours(host, tours, {
49
- capturesRoot,
28
+ const result = await captureStylePack(workspace, host, {
29
+ tours: values.places ? "places" : "grid",
30
+ ...(positionals.length ? { ids: positionals } : {}),
31
+ machine: host.machine,
50
32
  startOnInit: values["start-on-init"],
51
33
  showErrors: values["show-errors"],
52
34
  log: (line) => console.log(`[${new Date().toTimeString().slice(0, 8)}] ${line}`),
53
35
  });
54
- if (outcomes.some((outcome) => outcome.outcome !== "done" && outcome.outcome !== "already captured"))
36
+ const { made, removed, kept, unreadable } = result.frames;
37
+ console.log(`frames: made ${made}, removed ${removed}, kept ${kept}${unreadable.length ? `; unreadable: ${unreadable.join(", ")}` : ""}`);
38
+ if (result.withoutPlaces.length)
39
+ console.log(`no places for ${result.withoutPlaces.join(", ")}`);
40
+ if (unreadable.length || result.outcomes.some((outcome) => outcome.outcome !== "done" && outcome.outcome !== "already captured"))
55
41
  process.exitCode = 1;
56
42
  }
57
43
  main().catch((error) => {
@@ -0,0 +1,2 @@
1
+ /** The base map: 256 × 256 of flat built floor, so a far camera still sees only floor, the pad at its centre. */
2
+ export declare function effectTourBlueprint(campaignId: string): Record<string, unknown>;