skygame-data 0.1.3 → 0.2.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.
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  [![npm](https://img.shields.io/npm/v/skygame-data)](https://www.npmjs.com/package/skygame-data)
4
4
 
5
- A fan-made data repository for Sky: Children of the Light. This project contains the raw data that fuels [SkyGame-Planner](https://github.com/Silverfeelin/SkyGame-Planner). The data has been separated to make it easier to consume in other projects. Do note that various bits of data are tightly coupled to the Sky Planner, such as linking to image assets contained in that project.
5
+ A fan-made data repository for Sky: Children of the Light. This project contains the raw data that fuels [SkyGame-Planner](https://github.com/Silverfeelin/SkyGame-Planner). The data has been separated to make it easier to consume in other projects. Do note that various bits of data are tightly coupled to the Sky Planner, such as links to image assets contained in that project.
6
6
 
7
7
  ## Package
8
8
 
@@ -117,13 +117,69 @@ References marked in **bold** are stored as GUID reference in the data. For one-
117
117
 
118
118
  Circular references are marked in *italic* and are created automatically when parsing the data using the included [Scripts](#scripts).
119
119
 
120
- TODO
120
+ ![Reference diagram](./diagrams/References.jpg)
121
121
 
122
122
  ## Scripts
123
123
 
124
124
  The project includes some utilities to parse the data into a Javascript object with resolved GUID references. Do note that this data can not be serialized normally due to the circular references in the data, as per the diagram.
125
125
 
126
- TODO
126
+ **SkyDataResolver**
127
+
128
+ Helper class that can parse and resolve references using the `everything.json` file.
129
+
130
+ Example:
131
+ ```ts
132
+ import { SkyDataResolver } from 'skygame-data';
133
+
134
+ (async () => {
135
+ const response = await fetch('https://unpkg.com/skygame-data@0.2.0/assets/everything.json');
136
+ const data = await response.json();
137
+ const resolved = await SkyDataResolver.resolve(data);
138
+ console.log(resolved.seasons.items.length);
139
+ })();
140
+ ```
141
+
142
+
143
+ **SkyDateHelper**
144
+
145
+ Helper class that can parse date strings to Luxon DateTime objects based on the `America/Los_Angeles` timezone.
146
+
147
+ Example:
148
+ ```ts
149
+ import { SkyDateHelper } from 'skygame-data';
150
+
151
+ const date = SkyDateHelper.fromStringSky('2026-01-01');
152
+ console.log(date.toISO()); // 2026-01-01T08:00:00.000Z
153
+ ```
154
+
155
+ **SpiritTreeHelper**
156
+
157
+ Helper class that has some utilities for working with spirit trees.
158
+
159
+ Example:
160
+ ```ts
161
+ import { SpiritTreeHelper } from 'skygame-data';
162
+
163
+ const resolved; // See SkyDataResolver example.
164
+ const spirit = resolved.spirits.items.find(s => s.name === 'Migrating Bellmaker')!;
165
+ const nodes = SpiritTreeHelper.getNodes(spirit.tree!);
166
+ console.log(nodes.length);
167
+ ```
168
+
169
+ **NodeHelper**
170
+
171
+ Helper class that has some utilities for working with nodes.
172
+
173
+ Example:
174
+ ```ts
175
+ import { NodeHelper } from 'skygame-data';
176
+
177
+ const resolved; // See SkyDataResolver example.
178
+ const item = resolved.items.items.find(i => i.name === 'Admiring Actor Outfit')!;
179
+ const node = item.nodes!.at(0);
180
+ const nodes = NodeHelper.trace(node);
181
+ console.log(nodes.length);
182
+ ```
127
183
 
128
184
  # Discord
129
185