aboutsummaryrefslogtreecommitdiff
path: root/webAO/client.js
diff options
context:
space:
mode:
authorstoned <stoned@SPC.fritz.box>2022-01-19 14:18:49 +0100
committerstoned <stoned@SPC.fritz.box>2022-01-19 14:18:49 +0100
commitb89bb1c580e45c78bdb0afe0d989771bbd3d4afa (patch)
treed35eb021a05d576a598e6f42036390e78ae704d0 /webAO/client.js
parent56b082d2f83cf246dd017b361bfa95876769469c (diff)
add timers
Diffstat (limited to 'webAO/client.js')
-rw-r--r--webAO/client.js21
1 files changed, 21 insertions, 0 deletions
diff --git a/webAO/client.js b/webAO/client.js
index a2d70fb..cfb0969 100644
--- a/webAO/client.js
+++ b/webAO/client.js
@@ -199,6 +199,7 @@ class Client extends EventEmitter {
this.on("BN", this.handleBN.bind(this));
this.on("HP", this.handleHP.bind(this));
this.on("RT", this.handleRT.bind(this));
+ this.on("TI", this.handleTI.bind(this));
this.on("ZZ", this.handleZZ.bind(this));
this.on("HI", this.handleHI.bind(this));
this.on("ID", this.handleID.bind(this));
@@ -1318,6 +1319,26 @@ class Client extends EventEmitter {
}
/**
+ * Handles a timer update
+ * @param {Array} args packet arguments
+ */
+ handleTI(args) {
+ const timerid = Number(args[1]);
+ const type = Number(args[2]);
+ const timer_value = Number(args[3]);
+ switch (type) {
+ case 0:
+ //
+ case 1:
+ document.getElementById("client_timer"+timerid).innerText = timer_value;
+ case 2:
+ document.getElementById("client_timer"+timerid).style.display = "";
+ case 3:
+ document.getElementById("client_timer"+timerid).style.display = "none";
+ }
+ }
+
+ /**
* Handles a modcall
* @param {Array} args packet arguments
*/