diff options
| author | sD <stoned@derpymail.org> | 2020-02-14 21:17:57 +0100 |
|---|---|---|
| committer | sD <stoned@derpymail.org> | 2020-02-14 21:17:57 +0100 |
| commit | 0d85606a9fce42066d5217d51951c14ec2215bba (patch) | |
| tree | a747bb59f058aac953679b42449cc4566e153e38 | |
| parent | 092dee81590a821d4e837581a3b3847663f21223 (diff) | |
it is safe to assume that _HD characters are stolen from DRO so i can just load the png instead
| -rw-r--r-- | webAO/client.js | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/webAO/client.js b/webAO/client.js index 80b058a..18a4983 100644 --- a/webAO/client.js +++ b/webAO/client.js @@ -507,13 +507,26 @@ class Client extends EventEmitter { //we already set defaults } + let characterName = safe_tags(args[3]); + let spriteName = safe_tags(args[4]).toLowerCase(); + let speakingsprite; + let silentsprite; + + if (characterName.toLowerCase().endsWith("_hd")) { + speakingsprite = spriteName + ".png"; + silentsprite = spriteName + ".png"; + } else { + speakingsprite = "(b)" + spriteName + ".gif"; + silentsprite = "(a)" + spriteName + ".gif"; + } + let chatmsg = { deskmod: safe_tags(args[1]).toLowerCase(), preanim: safe_tags(args[2]).toLowerCase(), // get preanim nameplate: msg_nameplate, // TODO: there's a new feature that let's people choose the name that's displayed - name: safe_tags(args[3]), - speaking: "(b)" + safe_tags(args[4]).toLowerCase(), - silent: "(a)" + safe_tags(args[4]).toLowerCase(), + name: characterName, + speaking: speakingsprite, + silent: silentsprite, content: this.prepChat(args[5]), // Escape HTML tags side: args[6].toLowerCase(), sound: safe_tags(args[7]).toLowerCase(), @@ -1593,11 +1606,11 @@ class Viewport { } } - charSprite.src = AO_HOST + "characters/" + encodeURI(this.chatmsg.name.toLowerCase()) + "/" + encodeURI(this.chatmsg.speaking.toLowerCase()) + ".gif"; + charSprite.src = AO_HOST + "characters/" + encodeURI(this.chatmsg.name.toLowerCase()) + "/" + encodeURI(this.chatmsg.speaking); charSprite.style.display = ""; if (this.textnow === this.chatmsg.content) { - charSprite.src = AO_HOST + "characters/" + encodeURI(this.chatmsg.name.toLowerCase()) + "/" + encodeURI(this.chatmsg.silent.toLowerCase()) + ".gif"; + charSprite.src = AO_HOST + "characters/" + encodeURI(this.chatmsg.name.toLowerCase()) + "/" + encodeURI(this.chatmsg.silent); charSprite.style.display = ""; waitingBox.innerHTML = "▶"; this._animating = false; @@ -1617,7 +1630,7 @@ class Viewport { if (this.textnow === this.chatmsg.content) { this.textTimer = 0; this._animating = false; - charSprite.src = AO_HOST + "characters/" + encodeURI(this.chatmsg.name.toLowerCase()) + "/" + encodeURI(this.chatmsg.silent.toLowerCase()) + ".gif"; + charSprite.src = AO_HOST + "characters/" + encodeURI(this.chatmsg.name.toLowerCase()) + "/" + encodeURI(this.chatmsg.silent); charSprite.style.display = ""; waitingBox.innerHTML = "▶"; clearTimeout(this.updater); @@ -2523,7 +2536,7 @@ function safe_tags(unsafe) { if (unsafe) { return unsafe .replace(/&/g, "&") - .replace(/</g, "<") + .replace(/</g, "<"); //.replace(/"/g, """) //.replace(/'/g, "'"); } else { |
