@etothepii/satisfactory-file-parser 0.1.10 → 0.1.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/README.md CHANGED
@@ -19,7 +19,7 @@ U8 has only read support so far and only for save files, not for blueprint files
19
19
  |:--------------:|:-----------------------------|
20
20
  | <= U5 | ❌ |
21
21
  | U6 + U7 | ✅ 0.0.1 - 0.0.34 |
22
- | U8 | ⚠️ >= 0.1.9 (Reading only) |
22
+ | U8 | ⚠️ >= 0.1.12 (Reading only) |
23
23
 
24
24
 
25
25
  ## Installation via npm
@@ -245,6 +245,8 @@ export declare class SetProperty<T> extends BasicProperty {
245
245
  static CalcOverhead(property: SetProperty<any>): number;
246
246
  static Serialize(writer: ByteWriter, property: SetProperty<any>): void;
247
247
  }
248
+ export type GENERIC_MAP_KEY_TYPE = number | ObjectReference | boolean | GENERIC_STRUCT_PROPERTY_VALUE;
249
+ export type GENERIC_MAP_VALUE_TYPE = number | ObjectReference | boolean | GENERIC_STRUCT_PROPERTY_VALUE;
248
250
  export declare class MapProperty extends BasicProperty {
249
251
  keyType: string;
250
252
  valueType: string;
@@ -253,10 +255,7 @@ export declare class MapProperty extends BasicProperty {
253
255
  modeUnk2: string;
254
256
  modeUnk3: string;
255
257
  remainingData: number[];
256
- values: {
257
- key: any;
258
- value: any;
259
- }[];
258
+ values: [key: GENERIC_MAP_KEY_TYPE, value: GENERIC_MAP_VALUE_TYPE][];
260
259
  constructor(keyType: string, valueType: string, ueType: string, index: number);
261
260
  static Parse(reader: BinaryReadable, propertyName: string, buildVersion: number, size: number, ueType?: string, index?: number): MapProperty;
262
261
  static CalcOverhead(property: MapProperty): number;
@@ -844,11 +844,14 @@ class SetProperty extends BasicProperty {
844
844
  }
845
845
  static Parse(reader, ueType, index, propertyName) {
846
846
  const subtype = reader.readString();
847
- reader.skipBytes(1);
848
- reader.skipBytes(4);
847
+ const unk2 = reader.skipBytes(1);
848
+ const unk3 = reader.skipBytes(4);
849
849
  const elementCount = reader.readInt32();
850
850
  let property;
851
851
  switch (subtype) {
852
+ case "UInt32Property":
853
+ property = new SetProperty(subtype, new Array(elementCount).fill(0).map(() => Uint32Property.ReadValue(reader)), ueType, index);
854
+ break;
852
855
  case "IntProperty":
853
856
  property = new SetProperty(subtype, new Array(elementCount).fill(0).map(() => Int32Property.ReadValue(reader)), ueType, index);
854
857
  break;
@@ -858,11 +861,6 @@ class SetProperty extends BasicProperty {
858
861
  case "NameProperty":
859
862
  property = new SetProperty(subtype, new Array(elementCount).fill(0).map(() => StrProperty.ReadValue(reader)), ueType, index);
860
863
  break;
861
- case "StructProperty":
862
- if (propertyName === 'mRemovalLocations') {
863
- property = new SetProperty(subtype, new Array(elementCount).fill(0).map(() => (0, util_types_1.ParseVec3f)(reader)), ueType, index);
864
- }
865
- break;
866
864
  default:
867
865
  throw new Error('Not Implemented.');
868
866
  }
@@ -900,7 +898,7 @@ class MapProperty extends BasicProperty {
900
898
  super('MapProperty', ueType, undefined, index);
901
899
  this.keyType = keyType;
902
900
  this.valueType = valueType;
903
- this.modeType = 2;
901
+ this.modeType = 0;
904
902
  this.modeUnk2 = '';
905
903
  this.modeUnk3 = '';
906
904
  this.remainingData = [];
@@ -909,9 +907,68 @@ class MapProperty extends BasicProperty {
909
907
  static Parse(reader, propertyName, buildVersion, size, ueType = 'MapProperty', index = 0) {
910
908
  const start = reader.getBufferPosition();
911
909
  const property = new MapProperty(reader.readString(), reader.readString(), ueType, index);
912
- reader.skipBytes(1);
910
+ const unk = reader.readByte();
913
911
  property.modeType = reader.readInt32();
914
- property.remainingData = Array.from(reader.readBytes(size - 4));
912
+ const elementCount = reader.readInt32();
913
+ for (let i = 0; i < elementCount; i++) {
914
+ let key;
915
+ let value;
916
+ switch (property.keyType) {
917
+ case 'StructProperty':
918
+ if (propertyName === 'mSaveData' || propertyName === 'mUnresolvedSaveData') {
919
+ key = propertyName;
920
+ reader.skipBytes(12);
921
+ }
922
+ else {
923
+ key = (0, exports.ParseDynamicStructData)(reader, 0, 'MapPropertyKey-' + property.keyType);
924
+ }
925
+ break;
926
+ case 'ObjectProperty':
927
+ key = ObjectProperty.ReadValue(reader);
928
+ break;
929
+ case 'StrProperty':
930
+ case 'NameProperty':
931
+ key = StrProperty.ReadValue(reader);
932
+ break;
933
+ case 'EnumProperty':
934
+ key = EnumProperty.ReadValue(reader);
935
+ break;
936
+ case 'IntProperty':
937
+ case 'Int32Property':
938
+ key = Int32Property.ReadValue(reader);
939
+ break;
940
+ case 'ByteProperty':
941
+ key = ByteProperty.ReadValue(reader);
942
+ break;
943
+ default:
944
+ throw new Error(`not implemented map key type ${property.keyType}`);
945
+ }
946
+ switch (property.valueType) {
947
+ case 'StructProperty':
948
+ value = (0, exports.ParseDynamicStructData)(reader, 0, 'MapPropertyValue-' + property.valueType);
949
+ break;
950
+ case 'ObjectProperty':
951
+ value = ObjectProperty.ReadValue(reader);
952
+ break;
953
+ case 'StrProperty':
954
+ case 'NameProperty':
955
+ value = StrProperty.ReadValue(reader);
956
+ break;
957
+ case 'EnumProperty':
958
+ value = EnumProperty.ReadValue(reader);
959
+ break;
960
+ case 'IntProperty':
961
+ case 'Int32Property':
962
+ value = Int32Property.ReadValue(reader);
963
+ break;
964
+ case 'ByteProperty':
965
+ value = ByteProperty.ReadValue(reader);
966
+ break;
967
+ default:
968
+ throw new Error(`not implemented map value type ${property.valueType}`);
969
+ }
970
+ property.values.push([key, value]);
971
+ }
915
972
  return property;
916
973
  }
917
974
  static CalcOverhead(property) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@etothepii/satisfactory-file-parser",
3
3
  "author": "etothepii",
4
- "version": "0.1.10",
4
+ "version": "0.1.12",
5
5
  "description": "A file parser for satisfactory files. Includes save files and blueprint files.",
6
6
  "types": "./build/index.d.ts",
7
7
  "main": "./build/index.js",