diff options
| author | sD <stoned@derpymail.org> | 2020-02-23 20:01:20 +0100 |
|---|---|---|
| committer | sD <stoned@derpymail.org> | 2020-02-23 20:01:20 +0100 |
| commit | 18f5544d270ed66b1da6ba89191ff68ee3f5ff6e (patch) | |
| tree | 5a5105beb09dd13100301165eb7b71928a691db9 | |
| parent | 331fe4425dd22165a9b79d39adcf7d5a3d944e4e (diff) | |
""fix"" sfx on no preanim
| -rw-r--r-- | webAO/client.js | 35 |
1 files changed, 24 insertions, 11 deletions
diff --git a/webAO/client.js b/webAO/client.js index fa8942b..4081c17 100644 --- a/webAO/client.js +++ b/webAO/client.js @@ -1246,6 +1246,8 @@ class Viewport { const fg = document.getElementById("client_fg"); const gamewindow = document.getElementById("client_gamewindow"); + let delay=0; + // Reset CSS animation fg.style.animation = ""; gamewindow.style.animation = ""; @@ -1254,6 +1256,7 @@ class Viewport { appendICLog(chatmsg.content, chatmsg.nameplate); changeBackground(chatmsg.side); + clearTimeout(this.updater); if (this.chatmsg.name.toLowerCase().endsWith("_hd")) { @@ -1290,19 +1293,29 @@ class Viewport { this.chatmsg.isnew = false; this.chatmsg.startpreanim = true; - // If preanim existed then determine the length - if (this.chatmsg.preanim !== "-" && this.chatmsg.preanim !== "" && this.chatmsg.preanim !== undefined) { - // Hide message box - nameBox.style.display = "none"; - chatBox.style.display = "none"; - chatContainerBox.style.display = "none"; - const delay = await this.getAnimLength(`${AO_HOST}characters/${encodeURI(chatmsg.name.toLowerCase())}/${encodeURI(chatmsg.preanim)}.gif`); - chatmsg.preanimdelay = delay; - this.initUpdater(delay); - } else { - this.initUpdater(0); + switch (this.chatmsg.type) { + // case 0: + // normal emote, no preanim + case 1: + // play preanim + // Hide message box + nameBox.style.display = "none"; + chatBox.style.display = "none"; + chatContainerBox.style.display = "none"; + // If preanim existed then determine the length + delay = await this.getAnimLength(`${AO_HOST}characters/${encodeURI(chatmsg.name.toLowerCase())}/${encodeURI(chatmsg.preanim)}.gif`); + chatmsg.preanimdelay = delay; + break; + // case 5: + // zoom + default: + // due to a retarded client bug, we need to strip the sfx from the MS, if the preanim isn't playing + chatmsg.sound = ""; + break; } + this.initUpdater(delay); + //Set the nameplate after it (might) have been hidden nameBox.innerText = this.chatmsg.nameplate; //Clear out the last message |
