Merge branch 'fix-name-mention-notif' into 'master'

Fix "Name Mentioned" notification not working for players with "fancy" (italic, bold etc.) nicknames

See merge request 
This commit is contained in:
BondageProjects 2025-03-21 23:04:48 +00:00
commit f1d389922f

View file

@ -3357,9 +3357,10 @@ const mentionNameSplitter = /\b/gu;
* @returns {boolean} - msg contains mention of C
*/
function ChatRoomMessageMentionsCharacter(C, msg) {
const nameParts = C.Name.toLowerCase().split(mentionNameSplitter);
const nickParts = C.Nickname ? C.Nickname.toLowerCase().split(mentionNameSplitter) : [];
const msgParts = msg.toLowerCase().split(mentionNameSplitter);
const normalizeText = (text) => text.normalize('NFKC').toLowerCase();
const nameParts = normalizeText(C.Name).split(mentionNameSplitter);
const nickParts = C.Nickname ? normalizeText(C.Nickname).split(mentionNameSplitter) : [];
const msgParts = normalizeText(msg).split(mentionNameSplitter);
for (let i = 0; i < msgParts.length - (nameParts.length - 1); i++) {
if (msgParts[i] === nameParts[0]) {
let match = true;