Optional profanity filter
This commit is contained in:
@@ -187,6 +187,10 @@ function renderPropertyEntranceLabel(name, position, locked, isBusiness, price,
|
|||||||
screenPosition.y -= propertyLabelNameOffset;
|
screenPosition.y -= propertyLabelNameOffset;
|
||||||
|
|
||||||
text = name || " ";
|
text = name || " ";
|
||||||
|
if (profanityFilterEnabled) {
|
||||||
|
text = replaceProfanityInMessage(text);
|
||||||
|
}
|
||||||
|
|
||||||
size = propertyLabelNameFont.measure(text, game.width, 0.0, 0.0, propertyLabelNameFont.size, true, true);
|
size = propertyLabelNameFont.measure(text, game.width, 0.0, 0.0, propertyLabelNameFont.size, true, true);
|
||||||
propertyLabelNameFont.render(text, [screenPosition.x - size[0] / 2, screenPosition.y - size[1] / 2], game.width, 0.0, 0.0, propertyLabelNameFont.size, (isBusiness) ? toColour(0, 153, 255, 255) : toColour(17, 204, 17, 255), false, true, false, true);
|
propertyLabelNameFont.render(text, [screenPosition.x - size[0] / 2, screenPosition.y - size[1] / 2], game.width, 0.0, 0.0, propertyLabelNameFont.size, (isBusiness) ? toColour(0, 153, 255, 255) : toColour(17, 204, 17, 255), false, true, false, true);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,6 +44,10 @@ function loadPausedStatusFont() {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function updatePlayerNameTag(clientName, characterName, colour, paused, ping) {
|
function updatePlayerNameTag(clientName, characterName, colour, paused, ping) {
|
||||||
|
if (profanityFilterEnabled) {
|
||||||
|
characterName = replaceProfanityInMessage(characterName);
|
||||||
|
}
|
||||||
|
|
||||||
playerNames[clientName] = characterName;
|
playerNames[clientName] = characterName;
|
||||||
playerColours[clientName] = colour;
|
playerColours[clientName] = colour;
|
||||||
playerPaused[clientName] = paused;
|
playerPaused[clientName] = paused;
|
||||||
|
|||||||
@@ -110,6 +110,7 @@ function messageDiscordChatChannel(messageString) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
messageString = removeColoursInMessage(messageString);
|
messageString = removeColoursInMessage(messageString);
|
||||||
|
messageString = replaceProfanityInMessage(messageString);
|
||||||
triggerDiscordWebHook(messageString, getServerId(), AGRP_DISCORD_WEBHOOK_LOG);
|
triggerDiscordWebHook(messageString, getServerId(), AGRP_DISCORD_WEBHOOK_LOG);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -129,6 +130,7 @@ function messageDiscordEventChannel(messageString) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
messageString = removeColoursInMessage(messageString);
|
messageString = removeColoursInMessage(messageString);
|
||||||
|
messageString = replaceProfanityInMessage(messageString);
|
||||||
triggerDiscordWebHook(messageString, getServerId(), AGRP_DISCORD_WEBHOOK_LOG);
|
triggerDiscordWebHook(messageString, getServerId(), AGRP_DISCORD_WEBHOOK_LOG);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1098,6 +1098,8 @@ let serverEmoji = [
|
|||||||
[":water_buffalo:", "🐃"],
|
[":water_buffalo:", "🐃"],
|
||||||
[":neutral_face:", "😐"],
|
[":neutral_face:", "😐"],
|
||||||
[":clock1230:", "🕧"],
|
[":clock1230:", "🕧"],
|
||||||
|
[":think:", "🤔"],
|
||||||
|
[":thinking:", "🤔"],
|
||||||
[":P", "😛"],
|
[":P", "😛"],
|
||||||
[":)", "🙂"],
|
[":)", "🙂"],
|
||||||
[":D", "😃"],
|
[":D", "😃"],
|
||||||
@@ -1105,6 +1107,7 @@ let serverEmoji = [
|
|||||||
[":O", "😮"],
|
[":O", "😮"],
|
||||||
[":(", "☹️"],
|
[":(", "☹️"],
|
||||||
[":|", "😐"],
|
[":|", "😐"],
|
||||||
|
["XD", "😆"],
|
||||||
];
|
];
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -3014,9 +3017,9 @@ function removeColoursInMessage(messageText) {
|
|||||||
*/
|
*/
|
||||||
function replaceProfanityInMessage(messageString) {
|
function replaceProfanityInMessage(messageString) {
|
||||||
for (let i in profanityFilterWords) {
|
for (let i in profanityFilterWords) {
|
||||||
while (messageString.indexOf(profanityFilterWords[i]) != -1) {
|
let find = profanityFilterWords[i];
|
||||||
messageString = messageString.replace(profanityFilterWords[i], fillStringWithCharacter("*", profanityFilterWords[i].length));
|
let re = new RegExp(find, 'gi');
|
||||||
}
|
messageString = messageString.replace(re, fillStringWithCharacter('*', find.length - 1));
|
||||||
}
|
}
|
||||||
return messageString;
|
return messageString;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user