@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.
Files changed (124) hide show
  1. package/compat/DoLPcompat.d.ts +55 -0
  2. package/compat/ModI18N.d.ts +10 -0
  3. package/compat/Prototype.d.ts +43 -0
  4. package/compat/SimpleFrameworks.d.ts +1 -0
  5. package/constants.d.ts +52 -0
  6. package/core.d.ts +143 -0
  7. package/host/DoL.d.ts +44 -0
  8. package/host/ModLoader.d.ts +37 -0
  9. package/host/Resources.d.ts +15 -0
  10. package/host/SugarCube.d.ts +25 -0
  11. package/index.d.ts +11 -30
  12. package/infra/Catalog.d.ts +14 -0
  13. package/infra/Diagnostics.d.ts +48 -0
  14. package/infra/Emitter.d.ts +18 -0
  15. package/infra/Hooks.d.ts +15 -0
  16. package/infra/Lifecycle.d.ts +24 -0
  17. package/infra/Logger.d.ts +15 -0
  18. package/macros/helpers.d.ts +54 -0
  19. package/macros/index.d.ts +8 -0
  20. package/macros/lanButton.d.ts +2 -0
  21. package/macros/lanLink.d.ts +2 -0
  22. package/macros/lanListbox.d.ts +2 -0
  23. package/macros/lanSwitch.d.ts +3 -0
  24. package/macros/language.d.ts +2 -0
  25. package/macros/macros.d.ts +14 -0
  26. package/macros/maplebirchReplace.d.ts +1 -0
  27. package/macros/radiobuttonsfrom.d.ts +2 -0
  28. package/main.d.ts +22 -0
  29. package/maplebirch.d.ts +11 -4439
  30. package/modules/Audio.d.ts +118 -0
  31. package/modules/AudioAddon/Ambience.d.ts +17 -0
  32. package/modules/AudioAddon/AudioBufferPlayer.d.ts +20 -0
  33. package/modules/AudioAddon/Playlist.d.ts +29 -0
  34. package/modules/AudioAddon/Track.d.ts +15 -0
  35. package/modules/Character.d.ts +39 -0
  36. package/modules/CharacterAddon/Pet.d.ts +61 -0
  37. package/modules/CharacterAddon/Transformation.d.ts +70 -0
  38. package/modules/CharacterAddon/TransformationConfig.d.ts +20 -0
  39. package/modules/Combat.d.ts +17 -0
  40. package/modules/CombatAddon/CombatAction.d.ts +63 -0
  41. package/modules/CombatAddon/CombatTypes.d.ts +4 -0
  42. package/modules/DoL/Config.d.ts +50 -0
  43. package/modules/DoL/Dynamic.d.ts +23 -0
  44. package/modules/DoL/Integration.d.ts +13 -0
  45. package/modules/DoL/Patches/Antiques.d.ts +17 -0
  46. package/modules/DoL/Patches/Bodywriting.d.ts +33 -0
  47. package/modules/DoL/Patches/Fishing.d.ts +32 -0
  48. package/modules/DoL/Patches/Foodstuff.d.ts +64 -0
  49. package/modules/DoL/Patches/Location.d.ts +36 -0
  50. package/modules/DoL/Patches/Tips.d.ts +7 -0
  51. package/modules/DoL/Patches/Traits.d.ts +24 -0
  52. package/modules/DoL/Patches/config.d.ts +2 -0
  53. package/modules/DoL/Patches/index.d.ts +86 -0
  54. package/modules/DoL/Replacements.d.ts +189 -0
  55. package/modules/DoL/ToolCollection.d.ts +17 -0
  56. package/modules/DoL/index.d.ts +1 -0
  57. package/modules/DoL/types.d.ts +20 -0
  58. package/modules/Dynamic.d.ts +10 -0
  59. package/modules/Event.d.ts +16 -0
  60. package/modules/Frameworks/ApplyLinkZone.d.ts +40 -0
  61. package/modules/Frameworks/ConsoleCheat.d.ts +43 -0
  62. package/modules/Frameworks/DoLConsole.d.ts +8 -0
  63. package/modules/Frameworks/DoLMacros.d.ts +6 -0
  64. package/modules/Frameworks/HtmlTools.d.ts +49 -0
  65. package/modules/Frameworks/ImageLoader.d.ts +6 -0
  66. package/modules/Frameworks/OptionEvents.d.ts +15 -0
  67. package/modules/Frameworks/Patch.d.ts +24 -0
  68. package/modules/Frameworks/RandSystem.d.ts +27 -0
  69. package/modules/Frameworks/TextStore.d.ts +7 -0
  70. package/modules/Frameworks/TimeTravelCheat.d.ts +17 -0
  71. package/modules/Frameworks/ZonesManager.d.ts +69 -0
  72. package/modules/Frameworks/macros.d.ts +27 -0
  73. package/modules/Frameworks/migration.d.ts +33 -0
  74. package/modules/NamedNPC.d.ts +164 -0
  75. package/modules/NamedNPCAddon/NPCClothes/Condition.d.ts +3 -0
  76. package/modules/NamedNPCAddon/NPCClothes/NPCOutfitSets.d.ts +38 -0
  77. package/modules/NamedNPCAddon/NPCClothes/NPCSidebarArt.d.ts +25 -0
  78. package/modules/NamedNPCAddon/NPCClothes/NPCSidebarWardrobe.d.ts +60 -0
  79. package/modules/NamedNPCAddon/NPCClothes.d.ts +12 -0
  80. package/modules/NamedNPCAddon/NPCFluids.d.ts +17 -0
  81. package/modules/NamedNPCAddon/NPCPregnancy.d.ts +127 -0
  82. package/modules/NamedNPCAddon/NPCSchedules.d.ts +77 -0
  83. package/modules/NamedNPCAddon/NPCSidebar.d.ts +28 -0
  84. package/modules/NamedNPCAddon/NPCSidebarConfig/base_layers.d.ts +212 -0
  85. package/modules/NamedNPCAddon/NPCSidebarConfig/face_layers.d.ts +220 -0
  86. package/modules/NamedNPCAddon/NPCSidebarConfig/feet_layers.d.ts +274 -0
  87. package/modules/NamedNPCAddon/NPCSidebarConfig/fluids_layers.d.ts +109 -0
  88. package/modules/NamedNPCAddon/NPCSidebarConfig/functions.d.ts +509 -0
  89. package/modules/NamedNPCAddon/NPCSidebarConfig/handheld_layers.d.ts +292 -0
  90. package/modules/NamedNPCAddon/NPCSidebarConfig/hands_layers.d.ts +381 -0
  91. package/modules/NamedNPCAddon/NPCSidebarConfig/head_layers.d.ts +490 -0
  92. package/modules/NamedNPCAddon/NPCSidebarConfig/legs_layers.d.ts +274 -0
  93. package/modules/NamedNPCAddon/NPCSidebarConfig/lower_layers.d.ts +800 -0
  94. package/modules/NamedNPCAddon/NPCSidebarConfig/neck_layers.d.ts +112 -0
  95. package/modules/NamedNPCAddon/NPCSidebarConfig/transformation_layers.d.ts +1672 -0
  96. package/modules/NamedNPCAddon/NPCSidebarConfig/types.d.ts +130 -0
  97. package/modules/NamedNPCAddon/NPCSidebarConfig/upper_layers.d.ts +1516 -0
  98. package/modules/NamedNPCAddon/NPCTransformation.d.ts +51 -0
  99. package/modules/NamedNPCAddon/NPCUtils.d.ts +8 -0
  100. package/modules/State.d.ts +46 -0
  101. package/modules/TimeStateWeather/DateTime.d.ts +4 -0
  102. package/modules/TimeStateWeather/Time.d.ts +14 -0
  103. package/modules/TimeStateWeather/TimeEvents.d.ts +130 -0
  104. package/modules/TimeStateWeather/WeatherEvents.d.ts +56 -0
  105. package/modules/ToolCollection.d.ts +33 -0
  106. package/modules/Variables.d.ts +32 -0
  107. package/package.d.ts +30 -0
  108. package/package.json +5 -7
  109. package/services/AddonPlugin.d.ts +92 -0
  110. package/services/CloudSave.d.ts +124 -0
  111. package/services/CredentialVault.d.ts +80 -0
  112. package/services/GUIControl.d.ts +54 -0
  113. package/services/IndexedDB.d.ts +28 -0
  114. package/services/Modules.d.ts +75 -0
  115. package/services/Translator.d.ts +60 -0
  116. package/types/global.d.ts +123 -0
  117. package/types/twine-sugarcube.d.ts +456 -0
  118. package/utils/array.d.ts +10 -0
  119. package/utils/binary.d.ts +8 -0
  120. package/utils/condition.d.ts +1 -0
  121. package/utils/index.d.ts +22 -0
  122. package/utils/object.d.ts +16 -0
  123. package/utils/selector.d.ts +20 -0
  124. package/utils/string.d.ts +8 -0
