forked from ceifa/steamworks.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclient.d.ts
301 lines (301 loc) · 10.2 KB
/
client.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
export function init(appId?: number | undefined | null): void
export function restartAppIfNecessary(appId: number): boolean
export function runCallbacks(): void
export interface PlayerSteamId {
steamId64: bigint
steamId32: string
accountId: number
}
export namespace achievement {
export function activate(achievement: string): boolean
export function isActivated(achievement: string): boolean
export function clear(achievement: string): boolean
}
export namespace apps {
export function isSubscribedApp(appId: number): boolean
export function isAppInstalled(appId: number): boolean
export function isDlcInstalled(appId: number): boolean
export function isSubscribedFromFreeWeekend(): boolean
export function isVacBanned(): boolean
export function isCybercafe(): boolean
export function isLowViolence(): boolean
export function isSubscribed(): boolean
export function appBuildId(): number
export function appInstallDir(appId: number): string
export function appOwner(): PlayerSteamId
export function availableGameLanguages(): Array<string>
export function currentGameLanguage(): string
export function currentBetaName(): string | null
}
export namespace auth {
/** @param timeoutSeconds - The number of seconds to wait for the ticket to be validated. Default value is 10 seconds. */
export function getSessionTicket(timeoutSeconds?: number | undefined | null): Promise<Ticket>
export class Ticket {
cancel(): void
getBytes(): Buffer
}
}
export namespace callback {
export const enum SteamCallback {
PersonaStateChange = 0,
SteamServersConnected = 1,
SteamServersDisconnected = 2,
SteamServerConnectFailure = 3,
LobbyDataUpdate = 4,
LobbyChatUpdate = 5,
P2PSessionRequest = 6,
P2PSessionConnectFail = 7,
GameLobbyJoinRequested = 8,
MicroTxnAuthorizationResponse = 9
}
export function register<C extends keyof import('./callbacks').CallbackReturns>(steamCallback: C, handler: (value: import('./callbacks').CallbackReturns[C]) => void): Handle
export class Handle {
disconnect(): void
}
}
export namespace cloud {
export function isEnabledForAccount(): boolean
export function isEnabledForApp(): boolean
export function readFile(name: string): string
export function writeFile(name: string, content: string): boolean
export function deleteFile(name: string): boolean
export function fileExists(name: string): boolean
}
export namespace input {
export interface AnalogActionVector {
x: number
y: number
}
export function init(): void
export function getControllers(): Array<Controller>
export function getActionSet(actionSetName: string): bigint
export function getDigitalAction(actionName: string): bigint
export function getAnalogAction(actionName: string): bigint
export function shutdown(): void
export class Controller {
activateActionSet(actionSetHandle: bigint): void
isDigitalActionPressed(actionHandle: bigint): boolean
getAnalogActionVector(actionHandle: bigint): AnalogActionVector
}
}
export namespace localplayer {
export function getSteamId(): PlayerSteamId
export function getName(): string
export function getLevel(): number
/** @returns the 2 digit ISO 3166-1-alpha-2 format country code which client is running in, e.g. "US" or "UK". */
export function getIpCountry(): string
export function setRichPresence(key: string, value?: string | undefined | null): void
}
export namespace matchmaking {
export const enum LobbyType {
Private = 0,
FriendsOnly = 1,
Public = 2,
Invisible = 3
}
export function createLobby(lobbyType: LobbyType, maxMembers: number): Promise<Lobby>
export function joinLobby(lobbyId: bigint): Promise<Lobby>
export function getLobbies(): Promise<Array<Lobby>>
export class Lobby {
id: bigint
join(): Promise<Lobby>
leave(): void
openInviteDialog(): void
getMemberCount(): bigint
getMemberLimit(): bigint | null
getMembers(): Array<PlayerSteamId>
getOwner(): PlayerSteamId
setJoinable(joinable: boolean): boolean
getData(key: string): string | null
setData(key: string, value: string): boolean
deleteData(key: string): boolean
/** Get an object containing all the lobby data */
getFullData(): Record<string, string>
/**
* Merge current lobby data with provided data in a single batch
* @returns true if all data was set successfully
*/
mergeFullData(data: Record<string, string>): boolean
}
}
export namespace networking {
export interface P2PPacket {
data: Buffer
size: number
steamId: PlayerSteamId
}
/** The method used to send a packet */
export const enum SendType {
/**
* Send the packet directly over udp.
*
* Can't be larger than 1200 bytes
*/
Unreliable = 0,
/**
* Like `Unreliable` but doesn't buffer packets
* sent before the connection has started.
*/
UnreliableNoDelay = 1,
/**
* Reliable packet sending.
*
* Can't be larger than 1 megabyte.
*/
Reliable = 2,
/**
* Like `Reliable` but applies the nagle
* algorithm to packets being sent
*/
ReliableWithBuffering = 3
}
export function sendP2PPacket(steamId64: bigint, sendType: SendType, data: Buffer): boolean
export function isP2PPacketAvailable(): number
export function readP2PPacket(size: number): P2PPacket
export function acceptP2PSession(steamId64: bigint): void
}
export namespace overlay {
export const enum Dialog {
Friends = 0,
Community = 1,
Players = 2,
Settings = 3,
OfficialGameGroup = 4,
Stats = 5,
Achievements = 6
}
export const enum StoreFlag {
None = 0,
AddToCart = 1,
AddToCartAndShow = 2
}
export function activateDialog(dialog: Dialog): void
export function activateDialogToUser(dialog: Dialog, steamId64: bigint): void
export function activateInviteDialog(lobbyId: bigint): void
export function activateToWebPage(url: string): void
export function activateToStore(appId: number, flag: StoreFlag): void
}
export namespace stats {
export function getInt(name: string): number | null
export function setInt(name: string, value: number): boolean
export function store(): boolean
export function resetAll(achievementsToo: boolean): boolean
}
export namespace utils {
export function getAppId(): number
export function getServerRealTime(): number
export function isSteamRunningOnSteamDeck(): boolean
}
export namespace workshop {
export interface UgcResult {
itemId: bigint
needsToAcceptAgreement: boolean
}
export const enum UgcItemVisibility {
Public = 0,
FriendsOnly = 1,
Private = 2,
Unlisted = 3
}
export interface UgcUpdate {
title?: string
description?: string
changeNote?: string
previewPath?: string
contentPath?: string
tags?: Array<string>
visibility?: UgcItemVisibility
}
export interface InstallInfo {
folder: string
sizeOnDisk: bigint
timestamp: number
}
export interface DownloadInfo {
current: bigint
total: bigint
}
export function createItem(appId?: number | undefined | null): Promise<UgcResult>
export function updateItem(itemId: bigint, updateDetails: UgcUpdate, appId?: number | undefined | null): Promise<UgcResult>
/**
* Subscribe to a workshop item. It will be downloaded and installed as soon as possible.
*
* {@link https://partner.steamgames.com/doc/api/ISteamUGC#SubscribeItem}
*/
export function subscribe(itemId: bigint): Promise<void>
/**
* Unsubscribe from a workshop item. This will result in the item being removed after the game quits.
*
* {@link https://partner.steamgames.com/doc/api/ISteamUGC#UnsubscribeItem}
*/
export function unsubscribe(itemId: bigint): Promise<void>
/**
* Gets the current state of a workshop item on this client. States can be combined.
*
* @returns a number with the current item state, e.g. 9
* 9 = 1 (The current user is subscribed to this item) + 8 (The item needs an update)
*
* {@link https://partner.steamgames.com/doc/api/ISteamUGC#GetItemState}
* {@link https://partner.steamgames.com/doc/api/ISteamUGC#EItemState}
*/
export function state(itemId: bigint): number
/**
* Gets info about currently installed content on the disc for workshop item.
*
* @returns an object with the the properties {folder, size_on_disk, timestamp}
*
* {@link https://partner.steamgames.com/doc/api/ISteamUGC#GetItemInstallInfo}
*/
export function installInfo(itemId: bigint): InstallInfo | null
/**
* Get info about a pending download of a workshop item.
*
* @returns an object with the properties {current, total}
*
* {@link https://partner.steamgames.com/doc/api/ISteamUGC#GetItemDownloadInfo}
*/
export function downloadInfo(itemId: bigint): DownloadInfo | null
/**
* Download or update a workshop item.
*
* @param highPriority - If high priority is true, start the download in high priority mode, pausing any existing in-progress Steam downloads and immediately begin downloading this workshop item.
* @returns true or false
*
* {@link https://partner.steamgames.com/doc/api/ISteamUGC#DownloadItem}
*/
export function download(itemId: bigint, highPriority: boolean): boolean
/**
* Get all subscribed workshop items.
* @returns an array of subscribed workshop item ids
*/
export function getSubscribedItems(): Array<bigint>
export interface WorkshopItem {
publishedFileId: bigint
creatorAppId?: number
consumerAppId?: number
title: string
description: string
owner: PlayerSteamId
/** Time created in unix epoch seconds format */
timeCreated: number
/** Time updated in unix epoch seconds format */
timeUpdated: number
banned: boolean
acceptedForUse: boolean
tags: Array<string>
tagsTruncated: boolean
url: string
numUpvotes: number
numDownvotes: number
numChildren: number
previewUrl?: string
}
export interface WorkshopItemQuery {
cachedResponseMaxAge?: number
includeMetadata?: boolean
includeLongDescription?: boolean
language?: string
}
export function getItem(item: bigint, query?: WorkshopItemQuery | undefined | null): Promise<WorkshopItem | null>
export function getItems(items: Array<bigint>, query?: WorkshopItemQuery | undefined | null): Promise<Array<WorkshopItem | undefined | null>>
}