@zebbedaja/er-save-parser 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -2,6 +2,7 @@
2
2
  type LogLevel = 'debug' | 'info' | 'warn' | 'error' | 'none';
3
3
  interface ParseOptions {
4
4
  logLevel?: LogLevel;
5
+ includeEventFlagUInt8Array?: boolean;
5
6
  }
6
7
  interface Save {
7
8
  magicBytes?: string;
@@ -79,6 +80,7 @@ interface Slot {
79
80
  notAloneFlag?: number;
80
81
  inGameCountdownTimer?: number;
81
82
  eventFlags?: EventFlag[];
83
+ eventFlagUint8Array?: Uint8Array;
82
84
  }
83
85
  interface Character {
84
86
  unk0x0?: number;
@@ -149,8 +151,72 @@ interface EventFlag {
149
151
  * @param buffer - The ArrayBuffer containing the save file data
150
152
  * @param options - Optional configuration for parsing
151
153
  * @param options.logLevel - Log level threshold: 'debug', 'info', 'warn', 'error', or 'none'. Defaults to 'error'
154
+ * @param options.includeEventFlagUInt8Array - Includes the raw event flag array data
152
155
  * @returns A Save object containing parsed slot and profile data
153
156
  */
154
157
  declare function parse(buffer: ArrayBuffer, options?: ParseOptions): Save;
155
158
  //#endregion
156
- export { type Character, type EventFlag, type LogLevel, type ParseOptions, type ProfileSummary, type Save, type Settings, type Slot, parse };
159
+ //#region src/util.d.ts
160
+ /**
161
+ * Compare two ArrayBuffers for byte-by-byte equality.
162
+ *
163
+ * @param buf1 - The first ArrayBuffer to compare
164
+ * @param buf2 - The second ArrayBuffer to compare
165
+ * @returns True if both buffers have identical byte content
166
+ */
167
+ declare function arrayBuffersEqual(buf1: ArrayBuffer, buf2: ArrayBuffer): boolean;
168
+ /**
169
+ * Convert a string into an array of byte values.
170
+ *
171
+ * @param string - The string to convert
172
+ * @returns An array of ASCII/Unicode byte values for each character
173
+ */
174
+ declare function stringToBytes(string: string): number[];
175
+ /**
176
+ * Convert an ArrayBuffer to a lowercase hexadecimal string.
177
+ *
178
+ * @param buffer - The ArrayBuffer to convert
179
+ * @returns A lowercase hexadecimal string representation of the buffer
180
+ */
181
+ declare function toHexString(buffer: ArrayBuffer): string;
182
+ /**
183
+ * Remove all null ('\x00') characters from a string.
184
+ *
185
+ * @param text - The string to clean
186
+ * @returns The input string with all null ('\x00') characters removed
187
+ */
188
+ declare const trim: (text: string) => string;
189
+ /**
190
+ * Parse a string of delimiter-separated "key,value" pairs into a Map.
191
+ *
192
+ * @param text - A string of delimiter-separated pairs, one per line
193
+ * @param delimiter - The character separating key and value (default: ",")
194
+ * @returns A Map with numeric keys and values parsed from the input
195
+ */
196
+ declare const parseToMap: (text: string, delimiter?: string) => Map<number, number>;
197
+ /**
198
+ * Returns tha Bst Map as a Map
199
+ *
200
+ * @returns Bst Map as Map
201
+ */
202
+ declare const getBstMap: () => Map<number, number>;
203
+ /**
204
+ * Determine whether a specific event flag is set.
205
+ *
206
+ * @param bstMap - A map of block IDs to their binary offsets
207
+ * @param eventFlags - The raw event_flags byte array from the save data
208
+ * @param eventId - The event ID to check
209
+ * @returns True if the event flag is set (active), false otherwise
210
+ */
211
+ declare const getEventFlagState: (bstMap: Map<number, number>, eventFlags: Uint8Array, eventId: number) => boolean;
212
+ /**
213
+ * Determine the event ID from a byte position and bit index.
214
+ *
215
+ * @param bstMap - A map of block IDs to their binary offsets
216
+ * @param bytePos - The byte position in the event_flags array
217
+ * @param bitIndex - The bit index within the byte (0-7)
218
+ * @returns The event ID corresponding to the given position
219
+ */
220
+ declare const getEventIdFromPosition: (bstMap: Map<number, number>, bytePos: number, bitIndex: number) => number;
221
+ //#endregion
222
+ export { type Character, type EventFlag, type LogLevel, type ParseOptions, type ProfileSummary, type Save, type Settings, type Slot, arrayBuffersEqual, getBstMap, getEventFlagState, getEventIdFromPosition, parse, parseToMap, stringToBytes, toHexString, trim };