@scml-dol-maplebirch/types 4.3.5 → 4.4.0

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 (3) hide show
  1. package/index.d.ts +2 -2
  2. package/maplebirch.d.ts +1178 -368
  3. package/package.json +1 -1
package/maplebirch.d.ts CHANGED
@@ -1,8 +1,9 @@
1
1
  import { Passage } from '@scml/types/sugarcube-2-ModLoader/SugarCube2';
2
2
  import { ModBootJson, ModInfo } from '@scml/types/sugarcube-2-ModLoader/ModLoader';
3
- import { JSZipLikeReadOnlyInterface } from '@scml/types/sugarcube-2-ModLoader/JSZipLikeReadOnlyInterface';
3
+ import { InputFileFormat, JSZipLikeReadOnlyInterface } from '@scml/types/sugarcube-2-ModLoader/JSZipLikeReadOnlyInterface';
4
4
  import { ModZipReader } from '@scml/types/sugarcube-2-ModLoader/ModZipReader';
5
5
  import { SC2DataManager } from '@scml/types/sugarcube-2-ModLoader/SC2DataManager';
6
+ import { WikifyTracerCallback } from '@scml/types/sugarcube-2-ModLoader/WikifyTracer';
6
7
  import { ModUtils } from '@scml/types/sugarcube-2-ModLoader/Utils';
7
8
  import { BrowserAPI } from '@scml/sc2-verlnir/src/browser';
8
9
  import { ConfigAPI } from '@scml/sc2-verlnir/src/config';
@@ -11,40 +12,269 @@ import { DialogAPI } from '@scml/sc2-verlnir/src/dialog';
11
12
  import { EngineAPI } from '@scml/sc2-verlnir/src/engine';
12
13
  import { FullscreenAPI } from '@scml/sc2-verlnir/src/fullscreen';
13
14
  import { HasAPI } from '@scml/sc2-verlnir/src/has';
14
- import { IdbAPI } from '@scml/sc2-verlnir/src/idb';
15
15
  import { L10nAPI } from '@scml/sc2-verlnir/src/l10n';
16
- import { LinksAPI } from '@scml/sc2-verlnir/src/links';
17
- import { LoadScreenAPI } from '@scml/sc2-verlnir/src/loadscreen';
18
16
  import { MacroAPI } from '@scml/sc2-verlnir/src/macro';
19
17
  import { PassageConstructor } from '@scml/sc2-verlnir/src/passage';
20
18
  import { SaveAPI } from '@scml/sc2-verlnir/src/save';
21
19
  import { ScriptingAPI } from '@scml/sc2-verlnir/src/scripting';
22
20
  import { SettingAPI } from '@scml/sc2-verlnir/src/setting';
23
21
  import { SimpleAudioAPI } from '@scml/sc2-verlnir/src/simpleaudio';
24
- import { SimpleStoreAPI, SimpleStoreInstanceAPI } from '@scml/sc2-verlnir/src/simplestore';
22
+ import { SimpleStoreInstanceAPI } from '@scml/sc2-verlnir/src/simplestore';
25
23
  import { StoryAPI } from '@scml/sc2-verlnir/src/story';
26
- import { TemplateAPI } from '@scml/sc2-verlnir/src/template';
27
24
  import { UIAPI } from '@scml/sc2-verlnir/src/ui';
28
25
  import { UIBarAPI } from '@scml/sc2-verlnir/src/uibar';
29
26
  import { UtilAPI } from '@scml/sc2-verlnir/src/util';
30
27
  import { VersionInfo } from '@scml/sc2-verlnir/src/version';
31
28
  import { VisibilityAPI } from '@scml/sc2-verlnir/src/visibility';
32
29
  import { WikifierAPI } from '@scml/sc2-verlnir/src/wikifier';
30
+ import { SugarCubeStoryVariables, SugarCubeTemporaryVariables } from 'twine-sugarcube/userdata';
33
31
  import { Gui } from '@scml/types/Mod_LoaderGui/Gui';
34
32
  import jsyaml from 'js-yaml';
35
33
  import { Howl, Howler } from 'howler';
36
34
  import * as marked from 'marked';
37
35
  import { MacroContext } from 'twine-sugarcube';
38
36
  //#endregion
37
+ //#region src/modules/Frameworks/Patches/Bodywriting.d.ts
38
+ interface BodywritingConfig {
39
+ writing?: string;
40
+ writ_cn?: string;
41
+ type?: 'text' | 'object';
42
+ arrow?: 0 | 1;
43
+ special?: string;
44
+ gender?: 'n' | 'f' | 'm' | 'h';
45
+ lewd?: 0 | 1;
46
+ degree?: number;
47
+ featSkip?: boolean;
48
+ sprites?: string[];
49
+ index?: number;
50
+ key?: string;
51
+ }
52
+ type BodywritingData =
53
+ | {
54
+ operation: 'add';
55
+ config: BodywritingConfig;
56
+ }
57
+ | {
58
+ operation: 'del';
59
+ };
60
+ type BodywritingItem = BodywritingConfig & {
61
+ index: number;
62
+ key: string;
63
+ };
64
+ declare class Bodywriting {
65
+ static add(key: string, config: BodywritingConfig): void;
66
+ static delete(key: string): void;
67
+ static apply(): void;
68
+ private static remove;
69
+ private static set;
70
+ }
71
+ //#endregion
72
+ //#region src/modules/Frameworks/Patches/Foodstuff.d.ts
73
+ type FoodstuffSeason = 'spring' | 'summer' | 'autumn' | 'winter';
74
+ type FoodstuffPlantingBed = 'earth' | 'water';
75
+ type FoodstuffStallSize = 'small' | 'large';
76
+ interface FoodstuffConfig {
77
+ key?: string;
78
+ index?: number;
79
+ is_fishing_bait?: boolean;
80
+ name?: string;
81
+ singular?: string;
82
+ plural?: string;
83
+ icon?: string;
84
+ category?: string;
85
+ kitchen_item_type_icon?: string;
86
+ prop_folder?: string;
87
+ ingredient_alternatives?: Partial<Record<'normal' | 'lewd', string[]>>;
88
+ tending?: {
89
+ planting_bed?: FoodstuffPlantingBed;
90
+ growth_days?: number;
91
+ featCost?: number;
92
+ yield_multiplier?: number;
93
+ has_seeds?: boolean;
94
+ seed_name?: string;
95
+ seasons?: FoodstuffSeason[];
96
+ affected_by_tending_skill?: boolean;
97
+ tags?: string[];
98
+ [key: string]: unknown;
99
+ };
100
+ shop?: {
101
+ sell_price?: number;
102
+ available_in?: string[];
103
+ bought_in_bulk?: number;
104
+ stall_size?: FoodstuffStallSize;
105
+ [key: string]: unknown;
106
+ };
107
+ recipe?: {
108
+ recipe_name?: string;
109
+ difficulty?: number;
110
+ cook_minutes?: number;
111
+ servings?: number;
112
+ ingredients?: string[];
113
+ ingredient_alternatives?: Partial<Record<'normal' | 'lewd', Record<string, string[]>>>;
114
+ tags?: string[];
115
+ [key: string]: unknown;
116
+ };
117
+ food?: {
118
+ handheld_gift?: boolean;
119
+ tags?: string[];
120
+ [key: string]: unknown;
121
+ };
122
+ [key: string]: unknown;
123
+ }
124
+ type FoodstuffItem = FoodstuffConfig & Required<Pick<FoodstuffConfig, 'index' | 'name' | 'singular' | 'plural' | 'icon' | 'category' | 'kitchen_item_type_icon' | 'prop_folder'>>;
125
+ declare class Foodstuff {
126
+ static add(key: string, config: FoodstuffConfig): void;
127
+ static apply(): void;
128
+ static syncState(): void;
129
+ static applySetup(): void;
130
+ private static set;
131
+ private static nextIndex;
132
+ private static sort;
133
+ private static ensureState;
134
+ }
135
+ //#endregion
136
+ //#region src/modules/Frameworks/Patches/Location.d.ts
137
+ interface LocationConfigOptions {
138
+ overwrite?: boolean;
139
+ layer?: string;
140
+ element?: string;
141
+ }
142
+ interface LocationElement {
143
+ condition?: () => boolean;
144
+ image?: string;
145
+ frame?: number | (() => number);
146
+ animation?: {
147
+ frameDelay?: number;
148
+ cycleDelay?: number | (() => number);
149
+ };
150
+ [key: string]: unknown;
151
+ }
152
+ interface LocationConfig extends LocationElement {
153
+ folder?: string;
154
+ base?: Record<string, LocationElement> | LocationElement;
155
+ emissive?: Record<string, LocationElement> | LocationElement;
156
+ reflective?: Record<string, LocationElement> | LocationElement;
157
+ layerTop?: Record<string, LocationElement> | LocationElement;
158
+ weather?: Record<string, unknown>;
159
+ particles?: Record<string, unknown>[];
160
+ customMapping?: () => string;
161
+ }
162
+ interface LocationUpdate {
163
+ overwrite: boolean;
164
+ config: LocationConfig;
165
+ customMapping: (() => string) | null;
166
+ }
167
+ declare class Location {
168
+ static configure(locationId: string, config: LocationConfig, options?: LocationConfigOptions): boolean;
169
+ static apply(): void;
170
+ }
171
+ //#endregion
172
+ //#region src/modules/Frameworks/Patches/Fishing.d.ts
173
+ type FishingLocation = 'fishingBeach' | 'fishingPier' | 'fishingCoastPath' | 'fishingForestLake' | 'fishingMoor';
174
+ type FishingSeason = 'spring' | 'summer' | 'autumn' | 'winter';
175
+ type FishBehavior = 'runner' | 'darter' | 'panicked' | 'anchor' | 'thrasher' | 'slipper';
176
+ interface FishConfig {
177
+ minSize: number;
178
+ maxSize: number;
179
+ locations: Partial<Record<FishingLocation, number>>;
180
+ icon: string;
181
+ preferredSeason?: FishingSeason[];
182
+ preferredLocation?: FishingLocation[];
183
+ preferredBait?: string;
184
+ cookable?: boolean;
185
+ requiresBaitFish?: boolean;
186
+ isBaitFish?: boolean;
187
+ minigame?: {
188
+ behavior: FishBehavior;
189
+ maxStamina: number;
190
+ armFatigueDifficulty: number;
191
+ };
192
+ foodstuff?: FoodstuffConfig;
193
+ }
194
+ type FishData = Omit<FishConfig, 'foodstuff'> & Required<Pick<FishConfig, 'preferredSeason' | 'preferredLocation' | 'cookable'>>;
195
+ declare class Fishing {
196
+ static addFish(key: string, config: FishConfig): boolean;
197
+ static addBait(key: string, config: FoodstuffConfig): void;
198
+ static configureLocation(location: FishingLocation, weights: Record<string, number>): boolean;
199
+ static apply(): void;
200
+ }
201
+ //#endregion
202
+ //#region src/modules/Frameworks/Patches/Antiques.d.ts
203
+ interface AntiqueConfig {
204
+ hint: string;
205
+ museum: string;
206
+ name: string;
207
+ cn_name?: string;
208
+ journal: string;
209
+ journalName?: string;
210
+ icon: string;
211
+ key?: string;
212
+ }
213
+ declare class Antiques {
214
+ static add(key: string, config: AntiqueConfig): void;
215
+ static inject(data: Record<string, AntiqueConfig>): Record<string, AntiqueConfig>;
216
+ static syncState(): void;
217
+ }
218
+ //#endregion
219
+ //#region src/modules/Frameworks/Patches/Traits.d.ts
220
+ interface TraitCategory {
221
+ title: string;
222
+ traits: Trait[];
223
+ }
224
+ interface Trait {
225
+ name: string;
226
+ colour: string;
227
+ has: boolean;
228
+ text: string;
229
+ }
230
+ interface TraitConfig {
231
+ title: string;
232
+ name: string | (() => string);
233
+ colour: string | (() => string);
234
+ has: boolean | (() => boolean);
235
+ text: string | (() => string);
236
+ }
237
+ declare class Traits {
238
+ static add(...traits: Partial<TraitConfig>[]): void;
239
+ static inject(data: TraitCategory[], translate: (text: string) => string): TraitCategory[];
240
+ private static resolve;
241
+ }
242
+ //#endregion
39
243
  //#region types/twine-sugarcube.d.ts
40
244
  declare module 'twine-sugarcube/userdata' {
41
245
  export interface SugarCubeSetupObject {
246
+ bodywriting: Record<string, BodywritingItem>;
247
+ bodywriting_namebyindex: (string | undefined)[];
248
+ foodstuff: Record<string, FoodstuffItem>;
249
+ LocationImages: Record<string, LocationConfig>;
250
+ Locations: Record<string, () => string>;
251
+ tips: Record<string, string[]>;
252
+ tipsList: string[];
253
+ fishing?: {
254
+ lootTables: {
255
+ fish: Record<string, FishData>;
256
+ };
257
+ };
42
258
  [x: string]: any;
43
259
  }
44
260
  export interface SugarCubeStoryVariables {
261
+ foodstuff: Record<
262
+ string,
263
+ {
264
+ amount: number;
265
+ [key: string]: unknown;
266
+ }
267
+ >;
268
+ museumAntiques?: {
269
+ antiques: Record<string, string>;
270
+ maxCount: number;
271
+ [key: string]: unknown;
272
+ };
45
273
  [x: string]: any;
46
274
  }
47
275
  export interface SugarCubeTemporaryVariables {
276
+ traitLists: TraitCategory[];
277
+ museumAntiqueText: Record<string, AntiqueConfig>;
48
278
  [x: string]: any;
49
279
  }
50
280
  }
@@ -139,8 +369,8 @@ interface DolStateAPI {
139
369
  play(...args: unknown[]): void;
140
370
  }
141
371
  interface DolSaveAPI extends SaveAPI {
142
- serialize(metadata?: any): string;
143
- deserialize(saveStr: string): any;
372
+ serialize(metadata?: unknown): string;
373
+ deserialize(saveStr: string): unknown;
144
374
  }