package/maplebirch.d.ts CHANGED
@@ -1,4439 +1,11 @@
1
- import { Passage } from '@scml/types/sugarcube-2-ModLoader/SugarCube2';
2
- import { BrowserAPI } from '@scml/sc2-verlnir/src/browser';
3
- import { ConfigAPI } from '@scml/sc2-verlnir/src/config';
4
- import { DebugBarAPI } from '@scml/sc2-verlnir/src/debugbar';
5
- import { DialogAPI } from '@scml/sc2-verlnir/src/dialog';
6
- import { EngineAPI } from '@scml/sc2-verlnir/src/engine';
7
- import { FullscreenAPI } from '@scml/sc2-verlnir/src/fullscreen';
8
- import { HasAPI } from '@scml/sc2-verlnir/src/has';
9
- import { L10nAPI } from '@scml/sc2-verlnir/src/l10n';
10
- import { MacroAPI } from '@scml/sc2-verlnir/src/macro';
11
- import { PassageConstructor } from '@scml/sc2-verlnir/src/passage';
12
- import { SaveAPI } from '@scml/sc2-verlnir/src/save';
13
- import { ScriptingAPI } from '@scml/sc2-verlnir/src/scripting';
14
- import { SettingAPI } from '@scml/sc2-verlnir/src/setting';
15
- import { SimpleAudioAPI } from '@scml/sc2-verlnir/src/simpleaudio';
16
- import { SimpleStoreInstanceAPI } from '@scml/sc2-verlnir/src/simplestore';
17
- import { StoryAPI } from '@scml/sc2-verlnir/src/story';
18
- import { UIAPI } from '@scml/sc2-verlnir/src/ui';
19
- import { UIBarAPI } from '@scml/sc2-verlnir/src/uibar';
20
- import { UtilAPI } from '@scml/sc2-verlnir/src/util';
21
- import { VersionInfo } from '@scml/sc2-verlnir/src/version';
22
- import { VisibilityAPI } from '@scml/sc2-verlnir/src/visibility';
23
- import { WikifierAPI } from '@scml/sc2-verlnir/src/wikifier';
24
- import { SugarCubeStoryVariables, SugarCubeTemporaryVariables } from 'twine-sugarcube/userdata';
25
- import { SC2DataManager } from '@scml/types/sugarcube-2-ModLoader/SC2DataManager';
26
- import { Gui } from '@scml/types/Mod_LoaderGui/Gui';
27
- import * as marked from 'marked';
28
- import jsyaml from 'js-yaml';
29
- import { Howl, HowlOptions } from 'howler';
30
- import { InputFileFormat, JSZipLikeReadOnlyInterface } from '@scml/types/sugarcube-2-ModLoader/JSZipLikeReadOnlyInterface';
31
- import { ModBootJson, ModInfo } from '@scml/types/sugarcube-2-ModLoader/ModLoader';
32
- import { ModZipReader } from '@scml/types/sugarcube-2-ModLoader/ModZipReader';
33
- import { ModUtils } from '@scml/types/sugarcube-2-ModLoader/Utils';
34
- import { MacroContext } from 'twine-sugarcube';
35
- //#endregion
36
- //#region src/utils/object.d.ts
37
- type MergeMode = 'replace' | 'concat' | 'merge';
38
- type MergeFilterFn = (key: string, value: unknown, depth: number, targetValue: unknown) => boolean;
39
- type MergeTuple<T extends readonly unknown[], S extends readonly unknown[]> = S extends readonly [infer Head, ...infer Rest]
40
- ? T extends readonly [infer Previous, ...infer Tail]
41
- ? [Merged<Previous, Head, 'merge'>, ...MergeTuple<Tail, Rest>]
42
- : [...S]
43
- : [...T];
44
- type Merged<T, S, Mode extends MergeMode> = S extends readonly unknown[]
45
- ? T extends readonly unknown[]
46
- ? Mode extends 'replace'
47
- ? [...S]
48
- : Mode extends 'concat'
49
- ? [...T, ...S]
50
- : number extends T['length'] | S['length']
51
- ? (T[number] | S[number])[]
52
- : MergeTuple<T, S>
53
- : [...S]
54
- : S extends Record<string, unknown>
55
- ? Omit<T, keyof S> & { [Key in keyof S]: Key extends keyof T ? Merged<T[Key], S[Key], Mode> : S[Key] }
56
- : S;
57
- type MergeResult<T, Sources extends readonly unknown[], Mode extends MergeMode = 'merge'> = Sources extends readonly [infer Source, ...infer Rest]
58
- ? MergeResult<Merged<T, Source, Mode>, Rest, Mode>
59
- : T;
60
- declare function clone<T>(source: T, deep?: boolean, proto?: boolean, map?: WeakMap<object, unknown>): T;
61
- declare function equal(a: unknown, b: unknown): boolean;
62
- declare function merge<T, Sources extends unknown[]>(target: T, ...sources: Sources): MergeResult<T, Sources>;
63
- declare function append<T, Sources extends unknown[]>(target: T, ...sources: Sources): MergeResult<T, Sources, 'concat'>;
64
- declare function cover<T, Sources extends unknown[]>(target: T, ...sources: Sources): MergeResult<T, Sources, 'replace'>;
65
- declare function mergeFn<T, Sources extends unknown[]>(target: T, filter: MergeFilterFn | null, ...sources: Sources): MergeResult<T, Sources>;
66
- declare function appendFn<T, Sources extends unknown[]>(target: T, filter: MergeFilterFn | null, ...sources: Sources): MergeResult<T, Sources, 'concat'>;
67
- declare function coverFn<T, Sources extends unknown[]>(target: T, filter: MergeFilterFn | null, ...sources: Sources): MergeResult<T, Sources, 'replace'>;
68
- //#endregion
69
- //#region src/utils/array.d.ts
70
- type ContainsMode = 'all' | 'any' | 'none';
71
- type ContainsOptions = {
72
- case?: boolean;
73
- compare?: (item: unknown, value: unknown) => boolean;
74
- deep?: boolean;
75
- };
76
- declare function contains(array: readonly unknown[], value: unknown, mode?: ContainsMode, options?: ContainsOptions): boolean;
77
- declare function randomNumber(min?: number, max?: number, float?: boolean): number;
78
- declare function randomPick<T>(items: readonly T[], weights?: readonly number[] | null, allowNull?: boolean): T | null | undefined;
79
- declare function clamp(value: unknown, min: number, max: number, fallback?: number): number;
80
- //#endregion
81
- //#region src/utils/string.d.ts
82
- type ConvertMode$1 = 'lower' | 'upper' | 'capitalize' | 'title' | 'camel' | 'pascal' | 'snake' | 'kebab' | 'constant';
83
- declare function convert(
84
- value: string,
85
- mode?: ConvertMode$1,
86
- options?: {
87
- delimiter?: string;
88
- acronym?: boolean;
89
- }
90
- ): string;
91
- declare function escapeHtmlText(value: string): string;
92
- declare function widgets(content: string): string;
93
- declare function widgets(...contents: string[]): string[];
94
- //#endregion
95
- //#region src/compat/Prototype.d.ts
96
- declare global {
97
- interface ObjectConstructor {
98
- merge<T extends object = Record<string, unknown>>(...sources: unknown[]): T;
99
- append<T extends object = Record<string, unknown>>(...sources: unknown[]): T;
100
- cover<T extends object = Record<string, unknown>>(...sources: unknown[]): T;
101
- mergefn<T extends object = Record<string, unknown>>(filterFn: MergeFilterFn | null, ...sources: unknown[]): T;
102
- appendfn<T extends object = Record<string, unknown>>(filterFn: MergeFilterFn | null, ...sources: unknown[]): T;
103
- coverfn<T extends object = Record<string, unknown>>(filterFn: MergeFilterFn | null, ...sources: unknown[]): T;
104
- }
105
- interface Array<T> {
106
- contains(value: unknown, mode?: ContainsMode, options?: ContainsOptions): boolean;
107
- either(weights?: number[], allowNull?: boolean): T | null | undefined;
108
- }
109
- interface ArrayConstructor {
110
- merge<T>(...sources: readonly T[][]): T[];
111
- append<T>(...sources: readonly T[][]): T[];
112
- cover<T>(...sources: readonly T[][]): T[];
113
- }
114
- interface ReadonlyArray<T> {
115
- contains(value: unknown, mode?: ContainsMode, options?: ContainsOptions): boolean;
116
- either(weights?: number[], allowNull?: boolean): T | null | undefined;
117
- }
118
- interface String {
119
- contains(
120
- value: string,
121
- options?: {
122
- case?: boolean;
123
- }
124
- ): boolean;
125
- convert(
126
- mode?: ConvertMode$1,
127
- options?: {
128
- delimiter?: string;
129
- acronym?: boolean;
130
- }
131
- ): string;
132
- }
133
- interface Math {
134
- random(): number;
135
- random(max: number): number;
136
- random(min: number, max: number, float?: boolean): number;
137
- clamp(value: unknown, min: number, max: number, fallback?: number): number;
138
- }
139
- }
140
- //#endregion
141
- //#region src/modules/DoL/Patches/Bodywriting.d.ts
142
- interface BodywritingConfig {
143
- writing?: string;
144
- writ_cn?: string;
145
- type?: 'text' | 'object';
146
- arrow?: 0 | 1;
147
- special?: string;
148
- gender?: 'n' | 'f' | 'm' | 'h';
149
- lewd?: 0 | 1;
150
- degree?: number;
151
- featSkip?: boolean;
152
- sprites?: string[];
153
- index?: number;
154
- key?: string;
155
- }
156
- type BodywritingData =
157
- | {
158
- operation: 'add';
159
- config: BodywritingConfig;
160
- }
161
- | {
162
- operation: 'del';
163
- };
164
- type BodywritingItem = BodywritingConfig & {
165
- index: number;
166
- key: string;
167
- };
168
- declare class Bodywriting {
169
- static add(key: string, config: BodywritingConfig): void;
170
- static delete(key: string): void;
171
- static apply(): void;
172
- private static remove;
173
- private static set;
174
- }
175
- //#endregion
176
- //#region src/modules/DoL/Patches/Foodstuff.d.ts
177
- type FoodstuffSeason = 'spring' | 'summer' | 'autumn' | 'winter';
178
- type FoodstuffPlantingBed = 'earth' | 'water';
179
- type FoodstuffStallSize = 'small' | 'large';
180
- interface FoodstuffConfig {
181
- key?: string;
182
- index?: number;
183
- is_fishing_bait?: boolean;
184
- name?: string;
185
- singular?: string;
186
- plural?: string;
187
- icon?: string;
188
- category?: string;
189
- kitchen_item_type_icon?: string;
190
- prop_folder?: string;
191
- ingredient_alternatives?: Partial<Record<'normal' | 'lewd', string[]>>;
192
- tending?: {
193
- planting_bed?: FoodstuffPlantingBed;
194
- growth_days?: number;
195
- featCost?: number;
196
- yield_multiplier?: number;
197
- has_seeds?: boolean;
198
- seed_name?: string;
199
- seasons?: FoodstuffSeason[];
200
- affected_by_tending_skill?: boolean;
201
- tags?: string[];
202
- [key: string]: unknown;
203
- };
204
- shop?: {
205
- sell_price?: number;
206
- available_in?: string[];
207
- bought_in_bulk?: number;
208
- stall_size?: FoodstuffStallSize;
209
- [key: string]: unknown;
210
- };
211
- recipe?: {
212
- recipe_name?: string;
213
- difficulty?: number;
214
- cook_minutes?: number;
215
- servings?: number;
216
- ingredients?: string[];
217
- ingredient_alternatives?: Partial<Record<'normal' | 'lewd', Record<string, string[]>>>;
218
- tags?: string[];
219
- [key: string]: unknown;
220
- };
221
- food?: {
222
- handheld_gift?: boolean;
223
- tags?: string[];
224
- [key: string]: unknown;
225
- };
226
- [key: string]: unknown;
227
- }
228
- type FoodstuffItem = FoodstuffConfig & Required<Pick<FoodstuffConfig, 'index' | 'name' | 'singular' | 'plural' | 'icon' | 'category' | 'kitchen_item_type_icon' | 'prop_folder'>>;
229
- declare class Foodstuff {
230
- static add(key: string, config: FoodstuffConfig): void;
231
- static apply(): void;
232
- static syncState(): void;
233
- static applySetup(): void;
234
- private static set;
235
- private static nextIndex;
236
- private static sort;
237
- private static ensureState;
238
- }
239
- //#endregion
240
- //#region src/modules/DoL/Patches/Location.d.ts
241
- interface LocationConfigOptions {
242
- overwrite?: boolean;
243
- layer?: string;
244
- element?: string;
245
- }
246
- interface LocationElement {
247
- condition?: () => boolean;
248
- image?: string;
249
- frame?: number | (() => number);
250
- animation?: {
251
- frameDelay?: number;
252
- cycleDelay?: number | (() => number);
253
- };
254
- [key: string]: unknown;
255
- }
256
- interface LocationConfig extends LocationElement {
257
- folder?: string;
258
- base?: Record<string, LocationElement> | LocationElement;
259
- emissive?: Record<string, LocationElement> | LocationElement;
260
- reflective?: Record<string, LocationElement> | LocationElement;
261
- layerTop?: Record<string, LocationElement> | LocationElement;
262
- weather?: Record<string, unknown>;
263
- particles?: Record<string, unknown>[];
264
- customMapping?: () => string;
265
- }
266
- interface LocationUpdate {
267
- overwrite: boolean;
268
- config: LocationConfig;
269
- customMapping: (() => string) | null;
270
- }
271
- declare class Location {
272
- static configure(locationId: string, config: LocationConfig, options?: LocationConfigOptions): boolean;
273
- static apply(): void;
274
- }
275
- //#endregion
276
- //#region src/modules/DoL/Patches/Fishing.d.ts
277
- type FishingLocation = 'fishingBeach' | 'fishingPier' | 'fishingCoastPath' | 'fishingForestLake' | 'fishingMoor';
278
- type FishingSeason = 'spring' | 'summer' | 'autumn' | 'winter';
279
- type FishBehavior = 'runner' | 'darter' | 'panicked' | 'anchor' | 'thrasher' | 'slipper';
280
- interface FishConfig {
281
- minSize: number;
282
- maxSize: number;
283
- locations: Partial<Record<FishingLocation, number>>;
284
- icon: string;
285
- preferredSeason?: FishingSeason[];
286
- preferredLocation?: FishingLocation[];
287
- preferredBait?: string;
288
- cookable?: boolean;
289
- requiresBaitFish?: boolean;
290
- isBaitFish?: boolean;
291
- minigame?: {
292
- behavior: FishBehavior;
293
- maxStamina: number;
294
- armFatigueDifficulty: number;
295
- };
296
- foodstuff?: FoodstuffConfig;
297
- }
298
- type FishData = Omit<FishConfig, 'foodstuff'> & Required<Pick<FishConfig, 'preferredSeason' | 'preferredLocation' | 'cookable'>>;
299
- declare class Fishing {
300
- static addFish(key: string, config: FishConfig): boolean;
301
- static addBait(key: string, config: FoodstuffConfig): void;
302
- static configureLocation(location: FishingLocation, weights: Record<string, number>): boolean;
303
- static apply(): void;
304
- }
305
- //#endregion
306
- //#region src/modules/DoL/Patches/Antiques.d.ts
307
- interface AntiqueConfig {
308
- hint: string;
309
- museum: string;
310
- name: string;
311
- cn_name?: string;
312
- journal: string;
313
- journalName?: string;
314
- icon: string;
315
- key?: string;
316
- }
317
- declare class Antiques {
318
- static add(key: string, config: AntiqueConfig): void;
319
- static inject(data: Record<string, AntiqueConfig>): Record<string, AntiqueConfig>;
320
- static syncState(): void;
321
- }
322
- //#endregion
323
- //#region src/modules/DoL/Patches/Traits.d.ts
324
- interface TraitCategory {
325
- title: string;
326
- traits: Trait[];
327
- }
328
- interface Trait {
329
- name: string;
330
- colour: string;
331
- has: boolean;
332
- text: string;
333
- }
334
- interface TraitConfig {
335
- title: string;
336
- name: string | (() => string);
337
- colour: string | (() => string);
338
- has: boolean | (() => boolean);
339
- text: string | (() => string);
340
- }
341
- declare class Traits {
342
- static add(...traits: Partial<TraitConfig>[]): void;
343
- static inject(data: TraitCategory[], translate: (text: string) => string): TraitCategory[];
344
- private static resolve;
345
- }
346
- //#endregion
347
- //#region types/twine-sugarcube.d.ts
348
- declare module 'twine-sugarcube/userdata' {
349
- export interface SugarCubeSetupObject {
350
- bodywriting: Record<string, BodywritingItem>;
351
- bodywriting_namebyindex: (string | undefined)[];
352
- foodstuff: Record<string, FoodstuffItem>;
353
- LocationImages: Record<string, LocationConfig>;
354
- Locations: Record<string, () => string>;
355
- tips: Record<string, string[]>;
356
- tipsList: string[];
357
- fishing?: {
358
- lootTables: {
359
- fish: Record<string, FishData>;
360
- };
361
- };
362
- [x: string]: any;
363
- }
364
- export interface SugarCubeStoryVariables {
365
- foodstuff: Record<
366
- string,
367
- {
368
- amount: number;
369
- [key: string]: unknown;
370
- }
371
- >;
372
- museumAntiques?: {
373
- antiques: Record<string, string>;
374
- maxCount: number;
375
- [key: string]: unknown;
376
- };
377
- [x: string]: any;
378
- }
379
- export interface SugarCubeTemporaryVariables {
380
- traitLists: TraitCategory[];
381
- museumAntiqueText: Record<string, AntiqueConfig>;
382
- [x: string]: any;
383
- }
384
- }
385
- declare module 'twine-sugarcube' {
386
- export interface WikifierAPI {
387
- wikifyEval(
388
- text: string,
389
- passageObj?: {
390
- title: string;
391
- },
392
- passageTitle?: string
393
- ): DocumentFragment;
394
- }
395
- export interface MacroDefinition {
396
- isAsync?: boolean;
397
- isWidget?: boolean;
398
- }
399
- }
400
- interface DolStateMoment {
401
- readonly title: string;
402
- readonly variables: Record<string, unknown>;
403
- }
404
- interface DolStateMetadataAPI {
405
- clear(): void;
406
- delete(key: string): boolean;
407
- entries(): Iterable<[string, unknown]>;
408
- get(key: string): unknown;
409
- has(key: string): boolean;
410
- keys(): Iterable<string>;
411
- set(key: string, value: unknown): void;
412
- readonly size: number;
413
- }
414
- interface DolStatePRNGAPI {
415
- init(seed: string | number): void;
416
- isEnabled(): boolean;
417
- pull: number;
418
- readonly seed: string | number;
419
- str2int(str: string): number;
420
- test(seed: string | number): boolean;
421
- peek(): number;
422
- }
423
- interface DolStateAPI {
424
- reset(): void;
425
- restore(soft?: boolean): boolean;
426
- marshalForSave(): unknown;
427
- unmarshalForSave(stateObj: unknown): void;
428
- readonly expired: string[];
429
- readonly passages: string[];
430
- getSessionState(): unknown;
431
- setSessionState(state: unknown): void;
432
- readonly active: DolStateMoment;
433
- readonly activeIndex: number;
434
- readonly current: DolStateMoment | undefined;
435
- readonly top: DolStateMoment | undefined;
436
- readonly bottom: DolStateMoment | undefined;
437
- readonly history: DolStateMoment[];
438
- readonly passage: string;
439
- readonly variables: Record<string, unknown>;
440
- readonly temporary: Record<string, unknown>;
441
- readonly length: number;
442
- readonly size: number;
443
- readonly turns: number;
444
- create(): DolStateMoment;
445
- goTo(index: number): void;
446
- go(delta: number): void;
447
- deltaEncode(moments: DolStateMoment[]): unknown;
448
- deltaDecode(data: unknown): DolStateMoment[];
449
- readonly prng: DolStatePRNGAPI;
450
- clearTemporary(): void;
451
- pushLocal(): void;
452
- popLocal(): Record<string, unknown> | undefined;
453
- peekLocal(): Record<string, unknown> | undefined;
454
- readonly local: Record<string, unknown>;
455
- clearLocal(): void;
456
- getVar(path: string): unknown;
457
- setVar(path: string, value: unknown): void;
458
- has(offset: number): boolean;
459
- hasPlayed(passage: string): boolean;
460
- index(offset?: number): number;
461
- isEmpty(): boolean;
462
- peek(offset?: number): DolStateMoment | undefined;
463
- random(): number;
464
- readonly metadata: DolStateMetadataAPI;
465
- readonly qc: unknown;
466
- qcadd(fn: (...args: unknown[]) => void): void;
467
- initPRNG(seed: string | number): void;
468
- restart(): void;
469
- backward(): void;
470
- forward(): void;
471
- display(...args: unknown[]): void;
472
- show(...args: unknown[]): void;
473
- play(...args: unknown[]): void;
474
- }
475
- interface DolSaveAPI extends SaveAPI {
476
- serialize(metadata?: unknown): string;
477
- deserialize(saveStr: string): unknown;
478
- }
479
- type WikifierAPI$1 = WikifierAPI & {
480
- wikifyEval(
481
- text: string,
482
- passageObj?: {
483
- title: string;
484
- },
485
- passageTitle?: string
486
- ): DocumentFragment;
487
- };
488
- type SugarCubeUtilAPI = UtilAPI;
489
- interface TwineSugarCube {
490
- Browser: BrowserAPI;
491
- Config: ConfigAPI;
492
- Dialog: DialogAPI;
493
- Engine: EngineAPI;
494
- Fullscreen: FullscreenAPI;
495
- Has: HasAPI;
496
- L10n: L10nAPI;
497
- Macro: MacroAPI;
498
- Passage: PassageConstructor;
499
- Save: DolSaveAPI;
500
- Scripting: ScriptingAPI;
501
- Setting: SettingAPI;
502
- SimpleAudio: SimpleAudioAPI;
503
- State: DolStateAPI;
504
- Story: StoryAPI;
505
- UI: UIAPI;
506
- UIBar: UIBarAPI;
507
- DebugBar: DebugBarAPI;
508
- Util: SugarCubeUtilAPI;
509
- Visibility: VisibilityAPI;
510
- Wikifier: WikifierAPI$1;
511
- session: SimpleStoreInstanceAPI | null;
512
- settings: Record<string, unknown>;
513
- setup: Record<string, unknown>;
514
- storage: SimpleStoreInstanceAPI | null;
515
- version: VersionInfo;
516
- }
517
- declare global {
518
- const V: SugarCubeStoryVariables;
519
- const C: Record<string, any>;
520
- const T: SugarCubeTemporaryVariables;
521
- interface DateTimeData {
522
- year: number;
523
- month: number;
524
- day: number;
525
- hour?: number;
526
- minute?: number;
527
- second?: number;
528
- timeStamp: number;
529
- }
530
- interface DateTimeDiff {
531
- years: number;
532
- months: number;
533
- days: number;
534
- hours: number;
535
- minutes: number;
536
- seconds: number;
537
- }
538
- interface DateTimeConstructor {
539
- readonly MIN_DATE: DateTime;
540
- readonly MAX_DATE: DateTime;
541
- new (timestamp?: number): DateTime;
542
- new (date: DateTimeData): DateTime;
543
- new (year?: number, month?: number, day?: number, hour?: number, minute?: number, second?: number): DateTime;
544
- toSerialYear(year: number): number;
545
- fromSerialYear(serialYear: number): number;
546
- getTotalDaysSinceStart(year: number): number;
547
- isLeapYear(year: number): boolean;
548
- getDaysOfMonthFromYear(year: number): readonly number[];
549
- getDaysOfYear(year: number): number;
550
- }
551
- class DateTime implements DateTimeData {
552
- static readonly MIN_DATE: DateTime;
553
- static readonly MAX_DATE: DateTime;
554
- constructor(timestamp?: number);
555
- constructor(date: DateTimeData);
556
- constructor(year?: number, month?: number, day?: number, hour?: number, minute?: number, second?: number);
557
- year: number;
558
- month: number;
559
- day: number;
560
- hour: number;
561
- minute: number;
562
- second: number;
563
- timeStamp: number;
564
- static toSerialYear(year: number): number;
565
- static fromSerialYear(serialYear: number): number;
566
- static getTotalDaysSinceStart(year: number): number;
567
- static isLeapYear(year: number): boolean;
568
- static getDaysOfMonthFromYear(year: number): readonly number[];
569
- static getDaysOfYear(year: number): number;
570
- toTimestamp(year: number, month: number, day: number, hour: number, minute: number, second: number): this;
571
- fromTimestamp(timestamp: number): this;
572
- compareWith(otherDateTime: DateTime, getSeconds?: boolean): number | DateTimeDiff;
573
- dayDifference(otherDateTime: DateTime): number;
574
- getFirstWeekdayOfMonth(weekDay: number): DateTime;
575
- getNextWeekdayDate(weekDay: number): DateTime;
576
- getPreviousWeekdayDate(weekDay: number): DateTime;
577
- addYears(years: number): this;
578
- addMonths(months: number): this;
579
- addDays(days: number): this;
580
- addHours(hours: number): this;
581
- addMinutes(minutes: number): this;
582
- addSeconds(seconds: number): this;
583
- isLastDayOfMonth(): boolean;
584
- isFirstDayOfMonth(): boolean;
585
- between(startDate: DateTime, endDate: DateTime): boolean;
586
- readonly midnight: DateTime;
587
- readonly dayState: string;
588
- readonly weekDay: number;
589
- readonly weekDayName: string;
590
- readonly monthName: string;
591
- readonly weekEnd: boolean;
592
- readonly lastDayOfMonth: number;
593
- readonly yearDay: number;
594
- readonly moonPhaseFraction: number;
595
- readonly fractionOfDay: number;
596
- readonly fractionOfDayFromNoon: number;
597
- readonly simplifiedDayFactor: number;
598
- readonly fractionOfYear: number;
599
- readonly seasonFactor: number;
600
- }
601
- interface MoonPhase {
602
- start: number;
603
- end: number;
604
- endAlt?: number;
605
- description: string;
606
- }
607
- interface TimeAPI {
608
- readonly date: DateTime;
609
- readonly holidayMonths: number[];
610
- readonly second: number;
611
- readonly minute: number;
612
- readonly hour: number;
613
- readonly weekDay: number;
614
- readonly weekDayName: string;
615
- readonly monthDay: number;
616
- readonly month: number;
617
- readonly monthName: string;
618
- readonly year: number;
619
- readonly days: number;
620
- readonly season: string;
621
- readonly tomorrow: DateTime;
622
- readonly yesterday: DateTime;
623
- readonly schoolTerm: boolean;
624
- readonly schoolDay: boolean;
625
- readonly schoolTime: boolean;
626
- readonly dayState: string;
627
- readonly nextSchoolTermStartDate: DateTime;
628
- readonly nextSchoolTermEndDate: DateTime;
629
- readonly lastDayOfMonth: number;
630
- readonly dayOfYear: number;
631
- readonly secondsSinceMidnight: number;
632
- readonly currentMoonPhase: string;
633
- startDate: DateTime;
634
- monthNames: string[];
635
- daysOfWeek: string[];
636
- moonPhases: Record<string, MoonPhase>;
637
- set(time?: number | DateTime): void;
638
- setDate(date: DateTime): void;
639
- setTime(hour: number, minute?: number): void;
640
- setTimeRelative(hour?: number, minute?: number): void;
641
- pass(seconds: number): any;
642
- timeTravel(date: DateTime): any;
643
- isSchoolTerm(date: DateTime): boolean;
644
- isSchoolDay(date: DateTime): boolean;
645
- isSchoolTime(date: DateTime): boolean;
646
- getDayOfYear(date: DateTime): number;
647
- getSecondsSinceMidnight(date: DateTime): number;
648
- nextMoonPhase(targetPhase: string): DateTime;
649
- previousMoonPhase(targetPhase: string): DateTime;
650
- isBloodMoon(date?: DateTime): boolean;
651
- getSeason(date: DateTime): string;
652
- getNextSchoolTermStartDate(date: DateTime): DateTime;
653
- getNextSchoolTermEndDate(date: DateTime): DateTime;
654
- getNextWeekdayDate(weekDay: number): DateTime;
655
- getPreviousWeekdayDate(weekDay: number): DateTime;
656
- isWeekEnd(): boolean;
657
- hasDatePassed(month: number, day: number): boolean;
658
- betweenHours(from: number, to: number, pass?: number): boolean;
659
- openingHours(minutes?: number): boolean;
660
- readonly oxygenResaturationDuration: number;
661
- }
662
- const Time: TimeAPI;
663
- type CanvasLayerMap = Record<string, LayerConfig>;
664
- type CanvasLayerFilter = string | Record<string, any>;
665
- type CanvasLayerSrc = string | string[] | undefined;
666
- type CanvasLayerMask =
667
- | string
668
- | {
669
- path: string;
670
- offsetX?: number;
671
- offsetY?: number;
672
- convert?: boolean;
673
- };
674
- type CanvasLayerMaskSrc = CanvasLayerMask | CanvasLayerMask[] | undefined;
675
- interface CanvasLayerWorn {
676
- slot: string;
677
- integrity: string | number;
678
- alt?: string;
679
- index: number;
680
- }
681
- type CanvasLayerValueFn<T = any> = (options: any) => T;
682
- interface CanvasModelOptionsData {
683
- filters?: Record<string, any>;
684
- generatedLayers?: CanvasLayerMap;
685
- [key: string]: any;
686
- }
687
- interface LayerConfig {
688
- name?: string;
689
- model?: CanvasModel;
690
- defaultOptions?: LayerConfig;
691
- show?: boolean;
692
- src?: CanvasLayerSrc;
693
- z?: number;
694
- alpha?: number;
695
- maskAlpha?: number;
696
- brightness?: number;
697
- contrast?: number;
698
- blend?: string;
699
- blendMode?: string;
700
- maskBlendMode?: string;
701
- compositeOperation?: string;
702
- desaturate?: boolean;
703
- masksrc?: CanvasLayerMaskSrc;
704
- animation?: any;
705
- filters?: CanvasLayerFilter[];
706
- dx?: number;
707
- dy?: number;
708
- width?: number;
709
- height?: number;
710
- worn?: CanvasLayerWorn;
711
- scale?: boolean | number;
712
- frameDx?: number;
713
- frameDy?: number;
714
- showfn?: CanvasLayerValueFn<boolean>;
715
- srcfn?: CanvasLayerValueFn<CanvasLayerSrc>;
716
- zfn?: CanvasLayerValueFn<number>;
717
- alphafn?: CanvasLayerValueFn<number>;
718
- maskAlphafn?: CanvasLayerValueFn<number>;
719
- brightnessfn?: CanvasLayerValueFn<number>;
720
- contrastfn?: CanvasLayerValueFn<number>;
721
- blendfn?: CanvasLayerValueFn<string | undefined>;
722
- blendModefn?: CanvasLayerValueFn<string | undefined>;
723
- maskBlendModefn?: CanvasLayerValueFn<string | undefined>;
724
- compositeOperationfn?: CanvasLayerValueFn<string | undefined>;
725
- desaturatefn?: CanvasLayerValueFn<boolean>;
726
- masksrcfn?: CanvasLayerValueFn<CanvasLayerMaskSrc>;
727
- animationfn?: CanvasLayerValueFn<any>;
728
- filtersfn?: CanvasLayerValueFn<CanvasLayerFilter[] | undefined>;
729
- dxfn?: CanvasLayerValueFn<number>;
730
- dyfn?: CanvasLayerValueFn<number>;
731
- widthfn?: CanvasLayerValueFn<number>;
732
- heightfn?: CanvasLayerValueFn<number>;
733
- wornfn?: CanvasLayerValueFn<CanvasLayerWorn | undefined>;
734
- scalefn?: CanvasLayerValueFn<boolean | number | undefined>;
735
- [key: string]: any;
736
- }
737
- interface CanvasModelOptions {
738
- name: string;
739
- width: number;
740
- height: number;
741
- layers: CanvasLayerMap;
742
- frames?: number;
743
- metadata?: Record<string, any>;
744
- scale?: boolean | number;
745
- generatedOptions?: (this: CanvasModel) => any[];
746
- defaultOptions?: (this: CanvasModel) => CanvasModelOptionsData;
747
- preprocess?: (this: CanvasModel, options: any) => void;
748
- postprocess?: (this: CanvasModel, options: any) => void;
749
- [key: string]: any;
750
- }
751
- interface CanvasModelConstructor {
752
- new (...args: any[]): CanvasModel;
753
- create(id: string, slot?: string): CanvasModel;
754
- }
755
- class CanvasModel {
756
- static create(id: string, slot?: string): CanvasModel;
757
- constructor(...args: any[]);
758
- name: string;
759
- width: number;
760
- height: number;
761
- frames: number;
762
- metadata: Record<string, any>;
763
- scale: boolean | number;
764
- layers: CanvasLayerMap;
765
- layerList: LayerConfig[];
766
- options: CanvasModelOptionsData;
767
- animated: boolean;
768
- canvas: CanvasRenderingContext2D | null;
769
- listener?: any;
770
- rendererListener?: any;
771
- generatedOptions(): any[];
772
- defaultOptions(): CanvasModelOptionsData;
773
- createCanvas(cssAnimated?: boolean): CanvasRenderingContext2D;
774
- reset(): void;
775
- showLayer(name: string, filters: CanvasLayerFilter[]): void;
776
- hideLayer(name: string): void;
777
- render(canvas: CanvasRenderingContext2D, options?: any, listener?: any): void;
778
- animate(canvas: CanvasRenderingContext2D, options?: any, listener?: any): any;
779
- redraw(): any;
780
- preprocess(options: any): void;
781
- postprocess(options: any): void;
782
- compile(options?: any): LayerConfig[];
783
- }
784
- export interface JQueryAriaClickOptions {
785
- role?: string;
786
- }
787
- }
788
- //#endregion
789
- //#region src/utils/binary.d.ts
790
- declare function textToBytes(value: string): Uint8Array;
791
- declare function jsonToBytes(value: unknown): Uint8Array;
792
- declare function bytesToJson<T = unknown>(bytes: Uint8Array | ArrayBuffer): T;
793
- declare function toArrayBuffer(bytes: Uint8Array): ArrayBuffer;
794
- declare function bytesToBase64(bytes: Uint8Array): string;
795
- declare function base64ToBytes(value: string): Uint8Array;
796
- declare function base64ToArrayBuffer(value: string): ArrayBuffer;
797
- declare function basicAuth(username: string, password: string): string;
798
- //#endregion
799
- //#region src/utils/selector.d.ts
800
- type Comparator = '<' | '<=' | '>' | '>=';
801
- type ResultValue<Input, Result, Meta> = Result | ((input: Input, meta: Meta) => Result);
802
- declare class SelectCase<Input = unknown, Result = unknown, Meta = Record<string, unknown>> {
803
- private readonly cases;
804
- private defaultResult;
805
- private valueType;
806
- private allowMixedTypes;
807
- case(condition: string | number | ((input: Input, meta: Meta) => boolean), result: ResultValue<Input, Result, Meta>): this;
808
- casePredicate(fn: (input: Input, meta: Meta) => boolean, result: ResultValue<Input, Result, Meta>): this;
809
- caseRange(min: number, max: number, result: ResultValue<Input, Result, Meta>): this;
810
- caseIn(values: readonly (string | number)[], result: ResultValue<Input, Result, Meta>): this;
811
- caseIncludes(values: string | readonly string[], result: ResultValue<Input, Result, Meta>): this;
812
- caseRegex(regex: RegExp, result: ResultValue<Input, Result, Meta>): this;
813
- caseCompare(operator: Comparator, value: number, result: ResultValue<Input, Result, Meta>): this;
814
- else(result: ResultValue<Input, Result, Meta>): this;
815
- match(input: Input, meta?: Meta): Result | null;
816
- private resolve;
817
- private validateType;
818
- }
819
- declare namespace index_d_exports {
820
- export {
821
- SelectCase,
822
- append,
823
- appendFn as appendfn,
824
- base64ToArrayBuffer,
825
- base64ToBytes,
826
- basicAuth,
827
- bytesToBase64,
828
- bytesToJson,
829
- clamp,
830
- clone,
831
- contains,
832
- convert,
833
- cover,
834
- coverFn as coverfn,
835
- randomPick as either,
836
- equal,
837
- escapeHtmlText,
838
- jsonToBytes,
839
- merge,
840
- mergeFn as mergefn,
841
- publicUtils,
842
- randomNumber as random,
843
- textToBytes,
844
- toArrayBuffer,
845
- widgets
846
- };
847
- }
848
- declare const publicUtils: Readonly<{
849
- clone: typeof clone;
850
- equal: typeof equal;
851
- merge: typeof merge;
852
- append: typeof append;
853
- cover: typeof cover;
854
- mergefn: typeof mergeFn;
855
- appendfn: typeof appendFn;
856
- coverfn: typeof coverFn;
857
- contains: typeof contains;
858
- random: typeof randomNumber;
859
- either: typeof randomPick;
860
- SelectCase: typeof SelectCase;
861
- convert: typeof convert;
862
- clamp: typeof clamp;
863
- }>;
864
- //#endregion
865
- //#region src/infra/Logger.d.ts
866
- type LogLevel = 'DEBUG' | 'INFO' | 'WARN' | 'ERROR';
867
- export declare class Logger {
868
- readonly modloader?: ModLoader | undefined;
869
- private static readonly LEVELS;
870
- private static readonly CONFIG;
871
- private static readonly FORWARD;
872
- private static level;
873
- constructor(modloader?: ModLoader | undefined);
874
- static toLevel(level: string | number): LogLevel;
875
- log(message: string, levelName?: string | number, ...objects: unknown[]): void;
876
- set LevelName(levelName: string);
877
- get LevelName(): string;
878
- }
879
- //#endregion
880
- //#region src/infra/Diagnostics.d.ts
881
- interface DiagnosticRecord {
882
- at: string;
883
- level: LogLevel;
884
- scope?: string;
885
- message: string;
886
- data?: unknown;
887
- }
888
- interface PatchResult {
889
- kind: 'passage' | 'script' | 'style' | 'source';
890
- target: string;
891
- index: number;
892
- pattern: string;
893
- matches: number;
894
- applied: number;
895
- status: 'applied' | 'unmatched' | 'missing' | 'invalid' | 'mismatch' | 'error';
896
- expected?: number;
897
- error?: string;
898
- }
899
- interface ModConflict {
900
- source: string;
901
- dataSource: string;
902
- passages: string[];
903
- scripts: string[];
904
- styles: string[];
905
- }
906
- type ScopedLog = (message: string, level?: string, ...objects: unknown[]) => void;
907
- export declare class Diagnostics extends Logger {
908
- readonly scope: string;
909
- private static readonly entries;
910
- private static readonly patchResults;
911
- constructor(modloader?: ModLoader, scope?: string);
912
- static message(error: unknown): string;
913
- log(message: string, levelName?: string | number, ...objects: unknown[]): void;
914
- record(message: string, level?: string, scope?: string, ...objects: unknown[]): void;
915
- write(message: string, level?: string, scope?: string, ...objects: unknown[]): void;
916
- scoped(scope: string): ScopedLog;
917
- get history(): readonly DiagnosticRecord[];
918
- get errors(): DiagnosticRecord[];
919
- get patches(): PatchResult[];
920
- recordPatch(result: PatchResult): void;
921
- clearPatches(): void;
922
- get conflicts(): ModConflict[] | undefined;
923
- export(): string;
924
- reset(): void;
925
- }
926
- //#endregion
927
- //#region src/host/Resources.d.ts
928
- type ImageResult = string | false;
929
- declare class Resources {
930
- private readonly manager;
931
- private readonly report;
932
- private readonly cache;
933
- private readonly pending;
934
- constructor(manager: SC2DataManager, report: (path: string, error: unknown) => void);
935
- normalize(path: string): string;
936
- has(path: string): boolean | undefined;
937
- load(path: string): ImageResult | Promise<ImageResult>;
938
- clear(path?: string): void;
939
- private resolve;
940
- }
941
- //#endregion
942
- //#region src/host/ModLoader.d.ts
943
- type Replacement = [RegExp, string];
944
- type TwineAssetMode = 'append' | 'replace' | 'patch';
945
- interface SourcePatch {
946
- src?: string;
947
- srcmatch?: RegExp;
948
- srcmatchgroup?: RegExp;
949
- to?: string;
950
- applyafter?: string;
951
- applybefore?: string;
952
- expected?: number;
953
- }
954
- export declare class ModLoader {
955
- readonly modSC2DataManager: SC2DataManager;
956
- readonly modLoaderGui: Gui;
957
- static getLodash(): ReturnType<ReturnType<SC2DataManager['getModUtils']>['getLodash']>;
958
- readonly diagnostics: Diagnostics;
959
- readonly resources: Resources;
960
- constructor(modSC2DataManager: SC2DataManager, modLoaderGui: Gui);
961
- replace(content: string, replacements: Replacement[], label?: string): string;
962
- defineTwineAsset(type: 'script' | 'style', name: string, content: string | ((current: string) => string), mode?: TwineAssetMode): void;
963
- disabled(modNames: string | string[], reload?: boolean): Promise<boolean>;
964
- get modUtils(): ReturnType<SC2DataManager['getModUtils']>;
965
- get modLoader(): ReturnType<SC2DataManager['getModLoader']>;
966
- get loadController(): ReturnType<SC2DataManager['getModLoadController']>;
967
- get dependence(): ReturnType<SC2DataManager['getDependenceChecker']>;
968
- get conflict(): ReturnType<SC2DataManager['getConflictResult']>;
969
- get lodash(): ReturnType<ReturnType<SC2DataManager['getModUtils']>['getLodash']>;
970
- }
971
- //#endregion
972
- //#region src/host/SugarCube.d.ts
973
- interface SaveObject {
974
- state: {
975
- history: DolStateMoment[];
976
- index?: number;
977
- [key: string]: unknown;
978
- };
979
- [key: string]: unknown;
980
- }
981
- export declare class Save {
982
- private readonly state;
983
- readonly details?: unknown;
984
- readonly saveObj: SaveObject;
985
- constructor(state: DolStateAPI, saveObj: unknown, details?: unknown);
986
- get V(): Record<string, unknown>;
987
- use<Result>(variables: Record<string, unknown>, callback: () => Result): Result;
988
- }
989
- export declare class SugarCube {
990
- runtime: TwineSugarCube | undefined;
991
- passage: Passage;
992
- require(): TwineSugarCube;
993
- save(saveObj: unknown, details?: unknown): Save;
994
- }
995
- //#endregion
996
- //#region src/infra/Emitter.d.ts
997
- type EventCallback<Args extends unknown[] = unknown[]> = (...args: Args) => unknown;
998
- export declare class Emitter extends Diagnostics {
999
- private readonly events;
1000
- private readonly afters;
1001
- private readonly triggering;
1002
- private readonly stickyEvents;
1003
- private readonly stickyArgs;
1004
- private readonly synchronousEvents;
1005
- on<Args extends unknown[]>(eventName: string, callback: EventCallback<Args>, description?: string): boolean;
1006
- off<Args extends unknown[]>(eventName: string, identifier: EventCallback<Args> | string): boolean;
1007
- once<Args extends unknown[]>(eventName: string, callback: EventCallback<Args>, description?: string): boolean;
1008
- trigger(eventName: string, ...args: unknown[]): Promise<void>;
1009
- after<Args extends unknown[]>(eventName: string, callback: EventCallback<Args>): void;
1010
- private pending;
1011
- private callSticky;
1012
- }
1013
- //#endregion
1014
- //#region node_modules/idb/build/entry.d.ts
1015
- type KeyToKeyNoIndex<T> = { [K in keyof T]: string extends K ? never : number extends K ? never : K };
1016
- type ValuesOf<T> = T extends { [K in keyof T]: infer U } ? U : never;
1017
- type KnownKeys<T> = ValuesOf<KeyToKeyNoIndex<T>>;
1018
- type Omit$1<T, K> = Pick<T, Exclude<keyof T, K>>;
1019
- interface DBSchema {
1020
- [s: string]: DBSchemaValue;
1021
- }
1022
- interface IndexKeys {
1023
- [s: string]: IDBValidKey;
1024
- }
1025
- interface DBSchemaValue {
1026
- key: IDBValidKey;
1027
- value: any;
1028
- indexes?: IndexKeys;
1029
- }
1030
- /**
1031
- * Extract known object store names from the DB schema type.
1032
- *
1033
- * @template DBTypes DB schema type, or unknown if the DB isn't typed.
1034
- */
1035
- type StoreNames<DBTypes extends DBSchema | unknown> = DBTypes extends DBSchema ? KnownKeys<DBTypes> : string;
1036
- /**
1037
- * Extract database value types from the DB schema type.
1038
- *
1039
- * @template DBTypes DB schema type, or unknown if the DB isn't typed.
1040
- * @template StoreName Names of the object stores to get the types of.
1041
- */
1042
- type StoreValue<DBTypes extends DBSchema | unknown, StoreName extends StoreNames<DBTypes>> = DBTypes extends DBSchema ? DBTypes[StoreName]['value'] : any;
1043
- /**
1044
- * Extract database key types from the DB schema type.
1045
- *
1046
- * @template DBTypes DB schema type, or unknown if the DB isn't typed.
1047
- * @template StoreName Names of the object stores to get the types of.
1048
- */
1049
- type StoreKey<DBTypes extends DBSchema | unknown, StoreName extends StoreNames<DBTypes>> = DBTypes extends DBSchema ? DBTypes[StoreName]['key'] : IDBValidKey;
1050
- /**
1051
- * Extract the names of indexes in certain object stores from the DB schema type.
1052
- *
1053
- * @template DBTypes DB schema type, or unknown if the DB isn't typed.
1054
- * @template StoreName Names of the object stores to get the types of.
1055
- */
1056
- type IndexNames<DBTypes extends DBSchema | unknown, StoreName extends StoreNames<DBTypes>> = DBTypes extends DBSchema ? keyof DBTypes[StoreName]['indexes'] & string : string;
1057
- /**
1058
- * Extract the types of indexes in certain object stores from the DB schema type.
1059
- *
1060
- * @template DBTypes DB schema type, or unknown if the DB isn't typed.
1061
- * @template StoreName Names of the object stores to get the types of.
1062
- * @template IndexName Names of the indexes to get the types of.
1063
- */
1064
- type IndexKey<DBTypes extends DBSchema | unknown, StoreName extends StoreNames<DBTypes>, IndexName extends IndexNames<DBTypes, StoreName>> = DBTypes extends DBSchema
1065
- ? IndexName extends keyof DBTypes[StoreName]['indexes']
1066
- ? DBTypes[StoreName]['indexes'][IndexName]
1067
- : IDBValidKey
1068
- : IDBValidKey;
1069
- type CursorSource<
1070
- DBTypes extends DBSchema | unknown,
1071
- TxStores extends ArrayLike<StoreNames<DBTypes>>,
1072
- StoreName extends StoreNames<DBTypes>,
1073
- IndexName extends IndexNames<DBTypes, StoreName> | unknown,
1074
- Mode extends IDBTransactionMode = 'readonly'
1075
- > = IndexName extends IndexNames<DBTypes, StoreName> ? IDBPIndex<DBTypes, TxStores, StoreName, IndexName, Mode> : IDBPObjectStore<DBTypes, TxStores, StoreName, Mode>;
1076
- type CursorKey<DBTypes extends DBSchema | unknown, StoreName extends StoreNames<DBTypes>, IndexName extends IndexNames<DBTypes, StoreName> | unknown> =
1077
- IndexName extends IndexNames<DBTypes, StoreName> ? IndexKey<DBTypes, StoreName, IndexName> : StoreKey<DBTypes, StoreName>;
1078
- type IDBPDatabaseExtends = Omit$1<IDBDatabase, 'createObjectStore' | 'deleteObjectStore' | 'transaction' | 'objectStoreNames'>;
1079
- type DOMStringListSymbolIteratorType = DOMStringList extends {
1080
- [Symbol.iterator](): infer R;
1081
- }
1082
- ? R
1083
- : IterableIterator<string>;
1084
- /**
1085
- * A variation of DOMStringList with precise string types
1086
- */
1087
- interface TypedDOMStringList<T extends string> extends DOMStringList {
1088
- contains(string: T): boolean;
1089
- item(index: number): T | null;
1090
- [index: number]: T;
1091
- /**
1092
- * To resolve https://github.com/jakearchibald/idb/issues/327,
1093
- * and for compatibility with TypeScript >= 5.6 with ArrayIterator.
1094
- */
1095
- [Symbol.iterator](): IterableIterator<string> extends DOMStringListSymbolIteratorType ? IterableIterator<T> : DOMStringListSymbolIteratorType & Iterator<T>;
1096
- }
1097
- interface IDBTransactionOptions {
1098
- /**
1099
- * The durability of the transaction.
1100
- *
1101
- * The default is "default". Using "relaxed" provides better performance, but with fewer
1102
- * guarantees. Web applications are encouraged to use "relaxed" for ephemeral data such as caches
1103
- * or quickly changing records, and "strict" in cases where reducing the risk of data loss
1104
- * outweighs the impact to performance and power.
1105
- */
1106
- durability?: 'default' | 'strict' | 'relaxed';
1107
- }
1108
- interface IDBPDatabase<DBTypes extends DBSchema | unknown = unknown> extends IDBPDatabaseExtends {
1109
- /**
1110
- * The names of stores in the database.
1111
- */
1112
- readonly objectStoreNames: TypedDOMStringList<StoreNames<DBTypes>>;
1113
- /**
1114
- * Creates a new object store.
1115
- *
1116
- * Throws a "InvalidStateError" DOMException if not called within an upgrade transaction.
1117
- */
1118
- createObjectStore<Name extends StoreNames<DBTypes>>(name: Name, optionalParameters?: IDBObjectStoreParameters): IDBPObjectStore<DBTypes, ArrayLike<StoreNames<DBTypes>>, Name, 'versionchange'>;
1119
- /**
1120
- * Deletes the object store with the given name.
1121
- *
1122
- * Throws a "InvalidStateError" DOMException if not called within an upgrade transaction.
1123
- */
1124
- deleteObjectStore(name: StoreNames<DBTypes>): void;
1125
- /**
1126
- * Start a new transaction.
1127
- *
1128
- * @param storeNames The object store(s) this transaction needs.
1129
- * @param mode
1130
- * @param options
1131
- */
1132
- transaction<Name extends StoreNames<DBTypes>, Mode extends IDBTransactionMode = 'readonly'>(storeNames: Name, mode?: Mode, options?: IDBTransactionOptions): IDBPTransaction<DBTypes, [Name], Mode>;
1133
- transaction<Names extends ArrayLike<StoreNames<DBTypes>>, Mode extends IDBTransactionMode = 'readonly'>(
1134
- storeNames: Names,
1135
- mode?: Mode,
1136
- options?: IDBTransactionOptions
1137
- ): IDBPTransaction<DBTypes, Names, Mode>;
1138
- /**
1139
- * Add a value to a store.
1140
- *
1141
- * Rejects if an item of a given key already exists in the store.
1142
- *
1143
- * This is a shortcut that creates a transaction for this single action. If you need to do more
1144
- * than one action, create a transaction instead.
1145
- *
1146
- * @param storeName Name of the store.
1147
- * @param value
1148
- * @param key
1149
- */
1150
- add<Name extends StoreNames<DBTypes>>(storeName: Name, value: StoreValue<DBTypes, Name>, key?: StoreKey<DBTypes, Name> | IDBKeyRange): Promise<StoreKey<DBTypes, Name>>;
1151
- /**
1152
- * Deletes all records in a store.
1153
- *
1154
- * This is a shortcut that creates a transaction for this single action. If you need to do more
1155
- * than one action, create a transaction instead.
1156
- *
1157
- * @param storeName Name of the store.
1158
- */
1159
- clear(name: StoreNames<DBTypes>): Promise<void>;
1160
- /**
1161
- * Retrieves the number of records matching the given query in a store.
1162
- *
1163
- * This is a shortcut that creates a transaction for this single action. If you need to do more
1164
- * than one action, create a transaction instead.
1165
- *
1166
- * @param storeName Name of the store.
1167
- * @param key
1168
- */
1169
- count<Name extends StoreNames<DBTypes>>(storeName: Name, key?: StoreKey<DBTypes, Name> | IDBKeyRange | null): Promise<number>;
1170
- /**
1171
- * Retrieves the number of records matching the given query in an index.
1172
- *
1173
- * This is a shortcut that creates a transaction for this single action. If you need to do more
1174
- * than one action, create a transaction instead.
1175
- *
1176
- * @param storeName Name of the store.
1177
- * @param indexName Name of the index within the store.
1178
- * @param key
1179
- */
1180
- countFromIndex<Name extends StoreNames<DBTypes>, IndexName extends IndexNames<DBTypes, Name>>(
1181
- storeName: Name,
1182
- indexName: IndexName,
1183
- key?: IndexKey<DBTypes, Name, IndexName> | IDBKeyRange | null
1184
- ): Promise<number>;
1185
- /**
1186
- * Deletes records in a store matching the given query.
1187
- *
1188
- * This is a shortcut that creates a transaction for this single action. If you need to do more
1189
- * than one action, create a transaction instead.
1190
- *
1191
- * @param storeName Name of the store.
1192
- * @param key
1193
- */
1194
- delete<Name extends StoreNames<DBTypes>>(storeName: Name, key: StoreKey<DBTypes, Name> | IDBKeyRange): Promise<void>;
1195
- /**
1196
- * Retrieves the value of the first record in a store matching the query.
1197
- *
1198
- * Resolves with undefined if no match is found.
1199
- *
1200
- * This is a shortcut that creates a transaction for this single action. If you need to do more
1201
- * than one action, create a transaction instead.
1202
- *
1203
- * @param storeName Name of the store.
1204
- * @param query
1205
- */
1206
- get<Name extends StoreNames<DBTypes>>(storeName: Name, query: StoreKey<DBTypes, Name> | IDBKeyRange): Promise<StoreValue<DBTypes, Name> | undefined>;
1207
- /**
1208
- * Retrieves the value of the first record in an index matching the query.
1209
- *
1210
- * Resolves with undefined if no match is found.
1211
- *
1212
- * This is a shortcut that creates a transaction for this single action. If you need to do more
1213
- * than one action, create a transaction instead.
1214
- *
1215
- * @param storeName Name of the store.
1216
- * @param indexName Name of the index within the store.
1217
- * @param query
1218
- */
1219
- getFromIndex<Name extends StoreNames<DBTypes>, IndexName extends IndexNames<DBTypes, Name>>(
1220
- storeName: Name,
1221
- indexName: IndexName,
1222
- query: IndexKey<DBTypes, Name, IndexName> | IDBKeyRange
1223
- ): Promise<StoreValue<DBTypes, Name> | undefined>;
1224
- /**
1225
- * Retrieves all values in a store that match the query.
1226
- *
1227
- * This is a shortcut that creates a transaction for this single action. If you need to do more
1228
- * than one action, create a transaction instead.
1229
- *
1230
- * @param storeName Name of the store.
1231
- * @param query
1232
- * @param count Maximum number of values to return.
1233
- */
1234
- getAll<Name extends StoreNames<DBTypes>>(storeName: Name, query?: StoreKey<DBTypes, Name> | IDBKeyRange | null, count?: number): Promise<StoreValue<DBTypes, Name>[]>;
1235
- /**
1236
- * Retrieves all values in an index that match the query.
1237
- *
1238
- * This is a shortcut that creates a transaction for this single action. If you need to do more
1239
- * than one action, create a transaction instead.
1240
- *
1241
- * @param storeName Name of the store.
1242
- * @param indexName Name of the index within the store.
1243
- * @param query
1244
- * @param count Maximum number of values to return.
1245
- */
1246
- getAllFromIndex<Name extends StoreNames<DBTypes>, IndexName extends IndexNames<DBTypes, Name>>(
1247
- storeName: Name,
1248
- indexName: IndexName,
1249
- query?: IndexKey<DBTypes, Name, IndexName> | IDBKeyRange | null,
1250
- count?: number
1251
- ): Promise<StoreValue<DBTypes, Name>[]>;
1252
- /**
1253
- * Retrieves the keys of records in a store matching the query.
1254
- *
1255
- * This is a shortcut that creates a transaction for this single action. If you need to do more
1256
- * than one action, create a transaction instead.
1257
- *
1258
- * @param storeName Name of the store.
1259
- * @param query
1260
- * @param count Maximum number of keys to return.
1261
- */
1262
- getAllKeys<Name extends StoreNames<DBTypes>>(storeName: Name, query?: StoreKey<DBTypes, Name> | IDBKeyRange | null, count?: number): Promise<StoreKey<DBTypes, Name>[]>;
1263
- /**
1264
- * Retrieves the keys of records in an index matching the query.
1265
- *
1266
- * This is a shortcut that creates a transaction for this single action. If you need to do more
1267
- * than one action, create a transaction instead.
1268
- *
1269
- * @param storeName Name of the store.
1270
- * @param indexName Name of the index within the store.
1271
- * @param query
1272
- * @param count Maximum number of keys to return.
1273
- */
1274
- getAllKeysFromIndex<Name extends StoreNames<DBTypes>, IndexName extends IndexNames<DBTypes, Name>>(
1275
- storeName: Name,
1276
- indexName: IndexName,
1277
- query?: IndexKey<DBTypes, Name, IndexName> | IDBKeyRange | null,
1278
- count?: number
1279
- ): Promise<StoreKey<DBTypes, Name>[]>;
1280
- /**
1281
- * Retrieves the key of the first record in a store that matches the query.
1282
- *
1283
- * Resolves with undefined if no match is found.
1284
- *
1285
- * This is a shortcut that creates a transaction for this single action. If you need to do more
1286
- * than one action, create a transaction instead.
1287
- *
1288
- * @param storeName Name of the store.
1289
- * @param query
1290
- */
1291
- getKey<Name extends StoreNames<DBTypes>>(storeName: Name, query: StoreKey<DBTypes, Name> | IDBKeyRange): Promise<StoreKey<DBTypes, Name> | undefined>;
1292
- /**
1293
- * Retrieves the key of the first record in an index that matches the query.
1294
- *
1295
- * Resolves with undefined if no match is found.
1296
- *
1297
- * This is a shortcut that creates a transaction for this single action. If you need to do more
1298
- * than one action, create a transaction instead.
1299
- *
1300
- * @param storeName Name of the store.
1301
- * @param indexName Name of the index within the store.
1302
- * @param query
1303
- */
1304
- getKeyFromIndex<Name extends StoreNames<DBTypes>, IndexName extends IndexNames<DBTypes, Name>>(
1305
- storeName: Name,
1306
- indexName: IndexName,
1307
- query: IndexKey<DBTypes, Name, IndexName> | IDBKeyRange
1308
- ): Promise<StoreKey<DBTypes, Name> | undefined>;
1309
- /**
1310
- * Put an item in the database.
1311
- *
1312
- * Replaces any item with the same key.
1313
- *
1314
- * This is a shortcut that creates a transaction for this single action. If you need to do more
1315
- * than one action, create a transaction instead.
1316
- *
1317
- * @param storeName Name of the store.
1318
- * @param value
1319
- * @param key
1320
- */
1321
- put<Name extends StoreNames<DBTypes>>(storeName: Name, value: StoreValue<DBTypes, Name>, key?: StoreKey<DBTypes, Name> | IDBKeyRange): Promise<StoreKey<DBTypes, Name>>;
1322
- }
1323
- type IDBPTransactionExtends = Omit$1<IDBTransaction, 'db' | 'objectStore' | 'objectStoreNames'>;
1324
- interface IDBPTransaction<
1325
- DBTypes extends DBSchema | unknown = unknown,
1326
- TxStores extends ArrayLike<StoreNames<DBTypes>> = ArrayLike<StoreNames<DBTypes>>,
1327
- Mode extends IDBTransactionMode = 'readonly'
1328
- > extends IDBPTransactionExtends {
1329
- /**
1330
- * The transaction's mode.
1331
- */
1332
- readonly mode: Mode;
1333
- /**
1334
- * The names of stores in scope for this transaction.
1335
- */
1336
- readonly objectStoreNames: TypedDOMStringList<TxStores[number]>;
1337
- /**
1338
- * The transaction's connection.
1339
- */
1340
- readonly db: IDBPDatabase<DBTypes>;
1341
- /**
1342
- * Promise for the completion of this transaction.
1343
- */
1344
- readonly done: Promise<void>;
1345
- /**
1346
- * The associated object store, if the transaction covers a single store, otherwise undefined.
1347
- */
1348
- readonly store: TxStores[1] extends undefined ? IDBPObjectStore<DBTypes, TxStores, TxStores[0], Mode> : undefined;
1349
- /**
1350
- * Returns an IDBObjectStore in the transaction's scope.
1351
- */
1352
- objectStore<StoreName extends TxStores[number]>(name: StoreName): IDBPObjectStore<DBTypes, TxStores, StoreName, Mode>;
1353
- }
1354
- type IDBPObjectStoreExtends = Omit$1<
1355
- IDBObjectStore,
1356
- 'transaction' | 'add' | 'clear' | 'count' | 'createIndex' | 'delete' | 'get' | 'getAll' | 'getAllKeys' | 'getKey' | 'index' | 'openCursor' | 'openKeyCursor' | 'put' | 'indexNames'
1357
- >;
1358
- interface IDBPObjectStore<
1359
- DBTypes extends DBSchema | unknown = unknown,
1360
- TxStores extends ArrayLike<StoreNames<DBTypes>> = ArrayLike<StoreNames<DBTypes>>,
1361
- StoreName extends StoreNames<DBTypes> = StoreNames<DBTypes>,
1362
- Mode extends IDBTransactionMode = 'readonly'
1363
- > extends IDBPObjectStoreExtends {
1364
- /**
1365
- * The names of indexes in the store.
1366
- */
1367
- readonly indexNames: TypedDOMStringList<IndexNames<DBTypes, StoreName>>;
1368
- /**
1369
- * The associated transaction.
1370
- */
1371
- readonly transaction: IDBPTransaction<DBTypes, TxStores, Mode>;
1372
- /**
1373
- * Add a value to the store.
1374
- *
1375
- * Rejects if an item of a given key already exists in the store.
1376
- */
1377
- add: Mode extends 'readonly' ? undefined : (value: StoreValue<DBTypes, StoreName>, key?: StoreKey<DBTypes, StoreName> | IDBKeyRange) => Promise<StoreKey<DBTypes, StoreName>>;
1378
- /**
1379
- * Deletes all records in store.
1380
- */
1381
- clear: Mode extends 'readonly' ? undefined : () => Promise<void>;
1382
- /**
1383
- * Retrieves the number of records matching the given query.
1384
- */
1385
- count(key?: StoreKey<DBTypes, StoreName> | IDBKeyRange | null): Promise<number>;
1386
- /**
1387
- * Creates a new index in store.
1388
- *
1389
- * Throws an "InvalidStateError" DOMException if not called within an upgrade transaction.
1390
- */
1391
- createIndex: Mode extends 'versionchange'
1392
- ? <IndexName extends IndexNames<DBTypes, StoreName>>(name: IndexName, keyPath: string | string[], options?: IDBIndexParameters) => IDBPIndex<DBTypes, TxStores, StoreName, IndexName, Mode>
1393
- : undefined;
1394
- /**
1395
- * Deletes records in store matching the given query.
1396
- */
1397
- delete: Mode extends 'readonly' ? undefined : (key: StoreKey<DBTypes, StoreName> | IDBKeyRange) => Promise<void>;
1398
- /**
1399
- * Retrieves the value of the first record matching the query.
1400
- *
1401
- * Resolves with undefined if no match is found.
1402
- */
1403
- get(query: StoreKey<DBTypes, StoreName> | IDBKeyRange): Promise<StoreValue<DBTypes, StoreName> | undefined>;
1404
- /**
1405
- * Retrieves all values that match the query.
1406
- *
1407
- * @param query
1408
- * @param count Maximum number of values to return.
1409
- */
1410
- getAll(query?: StoreKey<DBTypes, StoreName> | IDBKeyRange | null, count?: number): Promise<StoreValue<DBTypes, StoreName>[]>;
1411
- /**
1412
- * Retrieves the keys of records matching the query.
1413
- *
1414
- * @param query
1415
- * @param count Maximum number of keys to return.
1416
- */
1417
- getAllKeys(query?: StoreKey<DBTypes, StoreName> | IDBKeyRange | null, count?: number): Promise<StoreKey<DBTypes, StoreName>[]>;
1418
- /**
1419
- * Retrieves the key of the first record that matches the query.
1420
- *
1421
- * Resolves with undefined if no match is found.
1422
- */
1423
- getKey(query: StoreKey<DBTypes, StoreName> | IDBKeyRange): Promise<StoreKey<DBTypes, StoreName> | undefined>;
1424
- /**
1425
- * Get a query of a given name.
1426
- */
1427
- index<IndexName extends IndexNames<DBTypes, StoreName>>(name: IndexName): IDBPIndex<DBTypes, TxStores, StoreName, IndexName, Mode>;
1428
- /**
1429
- * Opens a cursor over the records matching the query.
1430
- *
1431
- * Resolves with null if no matches are found.
1432
- *
1433
- * @param query If null, all records match.
1434
- * @param direction
1435
- */
1436
- openCursor(query?: StoreKey<DBTypes, StoreName> | IDBKeyRange | null, direction?: IDBCursorDirection): Promise<IDBPCursorWithValue<DBTypes, TxStores, StoreName, unknown, Mode> | null>;
1437
- /**
1438
- * Opens a cursor over the keys matching the query.
1439
- *
1440
- * Resolves with null if no matches are found.
1441
- *
1442
- * @param query If null, all records match.
1443
- * @param direction
1444
- */
1445
- openKeyCursor(query?: StoreKey<DBTypes, StoreName> | IDBKeyRange | null, direction?: IDBCursorDirection): Promise<IDBPCursor<DBTypes, TxStores, StoreName, unknown, Mode> | null>;
1446
- /**
1447
- * Put an item in the store.
1448
- *
1449
- * Replaces any item with the same key.
1450
- */
1451
- put: Mode extends 'readonly' ? undefined : (value: StoreValue<DBTypes, StoreName>, key?: StoreKey<DBTypes, StoreName> | IDBKeyRange) => Promise<StoreKey<DBTypes, StoreName>>;
1452
- /**
1453
- * Iterate over the store.
1454
- */
1455
- [Symbol.asyncIterator](): AsyncIterableIterator<IDBPCursorWithValueIteratorValue<DBTypes, TxStores, StoreName, unknown, Mode>>;
1456
- /**
1457
- * Iterate over the records matching the query.
1458
- *
1459
- * @param query If null, all records match.
1460
- * @param direction
1461
- */
1462
- iterate(
1463
- query?: StoreKey<DBTypes, StoreName> | IDBKeyRange | null,
1464
- direction?: IDBCursorDirection
1465
- ): AsyncIterableIterator<IDBPCursorWithValueIteratorValue<DBTypes, TxStores, StoreName, unknown, Mode>>;
1466
- }
1467
- type IDBPIndexExtends = Omit$1<IDBIndex, 'objectStore' | 'count' | 'get' | 'getAll' | 'getAllKeys' | 'getKey' | 'openCursor' | 'openKeyCursor'>;
1468
- interface IDBPIndex<
1469
- DBTypes extends DBSchema | unknown = unknown,
1470
- TxStores extends ArrayLike<StoreNames<DBTypes>> = ArrayLike<StoreNames<DBTypes>>,
1471
- StoreName extends StoreNames<DBTypes> = StoreNames<DBTypes>,
1472
- IndexName extends IndexNames<DBTypes, StoreName> = IndexNames<DBTypes, StoreName>,
1473
- Mode extends IDBTransactionMode = 'readonly'
1474
- > extends IDBPIndexExtends {
1475
- /**
1476
- * The IDBObjectStore the index belongs to.
1477
- */
1478
- readonly objectStore: IDBPObjectStore<DBTypes, TxStores, StoreName, Mode>;
1479
- /**
1480
- * Retrieves the number of records matching the given query.
1481
- */
1482
- count(key?: IndexKey<DBTypes, StoreName, IndexName> | IDBKeyRange | null): Promise<number>;
1483
- /**
1484
- * Retrieves the value of the first record matching the query.
1485
- *
1486
- * Resolves with undefined if no match is found.
1487
- */
1488
- get(query: IndexKey<DBTypes, StoreName, IndexName> | IDBKeyRange): Promise<StoreValue<DBTypes, StoreName> | undefined>;
1489
- /**
1490
- * Retrieves all values that match the query.
1491
- *
1492
- * @param query
1493
- * @param count Maximum number of values to return.
1494
- */
1495
- getAll(query?: IndexKey<DBTypes, StoreName, IndexName> | IDBKeyRange | null, count?: number): Promise<StoreValue<DBTypes, StoreName>[]>;
1496
- /**
1497
- * Retrieves the keys of records matching the query.
1498
- *
1499
- * @param query
1500
- * @param count Maximum number of keys to return.
1501
- */
1502
- getAllKeys(query?: IndexKey<DBTypes, StoreName, IndexName> | IDBKeyRange | null, count?: number): Promise<StoreKey<DBTypes, StoreName>[]>;
1503
- /**
1504
- * Retrieves the key of the first record that matches the query.
1505
- *
1506
- * Resolves with undefined if no match is found.
1507
- */
1508
- getKey(query: IndexKey<DBTypes, StoreName, IndexName> | IDBKeyRange): Promise<StoreKey<DBTypes, StoreName> | undefined>;
1509
- /**
1510
- * Opens a cursor over the records matching the query.
1511
- *
1512
- * Resolves with null if no matches are found.
1513
- *
1514
- * @param query If null, all records match.
1515
- * @param direction
1516
- */
1517
- openCursor(query?: IndexKey<DBTypes, StoreName, IndexName> | IDBKeyRange | null, direction?: IDBCursorDirection): Promise<IDBPCursorWithValue<DBTypes, TxStores, StoreName, IndexName, Mode> | null>;
1518
- /**
1519
- * Opens a cursor over the keys matching the query.
1520
- *
1521
- * Resolves with null if no matches are found.
1522
- *
1523
- * @param query If null, all records match.
1524
- * @param direction
1525
- */
1526
- openKeyCursor(query?: IndexKey<DBTypes, StoreName, IndexName> | IDBKeyRange | null, direction?: IDBCursorDirection): Promise<IDBPCursor<DBTypes, TxStores, StoreName, IndexName, Mode> | null>;
1527
- /**
1528
- * Iterate over the index.
1529
- */
1530
- [Symbol.asyncIterator](): AsyncIterableIterator<IDBPCursorWithValueIteratorValue<DBTypes, TxStores, StoreName, IndexName, Mode>>;
1531
- /**
1532
- * Iterate over the records matching the query.
1533
- *
1534
- * Resolves with null if no matches are found.
1535
- *
1536
- * @param query If null, all records match.
1537
- * @param direction
1538
- */
1539
- iterate(
1540
- query?: IndexKey<DBTypes, StoreName, IndexName> | IDBKeyRange | null,
1541
- direction?: IDBCursorDirection
1542
- ): AsyncIterableIterator<IDBPCursorWithValueIteratorValue<DBTypes, TxStores, StoreName, IndexName, Mode>>;
1543
- }
1544
- type IDBPCursorExtends = Omit$1<IDBCursor, 'key' | 'primaryKey' | 'source' | 'advance' | 'continue' | 'continuePrimaryKey' | 'delete' | 'update'>;
1545
- interface IDBPCursor<
1546
- DBTypes extends DBSchema | unknown = unknown,
1547
- TxStores extends ArrayLike<StoreNames<DBTypes>> = ArrayLike<StoreNames<DBTypes>>,
1548
- StoreName extends StoreNames<DBTypes> = StoreNames<DBTypes>,
1549
- IndexName extends IndexNames<DBTypes, StoreName> | unknown = unknown,
1550
- Mode extends IDBTransactionMode = 'readonly'
1551
- > extends IDBPCursorExtends {
1552
- /**
1553
- * The key of the current index or object store item.
1554
- */
1555
- readonly key: CursorKey<DBTypes, StoreName, IndexName>;
1556
- /**
1557
- * The key of the current object store item.
1558
- */
1559
- readonly primaryKey: StoreKey<DBTypes, StoreName>;
1560
- /**
1561
- * Returns the IDBObjectStore or IDBIndex the cursor was opened from.
1562
- */
1563
- readonly source: CursorSource<DBTypes, TxStores, StoreName, IndexName, Mode>;
1564
- /**
1565
- * Advances the cursor a given number of records.
1566
- *
1567
- * Resolves to null if no matching records remain.
1568
- */
1569
- advance<T>(this: T, count: number): Promise<T | null>;
1570
- /**
1571
- * Advance the cursor by one record (unless 'key' is provided).
1572
- *
1573
- * Resolves to null if no matching records remain.
1574
- *
1575
- * @param key Advance to the index or object store with a key equal to or greater than this value.
1576
- */
1577
- continue<T>(this: T, key?: CursorKey<DBTypes, StoreName, IndexName>): Promise<T | null>;
1578
- /**
1579
- * Advance the cursor by given keys.
1580
- *
1581
- * The operation is 'and' – both keys must be satisfied.
1582
- *
1583
- * Resolves to null if no matching records remain.
1584
- *
1585
- * @param key Advance to the index or object store with a key equal to or greater than this value.
1586
- * @param primaryKey and where the object store has a key equal to or greater than this value.
1587
- */
1588
- continuePrimaryKey<T>(this: T, key: CursorKey<DBTypes, StoreName, IndexName>, primaryKey: StoreKey<DBTypes, StoreName>): Promise<T | null>;
1589
- /**
1590
- * Delete the current record.
1591
- */
1592
- delete: Mode extends 'readonly' ? undefined : () => Promise<void>;
1593
- /**
1594
- * Updated the current record.
1595
- */
1596
- update: Mode extends 'readonly' ? undefined : (value: StoreValue<DBTypes, StoreName>) => Promise<StoreKey<DBTypes, StoreName>>;
1597
- /**
1598
- * Iterate over the cursor.
1599
- */
1600
- [Symbol.asyncIterator](): AsyncIterableIterator<IDBPCursorIteratorValue<DBTypes, TxStores, StoreName, IndexName, Mode>>;
1601
- }
1602
- type IDBPCursorIteratorValueExtends<
1603
- DBTypes extends DBSchema | unknown = unknown,
1604
- TxStores extends ArrayLike<StoreNames<DBTypes>> = ArrayLike<StoreNames<DBTypes>>,
1605
- StoreName extends StoreNames<DBTypes> = StoreNames<DBTypes>,
1606
- IndexName extends IndexNames<DBTypes, StoreName> | unknown = unknown,
1607
- Mode extends IDBTransactionMode = 'readonly'
1608
- > = Omit$1<IDBPCursor<DBTypes, TxStores, StoreName, IndexName, Mode>, 'advance' | 'continue' | 'continuePrimaryKey'>;
1609
- interface IDBPCursorIteratorValue<
1610
- DBTypes extends DBSchema | unknown = unknown,
1611
- TxStores extends ArrayLike<StoreNames<DBTypes>> = ArrayLike<StoreNames<DBTypes>>,
1612
- StoreName extends StoreNames<DBTypes> = StoreNames<DBTypes>,
1613
- IndexName extends IndexNames<DBTypes, StoreName> | unknown = unknown,
1614
- Mode extends IDBTransactionMode = 'readonly'
1615
- > extends IDBPCursorIteratorValueExtends<DBTypes, TxStores, StoreName, IndexName, Mode> {
1616
- /**
1617
- * Advances the cursor a given number of records.
1618
- */
1619
- advance<T>(this: T, count: number): void;
1620
- /**
1621
- * Advance the cursor by one record (unless 'key' is provided).
1622
- *
1623
- * @param key Advance to the index or object store with a key equal to or greater than this value.
1624
- */
1625
- continue<T>(this: T, key?: CursorKey<DBTypes, StoreName, IndexName>): void;
1626
- /**
1627
- * Advance the cursor by given keys.
1628
- *
1629
- * The operation is 'and' – both keys must be satisfied.
1630
- *
1631
- * @param key Advance to the index or object store with a key equal to or greater than this value.
1632
- * @param primaryKey and where the object store has a key equal to or greater than this value.
1633
- */
1634
- continuePrimaryKey<T>(this: T, key: CursorKey<DBTypes, StoreName, IndexName>, primaryKey: StoreKey<DBTypes, StoreName>): void;
1635
- }
1636
- interface IDBPCursorWithValue<
1637
- DBTypes extends DBSchema | unknown = unknown,
1638
- TxStores extends ArrayLike<StoreNames<DBTypes>> = ArrayLike<StoreNames<DBTypes>>,
1639
- StoreName extends StoreNames<DBTypes> = StoreNames<DBTypes>,
1640
- IndexName extends IndexNames<DBTypes, StoreName> | unknown = unknown,
1641
- Mode extends IDBTransactionMode = 'readonly'
1642
- > extends IDBPCursor<DBTypes, TxStores, StoreName, IndexName, Mode> {
1643
- /**
1644
- * The value of the current item.
1645
- */
1646
- readonly value: StoreValue<DBTypes, StoreName>;
1647
- /**
1648
- * Iterate over the cursor.
1649
- */
1650
- [Symbol.asyncIterator](): AsyncIterableIterator<IDBPCursorWithValueIteratorValue<DBTypes, TxStores, StoreName, IndexName, Mode>>;
1651
- }
1652
- type IDBPCursorWithValueIteratorValueExtends<
1653
- DBTypes extends DBSchema | unknown = unknown,
1654
- TxStores extends ArrayLike<StoreNames<DBTypes>> = ArrayLike<StoreNames<DBTypes>>,
1655
- StoreName extends StoreNames<DBTypes> = StoreNames<DBTypes>,
1656
- IndexName extends IndexNames<DBTypes, StoreName> | unknown = unknown,
1657
- Mode extends IDBTransactionMode = 'readonly'
1658
- > = Omit$1<IDBPCursorWithValue<DBTypes, TxStores, StoreName, IndexName, Mode>, 'advance' | 'continue' | 'continuePrimaryKey'>;
1659
- interface IDBPCursorWithValueIteratorValue<
1660
- DBTypes extends DBSchema | unknown = unknown,
1661
- TxStores extends ArrayLike<StoreNames<DBTypes>> = ArrayLike<StoreNames<DBTypes>>,
1662
- StoreName extends StoreNames<DBTypes> = StoreNames<DBTypes>,
1663
- IndexName extends IndexNames<DBTypes, StoreName> | unknown = unknown,
1664
- Mode extends IDBTransactionMode = 'readonly'
1665
- > extends IDBPCursorWithValueIteratorValueExtends<DBTypes, TxStores, StoreName, IndexName, Mode> {
1666
- /**
1667
- * Advances the cursor a given number of records.
1668
- */
1669
- advance<T>(this: T, count: number): void;
1670
- /**
1671
- * Advance the cursor by one record (unless 'key' is provided).
1672
- *
1673
- * @param key Advance to the index or object store with a key equal to or greater than this value.
1674
- */
1675
- continue<T>(this: T, key?: CursorKey<DBTypes, StoreName, IndexName>): void;
1676
- /**
1677
- * Advance the cursor by given keys.
1678
- *
1679
- * The operation is 'and' – both keys must be satisfied.
1680
- *
1681
- * @param key Advance to the index or object store with a key equal to or greater than this value.
1682
- * @param primaryKey and where the object store has a key equal to or greater than this value.
1683
- */
1684
- continuePrimaryKey<T>(this: T, key: CursorKey<DBTypes, StoreName, IndexName>, primaryKey: StoreKey<DBTypes, StoreName>): void;
1685
- }
1686
- //#endregion
1687
- //#region src/infra/Catalog.d.ts
1688
- export declare class Catalog<Key, Value> extends Diagnostics {
1689
- protected readonly items: Map<Key, Value>;
1690
- constructor(modloader?: ModLoader, entries?: Iterable<readonly [Key, Value]>);
1691
- add(key: Key, value: Value): boolean;
1692
- remove(key: Key): boolean;
1693
- get(key: Key): Value | undefined;
1694
- has(key: Key): boolean;
1695
- list(): Value[];
1696
- clear(): void;
1697
- get entries(): ReadonlyMap<Key, Value>;
1698
- }
1699
- //#endregion
1700
- //#region src/services/IndexedDB.d.ts
1701
- interface StoreIndex {
1702
- name: string;
1703
- keyPath: string | string[];
1704
- options?: IDBIndexParameters;
1705
- }
1706
- interface StoreDefinition {
1707
- options: IDBObjectStoreParameters;
1708
- indexes: StoreIndex[];
1709
- }
1710
- type Transaction<Mode extends IDBTransactionMode = IDBTransactionMode> = IDBPTransaction<unknown, string[], Mode>;
1711
- export declare class IndexedDB extends Catalog<string, StoreDefinition> {
1712
- static readonly DATABASE_NAME = 'maplebirch';
1713
- static readonly DATABASE_VERSION: number;
1714
- private db;
1715
- private opening;
1716
- constructor(modloader?: ModLoader);
1717
- define(name: string, options?: IDBObjectStoreParameters, indexes?: StoreIndex[]): boolean;
1718
- loadLogLevel(): Promise<string | boolean | undefined>;
1719
- init(): Promise<void>;
1720
- private open;
1721
- with<T, Mode extends IDBTransactionMode>(storeNames: string | string[], mode: Mode, callback: (tx: Transaction<Mode>) => T | Promise<T>): Promise<T>;
1722
- clearStore(storeName: string): Promise<void>;
1723
- deleteDatabase(): Promise<boolean>;
1724
- }
1725
- //#endregion
1726
- //#region src/services/CredentialVault.d.ts
1727
- type CredentialPeriod = 'day' | 'month';
1728
- interface AuthConfig {
1729
- key: string;
1730
- subject?: string;
1731
- name?: string;
1732
- publicKey: JsonWebKey | string;
1733
- prompt?: {
1734
- title?: string;
1735
- label?: string;
1736
- placeholder?: string;
1737
- hint?: string;
1738
- };
1739
- date?: {
1740
- period?: CredentialPeriod;
1741
- timezone?: string;
1742
- graceDays?: number;
1743
- };
1744
- }
1745
- interface AuthPayload {
1746
- subject: string;
1747
- key: string;
1748
- date?: string;
1749
- password: string;
1750
- expiresAt?: number;
1751
- }
1752
- interface CryptContext {
1753
- modName: string;
1754
- credential?: string;
1755
- payload?: AuthPayload;
1756
- }
1757
- interface CryptResult {
1758
- data: Awaited<InputFileFormat>;
1759
- auth?: AuthConfig | boolean | void;
1760
- }
1761
- interface CryptOptions {
1762
- modName?: string;
1763
- cache?: {
1764
- subject: string;
1765
- key: string;
1766
- };
1767
- password?: string;
1768
- prompt?: AuthConfig['prompt'] & {
1769
- name?: string;
1770
- };
1771
- lazyOptions?: unknown;
1772
- decrypt(password: string, context: CryptContext): Promise<CryptResult | Awaited<InputFileFormat>>;
1773
- }
1774
- export declare class CredentialVault {
1775
- readonly idb: IndexedDB;
1776
- readonly modloader: ModLoader;
1777
- readonly events: Emitter;
1778
- readonly diagnostics: Diagnostics;
1779
- readonly translate: (key: string) => string;
1780
- private static readonly STORE;
1781
- private static readonly TOKEN_PREFIX;
1782
- private dialogQueue;
1783
- private storageKey;
1784
- constructor(idb: IndexedDB, modloader: ModLoader, events: Emitter, diagnostics: Diagnostics, translate: (key: string) => string);
1785
- loadCrypt(options: CryptOptions): Promise<boolean>;
1786
- private loadCredential;
1787
- private decryptAndLoad;
1788
- private decodeCredential;
1789
- private verify;
1790
- private credentialDate;
1791
- private readStored;
1792
- private storeStored;
1793
- private forget;
1794
- private ensurePromptStyle;
1795
- private promptCredential;
1796
- private ensureStorageKey;
1797
- private loadStorageKey;
1798
- private encryptRecord;
1799
- private decryptRecord;
1800
- }
1801
- //#endregion
1802
- //#region src/services/CloudSave.d.ts
1803
- type CloudSaveSlot = number;
1804
- type PanelAction = 'connectRemote' | 'uploadSlot' | 'downloadSlot' | 'refreshRemoteList' | 'deleteRemoteSlot' | 'exportCurrentCode' | 'exportSlotCode' | 'uploadCode' | 'downloadCode' | 'importCode';
1805
- interface CloudSaveConfig {
1806
- endpoint: string;
1807
- token: string;
1808
- remember?: boolean;
1809
- }
1810
- interface CloudSaveRecord {
1811
- slot: CloudSaveSlot;
1812
- details: SaveDetails | null;
1813
- save: SaveState;
1814
- exportedAt: number;
1815
- gameId?: string;
1816
- }
1817
- interface CloudSaveCodeRecord {
1818
- code: string;
1819
- exportedAt: number;
1820
- gameId?: string;
1821
- }
1822
- interface CloudSaveRemoteItem {
1823
- slot: CloudSaveSlot;
1824
- updatedAt: number;
1825
- payload?: CloudSaveRecord;
1826
- }
1827
- interface CloudSaveRemoteCode {
1828
- updatedAt: number;
1829
- payload?: CloudSaveCodeRecord;
1830
- }
1831
- interface SaveDetails {
1832
- date?: number;
1833
- title?: string;
1834
- idx?: unknown;
1835
- metadata?: {
1836
- saveName?: string;
1837
- [key: string]: unknown;
1838
- };
1839
- [key: string]: unknown;
1840
- }
1841
- interface SaveState {
1842
- history?: DolStateMoment[];
1843
- delta?: unknown;
1844
- [key: string]: unknown;
1845
- }
1846
- interface CloudSaveTools {
1847
- isPlainObject(value: unknown): value is Record<string, unknown>;
1848
- isFinite(value: unknown): boolean;
1849
- isInteger(value: unknown): boolean;
1850
- inRange(value: number, start: number, end: number): boolean;
1851
- }
1852
- export declare class CloudSave {
1853
- readonly sugarcube: SugarCube;
1854
- readonly translate: (key: string) => string;
1855
- readonly tools: CloudSaveTools;
1856
- readonly diagnostics: Diagnostics;
1857
- private static readonly PANEL_STORAGE_KEY;
1858
- private static readonly REQUEST_TIMEOUT;
1859
- private config;
1860
- private mountFrame;
1861
- private busy;
1862
- constructor(sugarcube: SugarCube, translate: (key: string) => string, tools: CloudSaveTools, diagnostics: Diagnostics);
1863
- configure(config: CloudSaveConfig): this;
1864
- /** 验证 Worker 与 Token 是否可用。 */
1865
- connect(): Promise<void>;
1866
- /** 从 DoL 原生 IndexedDB 读取本地存档。 */
1867
- exportSlot(slot: CloudSaveSlot): Promise<CloudSaveRecord>;
1868
- /** 将云端存档写回 DoL 原生 IndexedDB。 */
1869
- importSlot(record: CloudSaveRecord, targetSlot?: CloudSaveSlot): Promise<boolean>;
1870
- /** 上传本地存档。 */
1871
- upload(slot: CloudSaveSlot): Promise<CloudSaveRemoteItem>;
1872
- /** 下载云端存档。 */
1873
- download(slot: CloudSaveSlot, targetSlot?: CloudSaveSlot): Promise<boolean>;
1874
- /** 获取远端存档列表。 */
1875
- listRemote(): Promise<CloudSaveRemoteItem[]>;
1876
- /** 删除远端存档。 */
1877
- deleteRemote(slot: CloudSaveSlot): Promise<void>;
1878
- /** 导出当前 SugarCube 存档码。 */
1879
- exportCode(): string;
1880
- /** 将指定本地槽位转换为 SugarCube 存档码。 */
1881
- exportSlotCode(slot: CloudSaveSlot): Promise<string>;
1882
- /** 导入 SugarCube 存档码。 */
1883
- importCode(code: string): boolean;
1884
- /** 上传 SugarCube 存档码。 */
1885
- uploadCode(code?: string): Promise<CloudSaveRemoteCode>;
1886
- /** 下载 SugarCube 存档码。 */
1887
- downloadCode(): Promise<string>;
1888
- /** 初始化云存档面板。 */
1889
- mountPanel(): void;
1890
- /** Twee 面板动作入口。 */
1891
- panelAction(action: PanelAction, slot?: CloudSaveSlot): Promise<void>;
1892
- private runPanelAction;
1893
- private done;
1894
- private complete;
1895
- private refreshPanel;
1896
- private remoteRow;
1897
- private readPanel;
1898
- private loadPanelConfig;
1899
- private savePanelConfig;
1900
- /** Worker 请求统一入口。 */
1901
- private request;
1902
- /** SugarCube delta 存档还原为完整 history。 */
1903
- private normalizeSave;
1904
- private validateRecord;
1905
- private validateCodeRecord;
1906
- private isSlot;
1907
- private validateSlot;
1908
- private validateGame;
1909
- private invalidResponse;
1910
- private field;
1911
- private setField;
1912
- private panelSlot;
1913
- /** 动态填充本地存档槽位选项。 */
1914
- populateSlotOptions(panel?: HTMLElement | null): Promise<void>;
1915
- private status;
1916
- private get saveDB();
1917
- private get panel();
1918
- private get current();
1919
- private get endpoint();
1920
- private get token();
1921
- }
1922
- //#endregion
1923
- //#region src/constants.d.ts
1924
- type LanguageCode = (typeof Languages)[number];
1925
- declare const Languages: readonly ['EN', 'CN'];
1926
- declare enum ModuleState {
1927
- REGISTERED = 0,
1928
- MOUNTED = 1,
1929
- ERROR = 2,
1930
- EXPOSED = 3,
1931
- DISABLED = 4
1932
- }
1933
- //#endregion
1934
- //#region src/services/Translator.d.ts
1935
- type Translation = Record<string, string>;
1936
- interface ImportProgress {
1937
- type: 'process' | 'complete' | 'error' | 'not_found';
1938
- language: LanguageCode;
1939
- progress?: number;
1940
- current?: number;
1941
- total?: number;
1942
- count?: number;
1943
- error?: Error | null;
1944
- }
1945
- interface TranslationAddon {
1946
- hook<T>(name: string, handler: (task: { modName: string; config: T }) => void | Promise<void>): boolean;
1947
- }
1948
- export declare class Translator extends Catalog<string, Translation> {
1949
- readonly idb: IndexedDB;
1950
- readonly events: Emitter;
1951
- private readonly addon;
1952
- static readonly DEFAULT_LANGS: readonly LanguageCode[];
1953
- static readonly BATCH_SIZE = 500;
1954
- language: LanguageCode;
1955
- private readonly STORE;
1956
- private readonly cache;
1957
- private readonly sourceOrders;
1958
- private preloaded;
1959
- constructor(idb: IndexedDB, modloader: ModLoader, events: Emitter, addon: () => TranslationAddon | undefined);
1960
- private initDB;
1961
- setLanguage(language?: string): Promise<LanguageCode>;
1962
- import(modName: string, languages?: readonly LanguageCode[]): AsyncGenerator<ImportProgress>;
1963
- importFile(modName: string, language: LanguageCode, paths: string | readonly string[]): AsyncGenerator<ImportProgress>;
1964
- t(translationKey: string, space?: boolean): string;
1965
- auto(text: string): string;
1966
- has(translationKey: string): boolean;
1967
- set(translationKey: string, translations: Record<string, unknown>): boolean;
1968
- preload(): Promise<void>;
1969
- clearStorage(): Promise<void>;
1970
- private loadBundledTranslations;
1971
- private writeTranslations;
1972
- private writeBatch;
1973
- private removeOldTranslations;
1974
- private updateSource;
1975
- private activeSources;
1976
- private visibleTranslations;
1977
- private syncTranslation;
1978
- private readFileRecord;
1979
- private writeFileRecord;
1980
- private loadTranslation;
1981
- private parseTranslations;
1982
- private computeHash;
1983
- private getModFile;
1984
- private rebuild;
1985
- }
1986
- //#endregion
1987
- //#region src/infra/Lifecycle.d.ts
1988
- type LifecyclePhase = 'preInit' | 'Init' | 'loadInit' | 'postInit';
1989
- interface LifecycleTarget {
1990
- preInit?(): void | Promise<void>;
1991
- Init?(): void;
1992
- loadInit?(): void;
1993
- postInit?(): void;
1994
- }
1995
- interface LifecycleResult {
1996
- called: boolean;
1997
- ok: boolean;
1998
- error?: unknown;
1999
- }
2000
- export declare class Lifecycle<Key = string, Target extends LifecycleTarget = LifecycleTarget> extends Catalog<Key, Target> {
2001
- preInit(): void | Promise<void>;
2002
- Init(): void;
2003
- loadInit(): void;
2004
- postInit(): void;
2005
- execute(target: Target, phase: 'preInit', scope?: string): Promise<LifecycleResult>;
2006
- execute(target: Target, phase: Exclude<LifecyclePhase, 'preInit'>, scope?: string): LifecycleResult;
2007
- execute(target: Target, phase: LifecyclePhase, scope?: string): LifecycleResult | Promise<LifecycleResult>;
2008
- private failure;
2009
- }
2010
- //#endregion
2011
- //#region src/services/Modules.d.ts
2012
- interface Module {
2013
- log?: ScopedLog;
2014
- dependencies?: string[];
2015
- exposed?: boolean | 'window';
2016
- preInit?(): void | Promise<void>;
2017
- Init?(): void;
2018
- loadInit?(): void;
2019
- postInit?(): void;
2020
- }
2021
- interface ModuleRegistry {
2022
- modules: Map<string, Module>;
2023
- states: Map<string, ModuleState>;
2024
- sources: Map<string, string>;
2025
- dependencies: Map<string, Set<string>>;
2026
- dependents: Map<string, Set<string>>;
2027
- }
2028
- interface DependencyInfo {
2029
- protected: boolean;
2030
- mounted: boolean;
2031
- exposed: boolean;
2032
- lifecycle: boolean;
2033
- dependencies: string[];
2034
- dependents: string[];
2035
- allDependencies: string[];
2036
- state: string;
2037
- source: string;
2038
- }
2039
- type DependencyGraph = Record<string, DependencyInfo>;
2040
- interface ModulesMeta {
2041
- core: readonly string[];
2042
- protected: readonly string[];
2043
- }
2044
- export declare class Modules extends Lifecycle<string, Module> {
2045
- readonly owner: Record<string, unknown>;
2046
- readonly meta: ModulesMeta;
2047
- readonly idb: IndexedDB;
2048
- readonly registry: ModuleRegistry;
2049
- readonly initPhase: {
2050
- preInitCompleted: boolean;
2051
- mainInitCompleted: boolean;
2052
- };
2053
- private readonly sourceStack;
2054
- private readonly preInitialized;
2055
- private disabledNames;
2056
- private preInitTask;
2057
- private late;
2058
- private preRunning;
2059
- private preQueued;
2060
- constructor(owner: Record<string, unknown>, meta: ModulesMeta, idb: IndexedDB, modloader?: ModLoader);
2061
- static traverse(roots: Iterable<string>, links: ReadonlyMap<string, Iterable<string>>, excluded?: ReadonlySet<string>): Set<string>;
2062
- with<T>(source: string, callback: () => T | Promise<T>): Promise<T>;
2063
- register<T extends object>(name: string, module: T & Module, dependencies?: string[]): boolean;
2064
- get(name: string): Module | undefined;
2065
- get dependencyGraph(): DependencyGraph;
2066
- run(phase: 'pre'): Promise<void>;
2067
- run(phase: 'init' | 'load' | 'post'): void;
2068
- private prepare;
2069
- private queuePre;
2070
- private disable;
2071
- private pre;
2072
- private init;
2073
- private phase;
2074
- private ready;
2075
- private flush;
2076
- private topologicalOrder;
2077
- private collect;
2078
- private circular;
2079
- private hasLifecycle;
2080
- }
2081
- //#endregion
2082
- //#region src/services/GUIControl.d.ts
2083
- type ModuleType = 'protected' | 'mounted' | 'exposed' | 'module';
2084
- interface ModuleInfo {
2085
- name: string;
2086
- type: ModuleType;
2087
- source: string;
2088
- protected: boolean;
2089
- lifecycle: boolean;
2090
- dependencies: string[];
2091
- }
2092
- interface ModulesSettings {
2093
- enabled: ModuleInfo[];
2094
- disabled: ModuleInfo[];
2095
- }
2096
- interface ScriptSource {
2097
- jsFiles: Array<{
2098
- modName: string;
2099
- filePath: string;
2100
- }>;
2101
- }
2102
- export declare class GUIControl {
2103
- readonly idb: IndexedDB;
2104
- readonly modloader: ModLoader;
2105
- readonly events: Emitter;
2106
- readonly modules: Modules;
2107
- readonly translator: Translator;
2108
- private readonly addon;
2109
- enabledModules: ModuleInfo[];
2110
- disabledModules: ModuleInfo[];
2111
- enabledScripts: string[];
2112
- disabledScripts: string[];
2113
- private modSubUiAngularJsService;
2114
- constructor(idb: IndexedDB, modloader: ModLoader, events: Emitter, modules: Modules, translator: Translator, addon: () => ScriptSource | undefined);
2115
- private initSettings;
2116
- init(): Promise<void>;
2117
- private loadSettings;
2118
- private modNames;
2119
- private currentModules;
2120
- typeLabel(type: ModuleType): string;
2121
- private modulesStore;
2122
- private scriptsStore;
2123
- saveModules(enabled: ModuleInfo[], disabled: ModuleInfo[]): Promise<void>;
2124
- setModuleStates(states: Readonly<Record<string, boolean>>): Promise<boolean>;
2125
- saveScripts(enabled: string[], disabled: string[]): Promise<void>;
2126
- cascadeModules(action: 'enable' | 'disable', moduleName: string, modules: ModulesSettings): string[];
2127
- private moduleLinks;
2128
- get moduleList(): string;
2129
- private whenCreate;
2130
- }
2131
- //#endregion
2132
- //#region src/infra/Hooks.d.ts
2133
- type HookCallback<Args extends unknown[] = unknown[], Result = unknown> = (...args: Args) => Result | Promise<Result>;
2134
- type HookErrorPolicy = 'throw' | 'continue';
2135
- export declare class Hooks<Args extends unknown[] = unknown[], Result = unknown> extends Catalog<string, HookCallback<Args, Result>> {
2136
- private readonly onError;
2137
- private readonly order;
2138
- constructor(modloader?: ModLoader, onError?: HookErrorPolicy);
2139
- add(name: string, callback: HookCallback<Args, Result>, order?: number): boolean;
2140
- remove(name: string): boolean;
2141
- clear(): void;
2142
- execute(...args: Args): Result[];
2143
- call(name: string, ...args: Args): Promise<Awaited<Result> | undefined>;
2144
- }
2145
- //#endregion
2146
- //#region src/services/AddonPlugin.d.ts
2147
- interface FileItem {
2148
- modName: string;
2149
- filePath: string;
2150
- content: string;
2151
- }
2152
- interface BootTask<T = unknown> {
2153
- modName: string;
2154
- modInfo: ModInfo;
2155
- modZip: ModZipReader;
2156
- config: T;
2157
- }
2158
- type BootHandler<T = unknown> = (task: BootTask<T>) => void | Promise<void>;
2159
- interface AddonServices {
2160
- translator(): Translator;
2161
- gui(): GUIControl;
2162
- credential(): CredentialVault;
2163
- }
2164
- export declare class AddonPlugin extends Hooks<[BootTask], void> {
2165
- readonly sugarcube: SugarCube;
2166
- readonly events: Emitter;
2167
- readonly idb: IndexedDB;
2168
- readonly modules: Modules;
2169
- private readonly services;
2170
- onStart: boolean;
2171
- get resources(): Resources;
2172
- replace(content: string, replacements: Replacement[], label?: string): string;
2173
- readonly info: Catalog<
2174
- string,
2175
- {
2176
- addonName: string;
2177
- mod: ModInfo;
2178
- modZip: ModZipReader;
2179
- }
2180
- >;
2181
- readonly modList: string[];
2182
- readonly jsFiles: FileItem[];
2183
- readonly moduleFiles: FileItem[];
2184
- private readonly disabledMods;
2185
- readonly blockedPassages: Set<string>;
2186
- readonly excludedMods: Set<string>;
2187
- private readonly bootQueue;
2188
- private onSaveLoadTracer;
2189
- private moduleFilesExecuted;
2190
- private scriptFilesExecuted;
2191
- private bootReady;
2192
- constructor(modloader: ModLoader, sugarcube: SugarCube, events: Emitter, idb: IndexedDB, modules: Modules, services: AddonServices);
2193
- get SC2DataManager(): SC2DataManager;
2194
- get modUtils(): ModUtils;
2195
- hook<T>(name: string, handler: BootHandler<T>): boolean;
2196
- canLoadThisMod(bootJson: ModBootJson, _zip: JSZipLikeReadOnlyInterface): Promise<boolean>;
2197
- afterInjectEarlyLoad(): Promise<void>;
2198
- ModLoaderLoadEnd(): Promise<void>;
2199
- afterEarlyLoad(): Promise<void>;
2200
- registerMod(addonName: string, modInfo: ModInfo, modZip: ModZipReader): Promise<void>;
2201
- afterRegisterMod2Addon(): Promise<void>;
2202
- beforePatchModToGame(): Promise<void>;
2203
- PatchModToGame_start(): Promise<void>;
2204
- afterPatchModToGame(): Promise<void>;
2205
- afterPreload(): Promise<void>;
2206
- whenSC2StoryReady(): Promise<void>;
2207
- whenSC2PassageInit(passage: Passage): Promise<void>;
2208
- whenSC2PassageStart(passage: Passage, content: HTMLDivElement): Promise<void>;
2209
- whenSC2PassageRender(passage: Passage, content: HTMLDivElement): Promise<void>;
2210
- whenSC2PassageDisplay(passage: Passage, content: HTMLDivElement): Promise<void>;
2211
- whenSC2PassageEnd(passage: Passage, content: HTMLDivElement): Promise<void>;
2212
- loadCrypt(options: CryptOptions): Promise<boolean>;
2213
- private scriptFiles;
2214
- private loadFiles;
2215
- private executeScripts;
2216
- private process;
2217
- private queue;
2218
- private flush;
2219
- private run;
2220
- private config;
2221
- }
2222
- //#endregion
2223
- //#region src/core.d.ts
2224
- declare global {
2225
- interface MaplebirchExtensions {}
2226
- }
2227
- interface Extensions extends MaplebirchExtensions {}
2228
- interface CoreEvents {
2229
- ':indexedDB': [];
2230
- ':idbReady': [];
2231
- ':import': [];
2232
- ':variable': [];
2233
- ':onSave': [save: Save];
2234
- ':onLoad': [save: Save];
2235
- ':language': [];
2236
- ':storyready': [];
2237
- ':passageinit': [passage: Passage];
2238
- ':passagestart': [passage: Passage, content: HTMLDivElement];
2239
- ':passagerender': [passage: Passage, content: HTMLDivElement];
2240
- ':passagedisplay': [passage: Passage, content: HTMLDivElement];
2241
- ':passageend': [passage: Passage, content: HTMLDivElement];
2242
- ':sugarcube': [];
2243
- ':modLoaderEnd': [];
2244
- }
2245
- interface FrameworkHost {
2246
- readonly sugarcube: SugarCube;
2247
- readonly modLoader: ModLoader;
2248
- }
2249
- interface FrameworkInfra {
2250
- readonly diagnostics: Diagnostics;
2251
- readonly events: Emitter;
2252
- }
2253
- interface FrameworkServices {
2254
- readonly indexedDB: IndexedDB;
2255
- readonly modules: Modules;
2256
- readonly addonPlugin: AddonPlugin;
2257
- readonly translator: Translator;
2258
- readonly credentialVault: CredentialVault;
2259
- readonly cloudSave: CloudSave;
2260
- readonly gui: GUIControl;
2261
- }
2262
- type MaplebirchCore = InstanceType<typeof MaplebirchCore> & Extensions;
2263
- declare const MaplebirchCore: {
2264
- new (
2265
- modSC2DataManager: SC2DataManager,
2266
- modLoaderGui: Gui
2267
- ): {
2268
- readonly meta: {
2269
- name: 'maplebirch Frameworks';
2270
- author: string;
2271
- version: string;
2272
- modifiedby: string;
2273
- updateDate: string;
2274
- Languages: readonly ['EN', 'CN'];
2275
- core: readonly string[];
2276
- protected: readonly string[];
2277
- };
2278
- readonly host: Readonly<FrameworkHost>;
2279
- readonly infra: Readonly<FrameworkInfra>;
2280
- readonly services: Readonly<FrameworkServices>;
2281
- readonly utils: Readonly<{
2282
- clone: typeof clone;
2283
- equal: typeof equal;
2284
- merge: typeof merge;
2285
- append: typeof append;
2286
- cover: typeof cover;
2287
- mergefn: typeof mergeFn;
2288
- appendfn: typeof appendFn;
2289
- coverfn: typeof coverFn;
2290
- contains: typeof contains;
2291
- random: typeof randomNumber;
2292
- either: typeof randomPick;
2293
- SelectCase: typeof SelectCase;
2294
- convert: typeof convert;
2295
- clamp: typeof clamp;
2296
- }>;
2297
- readonly yaml: Readonly<typeof jsyaml>;
2298
- readonly howler: Readonly<{
2299
- Howl: typeof Howl;
2300
- Howler: HowlerGlobal;
2301
- }>;
2302
- log(message: string, level?: string, ...objects: unknown[]): void;
2303
- get export(): string;
2304
- get passage(): Passage;
2305
- set passage(passage: Passage);
2306
- get SugarCube(): TwineSugarCube;
2307
- set SugarCube(runtime: TwineSugarCube);
2308
- get modUtils(): ReturnType<SC2DataManager['getModUtils']>;
2309
- get modLoader(): ReturnType<SC2DataManager['getModLoader']>;
2310
- get lodash(): ModLoader['lodash'];
2311
- get marked(): typeof marked;
2312
- get Language(): string;
2313
- set Language(language: string);
2314
- get LogLevel(): string;
2315
- set LogLevel(level: string);
2316
- get dependencyGraph(): DependencyGraph;
2317
- get modList(): string[];
2318
- on<Name extends keyof CoreEvents>(eventName: Name, callback: EventCallback<CoreEvents[Name]>, description?: string): boolean;
2319
- on<Name extends string, Args extends unknown[]>(eventName: Name extends keyof CoreEvents ? never : Name, callback: EventCallback<Args>, description?: string): boolean;
2320
- off<Args extends unknown[]>(eventName: string, identifier: string | EventCallback<Args>): boolean;
2321
- once<Name extends keyof CoreEvents>(eventName: Name, callback: EventCallback<CoreEvents[Name]>, description?: string): boolean;
2322
- once<Name extends string, Args extends unknown[]>(eventName: Name extends keyof CoreEvents ? never : Name, callback: EventCallback<Args>, description?: string): boolean;
2323
- after<Name extends keyof CoreEvents>(eventName: Name, callback: EventCallback<CoreEvents[Name]>): void;
2324
- after<Name extends string, Args extends unknown[]>(eventName: Name extends keyof CoreEvents ? never : Name, callback: EventCallback<Args>): void;
2325
- trigger<Name extends keyof CoreEvents>(eventName: Name, ...args: CoreEvents[Name]): Promise<void>;
2326
- trigger<Name extends string>(eventName: Name extends keyof CoreEvents ? never : Name, ...args: unknown[]): Promise<void>;
2327
- define<T extends object>(name: string, module: T & Module, dependencies?: string[]): boolean;
2328
- idb(name: string, options?: IDBObjectStoreParameters, indexes?: StoreIndex[]): boolean;
2329
- with<T, Mode extends IDBTransactionMode>(storeNames: string | string[], mode: Mode, callback: (tx: Transaction<Mode>) => T | Promise<T>): Promise<T>;
2330
- t(key: string, space?: boolean): string;
2331
- auto(text: string): string;
2332
- get<K extends keyof Extensions>(name: K): Extensions[K] | undefined;
2333
- get(name: string): Module | undefined;
2334
- };
2335
- meta: {
2336
- name: 'maplebirch Frameworks';
2337
- author: string;
2338
- version: string;
2339
- modifiedby: string;
2340
- updateDate: string;
2341
- Languages: readonly ['EN', 'CN'];
2342
- core: readonly string[];
2343
- protected: readonly string[];
2344
- };
2345
- };
2346
- declare var maplebirch: MaplebirchCore;
2347
- //#endregion
2348
- //#region src/modules/Dynamic.d.ts
2349
- declare class Dynamic extends Lifecycle<string, LifecycleTarget> {
2350
- readonly core: MaplebirchCore;
2351
- readonly log: ScopedLog;
2352
- constructor(core: MaplebirchCore);
2353
- Init(): void;
2354
- }
2355
- //#endregion
2356
- //#region src/modules/Event.d.ts
2357
- interface EventOptions {
2358
- priority?: number;
2359
- once?: boolean;
2360
- }
2361
- declare abstract class Event {
2362
- readonly id: string;
2363
- protected readonly log: ScopedLog;
2364
- readonly priority: number;
2365
- readonly once: boolean;
2366
- protected abstract readonly eventName: string;
2367
- protected constructor(id: string, options: EventOptions, log: ScopedLog);
2368
- protected evaluate<T extends unknown[]>(label: string, callback: (...args: T) => boolean, ...args: T): boolean;
2369
- protected invoke<T extends unknown[]>(label: string, callback: ((...args: T) => void) | undefined, ...args: T): void;
2370
- }
2371
- //#endregion
2372
- //#region src/modules/State.d.ts
2373
- interface StateEventOptions extends EventOptions {
2374
- output?: string;
2375
- action?: () => void;
2376
- cond?: () => boolean;
2377
- forceExit?: boolean | (() => boolean);
2378
- extra?: {
2379
- passage?: string[];
2380
- exclude?: string[];
2381
- match?: RegExp;
2382
- };
2383
- }
2384
- interface StateEventResult {
2385
- hasOutput: boolean;
2386
- remove: boolean;
2387
- }
2388
- declare class StateEvent extends Event {
2389
- readonly type: 'gate' | 'append';
2390
- protected readonly eventName = 'StateEvent';
2391
- output?: string;
2392
- private action?;
2393
- private cond;
2394
- private forceExit;
2395
- private extra;
2396
- constructor(id: string, type: 'gate' | 'append', options: StateEventOptions, log: Dynamic['log']);
2397
- private checkPassage;
2398
- tryRun(passageName?: string): StateEventResult | null;
2399
- private match;
2400
- private runAction;
2401
- shouldForceExit(): boolean;
2402
- }
2403
- export declare class StateManager {
2404
- private readonly manager;
2405
- private readonly stateEvents;
2406
- private readonly log;
2407
- constructor(manager: Dynamic);
2408
- get events(): Readonly<Record<'gate' | 'append', ReadonlyMap<string, StateEvent>>>;
2409
- trigger(type: 'gate' | 'append'): string;
2410
- private processGateEvents;
2411
- private processAppendEvents;
2412
- register(type: 'gate' | 'append', eventId: string, options: StateEventOptions): boolean;
2413
- unregister(type: 'gate' | 'append', eventId: string): boolean;
2414
- Init(): void;
2415
- }
2416
- //#endregion
2417
- //#region src/modules/Frameworks/ConsoleCheat.d.ts
2418
- interface JSExecutionResult {
2419
- success: boolean;
2420
- result?: any;
2421
- error?: string;
2422
- message: string;
2423
- globals?: Record<string, any>;
2424
- }
2425
- interface TwineExecutionResult {
2426
- success: boolean;
2427
- error?: string;
2428
- message: string;
2429
- hasNavigation?: boolean;
2430
- parsedContent?: string;
2431
- }
2432
- interface ExecutionResult {
2433
- success: boolean;
2434
- result?: any;
2435
- error?: string;
2436
- message: string;
2437
- globals?: Record<string, any>;
2438
- hasNavigation?: boolean;
2439
- parsedContent?: string;
2440
- }
2441
- declare class CheatConsole {
2442
- readonly manager: ToolCollection;
2443
- private readonly log;
2444
- private readonly core;
2445
- private readonly globals;
2446
- private readonly jsStatus;
2447
- private readonly twineStatus;
2448
- private readonly twineOutputs;
2449
- constructor(manager: ToolCollection);
2450
- executeJS(code?: string): JSExecutionResult;
2451
- executeTwine(code?: string): TwineExecutionResult;
2452
- execute(type: 'javascript' | 'twine', code?: string): ExecutionResult;
2453
- private runJavaScript;
2454
- private linkTarget;
2455
- private html;
2456
- private format;
2457
- private showStatus;
2458
- }
2459
- //#endregion
2460
- //#region src/modules/Frameworks/migration.d.ts
2461
- interface Step {
2462
- from: string;
2463
- to: string;
2464
- apply: (data: Record<string, unknown>, utils: Utils) => void;
2465
- }
2466
- interface PathRef {
2467
- parent: Record<string, unknown>;
2468
- key: string;
2469
- }
2470
- interface Utils {
2471
- readonly log: ScopedLog;
2472
- path: (obj: Record<string, unknown>, path: string, create?: boolean) => PathRef | null;
2473
- move: (data: Record<string, unknown>, from: string, to: string) => boolean;
2474
- remove: (data: Record<string, unknown>, path: string) => boolean;
2475
- transform: (data: Record<string, unknown>, path: string, fn: (value: unknown) => unknown) => boolean;
2476
- fill: (target: Record<string, unknown>, defaults: Record<string, unknown>, mode?: 'merge' | 'cover') => void;
2477
- }
2478
- declare class migration {
2479
- static readonly log: ScopedLog;
2480
- static create(): migration;
2481
- readonly log: ScopedLog;
2482
- readonly utils: Utils;
2483
- steps: Step[];
2484
- private readonly unsafeKeys;
2485
- constructor();
2486
- add(from: string, to: string, apply: Step['apply']): void;
2487
- run(data: Record<string, unknown>, targetVersion: string): void;
2488
- private path;
2489
- private move;
2490
- private compare;
2491
- }
2492
- //#endregion
2493
- //#region src/modules/Frameworks/RandSystem.d.ts
2494
- interface RandState {
2495
- seed: number | null;
2496
- history: number[];
2497
- index: number;
2498
- }
2499
- declare class randSystem {
2500
- static readonly log: ScopedLog;
2501
- static create(state?: Partial<RandState>): randSystem;
2502
- readonly log: ScopedLog;
2503
- readonly state: RandState;
2504
- private readonly maxHistory;
2505
- private readonly modulus;
2506
- constructor(state?: Partial<RandState>);
2507
- reset(seed?: number): void;
2508
- int(max: number): number;
2509
- percent(): number;
2510
- back(steps?: number): void;
2511
- forward(steps?: number): void;
2512
- get seed(): number | null;
2513
- set seed(value: number);
2514
- get history(): number[];
2515
- get index(): number;
2516
- private next;
2517
- private normalize;
2518
- }
2519
- //#endregion
2520
- //#region src/macros/helpers.d.ts
2521
- declare const CONVERT_MODES: readonly ['lower', 'upper', 'capitalize', 'title', 'camel', 'pascal', 'snake', 'kebab', 'constant'];
2522
- type ConvertMode = (typeof CONVERT_MODES)[number];
2523
- type MacroArgs = unknown[] & {
2524
- full?: string;
2525
- raw?: string;
2526
- };
2527
- interface MacroPayload {
2528
- name: string;
2529
- args: MacroArgs;
2530
- contents?: string;
2531
- }
2532
- interface MacroContext$1 extends Omit<MacroContext, 'args' | 'createShadowWrapper' | 'error' | 'payload'> {
2533
- args: MacroArgs;
2534
- payload?: MacroPayload[] | null;
2535
- error(msg: string): void;
2536
- createShadowWrapper(callback: (...args: never[]) => unknown, doneCallback?: (...args: never[]) => unknown, startCallback?: (...args: never[]) => unknown): (...args: unknown[]) => void;
2537
- passageObj?: {
2538
- title: string;
2539
- };
2540
- lanListboxCache?: Record<
2541
- string,
2542
- {
2543
- options: ListboxOption[];
2544
- selectedIdx: number;
2545
- }
2546
- >;
2547
- }
2548
- interface ListboxOption {
2549
- label: string;
2550
- value: unknown;
2551
- type: 'static' | 'dynamic';
2552
- exprIndex?: number;
2553
- convertMode: ConvertMode | null;
2554
- }
2555
- //#endregion
2556
- //#region src/modules/Frameworks/macros.d.ts
2557
- type MacroFunction<Args extends unknown[] = unknown[]> = (this: MacroContext$1, ...args: Args) => unknown;
2558
- type SimpleMacroFunction<Args extends unknown[]> = (this: MacroContext$1 | null, ...args: Args) => unknown;
2559
- type StatFunction<Args extends unknown[] = unknown[]> = (...args: Args) => DocumentFragment;
2560
- type MacroTags = string[] | null | undefined;
2561
- type SkipArgs = string[] | boolean | null | undefined;
2562
- type MacroPhase = 'sugarcube' | 'storyready';
2563
- declare class defineMacros {
2564
- readonly manager: ToolCollection;
2565
- readonly log: ScopedLog;
2566
- readonly macros: string[];
2567
- readonly statFunctions: Record<string, StatFunction>;
2568
- private readonly definitions;
2569
- private readonly ready;
2570
- constructor(manager: ToolCollection);
2571
- get Macro(): ReturnType<MaplebirchCore['host']['sugarcube']['require']>['Macro'];
2572
- define<Args extends unknown[]>(macroName: string, macroFunction: MacroFunction<Args>, tags?: MacroTags, skipArgs?: SkipArgs, isAsync?: boolean, phase?: MacroPhase): void;
2573
- private installAll;
2574
- private install;
2575
- defineS<Args extends unknown[]>(macroName: string, macroFunction: SimpleMacroFunction<Args>, tags?: MacroTags, skipArgs?: SkipArgs, maintainContext?: boolean, phase?: MacroPhase): void;
2576
- create<Args extends unknown[]>(name: string, fn: StatFunction<Args>): void;
2577
- callStatFunction(name: string, ...args: unknown[]): DocumentFragment;
2578
- }
2579
- //#endregion
2580
- //#region src/modules/Frameworks/HtmlTools.d.ts
2581
- type HtmlRoot = Element | DocumentFragment;
2582
- interface TextContext {
2583
- readonly macro?: MacroContext$1;
2584
- readonly args?: readonly unknown[];
2585
- readonly name?: string;
2586
- readonly widgetName?: string;
2587
- readonly passageTitle?: string;
2588
- readonly [key: string]: unknown;
2589
- }
2590
- type TextContent = string | number | boolean | null | undefined;
2591
- type RawContent = TextContent | Node;
2592
- declare class Builder {
2593
- readonly parent: htmlTools;
2594
- readonly auto: (text: string) => string;
2595
- readonly fragment: HtmlRoot;
2596
- readonly context: TextContext;
2597
- constructor(parent: htmlTools, fragment: HtmlRoot, context?: TextContext);
2598
- text(content: TextContent, style?: string): this;
2599
- line(content?: TextContent, style?: string): this;
2600
- wikify(content: TextContent): this;
2601
- raw(content: RawContent): this;
2602
- box(content: RawContent, style?: string): this;
2603
- }
2604
- declare class htmlTools {
2605
- readonly core: MaplebirchCore;
2606
- readonly log: ScopedLog;
2607
- private uid;
2608
- private readonly store;
2609
- constructor(core: MaplebirchCore);
2610
- get Wikifier(): ReturnType<MaplebirchCore['host']['sugarcube']['require']>['Wikifier'];
2611
- replaceText(oldText: string, newText: string, root?: HtmlRoot | null): number;
2612
- renameLink(target: string | Element, label: string, root?: HtmlRoot | null): boolean;
2613
- replaceLink(target: string | Element, source: string, root?: HtmlRoot | null): boolean;
2614
- private findLink;
2615
- add(key: string, handler: (tools: Builder) => void, id?: string): string | false;
2616
- delete(key: string, idOrHandler?: string | ((tools: Builder) => void)): boolean;
2617
- clear(): void;
2618
- renderFragment(keys: string | string[], context?: TextContext): DocumentFragment;
2619
- renderInto(root: HtmlRoot, keys: string | string[], context?: TextContext): void;
2620
- render(macro: MacroContext$1, keys: string | string[]): void;
2621
- makeTextOutput(options?: { CSV?: boolean }): MacroFunction;
2622
- }
2623
- //#endregion
2624
- //#region src/modules/Frameworks/ZonesManager.d.ts
2625
- interface ZoneWidgetConfig {
2626
- exclude?: string[];
2627
- match?: RegExp;
2628
- passage?: string | string[];
2629
- widget: string;
2630
- type?: 'function';
2631
- func?: () => unknown;
2632
- }
2633
- interface CustomLinkZoneItem {
2634
- position: number;
2635
- widget: string | ZoneWidgetConfig;
2636
- }
2637
- type PatchSet = SourcePatch;
2638
- type ZoneItem = string | ZoneWidgetConfig | CustomLinkZoneItem;
2639
- type ZoneFunction = () => unknown;
2640
- type InitObject =
2641
- | {
2642
- init: ZoneFunction;
2643
- }
2644
- | {
2645
- name: string;
2646
- func: ZoneFunction;
2647
- };
2648
- type PositionedZoneWidgetConfig = Omit<ZoneWidgetConfig, 'widget'> & {
2649
- widget: [number, string];
2650
- };
2651
- type ZoneWidget = string | ZoneFunction | ZoneWidgetConfig | PositionedZoneWidgetConfig | [number, string | ZoneWidgetConfig];
2652
- interface CustomLinkGroup {
2653
- position: number;
2654
- macro: string;
2655
- }
2656
- type InitFunction = string | ZoneFunction | InitObject;
2657
- declare class zonesManager {
2658
- readonly log: ScopedLog;
2659
- readonly core: MaplebirchCore;
2660
- data: Record<string, ZoneItem[]>;
2661
- initFunction: InitFunction[];
2662
- specialWidget: (string | ZoneFunction)[];
2663
- defaultData: Record<string, string | ZoneFunction>;
2664
- locationPassage: Record<string, PatchSet[]>;
2665
- widgetPassage: Record<string, PatchSet[]>;
2666
- widgethtml: string;
2667
- private readonly functions;
2668
- private readonly functionNames;
2669
- private nextFunction;
2670
- constructor(core: MaplebirchCore);
2671
- inject(...databases: Partial<Pick<zonesManager, 'specialWidget' | 'defaultData' | 'locationPassage' | 'widgetPassage'>>[]): void;
2672
- onInit(...widgets: InitFunction[]): void;
2673
- addTo(zone: string, ...widgets: ZoneWidget[]): void;
2674
- storyInit(): void;
2675
- call(name: string): unknown;
2676
- play(zone: 'CustomLinkZone', passageTitle?: string): CustomLinkGroup[];
2677
- play(zone: 'State' | 'BeforeLinkZone' | 'AfterLinkZone', passageTitle?: string): string;
2678
- play(zone: string, passageTitle?: string): string | CustomLinkGroup[];
2679
- patchModToGame(manager: AddonPlugin, type: 'before' | 'after'): void;
2680
- private get widgets();
2681
- private get specials();
2682
- private defaultContent;
2683
- private render;
2684
- private shouldRender;
2685
- private customLinkItem;
2686
- private wrapSpecialPassage;
2687
- private applyContentPatches;
2688
- private patchPassage;
2689
- private widgetInit;
2690
- }
2691
- //#endregion
2692
- //#region src/modules/Frameworks/ApplyLinkZone.d.ts
2693
- interface CustomZone {
2694
- position: number;
2695
- macro: string;
2696
- }
2697
- interface LinkZoneConfig {
2698
- containerId: string;
2699
- linkSelector: string;
2700
- beforeMacro: () => string;
2701
- afterMacro: () => string;
2702
- customMacro: () => CustomZone[];
2703
- zoneStyle: Partial<CSSStyleDeclaration>;
2704
- onBeforeApply?: (() => void) | null;
2705
- onAfterApply?: ((result: boolean, config: LinkZoneConfig) => void) | null;
2706
- debug: boolean;
2707
- }
2708
- declare class LinkZoneManager {
2709
- readonly containerId: string;
2710
- readonly linkSelector: string;
2711
- static readonly apply: (config?: Partial<LinkZoneConfig>) => boolean;
2712
- static readonly add: (config: LinkZoneConfig, customZones: CustomZone[]) => void;
2713
- static readonly defaultConfig: LinkZoneConfig;
2714
- firstLink: Element | null;
2715
- lastLink: Element | null;
2716
- links: Element[];
2717
- breakBeforeFirst: ChildNode | null;
2718
- readonly log: ScopedLog;
2719
- constructor(containerId: string | undefined, linkSelector: string | undefined, logger: ScopedLog);
2720
- detect(): boolean;
2721
- applyZones(config: LinkZoneConfig, customZones: CustomZone[]): boolean;
2722
- private applyBefore;
2723
- private applyAfter;
2724
- private applyCustom;
2725
- private zone;
2726
- private insertAfterBreak;
2727
- private findBreakBefore;
2728
- private isBreak;
2729
- private visible;
2730
- }
2731
- declare const applyLinkZone: typeof LinkZoneManager;
2732
- //#endregion
2733
- //#region src/modules/Frameworks/Patch.d.ts
2734
- type PatchPhase = 'init' | 'state';
2735
- interface PatchDefinition<T extends object = object, Flat extends object = T> {
2736
- api: T;
2737
- legacy?: Flat;
2738
- available?: () => boolean;
2739
- init?: () => void;
2740
- state?: () => void;
2741
- }
2742
- declare class Patch<Extensions extends Record<string, object> = Record<never, never>> {
2743
- private readonly report;
2744
- private readonly definitions;
2745
- constructor(report: (name: string, error: unknown) => void);
2746
- add<T extends object, Flat extends object = T>(name: string, definition: PatchDefinition<T, Flat>): this & Flat;
2747
- get<Name extends keyof Extensions>(name: Name): Extensions[Name] | undefined;
2748
- get<T extends object = object>(name: string): T | undefined;
2749
- require<Name extends keyof Extensions>(name: Name): Extensions[Name];
2750
- require<T extends object = object>(name: string): T;
2751
- has(name: string): boolean;
2752
- names(): string[];
2753
- private available;
2754
- private run;
2755
- apply(phase: PatchPhase): void;
2756
- }
2757
- //#endregion
2758
- //#region src/modules/ToolCollection.d.ts
2759
- type ToolConstructors = {
2760
- console?: new (manager: ToolCollection) => CheatConsole;
2761
- macro?: new (manager: ToolCollection) => defineMacros;
2762
- };
2763
- declare class ToolCollection {
2764
- readonly core: MaplebirchCore;
2765
- readonly log: ScopedLog;
2766
- readonly console: CheatConsole;
2767
- readonly migration: typeof migration;
2768
- readonly rand: typeof randSystem;
2769
- readonly macro: defineMacros;
2770
- readonly text: htmlTools;
2771
- readonly zone: zonesManager;
2772
- readonly link: typeof applyLinkZone;
2773
- readonly patch: Patch;
2774
- constructor(core: MaplebirchCore, constructors?: ToolConstructors);
2775
- onInit(...widgets: InitFunction[]): void;
2776
- define<Args extends unknown[]>(name: string, fn: MacroFunction<Args>, tags?: MacroTags, skipArgs?: SkipArgs, isAsync?: boolean, phase?: MacroPhase): void;
2777
- defineS<Args extends unknown[]>(name: string, fn: SimpleMacroFunction<Args>, tags?: MacroTags, skipArgs?: SkipArgs, maintainContext?: boolean, phase?: MacroPhase): void;
2778
- addTo(zone: string, ...widgets: ZoneWidget[]): void;
2779
- inject(...databases: Parameters<zonesManager['inject']>): void;
2780
- }
2781
- //#endregion
2782
- //#region src/host/DoL.d.ts
2783
- type DoLVariables = typeof V;
2784
- type DoLTemporary = typeof T;
2785
- type DoLCharacters = typeof C;
2786
- type DoLSetup = typeof setup;
2787
- type DoLRenderer = typeof Renderer;
2788
- type DoLGlobalName = 'V' | 'T' | 'C' | 'setup' | 'Renderer' | 'variables' | 'temporary' | 'characters' | 'renderer';
2789
- interface DoLHost {
2790
- readonly V: DoLVariables;
2791
- readonly T: DoLTemporary;
2792
- readonly C: DoLCharacters;
2793
- readonly setup: DoLSetup;
2794
- readonly Renderer: DoLRenderer;
2795
- readonly variables: DoLVariables;
2796
- readonly temporary: DoLTemporary;
2797
- readonly characters: DoLCharacters;
2798
- readonly renderer: DoLRenderer;
2799
- readonly gameVersion: string;
2800
- has(name: DoLGlobalName): boolean;
2801
- }
2802
- interface DoLGlobalScope {
2803
- V?: DoLVariables;
2804
- T?: DoLTemporary;
2805
- C?: DoLCharacters;
2806
- setup?: DoLSetup;
2807
- Renderer?: DoLRenderer;
2808
- }
2809
- export declare class DoL implements DoLHost {
2810
- private readonly scope;
2811
- constructor(scope?: DoLGlobalScope);
2812
- get V(): DoLVariables;
2813
- get T(): DoLTemporary;
2814
- get C(): DoLCharacters;
2815
- get setup(): DoLSetup;
2816
- get Renderer(): DoLRenderer;
2817
- get variables(): DoLVariables;
2818
- get temporary(): DoLTemporary;
2819
- get characters(): DoLCharacters;
2820
- get renderer(): DoLRenderer;
2821
- get gameVersion(): string;
2822
- has(name: DoLGlobalName): boolean;
2823
- private require;
2824
- }
2825
- declare const dol: DoL;
2826
- //#endregion
2827
- //#region src/modules/TimeStateWeather/TimeEvents.d.ts
2828
- type TimeEventType = 'onSec' | 'onMin' | 'onHour' | 'onDay' | 'onWeek' | 'onMonth' | 'onYear' | 'onBefore' | 'onThread' | 'onAfter' | 'onTimeTravel';
2829
- type TimeUnit = 'sec' | 'min' | 'hour' | 'day' | 'week' | 'month' | 'year';
2830
- interface AccumulateConfig {
2831
- unit: TimeUnit;
2832
- target?: number;
2833
- }
2834
- interface TimeData {
2835
- prevDate?: DateTime;
2836
- currentDate?: DateTime;
2837
- changes?: Record<TimeUnit, number>;
2838
- triggeredByAccumulator?: {
2839
- unit: TimeUnit;
2840
- target: number;
2841
- count: number;
2842
- };
2843
- exactPoints?: {
2844
- min: boolean;
2845
- hour: boolean;
2846
- day: boolean;
2847
- week: boolean;
2848
- month: boolean;
2849
- year: boolean;
2850
- };
2851
- passed?: number;
2852
- sec?: number;
2853
- min?: number;
2854
- hour?: number;
2855
- day?: number;
2856
- week?: number;
2857
- month?: number;
2858
- year?: number;
2859
- weekday?: [number, number];
2860
- detailedDiff?: ReturnType<DateTime['compareWith']>;
2861
- timeStamp?: number;
2862
- prev?: DateTime;
2863
- current?: DateTime;
2864
- diffSeconds?: number;
2865
- direction?: 'forward' | 'backward';
2866
- isLeap?: boolean;
2867
- }
2868
- interface TimeEventOptions extends EventOptions {
2869
- action?: (data: TimeData) => void;
2870
- cond?: (data: TimeData) => boolean;
2871
- accumulate?: AccumulateConfig;
2872
- exact?: boolean;
2873
- }
2874
- interface TimeTravelOptions {
2875
- target?: DateTime;
2876
- year?: number;
2877
- month?: number;
2878
- day?: number;
2879
- hour?: number;
2880
- minute?: number;
2881
- second?: number;
2882
- addYears?: number;
2883
- addMonths?: number;
2884
- addDays?: number;
2885
- addHours?: number;
2886
- addMinutes?: number;
2887
- addSeconds?: number;
2888
- }
2889
- declare class TimeEvent extends Event {
2890
- readonly type: TimeEventType;
2891
- protected readonly eventName = 'TimeEvent';
2892
- private action?;
2893
- private cond;
2894
- private exact;
2895
- private accumulate?;
2896
- private accumulated;
2897
- private target;
2898
- constructor(id: string, type: TimeEventType, options: TimeEventOptions, log: DoLDynamic['log']);
2899
- tryRun(data: TimeData, accumulatedOnly?: boolean): boolean;
2900
- private runAccumulated;
2901
- private execute;
2902
- private match;
2903
- private runAction;
2904
- private isExactPoint;
2905
- }
2906
- declare class TimeManager {
2907
- private readonly manager;
2908
- private readonly timeEvents;
2909
- private readonly travelHooks;
2910
- readonly log: DoLDynamic['log'];
2911
- readonly TimeConstants: Readonly<{
2912
- secondsPerDay: 86400;
2913
- secondsPerHour: 3600;
2914
- secondsPerMinute: 60;
2915
- minutesPerHour: 60;
2916
- standardYearMonths: readonly number[];
2917
- leapYearMonths: readonly number[];
2918
- synodicMonth: 29.53058867;
2919
- MIN_DATE: Readonly<{
2920
- timeStamp: -315537984000;
2921
- year: -9999;
2922
- month: 1;
2923
- day: 1;
2924
- hour: 0;
2925
- minute: 0;
2926
- second: 0;
2927
- }>;
2928
- MAX_DATE: Readonly<{
2929
- timeStamp: 315537897599;
2930
- year: 9999;
2931
- month: 12;
2932
- day: 31;
2933
- hour: 23;
2934
- minute: 59;
2935
- second: 59;
2936
- }>;
2937
- }>;
2938
- constructor(manager: DoLDynamic);
2939
- get events(): Readonly<Record<string, ReadonlyMap<string, TimeEvent>>>;
2940
- Init(): void;
2941
- patchDateTime(DateTimeClass: typeof DateTime): typeof DateTime;
2942
- patchTime(TimeObject: typeof Time): void;
2943
- register(type: TimeEventType, eventId: string, options: TimeEventOptions): boolean;
2944
- unregister(type: string, eventId: string): boolean;
2945
- onTravel(name: string, callback: (data: TimeData) => void): boolean;
2946
- timeTravel(options?: TimeTravelOptions): boolean;
2947
- updateTimeLanguage(choice?: 'JournalTime'): string | boolean;
2948
- private handleTimePass;
2949
- private handleTimeTravel;
2950
- private targetDate;
2951
- private timeData;
2952
- private triggerUnitEvents;
2953
- private trigger;
2954
- }
2955
- //#endregion
2956
- //#region src/modules/TimeStateWeather/WeatherEvents.d.ts
2957
- interface WeatherEventOptions extends EventOptions {
2958
- condition?: () => boolean;
2959
- onEnter?: () => void;
2960
- onExit?: () => void;
2961
- [key: string]: any;
2962
- }
2963
- interface WeatherTypeConfig {
2964
- name: string;
2965
- iconType?: string | (() => string);
2966
- value: number;
2967
- probability: {
2968
- summer: number;
2969
- winter: number;
2970
- spring: number;
2971
- autumn: number;
2972
- };
2973
- cloudCount: {
2974
- small: () => number;
2975
- large: () => number;
2976
- };
2977
- tanningModifier: number;
2978
- overcast: number | (() => number);
2979
- precipitationIntensity: number;
2980
- visibility: number;
2981
- }
2982
- interface WeatherException {
2983
- date: () => DateTime;
2984
- duration: number;
2985
- weatherType: string;
2986
- temperature?: number;
2987
- }
2988
- declare class WeatherManager {
2989
- private readonly manager;
2990
- private readonly weatherEvents;
2991
- private readonly activeEvents;
2992
- private readonly Exceptions;
2993
- private readonly WeatherTypes;
2994
- private readonly layerModifications;
2995
- private readonly effectModifications;
2996
- private weatherTriggered;
2997
- private readonly log;
2998
- constructor(manager: DoLDynamic);
2999
- private refresh;
3000
- private checkEvents;
3001
- register(eventId: string, options: WeatherEventOptions): boolean;
3002
- unregister(eventId: string): boolean;
3003
- addLayer(layerName: string, patch: any, mode?: 'concat' | 'replace' | 'merge'): this;
3004
- addEffect(effectName: string, patch: any, mode?: 'concat' | 'replace' | 'merge'): this;
3005
- applyModifications(params: any): any;
3006
- addWeatherData(data: WeatherException | WeatherTypeConfig): boolean | void;
3007
- Init(): void;
3008
- modifyWeatherJavaScript(manager: AddonPlugin): void;
3009
- }
3010
- //#endregion
3011
- //#region src/modules/DoL/Dynamic.d.ts
3012
- declare class DoLDynamic extends Dynamic {
3013
- get State(): StateManager;
3014
- get Time(): TimeManager;
3015
- get Weather(): WeatherManager;
3016
- regStateEvent(type: 'gate' | 'append', eventId: string, options: StateEventOptions): boolean;
3017
- delStateEvent(type: 'gate' | 'append', eventId: string): boolean;
3018
- trigger(type: 'gate' | 'append'): string;
3019
- get StateEvents(): StateManager['events'];
3020
- regTimeEvent(type: TimeEventType, eventId: string, options: TimeEventOptions): boolean;
3021
- delTimeEvent(type: TimeEventType, eventId: string): boolean;
3022
- timeTravel(options?: TimeTravelOptions): boolean;
3023
- get TimeEvents(): TimeManager['events'];
3024
- regWeatherEvent(eventId: string, options: WeatherEventOptions): boolean;
3025
- delWeatherEvent(eventId: string): boolean;
3026
- addWeather(data: WeatherException | WeatherTypeConfig): boolean | void;
3027
- Init(): void;
3028
- private fixDynamicTask;
3029
- }
3030
- //#endregion
3031
- //#region src/modules/Frameworks/TimeTravelCheat.d.ts
3032
- declare class TimeTravelCheat {
3033
- private readonly core;
3034
- private readonly ids;
3035
- constructor(core: MaplebirchCore);
3036
- fragment(): DocumentFragment;
3037
- private createRoot;
3038
- private bind;
3039
- private render;
3040
- private fieldInput;
3041
- private setFields;
3042
- private readFields;
3043
- private syncDayLimit;
3044
- private travel;
3045
- private status;
3046
- }
3047
- //#endregion
3048
- //#region src/modules/Frameworks/DoLConsole.d.ts
3049
- declare class DoLConsole extends CheatConsole {
3050
- readonly timeTravel: TimeTravelCheat;
3051
- constructor(manager: ToolCollection);
3052
- }
3053
- //#endregion
3054
- //#region src/modules/Frameworks/DoLMacros.d.ts
3055
- declare class DoLMacros extends defineMacros {
3056
- statChange(statType: string, amount: number, colorClass: string, condition?: () => boolean): DocumentFragment;
3057
- grace(amount: number, expectedRank?: string): DocumentFragment;
3058
- }
3059
- //#endregion
3060
- //#region src/modules/DoL/Patches/Tips.d.ts
3061
- declare class Tips {
3062
- static add(category: string, ...tips: string[]): void;
3063
- static apply(): void;
3064
- static inject(data: string[]): string[];
3065
- }
3066
- //#endregion
3067
- //#region src/modules/DoL/Patches/index.d.ts
3068
- declare function register(
3069
- core: MaplebirchCore,
3070
- patch: Patch
3071
- ): (Patch<Record<never, never>> & {
3072
- traitsData: TraitConfig[];
3073
- addTraits: typeof Traits.add;
3074
- injectTraits: (data: Parameters<typeof Traits.inject>[0]) => TraitCategory[];
3075
- } & {
3076
- locationData: Record<string, LocationUpdate>;
3077
- configureLocation: typeof Location.configure;
3078
- applyLocation: typeof Location.apply;
3079
- } & {
3080
- bodywritingData: Record<string, BodywritingData>;
3081
- addBodywriting: typeof Bodywriting.add;
3082
- deleteBodywriting: typeof Bodywriting.delete;
3083
- applyBodywriting: typeof Bodywriting.apply;
3084
- } & {
3085
- fishData: Record<string, FishConfig>;
3086
- fishingLocationData: Partial<Record<FishingLocation, Record<string, number>>>;
3087
- addFish: typeof Fishing.addFish;
3088
- addBait: typeof Fishing.addBait;
3089
- configureFishingLocation: typeof Fishing.configureLocation;
3090
- applyFishing: typeof Fishing.apply;
3091
- } & {
3092
- foodstuffData: Record<string, FoodstuffConfig>;
3093
- addFoodstuff: typeof Foodstuff.add;
3094
- applyFoodstuff: typeof Foodstuff.apply;
3095
- } & {
3096
- antiquesData: Record<string, AntiqueConfig>;
3097
- addAntiques: typeof Antiques.add;
3098
- injectAntiques: typeof Antiques.inject;
3099
- } & {
3100
- tipsData: Record<string, string[]>;
3101
- addTips: typeof Tips.add;
3102
- applyTips: typeof Tips.apply;
3103
- injectTips: typeof Tips.inject;
3104
- }) & {
3105
- traits: {
3106
- data: TraitConfig[];
3107
- add: typeof Traits.add;
3108
- inject: (data: Parameters<typeof Traits.inject>[0]) => TraitCategory[];
3109
- };
3110
- location: {
3111
- data: Record<string, LocationUpdate>;
3112
- configure: typeof Location.configure;
3113
- apply: typeof Location.apply;
3114
- };
3115
- bodywriting: {
3116
- data: Record<string, BodywritingData>;
3117
- add: typeof Bodywriting.add;
3118
- delete: typeof Bodywriting.delete;
3119
- apply: typeof Bodywriting.apply;
3120
- };
3121
- fishing: {
3122
- data: Record<string, FishConfig>;
3123
- locations: Partial<Record<FishingLocation, Record<string, number>>>;
3124
- add: typeof Fishing.addFish;
3125
- addBait: typeof Fishing.addBait;
3126
- configure: typeof Fishing.configureLocation;
3127
- apply: typeof Fishing.apply;
3128
- };
3129
- foodstuff: {
3130
- data: Record<string, FoodstuffConfig>;
3131
- add: typeof Foodstuff.add;
3132
- apply: typeof Foodstuff.apply;
3133
- };
3134
- antiques: {
3135
- data: Record<string, AntiqueConfig>;
3136
- add: typeof Antiques.add;
3137
- inject: typeof Antiques.inject;
3138
- };
3139
- tips: {
3140
- data: Record<string, string[]>;
3141
- add: typeof Tips.add;
3142
- apply: typeof Tips.apply;
3143
- inject: typeof Tips.inject;
3144
- };
3145
- };
3146
- type Patches = ReturnType<typeof register>;
3147
- //#endregion
3148
- //#region src/modules/DoL/ToolCollection.d.ts
3149
- declare class DoLToolCollection extends ToolCollection {
3150
- readonly console: DoLConsole;
3151
- readonly macro: DoLMacros;
3152
- readonly patch: Patches;
3153
- private readonly macros;
3154
- private readonly optionEvents;
3155
- private readonly modI18N;
3156
- constructor(core: MaplebirchCore);
3157
- preInit(): void;
3158
- Init(): void;
3159
- }
3160
- //#endregion
3161
- //#region src/modules/AudioAddon/Track.d.ts
3162
- type AudioFormat = 'mp3' | 'wav' | 'ogg' | 'm4a' | 'flac' | 'webm';
3163
- interface TrackMeta {
3164
- title?: string;
3165
- artist?: string;
3166
- }
3167
- declare class Track {
3168
- readonly audioName: string;
3169
- readonly modName: string;
3170
- title: string;
3171
- artist: string;
3172
- duration: number;
3173
- format: AudioFormat;
3174
- constructor(audioName: string, modName: string, meta?: TrackMeta);
3175
- }
3176
- //#endregion
3177
- //#region src/modules/AudioAddon/Playlist.d.ts
3178
- declare const PlayMode: {
3179
- readonly SEQUENTIAL: 'sequential';
3180
- readonly LOOP_ALL: 'loop_all';
3181
- readonly LOOP_ONE: 'loop_one';
3182
- readonly SHUFFLE: 'shuffle';
3183
- };
3184
- type PlayModeType = (typeof PlayMode)[keyof typeof PlayMode];
3185
- declare class Playlist {
3186
- readonly name: string;
3187
- tracks: Track[];
3188
- currentIndex: number;
3189
- playMode: PlayModeType;
3190
- private shuffleOrder;
3191
- private shuffleIndex;
3192
- constructor(name: string);
3193
- add(input: Track | Track[]): void;
3194
- removeAt(index: number): boolean;
3195
- remove(audioName: string): boolean;
3196
- clear(): void;
3197
- setMode(mode: PlayModeType): void;
3198
- select(index: number): Track | null;
3199
- next(): Track | null;
3200
- previous(): Track | null;
3201
- get length(): number;
3202
- private resetShuffle;
3203
- private shuffle;
3204
- }
3205
- //#endregion
3206
- //#region src/modules/AudioAddon/Ambience.d.ts
3207
- declare class Ambience {
3208
- private readonly modloader;
3209
- private active;
3210
- private request;
3211
- constructor(modloader: ModLoader);
3212
- protected create(options: HowlOptions): Howl;
3213
- play(modName: string, path: string, volume?: number, fadeMs?: number): Promise<boolean>;
3214
- setVolume(volume: number, fadeMs?: number): void;
3215
- stop(fadeMs?: number): void;
3216
- private fadeOut;
3217
- private dispose;
3218
- private clamp;
3219
- private duration;
3220
- }
3221
- //#endregion
3222
- //#region src/modules/Audio.d.ts
3223
- declare const PlayState: {
3224
- readonly IDLE: 'idle';
3225
- readonly LOADING: 'loading';
3226
- readonly PLAYING: 'playing';
3227
- readonly PAUSED: 'paused';
3228
- readonly STOPPED: 'stopped';
3229
- };
3230
- type PlayStateType = (typeof PlayState)[keyof typeof PlayState];
3231
- interface AudioEventData {
3232
- type: string;
3233
- data?: unknown[];
3234
- [key: string]: unknown;
3235
- }
3236
- type AudioEventHandler = (eventData: AudioEventData) => void;
3237
- interface AudioProgress {
3238
- currentTime: number;
3239
- duration: number;
3240
- percent: number;
3241
- }
3242
- interface AudioSnapshot {
3243
- state: PlayStateType;
3244
- track: Track | null;
3245
- playlist: string;
3246
- index: number;
3247
- length: number;
3248
- mode: PlayModeType;
3249
- volume: number;
3250
- muted: boolean;
3251
- progress: AudioProgress;
3252
- }
3253
- declare class Audio {
3254
- readonly core: MaplebirchCore;
3255
- readonly log: ScopedLog;
3256
- readonly ambience: Ambience;
3257
- private readonly STORE;
3258
- private readonly playlists;
3259
- private readonly playlistLoads;
3260
- private readonly eventListeners;
3261
- private readonly cache;
3262
- private readonly pendingLoads;
3263
- private activePlaylist;
3264
- private currentTrack;
3265
- private loadingTrack;
3266
- private currentHowl;
3267
- private state;
3268
- private volume;
3269
- private muted;
3270
- private autoNext;
3271
- private maxCache;
3272
- private cacheCount;
3273
- private playRequestId;
3274
- private progressTimer;
3275
- private progressBindings;
3276
- constructor(core: MaplebirchCore);
3277
- private initDB;
3278
- protected on(event: string, handler: AudioEventHandler): void;
3279
- protected off(event: string, handler: AudioEventHandler): boolean;
3280
- protected once(event: string, handler: AudioEventHandler): void;
3281
- play(track: Track): Promise<boolean>;
3282
- pause(): boolean;
3283
- resume(): boolean;
3284
- stop(): boolean;
3285
- togglePlayPause(): void;
3286
- next(): Promise<boolean>;
3287
- previous(): Promise<boolean>;
3288
- playAt(modName: string, index: number): Promise<boolean>;
3289
- seek(percent: number): boolean;
3290
- seekTo(seconds: number): boolean;
3291
- getPlaylist(modName: string): Promise<Playlist>;
3292
- playFromMod(modName: string, audioName?: string): Promise<boolean | string>;
3293
- import(modName: string, audioFolder?: string): Promise<boolean>;
3294
- addFile(file: File, modName?: string): Promise<boolean | string>;
3295
- delete(modName: string, audioName: string): Promise<boolean>;
3296
- clearAudio(modName: string): Promise<boolean | string>;
3297
- clearCache(): void;
3298
- destroy(): void;
3299
- playlist(modName: string): Playlist;
3300
- get Mute(): boolean;
3301
- set Mute(value: boolean);
3302
- get Volume(): number;
3303
- set Volume(value: number);
3304
- get PlayMode(): PlayModeType;
3305
- set PlayMode(mode: PlayModeType);
3306
- cyclePlayMode(): PlayModeType;
3307
- get AutoNext(): boolean;
3308
- set AutoNext(value: boolean);
3309
- get State(): PlayStateType;
3310
- get CurrentTrack(): Track | null;
3311
- get ActivePlaylist(): Playlist | null;
3312
- get currentTime(): number;
3313
- get duration(): number;
3314
- get progress(): AudioProgress;
3315
- get snapshot(): AudioSnapshot;
3316
- formatTime(seconds: number): string;
3317
- bindProgress(sliderId: string, timeId: string, interval?: number): void;
3318
- unbindProgress(sliderId: string, timeId: string): void;
3319
- preInit(): Promise<void>;
3320
- private load;
3321
- private save;
3322
- private readRecords;
3323
- private cacheAudio;
3324
- private unloadCache;
3325
- private trimCache;
3326
- private release;
3327
- private stopCurrent;
3328
- private get outputVolume();
3329
- private startProgressTimer;
3330
- private stopProgressTimer;
3331
- private handleTrackEnd;
3332
- private dispatch;
3333
- private emit;
3334
- }
3335
- //#endregion
3336
- //#region src/modules/Variables.d.ts
3337
- declare class Options {
3338
- define(...args: any[]): any;
3339
- }
3340
- interface HairGradientsReturn {
3341
- fringe: Record<string, string[]>;
3342
- sides: Record<string, string[]>;
3343
- }
3344
- declare function hairgradients(): HairGradientsReturn;
3345
- declare class Variables {
3346
- readonly core: MaplebirchCore;
3347
- private static readonly OPTIONS_STORAGE_KEY;
3348
- private static moduleOptions;
3349
- static add(key: string, value: any): void;
3350
- static get options(): Record<string, any>;
3351
- version: string;
3352
- readonly tool: MaplebirchCore['tool'];
3353
- readonly log: ScopedLog;
3354
- readonly migration: migration;
3355
- readonly options: Options;
3356
- constructor(core: MaplebirchCore);
3357
- hairgradients: typeof hairgradients;
3358
- optionsStorage(action: 'save' | 'restore' | 'reset' | 'load'): any | null;
3359
- check(): void;
3360
- Init(): void;
3361
- loadInit(): void;
3362
- postInit(): void;
3363
- private run;
3364
- }
3365
- //#endregion
3366
- //#region src/modules/CharacterAddon/Pet.d.ts
3367
- interface PetOptions {
3368
- mask?: number;
3369
- rotation?: number;
3370
- animated?: boolean;
3371
- floating?: boolean;
3372
- scale?: number;
3373
- }
3374
- type PetTarget = string | HTMLElement;
3375
- interface PetHost {
3376
- mask(x?: number, rotation?: number): string;
3377
- }
3378
- interface FloatingPetConfig {
3379
- elementId: string;
3380
- storageKey: string;
3381
- className: string;
3382
- fallback(size: number): {
3383
- left: number;
3384
- top: number;
3385
- };
3386
- }
3387
- declare abstract class FloatingPet {
3388
- protected readonly host: PetHost;
3389
- protected readonly petConfig: FloatingPetConfig;
3390
- protected canvas?: HTMLCanvasElement;
3391
- protected model?: CanvasModel;
3392
- protected container?: HTMLElement;
3393
- protected options: Required<PetOptions>;
3394
- private cleanupDrag?;
3395
- protected constructor(host: PetHost, petConfig: FloatingPetConfig);
3396
- configure(options?: PetOptions): this;
3397
- unmount(): void;
3398
- refresh(): boolean;
3399
- protected abstract draw(model: CanvasModel, context: CanvasRenderingContext2D): void;
3400
- protected mount(container: HTMLElement, model: CanvasModel, canvas: HTMLCanvasElement): void;
3401
- protected stopAnimation(): void;
3402
- private get displaySize();
3403
- private clearBox;
3404
- private enableDrag;
3405
- }
3406
- declare class Pet extends FloatingPet {
3407
- private manager;
3408
- readonly modelName: string;
3409
- private readonly layers;
3410
- private syncing;
3411
- private rendering;
3412
- private syncFrame;
3413
- constructor(manager: Character);
3414
- sync(): boolean;
3415
- use(layers: CanvasLayerMap): this;
3416
- capture(mainModel?: CanvasModelOptions): void;
3417
- render(target: PetTarget, options?: PetOptions): boolean;
3418
- unmount(): void;
3419
- private cancel;
3420
- private readSettings;
3421
- protected draw(model: CanvasModel, context: CanvasRenderingContext2D): void;
3422
- }
3423
- //#endregion
3424
- //#region src/modules/CharacterAddon/TransformationConfig.d.ts
3425
- type DecayCondition = () => boolean;
3426
- type SuppressCondition = (sourceName: string) => boolean;
3427
- type BuildUpdater = (change: number) => void;
3428
- //#endregion
3429
- //#region src/modules/CharacterAddon/Transformation.d.ts
3430
- interface Part {
3431
- name: string;
3432
- tfRequired: number;
3433
- default?: string;
3434
- [key: string]: any;
3435
- }
3436
- type TransformHook = (options: any, model?: CanvasModel) => void;
3437
- type TransformMessage = Record<
3438
- string,
3439
- {
3440
- up: string[];
3441
- down: string[];
3442
- }
3443
- >;
3444
- type TranslationInput$1 = Record<string, Translation> | Map<string, Translation>;
3445
- interface EntryOptions {
3446
- build?: number;
3447
- level?: number;
3448
- update?: number[];
3449
- icon?: string;
3450
- message?: TransformMessage;
3451
- decay?: boolean;
3452
- decayConditions?: DecayCondition[];
3453
- suppress?: boolean;
3454
- suppressConditions?: SuppressCondition[];
3455
- pre?: TransformHook;
3456
- post?: TransformHook;
3457
- layers?: CanvasLayerMap;
3458
- translations?: TranslationInput$1;
3459
- }
3460
- interface TransformationOption extends EntryOptions {
3461
- parts: Part[];
3462
- traits?: Part[];
3463
- }
3464
- declare class Transformation {
3465
- private manager;
3466
- private get log();
3467
- private config;
3468
- readonly decayConditions: Record<string, DecayCondition[]>;
3469
- readonly suppressConditions: Record<string, SuppressCondition[]>;
3470
- readonly buildUpdaters: Record<string, BuildUpdater>;
3471
- constructor(manager: Character);
3472
- private get isDoLP();
3473
- private get animalTransforms();
3474
- private get animalMacros();
3475
- private get historyTransforms();
3476
- wikifier(widget: string, ...args: any[]): any;
3477
- modifyEffect(manager: AddonPlugin): void;
3478
- add(name: string, type: string, options: TransformationOption): this;
3479
- inject(): void;
3480
- private _update;
3481
- state(): void;
3482
- private _clear;
3483
- private suppress;
3484
- _transform(name: string, change: number): void;
3485
- updateTransform(name: string): void;
3486
- _updateParts(name: string, oldLevel: number, newLevel: number): void;
3487
- _transformationAlteration(): void;
3488
- _transformationStateUpdate(): void;
3489
- private handleHiddenTransformParts;
3490
- message(
3491
- key: string,
3492
- tools: {
3493
- element: (tag: string, text: any, className?: string) => void;
3494
- wikifier: (macro: string, param: string) => void;
3495
- }
3496
- ): boolean;
3497
- get icon(): string;
3498
- setTransform(name: string, level?: number | null): void;
3499
- part(partName: string): boolean;
3500
- }
3501
- //#endregion
3502
- //#region src/modules/Character.d.ts
3503
- type ProcessType = 'pre' | 'post';
3504
- type ModelTarget<TModel = CanvasModel | CanvasModelOptions> = string | string[] | ((modelName: string, model?: TModel) => boolean);
3505
- type ProcessHandler = (options: any, model?: CanvasModel) => void;
3506
- interface LayerUseOptions {
3507
- pet?: boolean;
3508
- }
3509
- declare function mask(x?: number, rotation?: number, swap?: boolean, width?: number, height?: number): string;
3510
- declare class Character {
3511
- readonly core: MaplebirchCore;
3512
- readonly log: ScopedLog;
3513
- readonly mask: typeof mask;
3514
- readonly faceStyleMap: Map<string, string[]>;
3515
- private readonly processors;
3516
- private nextProcessor;
3517
- private readonly layers;
3518
- readonly pet: Pet;
3519
- readonly transformation: Transformation;
3520
- constructor(core: MaplebirchCore);
3521
- get ZIndices(): {
3522
- [key: string]: number;
3523
- };
3524
- modifyFaceStyle(manager: AddonPlugin): void;
3525
- faceStyleImagePaths(files: Record<string, unknown>): void;
3526
- private faceStyleSetupOption;
3527
- modifyCanvasModel(manager: AddonPlugin): void;
3528
- patchCanvasModel<T extends CanvasModelConstructor>(BaseCanvasModel: T): T;
3529
- use(type: ProcessType, handler: ProcessHandler, target?: ModelTarget<CanvasModel>): this;
3530
- use(layers: CanvasLayerMap, target?: ModelTarget<CanvasModelOptions>, options?: LayerUseOptions): this;
3531
- process(type: ProcessType, options: CanvasModelOptionsData, model?: CanvasModel): void;
3532
- preInit(): void;
3533
- Init(): void;
3534
- loadInit(): void;
3535
- }
3536
- //#endregion
3537
- //#region src/modules/NamedNPCAddon/NPCSchedules.d.ts
3538
- interface ScheduleCondition {
3539
- (date: EnhancedDate): boolean;
3540
- }
3541
- type ScheduleTime = number | [number, number?];
3542
- type ScheduleLocation = string | ((date: EnhancedDate) => string | Schedule | void | null | undefined);
3543
- type ScheduleBuilder = (schedule: Schedule) => void | Schedule;
3544
- interface SpecialSchedule {
3545
- id: string | number;
3546
- condition: ScheduleCondition;
3547
- location: ScheduleLocation;
3548
- before?: string | number;
3549
- after?: string | number;
3550
- insteadOf?: string | number;
3551
- override?: boolean;
3552
- }
3553
- interface DailyScheduleConfig {
3554
- time: ScheduleTime;
3555
- location: string;
3556
- }
3557
- interface SpecialScheduleConfig extends Partial<Omit<SpecialSchedule, 'condition' | 'location'>> {
3558
- condition: ScheduleCondition;
3559
- location: ScheduleLocation;
3560
- }
3561
- interface ScheduleConfig {
3562
- daily?: DailyScheduleConfig[];
3563
- special?: SpecialScheduleConfig[];
3564
- }
3565
- interface EnhancedDate extends DateTime {
3566
- schedule: Schedule;
3567
- schoolDay: boolean;
3568
- spring: boolean;
3569
- summer: boolean;
3570
- autumn: boolean;
3571
- winter: boolean;
3572
- dawn: boolean;
3573
- daytime: boolean;
3574
- dusk: boolean;
3575
- night: boolean;
3576
- weekEnd: boolean;
3577
- isAt(time: ScheduleTime): boolean;
3578
- isAfter(time: ScheduleTime): boolean;
3579
- isBefore(time: ScheduleTime): boolean;
3580
- isBetween(start: ScheduleTime, end: ScheduleTime): boolean;
3581
- isHour(...hours: number[]): boolean;
3582
- isHourBetween(start: number, end: number): boolean;
3583
- isMinuteBetween(start: number, end: number): boolean;
3584
- }
3585
- declare class Schedule {
3586
- daily: string[];
3587
- specials: SpecialSchedule[];
3588
- sortedSpecials: SpecialSchedule[] | null;
3589
- at(scheduleConfig: ScheduleTime, location: string): this;
3590
- when(condition: ScheduleCondition, location: ScheduleLocation, options?: Partial<Omit<SpecialSchedule, 'condition' | 'location'>>): this;
3591
- update(specialId: string | number, updates: Partial<Omit<SpecialSchedule, 'id'>>): this;
3592
- remove(specialId: string | number): this;
3593
- sortSpecials(): void;
3594
- topologicalSort(items: SpecialSchedule[]): SpecialSchedule[];
3595
- get location(): string;
3596
- resolveLocation(loc: ScheduleLocation, date: EnhancedDate): string;
3597
- createEnhancedDate(date: DateTime): EnhancedDate;
3598
- buildEnhancedDateProto(): EnhancedDate;
3599
- private dailyLocation;
3600
- }
3601
- declare const NPCSchedules: typeof Schedule & {
3602
- readonly schedules: Map<string, Schedule>;
3603
- init: (manager: NPCManager) => boolean;
3604
- set: (npcName: string, config: ScheduleConfig | ScheduleBuilder) => Schedule;
3605
- get: (npcName: string) => Schedule;
3606
- update: (npcName: string, specialId: string | number, updates: Partial<Omit<SpecialSchedule, 'id'>>) => Schedule;
3607
- remove: (npcName: string, specialId: string | number) => Schedule;
3608
- clear: (npcName: string) => Schedule;
3609
- clearAll: () => void;
3610
- readonly npcList: string[];
3611
- readonly location: Record<string, string>;
3612
- };
3613
- //#endregion
3614
- //#region src/modules/NamedNPCAddon/NPCClothes/NPCOutfitSets.d.ts
3615
- interface OutfitPartConfig {
3616
- name: string;
3617
- integrity_max?: number;
3618
- word?: string;
3619
- action?: string;
3620
- readonly desc?: string;
3621
- }
3622
- interface OutfitSetConfig {
3623
- name: string;
3624
- type?: string;
3625
- gender?: string;
3626
- outfit?: number;
3627
- upper: string | OutfitPartConfig;
3628
- lower: string | OutfitPartConfig;
3629
- desc?: string;
3630
- }
3631
- interface OutfitSet {
3632
- name: string;
3633
- type: string;
3634
- gender: string;
3635
- outfit: number;
3636
- clothes: {
3637
- upper: Required<OutfitPartConfig>;
3638
- lower: Required<OutfitPartConfig>;
3639
- };
3640
- desc: string;
3641
- }
3642
- declare class NPCOutfitSets {
3643
- private readonly manager;
3644
- constructor(manager: NPCManager);
3645
- init(): void;
3646
- add(...configs: OutfitSetConfig[]): void;
3647
- get data(): OutfitSet[];
3648
- private create;
3649
- private createPart;
3650
- }
3651
- //#endregion
3652
- //#region src/modules/NamedNPCAddon/NPCClothes/NPCSidebarArt.d.ts
3653
- interface ResolvedArtLayer {
3654
- zIndex: number | string;
3655
- img: string;
3656
- }
3657
- type ArtPart = 'head' | 'face' | 'neck' | 'upper' | 'lower' | 'legs' | 'feet' | 'hands';
3658
- interface ResolvedArt {
3659
- key: string;
3660
- body: string;
3661
- parts: Partial<Record<ArtPart, ResolvedArtLayer>>;
3662
- }
3663
- declare class NPCSidebarArt {
3664
- private readonly manager;
3665
- private readonly configs;
3666
- constructor(manager: NPCManager);
3667
- import(modName: string, modZip: ModZipReader, filePaths: string | string[]): Promise<string[]>;
3668
- has(npcName: string, key: string): boolean;
3669
- keys(npcName: string): string[];
3670
- get(npcName: string, key: string): ResolvedArt | undefined;
3671
- get layers(): Map<string, Map<string, ResolvedArt>>;
3672
- private setConfig;
3673
- private resolve;
3674
- }
3675
- //#endregion
3676
- //#region src/modules/NamedNPCAddon/NPCClothes/Condition.d.ts
3677
- type Condition = boolean | string | (() => boolean) | Condition[];
3678
- //#endregion
3679
- //#region src/modules/NamedNPCAddon/NPCSidebarConfig/transformation_layers.d.ts
3680
- declare const transformationDefaults: {
3681
- show_tf: boolean;
3682
- tf_ears_layer: string;
3683
- angel_wings_type: string;
3684
- angel_wing_right: string;
3685
- angel_wing_left: string;
3686
- angel_wings_layer: string;
3687
- angel_halo_type: string;
3688
- angel_halo_lower: boolean;
3689
- fallen_wings_type: string;
3690
- fallen_wing_right: string;
3691
- fallen_wing_left: string;
3692
- fallen_wings_layer: string;
3693
- fallen_halo_type: string;
3694
- demon_wings_type: string;
3695
- demon_wings_state: string;
3696
- demon_wings_layer: string;
3697
- demon_tail_type: string;
3698
- demon_tail_state: string;
3699
- demon_tail_layer: string;
3700
- demon_horns_type: string;
3701
- demon_horns_layer: string;
3702
- wolf_tail_type: string;
3703
- wolf_tail_layer: string;
3704
- wolf_ears_type: string;
3705
- wolf_pits_type: string;
3706
- wolf_pubes_type: string;
3707
- wolf_cheeks_type: string;
3708
- cat_tail_type: string;
3709
- cat_tail_layer: string;
3710
- cat_ears_type: string;
3711
- cow_horns_type: string;
3712
- cow_horns_layer: string;
3713
- cow_tail_type: string;
3714
- cow_tail_layer: string;
3715
- cow_ears_type: string;
3716
- bird_wings_type: string;
3717
- bird_wing_right: string;
3718
- bird_wing_left: string;
3719
- bird_wings_layer: string;
3720
- bird_tail_type: string;
3721
- bird_tail_layer: string;
3722
- bird_eyes_type: string;
3723
- bird_malar_type: string;
3724
- bird_plumage_type: string;
3725
- bird_pubes_type: string;
3726
- fox_tail_type: string;
3727
- fox_tail_layer: string;
3728
- fox_ears_type: string;
3729
- fox_cheeks_type: string;
3730
- };
3731
- //#endregion
3732
- //#region src/modules/NamedNPCAddon/NPCSidebarConfig/types.d.ts
3733
- type NPCBodyData = Pick<
3734
- NPCData,
3735
- | 'penis'
3736
- | 'vagina'
3737
- | 'virginity'
3738
- | 'hair_side_type'
3739
- | 'hair_fringe_type'
3740
- | 'hair_position'
3741
- | 'hair_sides_length'
3742
- | 'hair_fringe_length'
3743
- | 'eyeColour'
3744
- | 'hairColour'
3745
- | 'penissize'
3746
- | 'breastsize'
3747
- | 'ballssize'
3748
- >;
3749
- type NPCClothesSlot = 'head' | 'face' | 'neck' | 'upper' | 'lower' | 'feet' | 'legs' | 'handheld' | 'genitals' | 'under_upper' | 'under_lower' | 'over_head' | 'over_upper' | 'over_lower' | 'hands';
3750
- interface NPCSidebarClothing {
3751
- index: number;
3752
- name: string;
3753
- variable: string;
3754
- type: string[];
3755
- integrity: string;
3756
- setup?: NPCSidebarClothing;
3757
- alpha?: number;
3758
- alt?: string;
3759
- altposition?: string;
3760
- altdisabled?: string[];
3761
- altsleeve?: string;
3762
- state?: string;
3763
- state_top?: string;
3764
- colour?: string;
3765
- colourCustom?: string;
3766
- accessory_colour?: string;
3767
- accessory_colourCustom?: string;
3768
- accessory_colour_sidebar?: string;
3769
- accessory?: number;
3770
- accessory_integrity_img?: number;
3771
- mainImage?: number;
3772
- accImage?: number;
3773
- leftImage?: number;
3774
- rightImage?: number;
3775
- coverImage?: number;
3776
- coverBackImage?: number;
3777
- back_img?: number;
3778
- back_img_acc?: number;
3779
- back_img_colour?: string;
3780
- back_img_acc_colour?: string;
3781
- back_integrity_img?: number;
3782
- breast_img?: number | Record<number, number>;
3783
- breast_acc_img?: number | Record<number, number>;
3784
- breast_pattern?: number;
3785
- sleeve_img?: number;
3786
- sleeve_acc_img?: number;
3787
- sleeve_colour?: string;
3788
- penis_img?: number;
3789
- penis_acc_img?: number;
3790
- mask_img?: number;
3791
- pattern?: string;
3792
- pattern_layer?: string;
3793
- holdPosition?: string;
3794
- hoodposition?: string;
3795
- hood?: number;
3796
- has_collar?: number;
3797
- high_img?: number;
3798
- notuck?: number;
3799
- outfitPrimary?: Partial<Record<NPCClothesSlot, string>>;
3800
- outfitSecondary?: string[];
3801
- set?: string;
3802
- zIndex?: string | number;
3803
- }
3804
- interface NPCSidebarState extends Partial<typeof transformationDefaults> {
3805
- name: string;
3806
- show: boolean;
3807
- model: boolean;
3808
- position: number;
3809
- dxfn: number;
3810
- dyfn: number;
3811
- tan: number;
3812
- skin_type: string;
3813
- freckles: boolean;
3814
- facestyle: string;
3815
- facevariant: string;
3816
- ears_position: string;
3817
- close_up_mask: string;
3818
- hide_all: boolean;
3819
- hide_head_acc: boolean;
3820
- hide_leash: boolean;
3821
- hood_down: boolean;
3822
- show_hair: boolean;
3823
- clothes: Record<NPCClothesSlot, NPCSidebarClothing>;
3824
- bodydata: NPCBodyData;
3825
- tf_filters?: Record<string, CanvasLayerFilter>;
3826
- head_mask: string[];
3827
- upper_mask: string[];
3828
- lower_mask: string[];
3829
- legs_mask: string[];
3830
- feet_mask: string[];
3831
- fringe_mask_src: string | null;
3832
- feet_clip_src: string | null;
3833
- upper_tucked: boolean;
3834
- lower_tucked: boolean;
3835
- crotch_visible: boolean;
3836
- crotch_exposed: boolean;
3837
- arm_left: string;
3838
- arm_right: string;
3839
- handheld_position: string | null;
3840
- handheld_animation: string;
3841
- handheld_overhead: boolean | null;
3842
- alt_sleeve_state: boolean | null;
3843
- high_waist_suspenders: boolean | null;
3844
- hood_mask: boolean | null;
3845
- zarms: number;
3846
- zupper: number;
3847
- zupperleft: number;
3848
- zupperright: number;
3849
- lust: number;
3850
- breasts: string;
3851
- breast_size: number;
3852
- penis: string | false;
3853
- penis_size: number;
3854
- balls: boolean;
3855
- genitals_chastity: boolean;
3856
- eye_colour: string;
3857
- hair_colour: string;
3858
- hair_sides_type: string;
3859
- hair_fringe_type: string;
3860
- hair_position: string;
3861
- hair_sides_position: string;
3862
- hair_sides_length: string;
3863
- hair_fringe_length: string;
3864
- drip_mouth: string;
3865
- calculate_penis_bulge(target?: NPCSidebarState): number;
3866
- [key: string]: unknown;
3867
- }
3868
- //#endregion
3869
- //#region src/modules/NamedNPCAddon/NPCClothes/NPCSidebarWardrobe.d.ts
3870
- type WardrobeClothing = Partial<NPCSidebarClothing>;
3871
- type WardrobeItem = Partial<Record<NPCClothesSlot, WardrobeClothing>>;
3872
- type WardrobeWetness = 'dry' | 'damp' | 'wet' | 'soaked';
3873
- type WardrobeWetnessResolver = WardrobeWetness | (() => WardrobeWetness);
3874
- interface WardrobeWearOptions {
3875
- when?: Condition;
3876
- wetness?: WardrobeWetnessResolver;
3877
- }
3878
- interface WardrobeConditionGroup {
3879
- location?: string | readonly string[];
3880
- passage?: string | readonly string[];
3881
- hours?: readonly [from: number, to: number];
3882
- }
3883
- type WardrobeWeightedChoice = readonly [key: string, weight: number];
3884
- type WardrobeChoice = string | readonly WardrobeWeightedChoice[];
3885
- type WardrobeLayerResolver = string | (() => string);
3886
- interface WardrobeContext {
3887
- npcName: string;
3888
- location: string;
3889
- key: string;
3890
- wetness: WardrobeWetness;
3891
- }
3892
- type WardrobeModifier = (clothes: WardrobeItem, context: WardrobeContext) => void;
3893
- declare class NPCSidebarWardrobe {
3894
- private readonly manager;
3895
- private readonly templates;
3896
- private readonly profiles;
3897
- private readonly conditions;
3898
- constructor(manager: NPCManager);
3899
- init(): void;
3900
- load(modName: string, filePath: string): Promise<void>;
3901
- get(key: string): WardrobeItem | undefined;
3902
- set(key: string, template: WardrobeItem): void;
3903
- has(key: string): boolean;
3904
- when(name: string, group?: WardrobeConditionGroup, condition?: Condition): () => boolean;
3905
- wear(npcName: string, location: string | readonly string[], choice: WardrobeChoice, options?: Condition | WardrobeWearOptions): void;
3906
- wet(npcName: string, wetness: WardrobeWetnessResolver, cond?: Condition): void;
3907
- layer(npcName: string, source: WardrobeLayerResolver, cond?: Condition): void;
3908
- apply(clothes: WardrobeItem, slot: NPCClothesSlot, item: WardrobeClothing): void;
3909
- put(clothes: WardrobeItem, key: string, slots?: NPCClothesSlot | readonly NPCClothesSlot[]): void;
3910
- strip(clothes: WardrobeItem, slot: NPCClothesSlot | readonly NPCClothesSlot[]): void;
3911
- base(npcName: string, modifier: WardrobeModifier): void;
3912
- modify(npcName: string, modifier: WardrobeModifier): void;
3913
- worn(npcName: string): WardrobeItem;
3914
- private run;
3915
- private add;
3916
- private merge;
3917
- private select;
3918
- private find;
3919
- private choose;
3920
- private findWet;
3921
- private resolveWet;
3922
- private applyWet;
3923
- private profile;
3924
- private location;
3925
- }
3926
- //#endregion
3927
- //#region src/modules/NamedNPCAddon/NPCClothes.d.ts
3928
- declare class NPCClothes {
3929
- readonly outfitSets: NPCOutfitSets;
3930
- readonly art: NPCSidebarArt;
3931
- readonly wardrobe: NPCSidebarWardrobe;
3932
- constructor(manager: NPCManager);
3933
- init(): void;
3934
- }
3935
- //#endregion
3936
- //#region src/modules/NamedNPCAddon/NPCSidebar.d.ts
3937
- interface NPCSidebarBootConfig {
3938
- clothes?: string[];
3939
- image?: string[];
3940
- config?: string[];
3941
- }
3942
- declare function config(manager: NPCManager, modName: string, modZip: ModZipReader, config: NPCSidebarBootConfig): Promise<void>;
3943
- declare function loadFromMod(modZip: ModZipReader, npc_names: string[]): string[];
3944
- declare class NPCPet {
3945
- private readonly pets;
3946
- private frame;
3947
- private syncing;
3948
- sync(): boolean;
3949
- private render;
3950
- reset(): void;
3951
- private cancel;
3952
- }
3953
- declare const NPCSidebar: {
3954
- new (): {};
3955
- readonly pet: NPCPet;
3956
- get display(): Map<string, Set<string>>;
3957
- config: typeof config;
3958
- loadFromMod: typeof loadFromMod;
3959
- hair_type(type: 'sides' | 'fringe'): Record<string, string>;
3960
- init(manager: NPCManager): void;
3961
- };
3962
- //#endregion
3963
- //#region src/modules/NamedNPCAddon/NPCFluids.d.ts
3964
- type NPCFluidPart = 'vagina' | 'vaginaoutside' | 'anus' | 'mouth' | 'penis' | 'chest' | 'face' | 'hair' | 'bottom' | 'feet' | 'leftarm' | 'rightarm' | 'neck' | 'thigh' | 'tummy';
3965
- type NPCFluidType = 'goo' | 'semen';
3966
- type NPCFluidAmount = [goo: number, semen: number];
3967
- type NPCFluidData = Record<NPCFluidPart, NPCFluidAmount>;
3968
- declare class NPCFluids {
3969
- readonly parts: NPCFluidPart[];
3970
- ensure(npcName: string): NPCFluidData;
3971
- get(npcName: string): NPCFluidData;
3972
- combined(npcName: string, part: NPCFluidPart): number;
3973
- set(npcName: string, part: NPCFluidPart, value: number, type?: NPCFluidType): NPCFluidData;
3974
- add(npcName: string, part: NPCFluidPart, value?: number, type?: NPCFluidType): NPCFluidData;
3975
- reduce(npcName: string, part: NPCFluidPart, value?: number, type?: NPCFluidType): NPCFluidData;
3976
- clear(npcName: string, part?: NPCFluidPart, type?: NPCFluidType): NPCFluidData;
3977
- decay(value?: number): void;
3978
- apply(nnpc: Record<string, any>, npcData: any): void;
3979
- }
3980
- //#endregion
3981
- //#region src/modules/NamedNPCAddon/NPCTransformation.d.ts
3982
- interface NPCTransformationState {
3983
- build: number;
3984
- level: number;
3985
- }
3986
- type NPCTransformationPart = { [Key in keyof typeof transformationDefaults]: Key extends `${infer Part}_type` ? Part : never }[keyof typeof transformationDefaults];
3987
- interface NPCTransformationPartConfig {
3988
- level?: number;
3989
- style?: string;
3990
- filter?: {
3991
- blend?: string;
3992
- blendMode?: string;
3993
- brightness?: number;
3994
- contrast?: number;
3995
- desaturate?: boolean;
3996
- };
3997
- }
3998
- interface NPCTransformationConfig {
3999
- levels?: readonly number[];
4000
- type?: string;
4001
- parts?: Partial<Record<NPCTransformationPart, NPCTransformationPartConfig>>;
4002
- body?: (bodydata: NPCBodyData, state: Readonly<NPCTransformationState>, npcName: string) => void;
4003
- sidebar?: (nnpc: Partial<NPCSidebarState>, state: Readonly<NPCTransformationState>, npcName: string) => void;
4004
- layers?: CanvasLayerMap;
4005
- }
4006
- declare class NPCTransformation {
4007
- private readonly manager;
4008
- private readonly configs;
4009
- constructor(manager: NPCManager);
4010
- add(npcName: string, type: string, config?: NPCTransformationConfig): this;
4011
- ensure(npcName: string, type?: string): Record<string, NPCTransformationState>;
4012
- get(npcName: string, type: string): NPCTransformationState;
4013
- build(npcName: string, type: string, value: number): NPCTransformationState;
4014
- set(npcName: string, type: string, level: number): NPCTransformationState;
4015
- clear(npcName: string, type?: string): void;
4016
- level(npcName: string, type: string): number;
4017
- type(npcName: string): string;
4018
- applyBody(
4019
- nnpc: Partial<NPCSidebarState>,
4020
- npcData: {
4021
- bodydata?: NPCBodyData;
4022
- }
4023
- ): void;
4024
- applySidebar(nnpc: Partial<NPCSidebarState>): void;
4025
- private read;
4026
- private entries;
4027
- private config;
4028
- private active;
4029
- }
4030
- //#endregion
4031
- //#region src/modules/NamedNPCAddon/NPCPregnancy.d.ts
4032
- type NPCPregnancySpecies = 'human' | 'wolf' | 'wolfboy' | 'wolfgirl' | 'hawk' | 'harpy';
4033
- type NPCPregnancyOrifice = 'vagina' | 'anus';
4034
- type NPCPregnancyRange = number | readonly [min: number, max: number];
4035
- interface NPCPregnancyState {
4036
- enabled?: boolean;
4037
- analEnabled?: boolean;
4038
- cycleDaysTotal?: number;
4039
- cycleDay?: number;
4040
- cycleDangerousDay?: number;
4041
- fertileLeadDays?: number;
4042
- pills?: 'contraceptive' | 'fertility' | null;
4043
- [key: string]: unknown;
4044
- }
4045
- interface NPCPregnancyRecord {
4046
- pregnancyId: number;
4047
- carrier: string;
4048
- carrierSpecies: string;
4049
- donor: string;
4050
- donorSpecies: NPCPregnancySpecies;
4051
- possibleDonors: {
4052
- name: string;
4053
- species: NPCPregnancySpecies;
4054
- }[];
4055
- conceivedDate: number;
4056
- conceivedLocation: string;
4057
- gestationVariance: number;
4058
- orifice: NPCPregnancyOrifice;
4059
- deliveredDate: number | null;
4060
- deliveredLocation: string | null;
4061
- awareOfPregnancy: string[];
4062
- awareOfCarrier: string[];
4063
- awareOfDonor: string[];
4064
- talkedAbout: Record<string, boolean>;
4065
- playerLearnedFrom: string | null;
4066
- hatchDelay?: number;
4067
- layCare?: number;
4068
- waterBreaking?: boolean;
4069
- }
4070
- interface NPCPregnancyCycleConfig {
4071
- days?: NPCPregnancyRange;
4072
- dangerousDay?: number;
4073
- fertileLeadDays?: NPCPregnancyRange;
4074
- pills?: 'contraceptive' | 'fertility' | null;
4075
- analEnabled?: boolean;
4076
- avoidance?: number;
4077
- }
4078
- interface NPCPregnancyConfig {
4079
- canBePregnant?: boolean;
4080
- canImpregnatePlayer?: boolean;
4081
- cycle?: NPCPregnancyCycleConfig;
4082
- }
4083
- interface NPCTryConceiveOptions {
4084
- donor?: string;
4085
- donorSpecies?: NPCPregnancySpecies;
4086
- orifice?: NPCPregnancyOrifice;
4087
- depth?: 'outside' | 'imminent' | 'deep';
4088
- location?: string;
4089
- fertility?: number;
4090
- aware?: boolean;
4091
- donorKnown?: boolean;
4092
- }
4093
- interface NPCPregnancySnapshot {
4094
- cycle: {
4095
- enabled: boolean;
4096
- day: number | null;
4097
- days: number | null;
4098
- dangerousDay: number | null;
4099
- fertileLeadDays: number | null;
4100
- fertility: number;
4101
- pills: NPCPregnancyState['pills'];
4102
- analEnabled: boolean;
4103
- avoidance: number | null;
4104
- };
4105
- pregnancies: NPCPregnancyRecord[];
4106
- progress: number | null;
4107
- dueDate: number | null;
4108
- belly: number;
4109
- }
4110
- declare class NPCPregnancy {
4111
- private readonly manager;
4112
- private readonly configs;
4113
- private initialized;
4114
- constructor(manager: NPCManager);
4115
- get available(): boolean;
4116
- add(npcName: string, config?: NPCPregnancyConfig): this;
4117
- init(): void;
4118
- inject(): void;
4119
- get(npcName: string): NPCPregnancySnapshot;
4120
- tryConceive(npcName: string, options?: NPCTryConceiveOptions): NPCPregnancyRecord | null;
4121
- private applyRegistration;
4122
- private applyCycle;
4123
- private validateCycle;
4124
- private validateRange;
4125
- private cycleConfigured;
4126
- private markCycleConfigured;
4127
- private species;
4128
- private name;
4129
- private npc;
4130
- private requireRuntime;
4131
- private range;
4132
- private random;
4133
- }
4134
- //#endregion
4135
- //#region src/modules/NamedNPC.d.ts
4136
- type PronounCode = 'm' | 'f' | 'i' | 'n' | 't';
4137
- type TranslationInput = Map<string, Translation> | Record<string, Translation>;
4138
- interface NPCData {
4139
- nam: string;
4140
- gender?: 'm' | 'f' | 'h' | 'n' | 'none';
4141
- pronoun?: PronounCode;
4142
- title?: string;
4143
- description?: string;
4144
- type?: string;
4145
- adult?: number;
4146
- teen?: number;
4147
- age?: number;
4148
- insecurity?: string;
4149
- chastity?: {
4150
- penis: string;
4151
- vagina: string;
4152
- anus: string;
4153
- };
4154
- virginity?: Record<string, boolean>;
4155
- hair_side_type?: string;
4156
- hair_fringe_type?: string;
4157
- hair_position?: string;
4158
- hair_sides_length?: number;
4159
- hair_fringe_length?: number;
4160
- eyeColour?: string;
4161
- hairColour?: string;
4162
- bottomsize?: number;
4163
- skincolour?: number;
4164
- init?: number;
4165
- intro?: number;
4166
- penis?: string;
4167
- penissize?: number;
4168
- penisdesc?: string;
4169
- vagina?: string;
4170
- breastsize?: number;
4171
- breastdesc?: string;
4172
- ballssize?: number;
4173
- outfits?: string[];
4174
- pregnancy?: NPCPregnancyState | null;
4175
- pregnancyAvoidance?: number;
4176
- [key: string]: any;
4177
- }
4178
- interface NPCConfig {
4179
- love?: {
4180
- maxValue: number;
4181
- };
4182
- loveAlias?: [string, string] | (() => string | [string, string]);
4183
- important?: boolean | (() => boolean);
4184
- special?: boolean | (() => boolean);
4185
- loveInterest?: boolean | (() => boolean);
4186
- romance?: (() => boolean)[];
4187
- [key: string]: unknown;
4188
- }
4189
- interface NPCStatConfig {
4190
- min?: number;
4191
- max?: number;
4192
- default?: number;
4193
- position?: number | 'first' | 'last' | false;
4194
- [key: string]: unknown;
4195
- }
4196
- declare const NamedNPC: {
4197
- new (
4198
- manager: NPCManager,
4199
- data: NPCData
4200
- ): {
4201
- nam: string;
4202
- gender: 'm' | 'f' | 'h' | 'n' | 'none';
4203
- title: string;
4204
- description: string;
4205
- type: string;
4206
- adult: number;
4207
- teen: number;
4208
- age: number;
4209
- insecurity: string;
4210
- chastity: {
4211
- penis: string;
4212
- vagina: string;
4213
- anus: string;
4214
- };
4215
- virginity: Record<string, boolean>;
4216
- hair_side_type: string;
4217
- hair_fringe_type: string;
4218
- hair_position: string;
4219
- hair_sides_length: number;
4220
- hair_fringe_length: number;
4221
- eyeColour: string;
4222
- hairColour: string;
4223
- pronoun: PronounCode;
4224
- pronouns: Record<string, string>;
4225
- bottomsize: number;
4226
- skincolour: number;
4227
- init: number;
4228
- intro: number;
4229
- penis: string;
4230
- penissize: number;
4231
- penisdesc: string;
4232
- vagina: string;
4233
- breastsize: number;
4234
- breastdesc: string;
4235
- breastsdesc: string;
4236
- bottomdesc: string;
4237
- ballsdesc: string;
4238
- ballssize: number;
4239
- outfits: string[];
4240
- pregnancy: NPCPregnancyState;
4241
- pregnancyAvoidance?: number;
4242
- descCache: Record<string, string>;
4243
- setPronouns(): void;
4244
- setBodyTraits(data: NPCData): void;
4245
- bodyPartdescription(): void;
4246
- };
4247
- } & {
4248
- add: (manager: NPCManager, npcData: NPCData, config?: NPCConfig, translationsData?: TranslationInput) => boolean;
4249
- get: (manager: NPCManager) => string[];
4250
- clear: (manager: NPCManager) => boolean;
4251
- update: (manager: NPCManager) => boolean;
4252
- setup: (manager: NPCManager) => void;
4253
- proxy: (manager: NPCManager) => void;
4254
- convert: (manager: NPCManager) => void;
4255
- };
4256
- declare class NPCManager {
4257
- readonly core: MaplebirchCore;
4258
- readonly log: ScopedLog;
4259
- readonly data: Map<
4260
- string,
4261
- {
4262
- Data: InstanceType<typeof NamedNPC>;
4263
- Config: NPCConfig;
4264
- }
4265
- >;
4266
- NPCNameList: string[];
4267
- readonly Transformation: NPCTransformation;
4268
- readonly Pregnancy: NPCPregnancy;
4269
- readonly type: Record<'loveInterestNpcs' | 'importantNPCs' | 'specialNPCs', string[]>;
4270
- readonly customStats: Record<string, NPCStatConfig>;
4271
- readonly romanceConditions: {
4272
- [key: string]: (() => boolean)[];
4273
- };
4274
- readonly NamedNPC: typeof NamedNPC;
4275
- readonly Schedule: typeof NPCSchedules;
4276
- readonly Clothes: NPCClothes;
4277
- readonly Sidebar: typeof NPCSidebar;
4278
- readonly fluids: NPCFluids;
4279
- constructor(core: MaplebirchCore);
4280
- add(npcData: NPCData, config?: NPCConfig, translationsData?: TranslationInput): boolean;
4281
- addSchedule(npcName: string, config: ScheduleConfig | ScheduleBuilder): Schedule;
4282
- addStats(statsObject: Record<string, NPCStatConfig>): void;
4283
- addClothes(...configs: OutfitSetConfig[]): void;
4284
- injectModNPCs(): void;
4285
- vanillaNPCConfig(npcConfig: Record<string, NPCConfig>): Record<string, NPCConfig>;
4286
- applyStatDefaults(statDefaults: Record<string, NPCStatConfig>): Record<string, NPCStatConfig>;
4287
- vanillaInit(npcName: string): void;
4288
- vanillaInject(npcName: string, npcno: number): void;
4289
- private config;
4290
- preInit(): void;
4291
- Init(): void;
4292
- loadInit(): void;
4293
- postInit(): void;
4294
- }
4295
- //#endregion
4296
- //#region src/modules/CombatAddon/CombatTypes.d.ts
4297
- declare const actionTypes: readonly ['leftaction', 'rightaction', 'feetaction', 'mouthaction', 'penisaction', 'vaginaaction', 'anusaction', 'chestaction', 'thighaction'];
4298
- type ActionType = (typeof actionTypes)[number];
4299
- declare const combatTypes: readonly ['Default', 'Self', 'Struggle', 'Swarm', 'Vore', 'Machine', 'Tentacle'];
4300
- type CombatType = (typeof combatTypes)[number];
4301
- //#endregion
4302
- //#region src/modules/CombatAddon/CombatAction.d.ts
4303
- type OptionType = ActionType | 'ask';
4304
- type ActionValue = string | number;
4305
- interface Context {
4306
- actionType?: OptionType;
4307
- combatType?: CombatType;
4308
- encounterType?: CombatType;
4309
- action?: ActionValue;
4310
- id?: string;
4311
- originalCount?: number;
4312
- label?: string;
4313
- }
4314
- interface ActionEntry {
4315
- id: string;
4316
- actionType: ActionType;
4317
- cond: (ctx: Context) => boolean;
4318
- display: (ctx: Context) => string;
4319
- value: (ctx: Context) => ActionValue;
4320
- color: (ctx: Context) => string;
4321
- difficulty: (ctx: Context) => string;
4322
- effect: (ctx: Context) => string;
4323
- combatType: (ctx: Context) => CombatType | CombatType[];
4324
- order: (ctx: Context) => number;
4325
- }
4326
- interface ActionConfig {
4327
- id: string;
4328
- actionType: ActionType | ActionType[];
4329
- cond: (ctx: Context) => boolean;
4330
- display: (ctx: Context) => string;
4331
- value: (ctx: Context) => ActionValue;
4332
- color?: string | ((ctx: Context) => string);
4333
- difficulty?: string | ((ctx: Context) => string);
4334
- effect?: string | ((ctx: Context) => string);
4335
- combatType?: CombatType | CombatType[] | ((ctx: Context) => CombatType | CombatType[]);
4336
- order?: number | ((ctx: Context) => number);
4337
- }
4338
- interface ModificationConfig {
4339
- id: string;
4340
- actionType: OptionType | OptionType[];
4341
- value: ActionValue;
4342
- combatType?: CombatType | CombatType[] | ((ctx: Context) => CombatType | CombatType[]);
4343
- cond?: (ctx: Context) => boolean;
4344
- display?: string | ((ctx: Context) => string);
4345
- order?: number | ((ctx: Context) => number);
4346
- }
4347
- interface OptionsTable {
4348
- [key: string]: ActionValue;
4349
- }
4350
- declare class CombatActions {
4351
- readonly actions: ActionEntry[];
4352
- private readonly modifications;
4353
- private matches;
4354
- reg(...configs: ActionConfig[]): this;
4355
- modify(...configs: ModificationConfig[]): this;
4356
- private eval;
4357
- patchOptions(optionsTable: OptionsTable, actionType: OptionType, combatType?: CombatType): OptionsTable;
4358
- color(action: ActionValue, encounterType?: CombatType): string | null;
4359
- difficulty(action: ActionValue, combatType?: CombatType): string | null;
4360
- effect(combatType: CombatType | undefined, ...actionTypes: ActionType[]): string;
4361
- }
4362
- //#endregion
4363
- //#region src/modules/Combat.d.ts
4364
- declare class Combat {
4365
- readonly core: MaplebirchCore;
4366
- readonly log: ScopedLog;
4367
- readonly CombatAction: CombatActions;
4368
- constructor(core: MaplebirchCore);
4369
- preInit(): void;
4370
- private _generateCombatAction;
4371
- private _combatListColor;
4372
- private _combatButtonAdjustments;
4373
- Init(): void;
4374
- }
4375
- //#endregion
4376
- //#region src/modules/DoL/types.d.ts
4377
- interface CoreModules {
4378
- readonly dynamic: DoLDynamic;
4379
- readonly tool: DoLToolCollection;
4380
- readonly audio: Audio;
4381
- readonly var: Variables;
4382
- readonly char: Character;
4383
- readonly npc: NPCManager;
4384
- readonly combat: Combat;
4385
- }
4386
- declare global {
4387
- interface MaplebirchExtensions extends CoreModules {}
4388
- }
4389
- //#endregion
4390
- //#region src/modules/Frameworks/ImageLoader.d.ts
4391
- declare class ImageLoader {
4392
- private static refreshTimer;
4393
- static load(src: string): string | false | Promise<string | false>;
4394
- private static queueRefresh;
4395
- }
4396
- //#endregion
4397
- export {
4398
- type AddonServices,
4399
- type BootHandler,
4400
- type BootTask,
4401
- type CloudSaveConfig,
4402
- type CloudSaveRecord,
4403
- type CloudSaveRemoteCode,
4404
- type CloudSaveRemoteItem,
4405
- type CoreEvents,
4406
- type CoreModules,
4407
- type DependencyGraph,
4408
- type DependencyInfo,
4409
- type DiagnosticRecord,
4410
- DoLDynamic,
4411
- type DoLGlobalScope,
4412
- type DoLHost,
4413
- DoLToolCollection,
4414
- Dynamic,
4415
- type EventCallback,
4416
- type Extensions,
4417
- type FrameworkHost,
4418
- type FrameworkInfra,
4419
- type FrameworkServices,
4420
- type HookCallback,
4421
- ImageLoader,
4422
- type LifecyclePhase,
4423
- type LifecycleResult,
4424
- type LifecycleTarget,
4425
- type LogLevel,
4426
- type MaplebirchCore,
4427
- type ModConflict,
4428
- type Module,
4429
- type ModulesMeta,
4430
- type PatchResult,
4431
- Resources,
4432
- type SaveObject,
4433
- type StateEventOptions,
4434
- ToolCollection,
4435
- type Translation,
4436
- maplebirch as default,
4437
- dol,
4438
- index_d_exports as utils
4439
- };
1
+ import './modules/DoL/index.js';
2
+ import './compat/SimpleFrameworks.js';
3
+ import './compat/Prototype.js';
4
+ import './types/global.js';
5
+ export { default } from './main.js';
6
+ export * from './main.js';
7
+ export { default as dol, DoL, type DoLHost, type DoLGlobalScope } from './host/DoL.js';
8
+ export type { CoreModules } from './modules/DoL/types.js';
9
+ export { default as DoLDynamic } from './modules/DoL/Dynamic.js';
10
+ export { default as DoLToolCollection } from './modules/DoL/ToolCollection.js';
11
+ export { default as ImageLoader } from './modules/Frameworks/ImageLoader.js';