create-hackhub-mod 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/dist/index.js +101 -15
- package/package.json +1 -1
- package/templates/base/esbuild.config.ts +3 -0
- package/templates/base/src/types.d.ts +4 -0
- package/templates/basic/src/index.ts +1 -1
- package/templates/full/src/apps/{ExampleApp.ts → ExampleApp/app.html} +13 -16
- package/templates/full/src/apps/ExampleApp/index.ts +18 -0
- package/templates/full/src/commands/HelloCommand.ts +15 -8
- package/templates/full/src/index.ts +3 -3
- package/templates/full/src/quests/ExampleQuest.ts +26 -11
- package/templates/full/src/websites/ExampleWebsite/home.html +32 -0
- package/templates/full/src/websites/ExampleWebsite/index.ts +13 -0
- package/templates/quest/src/index.ts +1 -1
- package/templates/quest/src/quests/ExampleQuest.ts +26 -11
- package/templates/website/src/index.ts +2 -2
- package/templates/website/src/websites/ExampleWebsite/home.html +32 -0
- package/templates/website/src/websites/ExampleWebsite/index.ts +13 -0
- package/templates/full/src/websites/ExampleWebsite.ts +0 -31
- package/templates/website/src/websites/ExampleWebsite.ts +0 -31
package/dist/index.js
CHANGED
|
@@ -5,9 +5,51 @@ import * as p from "@clack/prompts";
|
|
|
5
5
|
import pc from "picocolors";
|
|
6
6
|
import fs from "fs";
|
|
7
7
|
import path from "path";
|
|
8
|
+
import { execSync } from "child_process";
|
|
8
9
|
import { fileURLToPath } from "url";
|
|
9
10
|
var __filename = fileURLToPath(import.meta.url);
|
|
10
11
|
var __dirname = path.dirname(__filename);
|
|
12
|
+
function hackerArt() {
|
|
13
|
+
const d = pc.dim;
|
|
14
|
+
const w = pc.white;
|
|
15
|
+
const c = pc.cyan;
|
|
16
|
+
const g = pc.green;
|
|
17
|
+
const lines = [
|
|
18
|
+
"",
|
|
19
|
+
d(" ") + w(".::::::::::."),
|
|
20
|
+
d(" ") + w(".::`") + d(" ") + w("``:::::::::."),
|
|
21
|
+
d(" ") + w(".::") + d(" ") + w("``::::::::."),
|
|
22
|
+
d(" ") + w(".::") + d(" ") + w("`:::::::::"),
|
|
23
|
+
d(" ") + w(".::") + d(" ") + w("::::::::"),
|
|
24
|
+
d(" ") + w("::") + d(" ") + g("@@") + d(" ") + g("@@") + d(" ") + w(":::::::"),
|
|
25
|
+
d(" ") + w("::") + d(" ") + g("@@") + d(" ") + g("@@") + d(" ") + w(":::::::"),
|
|
26
|
+
d(" ") + w("::") + d(" ") + w(":::::::"),
|
|
27
|
+
d(" ") + w("::") + d(" ") + g("\\__/") + d(" ") + w(":::::::"),
|
|
28
|
+
d(" ") + w("`::.") + d(" ") + w(".::::::"),
|
|
29
|
+
d(" ") + w("`::.") + d(" ") + w(".::::::'"),
|
|
30
|
+
d(" ") + w("_,,,,,,__") + w("`::::::::::::::'"),
|
|
31
|
+
d(" ") + w(",:''") + d(" ") + w("'':::::::::::'"),
|
|
32
|
+
d(" ") + w("/") + d(" ") + c(".--------.") + d(" ") + w("\\"),
|
|
33
|
+
d(" ") + w("|") + d(" ") + c("|") + d(" ") + c("|") + d(" ") + w("|"),
|
|
34
|
+
d(" ") + w("|") + d(" ") + c("|") + d(" ") + g(">_") + d(" ") + c("|") + d(" ") + w("|"),
|
|
35
|
+
d(" ") + w("|") + d(" ") + c("|") + d(" ") + c("|") + d(" ") + w("|"),
|
|
36
|
+
d(" ") + w("|") + d(" ") + c("'--------'") + d(" ") + w("|"),
|
|
37
|
+
d(" ") + w("\\") + d(" ") + c("/__________\\") + d(" ") + w("/"),
|
|
38
|
+
d(" ") + w("\\") + d(" ") + w("/"),
|
|
39
|
+
d(" ") + w("'---..___________..---'"),
|
|
40
|
+
""
|
|
41
|
+
];
|
|
42
|
+
return lines.join("\n");
|
|
43
|
+
}
|
|
44
|
+
var HACKER_ART = hackerArt();
|
|
45
|
+
var LOGO = `
|
|
46
|
+
${pc.cyan(" \u2588\u2588\u2557 \u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2557 \u2588\u2588\u2557\u2588\u2588\u2557 \u2588\u2588\u2557\u2588\u2588\u2557 \u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2557 ")}
|
|
47
|
+
${pc.cyan(" \u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D\u2588\u2588\u2551 \u2588\u2588\u2554\u255D\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557")}
|
|
48
|
+
${pc.cyan(" \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2588\u2588\u2588\u2554\u255D \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D")}
|
|
49
|
+
${pc.cyan(" \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2554\u2550\u2588\u2588\u2557 \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557")}
|
|
50
|
+
${pc.cyan(" \u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2551\u255A\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2551 \u2588\u2588\u2557\u2588\u2588\u2551 \u2588\u2588\u2551\u255A\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D")}
|
|
51
|
+
${pc.cyan(" \u255A\u2550\u255D \u255A\u2550\u255D\u255A\u2550\u255D \u255A\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u255D\u255A\u2550\u255D \u255A\u2550\u255D\u255A\u2550\u255D \u255A\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u255D ")}
|
|
52
|
+
`;
|
|
11
53
|
function toKebabCase(str) {
|
|
12
54
|
return str.trim().toLowerCase().replace(/\s+/g, "-").replace(/[^a-z0-9-]/g, "").replace(/-+/g, "-").replace(/^-|-$/g, "");
|
|
13
55
|
}
|
|
@@ -28,16 +70,42 @@ function copyDir(src, dest, vars) {
|
|
|
28
70
|
copyDir(srcPath, destPath, vars);
|
|
29
71
|
} else {
|
|
30
72
|
let content = fs.readFileSync(srcPath, "utf-8");
|
|
31
|
-
if (entry.name.endsWith(".hbs") || entry.name.endsWith(".ts") || entry.name.endsWith(".json")) {
|
|
73
|
+
if (entry.name.endsWith(".hbs") || entry.name.endsWith(".ts") || entry.name.endsWith(".html") || entry.name.endsWith(".json")) {
|
|
32
74
|
content = inject(content, vars);
|
|
33
75
|
}
|
|
34
76
|
fs.writeFileSync(destPath, content);
|
|
35
77
|
}
|
|
36
78
|
}
|
|
37
79
|
}
|
|
80
|
+
function detectPackageManager() {
|
|
81
|
+
const ua = process.env.npm_config_user_agent || "";
|
|
82
|
+
if (ua.startsWith("pnpm")) return "pnpm";
|
|
83
|
+
if (ua.startsWith("yarn")) return "yarn";
|
|
84
|
+
if (ua.startsWith("bun")) return "bun";
|
|
85
|
+
try {
|
|
86
|
+
execSync("bun --version", { stdio: "ignore" });
|
|
87
|
+
return "bun";
|
|
88
|
+
} catch {
|
|
89
|
+
}
|
|
90
|
+
try {
|
|
91
|
+
execSync("pnpm --version", { stdio: "ignore" });
|
|
92
|
+
return "pnpm";
|
|
93
|
+
} catch {
|
|
94
|
+
}
|
|
95
|
+
return "npm";
|
|
96
|
+
}
|
|
97
|
+
function installCommand(pm) {
|
|
98
|
+
return pm === "yarn" ? "yarn" : `${pm} install`;
|
|
99
|
+
}
|
|
100
|
+
function pad(str, len) {
|
|
101
|
+
const visible = str.replace(/\x1b\[[0-9;]*m/g, "");
|
|
102
|
+
const padding = Math.max(0, len - visible.length);
|
|
103
|
+
return str + " ".repeat(padding);
|
|
104
|
+
}
|
|
38
105
|
async function main() {
|
|
39
|
-
console.log();
|
|
40
|
-
|
|
106
|
+
console.log(HACKER_ART);
|
|
107
|
+
console.log(LOGO);
|
|
108
|
+
p.intro(pc.bgCyan(pc.black(" create-hackhub-mod ")));
|
|
41
109
|
const project = await p.group(
|
|
42
110
|
{
|
|
43
111
|
name: () => p.text({
|
|
@@ -51,10 +119,10 @@ async function main() {
|
|
|
51
119
|
template: () => p.select({
|
|
52
120
|
message: "Select a template",
|
|
53
121
|
options: [
|
|
54
|
-
{ value: "basic", label: "Basic"
|
|
55
|
-
{ value: "quest", label: "Quest"
|
|
56
|
-
{ value: "website", label: "Website"
|
|
57
|
-
{ value: "full", label: "Full"
|
|
122
|
+
{ value: "basic", label: `${pc.bold("Basic")}`, hint: "Minimal mod setup" },
|
|
123
|
+
{ value: "quest", label: `${pc.bold("Quest")}`, hint: "Includes an example quest" },
|
|
124
|
+
{ value: "website", label: `${pc.bold("Website")}`, hint: "Includes an in-game website" },
|
|
125
|
+
{ value: "full", label: `${pc.bold("Full")}`, hint: "Quest + Website + Command + App" }
|
|
58
126
|
]
|
|
59
127
|
}),
|
|
60
128
|
author: () => p.text({
|
|
@@ -94,13 +162,31 @@ async function main() {
|
|
|
94
162
|
s.start("Scaffolding mod project...");
|
|
95
163
|
copyDir(baseDir, targetDir, vars);
|
|
96
164
|
copyDir(templateDir, targetDir, vars);
|
|
97
|
-
s.stop("Project scaffolded.");
|
|
98
|
-
const
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
165
|
+
s.stop(pc.green("Project scaffolded."));
|
|
166
|
+
const pm = detectPackageManager();
|
|
167
|
+
s.start(`Installing dependencies with ${pc.cyan(pm)}...`);
|
|
168
|
+
try {
|
|
169
|
+
execSync(installCommand(pm), { cwd: targetDir, stdio: "ignore" });
|
|
170
|
+
s.stop(pc.green("Dependencies installed."));
|
|
171
|
+
} catch {
|
|
172
|
+
s.stop(pc.yellow("Could not install dependencies. Run it manually."));
|
|
173
|
+
}
|
|
174
|
+
const W = 54;
|
|
175
|
+
console.log();
|
|
176
|
+
console.log(pc.dim(" \u250C" + "\u2500".repeat(W) + "\u2510"));
|
|
177
|
+
console.log(pc.dim(" \u2502") + " ".repeat(W) + pc.dim("\u2502"));
|
|
178
|
+
console.log(pc.dim(" \u2502") + pad(pc.green(" \u2714 Your mod is ready!"), W) + pc.dim("\u2502"));
|
|
179
|
+
console.log(pc.dim(" \u2502") + " ".repeat(W) + pc.dim("\u2502"));
|
|
180
|
+
console.log(pc.dim(" \u2502") + pad(` Project: ${pc.bold(modName)}`, W) + pc.dim("\u2502"));
|
|
181
|
+
console.log(pc.dim(" \u2502") + pad(` Template: ${pc.bold(template)}`, W) + pc.dim("\u2502"));
|
|
182
|
+
console.log(pc.dim(" \u2502") + pad(` Author: ${pc.bold(author)}`, W) + pc.dim("\u2502"));
|
|
183
|
+
console.log(pc.dim(" \u2502") + " ".repeat(W) + pc.dim("\u2502"));
|
|
184
|
+
console.log(pc.dim(" \u2502") + pad(pc.dim(" Next steps:"), W) + pc.dim("\u2502"));
|
|
185
|
+
console.log(pc.dim(" \u2502") + pad(pc.cyan(` cd ${modId}`), W) + pc.dim("\u2502"));
|
|
186
|
+
console.log(pc.dim(" \u2502") + pad(pc.cyan(` ${pm} run build`), W) + pc.dim("\u2502"));
|
|
187
|
+
console.log(pc.dim(" \u2502") + " ".repeat(W) + pc.dim("\u2502"));
|
|
188
|
+
console.log(pc.dim(" \u2514" + "\u2500".repeat(W) + "\u2518"));
|
|
189
|
+
console.log();
|
|
190
|
+
p.outro(pc.green("Happy hacking!"));
|
|
105
191
|
}
|
|
106
192
|
main().catch(console.error);
|
package/package.json
CHANGED
|
@@ -1,24 +1,22 @@
|
|
|
1
|
-
import { App, RegisterApp } from "@hotbunny/hackhub-content-sdk";
|
|
2
|
-
|
|
3
|
-
@RegisterApp()
|
|
4
|
-
export class ExampleApp extends App {
|
|
5
|
-
definition = {
|
|
6
|
-
id: "example-app",
|
|
7
|
-
name: "Example App",
|
|
8
|
-
icon: "terminal",
|
|
9
|
-
html: `
|
|
10
1
|
<!DOCTYPE html>
|
|
11
2
|
<html>
|
|
12
3
|
<head>
|
|
13
4
|
<style>
|
|
5
|
+
* { margin: 0; padding: 0; box-sizing: border-box; }
|
|
14
6
|
body {
|
|
15
|
-
font-family: sans-serif;
|
|
7
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
|
|
16
8
|
background: #1a1a2e;
|
|
17
9
|
color: #eee;
|
|
18
10
|
padding: 24px;
|
|
19
|
-
margin: 0;
|
|
20
11
|
}
|
|
21
|
-
h2 {
|
|
12
|
+
h2 {
|
|
13
|
+
color: #e94560;
|
|
14
|
+
margin-bottom: 12px;
|
|
15
|
+
}
|
|
16
|
+
p {
|
|
17
|
+
color: #aaa;
|
|
18
|
+
margin-bottom: 16px;
|
|
19
|
+
}
|
|
22
20
|
button {
|
|
23
21
|
background: #e94560;
|
|
24
22
|
color: white;
|
|
@@ -26,15 +24,14 @@ export class ExampleApp extends App {
|
|
|
26
24
|
padding: 8px 16px;
|
|
27
25
|
border-radius: 4px;
|
|
28
26
|
cursor: pointer;
|
|
27
|
+
font-size: 14px;
|
|
29
28
|
}
|
|
30
29
|
button:hover { opacity: 0.85; }
|
|
31
30
|
</style>
|
|
32
31
|
</head>
|
|
33
32
|
<body>
|
|
34
|
-
<h2>{{modName}}
|
|
33
|
+
<h2>{{modName}}</h2>
|
|
35
34
|
<p>This is a custom in-game application.</p>
|
|
36
35
|
<button onclick="alert('Hello from {{modName}}!')">Click me</button>
|
|
37
36
|
</body>
|
|
38
|
-
</html
|
|
39
|
-
};
|
|
40
|
-
}
|
|
37
|
+
</html>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { App, RegisterApp } from "@hotbunny/hackhub-content-sdk";
|
|
2
|
+
import appHTML from "./app.html";
|
|
3
|
+
|
|
4
|
+
@RegisterApp
|
|
5
|
+
export class ExampleApp extends App {
|
|
6
|
+
|
|
7
|
+
AppName: string = "{{className}}App";
|
|
8
|
+
Title: string = "{{modName}}";
|
|
9
|
+
Icon: string = "";
|
|
10
|
+
HTML: string = appHTML;
|
|
11
|
+
DefaultSize = { width: 420, height: 320 };
|
|
12
|
+
|
|
13
|
+
Store = {
|
|
14
|
+
title: "{{modName}}",
|
|
15
|
+
ratings: 5.0,
|
|
16
|
+
description: "{{description}}",
|
|
17
|
+
};
|
|
18
|
+
}
|
|
@@ -1,13 +1,20 @@
|
|
|
1
|
-
import { Command, RegisterCommand } from "@hotbunny/hackhub-content-sdk";
|
|
1
|
+
import { Command, RegisterCommand, CommandTools } from "@hotbunny/hackhub-content-sdk";
|
|
2
2
|
|
|
3
|
-
@RegisterCommand
|
|
3
|
+
@RegisterCommand
|
|
4
4
|
export class HelloCommand extends Command {
|
|
5
|
-
definition = {
|
|
6
|
-
name: "hello",
|
|
7
|
-
description: "Says hello from {{modName}}",
|
|
8
|
-
};
|
|
9
5
|
|
|
10
|
-
|
|
11
|
-
|
|
6
|
+
CommandName: string = "hello";
|
|
7
|
+
Description: string = "Says hello from {{modName}}";
|
|
8
|
+
Autocomplete = [
|
|
9
|
+
{ label: "hello", type: "STRING" as const },
|
|
10
|
+
];
|
|
11
|
+
|
|
12
|
+
async Run(tools: CommandTools) {
|
|
13
|
+
const args = tools.getArgs();
|
|
14
|
+
if (args.length > 0) {
|
|
15
|
+
tools.println(`Hello, ${args.join(" ")}! From {{modName}}.`);
|
|
16
|
+
} else {
|
|
17
|
+
tools.println("Hello from {{modName}}!");
|
|
18
|
+
}
|
|
12
19
|
}
|
|
13
20
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Bootstrap, RegisterModPackage } from "@hotbunny/hackhub-content-sdk";
|
|
2
2
|
import "./quests/ExampleQuest";
|
|
3
|
-
import "./websites/ExampleWebsite";
|
|
3
|
+
import "./websites/ExampleWebsite/index";
|
|
4
4
|
import "./commands/HelloCommand";
|
|
5
|
-
import "./apps/ExampleApp";
|
|
5
|
+
import "./apps/ExampleApp/index";
|
|
6
6
|
|
|
7
|
-
@RegisterModPackage
|
|
7
|
+
@RegisterModPackage
|
|
8
8
|
export default class {{className}} extends Bootstrap {
|
|
9
9
|
OnModPackageLoaded() {
|
|
10
10
|
console.log("{{modName}} loaded!");
|
|
@@ -1,14 +1,29 @@
|
|
|
1
|
-
import { Quest,
|
|
1
|
+
import { Quest, RegisterQuest, QuestObjectiveDefinition } from "@hotbunny/hackhub-content-sdk";
|
|
2
2
|
|
|
3
|
-
@RegisterQuest
|
|
3
|
+
@RegisterQuest
|
|
4
4
|
export class ExampleQuest extends Quest {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
5
|
+
|
|
6
|
+
Name: string = "ExampleQuest";
|
|
7
|
+
Title: string = "Example Quest";
|
|
8
|
+
Description: string = "An example quest from {{modName}}.";
|
|
9
|
+
Rewards = { money: 100 };
|
|
10
|
+
Objectives: QuestObjectiveDefinition[] = [
|
|
11
|
+
{
|
|
12
|
+
name: "scan",
|
|
13
|
+
description: "Scan the target server",
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
name: "exploit",
|
|
17
|
+
description: "Exploit the vulnerability",
|
|
18
|
+
unlocksAfter: ["scan"],
|
|
19
|
+
},
|
|
20
|
+
];
|
|
21
|
+
|
|
22
|
+
OnStart() {
|
|
23
|
+
console.log("ExampleQuest started!");
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
OnComplete() {
|
|
27
|
+
console.log("ExampleQuest completed!");
|
|
28
|
+
}
|
|
14
29
|
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<style>
|
|
5
|
+
* { margin: 0; padding: 0; box-sizing: border-box; }
|
|
6
|
+
body {
|
|
7
|
+
font-family: 'Courier New', monospace;
|
|
8
|
+
background: #0a0a0a;
|
|
9
|
+
color: #00ff41;
|
|
10
|
+
min-height: 100vh;
|
|
11
|
+
display: flex;
|
|
12
|
+
flex-direction: column;
|
|
13
|
+
align-items: center;
|
|
14
|
+
justify-content: center;
|
|
15
|
+
padding: 24px;
|
|
16
|
+
}
|
|
17
|
+
h1 {
|
|
18
|
+
font-size: 2rem;
|
|
19
|
+
text-shadow: 0 0 10px #00ff41, 0 0 20px #00ff4180;
|
|
20
|
+
margin-bottom: 16px;
|
|
21
|
+
}
|
|
22
|
+
p {
|
|
23
|
+
color: #00ff41aa;
|
|
24
|
+
font-size: 0.9rem;
|
|
25
|
+
}
|
|
26
|
+
</style>
|
|
27
|
+
</head>
|
|
28
|
+
<body>
|
|
29
|
+
<h1>{{modName}}</h1>
|
|
30
|
+
<p>Welcome to the website. You shouldn't be here.</p>
|
|
31
|
+
</body>
|
|
32
|
+
</html>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Website, RegisterWebsite, WebsitePageDefinition } from "@hotbunny/hackhub-content-sdk";
|
|
2
|
+
import homePage from "./home.html";
|
|
3
|
+
|
|
4
|
+
@RegisterWebsite
|
|
5
|
+
export class ExampleWebsite extends Website {
|
|
6
|
+
|
|
7
|
+
SiteName: string = "{{modName}}";
|
|
8
|
+
Host: string = "{{modId}}.mod";
|
|
9
|
+
Icon: string = "";
|
|
10
|
+
Pages: WebsitePageDefinition[] = [
|
|
11
|
+
{ path: "/", title: "Home", html: homePage },
|
|
12
|
+
];
|
|
13
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Bootstrap, RegisterModPackage } from "@hotbunny/hackhub-content-sdk";
|
|
2
2
|
import "./quests/ExampleQuest";
|
|
3
3
|
|
|
4
|
-
@RegisterModPackage
|
|
4
|
+
@RegisterModPackage
|
|
5
5
|
export default class {{className}} extends Bootstrap {
|
|
6
6
|
OnModPackageLoaded() {
|
|
7
7
|
console.log("{{modName}} loaded!");
|
|
@@ -1,14 +1,29 @@
|
|
|
1
|
-
import { Quest,
|
|
1
|
+
import { Quest, RegisterQuest, QuestObjectiveDefinition } from "@hotbunny/hackhub-content-sdk";
|
|
2
2
|
|
|
3
|
-
@RegisterQuest
|
|
3
|
+
@RegisterQuest
|
|
4
4
|
export class ExampleQuest extends Quest {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
5
|
+
|
|
6
|
+
Name: string = "ExampleQuest";
|
|
7
|
+
Title: string = "Example Quest";
|
|
8
|
+
Description: string = "An example quest from {{modName}}.";
|
|
9
|
+
Rewards = { money: 100 };
|
|
10
|
+
Objectives: QuestObjectiveDefinition[] = [
|
|
11
|
+
{
|
|
12
|
+
name: "scan",
|
|
13
|
+
description: "Scan the target server",
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
name: "exploit",
|
|
17
|
+
description: "Exploit the vulnerability",
|
|
18
|
+
unlocksAfter: ["scan"],
|
|
19
|
+
},
|
|
20
|
+
];
|
|
21
|
+
|
|
22
|
+
OnStart() {
|
|
23
|
+
console.log("ExampleQuest started!");
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
OnComplete() {
|
|
27
|
+
console.log("ExampleQuest completed!");
|
|
28
|
+
}
|
|
14
29
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Bootstrap, RegisterModPackage } from "@hotbunny/hackhub-content-sdk";
|
|
2
|
-
import "./websites/ExampleWebsite";
|
|
2
|
+
import "./websites/ExampleWebsite/index";
|
|
3
3
|
|
|
4
|
-
@RegisterModPackage
|
|
4
|
+
@RegisterModPackage
|
|
5
5
|
export default class {{className}} extends Bootstrap {
|
|
6
6
|
OnModPackageLoaded() {
|
|
7
7
|
console.log("{{modName}} loaded!");
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<style>
|
|
5
|
+
* { margin: 0; padding: 0; box-sizing: border-box; }
|
|
6
|
+
body {
|
|
7
|
+
font-family: 'Courier New', monospace;
|
|
8
|
+
background: #0a0a0a;
|
|
9
|
+
color: #00ff41;
|
|
10
|
+
min-height: 100vh;
|
|
11
|
+
display: flex;
|
|
12
|
+
flex-direction: column;
|
|
13
|
+
align-items: center;
|
|
14
|
+
justify-content: center;
|
|
15
|
+
padding: 24px;
|
|
16
|
+
}
|
|
17
|
+
h1 {
|
|
18
|
+
font-size: 2rem;
|
|
19
|
+
text-shadow: 0 0 10px #00ff41, 0 0 20px #00ff4180;
|
|
20
|
+
margin-bottom: 16px;
|
|
21
|
+
}
|
|
22
|
+
p {
|
|
23
|
+
color: #00ff41aa;
|
|
24
|
+
font-size: 0.9rem;
|
|
25
|
+
}
|
|
26
|
+
</style>
|
|
27
|
+
</head>
|
|
28
|
+
<body>
|
|
29
|
+
<h1>{{modName}}</h1>
|
|
30
|
+
<p>Welcome to the website. You shouldn't be here.</p>
|
|
31
|
+
</body>
|
|
32
|
+
</html>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Website, RegisterWebsite, WebsitePageDefinition } from "@hotbunny/hackhub-content-sdk";
|
|
2
|
+
import homePage from "./home.html";
|
|
3
|
+
|
|
4
|
+
@RegisterWebsite
|
|
5
|
+
export class ExampleWebsite extends Website {
|
|
6
|
+
|
|
7
|
+
SiteName: string = "{{modName}}";
|
|
8
|
+
Host: string = "{{modId}}.mod";
|
|
9
|
+
Icon: string = "";
|
|
10
|
+
Pages: WebsitePageDefinition[] = [
|
|
11
|
+
{ path: "/", title: "Home", html: homePage },
|
|
12
|
+
];
|
|
13
|
+
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { Website, RegisterWebsite } from "@hotbunny/hackhub-content-sdk";
|
|
2
|
-
|
|
3
|
-
@RegisterWebsite()
|
|
4
|
-
export class ExampleWebsite extends Website {
|
|
5
|
-
definition = {
|
|
6
|
-
url: "example.mod",
|
|
7
|
-
title: "Example Website",
|
|
8
|
-
html: `
|
|
9
|
-
<!DOCTYPE html>
|
|
10
|
-
<html>
|
|
11
|
-
<head>
|
|
12
|
-
<style>
|
|
13
|
-
body {
|
|
14
|
-
font-family: monospace;
|
|
15
|
-
background: #0a0a0a;
|
|
16
|
-
color: #00ff41;
|
|
17
|
-
display: flex;
|
|
18
|
-
align-items: center;
|
|
19
|
-
justify-content: center;
|
|
20
|
-
height: 100vh;
|
|
21
|
-
margin: 0;
|
|
22
|
-
}
|
|
23
|
-
h1 { text-shadow: 0 0 10px #00ff41; }
|
|
24
|
-
</style>
|
|
25
|
-
</head>
|
|
26
|
-
<body>
|
|
27
|
-
<h1>Welcome to {{modName}}</h1>
|
|
28
|
-
</body>
|
|
29
|
-
</html>`,
|
|
30
|
-
};
|
|
31
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { Website, RegisterWebsite } from "@hotbunny/hackhub-content-sdk";
|
|
2
|
-
|
|
3
|
-
@RegisterWebsite()
|
|
4
|
-
export class ExampleWebsite extends Website {
|
|
5
|
-
definition = {
|
|
6
|
-
url: "example.mod",
|
|
7
|
-
title: "Example Website",
|
|
8
|
-
html: `
|
|
9
|
-
<!DOCTYPE html>
|
|
10
|
-
<html>
|
|
11
|
-
<head>
|
|
12
|
-
<style>
|
|
13
|
-
body {
|
|
14
|
-
font-family: monospace;
|
|
15
|
-
background: #0a0a0a;
|
|
16
|
-
color: #00ff41;
|
|
17
|
-
display: flex;
|
|
18
|
-
align-items: center;
|
|
19
|
-
justify-content: center;
|
|
20
|
-
height: 100vh;
|
|
21
|
-
margin: 0;
|
|
22
|
-
}
|
|
23
|
-
h1 { text-shadow: 0 0 10px #00ff41; }
|
|
24
|
-
</style>
|
|
25
|
-
</head>
|
|
26
|
-
<body>
|
|
27
|
-
<h1>Welcome to {{modName}}</h1>
|
|
28
|
-
</body>
|
|
29
|
-
</html>`,
|
|
30
|
-
};
|
|
31
|
-
}
|