From 6531a5c803f2144025273448e7d43bd5f43d11da Mon Sep 17 00:00:00 2001 From: sD Date: Thu, 19 Dec 2019 19:12:15 +0100 Subject: fix nameplate and load cookies with the settings tab --- webAO/client.js | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) (limited to 'webAO/client.js') diff --git a/webAO/client.js b/webAO/client.js index 67bbcab..7a0f467 100644 --- a/webAO/client.js +++ b/webAO/client.js @@ -341,7 +341,6 @@ class Client extends EventEmitter { * Triggered when a connection is established to the server. */ onOpen(_e) { - client.loadResources(); client.joinServer(); } @@ -408,16 +407,26 @@ class Client extends EventEmitter { // TODO: this if-statement might be a bug. if (args[4] !== viewport.chatmsg.content) { document.getElementById("client_inner_chat").innerHTML = ""; + + let msg_nameplate = args[3]; + let msg_blips = "male"; + try { + msg_nameplate = this.chars[args[9]].showname; + msg_blips = this.chars[args[9]].gender; + } catch(e) { + //we already set defaults + } + const chatmsg = { preanim: escape(args[2]).toLowerCase(), // get preanim - nameplate: this.chars[args[9]].showname, + nameplate: msg_nameplate, name: args[3].toLowerCase(), speaking: "(b)" + escape(args[4]).toLowerCase(), silent: "(a)" + escape(args[4]).toLowerCase(), content: this.prepChat(args[5]), // Escape HTML tag side: args[6].toLowerCase(), sound: escape(args[7]).toLowerCase(), - blips: this.chars[args[9]].gender, + blips: msg_blips, type: args[8], charid: args[9], snddelay: args[10], @@ -1653,6 +1662,14 @@ async function changeBackground(position) { } } +/** + * Triggered when the settings tab is fully loaded. + */ +export function loadSettings() { + client.loadResources(); +} +window.loadSettings = loadSettings; + /** * Triggered when the reconnect button is pushed. */ -- cgit