Update 'mbchc-dev.user.js'
This commit is contained in:
parent
c719d2ae91
commit
0d9e284d44
|
@ -18,6 +18,8 @@
|
||||||
|
|
||||||
// Static data
|
// Static data
|
||||||
window.MBCHC = {
|
window.MBCHC = {
|
||||||
|
NEXT_MESSAGE: 1,
|
||||||
|
LOG_MESSAGES: false,
|
||||||
LOADED: false,
|
LOADED: false,
|
||||||
VERSION: 'dev',
|
VERSION: 'dev',
|
||||||
AUTOHACK_ENABLED: false,
|
AUTOHACK_ENABLED: false,
|
||||||
|
@ -69,11 +71,73 @@
|
||||||
} catch (x) { window.ChatRoomSendLocal(`(Error: ${x.toString()})`) }
|
} catch (x) { window.ChatRoomSendLocal(`(Error: ${x.toString()})`) }
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{ Tag: "nod",
|
||||||
|
Description: ": Nod",
|
||||||
|
Action: (argline, cmdline, args) => {
|
||||||
|
try {
|
||||||
|
window.MBCHC.run_activity(window.Player, "ItemHead", "Nod")
|
||||||
|
} catch (x) { window.ChatRoomSendLocal(`(Error: ${x.toString()})`) }
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{ Tag: "shake",
|
||||||
|
Description: ": Shake your head",
|
||||||
|
Action: (argline, cmdline, args) => {
|
||||||
|
try {
|
||||||
|
window.MBCHC.run_activity(window.Player, "ItemHead", "Wiggle")
|
||||||
|
} catch (x) { window.ChatRoomSendLocal(`(Error: ${x.toString()})`) }
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{ Tag: "shrug",
|
||||||
|
Description: ": Shrug",
|
||||||
|
Action: (argline, cmdline, args) => {
|
||||||
|
try {
|
||||||
|
window.MBCHC.send_activity(`${window.CharacterNickname(window.Player)} shrugs.`)
|
||||||
|
} catch (x) { window.ChatRoomSendLocal(`(Error: ${x.toString()})`) }
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{ Tag: "myself",
|
||||||
|
Description: "[Message]: Send a custom activity as yourself (or \"@Message\")",
|
||||||
|
Action: (argline, cmdline, args) => {
|
||||||
|
if (!window.MBCHC.empty(argline)) {
|
||||||
|
try {
|
||||||
|
let message = window.MBCHC.add_full_stop(argline)
|
||||||
|
window.MBCHC.send_activity(`${window.CharacterNickname(window.Player)} ${message}`)
|
||||||
|
} catch (x) { window.ChatRoomSendLocal(`(Error: ${x.toString()})`) }
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{ Tag: "activity",
|
||||||
|
Description: "[Message]: Send a custom activity (or \"@@Message\")",
|
||||||
|
Action: (argline, cmdline, args) => {
|
||||||
|
if (!window.MBCHC.empty(argline)) {
|
||||||
|
try {
|
||||||
|
let message = window.MBCHC.add_full_stop(window.MBCHC.capitalise(argline))
|
||||||
|
window.MBCHC.send_activity(message)
|
||||||
|
} catch (x) { window.ChatRoomSendLocal(`(Error: ${x.toString()})`) }
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
],
|
],
|
||||||
log: function(msg) {return("MBCHC: " + msg.toString())},
|
log: function(msg) {return("MBCHC: " + msg.toString())},
|
||||||
|
empty: function(text) {
|
||||||
|
if (!text) return(true)
|
||||||
|
if (String(text).trim().length < 1) return(true)
|
||||||
|
return(false)
|
||||||
|
},
|
||||||
|
add_full_stop: function(text) {
|
||||||
|
if (text.endsWith('.')) return(text)
|
||||||
|
return(`${text}.`)
|
||||||
|
},
|
||||||
|
capitalise: function(text, lower = false) {
|
||||||
|
let first = text.at(0).toLocaleUpperCase()
|
||||||
|
let rest = text.slice(1)
|
||||||
|
if (lower) rest = rest.toLocaleLowerCase()
|
||||||
|
return(first + rest)
|
||||||
|
},
|
||||||
orig_AsylumGGTSSAddItems: window.AsylumGGTSSAddItems,
|
orig_AsylumGGTSSAddItems: window.AsylumGGTSSAddItems,
|
||||||
orig_ChatRoomMessageInvolvesPlayer: window.ChatRoomMessageInvolvesPlayer,
|
orig_ChatRoomMessageInvolvesPlayer: window.ChatRoomMessageInvolvesPlayer,
|
||||||
orig_ChatRoomReceiveSuitcaseMoney: window.ChatRoomReceiveSuitcaseMoney,
|
orig_ChatRoomReceiveSuitcaseMoney: window.ChatRoomReceiveSuitcaseMoney,
|
||||||
|
orig_ChatRoomSendChat: window.ChatRoomSendChat,
|
||||||
} // MBCHC
|
} // MBCHC
|
||||||
|
|
||||||
// Loader
|
// Loader
|
||||||
|
@ -101,7 +165,20 @@
|
||||||
window.ServerSend("ChatRoomChat", {Content: "ReceiveSuitcaseMoney", Type: "Hidden", Target: id})
|
window.ServerSend("ChatRoomChat", {Content: "ReceiveSuitcaseMoney", Type: "Hidden", Target: id})
|
||||||
return({cost: cost, name: (char.Nickname || char.Name)})
|
return({cost: cost, name: (char.Nickname || char.Name)})
|
||||||
}
|
}
|
||||||
|
window.MBCHC.run_activity = function(char, ag, action) {
|
||||||
|
try {
|
||||||
|
char.FocusGroup = window.AssetGroupGet(char.AssetFamily, ag)
|
||||||
|
if (!char.FocusGroup) throw "invalid AssetGroup"
|
||||||
|
let activity = window.ActivityAllowedForGroup(char, char.FocusGroup.Name).find( a => a.Name === action)
|
||||||
|
if (!activity) throw "invalid activity"
|
||||||
|
window.ActivityRun(char, activity)
|
||||||
|
} finally {
|
||||||
|
char.FocusGroup = null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
window.MBCHC.send_activity = function(msg) {
|
||||||
|
window.ServerSend("ChatRoomChat", {Type: "Action", Content: "lef_wie234jf_owhwi", Dictionary: [{Tag: 'MISSING PLAYER DIALOG: lef_wie234jf_owhwi', Text: msg}]})
|
||||||
|
}
|
||||||
// Command actions
|
// Command actions
|
||||||
window.MBCHC.action_title = function(args) {
|
window.MBCHC.action_title = function(args) {
|
||||||
let title = args.shift()
|
let title = args.shift()
|
||||||
|
@ -130,8 +207,12 @@
|
||||||
|
|
||||||
// Hooks
|
// Hooks
|
||||||
window.ChatRoomMessageInvolvesPlayer = function(data) {
|
window.ChatRoomMessageInvolvesPlayer = function(data) {
|
||||||
//console.log({data: data})
|
if (!data.MBCHC_ID) {
|
||||||
if (("ReceiveSuitcaseMoney" === data.Content) && ("Hidden" === data.Type)) { window.MBCHC.LAST_HACKED = data.Sender }
|
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 }
|
||||||
|
}
|
||||||
return(window.MBCHC.orig_ChatRoomMessageInvolvesPlayer(data))
|
return(window.MBCHC.orig_ChatRoomMessageInvolvesPlayer(data))
|
||||||
}
|
}
|
||||||
window.ChatRoomReceiveSuitcaseMoney = function() {
|
window.ChatRoomReceiveSuitcaseMoney = function() {
|
||||||
|
@ -143,6 +224,15 @@
|
||||||
}
|
}
|
||||||
return(result)
|
return(result)
|
||||||
}
|
}
|
||||||
|
window.ChatRoomSendChat = function() {
|
||||||
|
let input = window.ElementValue("InputChat")
|
||||||
|
if (!input.startsWith("@@@")) {
|
||||||
|
input = input.replace(/^@@/, "/activity ")
|
||||||
|
input = input.replace(/^@/, "/myself ")
|
||||||
|
window.ElementValue("InputChat", input)
|
||||||
|
}
|
||||||
|
return(window.MBCHC.orig_ChatRoomSendChat())
|
||||||
|
}
|
||||||
|
|
||||||
// Actions
|
// Actions
|
||||||
window.CommandCombine(window.MBCHC.COMMANDS)
|
window.CommandCombine(window.MBCHC.COMMANDS)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user