From c29d264520fc6ed7f4fb47844289ef7fd95dd253 Mon Sep 17 00:00:00 2001 From: Mute Date: Mon, 4 Jul 2022 22:19:38 +0000 Subject: [PATCH] Update 'mbchc-local.user.js' --- mbchc-local.user.js | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/mbchc-local.user.js b/mbchc-local.user.js index 754be52..7bced6d 100644 --- a/mbchc-local.user.js +++ b/mbchc-local.user.js @@ -272,6 +272,11 @@ var bcModSdk=function(){"use strict";const o="1.0.2";function e(o){alert("Mod ER } return(result) }, + need_load_hook: function(module, screen) { + if (!module || !screen) return(true) + if (("Character" === module) && ("Login" === screen)) return(true) + return(false) + }, // Command actions command_mbchc: function(argline, cmdline, args) { try { @@ -369,14 +374,13 @@ var bcModSdk=function(){"use strict";const o="1.0.2";function e(o){alert("Mod ER } return(next(args)) }) - /* Things to keep in mind: - 1. mod may be loaded early or late - 2. if we're loaded past login screen, no need to hook anything, load directly - 3. if we're loaded into a chatroom we need to send greetings (should probably be in the loader function) - */ -// if (!window.CurrentModule && !window.CurrentScreen) { - window.MBCHC.sdk.hookFunction("AsylumGGTSSAddItems", 0, (args, next) => { window.MBCHC.loader(); return(next(args)) }) + // MAIN SCREEN TURN ON + if (window.MBCHC.need_load_hook(window.CurrentModule, window.CurrentScreen)) { + window.MBCHC.sdk.hookFunction("AsylumGGTSSAddItems", 0, (args, next) => { window.MBCHC.loader(); return(next(args)) }) + } else { + window.MBCHC.loader() + } console.debug({module: window.CurrentModule, screen: window.CurrentScreen}) })()