From 18095495bb6cad61162e048aa1a33aea6131d9fd Mon Sep 17 00:00:00 2001 From: Mute Date: Wed, 20 Jul 2022 21:27:20 +0000 Subject: [PATCH] Update 'mbchc-dev.user.js' BCE expressions needed more love; also stripped a space in chats like "@'s ... " --- mbchc-dev.user.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/mbchc-dev.user.js b/mbchc-dev.user.js index 366c70a..1a50903 100644 --- a/mbchc-dev.user.js +++ b/mbchc-dev.user.js @@ -34,8 +34,9 @@ LAST_HACKED: null, HISTORY_MODE: false, RE_TITLE: /^[a-zA-Z]+$/, - RE_PREF_ACTIVITY_ME: /^@/, - RE_PREF_ACTIVITY: /^@@/, + RE_PREF_ACTIVITY_ME: /^@/, + RE_PREF_ACTIVITY_ME_APO: /^@'/, + RE_PREF_ACTIVITY: /^@@/, RE_ACT_CIDS: /^<(\d+)?:(\d+)?>/, RE_TZ: /(?:GMT|UTC)([+-]\d\d?)/i, RE_ALL_LEFT: /^<+$/, @@ -157,6 +158,10 @@ "ItemEars": ["ear", "ears", "earlobe", "earlobes"], "ItemHead": ["head", "face", "hair", "eyes", "forehead"], }, + BCE_TESTER_PATCHES: [ + [/^\^('s)?( )?/g, "^SourceCharacter$1\\s+"], + [/([^\\])\$/g, "$1\\.?$$"], + ], SUBCOMMANDS_MBCHC: { "versions": {desc: "show the mod versions across the room", cb: mbchc => mbchc.inform(mbchc.gather_versions().map(c => `
${c.name} (${c.cid}): ${c.version}
`).join(""))}, "autohack": {desc: "toggle the autohack feature", cb: mbchc => mbchc.inform(`Autohack is now ${(mbchc.AUTOHACK_ENABLED = !mbchc.AUTOHACK_ENABLED) ? "enabled" : "disabled"}`)}, @@ -343,7 +348,7 @@ let result = { Type: "Action", Event: trigger.Event, - Matchers: trigger.Matchers.map(m => ({Tester: new RegExp(m.Tester.source.replace(this.RE_CARET, "^SourceCharacter\\s+"), "u")})) + Matchers: trigger.Matchers.map(m => ({Tester: new RegExp(this.BCE_TESTER_PATCHES.reduce((ax,[f,r]) => ax.replaceAll(f,r), m.Tester.source), "u")})) } return(result) }, @@ -600,6 +605,7 @@ let input = window.ElementValue("InputChat") if (!input.startsWith("@@@") && input.startsWith("@")) { input = input.replace(window.MBCHC.RE_PREF_ACTIVITY, window.MBCHC.PREF_ACTIVITY) + input = input.replace(window.MBCHC.RE_PREF_ACTIVITY_ME_APO, `${window.MBCHC.PREF_ACTIVITY}<${window.Player.cid}:>SourceCharacter'`) input = input.replace(window.MBCHC.RE_PREF_ACTIVITY_ME, `${window.MBCHC.PREF_ACTIVITY}<${window.Player.cid}:>SourceCharacter `) window.ElementValue("InputChat", input) }