aboutsummaryrefslogtreecommitdiff
path: root/webAO/packets/handlers/handleHP.ts
diff options
context:
space:
mode:
authorstonedDiscord <stonedDiscord@users.noreply.github.com>2024-11-20 13:31:50 +0000
committerGitHub Action <actions@github.com>2024-11-20 13:31:50 +0000
commit6684f3fce6e90fd0574d7bab63b629554ab03ef6 (patch)
treeb2a62247d17e23a77af57aea355ba621666817c2 /webAO/packets/handlers/handleHP.ts
parent95a2d1361d84c61b454ebe506e6963b93f6d8dee (diff)
Prettified Code!
Diffstat (limited to 'webAO/packets/handlers/handleHP.ts')
-rw-r--r--webAO/packets/handlers/handleHP.ts29
1 files changed, 14 insertions, 15 deletions
diff --git a/webAO/packets/handlers/handleHP.ts b/webAO/packets/handlers/handleHP.ts
index 81dee64..6347e9f 100644
--- a/webAO/packets/handlers/handleHP.ts
+++ b/webAO/packets/handlers/handleHP.ts
@@ -5,18 +5,17 @@ import { client } from "../../client";
* @param {Array} args packet arguments
*/
export const handleHP = (args: string[]) => {
- const percent_hp = Number(args[2]) * 10;
- let healthbox;
- if (args[1] === "1") {
- // Def hp
- client.hp[0] = Number(args[2]);
- healthbox = document.getElementById("client_defense_hp");
- } else {
- // Pro hp
- client.hp[1] = Number(args[2]);
- healthbox = document.getElementById("client_prosecutor_hp");
- }
- (<HTMLElement>(
- healthbox.getElementsByClassName("health-bar")[0]
- )).style.width = `${percent_hp}%`;
-}
+ const percent_hp = Number(args[2]) * 10;
+ let healthbox;
+ if (args[1] === "1") {
+ // Def hp
+ client.hp[0] = Number(args[2]);
+ healthbox = document.getElementById("client_defense_hp");
+ } else {
+ // Pro hp
+ client.hp[1] = Number(args[2]);
+ healthbox = document.getElementById("client_prosecutor_hp");
+ }
+ (<HTMLElement>healthbox.getElementsByClassName("health-bar")[0]).style.width =
+ `${percent_hp}%`;
+};