Update 'mbchc-local.user.js'

This commit is contained in:
Mute 2022-07-15 00:09:12 +00:00
parent faf2714810
commit 537c538211

View File

@ -239,7 +239,7 @@ var bcModSdk=function(){"use strict";const o="1.0.2";function e(o){alert("Mod ER
if (pos < 0) pos = pos + window.ChatRoomCharacter.length
return(this.pos2char(pos))
},
target2char: function(target) {
target2char: function(target) { // target should be lowcase
let input = target
if (this.empty(target)) return(window.Player)
let int = Number.parseInt(target)
@ -251,11 +251,11 @@ var bcModSdk=function(){"use strict";const o="1.0.2";function e(o){alert("Mod ER
if (this.in(int, 0, 9)) return(this.pos2char(int))
if (this.in(int, 11, 15)) return(this.pos2char(int - 11))
if (this.in(int, 21, 25)) return(this.pos2char(int - 16))
found = found.concat(window.ChatRoomCharacter.filter(c => c.cid.toString().indexOf(target) > -1))
found.push(...window.ChatRoomCharacter.filter(c => c.cid.toString().indexOf(target) > -1))
}
if (target.startsWith("@")) target = target.slice(1)
found = found.concat(window.ChatRoomCharacter.filter(c => c.Name.toLocaleLowerCase().indexOf(target) > -1))
found = found.concat(window.ChatRoomCharacter.filter(c => c.Nickname.toLocaleLowerCase().indexOf(target) > -1))
found.push(...window.ChatRoomCharacter.filter(c => c.Name.toLocaleLowerCase().indexOf(target) > -1))
found.push(...window.ChatRoomCharacter.filter(c => c.Nickname.toLocaleLowerCase().indexOf(target) > -1))
let map = {}
found.forEach(c => {if (!map[c.cid]) map[c.cid] = c} )
found = Object.values(map)
@ -350,8 +350,12 @@ var bcModSdk=function(){"use strict";const o="1.0.2";function e(o){alert("Mod ER
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)
window.bce_ActivityTriggers.push(...window.bce_ActivityTriggers.filter(t => "Emote" === t.Type).map(t => this.copy_bce_trigger(t)))
/* (["anim", "pose"]).forEach(tag => {let cmd = window.Commands.find(c => tag === c.Tag); if (cmd) cmd.AutoComplete = this[`complete_bce_${tag}`]}) */ // this line explodes, don't ask me why
let cmd = window.Commands.find(c => "anim" === c.Tag)
if (cmd) cmd.AutoComplete = this.complete_bce_anim
cmd = window.Commands.find(c => "pose" === c.Tag)
if (cmd) cmd.AutoComplete = this.complete_bce_pose
},
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) {
@ -442,7 +446,8 @@ var bcModSdk=function(){"use strict";const o="1.0.2";function e(o){alert("Mod ER
let locase = token.toLocaleLowerCase()
let found = {}
for (let c of window.ChatRoomCharacter) {
if (!c.IsPlayer() || me2) [c.Name, c.Nickname, c.cid.toString()].forEach(s => {if (s.toLocaleLowerCase().startsWith(locase)) found[s] = true})
let [n, nn, cid] = [c.Name.toLocaleLowerCase(), c.Nickname.toLocaleLowerCase(), c.cid.toString()]
if (!c.IsPlayer() || me2) [n, nn, cid, `@${n}`, `@${nn}`, `=${cid}`].forEach(s => {if (s.startsWith(locase)) found[s] = true})
}
this.complete(Object.keys(found))
},
@ -487,6 +492,19 @@ var bcModSdk=function(){"use strict";const o="1.0.2";function e(o){alert("Mod ER
return(mbchc.complete_do_target(ags[mbchc.DO_DATA.zones[zone]], tokens[3]))
}
},
complete_bce_anim: function(args, locase, cmdline) { const [mbchc, input, tokens] = window.MBCHC.complete_common(); // `this` is command object
if (tokens.length < 1) return
if (tokens.length < 2) return(mbchc.complete([`${mbchc.CommandsKey}${this.Tag}`]))
if (tokens.length > 2) return
let anim = tokens[1].toLocaleLowerCase()
return(mbchc.complete(Object.keys(window.bce_EventExpressions).filter(a => a.toLocaleLowerCase().startsWith(anim))))
},
complete_bce_pose: function(args, locase, cmdline) { const [mbchc, input, tokens] = window.MBCHC.complete_common(); // `this` is command object
if (tokens.length < 1) return
if (tokens.length < 2) return(mbchc.complete([`${mbchc.CommandsKey}${this.Tag}`]))
let pose = tokens[tokens.length - 1].toLocaleLowerCase()
return(mbchc.complete(window.PoseFemale3DCG.map(p => p.Name).filter(p => p.toLocaleLowerCase().startsWith(pose))))
},
history: function(down) {
let text = window.ElementValue("InputChat")
if (!this.HISTORY_MODE) {