@hotbunny/hackhub-content-sdk 0.9.7 → 0.9.9

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.
Files changed (2) hide show
  1. package/README.md +77 -10
  2. package/package.json +2 -5
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Hackhub Content SDK
1
+ # @hotbunny/hackhub-content-sdk
2
2
 
3
3
  Official modding SDK for [HackHub - Ultimate Hacker Simulator](https://store.steampowered.com/app/2980270/HackHub__Ultimate_Hacker_Simulator/) on Steam. Create custom quests, websites, terminal commands, desktop apps, and more.
4
4
 
@@ -144,20 +144,54 @@ class StoryQuest extends Quest<{ contacted: boolean }> {
144
144
 
145
145
  ## Websites
146
146
 
147
+ Websites use a `Pages` array. Each page has a `path`, `title`, and an `html` file rendered inside the in-game browser:
148
+
147
149
  ```typescript
148
150
  import { Website, RegisterWebsite } from "@hotbunny/hackhub-content-sdk";
149
151
 
152
+ @RegisterWebsite
153
+ class HackerForum extends Website {
154
+
155
+ SiteName = "Hacker Forum";
156
+ Host = "hackerforum.net";
157
+ Icon = "./assets/forum-icon.png";
158
+ Pages = [
159
+ { path: "/", title: "Home", html: "pages/home.html" },
160
+ { path: "/about", title: "About", html: "pages/about.html" },
161
+ ];
162
+
163
+ }
164
+ ```
165
+
166
+ You can expose TypeScript functions to your HTML pages via `Exports`:
167
+
168
+ ```typescript
150
169
  @RegisterWebsite
151
170
  class MyWebsite extends Website {
152
171
 
153
- SiteName = "darkforum";
154
- DisplayName = "DarkForum";
155
- Description = "Underground hacking forum";
156
- HTML = "website.html";
172
+ SiteName = "My Site";
173
+ Host = "mysite.com";
174
+ Icon = "./assets/icon.png";
175
+ Pages = [
176
+ { path: "/", title: "Home", html: "pages/home.html" },
177
+ ];
178
+
179
+ Exports = {
180
+ formatPost: (text: string) => text.toUpperCase(),
181
+ };
157
182
 
158
183
  }
159
184
  ```
160
185
 
186
+ In your HTML, exported functions are available as globals and SDK APIs via `HackhubSDK`:
187
+
188
+ ```html
189
+ <script>
190
+ const formatted = formatPost("hello");
191
+ HackhubSDK.Mail.send({ to: "user@mail.com", subject: "Hi" });
192
+ </script>
193
+ ```
194
+
161
195
  ## Terminal Commands
162
196
 
163
197
  ```typescript
@@ -169,8 +203,15 @@ class PingCommand extends Command {
169
203
  CommandName = "myping";
170
204
  Description = "Custom ping command";
171
205
 
172
- OnCommand(args: string[], tools: any) {
173
- tools.println(`Pinging ${args[0] || "nowhere"}...`);
206
+ async Run(tools) {
207
+ const args = tools.getArgs();
208
+ if (args.length === 0) {
209
+ tools.printError("Usage: myping <ip>");
210
+ return;
211
+ }
212
+ tools.println(`Pinging ${args[0]}...`);
213
+ await tools.sleep(1000);
214
+ tools.println("Reply received.");
174
215
  }
175
216
 
176
217
  }
@@ -185,10 +226,36 @@ import { App, RegisterApp } from "@hotbunny/hackhub-content-sdk";
185
226
  class MyApp extends App {
186
227
 
187
228
  AppName = "mytool";
188
- DisplayName = "My Tool";
189
- Description = "A custom desktop application";
229
+ Title = "My Tool";
230
+ Icon = "./assets/app-icon.png";
231
+ HTML = "app.html";
232
+ DefaultSize = { width: 600, height: 400 };
233
+
234
+ }
235
+ ```
236
+
237
+ Apps can have an App Store listing and expose functions to HTML, just like websites:
238
+
239
+ ```typescript
240
+ @RegisterApp
241
+ class PasswordGen extends App {
242
+
243
+ AppName = "passgen";
244
+ Title = "Password Generator";
245
+ Icon = "./assets/passgen.png";
190
246
  HTML = "app.html";
191
- Size = { width: 600, height: 400 };
247
+ DefaultSize = { width: 400, height: 300 };
248
+ Unlocked = true;
249
+
250
+ Store = {
251
+ title: "Password Generator",
252
+ ratings: 4.5,
253
+ description: "Generate secure passwords",
254
+ };
255
+
256
+ Exports = {
257
+ generate: (length: number) => Random.password(),
258
+ };
192
259
 
193
260
  }
194
261
  ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hotbunny/hackhub-content-sdk",
3
- "version": "0.9.7",
3
+ "version": "0.9.9",
4
4
  "description": "Official modding SDK for HackHub - Ultimate Hacker Simulator on Steam. Create custom quests, websites, terminal commands, and desktop apps.",
5
5
  "types": "index.d.ts",
6
6
  "exports": {
@@ -29,10 +29,7 @@
29
29
  "typescript",
30
30
  "hotbunny"
31
31
  ],
32
- "repository": {
33
- "type": "git",
34
- "url": "https://github.com/AceKiron/hackhub-content-sdk.git"
35
- },
32
+ "homepage": "https://docs.hotbunny.dev/hackhub/",
36
33
  "author": "HotBunny Interactive Entertainment Inc.",
37
34
  "license": "MIT",
38
35
  "publishConfig": {