scmJS docs

api.gameData

GameDataApi

Which set of game files the editor draws from — the game's own or a mod's — and installing, switching and removing sets.

The game data as a whole: which set of files the editor draws from, and installing, switching and removing sets — the plugin side of Help ▸ Game Data…. What is in the files is data (the tables), tileset (the graphics), graphics (the pictures) and names (the labels, which follow the loaded set: a unit, weapon, upgrade or technology a mod renamed shows its new name, and the rest keep StarEdit's).

A data set is a name over files in the game's own formats; a mod that extends the tables past the game's sizes is not covered. Installing needs the game's two archives every time, since a mod's files are laid over them the way its loader lays them.

Members

source

source(): GameDataSource | null;

The session's source, or null while it is still being resolved at startup.

profile

profile(): GameDataProfile;

The data set in use — the game's own until another is selected.

profiles

profiles(): Promise<GameDataProfile[]>;

Every data set with a copy here, the game's own first.

install

install(profile: GameDataProfile, files: GameDataFiles, progress?: (fraction: number, label: string) => void): Promise<GameDataSource>;

Extract a data set from its files, store it under profile.id and switch to it. The archives must include the game's own two; the promise rejects with the reason when they do not or the extraction fails. progress is 0–1 with a label, as the dialog's bar.

select

select(id: string): Promise<GameDataSource>;

Switch to a data set. Everything decoded from the previous one is dropped and the viewport redraws from the new files; a set with no copy here falls back to the game's own. Resolves with the source in use afterwards.

remove

remove(id: string): Promise<boolean>;

Remove a data set's copy (never the game's bundled files). True when there was one.

read

read(path: string): Promise<Uint8Array | null>;

One file of the data set in use, by its path in the extracted copy: the archive path in lower case with forward slashes (arr/units.dat, tileset/jungle.cv5, unit/zerg/drone.grp). tileset/manifest.json and unit/manifest.json list what was extracted. Null when the copy has no such file, or there is no game data.

Types

Declarations only this group names.

GameDataProfileinterface

interface GameDataProfile

A data set: one set of game files the editor draws from. The default is the game's own; any other is a mod's, installed under an id of its own, the same formats and table sizes with some of the files replaced.

id: string

Lower-case letters, digits and hyphens, up to 40 characters.

name: string

What the dialog and the status line call it.

GameDataSourceinterface

interface GameDataSource

Where the session's game data comes from.

kind: "bundled" | "stored" | "none"

bundled (this build's own files, or the desktop app's extraction), stored (a copy kept in the browser), or none.

label: string

One line, as Help ▸ Game Data… shows it.

profile: GameDataProfile

The data set the files belong to.

desktop: boolean

Set when the desktop app extracted the files from a StarCraft installation.

GameDataBytestype

type GameDataBytes = Blob | Uint8Array;

Bytes for an install: a File / Blob, or already an array.

GameDataFilesinterface

interface GameDataFiles

What a data set is installed from.

archives: readonly { name: string; data: GameDataBytes; }[]

The archives, StarDat.mpq and BrooDat.mpq among them — a mod replaces files, it does not bring the rest. The game's own are read first, then the others in the order given, later ones winning as in the game.

files?: readonly { path: string; data: GameDataBytes; }[]

Loose files by member path (arr/units.dat, unit/terran/marine.grp), read before any archive.

scmJS 0.6.2 + main@dd79a77 · Generated from the repository. The source is under the MIT license, which does not cover what ATTRIBUTION.md lists. StarCraft and Brood War are trademarks of Blizzard Entertainment; this project ships none of their data.