EditorCampaign beta
Class of @v12-engine/editor
export declare class EditorCampaignThe game's campaign (campaign plan EQ8), as its campaign.json says it (CAMPAIGN_FILE, read by the client's defineCampaign({ file })): its chapters, and its missions with their maps, pictures, briefing, loading screen, debrief and difficulty. Found among the game's files (at the top of its folder, or in a folder of it), read and checked, each change a step of the history written into it (a change until the map is saved, Ctrl+S); a mission's map opened in a tab of its own. What the Campaign panel does, in code
A part of the editor, as it gives it (editor.campaign)
The constructor for this class is marked as internal. Third-party code should not call the constructor directly or create subclasses that extend the EditorCampaign class.
Members
addChapter
addChapter(chapter?: Partial<CampaignChapter>): Promise<string>;Adds a chapter, at the end: of a new id (chapter-2). Gives back its id
addMission
addMission(mission?: Partial<CampaignFileMission>, chapter?: string): Promise<string>;Adds a mission, at the end (and in a chapter, by its id): of a new id (mission-2), on the map open now where it has a file of the project's, else the first. Gives back its id
chapterOf
chapterOf(id: string): CampaignChapter | undefined;The chapter a mission is in, by the mission's id: none where no chapter names it
create
create(name?: string): Promise<CampaignFile>;Makes the game's campaign file, where it has none: by the game's id, no missions yet. A step of the history
error
error(): string | undefined;What is wrong with the campaign's file, where it could not be read: none when it reads
file
file(): CampaignFile | undefined;The campaign as its file says it: none until load, or for a game with no campaign.json yet (create)
load
load(text?: string): Promise<CampaignFile | undefined>;Finds the game's campaign.json (the one at the top of its folder, else the first in a folder of it) and reads it, or reads it again (text, after it changed on disk, as files.watch tells it). A file that does not read is left as it was, and what is wrong kept (error). None where the game has none
maps
maps(): Promise<string[]>;The maps a mission can be played on: the game's map files in the project, by name. None without a project
mission
mission(id: string): CampaignFileMission | undefined;A mission of the file, by its id
moveMission
moveMission(from: number, to: number): Promise<void>;Moves a mission to another place in the order they are played in, by their places
openMap
openMap(id: string): Promise<boolean>;Opens a mission's map, by the mission's id, in a tab of its own: the map open now pinned as a tab first, so it is kept as it is (changes and all). Whether it was opened (it is, already, where it is the map open)
path
path(): string;Where the campaign's file is among the game's files: as found by load, else where a new one goes (campaign.json)
putInChapter
putInChapter(mission: string, chapter: string | undefined): Promise<void>;Puts a mission in a chapter, by their ids (none: in none), in the order the missions are played in
removeChapter
removeChapter(id: string): Promise<void>;Takes a chapter away, by its id: its missions stay, in none
removeMission
removeMission(id: string): Promise<void>;Takes a mission away, by its id, from its chapter too
set
set(change: Partial<Omit<CampaignFile, 'missions' | 'chapters'>>, merge?: string): Promise<void>;Sets the campaign's own fields: its id, name, menu words, difficulties. A step of the history
setChapter
setChapter(id: string, change: Partial<Omit<CampaignChapter, 'id' | 'missions'>>, merge?: string): Promise<void>;Sets a chapter's name or picture, by its id. Changes with the same merge key one after another are one step
setMission
setMission(id: string, change: MissionChange, merge?: string): Promise<void>;Sets a mission's fields, by its id: over what it has (undefined takes one out). A new id is the chapters' too. Changes with the same merge key one after another are one step