aboutsummaryrefslogtreecommitdiff
path: root/webAO/packets/handlers
diff options
context:
space:
mode:
Diffstat (limited to 'webAO/packets/handlers')
-rw-r--r--webAO/packets/handlers/handleBB.ts11
-rw-r--r--webAO/packets/handlers/handleBD.ts13
-rw-r--r--webAO/packets/handlers/handleKB.ts12
-rw-r--r--webAO/packets/handlers/handleKK.ts11
-rw-r--r--webAO/packets/handlers/handleMM.ts8
5 files changed, 55 insertions, 0 deletions
diff --git a/webAO/packets/handlers/handleBB.ts b/webAO/packets/handlers/handleBB.ts
new file mode 100644
index 0000000..c12c4f6
--- /dev/null
+++ b/webAO/packets/handlers/handleBB.ts
@@ -0,0 +1,11 @@
+import { safeTags } from "../../encoding";
+
+
+/**
+ * Handles the warning packet
+ * on client this spawns a message box you can't close for 2 seconds
+ * @param {Array} args ban reason
+ */
+export const handleBB = (args: string[]) => {
+ alert(safeTags(args[1]));
+} \ No newline at end of file
diff --git a/webAO/packets/handlers/handleBD.ts b/webAO/packets/handlers/handleBD.ts
new file mode 100644
index 0000000..4ec291e
--- /dev/null
+++ b/webAO/packets/handlers/handleBD.ts
@@ -0,0 +1,13 @@
+import { client, setBanned } from "../../client";
+import { safeTags } from "../../encoding";
+
+
+/**
+ * Handles the banned packet
+ * this one is sent when you try to reconnect but you're banned
+ * @param {Array} args ban reason
+ */
+export const handleBD = (args: string[]) => {
+ client.handleBans("Banned", safeTags(args[1]));
+ setBanned(true);
+} \ No newline at end of file
diff --git a/webAO/packets/handlers/handleKB.ts b/webAO/packets/handlers/handleKB.ts
new file mode 100644
index 0000000..8705b83
--- /dev/null
+++ b/webAO/packets/handlers/handleKB.ts
@@ -0,0 +1,12 @@
+import { client, setBanned } from "../../client";
+import { safeTags } from "../../encoding";
+
+/**
+ * Handles the banned packet
+ * this one is sent when you are kicked off the server
+ * @param {Array} args ban reason
+ */
+export const handleKB = (args: string[]) => {
+ client.handleBans("Banned", safeTags(args[1]));
+ setBanned(true);
+}
diff --git a/webAO/packets/handlers/handleKK.ts b/webAO/packets/handlers/handleKK.ts
new file mode 100644
index 0000000..fd9a88c
--- /dev/null
+++ b/webAO/packets/handlers/handleKK.ts
@@ -0,0 +1,11 @@
+import { client } from "../../client";
+import { safeTags } from "../../encoding";
+
+
+/**
+ * Handles the kicked packet
+ * @param {Array} args kick reason
+ */
+export const handleKK = (args: string[]) => {
+ client.handleBans("Kicked", safeTags(args[1]));
+}
diff --git a/webAO/packets/handlers/handleMM.ts b/webAO/packets/handlers/handleMM.ts
new file mode 100644
index 0000000..077140f
--- /dev/null
+++ b/webAO/packets/handlers/handleMM.ts
@@ -0,0 +1,8 @@
+
+/**
+ * Handles the "MusicMode" packet
+ * @param {Array} args packet arguments
+ */
+export const handleMM = (_args: string[]) => {
+ // It's unused nowadays, as preventing people from changing the music is now serverside
+} \ No newline at end of file