@etothepii/satisfactory-file-parser 0.0.11 → 0.0.12
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/build/index.d.ts +5 -1
- package/build/index.js +46 -9
- package/build/parser/blueprint-reader.js +28 -20
- package/build/parser/blueprint-writer.js +20 -15
- package/build/parser/byte/alignment.enum.js +5 -2
- package/build/parser/byte/byte-reader.class.js +13 -9
- package/build/parser/byte/byte-writer.class.js +13 -10
- package/build/parser/error/parser.error.js +11 -4
- package/build/parser/parser.js +15 -12
- package/build/parser/satisfactory/blueprint/blueprint.js +2 -1
- package/build/parser/satisfactory/level.class.js +28 -24
- package/build/parser/satisfactory/objects/DataFields.js +76 -72
- package/build/parser/satisfactory/objects/ObjectReference.js +5 -1
- package/build/parser/satisfactory/objects/Property.js +118 -87
- package/build/parser/satisfactory/objects/SaveComponent.js +11 -7
- package/build/parser/satisfactory/objects/SaveEntity.js +17 -13
- package/build/parser/satisfactory/objects/SaveObject.js +9 -5
- package/build/parser/satisfactory/satisfactory-save.js +5 -1
- package/build/parser/satisfactory/static-data.js +2 -1
- package/build/parser/satisfactory/structs/util.types.js +47 -27
- package/build/parser/save-reader.js +34 -26
- package/build/parser/save-writer.js +33 -26
- package/package.json +1 -2
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DataFields = void 0;
|
|
4
|
+
const Property_1 = require("./Property");
|
|
5
|
+
class DataFields {
|
|
3
6
|
constructor() {
|
|
4
7
|
this.properties = [];
|
|
5
8
|
this.trailingData = [];
|
|
@@ -52,33 +55,33 @@ export class DataFields {
|
|
|
52
55
|
let overhead = 0;
|
|
53
56
|
switch (propertyType) {
|
|
54
57
|
case 'BoolProperty':
|
|
55
|
-
currentProperty = BoolProperty.Parse(reader, propertyType, index);
|
|
56
|
-
overhead = BoolProperty.CalcOverhead(currentProperty);
|
|
58
|
+
currentProperty = Property_1.BoolProperty.Parse(reader, propertyType, index);
|
|
59
|
+
overhead = Property_1.BoolProperty.CalcOverhead(currentProperty);
|
|
57
60
|
break;
|
|
58
61
|
case 'ByteProperty':
|
|
59
|
-
currentProperty = ByteProperty.Parse(reader, propertyType, index);
|
|
60
|
-
overhead = ByteProperty.CalcOverhead(currentProperty);
|
|
62
|
+
currentProperty = Property_1.ByteProperty.Parse(reader, propertyType, index);
|
|
63
|
+
overhead = Property_1.ByteProperty.CalcOverhead(currentProperty);
|
|
61
64
|
break;
|
|
62
65
|
case 'Int8Property':
|
|
63
|
-
currentProperty = Int8Property.Parse(reader, propertyType, index);
|
|
64
|
-
overhead = Int8Property.CalcOverhead(currentProperty);
|
|
66
|
+
currentProperty = Property_1.Int8Property.Parse(reader, propertyType, index);
|
|
67
|
+
overhead = Property_1.Int8Property.CalcOverhead(currentProperty);
|
|
65
68
|
break;
|
|
66
69
|
case 'UInt8Property':
|
|
67
|
-
currentProperty = Uint8Property.Parse(reader, propertyType, index);
|
|
68
|
-
overhead = Uint8Property.CalcOverhead(currentProperty);
|
|
70
|
+
currentProperty = Property_1.Uint8Property.Parse(reader, propertyType, index);
|
|
71
|
+
overhead = Property_1.Uint8Property.CalcOverhead(currentProperty);
|
|
69
72
|
break;
|
|
70
73
|
case 'IntProperty':
|
|
71
74
|
case 'Int32Property':
|
|
72
|
-
currentProperty = Int32Property.Parse(reader, propertyType, index);
|
|
73
|
-
overhead = Int32Property.CalcOverhead(currentProperty);
|
|
75
|
+
currentProperty = Property_1.Int32Property.Parse(reader, propertyType, index);
|
|
76
|
+
overhead = Property_1.Int32Property.CalcOverhead(currentProperty);
|
|
74
77
|
break;
|
|
75
78
|
case 'UInt32Property':
|
|
76
|
-
currentProperty = Uint32Property.Parse(reader, propertyType, index);
|
|
77
|
-
overhead = Uint32Property.CalcOverhead(currentProperty);
|
|
79
|
+
currentProperty = Property_1.Uint32Property.Parse(reader, propertyType, index);
|
|
80
|
+
overhead = Property_1.Uint32Property.CalcOverhead(currentProperty);
|
|
78
81
|
break;
|
|
79
82
|
case 'Int64Property':
|
|
80
|
-
currentProperty = Int64Property.Parse(reader, propertyType, index);
|
|
81
|
-
overhead = Int64Property.CalcOverhead(currentProperty);
|
|
83
|
+
currentProperty = Property_1.Int64Property.Parse(reader, propertyType, index);
|
|
84
|
+
overhead = Property_1.Int64Property.CalcOverhead(currentProperty);
|
|
82
85
|
break;
|
|
83
86
|
// TODO
|
|
84
87
|
/*
|
|
@@ -88,47 +91,47 @@ export class DataFields {
|
|
|
88
91
|
*/
|
|
89
92
|
case 'SingleProperty':
|
|
90
93
|
case 'FloatProperty':
|
|
91
|
-
currentProperty = FloatProperty.Parse(reader, propertyType, index);
|
|
92
|
-
overhead = FloatProperty.CalcOverhead(currentProperty);
|
|
94
|
+
currentProperty = Property_1.FloatProperty.Parse(reader, propertyType, index);
|
|
95
|
+
overhead = Property_1.FloatProperty.CalcOverhead(currentProperty);
|
|
93
96
|
break;
|
|
94
97
|
case 'DoubleProperty':
|
|
95
|
-
currentProperty = DoubleProperty.Parse(reader, propertyType, index);
|
|
96
|
-
overhead = DoubleProperty.CalcOverhead(currentProperty);
|
|
98
|
+
currentProperty = Property_1.DoubleProperty.Parse(reader, propertyType, index);
|
|
99
|
+
overhead = Property_1.DoubleProperty.CalcOverhead(currentProperty);
|
|
97
100
|
break;
|
|
98
101
|
case 'StrProperty':
|
|
99
102
|
case 'NameProperty':
|
|
100
|
-
currentProperty = StrProperty.Parse(reader, propertyType, index);
|
|
101
|
-
overhead = StrProperty.CalcOverhead(currentProperty);
|
|
103
|
+
currentProperty = Property_1.StrProperty.Parse(reader, propertyType, index);
|
|
104
|
+
overhead = Property_1.StrProperty.CalcOverhead(currentProperty);
|
|
102
105
|
break;
|
|
103
106
|
case 'ObjectProperty':
|
|
104
107
|
case 'InterfaceProperty':
|
|
105
|
-
currentProperty = ObjectProperty.Parse(reader, propertyType, index);
|
|
106
|
-
overhead = ObjectProperty.CalcOverhead(currentProperty);
|
|
108
|
+
currentProperty = Property_1.ObjectProperty.Parse(reader, propertyType, index);
|
|
109
|
+
overhead = Property_1.ObjectProperty.CalcOverhead(currentProperty);
|
|
107
110
|
break;
|
|
108
111
|
case 'EnumProperty':
|
|
109
|
-
currentProperty = EnumProperty.Parse(reader, propertyType, index);
|
|
110
|
-
overhead = EnumProperty.CalcOverhead(currentProperty);
|
|
112
|
+
currentProperty = Property_1.EnumProperty.Parse(reader, propertyType, index);
|
|
113
|
+
overhead = Property_1.EnumProperty.CalcOverhead(currentProperty);
|
|
111
114
|
break;
|
|
112
115
|
case 'StructProperty':
|
|
113
|
-
currentProperty = StructProperty.Parse(reader, propertyType, index, binarySize);
|
|
114
|
-
overhead = StructProperty.CalcOverhead(currentProperty);
|
|
116
|
+
currentProperty = Property_1.StructProperty.Parse(reader, propertyType, index, binarySize);
|
|
117
|
+
overhead = Property_1.StructProperty.CalcOverhead(currentProperty);
|
|
115
118
|
break;
|
|
116
119
|
case 'ArrayProperty':
|
|
117
|
-
currentProperty = ArrayProperty.Parse(reader, propertyType, index, propertyName);
|
|
118
|
-
overhead = ArrayProperty.CalcOverhead(currentProperty);
|
|
120
|
+
currentProperty = Property_1.ArrayProperty.Parse(reader, propertyType, index, propertyName);
|
|
121
|
+
overhead = Property_1.ArrayProperty.CalcOverhead(currentProperty);
|
|
119
122
|
break;
|
|
120
123
|
case 'MapProperty':
|
|
121
124
|
//currentProperty = reader.readMapProperty(currentProperty, '');
|
|
122
|
-
currentProperty = MapProperty.Parse(reader, propertyName, buildVersion, binarySize);
|
|
123
|
-
overhead = MapProperty.CalcOverhead(currentProperty);
|
|
125
|
+
currentProperty = Property_1.MapProperty.Parse(reader, propertyName, buildVersion, binarySize);
|
|
126
|
+
overhead = Property_1.MapProperty.CalcOverhead(currentProperty);
|
|
124
127
|
break;
|
|
125
128
|
case 'TextProperty':
|
|
126
|
-
currentProperty = TextProperty.Parse(reader, propertyType, index);
|
|
127
|
-
overhead = TextProperty.CalcOverhead(currentProperty);
|
|
129
|
+
currentProperty = Property_1.TextProperty.Parse(reader, propertyType, index);
|
|
130
|
+
overhead = Property_1.TextProperty.CalcOverhead(currentProperty);
|
|
128
131
|
break;
|
|
129
132
|
case 'SetProperty':
|
|
130
|
-
currentProperty = SetProperty.Parse(reader, propertyType, index, propertyName);
|
|
131
|
-
overhead = SetProperty.CalcOverhead(currentProperty);
|
|
133
|
+
currentProperty = Property_1.SetProperty.Parse(reader, propertyType, index, propertyName);
|
|
134
|
+
overhead = Property_1.SetProperty.CalcOverhead(currentProperty);
|
|
132
135
|
break;
|
|
133
136
|
default:
|
|
134
137
|
throw new Error(`Unimplemented type ${propertyType}`);
|
|
@@ -160,81 +163,81 @@ export class DataFields {
|
|
|
160
163
|
let overhead = 0;
|
|
161
164
|
switch (property.ueType) {
|
|
162
165
|
case 'BoolProperty':
|
|
163
|
-
overhead = BoolProperty.CalcOverhead(property);
|
|
164
|
-
BoolProperty.Serialize(writer, property);
|
|
166
|
+
overhead = Property_1.BoolProperty.CalcOverhead(property);
|
|
167
|
+
Property_1.BoolProperty.Serialize(writer, property);
|
|
165
168
|
break;
|
|
166
169
|
case 'ByteProperty':
|
|
167
|
-
overhead = ByteProperty.CalcOverhead(property);
|
|
168
|
-
ByteProperty.Serialize(writer, property);
|
|
170
|
+
overhead = Property_1.ByteProperty.CalcOverhead(property);
|
|
171
|
+
Property_1.ByteProperty.Serialize(writer, property);
|
|
169
172
|
break;
|
|
170
173
|
case 'Int8Property':
|
|
171
|
-
overhead = Int8Property.CalcOverhead(property);
|
|
172
|
-
Int8Property.Serialize(writer, property);
|
|
174
|
+
overhead = Property_1.Int8Property.CalcOverhead(property);
|
|
175
|
+
Property_1.Int8Property.Serialize(writer, property);
|
|
173
176
|
break;
|
|
174
177
|
case 'UInt8Property':
|
|
175
|
-
overhead = Uint8Property.CalcOverhead(property);
|
|
176
|
-
Uint8Property.Serialize(writer, property);
|
|
178
|
+
overhead = Property_1.Uint8Property.CalcOverhead(property);
|
|
179
|
+
Property_1.Uint8Property.Serialize(writer, property);
|
|
177
180
|
break;
|
|
178
181
|
case 'IntProperty':
|
|
179
182
|
case 'Int32Property':
|
|
180
|
-
overhead = Int32Property.CalcOverhead(property);
|
|
181
|
-
Int32Property.Serialize(writer, property);
|
|
183
|
+
overhead = Property_1.Int32Property.CalcOverhead(property);
|
|
184
|
+
Property_1.Int32Property.Serialize(writer, property);
|
|
182
185
|
break;
|
|
183
186
|
case 'UInt32Property':
|
|
184
|
-
overhead = Uint32Property.CalcOverhead(property);
|
|
185
|
-
Uint32Property.Serialize(writer, property);
|
|
187
|
+
overhead = Property_1.Uint32Property.CalcOverhead(property);
|
|
188
|
+
Property_1.Uint32Property.Serialize(writer, property);
|
|
186
189
|
break;
|
|
187
190
|
case 'Int64Property':
|
|
188
|
-
overhead = Int64Property.CalcOverhead(property);
|
|
189
|
-
Int64Property.Serialize(writer, property);
|
|
191
|
+
overhead = Property_1.Int64Property.CalcOverhead(property);
|
|
192
|
+
Property_1.Int64Property.Serialize(writer, property);
|
|
190
193
|
break;
|
|
191
194
|
// TODO: uint64Property
|
|
192
195
|
case 'SingleProperty':
|
|
193
196
|
case 'FloatProperty':
|
|
194
|
-
overhead = FloatProperty.CalcOverhead(property);
|
|
195
|
-
FloatProperty.Serialize(writer, property);
|
|
197
|
+
overhead = Property_1.FloatProperty.CalcOverhead(property);
|
|
198
|
+
Property_1.FloatProperty.Serialize(writer, property);
|
|
196
199
|
break;
|
|
197
200
|
case 'DoubleProperty':
|
|
198
|
-
overhead = DoubleProperty.CalcOverhead(property);
|
|
199
|
-
DoubleProperty.Serialize(writer, property);
|
|
201
|
+
overhead = Property_1.DoubleProperty.CalcOverhead(property);
|
|
202
|
+
Property_1.DoubleProperty.Serialize(writer, property);
|
|
200
203
|
break;
|
|
201
204
|
case 'StrProperty':
|
|
202
205
|
case 'NameProperty':
|
|
203
|
-
overhead = StrProperty.CalcOverhead(property);
|
|
204
|
-
StrProperty.Serialize(writer, property);
|
|
206
|
+
overhead = Property_1.StrProperty.CalcOverhead(property);
|
|
207
|
+
Property_1.StrProperty.Serialize(writer, property);
|
|
205
208
|
break;
|
|
206
209
|
case 'ObjectProperty':
|
|
207
210
|
case 'InterfaceProperty':
|
|
208
|
-
overhead = ObjectProperty.CalcOverhead(property);
|
|
209
|
-
ObjectProperty.Serialize(writer, property);
|
|
211
|
+
overhead = Property_1.ObjectProperty.CalcOverhead(property);
|
|
212
|
+
Property_1.ObjectProperty.Serialize(writer, property);
|
|
210
213
|
break;
|
|
211
214
|
case 'EnumProperty':
|
|
212
|
-
overhead = EnumProperty.CalcOverhead(property);
|
|
213
|
-
EnumProperty.Serialize(writer, property);
|
|
215
|
+
overhead = Property_1.EnumProperty.CalcOverhead(property);
|
|
216
|
+
Property_1.EnumProperty.Serialize(writer, property);
|
|
214
217
|
break;
|
|
215
218
|
case 'ByteProperty':
|
|
216
|
-
overhead = ByteProperty.CalcOverhead(property);
|
|
217
|
-
ByteProperty.Serialize(writer, property);
|
|
219
|
+
overhead = Property_1.ByteProperty.CalcOverhead(property);
|
|
220
|
+
Property_1.ByteProperty.Serialize(writer, property);
|
|
218
221
|
break;
|
|
219
222
|
case 'StructProperty':
|
|
220
|
-
overhead = StructProperty.CalcOverhead(property);
|
|
221
|
-
StructProperty.Serialize(writer, property);
|
|
223
|
+
overhead = Property_1.StructProperty.CalcOverhead(property);
|
|
224
|
+
Property_1.StructProperty.Serialize(writer, property);
|
|
222
225
|
break;
|
|
223
226
|
case 'ArrayProperty':
|
|
224
|
-
overhead = ArrayProperty.CalcOverhead(property);
|
|
225
|
-
ArrayProperty.Serialize(writer, property, propertyName);
|
|
227
|
+
overhead = Property_1.ArrayProperty.CalcOverhead(property);
|
|
228
|
+
Property_1.ArrayProperty.Serialize(writer, property, propertyName);
|
|
226
229
|
break;
|
|
227
230
|
case 'MapProperty':
|
|
228
|
-
overhead = MapProperty.CalcOverhead(property);
|
|
229
|
-
MapProperty.Serialize(writer, property);
|
|
231
|
+
overhead = Property_1.MapProperty.CalcOverhead(property);
|
|
232
|
+
Property_1.MapProperty.Serialize(writer, property);
|
|
230
233
|
break;
|
|
231
234
|
case 'TextProperty':
|
|
232
|
-
overhead = TextProperty.CalcOverhead(property);
|
|
233
|
-
TextProperty.Serialize(writer, property);
|
|
235
|
+
overhead = Property_1.TextProperty.CalcOverhead(property);
|
|
236
|
+
Property_1.TextProperty.Serialize(writer, property);
|
|
234
237
|
break;
|
|
235
238
|
case 'SetProperty':
|
|
236
|
-
overhead = SetProperty.CalcOverhead(property);
|
|
237
|
-
SetProperty.Serialize(writer, property);
|
|
239
|
+
overhead = Property_1.SetProperty.CalcOverhead(property);
|
|
240
|
+
Property_1.SetProperty.Serialize(writer, property);
|
|
238
241
|
break;
|
|
239
242
|
default:
|
|
240
243
|
throw new Error(`Unimplemented type ${property.type}`);
|
|
@@ -243,3 +246,4 @@ export class DataFields {
|
|
|
243
246
|
writer.writeBinarySizeFromPosition(lenIndicator, start + overhead);
|
|
244
247
|
}
|
|
245
248
|
}
|
|
249
|
+
exports.DataFields = DataFields;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ObjectReference = void 0;
|
|
4
|
+
class ObjectReference {
|
|
2
5
|
constructor(levelName, pathName) {
|
|
3
6
|
this.levelName = levelName;
|
|
4
7
|
this.pathName = pathName;
|
|
@@ -11,3 +14,4 @@ export class ObjectReference {
|
|
|
11
14
|
writer.writeString(ref.pathName);
|
|
12
15
|
}
|
|
13
16
|
}
|
|
17
|
+
exports.ObjectReference = ObjectReference;
|