Differential D4385 Diff 19395 binaries/data/mods/public/gui/lobby/LobbyPage/Chat/ChatMessages/ChatMessageFormat.js
Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/gui/lobby/LobbyPage/Chat/ChatMessages/ChatMessageFormat.js
Show All 16 Lines | class ChatMessageFormat | ||||
* Message properties: from, text, historic, optionally private | * Message properties: from, text, historic, optionally private | ||||
*/ | */ | ||||
format(message) | format(message) | ||||
{ | { | ||||
let text = escapeText(message.text); | let text = escapeText(message.text); | ||||
if (g_Nickname != message.from) | if (g_Nickname != message.from) | ||||
{ | { | ||||
// Highlight nicknames, assume they do not contain escapaped characters | // Highlight nicknames, assume they do not contain escapaped characters | ||||
text = text.replace(g_Nickname, PlayerColor.ColorPlayerName(g_Nickname)); | text = text.replace(coloredText(g_Nickname, PlayerColor.ColorPlayerName(Engine.LobbyGetPlayerRole(g_Nickname)))); | ||||
// Notify local player | // Notify local player | ||||
if (!message.historic && text.toLowerCase().indexOf(g_Nickname.toLowerCase()) != -1) | if (!message.historic && text.toLowerCase().indexOf(g_Nickname.toLowerCase()) != -1) | ||||
soundNotification("nick"); | soundNotification("nick"); | ||||
} | } | ||||
let sender = coloredText((message.from), PlayerColor.ColorPlayerNameByRole(Engine.LobbyGetPlayerRole(message.from))); | |||||
let sender = PlayerColor.ColorPlayerName(message.from, undefined, Engine.LobbyGetPlayerRole(message.from)); | |||||
// Handle chat format commands | // Handle chat format commands | ||||
let formattedMessage; | let formattedMessage; | ||||
let index = text.indexOf(" "); | let index = text.indexOf(" "); | ||||
if (text.startsWith("/") && index != -1) | if (text.startsWith("/") && index != -1) | ||||
{ | { | ||||
let command = text.substr(1, index - 1); | let command = text.substr(1, index - 1); | ||||
let commandText = text.substr(index + 1); | let commandText = text.substr(index + 1); | ||||
Show All 29 Lines |
Wildfire Games · Phabricator