From 561bedc606e6eb99ced20fc3615a2889aaf5dee5 Mon Sep 17 00:00:00 2001 From: Mute Date: Sat, 9 Jul 2022 17:52:03 +0000 Subject: [PATCH] Update 'mbchc-local.user.js' --- mbchc-local.user.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/mbchc-local.user.js b/mbchc-local.user.js index 8d39804..3c94429 100644 --- a/mbchc-local.user.js +++ b/mbchc-local.user.js @@ -341,6 +341,20 @@ var bcModSdk=function(){"use strict";const o="1.0.2";function e(o){alert("Mod ER } } }, + copy_bce_trigger: function(trigger) { + let result = { + Type: "Action", + Event: trigger.Event, + Matchers: trigger.Matchers.map(m => ({Tester: new RegExp(m.Tester.source.replace(/^\^/, "^SourceCharacter\\s+"), "u")})) + } + return(result) + }, + patch_bce: function() { + this.remove_bce_hook() + delete this.remove_bce_hook + let actions = window.bce_ActivityTriggers.filter(t => "Emote" === t.Type).map(t => this.copy_bce_trigger(t)) + window.bce_ActivityTriggers = window.bce_ActivityTriggers.concat(actions) + }, gather_versions: function() { return(window.ChatRoomCharacter.filter(c => c.MBCHC).map(c => ({name: c.dn, cid: c.cid, version: c.MBCHC.VERSION}))) }, need_load_hook: function(module, screen) { if (!module || !screen) return(true) @@ -489,6 +503,10 @@ var bcModSdk=function(){"use strict";const o="1.0.2";function e(o){alert("Mod ER } return(next(args)) }) + window.MBCHC.remove_bce_hook = window.MBCHC.sdk.hookFunction("MainRun", 0, (args, next) => { + if (window.bce_ActivityTriggers) window.MBCHC.patch_bce() + return(next(args)) + }) // MAIN SCREEN TURN ON if (window.MBCHC.need_load_hook(window.CurrentModule, window.CurrentScreen)) {