@skyrim-platform/papyrus-util
Version:
TypeScript library for the PapyrusUtil Skyrim modding utility
157 lines (145 loc) • 14.7 kB
TypeScript
import { Form } from "skyrimPlatform";
/** MOD AUTHORS, READ!
These functions all work in exactly the same way as their StorageUtil.psc equivalents. See them for usage docs.
The important difference between these functions and the ones on StorageUtil.psc, is that instead of giving "Form ObjKey"
argument for the location to save the data, you give it a "string FileName" argument, pointing to an external JSON formatted file.
These files will be saved/loaded in JSON format, and the starting location for the files to save/load from is as follows:
data/skse/plugins/StorageUtilData/
Some important notes on usage to keep in mind:
- You may specific a folder path in the filename, i.e. "../MyData/config" will save to data/skse/plugins/MyData/config.json
- If not given in the filename argument, the filename will have the extension .json appended to it automatically when used.
- You do not need to call Load() or Save() manually unless you have a specific need to.
- When the player saves their game any modified file will be automatically saved, written to, or created if it does not exist.
- When the player loads another save without saving themselves or the Save() function having been manually called by a script,
the loaded data will be discarded and revert back to whatever the contents of the current saved file are. */
export declare const Load: (FileName: string) => boolean;
export declare const Save: (FileName: string, minify?: boolean) => boolean;
export declare const Unload: (FileName: string, saveChanges?: boolean, minify?: boolean) => boolean;
export declare const IsPendingSave: (FileName: string) => boolean;
export declare const IsGood: (FileName: string) => boolean;
export declare const GetErrors: (FileName: string) => string;
export declare const JsonInFolder: (folderPath: string) => string[];
export declare const JsonExists: (FileName: string) => boolean;
export declare const SetIntValue: (FileName: string, KeyName: string, value: number) => number;
export declare const SetFloatValue: (FileName: string, KeyName: string, value: number) => number;
export declare const SetStringValue: (FileName: string, KeyName: string, value: string) => string;
export declare const SetFormValue: (FileName: string, KeyName: string, value: Form | null | undefined) => Form | null | undefined;
export declare const GetIntValue: (FileName: string, KeyName: string, missing?: number) => number;
export declare const GetFloatValue: (FileName: string, KeyName: string, missing?: number) => number;
export declare const GetStringValue: (FileName: string, KeyName: string, missing?: string) => string;
export declare const GetFormValue: (FileName: string, KeyName: string, missing?: Form | null | undefined) => Form | null | undefined;
export declare const UnsetIntValue: (FileName: string, KeyName: string) => boolean;
export declare const UnsetFloatValue: (FileName: string, KeyName: string) => boolean;
export declare const UnsetStringValue: (FileName: string, KeyName: string) => boolean;
export declare const UnsetFormValue: (FileName: string, KeyName: string) => boolean;
export declare const HasIntValue: (FileName: string, KeyName: string) => boolean;
export declare const HasFloatValue: (FileName: string, KeyName: string) => boolean;
export declare const HasStringValue: (FileName: string, KeyName: string) => boolean;
export declare const HasFormValue: (FileName: string, KeyName: string) => boolean;
export declare const IntListAdd: (FileName: string, KeyName: string, value: number, allowDuplicate?: boolean) => number;
export declare const FloatListAdd: (FileName: string, KeyName: string, value: number, allowDuplicate?: boolean) => number;
export declare const StringListAdd: (FileName: string, KeyName: string, value: string, allowDuplicate?: boolean) => number;
export declare const FormListAdd: (FileName: string, KeyName: string, value: Form | null | undefined, allowDuplicate?: boolean) => number;
export declare const IntListGet: (FileName: string, KeyName: string, index: number) => number;
export declare const FloatListGet: (FileName: string, KeyName: string, index: number) => number;
export declare const StringListGet: (FileName: string, KeyName: string, index: number) => string;
export declare const FormListGet: (FileName: string, KeyName: string, index: number) => Form | null | undefined;
export declare const IntListSet: (FileName: string, KeyName: string, index: number, value: number) => number;
export declare const FloatListSet: (FileName: string, KeyName: string, index: number, value: number) => number;
export declare const StringListSet: (FileName: string, KeyName: string, index: number, value: string) => string;
export declare const FormListSet: (FileName: string, KeyName: string, index: number, value: Form | null | undefined) => Form | null | undefined;
export declare const IntListRemove: (FileName: string, KeyName: string, value: number, allInstances?: boolean) => number;
export declare const FloatListRemove: (FileName: string, KeyName: string, value: number, allInstances?: boolean) => number;
export declare const StringListRemove: (FileName: string, KeyName: string, value: string, allInstances?: boolean) => number;
export declare const FormListRemove: (FileName: string, KeyName: string, value: Form | null | undefined, allInstances?: boolean) => number;
export declare const IntListInsertAt: (FileName: string, KeyName: string, index: number, value: number) => boolean;
export declare const FloatListInsertAt: (FileName: string, KeyName: string, index: number, value: number) => boolean;
export declare const StringListInsertAt: (FileName: string, KeyName: string, index: number, value: string) => boolean;
export declare const FormListInsertAt: (FileName: string, KeyName: string, index: number, value: Form | null | undefined) => boolean;
export declare const IntListRemoveAt: (FileName: string, KeyName: string, index: number) => boolean;
export declare const FloatListRemoveAt: (FileName: string, KeyName: string, index: number) => boolean;
export declare const StringListRemoveAt: (FileName: string, KeyName: string, index: number) => boolean;
export declare const FormListRemoveAt: (FileName: string, KeyName: string, index: number) => boolean;
export declare const IntListClear: (FileName: string, KeyName: string) => number;
export declare const FloatListClear: (FileName: string, KeyName: string) => number;
export declare const StringListClear: (FileName: string, KeyName: string) => number;
export declare const FormListClear: (FileName: string, KeyName: string) => number;
export declare const IntListCount: (FileName: string, KeyName: string) => number;
export declare const FloatListCount: (FileName: string, KeyName: string) => number;
export declare const StringListCount: (FileName: string, KeyName: string) => number;
export declare const FormListCount: (FileName: string, KeyName: string) => number;
export declare const IntListCountValue: (FileName: string, KeyName: string, value: number, exclude?: boolean) => number;
export declare const FloatListCountValue: (FileName: string, KeyName: string, value: number, exclude?: boolean) => number;
export declare const StringListCountValue: (FileName: string, KeyName: string, value: string, exclude?: boolean) => number;
export declare const FormListCountValue: (FileName: string, KeyName: string, value: Form | null | undefined, exclude?: boolean) => number;
export declare const IntListFind: (FileName: string, KeyName: string, value: number) => number;
export declare const FloatListFind: (FileName: string, KeyName: string, value: number) => number;
export declare const StringListFind: (FileName: string, KeyName: string, value: string) => number;
export declare const FormListFind: (FileName: string, KeyName: string, value: Form | null | undefined) => number;
export declare const IntListHas: (FileName: string, KeyName: string, value: number) => boolean;
export declare const FloatListHas: (FileName: string, KeyName: string, value: number) => boolean;
export declare const StringListHas: (FileName: string, KeyName: string, value: string) => boolean;
export declare const FormListHas: (FileName: string, KeyName: string, value: Form | null | undefined) => boolean;
export declare const IntListSlice: (FileName: string, KeyName: string, slice: number[], startIndex?: number) => void;
export declare const FloatListSlice: (FileName: string, KeyName: string, slice: number[], startIndex?: number) => void;
export declare const StringListSlice: (FileName: string, KeyName: string, slice: string[], startIndex?: number) => void;
export declare const FormListSlice: (FileName: string, KeyName: string, slice: Form[], startIndex?: number) => void;
export declare const IntListResize: (FileName: string, KeyName: string, toLength: number, filler?: number) => number;
export declare const FloatListResize: (FileName: string, KeyName: string, toLength: number, filler?: number) => number;
export declare const StringListResize: (FileName: string, KeyName: string, toLength: number, filler?: string) => number;
export declare const FormListResize: (FileName: string, KeyName: string, toLength: number, filler?: Form | null | undefined) => number;
export declare const IntListCopy: (FileName: string, KeyName: string, copy: number[]) => boolean;
export declare const FloatListCopy: (FileName: string, KeyName: string, copy: number[]) => boolean;
export declare const StringListCopy: (FileName: string, KeyName: string, copy: string[]) => boolean;
export declare const FormListCopy: (FileName: string, KeyName: string, copy: Form[]) => boolean;
export declare const IntListToArray: (FileName: string, KeyName: string) => number[];
export declare const FloatListToArray: (FileName: string, KeyName: string) => number[];
export declare const StringListToArray: (FileName: string, KeyName: string) => string[];
export declare const FormListToArray: (FileName: string, KeyName: string) => Form[];
export declare const AdjustIntValue: (FileName: string, KeyName: string, amount: number) => number;
export declare const AdjustFloatValue: (FileName: string, KeyName: string, amount: number) => number;
export declare const IntListAdjust: (FileName: string, KeyName: string, index: number, amount: number) => number;
export declare const FloatListAdjust: (FileName: string, KeyName: string, index: number, amount: number) => number;
export declare const CountIntValuePrefix: (FileName: string, PrefixKey: string) => number;
export declare const CountFloatValuePrefix: (FileName: string, PrefixKey: string) => number;
export declare const CountStringValuePrefix: (FileName: string, PrefixKey: string) => number;
export declare const CountFormValuePrefix: (FileName: string, PrefixKey: string) => number;
export declare const CountIntListPrefix: (FileName: string, PrefixKey: string) => number;
export declare const CountFloatListPrefix: (FileName: string, PrefixKey: string) => number;
export declare const CountStringListPrefix: (FileName: string, PrefixKey: string) => number;
export declare const CountFormListPrefix: (FileName: string, PrefixKey: string) => number;
export declare const CountAllPrefix: (FileName: string, PrefixKey: string) => number;
export declare const SetPathIntValue: (FileName: string, Path: string, value: number) => void;
export declare const SetPathFloatValue: (FileName: string, Path: string, value: number) => void;
export declare const SetPathStringValue: (FileName: string, Path: string, value: string) => void;
export declare const SetPathFormValue: (FileName: string, Path: string, value: Form | null | undefined) => void;
export declare const SetRawPathValue: (FileName: string, Path: string, RawJSON: string) => boolean;
export declare const GetPathIntValue: (FileName: string, Path: string, missing?: number) => number;
export declare const GetPathFloatValue: (FileName: string, Path: string, missing?: number) => number;
export declare const GetPathStringValue: (FileName: string, Path: string, missing?: string) => string;
export declare const GetPathFormValue: (FileName: string, Path: string, missing?: Form | null | undefined) => Form | null | undefined;
export declare const GetPathBoolValue: (FileName: string, Path: string, missing?: boolean) => boolean;
export declare const PathIntElements: (FileName: string, Path: string, invalidType?: number) => number[];
export declare const PathFloatElements: (FileName: string, Path: string, invalidType?: number) => number[];
export declare const PathStringElements: (FileName: string, Path: string, invalidType?: string) => string[];
export declare const PathFormElements: (FileName: string, Path: string, invalidType?: Form | null | undefined) => Form[];
export declare const FindPathIntElement: (FileName: string, Path: string, toFind: number) => number;
export declare const FindPathFloatElement: (FileName: string, Path: string, toFind: number) => number;
export declare const FindPathStringElement: (FileName: string, Path: string, toFind: string) => number;
export declare const FindPathFormElement: (FileName: string, Path: string, toFind: Form | null | undefined) => number;
export declare const PathCount: (FileName: string, Path: string) => number;
export declare const PathMembers: (FileName: string, Path: string) => string[];
export declare const CanResolvePath: (FileName: string, Path: string) => boolean;
export declare const IsPathString: (FileName: string, Path: string) => boolean;
export declare const IsPathNumber: (FileName: string, Path: string) => boolean;
export declare const IsPathForm: (FileName: string, Path: string) => boolean;
export declare const IsPathBool: (FileName: string, Path: string) => boolean;
export declare const IsPathArray: (FileName: string, Path: string) => boolean;
export declare const IsPathObject: (FileName: string, Path: string) => boolean;
export declare const SetPathIntArray: (FileName: string, Path: string, arr: number[], append?: boolean) => void;
export declare const SetPathFloatArray: (FileName: string, Path: string, arr: number[], append?: boolean) => void;
export declare const SetPathStringArray: (FileName: string, Path: string, arr: string[], append?: boolean) => void;
export declare const SetPathFormArray: (FileName: string, Path: string, arr: Form[], append?: boolean) => void;
export declare const ClearPath: (FileName: string, Path: string) => void;
export declare const ClearPathIndex: (FileName: string, Path: string, Index: number) => void;
export declare const ClearAll: (FileName: string) => void;