diff --git a/p2ce/campaign.d.ts b/p2ce/campaign.d.ts index 98cbbb2..6653255 100644 --- a/p2ce/campaign.d.ts +++ b/p2ce/campaign.d.ts @@ -49,15 +49,20 @@ declare namespace CampaignAPI { function IsCampaignActive(): boolean; function FindCampaign(campaign: string): CampaignPair|null; - function GetCampaignMeta(name: string|null): Map; + function GetCampaignMeta(name: string|null): Map|null; function SetActiveCampaign(name: string|null): boolean; function StartCampaign(campaign: string, chapter: string, map: number): boolean; function ContinueCampaign(campaign: string): boolean; function GetCampaignUnlockProgress(campaign: string): number; + + function CampaignHasSaveData(campaign: string|null): boolean; + function MoveToNextMap(): void; } interface GlobalEventNameMap { PanoramaComponent_Campaign_OnActiveCampaignChanged: (campaign: string|null) => void; + PanoramaComponent_Campaign_OnRefreshList: () => void; + PanoramaComponent_Campaign_OnCampaignEvaluationRequested: (campaign: string) => void; } diff --git a/p2ce/caption.d.ts b/p2ce/caption.d.ts new file mode 100644 index 0000000..d681222 --- /dev/null +++ b/p2ce/caption.d.ts @@ -0,0 +1,31 @@ +/** + * @packageDocumentation + * Captioning Interface + */ + +interface Caption { + bLowPriority: boolean; + bSFX: boolean; + flNoRepeat: number; + flDelay: number; + flLifetimeOverride: number; + text: string; + options: Map; +} + +declare enum CloseCaptioningExpiryMethod { + STACK = 0, + INDIVIDUAL = 1 +} + +interface GlobalEventNameMap { + DisplayCaption: (token: string, caption: Caption, lifetime: number, emitTime: number) => void; + BadCaption: (token: string, lifetime: number, emitTime: number) => void; + EndCaption: (token: string) => void; +} + +declare namespace ClosedCaptionsAPI { + function SetMaxCaptionEntries(num: number): void; + function GetAvailableLanguages(): Array; + function SetCaptioningExpiryMethod(method: CloseCaptioningExpiryMethod): void; +} diff --git a/p2ce/workshop.d.ts b/p2ce/workshop.d.ts index 2c18925..05c6a83 100644 --- a/p2ce/workshop.d.ts +++ b/p2ce/workshop.d.ts @@ -10,22 +10,14 @@ * ``` */ -/** @group enum */ -declare enum DownloadState { - UninstallPending = 0, - Uninstalling = 1, - Uninstalled = 2, - - InstallPending = 3, - Installing = 4, - Installed = 5, -} +declare type AddonIndex_t = int32; +declare type PublishedFileId_t = bigint; /** @group enum */ declare enum AddonRating { None = 0, - ThumbsDown = 1, - ThumbsUp = 2, + ThumbsUp = 1, + ThumbsDown = 2, } /** Describes a workshop item. */ @@ -34,13 +26,12 @@ interface AddonMeta { index: number; title: string; description: string; - workshopid: number; + workshopid: PublishedFileId_t; local: boolean; authors: string[]; tags: string[]; - dependencies: {[uuid: string]: { required: boolean }}; votescore: number; flagged: boolean; upvotes: number; @@ -53,21 +44,14 @@ interface AddonMeta { // The standard workshop thumbnail. Exists on all addons. thumb: string; - - // These only exist when the addon is a campaign. - cover?: string; - logo?: string; } -/** A chapter of an addon. */ -interface AddonChapterMeta { - map: string; - title: string; - description: string; - - unlocked: boolean; - thumb: string; - background: string; +interface SteamUGCDetails_t { + m_nPublishedFileId: PublishedFileId_t; + m_rgchTitle: string; + m_rgchDescription: string; + m_rgchPreviewUrl: string; + m_ulSteamIDOwner: uint64_num; } /** [API not finalized] The workshop content API. Exclusive to P2:CE! */ @@ -76,48 +60,41 @@ declare namespace WorkshopAPI { function GetAddonCount(): number; /** Returns the metadata for the addon at the specified index. */ - function GetAddonMeta(index: uint32): AddonMeta; + function GetAddonMeta(index: AddonIndex_t): AddonMeta; /** Sets the subscription state of the addon at the specified index */ - function SetAddonSubscribed(index: uint32, subscribed: boolean): void; + function SetAddonSubscribed(index: AddonIndex_t, subscribed: boolean): void; /** Returns the subscription state of the addon at the specified index. */ - function GetAddonSubscribed(index: uint32): boolean; + function GetAddonSubscribed(index: AddonIndex_t): boolean; /** Sets the enable state of the addon at the specified index */ - function SetAddonEnabled(index: uint32, enabled: boolean): void; + function SetAddonEnabled(index: AddonIndex_t, enabled: boolean): void; /** Returns the enable state of the addon at the specified index. */ - function GetAddonEnabled(index: uint32): boolean; + function GetAddonEnabled(index: AddonIndex_t): boolean; /** Gets the user rating for the given addon. If installed locally, returns AddonRating.None */ - function GetAddonUserRating(index: uint32): AddonRating; + function GetAddonUserRating(index: AddonIndex_t): AddonRating; /** Sets the user rating for the given addon */ - function SetAddonUserRating(index: uint32, rating: AddonRating): void; + function SetAddonUserRating(index: AddonIndex_t, rating: AddonRating): void; /** Enables or disables a set of addons in one fell swoop. Use this if you're planning to enable/disable multiple at once */ - function SetAddonListEnabled(addons: Record): void; + function SetAddonListEnabled(addons: Record): void; /** Returns the content path of an addon at the specified index. */ - function GetAddonNamedPath(index: number): string; + function GetAddonNamedPath(index: AddonIndex_t): string; /** Launched the game from Hammer or using the -workshop_tools launch option */ - function IsWorkshopToolsMode(): string; - - /****** Below here are @TODO items!! *******/ - - /** Returns the index of the addon that owns the specified map, or null if the map is not owned by an addon. */ - function GetAddonByMap(mapname: string): number|null; - - /** Returns the metadata of the maps for the addon at the specified index. */ - function GetAddonChapters(index: uint32): AddonChapterMeta[]; + function IsWorkshopToolsMode(): boolean; - /** Returns the download state of the addon at the specified index. */ - function GetAddonState(index: uint32): DownloadState; + function GetAddonDependencies(index: AddonIndex_t): Array | null; + function GetAddonDependenciesMissing(index: AddonIndex_t): Array | null; + function CreateQueryUGCDetailsRequest(callback: (success: boolean, data: Array | null) => void, workshopIds: Array): boolean; + function GetActiveMountList(): Array; } interface GlobalEventNameMap { - /** Fires when the installation state of an addon is updated. */ - 'WorkshopAddonStateUpdated': (index: uint32, state: DownloadState) => void, + 'PanoramaComponent_Workshop_OnAddonInstalled': (index: AddonIndex_t) => void, } diff --git a/shared/events.d.ts b/shared/events.d.ts index d2984c2..3dcbe8b 100644 --- a/shared/events.d.ts +++ b/shared/events.d.ts @@ -146,7 +146,7 @@ interface GlobalEventNameMap { 'MapLoaded': (mapName: string, isBackgroundMap: boolean) => void, 'MapUnloaded': () => void, 'Cancelled': (sourceID: string, source: PanelEventSource) => void, - 'PopulateLoadingScreen': (mapName: string) => void, + 'PopulateLoadingScreen': (mapName: string, mapGroup: string) => void, 'ApplyVideoSettings': () => void, 'VideoSettingsInit': () => void, 'VideoSettingsResetDefault': () => void, diff --git a/shared/panels.d.ts b/shared/panels.d.ts index aae03d3..702cb0e 100644 --- a/shared/panels.d.ts +++ b/shared/panels.d.ts @@ -454,6 +454,12 @@ declare interface Label extends AbstractPanel<'Label'> { SetLocalizationString(text: string): void; SetProceduralTextThatIPromiseIsLocalizedAndEscaped(text: string, allowDialogVariables: boolean): void; + + /** + * Approximates the height this label would have + * if the passed in text was set, given a pre-determined width. + */ + GetHeightForText(width: number, text: string): number; } declare interface Movie extends AbstractPanel<'Movie'> {