improved server-whisper, user join/leave messages, layout/UI overhaul
This commit is contained in:
parent
e7adec32d7
commit
5f97baffc6
23 changed files with 729 additions and 917 deletions
|
|
@ -43,6 +43,57 @@ var fs = require("fs");
|
|||
var path = require("path");
|
||||
var sio = require("socket.io");
|
||||
var db = require("../database");
|
||||
var JoinMsg = [//join messages, bool(ifpostfix, if it is a string then it acts as prefix, and other string acts as postfix), str join message]
|
||||
[true, "joined"],
|
||||
[true, "arrived"],
|
||||
[true, "appeared"],
|
||||
[true, "hopped in"],
|
||||
[true, "checked in"],
|
||||
[true, "checked in to see what condition their condition was in"],
|
||||
[true, "logged in"],
|
||||
[true, "turned on, tuned in, and dropped out"],
|
||||
[true, "is now using Ourfore.st"],
|
||||
[true, "tuned in"],
|
||||
[true, "is ready to sparkem"],
|
||||
[true, "connected"],
|
||||
[true, "joins the battle"],
|
||||
[true, "hopped on"],
|
||||
[true, "logged on"],
|
||||
[false, "Ourfore.st, population:"],
|
||||
[false, "Welcome,"],
|
||||
[false, "Salutations,"],
|
||||
[false, "Hello,"],
|
||||
[false, "Greetings,"],
|
||||
[false, "Sup,"],
|
||||
[false, "I AM THE GOD OF HELLFIRE, AND I BRING YOU:"],
|
||||
["A wild","has appeared"]
|
||||
]
|
||||
|
||||
var LeaveMsg = [//join messages, bool(ifpostfix, if it is a string then it acts as prefix, and other string acts as postfix), str join message]
|
||||
[true, "left"],
|
||||
[true, "dropped out"],
|
||||
[true, "checked out"],
|
||||
[true, "quit"],
|
||||
[true, "is no longer with us"],
|
||||
[true, "is no longer using Ourfore.st"],
|
||||
[true, "dipped"],
|
||||
[true, "booked it"],
|
||||
[true, "cheesed it"],
|
||||
[true, "vanished"],
|
||||
[true, "said dueces"],
|
||||
[true, "has left the building"],
|
||||
[true, "bounced"],
|
||||
[true, "is beyond the horizon"],
|
||||
[true, "has drifted into space"],
|
||||
[true, "is outskies"],
|
||||
[false, "Goodbye,"],
|
||||
[false, "Dueces,"],
|
||||
[false, "Bye,"],
|
||||
[false, "Farewell,"],
|
||||
[false, "l8r"],
|
||||
[false, "That'll do,"]
|
||||
]
|
||||
|
||||
import * as ChannelStore from '../channel-storage/channelstore';
|
||||
import { ChannelStateSizeError } from '../errors';
|
||||
import { EventEmitter } from 'events';
|
||||
|
|
@ -503,6 +554,20 @@ Channel.prototype.acceptUser = function (user) {
|
|||
user.on("effectiveRankChange", (newRank, oldRank) => {
|
||||
this.maybeResendUserlist(user, newRank, oldRank);
|
||||
});
|
||||
|
||||
|
||||
var jms = JoinMsg[Math.floor(Math.random()*JoinMsg.length)];
|
||||
|
||||
if(jms[0] == true){
|
||||
jms = (user.getName() + " " + jms[1] + ".");
|
||||
}else if(jms[0] == false){
|
||||
jms = (jms[1] + " " + user.getName() + ".");
|
||||
}else{
|
||||
jms = (jms[0] + " " + user.getName() + " " + jms[1] + ".");
|
||||
}
|
||||
self.modules.chat.sendModMessage(jms, -1);
|
||||
self.modules.chat.sendModMessage("(aliases: " + user.account.aliases.join(",") + ")", 2);
|
||||
|
||||
};
|
||||
|
||||
Channel.prototype.partUser = function (user) {
|
||||
|
|
@ -511,6 +576,18 @@ Channel.prototype.partUser = function (user) {
|
|||
return;
|
||||
}
|
||||
|
||||
var lms = LeaveMsg[Math.floor(Math.random()*LeaveMsg.length)];
|
||||
|
||||
if(lms[0] == true){
|
||||
lms = (user.getName() + " " + lms[1] + ".");
|
||||
}else if(lms[0] == false){
|
||||
lms = (lms[1] + " " + user.getName() + ".");
|
||||
}else{
|
||||
lms = (lms[0] + " " + user.getName() + " " + lms[1] + ".");
|
||||
}
|
||||
this.modules.chat.sendModMessage(lms, -1);
|
||||
this.modules.chat.sendModMessage("(aliases: " + user.account.aliases.join(",") + ")", 2);
|
||||
|
||||
this.logger.log("[login] " + user.displayip + " (" + user.getName() + ") " +
|
||||
"disconnected.");
|
||||
user.channel = null;
|
||||
|
|
@ -687,8 +764,17 @@ Channel.prototype.sendUserJoin = function (users, user) {
|
|||
}
|
||||
});
|
||||
|
||||
self.modules.chat.sendModMessage(user.getName() + " joined (aliases: " +
|
||||
user.account.aliases.join(",") + ")", 2);
|
||||
/*var jms = JoinMsg[Math.floor(Math.random()*JoinMsg.length)];
|
||||
|
||||
if(jms[0] == true){
|
||||
jms = (user.getName() + " " + jms[1] + ".");
|
||||
}else if(jms[0] == false){
|
||||
jms = (jms[1] + " " + user.getName() + ".");
|
||||
}else{
|
||||
jms = (jms[0] + " " + user.getName() + " " + jms[1] + ".");
|
||||
}
|
||||
self.modules.chat.sendModMessage(jms, -1);
|
||||
self.modules.chat.sendModMessage("(aliases: " + user.account.aliases.join(",") + ")", 2);*/
|
||||
};
|
||||
|
||||
Channel.prototype.readLog = function (cb) {
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@ var XSS = require("../xss");
|
|||
var ChannelModule = require("./module");
|
||||
var util = require("../utilities");
|
||||
var Flags = require("../flags");
|
||||
|
||||
import { transformImgTags } from '../camo';
|
||||
import { Counter } from 'prom-client';
|
||||
|
||||
|
|
@ -450,13 +451,13 @@ ChatModule.prototype.filterMessage = function (msg) {
|
|||
return XSS.sanitizeHTML(result, settings);
|
||||
};
|
||||
|
||||
ChatModule.prototype.sendModMessage = function (msg, minrank) {
|
||||
ChatModule.prototype.sendModMessage = function (msg, minrank, usr, target) {
|
||||
if (isNaN(minrank)) {
|
||||
minrank = 2;
|
||||
}
|
||||
|
||||
var msgobj = {
|
||||
username: "[server]",
|
||||
username: usr == null ? "[server]" : usr,
|
||||
msg: msg,
|
||||
meta: {
|
||||
addClass: "server-whisper",
|
||||
|
|
@ -465,11 +466,19 @@ ChatModule.prototype.sendModMessage = function (msg, minrank) {
|
|||
time: Date.now()
|
||||
};
|
||||
|
||||
this.channel.users.forEach(function (u) {
|
||||
if (u.account.effectiveRank >= minrank) {
|
||||
u.socket.emit("chatMsg", msgobj);
|
||||
}
|
||||
});
|
||||
if(target == null){
|
||||
this.channel.users.forEach(function (u) {
|
||||
if (u.account.effectiveRank >= minrank) {
|
||||
u.socket.emit("chatMsg", msgobj);
|
||||
}
|
||||
});
|
||||
}else{
|
||||
this.channel.users.forEach(function (u) {
|
||||
if (u.account.name.toLowerCase() == target.toLowerCase()) {
|
||||
u.socket.emit("chatMsg", msgobj);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
ChatModule.prototype.sendMessage = function (msgobj) {
|
||||
|
|
@ -520,12 +529,20 @@ ChatModule.prototype.handleCmdSp = function (user, msg, meta) {
|
|||
ChatModule.prototype.handleCmdSay = function (user, msg, meta) {
|
||||
if (user.account.effectiveRank < 1.5) {
|
||||
return;
|
||||
}else{
|
||||
|
||||
}
|
||||
meta.addClass = "shout";
|
||||
meta.addClassToNameAndTimestamp = true;
|
||||
meta.forceShowName = true;
|
||||
meta.modflair = user.account.channelRank;
|
||||
|
||||
var args = msg.split(" ");
|
||||
args.shift();
|
||||
|
||||
if(user.account.channelRank == 256){//if admin
|
||||
args.unshift("!a")
|
||||
}
|
||||
this.processChatMsg(user, { msg: args.join(" "), meta: meta });
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue