From be568feef204eeb07ded55cb51c1e4ba8f2e9c92 Mon Sep 17 00:00:00 2001 From: sD Date: Sat, 21 Dec 2019 19:00:25 +0100 Subject: self offset --- webAO/client.css | 1 - webAO/client.js | 23 ++++++++++++++++++++++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/webAO/client.css b/webAO/client.css index 5056e27..82199e2 100644 --- a/webAO/client.css +++ b/webAO/client.css @@ -161,7 +161,6 @@ img { height: 100%; width: 100%; bottom: 0; - left: 0; } #client_pair_char { diff --git a/webAO/client.js b/webAO/client.js index cccf2c8..c5ff1b2 100644 --- a/webAO/client.js +++ b/webAO/client.js @@ -1259,6 +1259,9 @@ class Viewport { "2": "objection", "3": "takethat" }; + // Hide old characters + charSprite.style.display = "none"; + pairSprite.style.display = "none"; // gets which shout shall played const shout = shouts[this.chatmsg.objection]; @@ -1302,15 +1305,17 @@ class Viewport { const charName = this.chatmsg.name.toLowerCase(); const preanim = this.chatmsg.preanim.toLowerCase(); charSprite.src = `${AO_HOST}characters/${charName}/${preanim}.gif`; + charSprite.style.display = ""; } if (extrafeatures.includes("cccc_ic_support")) { if (this.chatmsg.other_name) { const pairName = this.chatmsg.other_name.toLowerCase(); const pairEmote = this.chatmsg.other_emote.toLowerCase(); - pairSprite.style.display = ""; pairSprite.style.left = this.chatmsg.other_offset+"%"; + charSprite.style.left = this.chatmsg.self_offset+"%"; pairSprite.src = `${AO_HOST}characters/${pairName}/(a)${pairEmote}.gif`; + pairSprite.style.display = ""; } else { pairSprite.style.display = "none"; } @@ -1372,10 +1377,25 @@ class Viewport { changeBackground(this.chatmsg.side); } + if (extrafeatures.includes("cccc_ic_support")) { + if (this.chatmsg.other_name) { + const pairName = this.chatmsg.other_name.toLowerCase(); + 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.style.display = ""; + } else { + pairSprite.style.display = "none"; + } + } + charSprite.src = AO_HOST + "characters/" + this.chatmsg.name.toLowerCase() + "/" + this.chatmsg.speaking.toLowerCase() + ".gif"; + charSprite.style.display = ""; if (this.textnow === this.chatmsg.content) { charSprite.src = AO_HOST + "characters/" + this.chatmsg.name.toLowerCase() + "/" + this.chatmsg.silent.toLowerCase() + ".gif"; + charSprite.style.display = ""; this._animating = false; clearTimeout(this.updater); } @@ -1397,6 +1417,7 @@ class Viewport { this.textTimer = 0; this._animating = false; charSprite.src = AO_HOST + "characters/" + this.chatmsg.name.toLowerCase() + "/" + this.chatmsg.silent.toLowerCase() + ".gif"; + charSprite.style.display = ""; clearTimeout(this.updater); } } -- cgit