The information presented on this site about LotR TCG, both literal and graphical, is copyrighted by Decipher Inc.
This website is not produced, endorsed, supported, or affiliated with Decipher.
diff --git a/gemp-lotr/gemp-lotr-async/src/main/web/js/gemp-022/chat.js b/gemp-lotr/gemp-lotr-async/src/main/web/js/gemp-022/chat.js
index 20790c645..57d830d11 100644
--- a/gemp-lotr/gemp-lotr-async/src/main/web/js/gemp-022/chat.js
+++ b/gemp-lotr/gemp-lotr-async/src/main/web/js/gemp-022/chat.js
@@ -1,6 +1,9 @@
var ChatBoxUI = Class.extend({
name:null,
userName:null,
+ pingRegex:null,
+ mentionRegex:null,
+ everyoneRegex:/(@everyone|@anyone)/,
div:null,
comm:null,
@@ -59,6 +62,13 @@ var ChatBoxUI = Class.extend({
that.appendMessage("Unknown chat problem occured (error=" + xhr.status + ")", "warningMessage");
});
this.enableDiscord = allowDiscord;
+
+ this.comm.getPlayerInfo(function(json)
+ {
+ that.userName = json;
+ that.pingRegex = new RegExp("@" + json);
+ that.mentionRegex = new RegExp("(?)" + json );
+ }, this.chatErrorMap());
@@ -66,13 +76,7 @@ var ChatBoxUI = Class.extend({
if(this.name == "Game Hall")
{
-
-
this.discordDiv = $("#discordChat");
- this.comm.getPlayerInfo(function(json)
- {
- that.userName = json;
- }, this.chatErrorMap());
this.chatTalkDiv = $("#chatTalk");
@@ -128,13 +132,16 @@ var ChatBoxUI = Class.extend({
that.processMessages(xml, true);
}, this.chatErrorMap());
- this.chatTalkDiv.bind("keypress", function (e) {
- var code = (e.keyCode ? e.keyCode : e.which);
- if (code == 13) {
- var value = $(this).val();
- if (value != "")
- that.sendMessage(value);
- $(this).val("");
+ this.chatTalkDiv.keydown(function (e) {
+ if (e.keyCode == 13) {
+ if(!e.shiftKey)
+ {
+ e.preventDefault();
+ var value = $(this).val();
+ if (value != "")
+ that.sendMessage(value);
+ $(this).val("").trigger("oninput");
+ }
}
});
@@ -153,8 +160,6 @@ var ChatBoxUI = Class.extend({
}
else
{
-
-
this.chatTalkDiv = $("
");
if (showHideSystemButton) {
@@ -242,10 +247,6 @@ var ChatBoxUI = Class.extend({
}
},
- escapeHtml:function (text) {
- return $('
').text(text).html();
- },
-
setBounds:function (x, y, width, height) {
if(this.name != "Game Hall")
@@ -359,10 +360,21 @@ var ChatBoxUI = Class.extend({
}
}
},
+
appendMessage:function (message, msgClass) {
if (msgClass == undefined)
msgClass = "chatMessage";
+
+ if(this.pingRegex != null && this.pingRegex.test(message))
+ {
+ msgClass += " user-ping";
+ }
+ else if((this.mentionRegex != null && this.mentionRegex.test(message)) || this.everyoneRegex.test(message))
+ {
+ msgClass += " user-mention";
+ }
+
var messageDiv = $("
" + message + "
");
this.chatMessagesDiv.append(messageDiv);
@@ -402,13 +414,17 @@ var ChatBoxUI = Class.extend({
var msgClass = "chatMessage";
if (from == "System")
msgClass = "systemMessage";
+ var prefix = "
";
if (this.showTimestamps) {
var date = new Date(parseInt(message.getAttribute("date")));
var dateStr = this.monthNames[date.getMonth()] + " " + date.getDate() + " " + this.formatToTwoDigits(date.getHours()) + ":" + this.formatToTwoDigits(date.getMinutes()) + ":" + this.formatToTwoDigits(date.getSeconds());
- this.appendMessage("
[" + dateStr + "]
" + from + ": " + text, msgClass);
- } else {
- this.appendMessage("
" + from + ": " + text, msgClass);
+ prefix += "
[" + dateStr + "]";
}
+
+ prefix += "
" + from + ": ";
+ var postfix = "
" + text + "
";
+
+ this.appendMessage(prefix + postfix, msgClass);
}
var users = root.getElementsByTagName("user");
diff --git a/gemp-lotr/gemp-lotr-async/src/main/web/js/gemp-022/hallUi.js b/gemp-lotr/gemp-lotr-async/src/main/web/js/gemp-022/hallUi.js
index ce553c3d9..bc81b5010 100644
--- a/gemp-lotr/gemp-lotr-async/src/main/web/js/gemp-022/hallUi.js
+++ b/gemp-lotr/gemp-lotr-async/src/main/web/js/gemp-022/hallUi.js
@@ -1,5 +1,4 @@
var GempLotrHallUI = Class.extend({
- div:null,
comm:null,
chat:null,
supportedFormatsInitialized:false,
@@ -15,8 +14,7 @@ var GempLotrHallUI = Class.extend({
pocketValue:null,
hallChannelId: null,
- init:function (div, url, chat) {
- this.div = div;
+ init:function (url, chat) {
this.comm = new GempLotrCommunication(url, function (xhr, ajaxOptions, thrownError) {
if (thrownError != "abort") {
if (xhr != null) {
@@ -35,9 +33,6 @@ var GempLotrHallUI = Class.extend({
});
this.chat = chat;
- var width = $(div).width();
- var height = $(div).height();
-
this.tablesDiv = $("#tablesDiv");
var hallSettingsStr = $.cookie("hallSettings");
diff --git a/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/chat/ChatRoomMediator.java b/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/chat/ChatRoomMediator.java
index 8d7a8ac6d..f2b9b04e2 100644
--- a/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/chat/ChatRoomMediator.java
+++ b/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/chat/ChatRoomMediator.java
@@ -90,8 +90,8 @@ public class ChatRoomMediator {
}
public void sendMessage(String playerId, String message, boolean admin) throws PrivateInformationException, ChatCommandErrorException {
- if (message.startsWith("/")) {
- processIfKnownCommand(playerId, message.substring(1), admin);
+ if (message.trim().startsWith("/")) {
+ processIfKnownCommand(playerId, message.trim().substring(1), admin);
return;
}