@zebbedaja/er-save-parser 0.0.7 → 0.0.9

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/README.md +71 -12
  2. package/dist/index.mjs +2611 -31
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -1,11 +1,17 @@
1
1
  # ER Save Parser
2
2
 
3
+ ![CI](https://github.com/zebbedaja/er-save-parser/actions/workflows/ci.yml/badge.svg)
4
+ [![npm version](https://img.shields.io/npm/v/@zebbedaja/er-save-parser)](https://www.npmjs.com/package/@zebbedaja/er-save-parser)
5
+ [![npm downloads](https://img.shields.io/npm/dm/@zebbedaja/er-save-parser)](https://www.npmjs.com/package/@zebbedaja/er-save-parser)
6
+ ![npm package minimized gzipped size](https://img.shields.io/bundlejs/size/%40zebbedaja%2Fer-save-parser)
7
+ [![license](https://img.shields.io/badge/license-MIT-blue)](LICENSE)
8
+
3
9
  Parse Elden Ring PC save files into structured TypeScript/JavaScript objects.
4
10
 
5
11
  ## Features
6
12
 
7
13
  - **Full save slot parsing** — all 10 slots with character data, attributes, Flask counts, regions visited, death count, and more
8
- - **Event flag decoding** — track boss defeats, quest progress, and ending states using bit-level BST map lookups
14
+ - **Event flag decoding** — track boss defeats, quest progress, and ending states
9
15
  - **Settings extraction** — camera, audio, HDR, ray tracing, and other game settings
10
16
  - **Profile summaries** — character name, level, play time, starting gift, and archetype per slot
11
17
  - **Zero runtime dependencies** — pure ESM, no bundled dependencies
@@ -18,6 +24,10 @@ npm install @zebbedaja/er-save-parser
18
24
 
19
25
  ## Usage
20
26
 
27
+ ### Node
28
+
29
+ #### TypeScript
30
+
21
31
  ```typescript
22
32
  import { parse, type Save, type Slot, type Character } from '@zebbedaja/er-save-parser'
23
33
  import { readFileSync } from 'fs'
@@ -48,8 +58,42 @@ slot?.eventFlags?.forEach((flag) => {
48
58
  })
49
59
  ```
50
60
 
61
+ #### JavaScript
62
+
63
+ ```javascript
64
+ import { parse } from '@zebbedaja/er-save-parser'
65
+ import { readFileSync } from 'node:fs'
66
+
67
+ const buffer = readFileSync('ER0000.sl2').buffer
68
+ const save = parse(buffer)
69
+
70
+ console.log(save.steamId)
71
+ console.log(save.settings?.hud)
72
+
73
+ const slot = save.slots?.[0]
74
+ const char = slot?.character
75
+
76
+ if (char) {
77
+ console.log(char.characterName) // "Tarnished"
78
+ console.log(char.level) // 150
79
+ console.log(char.runes) // 1234567
80
+ console.log(char.strength) // 45
81
+ console.log(char.faith) // 30
82
+ console.log(char.arcane) // 20
83
+ }
84
+
85
+ // Check boss defeats
86
+ slot?.eventFlags?.forEach((flag) => {
87
+ if (flag.state) {
88
+ console.log(`${flag.name} ✓`)
89
+ }
90
+ })
91
+ ```
92
+
51
93
  ### Reading from a file in the browser
52
94
 
95
+ #### TypeScript
96
+
53
97
  ```typescript
54
98
  async function parseFromFile(file: File): Promise<Save> {
55
99
  const buffer = await file.arrayBuffer()
@@ -57,6 +101,15 @@ async function parseFromFile(file: File): Promise<Save> {
57
101
  }
58
102
  ```
59
103
 
104
+ #### JavaScript
105
+
106
+ ```javascript
107
+ async function parseFromFile(file) {
108
+ const buffer = await file.arrayBuffer()
109
+ return parse(buffer)
110
+ }
111
+ ```
112
+
60
113
  ## Parsed Data
61
114
 
62
115
  ### `Save` (root)
@@ -144,17 +197,7 @@ async function parseFromFile(file: File): Promise<Save> {
144
197
 
145
198
  ## Error handling
146
199
 
147
- ```typescript
148
- try {
149
- const save = parse(buffer)
150
- } catch (error: unknown) {
151
- if (error instanceof Error) {
152
- console.error('Failed to parse save file:', error.message)
153
- }
154
- }
155
- ```
156
-
157
- The parser will throw if:
200
+ The parser will throw an Error if:
158
201
  - The file magic bytes don't match `BND4` or `SL2\x00`
159
202
  - Event flags reference blocks not found in the BST map
160
203
  - Calculated byte positions exceed save data bounds
@@ -169,6 +212,22 @@ npm run build # Bundle with tsdown
169
212
  npm run dev # Watch mode
170
213
  ```
171
214
 
215
+ ## TODO
216
+
217
+ - Read all event flags
218
+ - Read equipment
219
+ - Read inventory
220
+
172
221
  ## License
173
222
 
174
223
  MIT
224
+
225
+ ## Credits
226
+
227
+ - [Hapfel1/er-save-manager](https://github.com/Hapfel1/er-save-manager) — Python-based save manager/editor with GUI, backup, teleportation, and community features
228
+ - [ClayAmore/ER-Save-Lib](https://github.com/ClayAmore/ER-Save-Lib) — Rust library for reading/writing save files with PC and PlayStation support
229
+ - [ClayAmore/ER-Save-Editor](https://github.com/ClayAmore/ER-Save-Editor) — Full-featured Rust save editor for PC and PlayStation save files
230
+ - [EthanShoeDev/elden-ring-compass](https://github.com/EthanShoeDev/elden-ring-compass) — React-based progress tracker with interactive map and save file polling
231
+ - [CyberGiant7/Elden-Ring-Automatic-Checklist](https://github.com/CyberGiant7/Elden-Ring-Automatic-Checklist) — Online tool that analyzes save files to track 100% completion and missing items
232
+ - [vawser/Smithbox](https://github.com/vawser/Smithbox) — Comprehensive modding tool for FromSoftware games with param, map, model, and material editors
233
+ - [soulsmodding.com](https://soulsmodding.com) — FromSoftware save file documentation and reverse engineering resources