Compare commits
No commits in common. "d0ef60dd4fc2fada77c0d7c6cbd68f5490e5f36c" and "2af9557456829178679d173c8c6b2ba940cd48a2" have entirely different histories.
d0ef60dd4f
...
2af9557456
6 changed files with 16 additions and 133 deletions
|
|
@ -14,9 +14,6 @@ GNU Affero General Public License for more details.
|
||||||
You should have received a copy of the GNU Affero General Public License
|
You should have received a copy of the GNU Affero General Public License
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.*/
|
along with this program. If not, see <https://www.gnu.org/licenses/>.*/
|
||||||
|
|
||||||
//config imports
|
|
||||||
const config = require('../../../config.json');
|
|
||||||
|
|
||||||
//local imports
|
//local imports
|
||||||
const connectedUser = require('./connectedUser');
|
const connectedUser = require('./connectedUser');
|
||||||
const chatBuffer = require('./chatBuffer');
|
const chatBuffer = require('./chatBuffer');
|
||||||
|
|
@ -80,61 +77,6 @@ class activeChannel{
|
||||||
* Child Chat Buffer Object
|
* Child Chat Buffer Object
|
||||||
*/
|
*/
|
||||||
this.chatBuffer = new chatBuffer(server, chanDB, this);
|
this.chatBuffer = new chatBuffer(server, chanDB, this);
|
||||||
|
|
||||||
this.userAnnouncements = {
|
|
||||||
join: [
|
|
||||||
"%UNAME% joined.",
|
|
||||||
"%UNAME% arrived.",
|
|
||||||
"%UNAME% appeared.",
|
|
||||||
"%UNAME% hopped in.",
|
|
||||||
"%UNAME% checked in.",
|
|
||||||
"%UNAME% checked in to see what condition their condition was in.",
|
|
||||||
"%UNAME% logged in.",
|
|
||||||
"%UNAME% turned on, tuned in, and dropped out.",
|
|
||||||
`%UNAME% is now using ${config.instanceName}.`,
|
|
||||||
`%UNAME% is now watching #${this.name}.`,
|
|
||||||
"%UNAME% tuned in.",
|
|
||||||
"%UNAME% is ready to sparkem.",
|
|
||||||
"%UNAME% connected.",
|
|
||||||
"%UNAME% joins the battle.",
|
|
||||||
"%UNAME% hopped on.",
|
|
||||||
"%UNAME% logged on.",
|
|
||||||
`${config.instanceName}, population: %UNAME%`,
|
|
||||||
"Welcome, %UNAME%.",
|
|
||||||
"Salutations, %UNAME%.",
|
|
||||||
"Hello, %UNAME%.",
|
|
||||||
"Greetings, %UNAME%.",
|
|
||||||
"Sup, %UNAME%.",
|
|
||||||
"I AM THE GOD OF HELLFIRE, AND I BRING YOU: %UNAME%!",
|
|
||||||
"A wild %UNAME% has appeared!"
|
|
||||||
],
|
|
||||||
leave: [
|
|
||||||
"%UNAME% left.",
|
|
||||||
"%UNAME% dropped out.",
|
|
||||||
"%UNAME% checked out.",
|
|
||||||
"%UNAME% quit.",
|
|
||||||
"%UNAME% is no longer with us.",
|
|
||||||
`%UNAME% is no longer using ${config.instanceName}.`,
|
|
||||||
"%UNAME% dipped.",
|
|
||||||
"%UNAME% booked it.",
|
|
||||||
"%UNAME% cheesed it.",
|
|
||||||
"%UNAME% vanished.",
|
|
||||||
"%UNAME% said dueces.",
|
|
||||||
"%UNAME% has left the building.",
|
|
||||||
"%UNAME% bounced.",
|
|
||||||
"%UNAME% is beyond the horizon.",
|
|
||||||
"%UNAME% has drifted into space.",
|
|
||||||
"%UNAME% is outskies.",
|
|
||||||
"%UNAME% went to the shadow realm.",
|
|
||||||
"Goodbye, %UNAME%.",
|
|
||||||
"Dueces, %UNAME%.",
|
|
||||||
"Bye, %UNAME%.",
|
|
||||||
"Farewell, %UNAME%.",
|
|
||||||
"l8r %UNAME%.",
|
|
||||||
"That'll do, %UNAME%."
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -208,9 +150,6 @@ class activeChannel{
|
||||||
|
|
||||||
//If this is the last connection for this user, remove them from the userlist
|
//If this is the last connection for this user, remove them from the userlist
|
||||||
this.userList.delete(socket.user.user);
|
this.userList.delete(socket.user.user);
|
||||||
|
|
||||||
//Broadcast the un-welcome wagon
|
|
||||||
this.welcomeWagon(socket.user.user, true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//and send out the filtered list
|
//and send out the filtered list
|
||||||
|
|
@ -256,20 +195,6 @@ class activeChannel{
|
||||||
//Broadcast that sumbitch
|
//Broadcast that sumbitch
|
||||||
this.server.io.in(this.name).emit('chanEmotes', emoteList);
|
this.server.io.in(this.name).emit('chanEmotes', emoteList);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Basic function to welcome/send off connecting/disconnecting users
|
|
||||||
* @param {string} user - user to welcome
|
|
||||||
* @param {boolean} leaving - true if user is leaving instead of joining
|
|
||||||
*/
|
|
||||||
async welcomeWagon(user, leaving = false){
|
|
||||||
//Grab the applicable list depending on if the user is leaving or not
|
|
||||||
const activeList = leaving ? this.userAnnouncements.leave : this.userAnnouncements.join;
|
|
||||||
//Randomly yoink the applicable message
|
|
||||||
const msg = activeList[Math.floor(Math.random() * activeList.length)];
|
|
||||||
|
|
||||||
this.server.chatHandler.relayChat(user, "", 0, msg.replace("%UNAME%", user), "serverwhisper", this.name, []);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = activeChannel;
|
module.exports = activeChannel;
|
||||||
|
|
@ -230,12 +230,6 @@ class chatHandler{
|
||||||
//Send out chat
|
//Send out chat
|
||||||
this.server.io.in(chan).emit("chatMessage", chat);
|
this.server.io.in(chan).emit("chatMessage", chat);
|
||||||
|
|
||||||
//If we're relaying a channel-wide serverwhisper
|
|
||||||
if(chat.type == "serverwhisper"){
|
|
||||||
//Don't bother throwing it into the buffer
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const channel = this.server.activeChannels.get(chan);
|
const channel = this.server.activeChannels.get(chan);
|
||||||
|
|
||||||
//If chat buffer length is over mandated size
|
//If chat buffer length is over mandated size
|
||||||
|
|
|
||||||
|
|
@ -237,9 +237,6 @@ class connectedUser{
|
||||||
|
|
||||||
//Send off the metadata to our user's clients
|
//Send off the metadata to our user's clients
|
||||||
this.emit("clientMetadata", {user: userObj, flairList, queueLock, chatBuffer, streamType: chanDB.settings.streamType});
|
this.emit("clientMetadata", {user: userObj, flairList, queueLock, chatBuffer, streamType: chanDB.settings.streamType});
|
||||||
|
|
||||||
//Broadcast the welcome wagon
|
|
||||||
this.channel.welcomeWagon(userDB.user);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -176,12 +176,6 @@ p.panel-head-element{
|
||||||
flex-direction: var(--chat-entry-flex-direction);
|
flex-direction: var(--chat-entry-flex-direction);
|
||||||
}
|
}
|
||||||
|
|
||||||
.chat-entry-serverwhisper, .chat-entry-tokewhisper{
|
|
||||||
overflow: hidden;
|
|
||||||
transition: max-height 0.5s;
|
|
||||||
max-height: 5em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.chat-entry-nameplate, .pm-panel-sesh-entry-nameplate{
|
.chat-entry-nameplate, .pm-panel-sesh-entry-nameplate{
|
||||||
display: flex;
|
display: flex;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -445,21 +445,17 @@ p.channel-guide-entry-item{
|
||||||
box-shadow: var(--focus-glow0-alt0-inset-top);
|
box-shadow: var(--focus-glow0-alt0-inset-top);
|
||||||
}
|
}
|
||||||
|
|
||||||
.chat-entry-tokewhisper, .chat-entry-serverwhisper{
|
|
||||||
background-color: var(--bg2-alt1);
|
|
||||||
}
|
|
||||||
|
|
||||||
.serverwhisper, .chat-entry-toke{
|
.serverwhisper, .chat-entry-toke{
|
||||||
background-color: var(--bg2-alt1);
|
background-color: var(--bg1);
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0.2em 0.1em;
|
padding: 0.2em 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.chat-entry:nth-child(even):not(.chat-entry-toke, .chat-entry-serverwhisper, .chat-entry-tokewhisper){
|
.chat-entry:nth-child(even):not(.chat-entry-toke){
|
||||||
background-color: var(--bg0);
|
background-color: var(--bg0);
|
||||||
}
|
}
|
||||||
|
|
||||||
.chat-entry:nth-child(odd):not(.chat-entry-toke, .chat-entry-serverwhisper, .chat-entry-tokewhisper){
|
.chat-entry:nth-child(odd):not(.chat-entry-toke){
|
||||||
background-color: var(--bg1-alt0);
|
background-color: var(--bg1-alt0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -499,31 +495,31 @@ p.channel-guide-entry-item{
|
||||||
color: var(--userlist-color6);
|
color: var(--userlist-color6);
|
||||||
}
|
}
|
||||||
|
|
||||||
.chat-userlist-color0:not(.chat-entry-toke, .chat-entry-serverwhisper, .chat-entry-tokewhisper, .chat-entry-announcement), .pm-panel-sesh-userlist-color0{/*green0*/
|
.chat-userlist-color0:not(.chat-entry-toke, .chat-entry-whisper, .chat-entry-tokewhisper, .chat-entry-announcement), .pm-panel-sesh-userlist-color0{/*green0*/
|
||||||
border-left: solid 5px var(--userlist-color0);
|
border-left: solid 5px var(--userlist-color0);
|
||||||
}
|
}
|
||||||
|
|
||||||
.chat-userlist-color1:not(.chat-entry-toke, .chat-entry-serverwhisper, .chat-entry-tokewhisper, .chat-entry-announcement), .pm-panel-sesh-userlist-color1{/*red0*/
|
.chat-userlist-color1:not(.chat-entry-toke, .chat-entry-whisper, .chat-entry-tokewhisper, .chat-entry-announcement), .pm-panel-sesh-userlist-color1{/*red0*/
|
||||||
border-left: solid 5px var(--userlist-color1);
|
border-left: solid 5px var(--userlist-color1);
|
||||||
}
|
}
|
||||||
|
|
||||||
.chat-userlist-color2:not(.chat-entry-toke, .chat-entry-serverwhisper, .chat-entry-tokewhisper, .chat-entry-announcement), .pm-panel-sesh-userlist-color2{/*blue0*/
|
.chat-userlist-color2:not(.chat-entry-toke, .chat-entry-whisper, .chat-entry-tokewhisper, .chat-entry-announcement), .pm-panel-sesh-userlist-color2{/*blue0*/
|
||||||
border-left: solid 5px var(--userlist-color2);
|
border-left: solid 5px var(--userlist-color2);
|
||||||
}
|
}
|
||||||
|
|
||||||
.chat-userlist-color3:not(.chat-entry-toke, .chat-entry-serverwhisper, .chat-entry-tokewhisper, .chat-entry-announcement), .pm-panel-sesh-userlist-color3{/*tan0*/
|
.chat-userlist-color3:not(.chat-entry-toke, .chat-entry-whisper, .chat-entry-tokewhisper, .chat-entry-announcement), .pm-panel-sesh-userlist-color3{/*tan0*/
|
||||||
border-left: solid 5px var(--userlist-color3);
|
border-left: solid 5px var(--userlist-color3);
|
||||||
}
|
}
|
||||||
|
|
||||||
.chat-userlist-color4:not(.chat-entry-toke, .chat-entry-serverwhisper, .chat-entry-tokewhisper, .chat-entry-announcement), .pm-panel-sesh-userlist-color4{/*pink0*/
|
.chat-userlist-color4:not(.chat-entry-toke, .chat-entry-whisper, .chat-entry-tokewhisper, .chat-entry-announcement), .pm-panel-sesh-userlist-color4{/*pink0*/
|
||||||
border-left: solid 5px var(--userlist-color4);
|
border-left: solid 5px var(--userlist-color4);
|
||||||
}
|
}
|
||||||
|
|
||||||
.chat-userlist-color5:not(.chat-entry-toke, .chat-entry-serverwhisper, .chat-entry-tokewhisper, .chat-entry-announcement), .pm-panel-sesh-userlist-color5{/*orange*/
|
.chat-userlist-color5:not(.chat-entry-toke, .chat-entry-whisper, .chat-entry-tokewhisper, .chat-entry-announcement), .pm-panel-sesh-userlist-color5{/*orange*/
|
||||||
border-left: solid 5px var(--userlist-color5);
|
border-left: solid 5px var(--userlist-color5);
|
||||||
}
|
}
|
||||||
|
|
||||||
.chat-userlist-color6:not(.chat-entry-toke, .chat-entry-serverwhisper, .chat-entry-tokewhisper, .chat-entry-announcement), .pm-panel-sesh-userlist-color6{/*violet*/
|
.chat-userlist-color6:not(.chat-entry-toke, .chat-entry-whisper, .chat-entry-tokewhisper, .chat-entry-announcement), .pm-panel-sesh-userlist-color6{/*violet*/
|
||||||
border-left: solid 5px var(--userlist-color6);
|
border-left: solid 5px var(--userlist-color6);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -664,13 +664,9 @@ class chatPostprocessor{
|
||||||
//add whisper class
|
//add whisper class
|
||||||
this.chatBody.classList.add('whisper');
|
this.chatBody.classList.add('whisper');
|
||||||
}else if(this.rawData.type == "announcement"){
|
}else if(this.rawData.type == "announcement"){
|
||||||
//Squash the high-level
|
//Squash the high-level & timestamp
|
||||||
this.chatEntry.querySelector('.high-level').remove();
|
this.chatEntry.querySelector('.high-level').remove();
|
||||||
//If the user is displaying timestamps
|
|
||||||
if(localStorage.getItem('nameplateFormat') == "timestamp"){
|
|
||||||
//Remove the timestamp from the chat entry
|
|
||||||
this.chatEntry.querySelector('.chat-entry-timestamp').remove();
|
this.chatEntry.querySelector('.chat-entry-timestamp').remove();
|
||||||
}
|
|
||||||
|
|
||||||
//Get the username and make it into an announcement title (little hacky but this *IS* postprocessing)
|
//Get the username and make it into an announcement title (little hacky but this *IS* postprocessing)
|
||||||
const userNode = this.chatEntry.querySelector('.chat-entry-username');
|
const userNode = this.chatEntry.querySelector('.chat-entry-username');
|
||||||
|
|
@ -696,27 +692,15 @@ class chatPostprocessor{
|
||||||
|
|
||||||
//Add toke/tokewhisper class
|
//Add toke/tokewhisper class
|
||||||
this.chatBody.classList.add("toke");
|
this.chatBody.classList.add("toke");
|
||||||
}else if(this.rawData.type == "tokewhisper" || this.rawData.type == "serverwhisper"){
|
}else if(this.rawData.type == "tokewhisper"){
|
||||||
//Squash the high-level
|
//Squash the high-level
|
||||||
this.chatEntry.querySelector('.high-level').remove();
|
this.chatEntry.querySelector('.high-level').remove();
|
||||||
|
|
||||||
//remove the username
|
//remove the username
|
||||||
this.chatEntry.querySelector('.chat-entry-username').remove();
|
this.chatEntry.querySelector('.chat-entry-username').remove();
|
||||||
|
|
||||||
//Add serverwhisper class
|
//Add toke/tokewhisper class
|
||||||
this.chatBody.classList.add("serverwhisper");
|
this.chatBody.classList.add("tokewhisper","serverwhisper");
|
||||||
|
|
||||||
//If this is a toke whisper
|
|
||||||
if(this.rawData.type == "tokewhisper"){
|
|
||||||
//Add tokewhisper class
|
|
||||||
this.chatBody.classList.add("tokewhisper");
|
|
||||||
}
|
|
||||||
|
|
||||||
//Set variable to hold chatEntry so the one after doesnt get clobbered by the killServerWhisper function
|
|
||||||
const currentWhisper = this.chatEntry;
|
|
||||||
|
|
||||||
//Kill server whispers after 10s, just like fore.st XP
|
|
||||||
setTimeout(()=>{this.killServerWhisper(currentWhisper)}, 10000);
|
|
||||||
}else if(this.rawData.type == "spoiler"){
|
}else if(this.rawData.type == "spoiler"){
|
||||||
//Set whole-body spoiler
|
//Set whole-body spoiler
|
||||||
this.chatBody.classList.add("spoiler");
|
this.chatBody.classList.add("spoiler");
|
||||||
|
|
@ -731,11 +715,4 @@ class chatPostprocessor{
|
||||||
this.chatBody.classList.add("italics");
|
this.chatBody.classList.add("italics");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
killServerWhisper(whisper, delay = 500){
|
|
||||||
//Drop max height to 0 to trigger the fancy animation
|
|
||||||
whisper.style.maxHeight = 0;
|
|
||||||
//Remove whisper after animation is done
|
|
||||||
setTimeout(()=>{whisper.remove()}, delay);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue