MBCHC/ambient.d.ts

63 lines
2.1 KiB
TypeScript
Raw Normal View History

interface ServerChatRoomMessage {
MBCHC_ID?: number
}
declare namespace MBCHC {
type WGT = Window & typeof globalThis
interface Root extends WGT {
MBCHC?: any
bcModSdk?: import('bondage-club-mod-sdk').ModSDKGlobalAPI
bce_ActivityTriggers?: any
bce_EventExpressions?: any
}
namespace Settings {
type V0 = PlayerOnlineSettings & {MBCHC: {timezones?: Record<number, number>}} // V0 is the whole onlinesettings
interface V1 { // V1 is specifically MBCHC inside extensionsettings
TZ: Record<number, number>
}
interface Methods {
migrate_0_1(v0: V0): true
save(cb?: (v1: V1) => unknown): true
replace(new_v1: V1): true
'purge!'(): true
get v1(): V1
}
}
interface Interval {
proxy: object // eslint-disable-line @typescript-eslint/ban-types
min: number
max: number
mini: boolean
maxi: boolean
upd(min: number, max: number, min_inclusive?: boolean, max_inclusive?: boolean): undefined
has(_: unknown, x: string): boolean
}
interface Utils {
interval: Interval
cid(character: Character): number | undefined
dn(character: Character): string
current(): string
with<V, R>(value: V, cb: (value: V) => R): R // A silly helper to kinda curry values
true<F extends (...args: unknown[]) => unknown>(cb: F): true // Useful for type-safe chaining
mutate<T>(value: T, cb: (v: T) => unknown): T // A silly helper for chaining
rm<T>(object: T, property: keyof T): T
mrg<T extends Record<string, unknown>>(target: T, ...source: T[]): T // Shorter, also less confusing with types
style<T>(query: string, cb: (s: CSSStyleDeclaration) => T): T | undefined
range(min: number, max: number, min_inclusive?: boolean, max_inclusive?: boolean): Proxy
assert<T>(error: string, value: T, cb?: (value: T) => boolean): T | never
each<T extends Record<string, unknown>>(object: T, cb: (key: string, value: unknown) => unknown): true
}
interface TZ_Cache {
map: Map<number, number>
RE: RegExp
for(character: Character): number | undefined
memo(member_number: number, description?: string | undefined): number | undefined
parse(description: string | undefined): number | undefined
}
}