@hotbunny/hackhub-content-sdk 0.1.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.
Files changed (4) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +252 -0
  3. package/index.d.ts +1460 -0
  4. package/package.json +26 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Hot Bunny Games
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,252 @@
1
+ # @hotbunny/hackhub-content-sdk
2
+
3
+ Type definitions and API reference for creating HackHub mods.
4
+
5
+ This package provides **TypeScript types only** -- no runtime code. The game loads your compiled `mod.js` at startup; this package gives you autocompletion and type checking while developing.
6
+
7
+ ## Installation
8
+
9
+ ```bash
10
+ npm install @hotbunny/hackhub-content-sdk --save-dev
11
+ ```
12
+
13
+ ## Mod Structure
14
+
15
+ A HackHub mod is a folder inside the game's `mods/` directory:
16
+
17
+ ```
18
+ mods/
19
+ my-first-mod/
20
+ manifest.json
21
+ mod.js
22
+ ```
23
+
24
+ ### manifest.json
25
+
26
+ ```json
27
+ {
28
+ "id": "my-first-mod",
29
+ "name": "My First Mod",
30
+ "version": "1.0.0",
31
+ "author": "YourName",
32
+ "description": "A simple HackHub mod",
33
+ "entry": "mod.js",
34
+ "permissions": ["network", "files", "events"],
35
+ "dependencies": []
36
+ }
37
+ ```
38
+
39
+ ### Source Code (TypeScript)
40
+
41
+ Write your mod in TypeScript, then compile to a single `mod.js` bundle.
42
+
43
+ ```typescript
44
+ import {
45
+ Bootstrap,
46
+ Quest,
47
+ Events,
48
+ Network,
49
+ RegisterModPackage,
50
+ RegisterQuest,
51
+ } from "@hotbunny/hackhub-content-sdk";
52
+
53
+ @RegisterModPackage()
54
+ class MyMod extends Bootstrap {
55
+ OnModPackageLoaded() {
56
+ console.log("My mod loaded!");
57
+ }
58
+ }
59
+
60
+ @RegisterQuest()
61
+ class MyQuest extends Quest {
62
+ definition = {
63
+ name: "MyQuest",
64
+ title: "My Custom Quest",
65
+ description: "A quest added by a mod.",
66
+ rewards: { money: 100 },
67
+ objectives: [
68
+ {
69
+ name: "scan",
70
+ description: "Scan the target",
71
+ trigger: {
72
+ event: "Terminal.NmapScan",
73
+ condition: (data) => data.ip === "10.0.0.1",
74
+ },
75
+ },
76
+ ],
77
+ };
78
+
79
+ OnStart() {
80
+ Network.createSubnetNetwork({
81
+ ip: "10.0.0.1",
82
+ type: "ROUTER",
83
+ ports: [{ external: 80, internal: 80, active: true, service: "http" }],
84
+ users: [Network.createUser({ username: "admin" })],
85
+ children: [],
86
+ });
87
+ }
88
+ }
89
+ ```
90
+
91
+ ## API Overview
92
+
93
+ ### Base Classes
94
+
95
+ | Class | Purpose |
96
+ |-------|---------|
97
+ | `Bootstrap` | Mod entry point, receives lifecycle callbacks |
98
+ | `Quest` | Define custom quests with objectives and rewards |
99
+ | `Website` | Add in-game websites to the browser |
100
+ | `Command` | Register custom terminal commands |
101
+ | `App` | Create desktop applications |
102
+
103
+ ### API Namespaces
104
+
105
+ | Namespace | Purpose |
106
+ |-----------|---------|
107
+ | `Events` | Listen to game events, emit custom cross-mod events |
108
+ | `Files` | Create, read, write, delete files in the game filesystem |
109
+ | `Network` | Create networks, manage ports, firewalls, domains |
110
+ | `Mail` | Send in-game emails |
111
+ | `Bank` | Manage bank transactions |
112
+ | `Storage` | Persistent key-value storage (per-mod) |
113
+ | `Variables` | Session-only variables (per-mod, reset on game close) |
114
+ | `SharedStorage` | Persistent storage shared between mods |
115
+ | `SharedVariables` | Session variables shared between mods |
116
+ | `Shell` | Execute terminal commands programmatically |
117
+ | `UI` | Show notifications and toasts |
118
+ | `Twotter` | In-game Twitter -- create users, post tweets |
119
+ | `Kisscord` | In-game Discord -- create users, send messages |
120
+ | `WeeChat` | In-game IRC -- create servers, send messages |
121
+
122
+ ### Decorators
123
+
124
+ ```typescript
125
+ @RegisterModPackage() // Register the mod's Bootstrap class
126
+ @RegisterQuest() // Register a Quest
127
+ @RegisterWebsite() // Register a Website
128
+ @RegisterCommand() // Register a terminal Command
129
+ @RegisterApp() // Register a desktop App
130
+ ```
131
+
132
+ ## Events
133
+
134
+ ### Listening to Game Events
135
+
136
+ ```typescript
137
+ import { Events } from "@hotbunny/hackhub-content-sdk";
138
+
139
+ Events.on("Terminal.NmapScan", (data) => {
140
+ console.log(`Player scanned ${data.ip}`);
141
+ });
142
+
143
+ Events.on("Kisscord.Messaging", (data) => {
144
+ console.log(`Message on channel ${data.channel}`);
145
+ });
146
+ ```
147
+
148
+ ### Custom Cross-Mod Events
149
+
150
+ Register and emit your own typed events that other mods can listen to:
151
+
152
+ ```typescript
153
+ // In your mod's type declarations
154
+ declare module "@hotbunny/hackhub-content-sdk" {
155
+ interface ModEventMap {
156
+ "MyMod.BossDefeated": { bossName: string; reward: number };
157
+ }
158
+ }
159
+
160
+ // Emit
161
+ Events.register("MyMod.BossDefeated");
162
+ Events.emit("MyMod.BossDefeated", { bossName: "Hydra", reward: 500 });
163
+
164
+ // Another mod can listen (with full type safety)
165
+ Events.on("MyMod.BossDefeated", (data) => {
166
+ console.log(`Boss ${data.bossName} defeated! Reward: ${data.reward}`);
167
+ });
168
+ ```
169
+
170
+ ## Messaging APIs
171
+
172
+ ### Twotter (in-game Twitter)
173
+
174
+ ```typescript
175
+ import { Twotter } from "@hotbunny/hackhub-content-sdk";
176
+
177
+ const user = Twotter.createUser({
178
+ username: "darknet_hacker",
179
+ bio: "I hack things.",
180
+ verified: true,
181
+ });
182
+ Twotter.addUser(user);
183
+
184
+ Twotter.postTweet({
185
+ id: "my-tweet-1",
186
+ userId: user.id,
187
+ content: "Just breached the mainframe!",
188
+ interaction: { comments: 5, share: 2, likes: 42, views: 1000 },
189
+ showInTimeline: true,
190
+ });
191
+ ```
192
+
193
+ ### Kisscord (in-game Discord)
194
+
195
+ ```typescript
196
+ import { Kisscord, KisscordStatus } from "@hotbunny/hackhub-content-sdk";
197
+
198
+ const npc = Kisscord.createUser({
199
+ username: "informant",
200
+ firstName: "John",
201
+ lastName: "Doe",
202
+ isFriend: true,
203
+ status: KisscordStatus.Online,
204
+ });
205
+ Kisscord.addUser(npc);
206
+ Kisscord.sendMessage(npc.id, "I have the files you need.");
207
+ ```
208
+
209
+ ### WeeChat (in-game IRC)
210
+
211
+ ```typescript
212
+ import { WeeChat } from "@hotbunny/hackhub-content-sdk";
213
+
214
+ WeeChat.createServer("irc.darknet.org", "secret123");
215
+ WeeChat.sendMessage({
216
+ host: "irc.darknet.org",
217
+ username: "informant",
218
+ message: "The target IP is 45.33.32.156",
219
+ });
220
+ ```
221
+
222
+ ## Building Your Mod
223
+
224
+ Use [esbuild](https://esbuild.github.io/) to compile your TypeScript source into a single `mod.js`:
225
+
226
+ ```bash
227
+ npx esbuild src/index.ts --bundle --outfile=mod.js --format=cjs --platform=browser --target=es2020 --external:@hotbunny/hackhub-content-sdk
228
+ ```
229
+
230
+ The `--external` flag is important: the game provides the SDK at runtime, so it must not be bundled into your mod.
231
+
232
+ ### tsconfig.json (recommended)
233
+
234
+ ```json
235
+ {
236
+ "compilerOptions": {
237
+ "target": "ES2020",
238
+ "module": "ESNext",
239
+ "moduleResolution": "bundler",
240
+ "strict": true,
241
+ "experimentalDecorators": true,
242
+ "emitDecoratorMetadata": true,
243
+ "esModuleInterop": true,
244
+ "skipLibCheck": true
245
+ },
246
+ "include": ["src/**/*.ts"]
247
+ }
248
+ ```
249
+
250
+ ## License
251
+
252
+ MIT