MBCHC/mbchc-dev.user.js
2022-06-26 21:08:11 +00:00

155 lines
7.7 KiB
JavaScript

// ==UserScript==
// @name MBCHC
// @version dev
// @description Mute's Bondage Club Hacks Collection
// @author codename.mute@proton.me
// @homepage https://code.fleshless.org/mute/MBCHC
// @namespace https://code.fleshless.org/mute/
// @match https://bondageprojects.elementfx.com/R*
// @match https://www.bondageprojects.elementfx.com/R*
// @match https://bondage-europe.com/R*
// @match https://www.bondage-europe.com/R*
// @grant none
// ==/UserScript==
(function() {
'use strict';
if (!window.AsylumGGTSSAddItems) throw "AsylumGGTSSAddItems() not found, aborting"
// Static data
window.MBCHC = {
LOADED: false,
VERSION: 'dev',
AUTOHACK_ENABLED: false,
LAST_HACKED: null,
RE_TITLE: /^[a-zA-Z]+$/,
HIDE_SPECIAL: ["Activity","Emoticon"],
HIDE_BODY: ["Blush","BodyLower","BodyUpper","Eyebrows","Eyes","Eyes2","Face","Fluids","HairBack","HairFront","Hands","Head","Mouth","Nipples","Pussy"],
HIDE_CLOTHES: [
"Cloth","ClothAccessory","Necklace","Suit","ClothLower","SuitLower","Bra","Corset","Panties",
"Socks","RightAnklet","LeftAnklet","Garters","Shoes","Hat","HairAccessory3","HairAccessory1","HairAccessory2",
"Gloves","Bracelet","Glasses","Mask","TailStraps","Wings"
],
HIDE_ITEMS: [
"ItemMisc","ItemEars","ItemHead","ItemNose","ItemHood","ItemAddon","ItemMouth","ItemMouth2","ItemMouth3",
"ItemArms","ItemNeckAccessories","ItemNeck","ItemNeckRestraints","ItemNipples","ItemNipplesPiercings","ItemBreast","ItemTorso",
"ItemHands","ItemPelvis","ItemVulva","ItemVulvaPiercings",
"ItemDevices","ItemLegs","ItemFeet","ItemBoots"
],
COMMANDS: [
{ Tag: "disappear",
Description: ": Become invisible; requires anal hook (hair)",
Action: (argline, cmdline, args) => {
try {
window.MBCHC.make_my_anal_hook_hide_body()
} catch (x) { window.ChatRoomSendLocal(`(Error: ${x.toString()})`) }
},
},
{ Tag: "title",
Description: "[Title]: (WIP) Set a custom title (one short word, letters only)",
Action: (argline, cmdline, args) => {
try {
window.MBCHC.action_title(args)
} catch (x) { window.ChatRoomSendLocal(`(Error: ${x.toString()})`) }
},
},
{ Tag: "donate",
Description: "[MemberNumber]: Buy data and send it to recipient",
Action: (argline, cmdline, args) => {
try {
window.MBCHC.action_donate(args)
} catch (x) { window.ChatRoomSendLocal(`(Error: ${x.toString()})`) }
},
},
{ Tag: "autohack",
Description: ": Toggle autohack mode",
Action: (argline, cmdline, args) => {
try {
window.MBCHC.action_autohack()
} catch (x) { window.ChatRoomSendLocal(`(Error: ${x.toString()})`) }
},
},
],
log: function(msg) {return("MBCHC: " + msg.toString())},
orig_AsylumGGTSSAddItems: window.AsylumGGTSSAddItems,
orig_ChatRoomMessageInvolvesPlayer: window.ChatRoomMessageInvolvesPlayer,
orig_ChatRoomReceiveSuitcaseMoney: window.ChatRoomReceiveSuitcaseMoney,
} // MBCHC
// Loader
window.AsylumGGTSSAddItems = function() {
if (!window.MBCHC.LOADED) {
// Functions
window.MBCHC.HIDE_ALL = window.MBCHC.HIDE_SPECIAL.concat(window.MBCHC.HIDE_BODY).concat(window.MBCHC.HIDE_CLOTHES).concat(window.MBCHC.HIDE_ITEMS)
window.MBCHC.make_my_anal_hook_hide_body = function() {
let item = window.InventoryGet(window.Player, "ItemButt")
if (!item || !item.Asset || !item.Asset.Name) throw "butt seems empty"
if (item.Asset.Name !== "AnalHook") throw "butt seems occupied by something other than the anal hook"
if (!item.Property.Type || item.Property.Type !== "Hair") throw "anal hook seems not tied to hair"
item.Property = {Type: "Hair", Hide: this.HIDE_ALL}
window.CharacterRefresh(window.Player, true, true)
}
window.MBCHC.donate_data = function(id) {
if (id == window.Player.MemberNumber) throw "recipient must not be you"
const char = window.ChatRoomCharacter.find( c => c.MemberNumber == id )
if (!char) throw "recipient not found"
if (!char.IsRestrained()) throw "recipient must be bound"
const cost = (Math.random() * 10 + 15).toFixed(0)
if (window.Player.Money < cost) throw "not enough money"
window.CharacterChangeMoney(window.Player, -cost)
window.ServerSend("ChatRoomChat", {Content: "ReceiveSuitcaseMoney", Type: "Hidden", Target: id})
return({cost: cost, name: (char.Nickname || char.Name)})
}
// Command actions
window.MBCHC.action_title = function(args) {
let title = args.shift()
if (!title || !title.length || title.length < 1) throw "empty title"
if (title.length > 16) throw "title too long"
if (!title.match(window.MBCHC.RE_TITLE)) throw "invalid title"
let first = title.at(0).toLocaleUpperCase()
let rest = title.slice(1).toLocaleLowerCase()
title = first + rest
window.TitleSet(title)
// TODO: this needs much more work. at least don't push a second title
// we need to patch the text cache
// we need to check for other players' custom titles
window.TitleList.push({Name: title, Requirement: () => {return true}})
}
window.MBCHC.action_donate = function(args) {
let id = Number.parseInt(args.shift())
if (isNaN(id)) throw "empty or invalid member number"
let result = window.MBCHC.donate_data(id)
window.ChatRoomSendLocal(`(You've bought data for $${result.cost} and sent it to ${result.name})`)
}
window.MBCHC.action_autohack = function() {
window.MBCHC.AUTOHACK_ENABLED = !window.MBCHC.AUTOHACK_ENABLED
window.ChatRoomSendLocal(`(Autohack is now ${window.MBCHC.AUTOHACK_ENABLED ? "enabled" : "disabled"})`)
}
// Hooks
window.ChatRoomMessageInvolvesPlayer = function(data) {
//console.log({data: data})
if (("ReceiveSuitcaseMoney" === data.Content) && ("Hidden" === data.Type)) { window.MBCHC.LAST_HACKED = data.Sender }
return(window.MBCHC.orig_ChatRoomMessageInvolvesPlayer(data))
}
window.ChatRoomReceiveSuitcaseMoney = function() {
let result = window.MBCHC.orig_ChatRoomReceiveSuitcaseMoney()
if (window.MBCHC.AUTOHACK_ENABLED && window.MBCHC.LAST_HACKED) {
window.CurrentCharacter = {MemberNumber: window.MBCHC.LAST_HACKED}
window.MBCHC.LAST_HACKED = null
window.ChatRoomTryToTakeSuitcase()
}
return(result)
}
// Actions
window.CommandCombine(window.MBCHC.COMMANDS)
window.MBCHC.LOADED = true
console.info(window.MBCHC.log("loaded version " + window.MBCHC.VERSION))
}
return(window.MBCHC.orig_AsylumGGTSSAddItems())
} // Loader
})()