@scml-dol-maplebirch/types 5.0.4 → 5.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/compat/DoLPcompat.d.ts +55 -0
- package/compat/ModI18N.d.ts +10 -0
- package/compat/Prototype.d.ts +43 -0
- package/compat/SimpleFrameworks.d.ts +1 -0
- package/constants.d.ts +52 -0
- package/core.d.ts +143 -0
- package/host/DoL.d.ts +44 -0
- package/host/ModLoader.d.ts +37 -0
- package/host/Resources.d.ts +15 -0
- package/host/SugarCube.d.ts +25 -0
- package/index.d.ts +11 -30
- package/infra/Catalog.d.ts +14 -0
- package/infra/Diagnostics.d.ts +48 -0
- package/infra/Emitter.d.ts +18 -0
- package/infra/Hooks.d.ts +15 -0
- package/infra/Lifecycle.d.ts +24 -0
- package/infra/Logger.d.ts +15 -0
- package/macros/helpers.d.ts +54 -0
- package/macros/index.d.ts +8 -0
- package/macros/lanButton.d.ts +2 -0
- package/macros/lanLink.d.ts +2 -0
- package/macros/lanListbox.d.ts +2 -0
- package/macros/lanSwitch.d.ts +3 -0
- package/macros/language.d.ts +2 -0
- package/macros/macros.d.ts +14 -0
- package/macros/maplebirchReplace.d.ts +1 -0
- package/macros/radiobuttonsfrom.d.ts +2 -0
- package/main.d.ts +22 -0
- package/maplebirch.d.ts +11 -4439
- package/modules/Audio.d.ts +118 -0
- package/modules/AudioAddon/Ambience.d.ts +17 -0
- package/modules/AudioAddon/AudioBufferPlayer.d.ts +20 -0
- package/modules/AudioAddon/Playlist.d.ts +29 -0
- package/modules/AudioAddon/Track.d.ts +15 -0
- package/modules/Character.d.ts +39 -0
- package/modules/CharacterAddon/Pet.d.ts +61 -0
- package/modules/CharacterAddon/Transformation.d.ts +70 -0
- package/modules/CharacterAddon/TransformationConfig.d.ts +20 -0
- package/modules/Combat.d.ts +17 -0
- package/modules/CombatAddon/CombatAction.d.ts +63 -0
- package/modules/CombatAddon/CombatTypes.d.ts +4 -0
- package/modules/DoL/Config.d.ts +50 -0
- package/modules/DoL/Dynamic.d.ts +23 -0
- package/modules/DoL/Integration.d.ts +13 -0
- package/modules/DoL/Patches/Antiques.d.ts +17 -0
- package/modules/DoL/Patches/Bodywriting.d.ts +33 -0
- package/modules/DoL/Patches/Fishing.d.ts +32 -0
- package/modules/DoL/Patches/Foodstuff.d.ts +64 -0
- package/modules/DoL/Patches/Location.d.ts +36 -0
- package/modules/DoL/Patches/Tips.d.ts +7 -0
- package/modules/DoL/Patches/Traits.d.ts +24 -0
- package/modules/DoL/Patches/config.d.ts +2 -0
- package/modules/DoL/Patches/index.d.ts +86 -0
- package/modules/DoL/Replacements.d.ts +189 -0
- package/modules/DoL/ToolCollection.d.ts +17 -0
- package/modules/DoL/index.d.ts +1 -0
- package/modules/DoL/types.d.ts +20 -0
- package/modules/Dynamic.d.ts +10 -0
- package/modules/Event.d.ts +16 -0
- package/modules/Frameworks/ApplyLinkZone.d.ts +40 -0
- package/modules/Frameworks/ConsoleCheat.d.ts +43 -0
- package/modules/Frameworks/DoLConsole.d.ts +8 -0
- package/modules/Frameworks/DoLMacros.d.ts +6 -0
- package/modules/Frameworks/HtmlTools.d.ts +49 -0
- package/modules/Frameworks/ImageLoader.d.ts +6 -0
- package/modules/Frameworks/OptionEvents.d.ts +15 -0
- package/modules/Frameworks/Patch.d.ts +24 -0
- package/modules/Frameworks/RandSystem.d.ts +27 -0
- package/modules/Frameworks/TextStore.d.ts +7 -0
- package/modules/Frameworks/TimeTravelCheat.d.ts +17 -0
- package/modules/Frameworks/ZonesManager.d.ts +69 -0
- package/modules/Frameworks/macros.d.ts +27 -0
- package/modules/Frameworks/migration.d.ts +33 -0
- package/modules/NamedNPC.d.ts +164 -0
- package/modules/NamedNPCAddon/NPCClothes/Condition.d.ts +3 -0
- package/modules/NamedNPCAddon/NPCClothes/NPCOutfitSets.d.ts +38 -0
- package/modules/NamedNPCAddon/NPCClothes/NPCSidebarArt.d.ts +25 -0
- package/modules/NamedNPCAddon/NPCClothes/NPCSidebarWardrobe.d.ts +60 -0
- package/modules/NamedNPCAddon/NPCClothes.d.ts +12 -0
- package/modules/NamedNPCAddon/NPCFluids.d.ts +17 -0
- package/modules/NamedNPCAddon/NPCPregnancy.d.ts +127 -0
- package/modules/NamedNPCAddon/NPCSchedules.d.ts +77 -0
- package/modules/NamedNPCAddon/NPCSidebar.d.ts +28 -0
- package/modules/NamedNPCAddon/NPCSidebarConfig/base_layers.d.ts +212 -0
- package/modules/NamedNPCAddon/NPCSidebarConfig/face_layers.d.ts +220 -0
- package/modules/NamedNPCAddon/NPCSidebarConfig/feet_layers.d.ts +274 -0
- package/modules/NamedNPCAddon/NPCSidebarConfig/fluids_layers.d.ts +109 -0
- package/modules/NamedNPCAddon/NPCSidebarConfig/functions.d.ts +509 -0
- package/modules/NamedNPCAddon/NPCSidebarConfig/handheld_layers.d.ts +292 -0
- package/modules/NamedNPCAddon/NPCSidebarConfig/hands_layers.d.ts +381 -0
- package/modules/NamedNPCAddon/NPCSidebarConfig/head_layers.d.ts +490 -0
- package/modules/NamedNPCAddon/NPCSidebarConfig/legs_layers.d.ts +274 -0
- package/modules/NamedNPCAddon/NPCSidebarConfig/lower_layers.d.ts +800 -0
- package/modules/NamedNPCAddon/NPCSidebarConfig/neck_layers.d.ts +112 -0
- package/modules/NamedNPCAddon/NPCSidebarConfig/transformation_layers.d.ts +1672 -0
- package/modules/NamedNPCAddon/NPCSidebarConfig/types.d.ts +130 -0
- package/modules/NamedNPCAddon/NPCSidebarConfig/upper_layers.d.ts +1516 -0
- package/modules/NamedNPCAddon/NPCTransformation.d.ts +51 -0
- package/modules/NamedNPCAddon/NPCUtils.d.ts +8 -0
- package/modules/State.d.ts +46 -0
- package/modules/TimeStateWeather/DateTime.d.ts +4 -0
- package/modules/TimeStateWeather/Time.d.ts +14 -0
- package/modules/TimeStateWeather/TimeEvents.d.ts +130 -0
- package/modules/TimeStateWeather/WeatherEvents.d.ts +56 -0
- package/modules/ToolCollection.d.ts +33 -0
- package/modules/Variables.d.ts +32 -0
- package/package.d.ts +30 -0
- package/package.json +5 -7
- package/services/AddonPlugin.d.ts +92 -0
- package/services/CloudSave.d.ts +124 -0
- package/services/CredentialVault.d.ts +80 -0
- package/services/GUIControl.d.ts +54 -0
- package/services/IndexedDB.d.ts +28 -0
- package/services/Modules.d.ts +75 -0
- package/services/Translator.d.ts +60 -0
- package/types/global.d.ts +123 -0
- package/types/twine-sugarcube.d.ts +456 -0
- package/utils/array.d.ts +10 -0
- package/utils/binary.d.ts +8 -0
- package/utils/condition.d.ts +1 -0
- package/utils/index.d.ts +22 -0
- package/utils/object.d.ts +16 -0
- package/utils/selector.d.ts +20 -0
- package/utils/string.d.ts +8 -0
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type NPCManager from '../NamedNPC.js';
|
|
2
|
+
import type { NPCBodyData, NPCSidebarState } from './NPCSidebarConfig/types.js';
|
|
3
|
+
import { transformationDefaults } from './NPCSidebarConfig/transformation_layers.js';
|
|
4
|
+
export interface NPCTransformationState {
|
|
5
|
+
build: number;
|
|
6
|
+
level: number;
|
|
7
|
+
}
|
|
8
|
+
export type NPCTransformationPart = {
|
|
9
|
+
[Key in keyof typeof transformationDefaults]: Key extends `${infer Part}_type` ? Part : never;
|
|
10
|
+
}[keyof typeof transformationDefaults];
|
|
11
|
+
export interface NPCTransformationPartConfig {
|
|
12
|
+
level?: number;
|
|
13
|
+
style?: string;
|
|
14
|
+
filter?: {
|
|
15
|
+
blend?: string;
|
|
16
|
+
blendMode?: string;
|
|
17
|
+
brightness?: number;
|
|
18
|
+
contrast?: number;
|
|
19
|
+
desaturate?: boolean;
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
export interface NPCTransformationConfig {
|
|
23
|
+
levels?: readonly number[];
|
|
24
|
+
type?: string;
|
|
25
|
+
parts?: Partial<Record<NPCTransformationPart, NPCTransformationPartConfig>>;
|
|
26
|
+
body?: (bodydata: NPCBodyData, state: Readonly<NPCTransformationState>, npcName: string) => void;
|
|
27
|
+
sidebar?: (nnpc: Partial<NPCSidebarState>, state: Readonly<NPCTransformationState>, npcName: string) => void;
|
|
28
|
+
layers?: CanvasLayerMap;
|
|
29
|
+
}
|
|
30
|
+
declare class NPCTransformation {
|
|
31
|
+
private readonly manager;
|
|
32
|
+
private readonly configs;
|
|
33
|
+
constructor(manager: NPCManager);
|
|
34
|
+
add(npcName: string, type: string, config?: NPCTransformationConfig): this;
|
|
35
|
+
ensure(npcName: string, type?: string): Record<string, NPCTransformationState>;
|
|
36
|
+
get(npcName: string, type: string): NPCTransformationState;
|
|
37
|
+
build(npcName: string, type: string, value: number): NPCTransformationState;
|
|
38
|
+
set(npcName: string, type: string, level: number): NPCTransformationState;
|
|
39
|
+
clear(npcName: string, type?: string): void;
|
|
40
|
+
level(npcName: string, type: string): number;
|
|
41
|
+
type(npcName: string): string;
|
|
42
|
+
applyBody(nnpc: Partial<NPCSidebarState>, npcData: {
|
|
43
|
+
bodydata?: NPCBodyData;
|
|
44
|
+
}): void;
|
|
45
|
+
applySidebar(nnpc: Partial<NPCSidebarState>): void;
|
|
46
|
+
private read;
|
|
47
|
+
private entries;
|
|
48
|
+
private config;
|
|
49
|
+
private active;
|
|
50
|
+
}
|
|
51
|
+
export default NPCTransformation;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type NPCManager from '../NamedNPC.js';
|
|
2
|
+
declare const bodyDefaults: {
|
|
3
|
+
hair_sides_length: number;
|
|
4
|
+
hair_fringe_length: number;
|
|
5
|
+
};
|
|
6
|
+
declare function isPossible(manager: NPCManager, name: string): boolean;
|
|
7
|
+
declare function setupNPCData(manager: NPCManager): void;
|
|
8
|
+
export { bodyDefaults, isPossible, setupNPCData };
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type Dynamic from './Dynamic.js';
|
|
2
|
+
import Event, { type EventOptions } from './Event.js';
|
|
3
|
+
export interface StateEventOptions extends EventOptions {
|
|
4
|
+
output?: string;
|
|
5
|
+
action?: () => void;
|
|
6
|
+
cond?: () => boolean;
|
|
7
|
+
forceExit?: boolean | (() => boolean);
|
|
8
|
+
extra?: {
|
|
9
|
+
passage?: string[];
|
|
10
|
+
exclude?: string[];
|
|
11
|
+
match?: RegExp;
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
interface StateEventResult {
|
|
15
|
+
hasOutput: boolean;
|
|
16
|
+
remove: boolean;
|
|
17
|
+
}
|
|
18
|
+
declare class StateEvent extends Event {
|
|
19
|
+
readonly type: 'gate' | 'append';
|
|
20
|
+
protected readonly eventName = "StateEvent";
|
|
21
|
+
output?: string;
|
|
22
|
+
private action?;
|
|
23
|
+
private cond;
|
|
24
|
+
private forceExit;
|
|
25
|
+
private extra;
|
|
26
|
+
constructor(id: string, type: 'gate' | 'append', options: StateEventOptions, log: Dynamic['log']);
|
|
27
|
+
private checkPassage;
|
|
28
|
+
tryRun(passageName?: string): StateEventResult | null;
|
|
29
|
+
private match;
|
|
30
|
+
private runAction;
|
|
31
|
+
shouldForceExit(): boolean;
|
|
32
|
+
}
|
|
33
|
+
export declare class StateManager {
|
|
34
|
+
private readonly manager;
|
|
35
|
+
private readonly stateEvents;
|
|
36
|
+
private readonly log;
|
|
37
|
+
constructor(manager: Dynamic);
|
|
38
|
+
get events(): Readonly<Record<'gate' | 'append', ReadonlyMap<string, StateEvent>>>;
|
|
39
|
+
trigger(type: 'gate' | 'append'): string;
|
|
40
|
+
private processGateEvents;
|
|
41
|
+
private processAppendEvents;
|
|
42
|
+
register(type: 'gate' | 'append', eventId: string, options: StateEventOptions): boolean;
|
|
43
|
+
unregister(type: 'gate' | 'append', eventId: string): boolean;
|
|
44
|
+
Init(): void;
|
|
45
|
+
}
|
|
46
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare function patchTimeAsset(content: string): string;
|
|
2
|
+
interface TimeHandlers {
|
|
3
|
+
pass?: (seconds: number) => unknown;
|
|
4
|
+
timeTravel?: (date: DateTime) => unknown;
|
|
5
|
+
}
|
|
6
|
+
export interface VanillaTimeHandlers {
|
|
7
|
+
set?: (value?: number | DateTime) => void;
|
|
8
|
+
pass?: (seconds: number) => unknown;
|
|
9
|
+
setDate?: (date: DateTime) => void;
|
|
10
|
+
}
|
|
11
|
+
export declare const vanillaTime: VanillaTimeHandlers;
|
|
12
|
+
export declare function bindTimeHandlers(time: TimeAPI, handlers: TimeHandlers): void;
|
|
13
|
+
declare function patchTime(time: TimeAPI): void;
|
|
14
|
+
export default patchTime;
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import type DoLDynamic from '../DoL/Dynamic.js';
|
|
2
|
+
import Event, { type EventOptions } from '../Event.js';
|
|
3
|
+
export type TimeEventType = 'onSec' | 'onMin' | 'onHour' | 'onDay' | 'onWeek' | 'onMonth' | 'onYear' | 'onBefore' | 'onThread' | 'onAfter' | 'onTimeTravel';
|
|
4
|
+
type TimeUnit = 'sec' | 'min' | 'hour' | 'day' | 'week' | 'month' | 'year';
|
|
5
|
+
interface AccumulateConfig {
|
|
6
|
+
unit: TimeUnit;
|
|
7
|
+
target?: number;
|
|
8
|
+
}
|
|
9
|
+
export interface TimeData {
|
|
10
|
+
prevDate?: DateTime;
|
|
11
|
+
currentDate?: DateTime;
|
|
12
|
+
changes?: Record<TimeUnit, number>;
|
|
13
|
+
triggeredByAccumulator?: {
|
|
14
|
+
unit: TimeUnit;
|
|
15
|
+
target: number;
|
|
16
|
+
count: number;
|
|
17
|
+
};
|
|
18
|
+
exactPoints?: {
|
|
19
|
+
min: boolean;
|
|
20
|
+
hour: boolean;
|
|
21
|
+
day: boolean;
|
|
22
|
+
week: boolean;
|
|
23
|
+
month: boolean;
|
|
24
|
+
year: boolean;
|
|
25
|
+
};
|
|
26
|
+
passed?: number;
|
|
27
|
+
sec?: number;
|
|
28
|
+
min?: number;
|
|
29
|
+
hour?: number;
|
|
30
|
+
day?: number;
|
|
31
|
+
week?: number;
|
|
32
|
+
month?: number;
|
|
33
|
+
year?: number;
|
|
34
|
+
weekday?: [number, number];
|
|
35
|
+
detailedDiff?: ReturnType<DateTime['compareWith']>;
|
|
36
|
+
timeStamp?: number;
|
|
37
|
+
prev?: DateTime;
|
|
38
|
+
current?: DateTime;
|
|
39
|
+
diffSeconds?: number;
|
|
40
|
+
direction?: 'forward' | 'backward';
|
|
41
|
+
isLeap?: boolean;
|
|
42
|
+
}
|
|
43
|
+
export interface TimeEventOptions extends EventOptions {
|
|
44
|
+
action?: (data: TimeData) => void;
|
|
45
|
+
cond?: (data: TimeData) => boolean;
|
|
46
|
+
accumulate?: AccumulateConfig;
|
|
47
|
+
exact?: boolean;
|
|
48
|
+
}
|
|
49
|
+
export interface TimeTravelOptions {
|
|
50
|
+
target?: DateTime;
|
|
51
|
+
year?: number;
|
|
52
|
+
month?: number;
|
|
53
|
+
day?: number;
|
|
54
|
+
hour?: number;
|
|
55
|
+
minute?: number;
|
|
56
|
+
second?: number;
|
|
57
|
+
addYears?: number;
|
|
58
|
+
addMonths?: number;
|
|
59
|
+
addDays?: number;
|
|
60
|
+
addHours?: number;
|
|
61
|
+
addMinutes?: number;
|
|
62
|
+
addSeconds?: number;
|
|
63
|
+
}
|
|
64
|
+
declare class TimeEvent extends Event {
|
|
65
|
+
readonly type: TimeEventType;
|
|
66
|
+
protected readonly eventName = "TimeEvent";
|
|
67
|
+
private action?;
|
|
68
|
+
private cond;
|
|
69
|
+
private exact;
|
|
70
|
+
private accumulate?;
|
|
71
|
+
private accumulated;
|
|
72
|
+
private target;
|
|
73
|
+
constructor(id: string, type: TimeEventType, options: TimeEventOptions, log: DoLDynamic['log']);
|
|
74
|
+
tryRun(data: TimeData, accumulatedOnly?: boolean): boolean;
|
|
75
|
+
private runAccumulated;
|
|
76
|
+
private execute;
|
|
77
|
+
private match;
|
|
78
|
+
private runAction;
|
|
79
|
+
private isExactPoint;
|
|
80
|
+
}
|
|
81
|
+
export declare class TimeManager {
|
|
82
|
+
private readonly manager;
|
|
83
|
+
private readonly timeEvents;
|
|
84
|
+
private readonly travelHooks;
|
|
85
|
+
readonly log: DoLDynamic['log'];
|
|
86
|
+
readonly TimeConstants: Readonly<{
|
|
87
|
+
secondsPerDay: 86400;
|
|
88
|
+
secondsPerHour: 3600;
|
|
89
|
+
secondsPerMinute: 60;
|
|
90
|
+
minutesPerHour: 60;
|
|
91
|
+
standardYearMonths: readonly number[];
|
|
92
|
+
leapYearMonths: readonly number[];
|
|
93
|
+
synodicMonth: 29.53058867;
|
|
94
|
+
MIN_DATE: Readonly<{
|
|
95
|
+
timeStamp: -315537984000;
|
|
96
|
+
year: -9999;
|
|
97
|
+
month: 1;
|
|
98
|
+
day: 1;
|
|
99
|
+
hour: 0;
|
|
100
|
+
minute: 0;
|
|
101
|
+
second: 0;
|
|
102
|
+
}>;
|
|
103
|
+
MAX_DATE: Readonly<{
|
|
104
|
+
timeStamp: 315537897599;
|
|
105
|
+
year: 9999;
|
|
106
|
+
month: 12;
|
|
107
|
+
day: 31;
|
|
108
|
+
hour: 23;
|
|
109
|
+
minute: 59;
|
|
110
|
+
second: 59;
|
|
111
|
+
}>;
|
|
112
|
+
}>;
|
|
113
|
+
constructor(manager: DoLDynamic);
|
|
114
|
+
get events(): Readonly<Record<string, ReadonlyMap<string, TimeEvent>>>;
|
|
115
|
+
Init(): void;
|
|
116
|
+
patchDateTime(DateTimeClass: typeof DateTime): typeof DateTime;
|
|
117
|
+
patchTime(TimeObject: typeof Time): void;
|
|
118
|
+
register(type: TimeEventType, eventId: string, options: TimeEventOptions): boolean;
|
|
119
|
+
unregister(type: string, eventId: string): boolean;
|
|
120
|
+
onTravel(name: string, callback: (data: TimeData) => void): boolean;
|
|
121
|
+
timeTravel(options?: TimeTravelOptions): boolean;
|
|
122
|
+
updateTimeLanguage(choice?: 'JournalTime'): string | boolean;
|
|
123
|
+
private handleTimePass;
|
|
124
|
+
private handleTimeTravel;
|
|
125
|
+
private targetDate;
|
|
126
|
+
private timeData;
|
|
127
|
+
private triggerUnitEvents;
|
|
128
|
+
private trigger;
|
|
129
|
+
}
|
|
130
|
+
export {};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type AddonPlugin from '../../services/AddonPlugin.js';
|
|
2
|
+
import type DoLDynamic from '../DoL/Dynamic.js';
|
|
3
|
+
import { type EventOptions } from '../Event.js';
|
|
4
|
+
export interface WeatherEventOptions extends EventOptions {
|
|
5
|
+
condition?: () => boolean;
|
|
6
|
+
onEnter?: () => void;
|
|
7
|
+
onExit?: () => void;
|
|
8
|
+
[key: string]: any;
|
|
9
|
+
}
|
|
10
|
+
export interface WeatherTypeConfig {
|
|
11
|
+
name: string;
|
|
12
|
+
iconType?: string | (() => string);
|
|
13
|
+
value: number;
|
|
14
|
+
probability: {
|
|
15
|
+
summer: number;
|
|
16
|
+
winter: number;
|
|
17
|
+
spring: number;
|
|
18
|
+
autumn: number;
|
|
19
|
+
};
|
|
20
|
+
cloudCount: {
|
|
21
|
+
small: () => number;
|
|
22
|
+
large: () => number;
|
|
23
|
+
};
|
|
24
|
+
tanningModifier: number;
|
|
25
|
+
overcast: number | (() => number);
|
|
26
|
+
precipitationIntensity: number;
|
|
27
|
+
visibility: number;
|
|
28
|
+
}
|
|
29
|
+
export interface WeatherException {
|
|
30
|
+
date: () => DateTime;
|
|
31
|
+
duration: number;
|
|
32
|
+
weatherType: string;
|
|
33
|
+
temperature?: number;
|
|
34
|
+
}
|
|
35
|
+
export declare class WeatherManager {
|
|
36
|
+
private readonly manager;
|
|
37
|
+
private readonly weatherEvents;
|
|
38
|
+
private readonly activeEvents;
|
|
39
|
+
private readonly Exceptions;
|
|
40
|
+
private readonly WeatherTypes;
|
|
41
|
+
private readonly layerModifications;
|
|
42
|
+
private readonly effectModifications;
|
|
43
|
+
private weatherTriggered;
|
|
44
|
+
private readonly log;
|
|
45
|
+
constructor(manager: DoLDynamic);
|
|
46
|
+
private refresh;
|
|
47
|
+
private checkEvents;
|
|
48
|
+
register(eventId: string, options: WeatherEventOptions): boolean;
|
|
49
|
+
unregister(eventId: string): boolean;
|
|
50
|
+
addLayer(layerName: string, patch: any, mode?: 'concat' | 'replace' | 'merge'): this;
|
|
51
|
+
addEffect(effectName: string, patch: any, mode?: 'concat' | 'replace' | 'merge'): this;
|
|
52
|
+
applyModifications(params: any): any;
|
|
53
|
+
addWeatherData(data: WeatherException | WeatherTypeConfig): boolean | void;
|
|
54
|
+
Init(): void;
|
|
55
|
+
modifyWeatherJavaScript(manager: AddonPlugin): void;
|
|
56
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { MaplebirchCore } from '../core.js';
|
|
2
|
+
import type { ScopedLog } from '../infra/Diagnostics.js';
|
|
3
|
+
import Console from './Frameworks/ConsoleCheat.js';
|
|
4
|
+
import migration from './Frameworks/migration.js';
|
|
5
|
+
import randSystem from './Frameworks/RandSystem.js';
|
|
6
|
+
import defineMacros, { type MacroFunction, type SimpleMacroFunction, type MacroTags, type SkipArgs, type MacroPhase } from './Frameworks/macros.js';
|
|
7
|
+
import htmlTools from './Frameworks/HtmlTools.js';
|
|
8
|
+
import { zonesManager, type InitFunction, type ZoneWidget } from './Frameworks/ZonesManager.js';
|
|
9
|
+
import applyLinkZone from './Frameworks/ApplyLinkZone.js';
|
|
10
|
+
import Patch from './Frameworks/Patch.js';
|
|
11
|
+
type ToolConstructors = {
|
|
12
|
+
console?: new (manager: ToolCollection) => Console;
|
|
13
|
+
macro?: new (manager: ToolCollection) => defineMacros;
|
|
14
|
+
};
|
|
15
|
+
declare class ToolCollection {
|
|
16
|
+
readonly core: MaplebirchCore;
|
|
17
|
+
readonly log: ScopedLog;
|
|
18
|
+
readonly console: Console;
|
|
19
|
+
readonly migration: typeof migration;
|
|
20
|
+
readonly rand: typeof randSystem;
|
|
21
|
+
readonly macro: defineMacros;
|
|
22
|
+
readonly text: htmlTools;
|
|
23
|
+
readonly zone: zonesManager;
|
|
24
|
+
readonly link: typeof applyLinkZone;
|
|
25
|
+
readonly patch: Patch;
|
|
26
|
+
constructor(core: MaplebirchCore, constructors?: ToolConstructors);
|
|
27
|
+
onInit(...widgets: InitFunction[]): void;
|
|
28
|
+
define<Args extends unknown[]>(name: string, fn: MacroFunction<Args>, tags?: MacroTags, skipArgs?: SkipArgs, isAsync?: boolean, phase?: MacroPhase): void;
|
|
29
|
+
defineS<Args extends unknown[]>(name: string, fn: SimpleMacroFunction<Args>, tags?: MacroTags, skipArgs?: SkipArgs, maintainContext?: boolean, phase?: MacroPhase): void;
|
|
30
|
+
addTo(zone: string, ...widgets: ZoneWidget[]): void;
|
|
31
|
+
inject(...databases: Parameters<zonesManager['inject']>): void;
|
|
32
|
+
}
|
|
33
|
+
export default ToolCollection;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { MaplebirchCore } from '../core.js';
|
|
2
|
+
import type { ScopedLog } from '../infra/Diagnostics.js';
|
|
3
|
+
import migration from './Frameworks/migration.js';
|
|
4
|
+
declare class Options {
|
|
5
|
+
define(...args: any[]): any;
|
|
6
|
+
}
|
|
7
|
+
interface HairGradientsReturn {
|
|
8
|
+
fringe: Record<string, string[]>;
|
|
9
|
+
sides: Record<string, string[]>;
|
|
10
|
+
}
|
|
11
|
+
declare function hairgradients(): HairGradientsReturn;
|
|
12
|
+
declare class Variables {
|
|
13
|
+
readonly core: MaplebirchCore;
|
|
14
|
+
private static readonly OPTIONS_STORAGE_KEY;
|
|
15
|
+
private static moduleOptions;
|
|
16
|
+
static add(key: string, value: any): void;
|
|
17
|
+
static get options(): Record<string, any>;
|
|
18
|
+
version: string;
|
|
19
|
+
readonly tool: MaplebirchCore['tool'];
|
|
20
|
+
readonly log: ScopedLog;
|
|
21
|
+
readonly migration: migration;
|
|
22
|
+
readonly options: Options;
|
|
23
|
+
constructor(core: MaplebirchCore);
|
|
24
|
+
hairgradients: typeof hairgradients;
|
|
25
|
+
optionsStorage(action: 'save' | 'restore' | 'reset' | 'load'): any | null;
|
|
26
|
+
check(): void;
|
|
27
|
+
Init(): void;
|
|
28
|
+
loadInit(): void;
|
|
29
|
+
postInit(): void;
|
|
30
|
+
private run;
|
|
31
|
+
}
|
|
32
|
+
export default Variables;
|
package/package.d.ts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import instance, * as types from './index';
|
|
2
|
+
|
|
3
|
+
type Utils = typeof types.utils.publicUtils;
|
|
4
|
+
|
|
5
|
+
declare global {
|
|
6
|
+
const maplebirch: typeof instance;
|
|
7
|
+
function clone<T>(...args: Parameters<typeof types.utils.clone<T>>): ReturnType<typeof types.utils.clone<T>>;
|
|
8
|
+
const equal: Utils['equal'];
|
|
9
|
+
const merge: Utils['merge'];
|
|
10
|
+
const append: Utils['append'];
|
|
11
|
+
const cover: Utils['cover'];
|
|
12
|
+
const mergefn: Utils['mergefn'];
|
|
13
|
+
const appendfn: Utils['appendfn'];
|
|
14
|
+
const coverfn: Utils['coverfn'];
|
|
15
|
+
const contains: Utils['contains'];
|
|
16
|
+
function random(...args: Parameters<Utils['random']>): ReturnType<Utils['random']>;
|
|
17
|
+
function either<T>(...args: Parameters<typeof types.utils.either<T>>): ReturnType<typeof types.utils.either<T>>;
|
|
18
|
+
const SelectCase: Utils['SelectCase'];
|
|
19
|
+
const convert: Utils['convert'];
|
|
20
|
+
const clamp: Utils['clamp'];
|
|
21
|
+
const loadImage: typeof types.ImageLoader.load;
|
|
22
|
+
|
|
23
|
+
interface Window extends Readonly<Utils> {
|
|
24
|
+
readonly maplebirch: typeof instance;
|
|
25
|
+
readonly loadImage: typeof types.ImageLoader.load;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export default instance;
|
|
30
|
+
export * from './index';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scml-dol-maplebirch/types",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.1.1",
|
|
4
4
|
"description": "TypeScript definitions for maplebirchFramework.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"degrees-of-lewdity",
|
|
@@ -13,21 +13,19 @@
|
|
|
13
13
|
"license": "(MIT OR CC-BY-NC-SA-4.0)",
|
|
14
14
|
"repository": {
|
|
15
15
|
"type": "git",
|
|
16
|
-
"url": "git+https://github.com/MaplebirchLeaf/SCML-DOL-maplebirchFramework.git"
|
|
17
|
-
"directory": "packages/types"
|
|
16
|
+
"url": "git+https://github.com/MaplebirchLeaf/SCML-DOL-maplebirchFramework.git"
|
|
18
17
|
},
|
|
19
18
|
"files": [
|
|
20
|
-
"
|
|
21
|
-
"maplebirch.d.ts",
|
|
19
|
+
"**/*.d.ts",
|
|
22
20
|
"README.md",
|
|
23
21
|
"LICENSE",
|
|
24
22
|
"LICENSE-CC-BY-NC-SA-4.0"
|
|
25
23
|
],
|
|
26
24
|
"sideEffects": false,
|
|
27
|
-
"types": "
|
|
25
|
+
"types": "package.d.ts",
|
|
28
26
|
"exports": {
|
|
29
27
|
".": {
|
|
30
|
-
"types": "./
|
|
28
|
+
"types": "./package.d.ts"
|
|
31
29
|
}
|
|
32
30
|
},
|
|
33
31
|
"publishConfig": {
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import type { Passage } from '@scml/types/sugarcube-2-ModLoader/SugarCube2';
|
|
2
|
+
import type { ModBootJson, ModInfo } from '@scml/types/sugarcube-2-ModLoader/ModLoader';
|
|
3
|
+
import type { JSZipLikeReadOnlyInterface } from '@scml/types/sugarcube-2-ModLoader/JSZipLikeReadOnlyInterface';
|
|
4
|
+
import type { ModZipReader } from '@scml/types/sugarcube-2-ModLoader/ModZipReader';
|
|
5
|
+
import type { SC2DataManager } from '@scml/types/sugarcube-2-ModLoader/SC2DataManager';
|
|
6
|
+
import type { ModUtils } from '@scml/types/sugarcube-2-ModLoader/Utils';
|
|
7
|
+
import type { CryptOptions } from '../services/CredentialVault.js';
|
|
8
|
+
import type ModLoader from '../host/ModLoader.js';
|
|
9
|
+
import type Resources from '../host/Resources.js';
|
|
10
|
+
import type SugarCube from '../host/SugarCube.js';
|
|
11
|
+
import type Emitter from '../infra/Emitter.js';
|
|
12
|
+
import Catalog from '../infra/Catalog.js';
|
|
13
|
+
import Hooks from '../infra/Hooks.js';
|
|
14
|
+
import type { Replacement } from '../host/ModLoader.js';
|
|
15
|
+
import type CredentialVault from './CredentialVault.js';
|
|
16
|
+
import type GUIControl from './GUIControl.js';
|
|
17
|
+
import type IndexedDB from './IndexedDB.js';
|
|
18
|
+
import type Modules from './Modules.js';
|
|
19
|
+
import type Translator from './Translator.js';
|
|
20
|
+
interface FileItem {
|
|
21
|
+
modName: string;
|
|
22
|
+
filePath: string;
|
|
23
|
+
content: string;
|
|
24
|
+
}
|
|
25
|
+
export interface BootTask<T = unknown> {
|
|
26
|
+
modName: string;
|
|
27
|
+
modInfo: ModInfo;
|
|
28
|
+
modZip: ModZipReader;
|
|
29
|
+
config: T;
|
|
30
|
+
}
|
|
31
|
+
export type BootHandler<T = unknown> = (task: BootTask<T>) => void | Promise<void>;
|
|
32
|
+
export interface AddonServices {
|
|
33
|
+
translator(): Translator;
|
|
34
|
+
gui(): GUIControl;
|
|
35
|
+
credential(): CredentialVault;
|
|
36
|
+
}
|
|
37
|
+
export declare class AddonPlugin extends Hooks<[BootTask], void> {
|
|
38
|
+
readonly sugarcube: SugarCube;
|
|
39
|
+
readonly events: Emitter;
|
|
40
|
+
readonly idb: IndexedDB;
|
|
41
|
+
readonly modules: Modules;
|
|
42
|
+
private readonly services;
|
|
43
|
+
onStart: boolean;
|
|
44
|
+
get resources(): Resources;
|
|
45
|
+
replace(content: string, replacements: Replacement[], label?: string): string;
|
|
46
|
+
readonly info: Catalog<string, {
|
|
47
|
+
addonName: string;
|
|
48
|
+
mod: ModInfo;
|
|
49
|
+
modZip: ModZipReader;
|
|
50
|
+
}>;
|
|
51
|
+
readonly modList: string[];
|
|
52
|
+
readonly jsFiles: FileItem[];
|
|
53
|
+
readonly moduleFiles: FileItem[];
|
|
54
|
+
private readonly disabledMods;
|
|
55
|
+
readonly blockedPassages: Set<string>;
|
|
56
|
+
readonly excludedMods: Set<string>;
|
|
57
|
+
private readonly bootQueue;
|
|
58
|
+
private onSaveLoadTracer;
|
|
59
|
+
private moduleFilesExecuted;
|
|
60
|
+
private scriptFilesExecuted;
|
|
61
|
+
private bootReady;
|
|
62
|
+
constructor(modloader: ModLoader, sugarcube: SugarCube, events: Emitter, idb: IndexedDB, modules: Modules, services: AddonServices);
|
|
63
|
+
get SC2DataManager(): SC2DataManager;
|
|
64
|
+
get modUtils(): ModUtils;
|
|
65
|
+
hook<T>(name: string, handler: BootHandler<T>): boolean;
|
|
66
|
+
canLoadThisMod(bootJson: ModBootJson, _zip: JSZipLikeReadOnlyInterface): Promise<boolean>;
|
|
67
|
+
afterInjectEarlyLoad(): Promise<void>;
|
|
68
|
+
ModLoaderLoadEnd(): Promise<void>;
|
|
69
|
+
afterEarlyLoad(): Promise<void>;
|
|
70
|
+
registerMod(addonName: string, modInfo: ModInfo, modZip: ModZipReader): Promise<void>;
|
|
71
|
+
afterRegisterMod2Addon(): Promise<void>;
|
|
72
|
+
beforePatchModToGame(): Promise<void>;
|
|
73
|
+
PatchModToGame_start(): Promise<void>;
|
|
74
|
+
afterPatchModToGame(): Promise<void>;
|
|
75
|
+
afterPreload(): Promise<void>;
|
|
76
|
+
whenSC2StoryReady(): Promise<void>;
|
|
77
|
+
whenSC2PassageInit(passage: Passage): Promise<void>;
|
|
78
|
+
whenSC2PassageStart(passage: Passage, content: HTMLDivElement): Promise<void>;
|
|
79
|
+
whenSC2PassageRender(passage: Passage, content: HTMLDivElement): Promise<void>;
|
|
80
|
+
whenSC2PassageDisplay(passage: Passage, content: HTMLDivElement): Promise<void>;
|
|
81
|
+
whenSC2PassageEnd(passage: Passage, content: HTMLDivElement): Promise<void>;
|
|
82
|
+
loadCrypt(options: CryptOptions): Promise<boolean>;
|
|
83
|
+
private scriptFiles;
|
|
84
|
+
private loadFiles;
|
|
85
|
+
private executeScripts;
|
|
86
|
+
private process;
|
|
87
|
+
private queue;
|
|
88
|
+
private flush;
|
|
89
|
+
private run;
|
|
90
|
+
private config;
|
|
91
|
+
}
|
|
92
|
+
export default AddonPlugin;
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import Diagnostics from '../infra/Diagnostics.js';
|
|
2
|
+
import type SugarCube from '../host/SugarCube.js';
|
|
3
|
+
import type { DolStateMoment } from '../types/twine-sugarcube.js';
|
|
4
|
+
type CloudSaveSlot = number;
|
|
5
|
+
type PanelAction = 'connectRemote' | 'uploadSlot' | 'downloadSlot' | 'refreshRemoteList' | 'deleteRemoteSlot' | 'exportCurrentCode' | 'exportSlotCode' | 'uploadCode' | 'downloadCode' | 'importCode';
|
|
6
|
+
interface CloudSaveConfig {
|
|
7
|
+
endpoint: string;
|
|
8
|
+
token: string;
|
|
9
|
+
remember?: boolean;
|
|
10
|
+
}
|
|
11
|
+
interface CloudSaveRecord {
|
|
12
|
+
slot: CloudSaveSlot;
|
|
13
|
+
details: SaveDetails | null;
|
|
14
|
+
save: SaveState;
|
|
15
|
+
exportedAt: number;
|
|
16
|
+
gameId?: string;
|
|
17
|
+
}
|
|
18
|
+
interface CloudSaveCodeRecord {
|
|
19
|
+
code: string;
|
|
20
|
+
exportedAt: number;
|
|
21
|
+
gameId?: string;
|
|
22
|
+
}
|
|
23
|
+
interface CloudSaveRemoteItem {
|
|
24
|
+
slot: CloudSaveSlot;
|
|
25
|
+
updatedAt: number;
|
|
26
|
+
payload?: CloudSaveRecord;
|
|
27
|
+
}
|
|
28
|
+
interface CloudSaveRemoteCode {
|
|
29
|
+
updatedAt: number;
|
|
30
|
+
payload?: CloudSaveCodeRecord;
|
|
31
|
+
}
|
|
32
|
+
interface SaveDetails {
|
|
33
|
+
date?: number;
|
|
34
|
+
title?: string;
|
|
35
|
+
idx?: unknown;
|
|
36
|
+
metadata?: {
|
|
37
|
+
saveName?: string;
|
|
38
|
+
[key: string]: unknown;
|
|
39
|
+
};
|
|
40
|
+
[key: string]: unknown;
|
|
41
|
+
}
|
|
42
|
+
interface SaveState {
|
|
43
|
+
history?: DolStateMoment[];
|
|
44
|
+
delta?: unknown;
|
|
45
|
+
[key: string]: unknown;
|
|
46
|
+
}
|
|
47
|
+
interface CloudSaveTools {
|
|
48
|
+
isPlainObject(value: unknown): value is Record<string, unknown>;
|
|
49
|
+
isFinite(value: unknown): boolean;
|
|
50
|
+
isInteger(value: unknown): boolean;
|
|
51
|
+
inRange(value: number, start: number, end: number): boolean;
|
|
52
|
+
}
|
|
53
|
+
export declare class CloudSave {
|
|
54
|
+
readonly sugarcube: SugarCube;
|
|
55
|
+
readonly translate: (key: string) => string;
|
|
56
|
+
readonly tools: CloudSaveTools;
|
|
57
|
+
readonly diagnostics: Diagnostics;
|
|
58
|
+
private static readonly PANEL_STORAGE_KEY;
|
|
59
|
+
private static readonly REQUEST_TIMEOUT;
|
|
60
|
+
private config;
|
|
61
|
+
private mountFrame;
|
|
62
|
+
private busy;
|
|
63
|
+
constructor(sugarcube: SugarCube, translate: (key: string) => string, tools: CloudSaveTools, diagnostics: Diagnostics);
|
|
64
|
+
configure(config: CloudSaveConfig): this;
|
|
65
|
+
/** 验证 Worker 与 Token 是否可用。 */
|
|
66
|
+
connect(): Promise<void>;
|
|
67
|
+
/** 从 DoL 原生 IndexedDB 读取本地存档。 */
|
|
68
|
+
exportSlot(slot: CloudSaveSlot): Promise<CloudSaveRecord>;
|
|
69
|
+
/** 将云端存档写回 DoL 原生 IndexedDB。 */
|
|
70
|
+
importSlot(record: CloudSaveRecord, targetSlot?: CloudSaveSlot): Promise<boolean>;
|
|
71
|
+
/** 上传本地存档。 */
|
|
72
|
+
upload(slot: CloudSaveSlot): Promise<CloudSaveRemoteItem>;
|
|
73
|
+
/** 下载云端存档。 */
|
|
74
|
+
download(slot: CloudSaveSlot, targetSlot?: CloudSaveSlot): Promise<boolean>;
|
|
75
|
+
/** 获取远端存档列表。 */
|
|
76
|
+
listRemote(): Promise<CloudSaveRemoteItem[]>;
|
|
77
|
+
/** 删除远端存档。 */
|
|
78
|
+
deleteRemote(slot: CloudSaveSlot): Promise<void>;
|
|
79
|
+
/** 导出当前 SugarCube 存档码。 */
|
|
80
|
+
exportCode(): string;
|
|
81
|
+
/** 将指定本地槽位转换为 SugarCube 存档码。 */
|
|
82
|
+
exportSlotCode(slot: CloudSaveSlot): Promise<string>;
|
|
83
|
+
/** 导入 SugarCube 存档码。 */
|
|
84
|
+
importCode(code: string): boolean;
|
|
85
|
+
/** 上传 SugarCube 存档码。 */
|
|
86
|
+
uploadCode(code?: string): Promise<CloudSaveRemoteCode>;
|
|
87
|
+
/** 下载 SugarCube 存档码。 */
|
|
88
|
+
downloadCode(): Promise<string>;
|
|
89
|
+
/** 初始化云存档面板。 */
|
|
90
|
+
mountPanel(): void;
|
|
91
|
+
/** Twee 面板动作入口。 */
|
|
92
|
+
panelAction(action: PanelAction, slot?: CloudSaveSlot): Promise<void>;
|
|
93
|
+
private runPanelAction;
|
|
94
|
+
private done;
|
|
95
|
+
private complete;
|
|
96
|
+
private refreshPanel;
|
|
97
|
+
private remoteRow;
|
|
98
|
+
private readPanel;
|
|
99
|
+
private loadPanelConfig;
|
|
100
|
+
private savePanelConfig;
|
|
101
|
+
/** Worker 请求统一入口。 */
|
|
102
|
+
private request;
|
|
103
|
+
/** SugarCube delta 存档还原为完整 history。 */
|
|
104
|
+
private normalizeSave;
|
|
105
|
+
private validateRecord;
|
|
106
|
+
private validateCodeRecord;
|
|
107
|
+
private isSlot;
|
|
108
|
+
private validateSlot;
|
|
109
|
+
private validateGame;
|
|
110
|
+
private invalidResponse;
|
|
111
|
+
private field;
|
|
112
|
+
private setField;
|
|
113
|
+
private panelSlot;
|
|
114
|
+
/** 动态填充本地存档槽位选项。 */
|
|
115
|
+
populateSlotOptions(panel?: HTMLElement | null): Promise<void>;
|
|
116
|
+
private status;
|
|
117
|
+
private get saveDB();
|
|
118
|
+
private get panel();
|
|
119
|
+
private get current();
|
|
120
|
+
private get endpoint();
|
|
121
|
+
private get token();
|
|
122
|
+
}
|
|
123
|
+
export default CloudSave;
|
|
124
|
+
export type { CloudSaveConfig, CloudSaveRecord, CloudSaveRemoteItem, CloudSaveRemoteCode };
|