mirror of
https://github.com/gooba42/adventureland.git
synced 2026-10-14 10:33:47 -05:00
Switch to tabs instead of spaces
This commit is contained in:
Vendored
+11
-10
@@ -1,12 +1,13 @@
|
|||||||
{
|
{
|
||||||
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
||||||
"prettier.configPath": "./node/.prettierrc",
|
"prettier.configPath": "./node/.prettierrc",
|
||||||
"prettier.printWidth": 120,
|
"prettier.printWidth": 120,
|
||||||
"prettier.tabWidth": 2,
|
"prettier.tabWidth": 2,
|
||||||
"prettier.trailingComma": "all",
|
"prettier.trailingComma": "all",
|
||||||
"prettier.semi": true,
|
"prettier.semi": true,
|
||||||
"editor.formatOnSave": true,
|
"prettier.useTabs": true,
|
||||||
"editor.codeActionsOnSave": {
|
"editor.formatOnSave": true,
|
||||||
"source.fixAll.eslint": true
|
"editor.codeActionsOnSave": {
|
||||||
}
|
"source.fixAll.eslint": true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-1
@@ -5,5 +5,6 @@
|
|||||||
"trailingComma": "all",
|
"trailingComma": "all",
|
||||||
"semi": true,
|
"semi": true,
|
||||||
"bracketSpacing": true,
|
"bracketSpacing": true,
|
||||||
"arrowParens": "always"
|
"arrowParens": "always",
|
||||||
|
"useTabs": true
|
||||||
}
|
}
|
||||||
+19
-19
@@ -13,23 +13,23 @@ var server_auth = "123456";
|
|||||||
var base_url = variables.base_url;
|
var base_url = variables.base_url;
|
||||||
|
|
||||||
appengine_call("reload_server", { keyword: variables.keyword }, function (result) {
|
appengine_call("reload_server", { keyword: variables.keyword }, function (result) {
|
||||||
if (result.failed) {
|
if (result.failed) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
G = result.game;
|
G = result.game;
|
||||||
var start = new Date();
|
var start = new Date();
|
||||||
for (var mname in G.maps) {
|
for (var mname in G.maps) {
|
||||||
if (G.maps[mname].ignore) {
|
if (G.maps[mname].ignore) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
var cstart = new Date();
|
var cstart = new Date();
|
||||||
server_bfs(mname);
|
server_bfs(mname);
|
||||||
console.log("Precomputed: " + mname + " in " + mssince(cstart) + "ms");
|
console.log("Precomputed: " + mname + " in " + mssince(cstart) + "ms");
|
||||||
}
|
}
|
||||||
console.log("Done: " + mssince(start) + "ms");
|
console.log("Done: " + mssince(start) + "ms");
|
||||||
var precomputed = {};
|
var precomputed = {};
|
||||||
precomputed.version = G.version;
|
precomputed.version = G.version;
|
||||||
precomputed.amap_data = amap_data;
|
precomputed.amap_data = amap_data;
|
||||||
precomputed.smap_data = smap_data;
|
precomputed.smap_data = smap_data;
|
||||||
fs.writeFileSync(variables.data_path, "var precomputed=" + JSON.stringify(precomputed) + ";");
|
fs.writeFileSync(variables.data_path, "var precomputed=" + JSON.stringify(precomputed) + ";");
|
||||||
});
|
});
|
||||||
|
|||||||
+13208
-13208
File diff suppressed because it is too large
Load Diff
+4731
-4731
File diff suppressed because it is too large
Load Diff
+11
-11
@@ -12,17 +12,17 @@ var smap_data = workerData.smap_data;
|
|||||||
var amap_data = workerData.amap_data;
|
var amap_data = workerData.amap_data;
|
||||||
|
|
||||||
parentPort.on("message", function (data) {
|
parentPort.on("message", function (data) {
|
||||||
try {
|
try {
|
||||||
//console.log(data);
|
//console.log(data);
|
||||||
if (data.type == "fast_astar") {
|
if (data.type == "fast_astar") {
|
||||||
parentPort.postMessage({ type: "monster_move", move: fast_astar(data), id: data.id, in: data.in });
|
parentPort.postMessage({ type: "monster_move", move: fast_astar(data), id: data.id, in: data.in });
|
||||||
}
|
}
|
||||||
if (data.type == "exit") {
|
if (data.type == "exit") {
|
||||||
process.exit();
|
process.exit();
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log(e);
|
console.log(e);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
setInterval(function () {}, 10);
|
setInterval(function () {}, 10);
|
||||||
|
|||||||
+128
-128
@@ -3,174 +3,174 @@ var protobuf = require("protobufjs");
|
|||||||
var ByteBuffer = require("bytebuffer");
|
var ByteBuffer = require("bytebuffer");
|
||||||
|
|
||||||
function symmetricDecrypt(input, key, checkHmac) {
|
function symmetricDecrypt(input, key, checkHmac) {
|
||||||
var aesIv = crypto.createDecipheriv("aes-256-ecb", key, "");
|
var aesIv = crypto.createDecipheriv("aes-256-ecb", key, "");
|
||||||
aesIv.setAutoPadding(false);
|
aesIv.setAutoPadding(false);
|
||||||
aesIv.end(input.slice(0, 16));
|
aesIv.end(input.slice(0, 16));
|
||||||
var iv = aesIv.read();
|
var iv = aesIv.read();
|
||||||
|
|
||||||
var aesData = crypto.createDecipheriv("aes-256-cbc", key, iv);
|
var aesData = crypto.createDecipheriv("aes-256-cbc", key, iv);
|
||||||
aesData.end(input.slice(16));
|
aesData.end(input.slice(16));
|
||||||
var plaintext = aesData.read();
|
var plaintext = aesData.read();
|
||||||
|
|
||||||
if (checkHmac) {
|
if (checkHmac) {
|
||||||
// The last 3 bytes of the IV are a random value, and the remainder are a partial HMAC
|
// The last 3 bytes of the IV are a random value, and the remainder are a partial HMAC
|
||||||
var remotePartialHmac = iv.slice(0, iv.length - 3);
|
var remotePartialHmac = iv.slice(0, iv.length - 3);
|
||||||
var random = iv.slice(iv.length - 3, iv.length);
|
var random = iv.slice(iv.length - 3, iv.length);
|
||||||
var hmac = crypto.createHmac("sha1", key.slice(0, 16));
|
var hmac = crypto.createHmac("sha1", key.slice(0, 16));
|
||||||
hmac.update(random);
|
hmac.update(random);
|
||||||
hmac.update(plaintext);
|
hmac.update(plaintext);
|
||||||
if (!remotePartialHmac.equals(hmac.digest().slice(0, remotePartialHmac.length))) {
|
if (!remotePartialHmac.equals(hmac.digest().slice(0, remotePartialHmac.length))) {
|
||||||
throw new Error("Received invalid HMAC from remote host.");
|
throw new Error("Received invalid HMAC from remote host.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return plaintext;
|
return plaintext;
|
||||||
}
|
}
|
||||||
|
|
||||||
function parseAppTicket(ticket) {
|
function parseAppTicket(ticket) {
|
||||||
// https://github.com/SteamRE/SteamKit/blob/master/Resources/Structs/steam3_appticket.hsl
|
// https://github.com/SteamRE/SteamKit/blob/master/Resources/Structs/steam3_appticket.hsl
|
||||||
|
|
||||||
console.log(ticket);
|
console.log(ticket);
|
||||||
if (!ByteBuffer.isByteBuffer(ticket)) {
|
if (!ByteBuffer.isByteBuffer(ticket)) {
|
||||||
ticket = ByteBuffer.wrap(ticket, ByteBuffer.LITTLE_ENDIAN);
|
ticket = ByteBuffer.wrap(ticket, ByteBuffer.LITTLE_ENDIAN);
|
||||||
}
|
}
|
||||||
|
|
||||||
let details = {};
|
let details = {};
|
||||||
|
|
||||||
try {
|
try {
|
||||||
let initialLength = ticket.readUint32();
|
let initialLength = ticket.readUint32();
|
||||||
console.log(initialLength);
|
console.log(initialLength);
|
||||||
if (initialLength == 20) {
|
if (initialLength == 20) {
|
||||||
// This is a full appticket, with a GC token and session header (in addition to ownership ticket)
|
// This is a full appticket, with a GC token and session header (in addition to ownership ticket)
|
||||||
details.authTicket = ticket.slice(ticket.offset - 4, ticket.offset - 4 + 52).toBuffer(); // this is the part that's passed back to Steam for validation
|
details.authTicket = ticket.slice(ticket.offset - 4, ticket.offset - 4 + 52).toBuffer(); // this is the part that's passed back to Steam for validation
|
||||||
|
|
||||||
details.gcToken = ticket.readUint64().toString();
|
details.gcToken = ticket.readUint64().toString();
|
||||||
//details.steamID = new SteamID(ticket.readUint64().toString());
|
//details.steamID = new SteamID(ticket.readUint64().toString());
|
||||||
ticket.skip(8); // the SteamID gets read later on
|
ticket.skip(8); // the SteamID gets read later on
|
||||||
details.tokenGenerated = new Date(ticket.readUint32() * 1000);
|
details.tokenGenerated = new Date(ticket.readUint32() * 1000);
|
||||||
|
|
||||||
if (ticket.readUint32() != 24) {
|
if (ticket.readUint32() != 24) {
|
||||||
// SESSIONHEADER should be 24 bytes.
|
// SESSIONHEADER should be 24 bytes.
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
ticket.skip(8); // unknown 1 and unknown 2
|
ticket.skip(8); // unknown 1 and unknown 2
|
||||||
details.sessionExternalIP = Helpers.ipIntToString(ticket.readUint32());
|
details.sessionExternalIP = Helpers.ipIntToString(ticket.readUint32());
|
||||||
ticket.skip(4); // filler
|
ticket.skip(4); // filler
|
||||||
details.clientConnectionTime = ticket.readUint32(); // time the client has been connected to Steam in ms
|
details.clientConnectionTime = ticket.readUint32(); // time the client has been connected to Steam in ms
|
||||||
details.clientConnectionCount = ticket.readUint32(); // how many servers the client has connected to
|
details.clientConnectionCount = ticket.readUint32(); // how many servers the client has connected to
|
||||||
|
|
||||||
if (ticket.readUint32() + ticket.offset != ticket.limit) {
|
if (ticket.readUint32() + ticket.offset != ticket.limit) {
|
||||||
// OWNERSHIPSECTIONWITHSIGNATURE sectlength
|
// OWNERSHIPSECTIONWITHSIGNATURE sectlength
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ticket.skip(-4);
|
ticket.skip(-4);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start reading the ownership ticket
|
// Start reading the ownership ticket
|
||||||
let ownershipTicketOffset = ticket.offset;
|
let ownershipTicketOffset = ticket.offset;
|
||||||
let ownershipTicketLength = ticket.readUint32(); // including itself, for some reason
|
let ownershipTicketLength = ticket.readUint32(); // including itself, for some reason
|
||||||
if (
|
if (
|
||||||
ownershipTicketOffset + ownershipTicketLength != ticket.limit &&
|
ownershipTicketOffset + ownershipTicketLength != ticket.limit &&
|
||||||
ownershipTicketOffset + ownershipTicketLength + 128 != ticket.limit
|
ownershipTicketOffset + ownershipTicketLength + 128 != ticket.limit
|
||||||
) {
|
) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
let i;
|
let i;
|
||||||
let j;
|
let j;
|
||||||
let dlc;
|
let dlc;
|
||||||
|
|
||||||
details.version = ticket.readUint32();
|
details.version = ticket.readUint32();
|
||||||
details.steamID = ticket.readUint64().toString();
|
details.steamID = ticket.readUint64().toString();
|
||||||
details.appID = ticket.readUint32();
|
details.appID = ticket.readUint32();
|
||||||
details.ownershipTicketExternalIP = ticket.readUint32();
|
details.ownershipTicketExternalIP = ticket.readUint32();
|
||||||
details.ownershipTicketInternalIP = ticket.readUint32(); // Helpers.ipIntToString(
|
details.ownershipTicketInternalIP = ticket.readUint32(); // Helpers.ipIntToString(
|
||||||
details.ownershipFlags = ticket.readUint32();
|
details.ownershipFlags = ticket.readUint32();
|
||||||
details.ownershipTicketGenerated = new Date(ticket.readUint32() * 1000);
|
details.ownershipTicketGenerated = new Date(ticket.readUint32() * 1000);
|
||||||
details.ownershipTicketExpires = new Date(ticket.readUint32() * 1000);
|
details.ownershipTicketExpires = new Date(ticket.readUint32() * 1000);
|
||||||
details.licenses = [];
|
details.licenses = [];
|
||||||
// return details;
|
// return details;
|
||||||
|
|
||||||
let licenseCount = ticket.readUint16();
|
let licenseCount = ticket.readUint16();
|
||||||
for (i = 0; i < licenseCount; i++) {
|
for (i = 0; i < licenseCount; i++) {
|
||||||
details.licenses.push(ticket.readUint32());
|
details.licenses.push(ticket.readUint32());
|
||||||
}
|
}
|
||||||
|
|
||||||
details.dlc = [];
|
details.dlc = [];
|
||||||
|
|
||||||
let dlcCount = ticket.readUint16();
|
let dlcCount = ticket.readUint16();
|
||||||
for (i = 0; i < dlcCount; i++) {
|
for (i = 0; i < dlcCount; i++) {
|
||||||
dlc = {};
|
dlc = {};
|
||||||
dlc.appID = ticket.readUint32();
|
dlc.appID = ticket.readUint32();
|
||||||
dlc.licenses = [];
|
dlc.licenses = [];
|
||||||
|
|
||||||
licenseCount = ticket.readUint16();
|
licenseCount = ticket.readUint16();
|
||||||
|
|
||||||
for (j = 0; j < licenseCount; j++) {
|
for (j = 0; j < licenseCount; j++) {
|
||||||
dlc.licenses.push(ticket.readUint32());
|
dlc.licenses.push(ticket.readUint32());
|
||||||
}
|
}
|
||||||
|
|
||||||
details.dlc.push(dlc);
|
details.dlc.push(dlc);
|
||||||
}
|
}
|
||||||
|
|
||||||
ticket.readUint16(); // reserved
|
ticket.readUint16(); // reserved
|
||||||
if (ticket.offset + 128 == ticket.limit) {
|
if (ticket.offset + 128 == ticket.limit) {
|
||||||
// Has signature
|
// Has signature
|
||||||
details.signature = ticket.slice(ticket.offset, ticket.offset + 128).toBuffer();
|
details.signature = ticket.slice(ticket.offset, ticket.offset + 128).toBuffer();
|
||||||
}
|
}
|
||||||
|
|
||||||
let date = new Date();
|
let date = new Date();
|
||||||
details.isExpired = details.ownershipTicketExpires < date;
|
details.isExpired = details.ownershipTicketExpires < date;
|
||||||
details.hasValidSignature =
|
details.hasValidSignature =
|
||||||
!!details.signature &&
|
!!details.signature &&
|
||||||
SteamCrypto.verifySignature(
|
SteamCrypto.verifySignature(
|
||||||
ticket.slice(ownershipTicketOffset, ownershipTicketOffset + ownershipTicketLength).toBuffer(),
|
ticket.slice(ownershipTicketOffset, ownershipTicketOffset + ownershipTicketLength).toBuffer(),
|
||||||
details.signature,
|
details.signature,
|
||||||
);
|
);
|
||||||
details.isValid = !details.isExpired && (!details.signature || details.hasValidSignature);
|
details.isValid = !details.isExpired && (!details.signature || details.hasValidSignature);
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
console.log("parseAppTicket: " + ex);
|
console.log("parseAppTicket: " + ex);
|
||||||
return details;
|
return details;
|
||||||
return null; // not a valid ticket
|
return null; // not a valid ticket
|
||||||
}
|
}
|
||||||
|
|
||||||
return details;
|
return details;
|
||||||
}
|
}
|
||||||
|
|
||||||
var proto = {
|
var proto = {
|
||||||
nested: {
|
nested: {
|
||||||
EncryptedAppTicket: {
|
EncryptedAppTicket: {
|
||||||
fields: {
|
fields: {
|
||||||
ticketVersionNo: { type: "uint32", id: 1 },
|
ticketVersionNo: { type: "uint32", id: 1 },
|
||||||
crcEncryptedticket: { type: "uint32", id: 2 },
|
crcEncryptedticket: { type: "uint32", id: 2 },
|
||||||
cbEncrypteduserdata: { type: "uint32", id: 3 },
|
cbEncrypteduserdata: { type: "uint32", id: 3 },
|
||||||
cbEncryptedAppownershipticket: { type: "uint32", id: 4 },
|
cbEncryptedAppownershipticket: { type: "uint32", id: 4 },
|
||||||
encryptedTicket: { type: "bytes", id: 5 },
|
encryptedTicket: { type: "bytes", id: 5 },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
var proto_root = protobuf.Root.fromJSON(proto);
|
var proto_root = protobuf.Root.fromJSON(proto);
|
||||||
var EncryptedAppTicket = proto_root.lookupType("EncryptedAppTicket");
|
var EncryptedAppTicket = proto_root.lookupType("EncryptedAppTicket");
|
||||||
|
|
||||||
var outer = EncryptedAppTicket.decode(
|
var outer = EncryptedAppTicket.decode(
|
||||||
new Buffer(
|
new Buffer(
|
||||||
"080110a7e59890031815204f2a80014527ad8cccd8cd9b7d3260529556004ddf0454a1c2e8543495b1eb72b3dff44d9d67555798ef44b7e3f97cf86d3bf1bc3f84a91de415c382b0d96033c8e5398f2b775bcb004f5487c651d81ef410d7d2917cbb407713397d2c29a455b6852eac7db1a0e52248585bd5440ef07de54b7519f67eefbad5420d97b77ef7e35450af",
|
"080110a7e59890031815204f2a80014527ad8cccd8cd9b7d3260529556004ddf0454a1c2e8543495b1eb72b3dff44d9d67555798ef44b7e3f97cf86d3bf1bc3f84a91de415c382b0d96033c8e5398f2b775bcb004f5487c651d81ef410d7d2917cbb407713397d2c29a455b6852eac7db1a0e52248585bd5440ef07de54b7519f67eefbad5420d97b77ef7e35450af",
|
||||||
"hex",
|
"hex",
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
var decrypted = symmetricDecrypt(
|
var decrypted = symmetricDecrypt(
|
||||||
outer.encryptedTicket,
|
outer.encryptedTicket,
|
||||||
new Buffer("8af5c487af6c7709ef1a4e6e2275fcc0a90f57ae4319de793fca3d7ed8655520", "hex"),
|
new Buffer("8af5c487af6c7709ef1a4e6e2275fcc0a90f57ae4319de793fca3d7ed8655520", "hex"),
|
||||||
);
|
);
|
||||||
let userData = decrypted.slice(0, outer.cbEncrypteduserdata);
|
let userData = decrypted.slice(0, outer.cbEncrypteduserdata);
|
||||||
let ownershipTicketLength = decrypted.readUInt32LE(outer.cbEncrypteduserdata);
|
let ownershipTicketLength = decrypted.readUInt32LE(outer.cbEncrypteduserdata);
|
||||||
let ownershipTicket = parseAppTicket(
|
let ownershipTicket = parseAppTicket(
|
||||||
decrypted.slice(outer.cbEncrypteduserdata, outer.cbEncrypteduserdata + ownershipTicketLength),
|
decrypted.slice(outer.cbEncrypteduserdata, outer.cbEncrypteduserdata + ownershipTicketLength),
|
||||||
);
|
);
|
||||||
if (ownershipTicket) {
|
if (ownershipTicket) {
|
||||||
ownershipTicket.userData = userData.toString();
|
ownershipTicket.userData = userData.toString();
|
||||||
}
|
}
|
||||||
console.log(ownershipTicket);
|
console.log(ownershipTicket);
|
||||||
|
|||||||
Reference in New Issue
Block a user