aboutsummaryrefslogtreecommitdiff
path: root/webAO
diff options
context:
space:
mode:
authorsD <stoned@derpymail.org>2020-06-06 17:42:22 +0200
committersD <stoned@derpymail.org>2020-06-06 17:42:22 +0200
commitf3e1694c23bc7e587e2a6a55ca5f49052cce832a (patch)
tree95639f66d7bb0ff38036ae91a891492ab65b7017 /webAO
parentaa5efcf3ff9c29eb13c89ec985ace0a5dcef3d1a (diff)
allow the paired char to be png too
Diffstat (limited to 'webAO')
-rw-r--r--webAO/client.js16
1 files changed, 14 insertions, 2 deletions
diff --git a/webAO/client.js b/webAO/client.js
index 9925cab..8377551 100644
--- a/webAO/client.js
+++ b/webAO/client.js
@@ -1667,6 +1667,18 @@ async changeBackground(position) {
this.silentSprite = AO_HOST + "characters/" + encodeURI(this.chatmsg.name.toLowerCase()) + "/(a)" + this.chatmsg.sprite + ".gif";
}
+ if (this.chatmsg.other_name) {
+ try {
+ const { url: pairUrl } = await this.oneSuccess([
+ this.rejectOnError(fetch(AO_HOST + "characters/" + encodeURI(this.chatmsg.other_name.toLowerCase()) + "/" + this.chatmsg.sprite + ".png")),
+ this.rejectOnError(fetch(AO_HOST + "characters/" + encodeURI(this.chatmsg.other_name.toLowerCase()) + "/(a)" + this.chatmsg.sprite + ".gif"))
+ ]);
+ this.pairSilent = pairUrl ? pairUrl : transparentPNG;
+ } catch (error) {
+ this.pairSilent = AO_HOST + "characters/" + encodeURI(this.chatmsg.other_name.toLowerCase()) + "/(a)" + this.chatmsg.sprite + ".gif";
+ }
+ }
+
// gets which shout shall played
const shoutSprite = document.getElementById("client_shout");
const shout = this.shouts[this.chatmsg.objection];
@@ -1823,7 +1835,7 @@ async changeBackground(position) {
const pairEmote = this.chatmsg.other_emote.toLowerCase();
pairSprite.style.left = this.chatmsg.other_offset + "%";
charSprite.style.left = this.chatmsg.self_offset + "%";
- pairSprite.src = `${AO_HOST}characters/${pairName}/(a)${pairEmote}.gif`;
+ pairSprite.src = this.pairSilent;
pairSprite.style.opacity = 1;
} else {
pairSprite.style.opacity = 0;
@@ -1872,7 +1884,7 @@ async changeBackground(position) {
const pairEmote = this.chatmsg.other_emote.toLowerCase();
pairSprite.style.left = this.chatmsg.other_offset + "%";
charSprite.style.left = this.chatmsg.self_offset + "%";
- pairSprite.src = `${AO_HOST}characters/${pairName}/(a)${pairEmote}.gif`;
+ pairSprite.src = this.pairSilent;
pairSprite.style.opacity = 1;
} else {
pairSprite.style.opacity = 0;