145
375
  type WikifierAPI$1 = WikifierAPI & {
146
376
  wikifyEval(
@@ -151,9 +381,7 @@ type WikifierAPI$1 = WikifierAPI & {
151
381
  passageTitle?: string
152
382
  ): DocumentFragment;
153
383
  };
154
- interface SugarCubeUtilAPI extends UtilAPI {
155
- [key: string]: any;
156
- }
384
+ type SugarCubeUtilAPI = UtilAPI;
157
385
  interface TwineSugarCube {
158
386
  Browser: BrowserAPI;
159
387
  Config: ConfigAPI;
@@ -162,25 +390,20 @@ interface TwineSugarCube {
162
390
  Fullscreen: FullscreenAPI;
163
391
  Has: HasAPI;
164
392
  L10n: L10nAPI;
165
- Links: LinksAPI;
166
- LoadScreen: LoadScreenAPI;
167
393
  Macro: MacroAPI;
168
394
  Passage: PassageConstructor;
169
395
  Save: DolSaveAPI;
170
396
  Scripting: ScriptingAPI;
171
397
  Setting: SettingAPI;
172
398
  SimpleAudio: SimpleAudioAPI;
173
- SimpleStore: SimpleStoreAPI;
174
399
  State: DolStateAPI;
175
400
  Story: StoryAPI;
176
- Template: TemplateAPI;
177
401
  UI: UIAPI;
178
402
  UIBar: UIBarAPI;
179
403
  DebugBar: DebugBarAPI;
180
404
  Util: SugarCubeUtilAPI;
181
405
  Visibility: VisibilityAPI;
182
406
  Wikifier: WikifierAPI$1;
183
- idb: IdbAPI;
184
407
  session: SimpleStoreInstanceAPI | null;
185
408
  settings: Record<string, unknown>;
186
409
  setup: Record<string, unknown>;
@@ -188,9 +411,9 @@ interface TwineSugarCube {
188
411
  version: VersionInfo;
189
412
  }
190
413
  declare global {
191
- const V: Record<string, any>;
414
+ const V: SugarCubeStoryVariables;
192
415
  const C: Record<string, any>;
193
- const T: Record<string, any>;
416
+ const T: SugarCubeTemporaryVariables;
194
417
  interface DateTimeData {
195
418
  year: number;
196
419
  month: number;
@@ -336,6 +559,21 @@ declare global {
336
559
  type CanvasLayerMap = Record<string, LayerConfig>;
337
560
  type CanvasLayerFilter = string | Record<string, any>;
338
561
  type CanvasLayerSrc = string | string[] | undefined;
562
+ type CanvasLayerMask =
563
+ | string
564
+ | {
565
+ path: string;
566
+ offsetX?: number;
567
+ offsetY?: number;
568
+ convert?: boolean;
569
+ };
570
+ type CanvasLayerMaskSrc = CanvasLayerMask | CanvasLayerMask[] | undefined;
571
+ interface CanvasLayerWorn {
572
+ slot: string;
573
+ integrity: string | number;
574
+ alt?: string;
575
+ index: number;
576
+ }
339
577
  type CanvasLayerValueFn<T = any> = (options: any) => T;
340
578
  interface CanvasModelOptionsData {
341
579
  filters?: Record<string, any>;
@@ -358,14 +596,14 @@ declare global {
358
596
  maskBlendMode?: string;
359
597
  compositeOperation?: string;
360
598
  desaturate?: boolean;
361
- masksrc?: CanvasLayerSrc;
599
+ masksrc?: CanvasLayerMaskSrc;
362
600
  animation?: any;
363
601
  filters?: CanvasLayerFilter[];
364
602
  dx?: number;
365
603
  dy?: number;
366
604
  width?: number;
367
605
  height?: number;
368
- worn?: string;
606
+ worn?: CanvasLayerWorn;
369
607
  scale?: boolean | number;
370
608
  frameDx?: number;
371
609
  frameDy?: number;
@@ -381,14 +619,14 @@ declare global {
381
619
  maskBlendModefn?: CanvasLayerValueFn<string | undefined>;
382
620
  compositeOperationfn?: CanvasLayerValueFn<string | undefined>;
383
621
  desaturatefn?: CanvasLayerValueFn<boolean>;
384
- masksrcfn?: CanvasLayerValueFn<CanvasLayerSrc>;
622
+ masksrcfn?: CanvasLayerValueFn<CanvasLayerMaskSrc>;
385
623
  animationfn?: CanvasLayerValueFn<any>;
386
624
  filtersfn?: CanvasLayerValueFn<CanvasLayerFilter[] | undefined>;
387
625
  dxfn?: CanvasLayerValueFn<number>;
388
626
  dyfn?: CanvasLayerValueFn<number>;
389
627
  widthfn?: CanvasLayerValueFn<number>;
390
628
  heightfn?: CanvasLayerValueFn<number>;
391
- wornfn?: CanvasLayerValueFn<string | undefined>;
629
+ wornfn?: CanvasLayerValueFn<CanvasLayerWorn | undefined>;
392
630
  scalefn?: CanvasLayerValueFn<boolean | number | undefined>;
393
631
  [key: string]: any;
394
632
  }
@@ -447,17 +685,46 @@ declare global {
447
685
  //#region src/constants.d.ts
448
686
  type LanguageCode = (typeof Languages)[number];
449
687
  declare const Languages: readonly ['EN', 'CN'];
688
+ declare enum ModuleState {
689
+ REGISTERED = 0,
690
+ MOUNTED = 1,
691
+ ERROR = 2,
692
+ EXPOSED = 3,
693
+ DISABLED = 4
694
+ }
450
695
  //#endregion
451
696
  //#region src/utils/object.d.ts
452
- type MergeFilterFn = (key: string, value: any, depth: number, targetValue: any) => boolean;
453
- declare function clone(source: any, deep?: boolean, proto?: boolean, map?: WeakMap<object, any>): any;
454
- declare function equal(a: any, b: any): boolean;
455
- declare function merge(target: any, ...sources: any[]): any;
456
- declare function append(target: any, ...sources: any[]): any;
457
- declare function cover(target: any, ...sources: any[]): any;
458
- declare function mergeFn(target: any, filterFn: MergeFilterFn | null, ...sources: any[]): any;
459
- declare function appendFn(target: any, filterFn: MergeFilterFn | null, ...sources: any[]): any;
460
- declare function coverFn(target: any, filterFn: MergeFilterFn | null, ...sources: any[]): any;
697
+ type MergeMode = 'replace' | 'concat' | 'merge';
698
+ type MergeFilterFn = (key: string, value: unknown, depth: number, targetValue: unknown) => boolean;
699
+ type MergeTuple<T extends readonly unknown[], S extends readonly unknown[]> = S extends readonly [infer Head, ...infer Rest]
700
+ ? T extends readonly [infer Previous, ...infer Tail]
701
+ ? [Merged<Previous, Head, 'merge'>, ...MergeTuple<Tail, Rest>]
702
+ : [...S]
703
+ : [...T];
704
+ type Merged<T, S, Mode extends MergeMode> = S extends readonly unknown[]
705
+ ? T extends readonly unknown[]
706
+ ? Mode extends 'replace'
707
+ ? [...S]
708
+ : Mode extends 'concat'
709
+ ? [...T, ...S]
710
+ : number extends T['length'] | S['length']
711
+ ? (T[number] | S[number])[]
712
+ : MergeTuple<T, S>
713
+ : [...S]
714
+ : S extends Record<string, unknown>
715
+ ? Omit<T, keyof S> & { [Key in keyof S]: Key extends keyof T ? Merged<T[Key], S[Key], Mode> : S[Key] }
716
+ : S;
717
+ type MergeResult<T, Sources extends readonly unknown[], Mode extends MergeMode = 'merge'> = Sources extends readonly [infer Source, ...infer Rest]
718
+ ? MergeResult<Merged<T, Source, Mode>, Rest, Mode>
719
+ : T;
720
+ declare function clone<T>(source: T, deep?: boolean, proto?: boolean, map?: WeakMap<object, unknown>): T;
721
+ declare function equal(a: unknown, b: unknown): boolean;
722
+ declare function merge<T, Sources extends unknown[]>(target: T, ...sources: Sources): MergeResult<T, Sources>;
723
+ declare function append<T, Sources extends unknown[]>(target: T, ...sources: Sources): MergeResult<T, Sources, 'concat'>;
724
+ declare function cover<T, Sources extends unknown[]>(target: T, ...sources: Sources): MergeResult<T, Sources, 'replace'>;
725
+ declare function mergeFn<T, Sources extends unknown[]>(target: T, filter: MergeFilterFn | null, ...sources: Sources): MergeResult<T, Sources>;
726
+ declare function appendFn<T, Sources extends unknown[]>(target: T, filter: MergeFilterFn | null, ...sources: Sources): MergeResult<T, Sources, 'concat'>;
727
+ declare function coverFn<T, Sources extends unknown[]>(target: T, filter: MergeFilterFn | null, ...sources: Sources): MergeResult<T, Sources, 'replace'>;
461
728
  //#endregion
462
729
  //#region src/utils/array.d.ts
463
730
  type ContainsMode = 'all' | 'any' | 'none';
@@ -469,7 +736,7 @@ type ContainsOptions = {
469
736
  declare function contains(array: readonly unknown[], value: unknown, mode?: ContainsMode, options?: ContainsOptions): boolean;
470
737
  declare function randomNumber(min?: number, max?: number, float?: boolean): number;
471
738
  declare function randomPick<T>(items: readonly T[], weights?: readonly number[] | null, allowNull?: boolean): T | null | undefined;
472
- declare function clamp(value: any, min: number, max: number, fallback?: number): number;
739
+ declare function clamp(value: unknown, min: number, max: number, fallback?: number): number;
473
740
  //#endregion
474
741
  //#region src/utils/string.d.ts
475
742
  type ConvertMode$1 = 'lower' | 'upper' | 'capitalize' | 'title' | 'camel' | 'pascal' | 'snake' | 'kebab' | 'constant';
@@ -488,7 +755,7 @@ declare function widgets(...contents: string[]): string[];
488
755
  //#region src/utils/binary.d.ts
489
756
  declare function textToBytes(value: string): Uint8Array;
490
757
  declare function jsonToBytes(value: unknown): Uint8Array;
491
- declare function bytesToJson<T = any>(bytes: Uint8Array | ArrayBuffer): T;
758
+ declare function bytesToJson<T = unknown>(bytes: Uint8Array | ArrayBuffer): T;
492
759
  declare function toArrayBuffer(bytes: Uint8Array): ArrayBuffer;
493
760
  declare function bytesToBase64(bytes: Uint8Array): string;
494
761
  declare function base64ToBytes(value: string): Uint8Array;
@@ -498,46 +765,51 @@ declare function basicAuth(username: string, password: string): string;
498
765
  //#region src/utils/path.d.ts
499
766
  declare function joinEncodedPath(...parts: string[]): string;
500
767
  //#endregion
768
+ //#region src/utils/error.d.ts
769
+ declare function errorMessage(error: unknown): string;
770
+ //#endregion
501
771
  //#region src/utils/selector.d.ts
502
- declare class SelectCase {
503
- private cases;
772
+ type Comparator = '<' | '<=' | '>' | '>=';
773
+ type ResultValue<Input, Result, Meta> = Result | ((input: Input, meta: Meta) => Result);
774
+ declare class SelectCase<Input = unknown, Result = unknown, Meta = Record<string, unknown>> {
775
+ private readonly cases;
504
776
  private defaultResult;
505
777
  private valueType;
506
778
  private allowMixedTypes;
507
- case(condition: string | number, result: any): this;
508
- case(condition: (input: any, meta?: any) => boolean, result: any): this;
509
- casePredicate(fn: (input: any, meta?: any) => boolean, result: any): this;
510
- caseRange(min: number, max: number, result: any): this;
511
- caseIn(values: any[], result: any): this;
512
- caseIncludes(values: string | string[], result: any): this;
513
- caseRegex(regex: RegExp, result: any): this;
514
- caseCompare(operator: '<' | '<=' | '>' | '>=', value: number, result: any): this;
515
- else(result: any): this;
516
- match(input: any, meta?: any): any;
779
+ case(condition: string | number | ((input: Input, meta: Meta) => boolean), result: ResultValue<Input, Result, Meta>): this;
780
+ casePredicate(fn: (input: Input, meta: Meta) => boolean, result: ResultValue<Input, Result, Meta>): this;
781
+ caseRange(min: number, max: number, result: ResultValue<Input, Result, Meta>): this;
782
+ caseIn(values: readonly (string | number)[], result: ResultValue<Input, Result, Meta>): this;
783
+ caseIncludes(values: string | readonly string[], result: ResultValue<Input, Result, Meta>): this;
784
+ caseRegex(regex: RegExp, result: ResultValue<Input, Result, Meta>): this;
785
+ caseCompare(operator: Comparator, value: number, result: ResultValue<Input, Result, Meta>): this;
786
+ else(result: ResultValue<Input, Result, Meta>): this;
787
+ match(input: Input, meta?: Meta): Result | null;
788
+ private resolve;
517
789
  private validateType;
518
790
  }
519
791
  //#endregion
520
792
  //#region src/utils/image.d.ts
521
- declare function loadImage(src: string): string | boolean | Promise<string | boolean>;
793
+ declare function loadImage(src: string): string | false | Promise<string | false>;
522
794
  //#endregion
523
795
  //#region src/utils/prototype.d.ts
524
796
  declare global {
525
797
  interface ObjectConstructor {
526
- merge<T extends object = any>(...sources: any[]): T;
527
- append<T extends object = any>(...sources: any[]): T;
528
- cover<T extends object = any>(...sources: any[]): T;
529
- mergefn<T extends object = any>(filterFn: MergeFilterFn | null, ...sources: any[]): T;
530
- appendfn<T extends object = any>(filterFn: MergeFilterFn | null, ...sources: any[]): T;
531
- coverfn<T extends object = any>(filterFn: MergeFilterFn | null, ...sources: any[]): T;
798
+ merge<T extends object = Record<string, unknown>>(...sources: unknown[]): T;
799
+ append<T extends object = Record<string, unknown>>(...sources: unknown[]): T;
800
+ cover<T extends object = Record<string, unknown>>(...sources: unknown[]): T;
801
+ mergefn<T extends object = Record<string, unknown>>(filterFn: MergeFilterFn | null, ...sources: unknown[]): T;
802
+ appendfn<T extends object = Record<string, unknown>>(filterFn: MergeFilterFn | null, ...sources: unknown[]): T;
803
+ coverfn<T extends object = Record<string, unknown>>(filterFn: MergeFilterFn | null, ...sources: unknown[]): T;
532
804
  }
533
805
  interface Array<T> {
534
806
  contains(value: unknown, mode?: ContainsMode, options?: ContainsOptions): boolean;
535
807
  either(weights?: number[], allowNull?: boolean): T | null | undefined;
536
808
  }
537
809
  interface ArrayConstructor {
538
- merge<T = any>(...sources: any[]): T[];
539
- append<T = any>(...sources: any[]): T[];
540
- cover<T = any>(...sources: any[]): T[];
810
+ merge<T>(...sources: readonly T[][]): T[];
811
+ append<T>(...sources: readonly T[][]): T[];
812
+ cover<T>(...sources: readonly T[][]): T[];
541
813
  }
542
814
  interface ReadonlyArray<T> {
543
815
  contains(value: unknown, mode?: ContainsMode, options?: ContainsOptions): boolean;
@@ -562,7 +834,7 @@ declare global {
562
834
  random(): number;
563
835
  random(max: number): number;
564
836
  random(min: number, max: number, float?: boolean): number;
565
- clamp(value: any, min: number, max: number, fallback?: number): number;
837
+ clamp(value: unknown, min: number, max: number, fallback?: number): number;
566
838
  }
567
839
  }
568
840
  declare function prototypeUtils(): void;
@@ -584,6 +856,7 @@ declare namespace index_d_exports {
584
856
  coverFn as coverfn,
585
857
  randomPick as either,
586
858
  equal,
859
+ errorMessage,
587
860
  escapeHtmlText,
588
861
  joinEncodedPath,
589
862
  jsonToBytes,
@@ -630,21 +903,23 @@ declare class Logger {
630
903
  }
631
904
  //#endregion
632
905
  //#region src/services/EventEmitter.d.ts
633
- type EventCallback = (...args: any[]) => unknown;
906
+ type EventCallback<Args extends unknown[] = unknown[]> = (...args: Args) => unknown;
634
907
  declare class EventEmitter {
635
908
  readonly core: MaplebirchCore;
636
909
  private readonly events;
637
910
  private readonly afters;
911
+ private readonly triggering;
638
912
  private readonly stickyEvents;
639
913
  private readonly stickyArgs;
914
+ private readonly synchronousEvents;
640
915
  constructor(core: MaplebirchCore);
641
- on(eventName: string, callback: EventCallback, description?: string): boolean;
642
- off(eventName: string, identifier: EventCallback | string): boolean;
643
- once(eventName: string, callback: EventCallback, description?: string): boolean;
644
- trigger(eventName: string, ...args: any[]): Promise<void>;
645
- after(eventName: string, callback: EventCallback): void;
916
+ on<Args extends unknown[]>(eventName: string, callback: EventCallback<Args>, description?: string): boolean;
917
+ off<Args extends unknown[]>(eventName: string, identifier: EventCallback<Args> | string): boolean;
918
+ once<Args extends unknown[]>(eventName: string, callback: EventCallback<Args>, description?: string): boolean;
919
+ trigger(eventName: string, ...args: unknown[]): Promise<void>;
920
+ after<Args extends unknown[]>(eventName: string, callback: EventCallback<Args>): void;
921
+ private pending;
646
922
  private callSticky;
647
- private error;
648
923
  }
649
924
  //#endregion
650
925
  //#region node_modules/idb/build/entry.d.ts
@@ -1341,7 +1616,6 @@ declare class IndexedDBService {
1341
1616
  withTransaction<T, Mode extends IDBTransactionMode>(storeNames: string | string[], mode: Mode, callback: (tx: Transaction<Mode>) => T | Promise<T>): Promise<T>;
1342
1617
  clearStore(storeName: string): Promise<void>;
1343
1618
  deleteDatabase(): Promise<boolean>;
1344
- private error;
1345
1619
  }
1346
1620
  //#endregion
1347
1621
  //#region src/services/CloudSaveService.d.ts
@@ -1350,11 +1624,12 @@ type PanelAction = 'connectRemote' | 'uploadSlot' | 'downloadSlot' | 'refreshRem
1350
1624
  interface CloudSaveConfig {
1351
1625
  endpoint: string;
1352
1626
  token: string;
1627
+ remember?: boolean;
1353
1628
  }
1354
1629
  interface CloudSaveRecord {
1355
1630
  slot: CloudSaveSlot;
1356
- details: any;
1357
- save: any;
1631
+ details: SaveDetails | null;
1632
+ save: SaveState;
1358
1633
  exportedAt: number;
1359
1634
  gameId?: string;
1360
1635
  }
@@ -1372,10 +1647,28 @@ interface CloudSaveRemoteCode {
1372
1647
  updatedAt: number;
1373
1648
  payload?: CloudSaveCodeRecord;
1374
1649
  }
1650
+ interface SaveDetails {
1651
+ date?: number;
1652
+ title?: string;
1653
+ idx?: unknown;
1654
+ metadata?: {
1655
+ saveName?: string;
1656
+ [key: string]: unknown;
1657
+ };
1658
+ [key: string]: unknown;
1659
+ }
1660
+ interface SaveState {
1661
+ history?: DolStateMoment[];
1662
+ delta?: unknown;
1663
+ [key: string]: unknown;
1664
+ }
1375
1665
  declare class CloudSaveService {
1376
1666
  readonly core: MaplebirchCore;
1377
1667
  private static readonly PANEL_STORAGE_KEY;
1668
+ private static readonly REQUEST_TIMEOUT;
1378
1669
  private config;
1670
+ private mountFrame;
1671
+ private busy;
1379
1672
  constructor(core: MaplebirchCore);
1380
1673
  configure(config: CloudSaveConfig): this;
1381
1674
  /** 验证 Worker 与 Token 是否可用。 */
@@ -1408,6 +1701,7 @@ declare class CloudSaveService {
1408
1701
  panelAction(action: PanelAction, slot?: CloudSaveSlot): Promise<void>;
1409
1702
  private runPanelAction;
1410
1703
  private done;
1704
+ private complete;
1411
1705
  private refreshPanel;
1412
1706
  private remoteRow;
1413
1707
  private readPanel;
@@ -1417,11 +1711,18 @@ declare class CloudSaveService {
1417
1711
  private request;
1418
1712
  /** SugarCube delta 存档还原为完整 history。 */
1419
1713
  private normalizeSave;
1714
+ private validateRecord;
1715
+ private validateCodeRecord;
1716
+ private isSlot;
1717
+ private validateSlot;
1718
+ private validateGame;
1719
+ private invalidResponse;
1420
1720
  private field;
1421
1721
  private setField;
1422
1722
  private panelSlot;
1723
+ /** 动态填充本地存档槽位选项。 */
1724
+ populateSlotOptions(panel?: HTMLElement | null): Promise<void>;
1423
1725
  private status;
1424
- private error;
1425
1726
  private get saveDB();
1426
1727
  private get panel();
1427
1728
  private get current();
@@ -1466,6 +1767,8 @@ declare class LanguageManager {
1466
1767
  private writeBatch;
1467
1768
  private removeOldTranslations;
1468
1769
  private updateSource;
1770
+ private activeSources;
1771
+ private visibleTranslations;
1469
1772
  private syncTranslation;
1470
1773
  private readFileRecord;
1471
1774
  private writeFileRecord;
@@ -1474,7 +1777,6 @@ declare class LanguageManager {
1474
1777
  private computeHash;
1475
1778
  private getModFile;
1476
1779
  private rebuild;
1477
- private error;
1478
1780
  }
1479
1781
  //#endregion
1480
1782
  //#region src/services/ModuleSystem.d.ts
@@ -1485,11 +1787,10 @@ interface Module {
1485
1787
  Init?(): void;
1486
1788
  loadInit?(): void;
1487
1789
  postInit?(): void;
1488
- [key: string]: unknown;
1489
1790
  }
1490
1791
  interface ModuleRegistry {
1491
1792
  modules: Map<string, Module>;
1492
- states: Map<string, string | number>;
1793
+ states: Map<string, ModuleState>;
1493
1794
  sources: Map<string, string>;
1494
1795
  dependencies: Map<string, Set<string>>;
1495
1796
  dependents: Map<string, Set<string>>;
@@ -1524,7 +1825,7 @@ declare class ModuleSystem {
1524
1825
  constructor(core: MaplebirchCore);
1525
1826
  static traverse(roots: Iterable<string>, links: ReadonlyMap<string, Iterable<string>>, excluded?: ReadonlySet<string>): Set<string>;
1526
1827
  with<T>(source: string, callback: () => T | Promise<T>): Promise<T>;
1527
- register(name: string, module: Module, dependencies?: string[]): boolean;
1828
+ register<T extends object>(name: string, module: T & Module, dependencies?: string[]): boolean;
1528
1829
  get(name: string): Module | undefined;
1529
1830
  get dependencyGraph(): DependencyGraph;
1530
1831
  run(phase: 'pre'): Promise<void>;
@@ -1543,7 +1844,6 @@ declare class ModuleSystem {
1543
1844
  private circular;
1544
1845
  private lifecycle;
1545
1846
  private promiseLike;
1546
- private error;
1547
1847
  }
1548
1848
  //#endregion
1549
1849
  //#region src/services/GUIControl.d.ts
@@ -1584,31 +1884,49 @@ declare class GUIControl {
1584
1884
  private whenCreate;
1585
1885
  }
1586
1886
  //#endregion
1887
+ //#region src/modules/Addon/Save.d.ts
1888
+ interface SaveObject {
1889
+ state: {
1890
+ history: DolStateMoment[];
1891
+ index?: number;
1892
+ [key: string]: unknown;
1893
+ };
1894
+ [key: string]: unknown;
1895
+ }
1896
+ declare class Save {
1897
+ private readonly state;
1898
+ readonly details?: unknown;
1899
+ readonly saveObj: SaveObject;
1900
+ constructor(state: DolStateAPI, saveObj: unknown, details?: unknown);
1901
+ get V(): Record<string, unknown>;
1902
+ use<T>(variables: Record<string, unknown>, callback: () => T): T;
1903
+ }
1904
+ //#endregion
1587
1905
  //#region src/modules/TimeStateWeather/Event.d.ts
1588
1906
  interface EventOptions {
1589
1907
  priority?: number;
1590
1908
  once?: boolean;
1591
1909
  }
1910
+ declare abstract class Event {
1911
+ readonly id: string;
1912
+ readonly priority: number;
1913
+ readonly once: boolean;
1914
+ protected abstract readonly eventName: string;
1915
+ protected constructor(id: string, options?: EventOptions);
1916
+ protected evaluate<T extends unknown[]>(label: string, callback: (...args: T) => boolean, ...args: T): boolean;
1917
+ protected invoke<T extends unknown[]>(label: string, callback: ((...args: T) => void) | undefined, ...args: T): void;
1918
+ }
1592
1919
  //#endregion
1593
1920
  //#region src/modules/TimeStateWeather/TimeEvents.d.ts
1594
1921
  type TimeEventType = 'onSec' | 'onMin' | 'onHour' | 'onDay' | 'onWeek' | 'onMonth' | 'onYear' | 'onBefore' | 'onThread' | 'onAfter' | 'onTimeTravel';
1595
1922
  type TimeUnit = 'sec' | 'min' | 'hour' | 'day' | 'week' | 'month' | 'year';
1596
- interface DateLike {
1597
- hour: number;
1598
- day: number;
1599
- month: number;
1600
- year: number;
1601
- timeStamp: number;
1602
- minute?: number;
1603
- second?: number;
1604
- }
1605
1923
  interface AccumulateConfig {
1606
1924
  unit: TimeUnit;
1607
1925
  target?: number;
1608
1926
  }
1609
1927
  interface TimeData {
1610
- prevDate?: DateLike;
1611
- currentDate?: DateLike;
1928
+ prevDate?: DateTime;
1929
+ currentDate?: DateTime;
1612
1930
  changes?: Record<TimeUnit, number>;
1613
1931
  triggeredByAccumulator?: {
1614
1932
  unit: TimeUnit;
@@ -1616,6 +1934,7 @@ interface TimeData {
1616
1934
  count: number;
1617
1935
  };
1618
1936
  exactPoints?: {
1937
+ min: boolean;
1619
1938
  hour: boolean;
1620
1939
  day: boolean;
1621
1940
  week: boolean;
@@ -1631,7 +1950,7 @@ interface TimeData {
1631
1950
  month?: number;
1632
1951
  year?: number;
1633
1952
  weekday?: [number, number];
1634
- detailedDiff?: any;
1953
+ detailedDiff?: ReturnType<DateTime['compareWith']>;
1635
1954
  timeStamp?: number;
1636
1955
  prev?: DateTime;
1637
1956
  current?: DateTime;
@@ -1660,12 +1979,29 @@ interface TimeTravelOptions {
1660
1979
  addMinutes?: number;
1661
1980
  addSeconds?: number;
1662
1981
  }
1982
+ declare class TimeEvent extends Event {
1983
+ readonly type: TimeEventType;
1984
+ protected readonly eventName = 'TimeEvent';
1985
+ private action?;
1986
+ private cond;
1987
+ private exact;
1988
+ private accumulate?;
1989
+ private accumulated;
1990
+ private target;
1991
+ constructor(id: string, type: TimeEventType, options?: TimeEventOptions);
1992
+ tryRun(data: TimeData, accumulatedOnly?: boolean): boolean;
1993
+ private runAccumulated;
1994
+ private execute;
1995
+ private match;
1996
+ private runAction;
1997
+ private isExactPoint;
1998
+ }
1663
1999
  declare class TimeManager {
1664
2000
  private readonly manager;
1665
2001
  private readonly eventTypes;
1666
2002
  private readonly timeEvents;
1667
2003
  private readonly sortedEventsCache;
1668
- readonly log: (message: string, level?: string, ...objects: any[]) => void;
2004
+ readonly log: DynamicManager['log'];
1669
2005
  readonly TimeConstants: Readonly<{
1670
2006
  secondsPerDay: 86400;
1671
2007
  secondsPerHour: 3600;
@@ -1694,6 +2030,7 @@ declare class TimeManager {
1694
2030
  }>;
1695
2031
  }>;
1696
2032
  constructor(manager: DynamicManager);
2033
+ get events(): Readonly<Record<string, ReadonlyMap<string, TimeEvent>>>;
1697
2034
  init(): void;
1698
2035
  patchDateTime(DateTimeClass: typeof DateTime): typeof DateTime;
1699
2036
  patchTime(TimeObject: typeof Time): void;
@@ -1721,11 +2058,31 @@ interface StateEventOptions extends EventOptions {
1721
2058
  match?: RegExp;
1722
2059
  };
1723
2060
  }
2061
+ interface StateEventResult {
2062
+ hasOutput: boolean;
2063
+ remove: boolean;
2064
+ }
2065
+ declare class StateEvent extends Event {
2066
+ readonly type: 'gate' | 'append';
2067
+ protected readonly eventName = 'StateEvent';
2068
+ output?: string;
2069
+ private action?;
2070
+ private cond;
2071
+ private forceExit;
2072
+ private extra;
2073
+ constructor(id: string, type: 'gate' | 'append', options?: StateEventOptions);
2074
+ private checkPassage;
2075
+ tryRun(passageName?: string): StateEventResult | null;
2076
+ private match;
2077
+ private runAction;
2078
+ shouldForceExit(): boolean;
2079
+ }
1724
2080
  declare class StateManager {
1725
2081
  private readonly manager;
1726
2082
  private readonly stateEvents;
1727
2083
  private readonly log;
1728
2084
  constructor(manager: DynamicManager);
2085
+ get events(): Readonly<Record<'gate' | 'append', ReadonlyMap<string, StateEvent>>>;
1729
2086
  trigger(type: 'gate' | 'append'): string;
1730
2087
  private processGateEvents;
1731
2088
  private processAppendEvents;
@@ -1800,11 +2157,11 @@ declare class DynamicManager {
1800
2157
  regTimeEvent(type: TimeEventType, eventId: string, options: TimeEventOptions): boolean;
1801
2158
  delTimeEvent(type: TimeEventType, eventId: string): boolean;
1802
2159
  timeTravel(options?: TimeTravelOptions): boolean;
1803
- get TimeEvents(): any;
2160
+ get TimeEvents(): TimeManager['events'];
1804
2161
  regStateEvent(type: 'gate' | 'append', eventId: string, options: StateEventOptions): boolean;
1805
2162
  delStateEvent(type: 'gate' | 'append', eventId: string): boolean;
1806
2163
  trigger(type: 'gate' | 'append'): string;
1807
- get StateEvents(): any;
2164
+ get StateEvents(): StateManager['events'];
1808
2165
  regWeatherEvent(eventId: string, options: WeatherEventOptions): boolean;
1809
2166
  delWeatherEvent(eventId: string): boolean;
1810
2167
  addWeather(data: WeatherException | WeatherTypeConfig): boolean | void;
@@ -1876,30 +2233,30 @@ declare class CheatConsole {
1876
2233
  interface Step {
1877
2234
  from: string;
1878
2235
  to: string;
1879
- apply: (data: Record<string, any>, utils: Utils) => void;
2236
+ apply: (data: Record<string, unknown>, utils: Utils) => void;
1880
2237
  }
1881
2238
  interface PathRef {
1882
- parent: Record<string, any>;
2239
+ parent: Record<string, unknown>;
1883
2240
  key: string;
1884
2241
  }
1885
2242
  interface Utils {
1886
2243
  readonly log: ReturnType<typeof createlog>;
1887
- path: (obj: Record<string, any>, path: string, create?: boolean) => PathRef | null;
1888
- move: (data: Record<string, any>, from: string, to: string) => boolean;
1889
- remove: (data: Record<string, any>, path: string) => boolean;
1890
- transform: (data: Record<string, any>, path: string, fn: (value: any) => any) => boolean;
1891
- fill: (target: Record<string, any>, defaults: Record<string, any>, mode?: 'merge' | 'cover') => void;
2244
+ path: (obj: Record<string, unknown>, path: string, create?: boolean) => PathRef | null;
2245
+ move: (data: Record<string, unknown>, from: string, to: string) => boolean;
2246
+ remove: (data: Record<string, unknown>, path: string) => boolean;
2247
+ transform: (data: Record<string, unknown>, path: string, fn: (value: unknown) => unknown) => boolean;
2248
+ fill: (target: Record<string, unknown>, defaults: Record<string, unknown>, mode?: 'merge' | 'cover') => void;
1892
2249
  }
1893
2250
  declare class migration {
1894
- static readonly log: (message: string, level?: string, ...objects: any[]) => void;
2251
+ static readonly log: (message: string, level?: string, ...objects: unknown[]) => void;
1895
2252
  static create(): migration;
1896
- readonly log: (message: string, level?: string, ...objects: any[]) => void;
2253
+ readonly log: (message: string, level?: string, ...objects: unknown[]) => void;
1897
2254
  readonly utils: Utils;
1898
2255
  steps: Step[];
1899
2256
  private readonly unsafeKeys;
1900
2257
  constructor();
1901
2258
  add(from: string, to: string, apply: Step['apply']): void;
1902
- run(data: Record<string, any>, targetVersion: string): void;
2259
+ run(data: Record<string, unknown>, targetVersion: string): void;
1903
2260
  private path;
1904
2261
  private move;
1905
2262
  private compare;
@@ -1912,9 +2269,9 @@ interface RandState {
1912
2269
  index: number;
1913
2270
  }
1914
2271
  declare class randSystem {
1915
- static readonly log: (message: string, level?: string, ...objects: any[]) => void;
2272
+ static readonly log: (message: string, level?: string, ...objects: unknown[]) => void;
1916
2273
  static create(state?: Partial<RandState>): randSystem;
1917
- readonly log: (message: string, level?: string, ...objects: any[]) => void;
2274
+ readonly log: (message: string, level?: string, ...objects: unknown[]) => void;
1918
2275
  readonly state: RandState;
1919
2276
  private readonly maxHistory;
1920
2277
  private readonly modulus;
@@ -1935,16 +2292,23 @@ declare class randSystem {
1935
2292
  //#region src/macros/helpers.d.ts
1936
2293
  declare const CONVERT_MODES: readonly ['lower', 'upper', 'capitalize', 'title', 'camel', 'pascal', 'snake', 'kebab', 'constant'];
1937
2294
  type ConvertMode = (typeof CONVERT_MODES)[number];
2295
+ type MacroArgs = unknown[] & {
2296
+ full?: string;
2297
+ raw?: string;
2298
+ };
1938
2299
  interface MacroPayload {
1939
2300
  name: string;
1940
- args: any;
2301
+ args: MacroArgs;
1941
2302
  contents?: string;
1942
2303
  }
1943
- interface MacroContext$1 extends Omit<MacroContext, 'createShadowWrapper' | 'error' | 'payload'> {
2304
+ interface MacroContext$1 extends Omit<MacroContext, 'args' | 'createShadowWrapper' | 'error' | 'payload'> {
2305
+ args: MacroArgs;
1944
2306
  payload?: MacroPayload[] | null;
1945
- error(msg: string): any;
1946
- createShadowWrapper(callback: Function, doneCallback?: Function, startCallback?: Function): (...args: any[]) => void;
1947
- passageObj?: any;
2307
+ error(msg: string): void;
2308
+ createShadowWrapper(callback: (...args: never[]) => unknown, doneCallback?: (...args: never[]) => unknown, startCallback?: (...args: never[]) => unknown): (...args: unknown[]) => void;
2309
+ passageObj?: {
2310
+ title: string;
2311
+ };
1948
2312
  lanListboxCache?: Record<
1949
2313
  string,
1950
2314
  {
@@ -1955,16 +2319,16 @@ interface MacroContext$1 extends Omit<MacroContext, 'createShadowWrapper' | 'err
1955
2319
  }
1956
2320
  interface ListboxOption {
1957
2321
  label: string;
1958
- value: any;
2322
+ value: unknown;
1959
2323
  type: 'static' | 'dynamic';
1960
2324
  exprIndex?: number;
1961
2325
  convertMode: ConvertMode | null;
1962
2326
  }
1963
2327
  //#endregion
1964
2328
  //#region src/modules/Frameworks/macros.d.ts
1965
- type MacroFunction = (this: MacroContext$1, ...args: any[]) => any;
1966
- type SimpleMacroFunction = (this: MacroContext$1 | null, ...args: any[]) => any;
1967
- type StatFunction = (...args: any[]) => DocumentFragment;
2329
+ type MacroFunction<Args extends unknown[] = unknown[]> = (this: MacroContext$1, ...args: Args) => unknown;
2330
+ type SimpleMacroFunction<Args extends unknown[]> = (this: MacroContext$1 | null, ...args: Args) => unknown;
2331
+ type StatFunction<Args extends unknown[] = unknown[]> = (...args: Args) => DocumentFragment;
1968
2332
  type MacroTags = string[] | null | undefined;
1969
2333
  type SkipArgs = string[] | boolean | null | undefined;
1970
2334
  declare class defineMacros {
@@ -1974,23 +2338,32 @@ declare class defineMacros {
1974
2338
  readonly statFunctions: Record<string, StatFunction>;
1975
2339
  constructor(manager: ToolCollection);
1976
2340
  get Macro(): MaplebirchCore['SugarCube']['Macro'];
1977
- define(macroName: string, macroFunction: MacroFunction, tags?: MacroTags, skipArgs?: SkipArgs, isAsync?: boolean): void;
1978
- defineS(macroName: string, macroFunction: SimpleMacroFunction, tags?: MacroTags, skipArgs?: SkipArgs, maintainContext?: boolean): void;
2341
+ define<Args extends unknown[]>(macroName: string, macroFunction: MacroFunction<Args>, tags?: MacroTags, skipArgs?: SkipArgs, isAsync?: boolean): void;
2342
+ defineS<Args extends unknown[]>(macroName: string, macroFunction: SimpleMacroFunction<Args>, tags?: MacroTags, skipArgs?: SkipArgs, maintainContext?: boolean): void;
1979
2343
  statChange(statType: string, amount: number, colorClass: string, condition?: () => boolean): DocumentFragment;
1980
2344
  grace(amount: number, expectedRank?: string): DocumentFragment;
1981
- create(name: string, fn: StatFunction): void;
1982
- callStatFunction(name: string, ...args: any[]): DocumentFragment;
2345
+ create<Args extends unknown[]>(name: string, fn: StatFunction<Args>): void;
2346
+ callStatFunction(name: string, ...args: unknown[]): DocumentFragment;
1983
2347
  }
1984
2348
  //#endregion
1985
2349
  //#region src/modules/Frameworks/HtmlTools.d.ts
2350
+ type HtmlRoot = Element | DocumentFragment;
2351
+ interface TextContext {
2352
+ readonly macro?: MacroContext$1;
2353
+ readonly args?: readonly unknown[];
2354
+ readonly name?: string;
2355
+ readonly widgetName?: string;
2356
+ readonly passageTitle?: string;
2357
+ readonly [key: string]: unknown;
2358
+ }
1986
2359
  type TextContent = string | number | boolean | null | undefined;
1987
2360
  type RawContent = TextContent | Node;
1988
2361
  declare class Builder {
1989
2362
  readonly parent: htmlTools;
1990
2363
  readonly auto: (text: string) => string;
1991
- readonly fragment: DocumentFragment;
1992
- readonly context: Record<string, any>;
1993
- constructor(parent: htmlTools, fragment: DocumentFragment, context?: Record<string, any>);
2364
+ readonly fragment: HtmlRoot;
2365
+ readonly context: TextContext;
2366
+ constructor(parent: htmlTools, fragment: HtmlRoot, context?: TextContext);
1994
2367
  text(content: TextContent, style?: string): this;
1995
2368
  line(content?: TextContent, style?: string): this;
1996
2369
  wikify(content: TextContent): this;
@@ -1998,22 +2371,75 @@ declare class Builder {
1998
2371
  box(content: RawContent, style?: string): this;
1999
2372
  }
2000
2373
  declare class htmlTools {
2001
- readonly core: ToolCollection['core'];
2374
+ readonly core: MaplebirchCore;
2002
2375
  readonly log: ReturnType<typeof createlog>;
2003
2376
  private uid;
2004
2377
  private readonly store;
2005
- constructor(manager: ToolCollection);
2006
- get Wikifier(): any;
2007
- replaceText(oldText: string, newText: string): void;
2008
- replaceLink(oldLink: string, newLink: string): void;
2378
+ constructor(core: MaplebirchCore);
2379
+ get Wikifier(): MaplebirchCore['SugarCube']['Wikifier'];
2380
+ replaceText(oldText: string, newText: string, root?: HtmlRoot | null): number;
2381
+ renameLink(target: string | Element, label: string, root?: HtmlRoot | null): boolean;
2382
+ replaceLink(target: string | Element, source: string, root?: HtmlRoot | null): boolean;
2383
+ private findLink;
2009
2384
  add(key: string, handler: (tools: Builder) => void, id?: string): string | false;
2010
2385
  delete(key: string, idOrHandler?: string | ((tools: Builder) => void)): boolean;
2011
2386
  clear(): void;
2012
- renderFragment(keys: string | string[], context?: Record<string, any>): DocumentFragment;
2013
- render(macro: any, keys: string | string[]): void;
2387
+ renderFragment(keys: string | string[], context?: TextContext): DocumentFragment;
2388
+ renderInto(root: HtmlRoot, keys: string | string[], context?: TextContext): void;
2389
+ render(macro: MacroContext$1, keys: string | string[]): void;
2014
2390
  makeTextOutput(options?: { CSV?: boolean }): MacroFunction;
2015
2391
  }
2016
2392
  //#endregion
2393
+ //#region src/modules/Addon/Diagnostics.d.ts
2394
+ interface PatchResult {
2395
+ kind: 'passage' | 'script' | 'style' | 'source';
2396
+ target: string;
2397
+ index: number;
2398
+ pattern: string;
2399
+ matches: number;
2400
+ applied: number;
2401
+ status: 'applied' | 'unmatched' | 'missing' | 'invalid' | 'mismatch' | 'error';
2402
+ expected?: number;
2403
+ error?: string;
2404
+ }
2405
+ interface ModRequirement {
2406
+ name: string;
2407
+ range?: string;
2408
+ version?: string;
2409
+ status: 'available' | 'missing' | 'incompatible' | 'invalid';
2410
+ error?: string;
2411
+ }
2412
+ interface ModConflict {
2413
+ source: string;
2414
+ dataSource: string;
2415
+ passages: string[];
2416
+ scripts: string[];
2417
+ styles: string[];
2418
+ }
2419
+ declare class Diagnostics {
2420
+ private readonly manager;
2421
+ private readonly modUtils;
2422
+ private readonly results;
2423
+ constructor(manager: SC2DataManager, modUtils: ModUtils);
2424
+ get patches(): PatchResult[];
2425
+ recordPatch(result: PatchResult): void;
2426
+ clearPatches(): void;
2427
+ mod(name: string, range?: string): ModRequirement;
2428
+ dependencies(): boolean;
2429
+ get conflicts(): ModConflict[] | undefined;
2430
+ }
2431
+ //#endregion
2432
+ //#region src/modules/Frameworks/SourcePatch.d.ts
2433
+ interface SourcePatch {
2434
+ src?: string;
2435
+ srcmatch?: RegExp;
2436
+ srcmatchgroup?: RegExp;
2437
+ to?: string;
2438
+ applyafter?: string;
2439
+ applybefore?: string;
2440
+ expected?: number;
2441
+ }
2442
+ //#endregion
2017
2443
  //#region src/modules/Frameworks/ZonesManager.d.ts
2018
2444
  interface ZoneWidgetConfig {
2019
2445
  exclude?: string[];
@@ -2021,48 +2447,54 @@ interface ZoneWidgetConfig {
2021
2447
  passage?: string | string[];
2022
2448
  widget: string;
2023
2449
  type?: 'function';
2024
- func?: () => any;
2450
+ func?: () => unknown;
2025
2451
  }
2026
2452
  interface CustomLinkZoneItem {
2027
2453
  position: number;
2028
2454
  widget: string | ZoneWidgetConfig;
2029
2455
  }
2030
- interface PatchSet {
2031
- src?: string;
2032
- srcmatch?: RegExp;
2033
- srcmatchgroup?: RegExp;
2034
- to?: string;
2035
- applyafter?: string;
2036
- applybefore?: string;
2037
- }
2456
+ type PatchSet = SourcePatch;
2038
2457
  type ZoneItem = string | ZoneWidgetConfig | CustomLinkZoneItem;
2458
+ type ZoneFunction = () => unknown;
2039
2459
  type InitObject =
2040
2460
  | {
2041
- init: Function;
2461
+ init: ZoneFunction;
2042
2462
  }
2043
2463
  | {
2044
2464
  name: string;
2045
- func: Function;
2465
+ func: ZoneFunction;
2046
2466
  };
2047
- type InitFunction = string | Function | InitObject;
2467
+ type PositionedZoneWidgetConfig = Omit<ZoneWidgetConfig, 'widget'> & {
2468
+ widget: [number, string];
2469
+ };
2470
+ type ZoneWidget = string | ZoneFunction | ZoneWidgetConfig | PositionedZoneWidgetConfig | [number, string | ZoneWidgetConfig];
2471
+ interface CustomLinkGroup {
2472
+ position: number;
2473
+ macro: string;
2474
+ }
2475
+ type InitFunction = string | ZoneFunction | InitObject;
2048
2476
  declare class zonesManager {
2049
2477
  readonly log: ReturnType<typeof createlog>;
2050
2478
  readonly core: ToolCollection['core'];
2051
2479
  data: Record<string, ZoneItem[]>;
2052
2480
  initFunction: InitFunction[];
2053
- specialWidget: (string | Function)[];
2054
- defaultData: Record<string, string | Function>;
2481
+ specialWidget: (string | ZoneFunction)[];
2482
+ defaultData: Record<string, string | ZoneFunction>;
2055
2483
  locationPassage: Record<string, PatchSet[]>;
2056
2484
  widgetPassage: Record<string, PatchSet[]>;
2057
2485
  widgethtml: string;
2058
- private functions;
2486
+ private readonly functions;
2487
+ private readonly functionNames;
2488
+ private nextFunction;
2059
2489
  constructor(manager: ToolCollection);
2060
2490
  inject(...databases: Partial<Pick<zonesManager, 'specialWidget' | 'defaultData' | 'locationPassage' | 'widgetPassage'>>[]): void;
2061
2491
  onInit(...widgets: InitFunction[]): void;
2062
- addTo(zone: string, ...widgets: (string | Function | ZoneWidgetConfig | [number, string | ZoneWidgetConfig])[]): void;
2492
+ addTo(zone: string, ...widgets: ZoneWidget[]): void;
2063
2493
  storyInit(): void;
2064
- call(name: string): any;
2065
- play(zone: string, passageTitle?: string): any;
2494
+ call(name: string): unknown;
2495
+ play(zone: 'CustomLinkZone', passageTitle?: string): CustomLinkGroup[];
2496
+ play(zone: 'BeforeLinkZone' | 'AfterLinkZone', passageTitle?: string): string;
2497
+ play(zone: string, passageTitle?: string): string | CustomLinkGroup[];
2066
2498
  patchModToGame(manager: AddonPlugin, type: 'before' | 'after'): void;
2067
2499
  private get widgets();
2068
2500
  private get specials();
@@ -2070,13 +2502,10 @@ declare class zonesManager {
2070
2502
  private render;
2071
2503
  private shouldRender;
2072
2504
  private customLinkItem;
2073
- private matchAndApply;
2074
- private applyPatch;
2075
2505
  private wrapSpecialPassage;
2076
2506
  private applyContentPatches;
2077
2507
  private patchPassage;
2078
2508
  private widgetInit;
2079
- private hash;
2080
2509
  }
2081
2510
  //#endregion
2082
2511
  //#region src/modules/Frameworks/ApplyLinkZone.d.ts
@@ -2095,10 +2524,13 @@ interface LinkZoneConfig {
2095
2524
  onAfterApply?: ((result: boolean, config: LinkZoneConfig) => void) | null;
2096
2525
  debug: boolean;
2097
2526
  }
2098
- declare const log: (message: string, level?: string, ...objects: any[]) => void;
2527
+ declare const log: (message: string, level?: string, ...objects: unknown[]) => void;
2099
2528
  declare class LinkZoneManager {
2100
2529
  readonly containerId: string;
2101
2530
  readonly linkSelector: string;
2531
+ static readonly apply: (config?: Partial<LinkZoneConfig>) => boolean;
2532
+ static readonly add: (config: LinkZoneConfig, customZones: CustomZone[]) => void;
2533
+ static readonly defaultConfig: LinkZoneConfig;
2102
2534
  firstLink: Element | null;
2103
2535
  lastLink: Element | null;
2104
2536
  links: Element[];
@@ -2118,159 +2550,165 @@ declare class LinkZoneManager {
2118
2550
  }
2119
2551
  declare const applyLinkZone: typeof LinkZoneManager;
2120
2552
  //#endregion
2121
- //#region src/modules/Frameworks/OtherTools/Traits.d.ts
2122
- interface TraitCategory {
2123
- title: string;
2124
- traits: Trait[];
2125
- }
2126
- interface Trait {
2127
- name: string;
2128
- colour: string;
2129
- has: boolean;
2130
- text: string;
2131
- }
2132
- interface TraitConfig {
2133
- title: string;
2134
- name: string | (() => string);
2135
- colour: string | (() => string);
2136
- has: boolean | (() => boolean);
2137
- text: string | (() => string);
2138
- }
2139
- //#endregion
2140
- //#region src/modules/Frameworks/OtherTools/Location.d.ts
2141
- interface LocationConfigOptions {
2142
- overwrite?: boolean;
2143
- layer?: string;
2144
- element?: string;
2145
- }
2146
- interface LocationConfig {
2147
- condition?: (...object: any[]) => boolean;
2148
- folder?: string;
2149
- base?: Record<string, any>;
2150
- emissive?: Record<string, any>;
2151
- reflective?: Record<string, any>;
2152
- layerTop?: Record<string, any>;
2153
- customMapping?: any;
2154
- [key: string]: any;
2155
- }
2156
- interface LocationUpdate {
2157
- overwrite: boolean;
2158
- config: LocationConfig;
2159
- customMapping: any;
2553
+ //#region src/modules/Frameworks/Patches/Patch.d.ts
2554
+ type PatchPhase = 'init' | 'state';
2555
+ interface WidgetPatch {
2556
+ before?: (text: string) => string;
2557
+ after?: (node: DocumentFragment) => void;
2558
+ }
2559
+ interface PatchDefinition<T extends object = object, Flat extends object = T> {
2560
+ api: T;
2561
+ legacy?: Flat;
2562
+ available?: () => boolean;
2563
+ init?: () => void;
2564
+ state?: () => void;
2565
+ widgets?: Readonly<Record<string, WidgetPatch>>;
2566
+ }
2567
+ declare class Patch<Extensions extends Record<string, object> = Record<never, never>> {
2568
+ private readonly report;
2569
+ private readonly entries;
2570
+ private readonly extensionValues;
2571
+ constructor(report: (name: string, error: unknown) => void);
2572
+ add<T extends object, Flat extends object = T>(name: string, definition: PatchDefinition<T, Flat>): this & Flat;
2573
+ get<Name extends keyof Extensions>(name: Name): Extensions[Name] | undefined;
2574
+ get<T extends object = object>(name: string): T | undefined;
2575
+ require<Name extends keyof Extensions>(name: Name): Extensions[Name];
2576
+ require<T extends object = object>(name: string): T;
2577
+ has(name: string): boolean;
2578
+ names(): string[];
2579
+ beforeWidget(widget: string, text: string): string;
2580
+ afterWidget(widget: string, node: DocumentFragment): void;
2581
+ private widget;
2582
+ private available;
2583
+ private run;
2584
+ apply(phase: PatchPhase): void;
2160
2585
  }
2161
2586
  //#endregion
2162
- //#region src/modules/Frameworks/OtherTools/Bodywriting.d.ts
2163
- interface BodywritingConfig {
2164
- writing?: string;
2165
- writ_cn?: string;
2166
- type?: 'text' | 'object';
2167
- arrow?: 0 | 1;
2168
- special?: string;
2169
- gender?: 'n' | 'f' | 'm' | 'h';
2170
- lewd?: 0 | 1;
2171
- degree?: number;
2172
- featSkip?: boolean;
2173
- sprites?: string[];
2174
- index?: number;
2175
- key?: string;
2176
- }
2177
- interface BodywritingData {
2178
- operation: 'add' | 'del';
2179
- config?: BodywritingConfig;
2587
+ //#region src/modules/Frameworks/Patches/Tips.d.ts
2588
+ declare class Tips {
2589
+ static add(category: string, ...tips: string[]): void;
2590
+ static apply(): void;
2591
+ static inject(data: string[]): string[];
2180
2592
  }
2181
2593
  //#endregion
2182
- //#region src/modules/Frameworks/OtherTools/Foodstuff.d.ts
2183
- type FoodstuffSeason = 'spring' | 'summer' | 'autumn' | 'winter';
2184
- type FoodstuffPlantingBed = 'earth' | 'water';
2185
- type FoodstuffStallSize = 'small' | 'large';
2186
- interface FoodstuffConfig {
2187
- key?: string;
2188
- index?: number;
2189
- name?: string;
2190
- singular?: string;
2191
- plural?: string;
2192
- icon?: string;
2193
- category?: string;
2194
- kitchen_item_type_icon?: string;
2195
- prop_folder?: string;
2196
- ingredient_alternatives?: Record<string, string[]>;
2197
- tending?: {
2198
- planting_bed?: FoodstuffPlantingBed;
2199
- growth_days?: number;
2200
- yield_multiplier?: number;
2201
- has_seeds?: boolean;
2202
- seed_name?: string;
2203
- seasons?: FoodstuffSeason[];
2204
- affected_by_tending_skill?: boolean;
2205
- tags?: string[];
2206
- [key: string]: any;
2594
+ //#region src/modules/Frameworks/Patches/index.d.ts
2595
+ declare function create(core: MaplebirchCore): (Patch<{
2596
+ traits: {
2597
+ data: TraitConfig[];
2598
+ add: typeof Traits.add;
2599
+ inject: (data: Parameters<typeof Traits.inject>[0]) => TraitCategory[];
2207
2600
  };
2208
- shop?: {
2209
- sell_price?: number;
2210
- available_in?: string[];
2211
- bought_in_bulk?: number;
2212
- stall_size?: FoodstuffStallSize;
2213
- [key: string]: any;
2601
+ location: {
2602
+ data: Record<string, LocationUpdate>;
2603
+ configure: typeof Location.configure;
2604
+ apply: typeof Location.apply;
2214
2605
  };
2215
- recipe?: {
2216
- recipe_name?: string;
2217
- difficulty?: number;
2218
- cook_minutes?: number;
2219
- servings?: number;
2220
- ingredients?: string[];
2221
- ingredient_alternatives?: Record<string, string[]>;
2222
- tags?: string[];
2223
- [key: string]: any;
2606
+ bodywriting: {
2607
+ data: Record<string, BodywritingData>;
2608
+ add: typeof Bodywriting.add;
2609
+ delete: typeof Bodywriting.delete;
2610
+ apply: typeof Bodywriting.apply;
2224
2611
  };
2225
- food?: {
2226
- handheld_gift?: boolean;
2227
- tags?: string[];
2228
- [key: string]: any;
2612
+ fishing: {
2613
+ data: Record<string, FishConfig>;
2614
+ locations: Partial<Record<FishingLocation, Record<string, number>>>;
2615
+ add: typeof Fishing.addFish;
2616
+ addBait: typeof Fishing.addBait;
2617
+ configure: typeof Fishing.configureLocation;
2618
+ apply: typeof Fishing.apply;
2229
2619
  };
2230
- [key: string]: any;
2231
- }
2232
- //#endregion
2233
- //#region src/modules/Frameworks/OtherTools/Antiques.d.ts
2234
- interface AntiqueConfig {
2235
- hint: string;
2236
- museum: string;
2237
- name: string;
2238
- cn_name?: string;
2239
- journal: string;
2240
- journalName?: string;
2241
- icon: string;
2242
- key?: string;
2243
- }
2244
- //#endregion
2245
- //#region src/modules/Frameworks/patch.d.ts
2246
- type AddTraits = (...traits: Partial<TraitConfig>[]) => void;
2247
- type InjectTraits = (data: TraitCategory[]) => TraitCategory[];
2248
- type ConfigureLocation = (locationId: string, config: LocationConfig, options?: LocationConfigOptions) => boolean;
2249
- type ApplyLocation = () => void;
2250
- type AddBodywriting = (key: string, config: BodywritingConfig) => void;
2251
- type ApplyBodywriting = () => void;
2252
- type AddFoodstuff = (key: string, config: FoodstuffConfig) => void;
2253
- type ApplyFoodstuff = () => void;
2254
- type AddAntiques = (key: string, config: AntiqueConfig) => void;
2255
- type InjectAntiques = (data: Record<string, AntiqueConfig>) => Record<string, AntiqueConfig>;
2256
- declare class Patch {
2257
- readonly traitsData: TraitConfig[];
2258
- readonly locationData: Record<string, LocationUpdate>;
2259
- readonly bodywritingData: Record<string, BodywritingData>;
2260
- readonly foodstuffData: Record<string, FoodstuffConfig>;
2261
- readonly antiquesData: Record<string, AntiqueConfig>;
2262
- addTraits: AddTraits;
2263
- injectTraits: InjectTraits;
2264
- configureLocation: ConfigureLocation;
2265
- applyLocation: ApplyLocation;
2266
- addBodywriting: AddBodywriting;
2267
- applyBodywriting: ApplyBodywriting;
2268
- addFoodstuff: AddFoodstuff;
2269
- applyFoodstuff: ApplyFoodstuff;
2270
- addAntiques: AddAntiques;
2271
- injectAntiques: InjectAntiques;
2272
- }
2273
- declare const _default: Patch;
2620
+ foodstuff: {
2621
+ data: Record<string, FoodstuffConfig>;
2622
+ add: typeof Foodstuff.add;
2623
+ apply: typeof Foodstuff.apply;
2624
+ };
2625
+ antiques: {
2626
+ data: Record<string, AntiqueConfig>;
2627
+ add: typeof Antiques.add;
2628
+ inject: typeof Antiques.inject;
2629
+ };
2630
+ tips: {
2631
+ data: Record<string, string[]>;
2632
+ add: typeof Tips.add;
2633
+ apply: typeof Tips.apply;
2634
+ inject: typeof Tips.inject;
2635
+ };
2636
+ }> & {
2637
+ traitsData: TraitConfig[];
2638
+ addTraits: typeof Traits.add;
2639
+ injectTraits: (data: Parameters<typeof Traits.inject>[0]) => TraitCategory[];
2640
+ } & {
2641
+ locationData: Record<string, LocationUpdate>;
2642
+ configureLocation: typeof Location.configure;
2643
+ applyLocation: typeof Location.apply;
2644
+ } & {
2645
+ bodywritingData: Record<string, BodywritingData>;
2646
+ addBodywriting: typeof Bodywriting.add;
2647
+ deleteBodywriting: typeof Bodywriting.delete;
2648
+ applyBodywriting: typeof Bodywriting.apply;
2649
+ } & {
2650
+ fishData: Record<string, FishConfig>;
2651
+ fishingLocationData: Partial<Record<FishingLocation, Record<string, number>>>;
2652
+ addFish: typeof Fishing.addFish;
2653
+ addBait: typeof Fishing.addBait;
2654
+ configureFishingLocation: typeof Fishing.configureLocation;
2655
+ applyFishing: typeof Fishing.apply;
2656
+ } & {
2657
+ foodstuffData: Record<string, FoodstuffConfig>;
2658
+ addFoodstuff: typeof Foodstuff.add;
2659
+ applyFoodstuff: typeof Foodstuff.apply;
2660
+ } & {
2661
+ antiquesData: Record<string, AntiqueConfig>;
2662
+ addAntiques: typeof Antiques.add;
2663
+ injectAntiques: typeof Antiques.inject;
2664
+ } & {
2665
+ tipsData: Record<string, string[]>;
2666
+ addTips: typeof Tips.add;
2667
+ applyTips: typeof Tips.apply;
2668
+ injectTips: typeof Tips.inject;
2669
+ }) & {
2670
+ traits: {
2671
+ data: TraitConfig[];
2672
+ add: typeof Traits.add;
2673
+ inject: (data: Parameters<typeof Traits.inject>[0]) => TraitCategory[];
2674
+ };
2675
+ location: {
2676
+ data: Record<string, LocationUpdate>;
2677
+ configure: typeof Location.configure;
2678
+ apply: typeof Location.apply;
2679
+ };
2680
+ bodywriting: {
2681
+ data: Record<string, BodywritingData>;
2682
+ add: typeof Bodywriting.add;
2683
+ delete: typeof Bodywriting.delete;
2684
+ apply: typeof Bodywriting.apply;
2685
+ };
2686
+ fishing: {
2687
+ data: Record<string, FishConfig>;
2688
+ locations: Partial<Record<FishingLocation, Record<string, number>>>;
2689
+ add: typeof Fishing.addFish;
2690
+ addBait: typeof Fishing.addBait;
2691
+ configure: typeof Fishing.configureLocation;
2692
+ apply: typeof Fishing.apply;
2693
+ };
2694
+ foodstuff: {
2695
+ data: Record<string, FoodstuffConfig>;
2696
+ add: typeof Foodstuff.add;
2697
+ apply: typeof Foodstuff.apply;
2698
+ };
2699
+ antiques: {
2700
+ data: Record<string, AntiqueConfig>;
2701
+ add: typeof Antiques.add;
2702
+ inject: typeof Antiques.inject;
2703
+ };
2704
+ tips: {
2705
+ data: Record<string, string[]>;
2706
+ add: typeof Tips.add;
2707
+ apply: typeof Tips.apply;
2708
+ inject: typeof Tips.inject;
2709
+ };
2710
+ };
2711
+ type Patches = ReturnType<typeof create>;
2274
2712
  //#endregion
2275
2713
  //#region src/modules/ToolCollection.d.ts
2276
2714
  declare class ToolCollection {
@@ -2282,17 +2720,12 @@ declare class ToolCollection {
2282
2720
  readonly text: htmlTools;
2283
2721
  readonly zone: zonesManager;
2284
2722
  readonly link: typeof applyLinkZone;
2285
- readonly patch: typeof _default;
2723
+ readonly patch: Patches;
2286
2724
  readonly createlog: typeof createlog;
2287
2725
  constructor(core: MaplebirchCore);
2288
2726
  onInit(...widgets: InitFunction[]): void;
2289
- addTo(zone: string, ...widgets: (string | Function | ZoneWidgetConfig | [number, string | ZoneWidgetConfig])[]): void;
2727
+ addTo(zone: string, ...widgets: ZoneWidget[]): void;
2290
2728
  preInit(): void;
2291
- private config;
2292
- private loadConfig;
2293
- private addTrait;
2294
- private addKeyedConfig;
2295
- private error;
2296
2729
  }
2297
2730
  //#endregion
2298
2731
  //#region src/modules/AudioAddon/Track.d.ts
@@ -2351,8 +2784,8 @@ declare const PlayState: {
2351
2784
  type PlayStateType = (typeof PlayState)[keyof typeof PlayState];
2352
2785
  interface AudioEventData {
2353
2786
  type: string;
2354
- data?: any[];
2355
- [key: string]: any;
2787
+ data?: unknown[];
2788
+ [key: string]: unknown;
2356
2789
  }
2357
2790
  type AudioEventHandler = (eventData: AudioEventData) => void;
2358
2791
  interface AudioProgress {
@@ -2376,6 +2809,7 @@ declare class AudioManager {
2376
2809
  readonly log: ReturnType<typeof createlog>;
2377
2810
  private readonly STORE;
2378
2811
  private readonly playlists;
2812
+ private readonly playlistLoads;
2379
2813
  private readonly eventListeners;
2380
2814
  private readonly cache;
2381
2815
  private readonly pendingLoads;
@@ -2587,7 +3021,7 @@ declare class Transformation {
2587
3021
  readonly suppressConditions: Record<string, SuppressCondition[]>;
2588
3022
  readonly buildUpdaters: Record<string, BuildUpdater>;
2589
3023
  constructor(manager: Character);
2590
- private isDoLP;
3024
+ private get isDoLP();
2591
3025
  private get animalTransforms();
2592
3026
  private get animalMacros();
2593
3027
  private get historyTransforms();
@@ -2596,6 +3030,7 @@ declare class Transformation {
2596
3030
  add(name: string, type: string, options: TransformationOption): this;
2597
3031
  inject(): void;
2598
3032
  private _update;
3033
+ state(): void;
2599
3034
  private _clear;
2600
3035
  private suppress;
2601
3036
  _transform(name: string, change: number): void;
@@ -2612,7 +3047,7 @@ declare class Transformation {
2612
3047
  }
2613
3048
  ): boolean;
2614
3049
  get icon(): string;
2615
- setTransform(name: string, level: number | null): void;
3050
+ setTransform(name: string, level?: number | null): void;
2616
3051
  part(partName: string): boolean;
2617
3052
  }
2618
3053
  //#endregion
@@ -2697,7 +3132,6 @@ interface EnhancedDate extends DateTime {
2697
3132
  isHour(...hours: number[]): boolean;
2698
3133
  isHourBetween(start: number, end: number): boolean;
2699
3134
  isMinuteBetween(start: number, end: number): boolean;
2700
- [key: string]: any;
2701
3135
  }
2702
3136
  declare class Schedule {
2703
3137
  daily: string[];
@@ -2860,7 +3294,7 @@ interface NPCSidebarBootConfig {
2860
3294
  config?: string[];
2861
3295
  }
2862
3296
  declare function config(manager: NPCManager, modName: string, modZip: ModZipReader, config: NPCSidebarBootConfig): Promise<void>;
2863
- declare function loadFromMod(modZip: ModZipReader, npcNames: string[]): string[];
3297
+ declare function loadFromMod(modZip: ModZipReader, npc_names: string[]): string[];
2864
3298
  declare class NPCPet {
2865
3299
  private readonly pets;
2866
3300
  private frame;
@@ -2881,38 +3315,243 @@ declare const NPCSidebar: {
2881
3315
  };
2882
3316
  //#endregion
2883
3317
  //#region src/modules/NamedNPCAddon/NPCFluids.d.ts
2884
- type NPCFluidPart = 'vagina' | 'anus' | 'mouth' | 'chest' | 'face' | 'feet' | 'leftarm' | 'rightarm' | 'neck' | 'thigh' | 'tummy';
2885
- type NPCFluidData = Record<NPCFluidPart, number>;
3318
+ type NPCFluidPart = 'vagina' | 'vaginaoutside' | 'anus' | 'mouth' | 'penis' | 'chest' | 'face' | 'hair' | 'bottom' | 'feet' | 'leftarm' | 'rightarm' | 'neck' | 'thigh' | 'tummy';
3319
+ type NPCFluidType = 'goo' | 'semen';
3320
+ type NPCFluidAmount = [goo: number, semen: number];
3321
+ type NPCFluidData = Record<NPCFluidPart, NPCFluidAmount>;
2886
3322
  declare class NPCFluids {
2887
3323
  readonly parts: NPCFluidPart[];
2888
3324
  ensure(npcName: string): NPCFluidData;
2889
3325
  get(npcName: string): NPCFluidData;
2890
- set(npcName: string, part: NPCFluidPart, value: number): NPCFluidData;
2891
- add(npcName: string, part: NPCFluidPart, value?: number): NPCFluidData;
2892
- reduce(npcName: string, part: NPCFluidPart, value?: number): NPCFluidData;
2893
- clear(npcName: string, part?: NPCFluidPart): NPCFluidData;
3326
+ combined(npcName: string, part: NPCFluidPart): number;
3327
+ set(npcName: string, part: NPCFluidPart, value: number, type?: NPCFluidType): NPCFluidData;
3328
+ add(npcName: string, part: NPCFluidPart, value?: number, type?: NPCFluidType): NPCFluidData;
3329
+ reduce(npcName: string, part: NPCFluidPart, value?: number, type?: NPCFluidType): NPCFluidData;
3330
+ clear(npcName: string, part?: NPCFluidPart, type?: NPCFluidType): NPCFluidData;
2894
3331
  decay(value?: number): void;
2895
3332
  apply(nnpc: Record<string, any>, npcData: any): void;
2896
3333
  }
2897
3334
  //#endregion
3335
+ //#region src/modules/NamedNPCAddon/NPCSidebarConfig/transformation_layers.d.ts
3336
+ declare const transformationDefaults: {
3337
+ show_tf: boolean;
3338
+ tf_ears_layer: string;
3339
+ angel_wings_type: string;
3340
+ angel_wing_right: string;
3341
+ angel_wing_left: string;
3342
+ angel_wings_layer: string;
3343
+ angel_halo_type: string;
3344
+ angel_halo_lower: boolean;
3345
+ fallen_wings_type: string;
3346
+ fallen_wing_right: string;
3347
+ fallen_wing_left: string;
3348
+ fallen_wings_layer: string;
3349
+ fallen_halo_type: string;
3350
+ demon_wings_type: string;
3351
+ demon_wings_state: string;
3352
+ demon_wings_layer: string;
3353
+ demon_tail_type: string;
3354
+ demon_tail_state: string;
3355
+ demon_tail_layer: string;
3356
+ demon_horns_type: string;
3357
+ demon_horns_layer: string;
3358
+ wolf_tail_type: string;
3359
+ wolf_tail_layer: string;
3360
+ wolf_ears_type: string;
3361
+ wolf_pits_type: string;
3362
+ wolf_pubes_type: string;
3363
+ wolf_cheeks_type: string;
3364
+ cat_tail_type: string;
3365
+ cat_tail_layer: string;
3366
+ cat_ears_type: string;
3367
+ cow_horns_type: string;
3368
+ cow_horns_layer: string;
3369
+ cow_tail_type: string;
3370
+ cow_tail_layer: string;
3371
+ cow_ears_type: string;
3372
+ bird_wings_type: string;
3373
+ bird_wing_right: string;
3374
+ bird_wing_left: string;
3375
+ bird_wings_layer: string;
3376
+ bird_tail_type: string;
3377
+ bird_tail_layer: string;
3378
+ bird_eyes_type: string;
3379
+ bird_malar_type: string;
3380
+ bird_plumage_type: string;
3381
+ bird_pubes_type: string;
3382
+ fox_tail_type: string;
3383
+ fox_tail_layer: string;
3384
+ fox_ears_type: string;
3385
+ fox_cheeks_type: string;
3386
+ };
3387
+ //#endregion
3388
+ //#region src/modules/NamedNPCAddon/NPCSidebarConfig/types.d.ts
3389
+ type NPCBodyData = Pick<
3390
+ NPCData,
3391
+ | 'penis'
3392
+ | 'vagina'
3393
+ | 'virginity'
3394
+ | 'hair_side_type'
3395
+ | 'hair_fringe_type'
3396
+ | 'hair_position'
3397
+ | 'hair_sides_length'
3398
+ | 'hair_fringe_length'
3399
+ | 'eyeColour'
3400
+ | 'hairColour'
3401
+ | 'penissize'
3402
+ | 'breastsize'
3403
+ | 'ballssize'
3404
+ >;
3405
+ type NPCClothesSlot = 'head' | 'face' | 'neck' | 'upper' | 'lower' | 'feet' | 'legs' | 'handheld' | 'genitals' | 'under_upper' | 'under_lower' | 'over_head' | 'over_upper' | 'over_lower' | 'hands';
3406
+ interface NPCSidebarClothing {
3407
+ index: number;
3408
+ name: string;
3409
+ variable: string;
3410
+ type: string[];
3411
+ integrity: string;
3412
+ setup?: NPCSidebarClothing;
3413
+ alpha?: number;
3414
+ alt?: string;
3415
+ altposition?: string;
3416
+ altdisabled?: string[];
3417
+ altsleeve?: string;
3418
+ state?: string;
3419
+ state_top?: string;
3420
+ colour?: string;
3421
+ colourCustom?: string;
3422
+ accessory_colour?: string;
3423
+ accessory_colourCustom?: string;
3424
+ accessory_colour_sidebar?: string;
3425
+ accessory?: number;
3426
+ accessory_integrity_img?: number;
3427
+ mainImage?: number;
3428
+ accImage?: number;
3429
+ leftImage?: number;
3430
+ rightImage?: number;
3431
+ coverImage?: number;
3432
+ coverBackImage?: number;
3433
+ back_img?: number;
3434
+ back_img_acc?: number;
3435
+ back_img_colour?: string;
3436
+ back_img_acc_colour?: string;
3437
+ back_integrity_img?: number;
3438
+ breast_img?: number | Record<number, number>;
3439
+ breast_acc_img?: number | Record<number, number>;
3440
+ breast_pattern?: number;
3441
+ sleeve_img?: number;
3442
+ sleeve_acc_img?: number;
3443
+ sleeve_colour?: string;
3444
+ penis_img?: number;
3445
+ penis_acc_img?: number;
3446
+ mask_img?: number;
3447
+ pattern?: string;
3448
+ pattern_layer?: string;
3449
+ holdPosition?: string;
3450
+ hoodposition?: string;
3451
+ hood?: number;
3452
+ has_collar?: number;
3453
+ high_img?: number;
3454
+ notuck?: number;
3455
+ outfitPrimary?: Partial<Record<NPCClothesSlot, string>>;
3456
+ outfitSecondary?: string[];
3457
+ set?: string;
3458
+ zIndex?: string | number;
3459
+ }
3460
+ interface NPCSidebarState extends Partial<typeof transformationDefaults> {
3461
+ name: string;
3462
+ show: boolean;
3463
+ model: boolean;
3464
+ position: number;
3465
+ dxfn: number;
3466
+ dyfn: number;
3467
+ tan: number;
3468
+ skin_type: string;
3469
+ freckles: boolean;
3470
+ facestyle: string;
3471
+ facevariant: string;
3472
+ ears_position: string;
3473
+ close_up_mask: string;
3474
+ hide_all: boolean;
3475
+ hide_head_acc: boolean;
3476
+ hide_leash: boolean;
3477
+ hood_down: boolean;
3478
+ show_hair: boolean;
3479
+ clothes: Record<NPCClothesSlot, NPCSidebarClothing>;
3480
+ bodydata: NPCBodyData;
3481
+ tf_filters?: Record<string, CanvasLayerFilter>;
3482
+ head_mask: string[];
3483
+ upper_mask: string[];
3484
+ lower_mask: string[];
3485
+ legs_mask: string[];
3486
+ feet_mask: string[];
3487
+ fringe_mask_src: string | null;
3488
+ feet_clip_src: string | null;
3489
+ upper_tucked: boolean;
3490
+ lower_tucked: boolean;
3491
+ crotch_visible: boolean;
3492
+ crotch_exposed: boolean;
3493
+ arm_left: string;
3494
+ arm_right: string;
3495
+ handheld_position: string | null;
3496
+ handheld_animation: string;
3497
+ handheld_overhead: boolean | null;
3498
+ alt_sleeve_state: boolean | null;
3499
+ high_waist_suspenders: boolean | null;
3500
+ hood_mask: boolean | null;
3501
+ zarms: number;
3502
+ zupper: number;
3503
+ zupperleft: number;
3504
+ zupperright: number;
3505
+ lust: number;
3506
+ breasts: string;
3507
+ breast_size: number;
3508
+ penis: string | false;
3509
+ penis_size: number;
3510
+ balls: boolean;
3511
+ genitals_chastity: boolean;
3512
+ eye_colour: string;
3513
+ hair_colour: string;
3514
+ hair_sides_type: string;
3515
+ hair_fringe_type: string;
3516
+ hair_position: string;
3517
+ hair_sides_position: string;
3518
+ hair_sides_length: string;
3519
+ hair_fringe_length: string;
3520
+ drip_mouth: string;
3521
+ calculate_penis_bulge(target?: NPCSidebarState): number;
3522
+ [key: string]: unknown;
3523
+ }
3524
+ //#endregion
2898
3525
  //#region src/modules/NamedNPCAddon/NPCTransformation.d.ts
2899
3526
  interface NPCTransformationState {
2900
3527
  build: number;
2901
3528
  level: number;
2902
3529
  }
3530
+ type NPCTransformationPart = { [Key in keyof typeof transformationDefaults]: Key extends `${infer Part}_type` ? Part : never }[keyof typeof transformationDefaults];
3531
+ interface NPCTransformationPartConfig {
3532
+ level?: number;
3533
+ style?: string;
3534
+ filter?: {
3535
+ blend?: string;
3536
+ blendMode?: string;
3537
+ brightness?: number;
3538
+ contrast?: number;
3539
+ desaturate?: boolean;
3540
+ };
3541
+ }
2903
3542
  interface NPCTransformationConfig {
2904
- levels?: number[];
3543
+ levels?: readonly number[];
2905
3544
  type?: string;
2906
- pregnancy?: string;
2907
- body?: (bodydata: Record<string, any>, state: NPCTransformationState, npcName: string) => void;
2908
- sidebar?: (nnpc: Record<string, any>, state: NPCTransformationState, npcName: string) => void;
3545
+ parts?: Partial<Record<NPCTransformationPart, NPCTransformationPartConfig>>;
3546
+ body?: (bodydata: NPCBodyData, state: Readonly<NPCTransformationState>, npcName: string) => void;
3547
+ sidebar?: (nnpc: Partial<NPCSidebarState>, state: Readonly<NPCTransformationState>, npcName: string) => void;
2909
3548
  layers?: CanvasLayerMap;
2910
3549
  }
2911
3550
  declare class NPCTransformation {
2912
3551
  private readonly manager;
2913
3552
  private readonly configs;
2914
3553
  constructor(manager: NPCManager);
2915
- add(type: string, config?: NPCTransformationConfig): this;
3554
+ add(npcName: string, type: string, config?: NPCTransformationConfig): this;
2916
3555
  ensure(npcName: string, type?: string): Record<string, NPCTransformationState>;
2917
3556
  get(npcName: string, type: string): NPCTransformationState;
2918
3557
  build(npcName: string, type: string, value: number): NPCTransformationState;
@@ -2920,12 +3559,123 @@ declare class NPCTransformation {
2920
3559
  clear(npcName: string, type?: string): void;
2921
3560
  level(npcName: string, type: string): number;
2922
3561
  type(npcName: string): string;
2923
- pregnancyType(npcName: string): string;
2924
- applyBody(nnpc: Record<string, any>, npcData: any): void;
2925
- applySidebar(nnpc: Record<string, any>): void;
3562
+ applyBody(
3563
+ nnpc: Partial<NPCSidebarState>,
3564
+ npcData: {
3565
+ bodydata?: NPCBodyData;
3566
+ }
3567
+ ): void;
3568
+ applySidebar(nnpc: Partial<NPCSidebarState>): void;
3569
+ private read;
3570
+ private entries;
3571
+ private config;
2926
3572
  private active;
2927
3573
  }
2928
3574
  //#endregion
3575
+ //#region src/modules/NamedNPCAddon/NPCPregnancy.d.ts
3576
+ type NPCPregnancySpecies = 'human' | 'wolf' | 'wolfboy' | 'wolfgirl' | 'hawk' | 'harpy';
3577
+ type NPCPregnancyOrifice = 'vagina' | 'anus';
3578
+ type NPCPregnancyRange = number | readonly [min: number, max: number];
3579
+ interface NPCPregnancyState {
3580
+ enabled?: boolean;
3581
+ analEnabled?: boolean;
3582
+ cycleDaysTotal?: number;
3583
+ cycleDay?: number;
3584
+ cycleDangerousDay?: number;
3585
+ fertileLeadDays?: number;
3586
+ pills?: 'contraceptive' | 'fertility' | null;
3587
+ [key: string]: unknown;
3588
+ }
3589
+ interface NPCPregnancyRecord {
3590
+ pregnancyId: number;
3591
+ carrier: string;
3592
+ carrierSpecies: string;
3593
+ donor: string;
3594
+ donorSpecies: NPCPregnancySpecies;
3595
+ possibleDonors: {
3596
+ name: string;
3597
+ species: NPCPregnancySpecies;
3598
+ }[];
3599
+ conceivedDate: number;
3600
+ conceivedLocation: string;
3601
+ gestationVariance: number;
3602
+ orifice: NPCPregnancyOrifice;
3603
+ deliveredDate: number | null;
3604
+ deliveredLocation: string | null;
3605
+ awareOfPregnancy: string[];
3606
+ awareOfCarrier: string[];
3607
+ awareOfDonor: string[];
3608
+ talkedAbout: Record<string, boolean>;
3609
+ playerLearnedFrom: string | null;
3610
+ hatchDelay?: number;
3611
+ layCare?: number;
3612
+ waterBreaking?: boolean;
3613
+ }
3614
+ interface NPCPregnancyCycleConfig {
3615
+ days?: NPCPregnancyRange;
3616
+ dangerousDay?: number;
3617
+ fertileLeadDays?: NPCPregnancyRange;
3618
+ pills?: 'contraceptive' | 'fertility' | null;
3619
+ analEnabled?: boolean;
3620
+ avoidance?: number;
3621
+ }
3622
+ interface NPCPregnancyConfig {
3623
+ canBePregnant?: boolean;
3624
+ canImpregnatePlayer?: boolean;
3625
+ cycle?: NPCPregnancyCycleConfig;
3626
+ }
3627
+ interface NPCTryConceiveOptions {
3628
+ donor?: string;
3629
+ donorSpecies?: NPCPregnancySpecies;
3630
+ orifice?: NPCPregnancyOrifice;
3631
+ depth?: 'outside' | 'imminent' | 'deep';
3632
+ location?: string;
3633
+ fertility?: number;
3634
+ aware?: boolean;
3635
+ donorKnown?: boolean;
3636
+ }
3637
+ interface NPCPregnancySnapshot {
3638
+ cycle: {
3639
+ enabled: boolean;
3640
+ day: number | null;
3641
+ days: number | null;
3642
+ dangerousDay: number | null;
3643
+ fertileLeadDays: number | null;
3644
+ fertility: number;
3645
+ pills: NPCPregnancyState['pills'];
3646
+ analEnabled: boolean;
3647
+ avoidance: number | null;
3648
+ };
3649
+ pregnancies: NPCPregnancyRecord[];
3650
+ progress: number | null;
3651
+ dueDate: number | null;
3652
+ belly: number;
3653
+ }
3654
+ declare class NPCPregnancy {
3655
+ private readonly manager;
3656
+ private readonly configs;
3657
+ private initialized;
3658
+ constructor(manager: NPCManager);
3659
+ get available(): boolean;
3660
+ add(npcName: string, config?: NPCPregnancyConfig): this;
3661
+ init(): void;
3662
+ inject(): void;
3663
+ get(npcName: string): NPCPregnancySnapshot;
3664
+ tryConceive(npcName: string, options?: NPCTryConceiveOptions): NPCPregnancyRecord | null;
3665
+ private applyRegistration;
3666
+ private applyCycle;
3667
+ private validateCycle;
3668
+ private validateRange;
3669
+ private cycleConfigured;
3670
+ private markCycleConfigured;
3671
+ private species;
3672
+ private name;
3673
+ private npc;
3674
+ private requireRuntime;
3675
+ private range;
3676
+ private random;
3677
+ }
3678
+ //#endregion
2929
3679
  //#region src/modules/NamedNPC.d.ts
2930
3680
  type PronounCode = 'm' | 'f' | 'i' | 'n' | 't';
2931
3681
  type TranslationInput = Map<string, Translation> | Record<string, Translation>;
@@ -2949,7 +3699,8 @@ interface NPCData {
2949
3699
  hair_side_type?: string;
2950
3700
  hair_fringe_type?: string;
2951
3701
  hair_position?: string;
2952
- hairlength?: number;
3702
+ hair_sides_length?: number;
3703
+ hair_fringe_length?: number;
2953
3704
  eyeColour?: string;
2954
3705
  hairColour?: string;
2955
3706
  bottomsize?: number;
@@ -2964,7 +3715,7 @@ interface NPCData {
2964
3715
  breastdesc?: string;
2965
3716
  ballssize?: number;
2966
3717
  outfits?: string[];
2967
- pregnancy?: any;
3718
+ pregnancy?: NPCPregnancyState | null;
2968
3719
  pregnancyAvoidance?: number;
2969
3720
  [key: string]: any;
2970
3721
  }
@@ -2977,7 +3728,14 @@ interface NPCConfig {
2977
3728
  special?: boolean | (() => boolean);
2978
3729
  loveInterest?: boolean | (() => boolean);
2979
3730
  romance?: (() => boolean)[];
2980
- [key: string]: any;
3731
+ [key: string]: unknown;
3732
+ }
3733
+ interface NPCStatConfig {
3734
+ min?: number;
3735
+ max?: number;
3736
+ default?: number;
3737
+ position?: number | 'first' | 'last' | false;
3738
+ [key: string]: unknown;
2981
3739
  }
2982
3740
  declare const NamedNPC: {
2983
3741
  new (
@@ -3002,7 +3760,8 @@ declare const NamedNPC: {
3002
3760
  hair_side_type: string;
3003
3761
  hair_fringe_type: string;
3004
3762
  hair_position: string;
3005
- hairlength: number;
3763
+ hair_sides_length: number;
3764
+ hair_fringe_length: number;
3006
3765
  eyeColour: string;
3007
3766
  hairColour: string;
3008
3767
  pronoun: PronounCode;
@@ -3022,9 +3781,9 @@ declare const NamedNPC: {
3022
3781
  ballsdesc: string;
3023
3782
  ballssize: number;
3024
3783
  outfits: string[];
3025
- pregnancy: any;
3784
+ pregnancy: NPCPregnancyState;
3026
3785
  pregnancyAvoidance?: number;
3027
- descCache: Record<string, any>;
3786
+ descCache: Record<string, string>;
3028
3787
  setPronouns(): void;
3029
3788
  setBodyTraits(data: NPCData): void;
3030
3789
  bodyPartdescription(): void;
@@ -3041,15 +3800,18 @@ declare const NamedNPC: {
3041
3800
  declare class NPCManager {
3042
3801
  readonly core: MaplebirchCore;
3043
3802
  readonly log: ReturnType<typeof createlog>;
3044
- readonly data: Map<string, any>;
3803
+ readonly data: Map<
3804
+ string,
3805
+ {
3806
+ Data: InstanceType<typeof NamedNPC>;
3807
+ Config: NPCConfig;
3808
+ }
3809
+ >;
3045
3810
  NPCNameList: string[];
3046
3811
  readonly Transformation: NPCTransformation;
3047
- readonly type: {
3048
- [x: string]: Array<string>;
3049
- };
3050
- readonly customStats: {
3051
- [x: string]: any;
3052
- };
3812
+ readonly Pregnancy: NPCPregnancy;
3813
+ readonly type: Record<'loveInterestNpcs' | 'importantNPCs' | 'specialNPCs', string[]>;
3814
+ readonly customStats: Record<string, NPCStatConfig>;
3053
3815
  readonly romanceConditions: {
3054
3816
  [key: string]: (() => boolean)[];
3055
3817
  };
@@ -3061,13 +3823,11 @@ declare class NPCManager {
3061
3823
  constructor(core: MaplebirchCore);
3062
3824
  add(npcData: NPCData, config?: NPCConfig, translationsData?: TranslationInput): boolean;
3063
3825
  addSchedule(npcName: string, config: ScheduleConfig | ScheduleBuilder): Schedule;
3064
- addStats(statsObject: { [x: string]: any }): void;
3826
+ addStats(statsObject: Record<string, NPCStatConfig>): void;
3065
3827
  addClothes(...configs: OutfitSetConfig[]): void;
3066
3828
  injectModNPCs(): void;
3067
- vanillaNPCConfig(npcConfig: NPCConfig): any;
3068
- applyStatDefaults(statDefaults: { [x: string]: any }): {
3069
- [x: string]: any;
3070
- };
3829
+ vanillaNPCConfig(npcConfig: Record<string, NPCConfig>): Record<string, NPCConfig>;
3830
+ applyStatDefaults(statDefaults: Record<string, NPCStatConfig>): Record<string, NPCStatConfig>;
3071
3831
  vanillaInit(npcName: string): void;
3072
3832
  vanillaInject(npcName: string, npcno: number): void;
3073
3833
  private config;
@@ -3078,22 +3838,24 @@ declare class NPCManager {
3078
3838
  }
3079
3839
  //#endregion
3080
3840
  //#region src/modules/CombatAddon/CombatAction.d.ts
3081
- type ActionType = 'leftaction' | 'rightaction' | 'feetaction' | 'mouthaction' | 'penisaction' | 'vaginaaction' | 'anusaction' | 'chestaction' | 'thighaction';
3841
+ declare const actionTypes: readonly ['leftaction', 'rightaction', 'feetaction', 'mouthaction', 'penisaction', 'vaginaaction', 'anusaction', 'chestaction', 'thighaction'];
3842
+ type ActionType = (typeof actionTypes)[number];
3082
3843
  type CombatType = 'Default' | 'Self' | 'Struggle' | 'Swarm' | 'Vore' | 'Machine' | 'Tentacle';
3844
+ type ActionValue = string | number;
3083
3845
  interface Context {
3084
3846
  actionType?: ActionType;
3085
3847
  combatType?: CombatType;
3086
3848
  encounterType?: CombatType;
3087
- action?: any;
3849
+ action?: ActionValue;
3850
+ id?: string;
3088
3851
  originalCount?: number;
3089
- [key: string]: any;
3090
3852
  }
3091
3853
  interface ActionEntry {
3092
3854
  id: string;
3093
3855
  actionType: ActionType;
3094
3856
  cond: (ctx: Context) => boolean;
3095
3857
  display: (ctx: Context) => string;
3096
- value: (ctx: Context) => any;
3858
+ value: (ctx: Context) => ActionValue;
3097
3859
  color: (ctx: Context) => string;
3098
3860
  difficulty: (ctx: Context) => string;
3099
3861
  effect: (ctx: Context) => string;
@@ -3105,7 +3867,7 @@ interface ActionConfig {
3105
3867
  actionType: ActionType | ActionType[];
3106
3868
  cond: (ctx: Context) => boolean;
3107
3869
  display: (ctx: Context) => string;
3108
- value: (ctx: Context) => any;
3870
+ value: (ctx: Context) => ActionValue;
3109
3871
  color?: string | ((ctx: Context) => string);
3110
3872
  difficulty?: string | ((ctx: Context) => string);
3111
3873
  effect?: string | ((ctx: Context) => string);
@@ -3113,15 +3875,15 @@ interface ActionConfig {
3113
3875
  order?: number | ((ctx: Context) => number);
3114
3876
  }
3115
3877
  interface OptionsTable {
3116
- [key: string]: any;
3878
+ [key: string]: ActionValue;
3117
3879
  }
3118
3880
  declare class CombatActions {
3119
3881
  readonly actions: ActionEntry[];
3120
3882
  reg(...configs: ActionConfig[]): this;
3121
3883
  private eval;
3122
3884
  patchOptions(optionsTable: OptionsTable, actionType: ActionType, combatType?: CombatType): OptionsTable;
3123
- color(action: any, encounterType?: CombatType): string | null;
3124
- difficulty(action: any, combatType?: CombatType): string | null;
3885
+ color(action: ActionValue, encounterType?: CombatType): string | null;
3886
+ difficulty(action: ActionValue, combatType?: CombatType): string | null;
3125
3887
  effect(...actionTypes: ActionType[]): string;
3126
3888
  }
3127
3889
  //#endregion
@@ -3139,6 +3901,33 @@ declare class CombatManager {
3139
3901
  //#endregion
3140
3902
  //#region src/core.d.ts
3141
3903
  interface Extensions {}
3904
+ interface CoreModules {
3905
+ readonly addon: AddonPlugin;
3906
+ readonly dynamic: DynamicManager;
3907
+ readonly tool: ToolCollection;
3908
+ readonly audio: AudioManager;
3909
+ readonly var: Variables;
3910
+ readonly char: Character;
3911
+ readonly npc: NPCManager;
3912
+ readonly combat: CombatManager;
3913
+ }
3914
+ interface CoreEvents {
3915
+ ':indexedDB': [];
3916
+ ':idbReady': [];
3917
+ ':import': [];
3918
+ ':variable': [];
3919
+ ':onSave': [save: Save];
3920
+ ':onLoad': [save: Save];
3921
+ ':language': [];
3922
+ ':storyready': [];
3923
+ ':passageinit': [passage: Passage];
3924
+ ':passagestart': [passage: Passage, content: HTMLDivElement];
3925
+ ':passagerender': [passage: Passage, content: HTMLDivElement];
3926
+ ':passagedisplay': [passage: Passage, content: HTMLDivElement];
3927
+ ':passageend': [passage: Passage, content: HTMLDivElement];
3928
+ ':sugarcube': [];
3929
+ ':modLoaderEnd': [];
3930
+ }
3142
3931
  type Instance = MaplebirchCore & Extensions;
3143
3932
  declare class MaplebirchCore {
3144
3933
  static meta: {
@@ -3170,12 +3959,12 @@ declare class MaplebirchCore {
3170
3959
  clamp: typeof clamp;
3171
3960
  loadImage: typeof loadImage;
3172
3961
  }>;
3173
- modList: string[];
3962
+ readonly modList: string[];
3174
3963
  readonly manager: {
3175
3964
  modSC2DataManager: SC2DataManager;
3176
3965
  modLoaderGui: Gui;
3177
3966
  };
3178
- passage: any;
3967
+ passage: Passage;
3179
3968
  readonly yaml: typeof jsyaml;
3180
3969
  readonly howler: {
3181
3970
  Howl: typeof Howl;
@@ -3189,22 +3978,26 @@ declare class MaplebirchCore {
3189
3978
  readonly lang: LanguageManager;
3190
3979
  readonly modules: ModuleSystem;
3191
3980
  readonly gui: GUIControl;
3192
- readonly addon: AddonPlugin;
3193
- readonly dynamic: DynamicManager;
3194
- readonly tool: ToolCollection;
3195
- readonly audio: AudioManager;
3196
- readonly var: Variables;
3197
- readonly char: Character;
3198
- readonly npc: NPCManager;
3199
- readonly combat: CombatManager;
3981
+ readonly addon: CoreModules['addon'];
3982
+ readonly dynamic: CoreModules['dynamic'];
3983
+ readonly tool: CoreModules['tool'];
3984
+ readonly audio: CoreModules['audio'];
3985
+ readonly var: CoreModules['var'];
3986
+ readonly char: CoreModules['char'];
3987
+ readonly npc: CoreModules['npc'];
3988
+ readonly combat: CoreModules['combat'];
3200
3989
  constructor(modSC2DataManager: SC2DataManager, modLoaderGui: Gui);
3201
- log(msg: string, level?: string, ...objs: any[]): void;
3202
- on(eventName: string, callback: (...args: any[]) => any, description?: string): boolean;
3203
- off(eventName: string, identifier: string | ((...args: any[]) => any)): boolean;
3204
- once(eventName: string, callback: (...args: any[]) => any, description?: string): boolean;
3205
- after(eventName: string, callback: (...args: any[]) => any): void;
3206
- trigger(evt: string, ...args: any[]): Promise<void>;
3207
- register(name: string, module: any, dependencies?: string[]): boolean;
3990
+ log(msg: string, level?: string, ...objs: unknown[]): void;
3991
+ on<Name extends keyof CoreEvents>(eventName: Name, callback: EventCallback<CoreEvents[Name]>, description?: string): boolean;
3992
+ on<Name extends string, Args extends unknown[]>(eventName: Name extends keyof CoreEvents ? never : Name, callback: EventCallback<Args>, description?: string): boolean;
3993
+ off<Args extends unknown[]>(eventName: string, identifier: string | EventCallback<Args>): boolean;
3994
+ once<Name extends keyof CoreEvents>(eventName: Name, callback: EventCallback<CoreEvents[Name]>, description?: string): boolean;
3995
+ once<Name extends string, Args extends unknown[]>(eventName: Name extends keyof CoreEvents ? never : Name, callback: EventCallback<Args>, description?: string): boolean;
3996
+ after<Name extends keyof CoreEvents>(eventName: Name, callback: EventCallback<CoreEvents[Name]>): void;
3997
+ after<Name extends string, Args extends unknown[]>(eventName: Name extends keyof CoreEvents ? never : Name, callback: EventCallback<Args>): void;
3998
+ trigger<Name extends keyof CoreEvents>(eventName: Name, ...args: CoreEvents[Name]): Promise<void>;
3999
+ trigger<Name extends string>(eventName: Name extends keyof CoreEvents ? never : Name, ...args: unknown[]): Promise<void>;
4000
+ register<T extends object>(name: string, module: T & Module, dependencies?: string[]): boolean;
3208
4001
  t(key: string, space?: boolean): string;
3209
4002
  auto(text: string): string;
3210
4003
  disabled(modNames: string | string[], reload?: boolean): Promise<boolean>;
@@ -3216,14 +4009,15 @@ declare class MaplebirchCore {
3216
4009
  get Language(): string;
3217
4010
  set LogLevel(level: string);
3218
4011
  get LogLevel(): string;
3219
- get(name: string): any;
3220
- get dependencyGraph(): any;
4012
+ get<K extends keyof (CoreModules & Extensions)>(name: K): (CoreModules & Extensions)[K] | undefined;
4013
+ get(name: string): Module | undefined;
4014
+ get dependencyGraph(): DependencyGraph;
3221
4015
  get modLoader(): ReturnType<SC2DataManager['getModLoader']>;
3222
4016
  get modUtils(): ModUtils;
3223
4017
  get gameVersion(): string;
3224
4018
  }
3225
4019
  declare var maplebirch: Instance;
3226
- declare function createlog(prefix: string): (message: string, level?: string, ...objects: any[]) => void;
4020
+ declare function createlog(prefix: string): (message: string, level?: string, ...objects: unknown[]) => void;
3227
4021
  //#endregion
3228
4022
  //#region src/services/CredentialVault.d.ts
3229
4023
  type CredentialPeriod = 'day' | 'month';
@@ -3257,7 +4051,7 @@ interface CryptContext {
3257
4051
  payload?: AuthPayload;
3258
4052
  }
3259
4053
  interface CryptResult {
3260
- data: any;
4054
+ data: Awaited<InputFileFormat>;
3261
4055
  auth?: AuthConfig | boolean | void;
3262
4056
  }
3263
4057
  interface CryptOptions {
@@ -3270,8 +4064,8 @@ interface CryptOptions {
3270
4064
  prompt?: AuthConfig['prompt'] & {
3271
4065
  name?: string;
3272
4066
  };
3273
- lazyOptions?: any;
3274
- decrypt(password: string, context: CryptContext): Promise<CryptResult | Uint8Array | ArrayBuffer | Blob | string>;
4067
+ lazyOptions?: unknown;
4068
+ decrypt(password: string, context: CryptContext): Promise<CryptResult | Awaited<InputFileFormat>>;
3275
4069
  }
3276
4070
  declare class CredentialVault {
3277
4071
  readonly core: MaplebirchCore;
@@ -3301,6 +4095,21 @@ declare class CredentialVault {
3301
4095
  type Replacement = [RegExp, string];
3302
4096
  declare function replace(content: string, replacements: Replacement[], label?: string): string;
3303
4097
  //#endregion
4098
+ //#region src/modules/Addon/Resources.d.ts
4099
+ type ImageResult = string | false;
4100
+ declare class Resources {
4101
+ private readonly manager;
4102
+ private readonly report;
4103
+ private readonly cache;
4104
+ private readonly pending;
4105
+ constructor(manager: SC2DataManager, report: (path: string, error: unknown) => void);
4106
+ normalize(path: string): string;
4107
+ has(path: string): boolean | undefined;
4108
+ load(path: string): ImageResult | Promise<ImageResult>;
4109
+ clear(path?: string): void;
4110
+ private resolve;
4111
+ }
4112
+ //#endregion
3304
4113
  //#region src/modules/AddonPlugin.d.ts
3305
4114
  interface FileItem {
3306
4115
  modName: string;
@@ -3320,6 +4129,8 @@ declare class AddonPlugin {
3320
4129
  readonly replace: typeof replace;
3321
4130
  readonly SC2DataManager: SC2DataManager;
3322
4131
  readonly modUtils: ModUtils;
4132
+ readonly resources: Resources;
4133
+ readonly diagnostics: Diagnostics;
3323
4134
  readonly info: Map<
3324
4135
  string,
3325
4136
  {
@@ -3340,6 +4151,7 @@ declare class AddonPlugin {
3340
4151
  private scriptFilesExecuted;
3341
4152
  private bootReady;
3342
4153
  constructor(core: MaplebirchCore);
4154
+ wikify(name: string, callbacks: WikifyTracerCallback): void;
3343
4155
  hook<T>(name: string, handler: BootHandler<T>): boolean;
3344
4156
  canLoadThisMod(bootJson: ModBootJson, _zip: JSZipLikeReadOnlyInterface): Promise<boolean>;
3345
4157
  afterInjectEarlyLoad(): Promise<void>;
@@ -3368,8 +4180,6 @@ declare class AddonPlugin {
3368
4180
  private run;
3369
4181
  private config;
3370
4182
  private modifyOptionsDateFormat;
3371
- private saveHandle;
3372
- private error;
3373
4183
  }
3374
4184
  //#endregion
3375
- export { type Extensions, type MaplebirchCore, maplebirch as default, index_d_exports as utils };
4185
+ export { type CoreEvents, type CoreModules, type Extensions, type MaplebirchCore, type Save, type SaveObject, maplebirch as default, index_d_exports as utils };