Update 'mbchc-local.user.js'
chat room handlers
This commit is contained in:
parent
8d1516f1a7
commit
f911c05073
|
@ -314,7 +314,7 @@
|
|||
},
|
||||
receive: function(data) {
|
||||
let char = this.cid2char(data.Sender)
|
||||
if (char.IsPlayer()) return // this is our own message, sent back to us
|
||||
if (char.IsPlayer()) return true // this is our own message, sent back to us
|
||||
let payload = this.ensure("Empty message", () => data.Dictionary[0])
|
||||
switch (payload.type) {
|
||||
case "greetings": case "hello":
|
||||
|
@ -323,6 +323,7 @@
|
|||
break
|
||||
default: // if we don't know the type it may be from a newer version
|
||||
}
|
||||
return true
|
||||
},
|
||||
hello: function(char = null) {
|
||||
let payload = {type: "greetings", value: window.Player.MBCHC}
|
||||
|
@ -594,18 +595,6 @@
|
|||
window.MBCHC.update_char(nextargs[0])
|
||||
return(result)
|
||||
})
|
||||
window.MBCHC.sdk.hookFunction("ChatRoomMessageInvolvesPlayer", 0, (nextargs, next) => {
|
||||
let data = nextargs[0]
|
||||
if (!data.MBCHC_ID) {
|
||||
data.MBCHC_ID = window.MBCHC.NEXT_MESSAGE
|
||||
window.MBCHC.NEXT_MESSAGE += 1
|
||||
if (window.MBCHC.LOG_MESSAGES) console.debug(data)
|
||||
if (("ReceiveSuitcaseMoney" === data.Content) && ("Hidden" === data.Type)) { window.MBCHC.LAST_HACKED = data.Sender }
|
||||
if (("ServerEnter" === data.Content) && ("Action" === data.Type) && (data.Sender === window.Player.cid)) { window.MBCHC.player_enters_room() }
|
||||
if (("MBCHC" === data.Content) && ("Hidden" === data.Type)) { window.MBCHC.receive(data) }
|
||||
}
|
||||
return(next(nextargs))
|
||||
})
|
||||
window.MBCHC.sdk.hookFunction("ChatRoomReceiveSuitcaseMoney", 0, (nextargs, next) => {
|
||||
let result = next(nextargs)
|
||||
if (window.MBCHC.AUTOHACK_ENABLED && window.MBCHC.LAST_HACKED) {
|
||||
|
@ -695,6 +684,24 @@
|
|||
return(next(nextargs))
|
||||
})
|
||||
|
||||
// Chat room handlers
|
||||
window.ChatRoomRegisterMessageHandler({ Priority: -220, Description: "MBCHC preprocessor",
|
||||
Callback: (data, sender, msg, metadata) => {
|
||||
data.MBCHC_ID = window.MBCHC.NEXT_MESSAGE
|
||||
window.MBCHC.NEXT_MESSAGE += 1
|
||||
if (window.MBCHC.LOG_MESSAGES) console.debug({data, sender, msg, metadata})
|
||||
}
|
||||
})
|
||||
window.ChatRoomRegisterMessageHandler({ Priority: -219, Description: "MBCHC room enter hook",
|
||||
Callback: (data, sender, msg, metadata) => { if (("Action" === data.Type) && ("ServerEnter" === data.Content) && (data.Sender === window.Player.cid)) window.MBCHC.player_enters_room() }
|
||||
})
|
||||
window.ChatRoomRegisterMessageHandler({ Priority: -219, Description: "MBCHC specific consumer",
|
||||
Callback: (data, sender, msg, metadata) => { if (("Hidden" === data.Type) && ("MBCHC" === data.Content)) return window.MBCHC.receive(data) }
|
||||
})
|
||||
window.ChatRoomRegisterMessageHandler({ Priority: -219, Description: "MBCHC autohack lookup",
|
||||
Callback: (data, sender, msg, metadata) => { if (("Hidden" === data.Type) && ("ReceiveSuitcaseMoney" === data.Content)) window.MBCHC.LAST_HACKED = data.Sender }
|
||||
})
|
||||
|
||||
// MAIN SCREEN TURN ON
|
||||
if (window.MBCHC.need_load_hook(window.CurrentModule, window.CurrentScreen)) {
|
||||
window.MBCHC.remove_load_hook = window.MBCHC.sdk.hookFunction("AsylumGGTSSAddItems", 0, (nextargs, next) => {window.MBCHC.loader(); return(next(nextargs))})
|
||||
|
|
Loading…
Reference in New Issue
Block a user