Socket
Socket
Sign inDemoInstall

satisfactory-json

Package Overview
Dependencies
Maintainers
1
Versions
63
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

satisfactory-json - npm Package Compare versions

Comparing version 0.0.3 to 0.0.4

6

lib/index.d.ts

@@ -1,3 +0,3 @@

export { Sav2Json } from "./sav2json";
export { Json2Sav } from "./json2sav";
export * from "./types";
export { Sav2Json } from './sav2json';
export { Json2Sav } from './json2sav';
export * from './types';

@@ -1,2 +0,2 @@

import { Entity } from "./types";
import { Entity } from './types';
interface OutputBufferBuffer {

@@ -9,3 +9,2 @@ bytes: string;

buffers: OutputBufferBuffer[];
constructor();
write(bytes: string, count?: boolean): void;

@@ -12,0 +11,0 @@ addBuffer(): void;

@@ -5,7 +5,8 @@ "use strict";

constructor() {
this.bytes = "";
this.bytes = '';
this.buffers = [];
}
// constructor() { }
write(bytes, count = true) {
if (this.buffers.length == 0) {
if (this.buffers.length === 0) {
this.bytes += bytes;

@@ -21,6 +22,6 @@ }

addBuffer() {
this.buffers.push({ bytes: "", length: 0 });
this.buffers.push({ bytes: '', length: 0 });
}
endBufferAndWriteSize() {
let buffer = this.buffers[this.buffers.length - 1];
const buffer = this.buffers[this.buffers.length - 1];
this.buffers.pop(); // remove last element

@@ -32,5 +33,5 @@ this.writeInt(buffer.length);

writeInt(value, count = true) {
let buffer = Buffer.alloc(4);
const buffer = Buffer.alloc(4);
buffer.writeInt32LE(value, 0);
this.write(buffer.toString("binary"), count);
this.write(buffer.toString('binary'), count);
}

@@ -44,9 +45,9 @@ writeLong(value) {

writeFloat(value) {
let buffer = Buffer.alloc(4);
const buffer = Buffer.alloc(4);
buffer.writeFloatLE(value, 0);
this.write(buffer.toString("binary"));
this.write(buffer.toString('binary'));
}
writeHex(value, count = true) {
let buffer = Buffer.from(value, "hex");
this.write(buffer.toString("binary"), count);
const buffer = Buffer.from(value, 'hex');
this.write(buffer.toString('binary'), count);
}

@@ -59,4 +60,4 @@ // https://stackoverflow.com/a/14313213

encodeUTF16LE(text) {
var byteArray = new Uint8Array(text.length * 2);
for (var i = 0; i < text.length; i++) {
const byteArray = new Uint8Array(text.length * 2);
for (let i = 0; i < text.length; i++) {
byteArray[i * 2] = text.charCodeAt(i) & 0xff;

@@ -68,3 +69,3 @@ byteArray[i * 2 + 1] = (text.charCodeAt(i) >> 8) & 0xff;

writeLengthPrefixedString(value, count = true) {
if (value.length == 0) {
if (value.length === 0) {
this.writeInt(0, count);

@@ -95,3 +96,3 @@ }

try {
let saveJson = this.saveJson;
const saveJson = this.saveJson;
// console.log(json);

@@ -113,22 +114,22 @@ if (saveJson) {

this.buffer.writeInt(saveJson.objects.length);
for (var i = 0; i < saveJson.objects.length; i++) {
for (let i = 0; i < saveJson.objects.length; i++) {
const obj = saveJson.objects[i];
this.buffer.writeInt(obj.type);
if (obj.type == 1) {
if (obj.type === 1) {
this.writeActor(obj);
}
else if (obj.type == 0) {
else if (obj.type === 0) {
this.writeObject(obj);
}
else {
this.error("uknown type " + obj.type);
this.error('uknown type ' + obj.type);
}
}
this.buffer.writeInt(saveJson.objects.length);
for (var i = 0; i < saveJson.objects.length; i++) {
for (let i = 0; i < saveJson.objects.length; i++) {
const obj = saveJson.objects[i];
if (obj.type == 1) {
if (obj.type === 1) {
this.writeEntity(obj.entity, true, obj.className);
}
else if (obj.type == 0) {
else if (obj.type === 0) {
this.writeEntity(obj.entity, false, obj.className);

@@ -138,3 +139,3 @@ }

this.buffer.writeInt(saveJson.collected.length);
for (var i = 0; i < saveJson.collected.length; i++) {
for (let i = 0; i < saveJson.collected.length; i++) {
const obj = saveJson.collected[i];

@@ -187,3 +188,3 @@ this.buffer.writeLengthPrefixedString(obj.levelName);

this.buffer.writeInt(entity.children.length);
for (var i = 0; i < entity.children.length; i++) {
for (let i = 0; i < entity.children.length; i++) {
this.buffer.writeLengthPrefixedString(entity.children[i].levelName);

@@ -193,3 +194,3 @@ this.buffer.writeLengthPrefixedString(entity.children[i].pathName);

}
for (var i = 0; i < entity.properties.length; i++) {
for (let i = 0; i < entity.properties.length; i++) {
this.writeProperty(entity.properties[i]);

@@ -206,3 +207,3 @@ }

writeNone() {
this.buffer.writeLengthPrefixedString("None");
this.buffer.writeLengthPrefixedString('None');
}

@@ -216,20 +217,20 @@ writeProperty(property) {

switch (type) {
case "IntProperty":
case 'IntProperty':
this.buffer.writeByte(0, false);
this.buffer.writeInt(property.value);
break;
case "BoolProperty":
case 'BoolProperty':
this.buffer.writeByte(property.value, false);
this.buffer.writeByte(0, false);
break;
case "FloatProperty":
case 'FloatProperty':
this.buffer.writeByte(0, false);
this.buffer.writeFloat(property.value);
break;
case "StrProperty":
case "NameProperty":
case 'StrProperty':
case 'NameProperty':
this.buffer.writeByte(0, false);
this.buffer.writeLengthPrefixedString(property.value);
break;
case "TextProperty":
case 'TextProperty':
this.buffer.writeByte(0, false);

@@ -242,5 +243,5 @@ this.buffer.writeInt(property.unkown1);

break;
case "ByteProperty":
case 'ByteProperty':
this.buffer.writeLengthPrefixedString(property.value.unk1, false);
if (property.value.unk1 === "None") {
if (property.value.unk1 === 'None') {
this.buffer.writeByte(0, false);

@@ -254,3 +255,3 @@ this.buffer.writeByte(property.value.unk2);

break;
case "EnumProperty":
case 'EnumProperty':
this.buffer.writeLengthPrefixedString(property.value.enum, false);

@@ -260,3 +261,3 @@ this.buffer.writeByte(0, false);

break;
case "ObjectProperty":
case 'ObjectProperty':
this.buffer.writeByte(0, false);

@@ -266,3 +267,3 @@ this.buffer.writeLengthPrefixedString(property.value.levelName);

break;
case "StructProperty":
case 'StructProperty':
this.buffer.writeLengthPrefixedString(property.value.type, false);

@@ -272,4 +273,4 @@ this.buffer.writeHex(property.structUnknown, false);

switch (structType) {
case "Vector":
case "Rotator":
case 'Vector':
case 'Rotator':
this.buffer.writeFloat(property.value.x);

@@ -279,3 +280,3 @@ this.buffer.writeFloat(property.value.y);

break;
case "Box":
case 'Box':
this.buffer.writeFloat(property.value.min[0]);

@@ -289,3 +290,3 @@ this.buffer.writeFloat(property.value.min[1]);

break;
case "Color":
case 'Color':
this.buffer.writeByte(property.value.b);

@@ -296,3 +297,3 @@ this.buffer.writeByte(property.value.g);

break;
case "LinearColor":
case 'LinearColor':
this.buffer.writeFloat(property.value.r);

@@ -303,4 +304,4 @@ this.buffer.writeFloat(property.value.g);

break;
case "Transform":
for (var i = 0; i < property.value.properties.length; i++) {
case 'Transform':
for (let i = 0; i < property.value.properties.length; i++) {
this.writeProperty(property.value.properties[i]);

@@ -310,3 +311,3 @@ }

break;
case "Quat":
case 'Quat':
this.buffer.writeFloat(property.value.a);

@@ -317,5 +318,5 @@ this.buffer.writeFloat(property.value.b);

break;
case "RemovedInstanceArray":
case "InventoryStack":
for (var i = 0; i < property.value.properties.length; i++) {
case 'RemovedInstanceArray':
case 'InventoryStack':
for (let i = 0; i < property.value.properties.length; i++) {
this.writeProperty(property.value.properties[i]);

@@ -325,3 +326,3 @@ }

break;
case "InventoryItem":
case 'InventoryItem':
this.buffer.writeLengthPrefixedString(property.value.unk1, false);

@@ -338,3 +339,3 @@ this.buffer.writeLengthPrefixedString(property.value.itemName);

break;
case "RailroadTrackPosition":
case 'RailroadTrackPosition':
this.buffer.writeLengthPrefixedString(property.value.levelName);

@@ -345,3 +346,3 @@ this.buffer.writeLengthPrefixedString(property.value.pathName);

break;
case "TimerHandle":
case 'TimerHandle':
this.buffer.writeLengthPrefixedString(property.value.handle);

@@ -351,3 +352,3 @@ break;

break;
case "ArrayProperty":
case 'ArrayProperty':
const itemType = property.value.type;

@@ -358,14 +359,14 @@ this.buffer.writeLengthPrefixedString(itemType, false);

switch (itemType) {
case "IntProperty":
for (var i = 0; i < property.value.values.length; i++) {
case 'IntProperty':
for (let i = 0; i < property.value.values.length; i++) {
this.buffer.writeInt(property.value.values[i]);
}
break;
case "ByteProperty":
for (var i = 0; i < property.value.values.length; i++) {
case 'ByteProperty':
for (let i = 0; i < property.value.values.length; i++) {
this.buffer.writeByte(property.value.values[i]);
}
break;
case "ObjectProperty":
for (var i = 0; i < property.value.values.length; i++) {
case 'ObjectProperty':
for (let i = 0; i < property.value.values.length; i++) {
const obj = property.value.values[i];

@@ -376,3 +377,3 @@ this.buffer.writeLengthPrefixedString(obj.levelName);

break;
case "StructProperty":
case 'StructProperty':
this.buffer.writeLengthPrefixedString(property.structName);

@@ -384,5 +385,5 @@ this.buffer.writeLengthPrefixedString(property.structType);

this.buffer.writeHex(property.structUnknown, false);
for (var i = 0; i < property.value.values.length; i++) {
for (let i = 0; i < property.value.values.length; i++) {
const obj = property.value.values[i];
for (var j = 0; j < obj.properties.length; j++) {
for (let j = 0; j < obj.properties.length; j++) {
this.writeProperty(obj.properties[j]);

@@ -395,7 +396,7 @@ }

default:
this.error("Unknown array type: " + itemType);
this.error('Unknown array type: ' + itemType);
break;
}
break;
case "MapProperty":
case 'MapProperty':
this.buffer.writeLengthPrefixedString(property.value.name, false);

@@ -407,8 +408,8 @@ this.buffer.writeLengthPrefixedString(property.value.type, false);

this.buffer.writeInt(keys.length);
for (var i = 0; i < keys.length; i++) {
//(let [key, value] of property.value.values) {
for (let i = 0; i < keys.length; i++) {
// (let [key, value] of property.value.values) {
const key = keys[i];
const value = property.value.values[key];
this.buffer.writeInt(+key); // parse key to int
for (var j = 0; j < value.length; j++) {
for (let j = 0; j < value.length; j++) {
this.writeProperty(value[j]);

@@ -420,3 +421,3 @@ }

default:
this.error("Unknown property type " + type);
this.error('Unknown property type ' + type);
}

@@ -427,3 +428,3 @@ this.buffer.endBufferAndWriteSize();

switch (className) {
case "/Game/FactoryGame/Buildable/Factory/PowerLine/Build_PowerLine.Build_PowerLine_C":
case '/Game/FactoryGame/Buildable/Factory/PowerLine/Build_PowerLine.Build_PowerLine_C':
this.writePowerLineExtra(entity);

@@ -440,5 +441,5 @@ break;

error(message) {
console.trace("error: " + message);
console.trace('error: ' + message);
if (this.uuid) {
console.error("uuid: " + this.uuid);
console.error('uuid: ' + this.uuid);
}

@@ -445,0 +446,0 @@ if (!this.hadError) {

/// <reference types="node" />
import { SaveGame, Actor, Entity, Property, Object } from "./types";
import { Actor, Entity, Object, Property, SaveGame } from './types';
declare class DataBuffer {

@@ -4,0 +4,0 @@ buffer: Buffer;

@@ -10,3 +10,3 @@ "use strict";

readInt() {
let result = this.buffer.readInt32LE(this.cursor);
const result = this.buffer.readInt32LE(this.cursor);
this.cursor += 4;

@@ -25,3 +25,3 @@ this.bytesRead += 4;

readByte() {
let result = this.buffer.readUInt8(this.cursor);
const result = this.buffer.readUInt8(this.cursor);
this.cursor += 1;

@@ -32,3 +32,3 @@ this.bytesRead += 1;

readFloat() {
let result = this.buffer.readFloatLE(this.cursor);
const result = this.buffer.readFloatLE(this.cursor);
this.cursor += 4;

@@ -39,5 +39,5 @@ this.bytesRead += 4;

readHex(count) {
let result = this.buffer
const result = this.buffer
.slice(this.cursor, this.cursor + count)
.toString("hex");
.toString('hex');
this.cursor += count;

@@ -49,4 +49,4 @@ this.bytesRead += count;

decodeUTF16LE(binaryStr) {
var cp = [];
for (var i = 0; i < binaryStr.length; i += 2) {
const cp = [];
for (let i = 0; i < binaryStr.length; i += 2) {
cp.push(binaryStr.charCodeAt(i) | (binaryStr.charCodeAt(i + 1) << 8));

@@ -58,6 +58,6 @@ }

let length = this.readInt();
if (length == 0) {
return "";
if (length === 0) {
return '';
}
var utf16 = false;
let utf16 = false;
if (length < 0) {

@@ -71,12 +71,12 @@ // Thanks to @Goz3rr we know that this is now an utf16 based string

// throw new Error('TOO LONG: ' +length + ' | ' + this.readHex(32) + ': ' + this.cursor + ' / ' + this.buffer.length );
//console.error(this.readHex(this.buffer.length - this.cursor -1));
// console.error(this.readHex(this.buffer.length - this.cursor -1));
console.log(this.readHex(32));
// return '';
console.trace("buffer < " + length);
throw new Error("cannot read string of length: " + length);
console.trace('buffer < ' + length);
throw new Error('cannot read string of length: ' + length);
}
var resultStr;
let resultStr;
if (utf16) {
var result = this.buffer.slice(this.cursor, this.cursor + length - 2);
resultStr = this.decodeUTF16LE(result.toString("binary"));
const result = this.buffer.slice(this.cursor, this.cursor + length - 2);
resultStr = this.decodeUTF16LE(result.toString('binary'));
this.cursor += length - 2;

@@ -86,4 +86,4 @@ this.bytesRead += length - 2;

else {
var result = this.buffer.slice(this.cursor, this.cursor + length - 1);
resultStr = result.toString("utf8");
const result = this.buffer.slice(this.cursor, this.cursor + length - 1);
resultStr = result.toString('utf8');
this.cursor += length - 1;

@@ -93,3 +93,3 @@ this.bytesRead += length - 1;

if (this.cursor < 0) {
throw new Error("Cursor overflowed to " + this.cursor + " by " + length);
throw new Error('Cursor overflowed to ' + this.cursor + ' by ' + length);
}

@@ -104,4 +104,4 @@ if (utf16) {

const zero = this.buffer.readInt8(this.cursor);
if (zero != 0) {
throw new Error("string does not end with 0 byte, but " + zero);
if (zero !== 0) {
throw new Error('string does not end with 0 byte, but ' + zero);
// TODO return error

@@ -119,12 +119,12 @@ }

this.hadError = false;
var buffer = new DataBuffer(data);
const buffer = new DataBuffer(data);
this.buffer = buffer;
}
transform() {
var buffer = this.buffer;
const buffer = this.buffer;
const saveHeaderType = buffer.readInt();
const saveVersion = buffer.readInt();
var saveJson = {
saveHeaderType: saveHeaderType,
saveVersion: saveVersion,
const saveJson = {
saveHeaderType,
saveVersion,
buildVersion: buffer.readInt(),

@@ -139,6 +139,6 @@ mapName: buffer.readLengthPrefixedString(),

collected: [],
missing: ""
missing: ''
};
const entryCount = buffer.readInt();
for (var i = 0; i < entryCount; i++) {
for (let i = 0; i < entryCount; i++) {
if (this.hadError) {

@@ -148,10 +148,10 @@ return;

const type = buffer.readInt();
if (type == 1) {
saveJson["objects"].push(this.readActor(buffer));
if (type === 1) {
saveJson['objects'].push(this.readActor(buffer));
}
else if (type == 0) {
saveJson["objects"].push(this.readObject(buffer));
else if (type === 0) {
saveJson['objects'].push(this.readObject(buffer));
}
else {
this.error("Unknown type " + type);
this.error('Unknown type ' + type);
return;

@@ -162,11 +162,11 @@ }

// # So far these counts have always been the same and the entities seem to belong 1 to 1 to the actors/objects read above
if (elementCount != entryCount) {
this.error("elementCount (" + elementCount + ") != entryCount(" + entryCount + ")");
if (elementCount !== entryCount) {
this.error('elementCount (' + elementCount + ') != entryCount(' + entryCount + ')');
return;
}
for (var i = 0; i < elementCount; i++) {
for (let i = 0; i < elementCount; i++) {
if (this.hadError) {
return;
}
if (saveJson.objects[i].type == 1) {
if (saveJson.objects[i].type === 1) {
saveJson.objects[i].entity = this.readEntity(buffer, true, saveJson.objects[i].className);

@@ -180,3 +180,3 @@ }

const collectedCount = buffer.readInt();
for (var i = 0; i < collectedCount; i++) {
for (let i = 0; i < collectedCount; i++) {
saveJson.collected.push({

@@ -227,3 +227,3 @@ levelName: buffer.readLengthPrefixedString(),

buffer.resetBytesRead();
var entity = {
const entity = {
properties: []

@@ -236,3 +236,3 @@ };

const childCount = buffer.readInt();
for (var i = 0; i < childCount; i++) {
for (let i = 0; i < childCount; i++) {
entity.children.push({

@@ -248,3 +248,3 @@ levelName: buffer.readLengthPrefixedString(),

if (zero !== 0) {
this.error("extra object count not zero: " + zero + " className: " + className);
this.error('extra object count not zero: ' + zero + ' className: ' + className);
}

@@ -257,3 +257,3 @@ this.readExtra(entity, className);

else if (missing < 0) {
this.error("negative missing amount: " + missing);
this.error('negative missing amount: ' + missing);
}

@@ -265,3 +265,3 @@ // console.log(entity);

const name = buffer.readLengthPrefixedString();
if (name === "None") {
if (name === 'None') {
return false; // end of properties

@@ -271,3 +271,3 @@ }

const length = buffer.readInt();
if (length == 0) {
if (length === 0) {
// TODO remove, only there so that length is used

@@ -277,16 +277,16 @@ }

switch (prop) {
case "IntProperty":
case 'IntProperty':
buffer.assertNullByte();
properties.push({
name: name,
name,
type: prop,
index: index,
index,
value: buffer.readInt()
});
break;
case "BoolProperty":
case 'BoolProperty':
properties.push({
name: name,
name,
type: prop,
index: index,
index,
value: buffer.readByte()

@@ -296,27 +296,27 @@ });

break;
case "FloatProperty":
case 'FloatProperty':
buffer.assertNullByte();
properties.push({
name: name,
name,
type: prop,
index: index,
index,
value: buffer.readFloat()
});
break;
case "StrProperty":
case "NameProperty":
case 'StrProperty':
case 'NameProperty':
buffer.assertNullByte();
properties.push({
name: name,
name,
type: prop,
index: index,
index,
value: buffer.readLengthPrefixedString()
});
break;
case "TextProperty":
case 'TextProperty':
buffer.assertNullByte();
properties.push({
name: name,
name,
type: prop,
index: index,
index,
unknown1: buffer.readInt(),

@@ -329,12 +329,12 @@ unknown2: buffer.readByte(),

break;
case "ByteProperty":
case 'ByteProperty':
const unk1 = buffer.readLengthPrefixedString();
buffer.assertNullByte();
if (unk1 === "None") {
if (unk1 === 'None') {
properties.push({
name: name,
name,
type: prop,
index: index,
index,
value: {
unk1: unk1,
unk1,
unk2: buffer.readByte()

@@ -346,7 +346,7 @@ }

properties.push({
name: name,
name,
type: prop,
index: index,
index,
value: {
unk1: unk1,
unk1,
unk2: buffer.readLengthPrefixedString()

@@ -357,9 +357,9 @@ }

break;
case "EnumProperty":
case 'EnumProperty':
const enumName = buffer.readLengthPrefixedString();
buffer.assertNullByte();
properties.push({
name: name,
name,
type: prop,
index: index,
index,
value: {

@@ -371,8 +371,8 @@ enum: enumName,

break;
case "ObjectProperty":
case 'ObjectProperty':
buffer.assertNullByte();
properties.push({
name: name,
name,
type: prop,
index: index,
index,
value: {

@@ -384,15 +384,15 @@ levelName: buffer.readLengthPrefixedString(),

break;
case "StructProperty":
case 'StructProperty':
const type = buffer.readLengthPrefixedString();
const unknown = buffer.readHex(17);
switch (type) {
case "Vector":
case "Rotator":
case 'Vector':
case 'Rotator':
properties.push({
name: name,
name,
type: prop,
index: index,
index,
structUnknown: unknown,
value: {
type: type,
type,
x: buffer.readFloat(),

@@ -404,10 +404,10 @@ y: buffer.readFloat(),

break;
case "Box":
case 'Box':
properties.push({
name: name,
name,
type: prop,
index: index,
index,
structUnknown: unknown,
value: {
type: type,
type,
min: [

@@ -427,10 +427,10 @@ buffer.readFloat(),

break;
case "Color":
case 'Color':
properties.push({
name: name,
name,
type: prop,
index: index,
index,
structUnknown: unknown,
value: {
type: type,
type,
b: buffer.readByte(),

@@ -443,10 +443,10 @@ g: buffer.readByte(),

break;
case "LinearColor":
case 'LinearColor':
properties.push({
name: name,
name,
type: prop,
index: index,
index,
structUnknown: unknown,
value: {
type: type,
type,
r: buffer.readFloat(),

@@ -459,12 +459,12 @@ g: buffer.readFloat(),

break;
case "Transform":
case 'Transform':
const props = [];
while (this.readProperty(buffer, props)) { }
properties.push({
name: name,
name,
type: prop,
index: index,
index,
structUnknown: unknown,
value: {
type: type,
type,
properties: props

@@ -474,10 +474,10 @@ }

break;
case "Quat":
case 'Quat':
properties.push({
name: name,
name,
type: prop,
index: index,
index,
structUnknown: unknown,
value: {
type: type,
type,
a: buffer.readFloat(),

@@ -490,13 +490,13 @@ b: buffer.readFloat(),

break;
case "RemovedInstanceArray":
case "InventoryStack": {
case 'RemovedInstanceArray':
case 'InventoryStack': {
const props = [];
while (this.readProperty(buffer, props)) { }
properties.push({
name: name,
name,
type: prop,
index: index,
index,
structUnknown: unknown,
value: {
type: type,
type,
properties: props

@@ -507,3 +507,3 @@ }

}
case "InventoryItem": {
case 'InventoryItem': {
const unk1 = buffer.readLengthPrefixedString();

@@ -516,12 +516,12 @@ const itemName = buffer.readLengthPrefixedString();

properties.push({
name: name,
name,
type: prop,
index: index,
index,
structUnknown: unknown,
value: {
type: type,
unk1: unk1,
itemName: itemName,
levelName: levelName,
pathName: pathName,
type,
unk1,
itemName,
levelName,
pathName,
properties: props

@@ -532,10 +532,10 @@ }

}
case "RailroadTrackPosition":
case 'RailroadTrackPosition':
properties.push({
name: name,
name,
type: prop,
index: index,
index,
structUnknown: unknown,
value: {
type: type,
type,
levelName: buffer.readLengthPrefixedString(),

@@ -548,10 +548,10 @@ pathName: buffer.readLengthPrefixedString(),

break;
case "TimerHandle":
case 'TimerHandle':
properties.push({
name: name,
name,
type: prop,
index: index,
index,
structUnknown: unknown,
value: {
type: type,
type,
handle: this.buffer.readLengthPrefixedString()

@@ -563,7 +563,7 @@ }

console.log(buffer.readHex(32));
this.error("Unknown struct type: " + type);
this.error('Unknown struct type: ' + type);
break;
}
break;
case "ArrayProperty":
case 'ArrayProperty':
const itemType = buffer.readLengthPrefixedString();

@@ -574,14 +574,14 @@ buffer.assertNullByte();

switch (itemType) {
case "IntProperty":
for (var j = 0; j < count; j++) {
case 'IntProperty':
for (let j = 0; j < count; j++) {
values.push(buffer.readInt());
}
break;
case "ByteProperty":
for (var j = 0; j < count; j++) {
case 'ByteProperty':
for (let j = 0; j < count; j++) {
values.push(buffer.readByte());
}
break;
case "ObjectProperty":
for (var j = 0; j < count; j++) {
case 'ObjectProperty':
for (let j = 0; j < count; j++) {
values.push({

@@ -593,11 +593,11 @@ levelName: buffer.readLengthPrefixedString(),

break;
case "StructProperty":
case 'StructProperty':
const structName = buffer.readLengthPrefixedString();
const structType = buffer.readLengthPrefixedString();
const structSize = buffer.readInt();
if (structSize == 0) {
if (structSize === 0) {
} // TODO remove?
const zero = buffer.readInt();
if (zero != 0) {
this.error("not zero: " + zero);
if (zero !== 0) {
this.error('not zero: ' + zero);
return false;

@@ -610,7 +610,7 @@ }

property['structInnerType'] = type
property['structUnknown'] = readHex(17) # TODO what are those?
property['_structLength'] = structSize*/
for (var j = 0; j < count; j++) {
var props = [];
for (let j = 0; j < count; j++) {
const props = [];
while (this.readProperty(buffer, props)) { }

@@ -622,12 +622,12 @@ values.push({

properties.push({
name: name,
name,
type: prop,
index: index,
index,
structUnknown: unknown,
structName: structName,
structType: structType,
structName,
structType,
structInnerType: type,
value: {
type: itemType,
values: values
values
}

@@ -638,24 +638,24 @@ });

default:
this.error("unknown itemType: " + itemType);
this.error('unknown itemType: ' + itemType);
break;
}
properties.push({
name: name,
name,
type: prop,
index: index,
index,
value: {
type: itemType,
values: values
values
}
});
break;
case "MapProperty": {
case 'MapProperty': {
const mapName = buffer.readLengthPrefixedString();
const valueType = buffer.readLengthPrefixedString();
for (var i = 0; i < 5; i++) {
for (let i = 0; i < 5; i++) {
buffer.assertNullByte();
}
const count = buffer.readInt();
var mapValues = {};
for (var i = 0; i < count; i++) {
const mapValues = {};
for (let i = 0; i < count; i++) {
const key = buffer.readInt();

@@ -667,5 +667,5 @@ const props = [];

properties.push({
name: name,
name,
type: prop,
index: index,
index,
value: {

@@ -680,3 +680,3 @@ name: mapName,

default:
this.error("unknown type: " + prop);
this.error('unknown type: ' + prop);
return false;

@@ -688,3 +688,3 @@ }

switch (className) {
case "/Game/FactoryGame/Buildable/Factory/PowerLine/Build_PowerLine.Build_PowerLine_C":
case '/Game/FactoryGame/Buildable/Factory/PowerLine/Build_PowerLine.Build_PowerLine_C':
this.readPowerLineExtra(entity);

@@ -703,5 +703,5 @@ break;

error(message) {
console.trace("error: " + message);
console.trace('error: ' + message);
if (this.buffer) {
console.error("cursor: " + this.buffer.cursor);
console.error('cursor: ' + this.buffer.cursor);
}

@@ -708,0 +708,0 @@ if (!this.hadError) {

{
"name": "satisfactory-json",
"version": "0.0.3",
"version": "0.0.4",
"description": "Convert Satisfactory save files to JSON and back",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc