@hotbunny/hackhub-content-sdk 0.1.1 → 0.3.0
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.
- package/index.d.ts +116 -13
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -68,6 +68,10 @@ export interface CommandDefinition {
|
|
|
68
68
|
packageName?: string;
|
|
69
69
|
autocomplete?: CommandAutoComplete[];
|
|
70
70
|
}
|
|
71
|
+
export interface ParsedFlags {
|
|
72
|
+
flags: Record<string, string | boolean>;
|
|
73
|
+
positional: string[];
|
|
74
|
+
}
|
|
71
75
|
export interface CommandTools {
|
|
72
76
|
println(text: string): void;
|
|
73
77
|
printError(text: string): void;
|
|
@@ -80,11 +84,29 @@ export interface CommandTools {
|
|
|
80
84
|
isLocked(): boolean;
|
|
81
85
|
lock(): void;
|
|
82
86
|
unlock(): void;
|
|
87
|
+
/** Print a formatted ASCII table. */
|
|
88
|
+
printTable(headers: string[], rows: string[][]): void;
|
|
89
|
+
/** Print a success message (green). */
|
|
90
|
+
printSuccess(text: string): void;
|
|
91
|
+
/** Print a warning message (yellow). */
|
|
92
|
+
printWarning(text: string): void;
|
|
93
|
+
/** Print an info message (cyan). */
|
|
94
|
+
printInfo(text: string): void;
|
|
95
|
+
/** Parse args into flags and positional arguments. */
|
|
96
|
+
parseFlags(): ParsedFlags;
|
|
83
97
|
}
|
|
84
98
|
export interface AppSize {
|
|
85
99
|
width: number;
|
|
86
100
|
height: number;
|
|
87
101
|
}
|
|
102
|
+
/** App Store listing definition for mod apps. */
|
|
103
|
+
export interface AppStoreDefinition {
|
|
104
|
+
title: string;
|
|
105
|
+
ratings: number;
|
|
106
|
+
description: string;
|
|
107
|
+
/** Price in dollars. Omit for free apps. */
|
|
108
|
+
price?: number;
|
|
109
|
+
}
|
|
88
110
|
export interface AppDefinition {
|
|
89
111
|
name: string;
|
|
90
112
|
title: string;
|
|
@@ -96,12 +118,67 @@ export interface AppDefinition {
|
|
|
96
118
|
maxOpen?: number;
|
|
97
119
|
disableMaximize?: boolean;
|
|
98
120
|
disableMinimize?: boolean;
|
|
99
|
-
store?:
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
121
|
+
store?: AppStoreDefinition;
|
|
122
|
+
}
|
|
123
|
+
/** Twotter account that gets registered with the game for quest use. */
|
|
124
|
+
export interface TwotterAccountDefinition {
|
|
125
|
+
id: string;
|
|
126
|
+
username: string;
|
|
127
|
+
displayName: string;
|
|
128
|
+
avatar: string;
|
|
129
|
+
bio?: string;
|
|
130
|
+
followers?: number;
|
|
131
|
+
following?: number;
|
|
132
|
+
verified?: boolean;
|
|
133
|
+
}
|
|
134
|
+
/** A tweet posted by a Twotter account during a quest. */
|
|
135
|
+
export interface TweetDefinition {
|
|
136
|
+
/** Must match a TwotterAccountDefinition.id from TwotterAccounts. */
|
|
137
|
+
accountId: string;
|
|
138
|
+
content: string;
|
|
139
|
+
image?: string;
|
|
140
|
+
likes?: number;
|
|
141
|
+
comments?: number;
|
|
142
|
+
shares?: number;
|
|
143
|
+
views?: number;
|
|
144
|
+
/** How long ago the tweet was posted, e.g. "2 days", "1 month". */
|
|
145
|
+
postedAgo?: string;
|
|
146
|
+
}
|
|
147
|
+
/** A Kisscord conversation chain attached to a quest. */
|
|
148
|
+
export interface KisscordChatDefinition {
|
|
149
|
+
/** The Kisscord user ID to chat with (NPC). */
|
|
150
|
+
contactId: string;
|
|
151
|
+
/** Ordered list of messages. The chain follows array order automatically. */
|
|
152
|
+
messages: KisscordMessageDefinition[];
|
|
153
|
+
}
|
|
154
|
+
/** A single Kisscord message in a chat chain. */
|
|
155
|
+
export interface KisscordMessageDefinition {
|
|
156
|
+
content: string;
|
|
157
|
+
/** True if the player sends this message. Defaults to false (NPC). */
|
|
158
|
+
isMine?: boolean;
|
|
159
|
+
/** Delay in ms before this NPC message appears. */
|
|
160
|
+
delayMs?: number;
|
|
161
|
+
/** Callback fired after this message is sent/received. */
|
|
162
|
+
onSent?: () => void | Promise<void>;
|
|
163
|
+
}
|
|
164
|
+
/** A WeeChat (IRC) conversation chain attached to a quest. */
|
|
165
|
+
export interface WeeChatChatDefinition {
|
|
166
|
+
/** The IRC server host. */
|
|
167
|
+
host: string;
|
|
168
|
+
/** Ordered list of messages. */
|
|
169
|
+
messages: WeeChatMessageDefinition[];
|
|
170
|
+
}
|
|
171
|
+
/** A single WeeChat message in a chain. */
|
|
172
|
+
export interface WeeChatMessageDefinition {
|
|
173
|
+
content: string;
|
|
174
|
+
/** Username for NPC messages. Player username auto-filled if isMine. */
|
|
175
|
+
username?: string;
|
|
176
|
+
/** True if the player sends this message. */
|
|
177
|
+
isMine?: boolean;
|
|
178
|
+
/** Delay in ms before this NPC message appears. */
|
|
179
|
+
delayMs?: number;
|
|
180
|
+
/** Callback fired after this message is sent. */
|
|
181
|
+
onSent?: () => void | Promise<void>;
|
|
105
182
|
}
|
|
106
183
|
/**
|
|
107
184
|
* Game events that mods can listen to.
|
|
@@ -630,7 +707,7 @@ export interface ModManifest {
|
|
|
630
707
|
version: string;
|
|
631
708
|
author: string;
|
|
632
709
|
description: string;
|
|
633
|
-
|
|
710
|
+
apiVersion?: number;
|
|
634
711
|
dependencies?: string[];
|
|
635
712
|
permissions?: ModPermission[];
|
|
636
713
|
icon?: string;
|
|
@@ -809,6 +886,14 @@ export declare abstract class Quest {
|
|
|
809
886
|
MaxClaimPerDay?: number;
|
|
810
887
|
Abandonable?: boolean;
|
|
811
888
|
HasCompleteButton?: boolean;
|
|
889
|
+
/** Twotter accounts to register when this quest loads. */
|
|
890
|
+
TwotterAccounts?: TwotterAccountDefinition[];
|
|
891
|
+
/** Tweets to post when the quest starts. */
|
|
892
|
+
Tweets?: TweetDefinition[];
|
|
893
|
+
/** Kisscord chat chains for this quest. */
|
|
894
|
+
KisscordChats?: KisscordChatDefinition[];
|
|
895
|
+
/** WeeChat (IRC) chat chains for this quest. */
|
|
896
|
+
WeeChatChats?: WeeChatChatDefinition[];
|
|
812
897
|
/**
|
|
813
898
|
* Called when the quest is first claimed/started.
|
|
814
899
|
* Use this to set up event listeners for objective completion.
|
|
@@ -931,12 +1016,10 @@ export declare abstract class App {
|
|
|
931
1016
|
MaxOpen?: number;
|
|
932
1017
|
DisableMaximize?: boolean;
|
|
933
1018
|
DisableMinimize?: boolean;
|
|
934
|
-
Store
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
price?: number;
|
|
939
|
-
};
|
|
1019
|
+
/** App Store listing. If provided, the app appears in the AppStore. */
|
|
1020
|
+
Store?: AppStoreDefinition;
|
|
1021
|
+
/** If true, the app is unlocked in the AppStore by default (no quest required). */
|
|
1022
|
+
Unlocked?: boolean;
|
|
940
1023
|
}
|
|
941
1024
|
/**
|
|
942
1025
|
* Game events API. Allows mods to listen to in-game events
|
|
@@ -1314,6 +1397,26 @@ export declare namespace Shell {
|
|
|
1314
1397
|
export function getInstalledPackages(): string[];
|
|
1315
1398
|
/** Check if a specific package is installed. */
|
|
1316
1399
|
export function isPackageInstalled(pkg: string): boolean;
|
|
1400
|
+
/**
|
|
1401
|
+
* Add response data for a built-in terminal command.
|
|
1402
|
+
* When a player runs `command input`, the game returns this data.
|
|
1403
|
+
*
|
|
1404
|
+
* @example
|
|
1405
|
+
* ```ts
|
|
1406
|
+
* Shell.addCommandData("nmap", "10.0.0.1", [
|
|
1407
|
+
* { port: 22, service: "ssh", status: "OPEN", version: "OpenSSH 8.9" }
|
|
1408
|
+
* ]);
|
|
1409
|
+
* Shell.addCommandData("whois", "example.com", { registrant: "John Doe" });
|
|
1410
|
+
* ```
|
|
1411
|
+
*/
|
|
1412
|
+
export function addCommandData(command: string, input: any, data: any): void;
|
|
1413
|
+
/**
|
|
1414
|
+
* Remove previously added command data.
|
|
1415
|
+
* Should be called when a quest completes to clean up.
|
|
1416
|
+
*/
|
|
1417
|
+
export function removeCommandData(command: string, input: any): void;
|
|
1418
|
+
/** Get existing command data for a command+input pair. */
|
|
1419
|
+
export function getCommandData(command: string, input: any): any;
|
|
1317
1420
|
export {};
|
|
1318
1421
|
}
|
|
1319
1422
|
/**
|