aboutsummaryrefslogtreecommitdiff
path: root/webAO/packets/handlers/handleCharsCheck.ts
blob: c862cd796458a9aa10de533ce19fb9ce5a1d6d26 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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";
    }
  }
};