diff --git a/_datafiles/html/public/webclient-pure.html b/_datafiles/html/public/webclient-pure.html index 7dbed51d..4189e4d7 100644 --- a/_datafiles/html/public/webclient-pure.html +++ b/_datafiles/html/public/webclient-pure.html @@ -255,6 +255,69 @@

Volume Controls

roomZones: {}, }; let GMCPUpdateHandlers = { + "Comm": function() { + + var obj = GMCPStructs["Comm"]; + if ( !obj.Channel ) { + return; + } + + if ( !GMCPWindows['Comm'] && GMCPWindows['Comm'] !== false ) { + + GMCPWindows['Comm'] = new WinBox({ title: "Communications", + mount: document.getElementById("comm-output"), + background: "#1c6b60", border: 1, + x: "right", y: 450, + width:363, height:20+290, + header: 20, + bottom: 60, // Limit how far down it can go. This affects docking the minimized window. + // end limit position range + onclose: force => { GMCPWindows['Comm'] = false; return false; }, + }); + + GMCPWindows['Comm'].Message = function(channelName, fromName, fromSource, message) { + + // add new text output + var tab = document.getElementById("comm-tab-"+channelName); + var panel = document.getElementById("comm-"+channelName); + + if ( tab.classList.contains('active') ) { + tab.dataset.unread = 0; + tab.innerText = tab.dataset.label; + } else { + tab.dataset.unread = parseInt(tab.dataset.unread)+1; + tab.innerText = tab.dataset.label + "(" + String(tab.dataset.unread) + ")"; + } + + var p = document.createElement('p'); + p.innerHTML = '' + + fromName + + ': ' + + '' + + message + + ''; + panel.appendChild(p); + + // clean up overflow + panelContainer = GMCPWindows['Comm'].window; + while (panel.scrollHeight > panelContainer.clientHeight-58) { + if ( panel.childElementCount < 1) { + break; + } + panel.removeChild(panel.firstElementChild); + } + + }; + + } + + if ( GMCPWindows['Comm'] === false ) { + return; + } + + GMCPWindows['Comm'].Message(obj.Channel.channel, obj.Channel.sender, obj.Channel.source, obj.Channel.text); + + }, "Room": function() { var obj = GMCPStructs["Room"]; @@ -269,10 +332,12 @@

Volume Controls

background: "#1c6b60", border: 1, x: "right", - y: 0, - width:300, - height:20+300, + y: 66, + width:363, + height:20+363, header: 20, + bottom: 60, // Limit how far down it can go. This affects docking the minimized window. + // end limit position range onclose: force => { GMCPWindows['Map'] = false; return false; }, oncreate: ops => { @@ -391,17 +456,13 @@

Volume Controls

mount: document.getElementById("vitals-bars"), background: "#1c6b60", border: 1, - x: "right", - y: 320, + x: window.innerWidth-300-63,//"right", + y: 0, width:300, - height:20+120, + height:20+40, header: 20, + bottom: 60, // Limit how far down it can go. This affects docking the minimized window. onclose: force => { GMCPWindows['Char.Vitals'] = false; return false; }, - oncreate: opts => { - opts.width = document.getElementById('vitals-bars').style.width; - opts.height = "48px"; - } - }); } @@ -983,86 +1044,181 @@

Volume Controls

/* add these styles once (e.g. in your global + + + + +
+ +
@@ -1074,7 +1230,26 @@

Volume Controls

+
+ + +
+
+ + + + +
+
+
+
+
+
+
+
+
+ diff --git a/_datafiles/world/default/mobs/frostfang/scripts/40-rodric.js b/_datafiles/world/default/mobs/frostfang/scripts/40-rodric.js index 5eebebc0..83e1508e 100644 --- a/_datafiles/world/default/mobs/frostfang/scripts/40-rodric.js +++ b/_datafiles/world/default/mobs/frostfang/scripts/40-rodric.js @@ -121,6 +121,7 @@ function onPath(mob, room, eventDetails) { } var RANDOM_IDLE = [ + "pathto "+String(INN_ROOM_ID), "emote shakes his head in disbelief.", "emote attempts to fix a rat trap.", "say There's just too many rats. We'll never get rid of them all.", @@ -128,7 +129,6 @@ var RANDOM_IDLE = [ "say I'm running out of traps. I need to find more.", "say I'm worried about the rats in the slums. They're everywhere!", "say I'm running out of traps and don't seem to be making a dent in the rat numbers.", - "pathto "+String(INN_ROOM_ID), ]; // Invoked once every round if mob is idle @@ -144,6 +144,9 @@ function onIdle(mob, room) { } randNum = UtilDiceRoll(1, 12)-1; + if ( randNum == 0) { // double zero needed for the pathto event + randNum = UtilDiceRoll(1, 12)-1; + } if ( randNum < RANDOM_IDLE.length ) { mob.Command(RANDOM_IDLE[randNum]); return true; diff --git a/modules/gmcp/gmcp.Comm.go b/modules/gmcp/gmcp.Comm.go index b52b04f6..401a27ec 100644 --- a/modules/gmcp/gmcp.Comm.go +++ b/modules/gmcp/gmcp.Comm.go @@ -51,6 +51,12 @@ func (g *GMCPCommModule) onComm(e events.Event) events.ListenerReturn { Text: ansitags.Parse(evt.Message, ansitags.StripTags), } + if evt.SourceUserId > 0 { + payload.Source = `player` + } else if evt.SourceMobInstanceId > 0 { + payload.Source = `mob` + } + // Sent to everyone. // say, party, broadcast, whisper @@ -119,5 +125,6 @@ func (g *GMCPCommModule) onComm(e events.Event) events.ListenerReturn { type GMCPCommModule_Payload struct { Channel string `json:"channel"` Sender string `json:"sender"` + Source string `json:"source"` Text string `json:"text"` }