aboutsummaryrefslogtreecommitdiff
path: root/webAO/packets/handlers/handleCharsCheck.ts
diff options
context:
space:
mode:
authorstonedDiscord <Tukz@gmx.de>2022-10-12 18:25:14 +0200
committerstonedDiscord <Tukz@gmx.de>2022-10-12 18:25:14 +0200
commit8a7942c0565298c29edbf0b271d5d7c7f9e56fd8 (patch)
tree67b788f40b7a4713904836de05f0e5876c32bd79 /webAO/packets/handlers/handleCharsCheck.ts
parenta83c8962b68f2cc0a0e22d988b8ff030057454e5 (diff)
parent82983e0c38383ec2602b4f41327342d1c8d0a8fd (diff)
Merge branch 'master' into 2fa
Diffstat (limited to 'webAO/packets/handlers/handleCharsCheck.ts')
-rw-r--r--webAO/packets/handlers/handleCharsCheck.ts17
1 files changed, 17 insertions, 0 deletions
diff --git a/webAO/packets/handlers/handleCharsCheck.ts b/webAO/packets/handlers/handleCharsCheck.ts
new file mode 100644
index 0000000..2d891ef
--- /dev/null
+++ b/webAO/packets/handlers/handleCharsCheck.ts
@@ -0,0 +1,17 @@
+import { client } from "../../client";
+
+/**
+ * Handles the list of all used and vacant characters.
+ * @param {Array} args list of all characters represented as a 0 for free or a -1 for taken
+ */
+export const handleCharsCheck = (args: string[]) => {
+ for (let i = 0; i < client.char_list_length; i++) {
+ const img = document.getElementById(`demo_${i}`)!;
+
+ if (args[i + 1] === "-1") {
+ img.style.opacity = "0.25";
+ } else if (args[i + 1] === "0") {
+ img.style.opacity = "1";
+ }
+ }
+} \ No newline at end of file