Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Artemis 2.1.5 #22

Merged
merged 2 commits into from
Jan 27, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions artemisNet.js
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ function onPacket(buffer) {

} catch(e) {
console.error('Aaaaiiieeeee, something went wrong while parsing a packet of type ' + packetType + '!');
console.error(e);
var str = '';
for (var i = 0; i<header.packetLength && i<data.buffer.length; i++) {
var hex = data.buffer.readUInt8(i).toString(16);
Expand Down
2 changes: 1 addition & 1 deletion packets/objectUpdate/anomalyUpdate.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ exports.name = 'anomalyUpdate';

exports.type = 0x80803df9;

exports.subtype = 0x07;
exports.subtype = 0x08;
exports.subtypeLength = 1; // 1 byte -> UInt8

exports.pack = null; // Only from server to client
Expand Down
2 changes: 1 addition & 1 deletion packets/objectUpdate/asteroidUpdate.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ exports.name = 'asteroidUpdate';

exports.type = 0x80803df9;

exports.subtype = 0x0c;
exports.subtype = 0x0d;
exports.subtypeLength = 1; // 1 byte -> UInt8

exports.pack = null; // Only from server to client
Expand Down
2 changes: 1 addition & 1 deletion packets/objectUpdate/blackHoleUpdate.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ exports.name = 'blackHoleUpdate';

exports.type = 0x80803df9;

exports.subtype = 0x0b;
exports.subtype = 0x0c;
exports.subtypeLength = 1; // 1 byte -> UInt8

exports.pack = null; // Only from server to client
Expand Down
4 changes: 2 additions & 2 deletions packets/objectUpdate/droneUpdate.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ exports.name = 'droneUpdate';

exports.type = 0x80803df9;

exports.subtype = 0x10;
exports.subtype = 0x11;
exports.subtypeLength = 1; // 1 byte -> UInt8

exports.pack = null; // Only from server to client
Expand Down Expand Up @@ -35,7 +35,7 @@ exports.unpack = function(data) {
if (bits.get(1)) { unpacked.heading = data.readFloat();}
if (bits.get(0)) { unpacked.unknown4 = data.readLong(); } // Looks like some kind of flags?

if (bits.get(15)) { /* Unused */ }
if (bits.get(15)) { unpacked.unknown5 = data.readFloat(); }
if (bits.get(14)) { /* Unused */ }
if (bits.get(13)) { /* Unused */ }
if (bits.get(12)) { /* Unused */ }
Expand Down
2 changes: 1 addition & 1 deletion packets/objectUpdate/mineUpdate.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ exports.name = 'mineUpdate';

exports.type = 0x80803df9;

exports.subtype = 0x06;
exports.subtype = 0x07;
exports.subtypeLength = 1; // 1 byte -> UInt8

exports.pack = null; // Only from server to client
Expand Down
3 changes: 1 addition & 2 deletions packets/objectUpdate/monsterUpdate.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ exports.name = 'monsterUpdate';

exports.type = 0x80803df9;

exports.subtype = 0x0e;
exports.subtype = 0x0f;
exports.subtypeLength = 1; // 1 byte -> UInt8

exports.pack = null; // Only from server to client
Expand All @@ -29,7 +29,6 @@ exports.unpack = function(data) {
if (bits.get(1)) { unpacked.unknown3 = data.readLong(); }
if (bits.get(0)) { unpacked.unknown4 = data.readLong(); }


return unpacked;
}

Expand Down
2 changes: 1 addition & 1 deletion packets/objectUpdate/nebulaUpdate.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ exports.name = 'nebulaUpdate';

exports.type = 0x80803df9;

exports.subtype = 0x09;
exports.subtype = 0x0a;
exports.subtypeLength = 1; // 1 byte -> UInt8

exports.pack = null; // Only from server to client
Expand Down
5 changes: 2 additions & 3 deletions packets/objectUpdate/npcUpdate.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@

// Provides an update on the status of any other ship.


exports.name = 'npcUpdate';

exports.type = 0x80803df9;

exports.subtype = 0x04;
exports.subtype = 0x05;
exports.subtypeLength = 1; // 1 byte -> UInt8

exports.pack = null; // Only from server to client
Expand Down Expand Up @@ -54,7 +53,7 @@ exports.unpack = function(data) {
if (bits.get(27)) { unpacked.unknown9 = data.readByte(); }
if (bits.get(26)) { unpacked.unknown10 = data.readByte(); }
if (bits.get(25)) { unpacked.unknown11 = data.readByte(); }
if (bits.get(24)) { unpacked.unknown12 = data.readFloat();}
if (bits.get(24)) { unpacked.unknown12 = data.readFloat();} // - 10000 ??

if (bits.get(39)) { unpacked.unknown13 = data.readLong(); }
if (bits.get(38)) { unpacked.unknown14 = data.readLong(); }
Expand Down
16 changes: 8 additions & 8 deletions packets/objectUpdate/stationUpdate.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ exports.name = 'stationUpdate';

exports.type = 0x80803df9;

exports.subtype = 0x05;
exports.subtype = 0x06;
exports.subtypeLength = 1; // 1 byte -> UInt8

exports.pack = null; // Only from server to client
Expand Down Expand Up @@ -37,20 +37,20 @@ exports.unpack = function(data) {
if (bits.get(7)) { unpacked.shipName = data.readString();}
if (bits.get(6)) { unpacked.forShields = data.readFloat();}
if (bits.get(5)) { unpacked.aftShields = data.readFloat();}
if (bits.get(4)) { unpacked.stationID = data.readLong(); }
if (bits.get(3)) { unpacked.shiptype = data.readLong(); }
if (bits.get(4)) { unpacked.unknown1 = data.readLong(); }
if (bits.get(3)) { unpacked.shipType = data.readLong(); }
if (bits.get(2)) { unpacked.posX = data.readFloat();}
if (bits.get(1)) { unpacked.posY = data.readFloat();}
if (bits.get(0)) { unpacked.posZ = data.readFloat();}

if (bits.get(15)) { unpacked.unknown2 = data.readLong(); }
if (bits.get(14)) { unpacked.unknown3 = data.readLong(); }
if (bits.get(13)) { unpacked.unknown4 = data.readLong(); }
if (bits.get(12)) { unpacked.unknown5 = data.readLong(); }
if (bits.get(11)) { unpacked.unknown6 = data.readByte(); }
if (bits.get(10)) { unpacked.unknown7 = data.readByte(); }
if (bits.get(9)) { /* Unused */ }
if (bits.get(8)) { /* Unused */ }
if (bits.get(12)) { unpacked.unknown5 = data.readShort(); }
if (bits.get(11)) { unpacked.unknown6 = data.readShort(); }
if (bits.get(10)) { unpacked.unknown7 = data.readShort(); }
if (bits.get(9)) { unpacked.unknown8 = data.readShort(); }
if (bits.get(8)) { unpacked.unknown9 = data.readShort(); } // Unused

return unpacked;

Expand Down
3 changes: 2 additions & 1 deletion packets/objectUpdate/torpedoUpdate.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ exports.name = 'torpedoUpdate';

exports.type = 0x80803df9;

exports.subtype = 0x0a;
// exports.subtype = 0x0b;
exports.subtype = 0xfb;
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See #23

exports.subtypeLength = 1; // 1 byte -> UInt8

exports.pack = null; // Only from server to client
Expand Down
135 changes: 135 additions & 0 deletions packets/objectUpdate/unknownObjectUpdate.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@

// Provides an update on the status of a space monster.


exports.name = 'upgradesUpdate';

exports.type = 0x80803df9;

exports.subtype = 0x04;
exports.subtypeLength = 1; // 1 byte -> UInt8

exports.pack = null; // Only from server to client

exports.unpack = function(data) {
var unpacked = {};

unpacked.id = data.readLong();

var bits = data.readBitArray(7);

// This is all guesswork, I haven't seen any changing values in this packet.

// The game UI displays 28 possible upgrades.
// There is a 7-byte bitmask with 56 bits (28*2).
// Then there is a 4-byte word with 28 (out of 32) bits set to 1. Maybe upgrades possible for this ship?
// Then, there are 28 4-byte words, all zeroed out. Are these one 4-byte or 2 2-bytes data fields per upgrade?
// How does this map to the bitmap??

// The bits are in big-endian, and the docs are in little-endian!
// This is why this seems backwards :-(
if (bits.get(7)) { unpacked.unknown07 = data.readLong();}
if (bits.get(6)) { unpacked.unknown06 = data.readLong();}
if (bits.get(5)) { unpacked.unknown05 = data.readLong();}
if (bits.get(4)) { unpacked.unknown04 = data.readLong();}
if (bits.get(3)) { unpacked.unknown03 = data.readLong();}
if (bits.get(2)) { unpacked.unknown02 = data.readLong();}
if (bits.get(1)) { unpacked.unknown01 = data.readLong(); }
if (bits.get(0)) { unpacked.unknown00 = data.readLong(); }

if (bits.get(15)) { unpacked.unknown15 = data.readLong();}
if (bits.get(14)) { unpacked.unknown14 = data.readLong(); }
if (bits.get(13)) { unpacked.unknown13 = data.readLong(); }
if (bits.get(12)) { unpacked.unknown12 = data.readLong();}
if (bits.get(11)) { unpacked.unknown11 = data.readLong();}
if (bits.get(10)) { unpacked.unknown10 = data.readLong();}
if (bits.get(9)) { unpacked.unknown09 = data.readLong();}
if (bits.get(8)) { unpacked.unknown08 = data.readLong();}

if (bits.get(23)) { unpacked.unknown23 = data.readLong();}
if (bits.get(22)) { unpacked.unknown22 = data.readLong();}
if (bits.get(21)) { unpacked.unknown21 = data.readLong();}
if (bits.get(20)) { unpacked.unknown20 = data.readLong();}
if (bits.get(19)) { unpacked.unknown19 = data.readLong();}
if (bits.get(18)) { unpacked.unknown18 = data.readLong();}
if (bits.get(17)) { unpacked.unknown17 = data.readLong();}
if (bits.get(16)) { unpacked.unknown16 = data.readLong();}

// if (bits.get(31)) { unpacked.unknown31 = data.readLong(); }
// if (bits.get(30)) { unpacked.unknown30 = data.readByte(); }
// if (bits.get(29)) { unpacked.unknown29 = data.readLong();}
// if (bits.get(28)) { unpacked.unknown28 = data.readLong(); }
if (bits.get(27)) { unpacked.unknown27 = data.readLong(); }
if (bits.get(26)) { unpacked.unknown26 = data.readLong(); }
if (bits.get(25)) { unpacked.unknown25 = data.readLong(); }
if (bits.get(24)) { unpacked.unknown24 = data.readLong(); }

// if (bits.get(39)) { unpacked.unknown = data.readLong(); }
// if (bits.get(38)) { unpacked.unknown = data.readByte(); }
// if (bits.get(37)) { unpacked.unknown = data.readFloat();}
// if (bits.get(36)) { unpacked.unknown = data.readByte(); }
// if (bits.get(35)) { unpacked.unknown = data.readFloat(); }
// if (bits.get(34)) { unpacked.unknown = data.readByte(); }
// if (bits.get(33)) { unpacked.unknown = data.readLong(); }
// if (bits.get(32)) { unpacked.unknown = data.readLong(); }
//
// if (bits.get(47)) { unpacked.unknown = data.readLong(); }
// if (bits.get(46)) { unpacked.unknown = data.readByte(); }
// if (bits.get(45)) { unpacked.unknown = data.readFloat();}
// if (bits.get(44)) { unpacked.unknown = data.readByte(); }
// if (bits.get(43)) { unpacked.unknown = data.readFloat(); }
// if (bits.get(42)) { unpacked.unknown = data.readByte(); }
// if (bits.get(41)) { unpacked.unknown = data.readLong(); }
// if (bits.get(40)) { unpacked.unknown = data.readLong(); }
//
// if (bits.get(55)) { unpacked.unknown = data.readLong(); }
// if (bits.get(54)) { unpacked.unknown = data.readByte(); }
// if (bits.get(53)) { unpacked.unknown = data.readFloat();}
// if (bits.get(52)) { unpacked.unknown = data.readByte(); }
// if (bits.get(51)) { unpacked.unknown = data.readFloat(); }
// if (bits.get(50)) { unpacked.unknown = data.readByte(); }
// if (bits.get(49)) { unpacked.unknown = data.readLong(); }
// if (bits.get(48)) { unpacked.unknown = data.readLong(); }
//
// if (bits.get(63)) { unpacked.unknown = data.readLong(); }
// if (bits.get(62)) { unpacked.unknown = data.readByte(); }
// if (bits.get(61)) { unpacked.unknown = data.readFloat();}
// if (bits.get(60)) { unpacked.unknown = data.readByte(); }
// if (bits.get(59)) { unpacked.unknown = data.readFloat(); }
// if (bits.get(58)) { unpacked.unknown = data.readByte(); }
// if (bits.get(57)) { unpacked.unknown = data.readLong(); }
// if (bits.get(56)) { unpacked.unknown = data.readLong(); }
//
// if (bits.get(71)) { unpacked.unknown = data.readLong(); }
// if (bits.get(70)) { unpacked.unknown = data.readByte(); }
// if (bits.get(69)) { unpacked.unknown = data.readFloat();}
// if (bits.get(68)) { unpacked.unknown = data.readByte(); }
// if (bits.get(67)) { unpacked.unknown = data.readFloat(); }
// if (bits.get(66)) { unpacked.unknown = data.readByte(); }
// if (bits.get(65)) { unpacked.unknown = data.readLong(); }
// if (bits.get(64)) { unpacked.unknown = data.readLong(); }
//
// if (bits.get(79)) { unpacked.unknown = data.readLong(); }
// if (bits.get(78)) { unpacked.unknown = data.readByte(); }
// if (bits.get(77)) { unpacked.unknown = data.readFloat();}
// if (bits.get(76)) { unpacked.unknown = data.readByte(); }
// if (bits.get(75)) { unpacked.unknown = data.readFloat(); }
// if (bits.get(74)) { unpacked.unknown = data.readByte(); }
// if (bits.get(73)) { unpacked.unknown = data.readLong(); }
// if (bits.get(72)) { unpacked.unknown = data.readLong(); }
//
// if (bits.get(87)) { unpacked.unknown = data.readLong(); }
// if (bits.get(86)) { unpacked.unknown = data.readByte(); }
// if (bits.get(85)) { unpacked.unknown = data.readFloat();}
// if (bits.get(84)) { unpacked.unknown = data.readByte(); }
// if (bits.get(83)) { unpacked.unknown = data.readFloat(); }
// if (bits.get(82)) { unpacked.unknown = data.readByte(); }
// if (bits.get(81)) { unpacked.unknown = data.readLong(); }
// if (bits.get(80)) { unpacked.unknown = data.readLong(); }

console.log('Upgrades update: ', unpacked);

return unpacked;
}


2 changes: 1 addition & 1 deletion packets/objectUpdate/whaleUpdate.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ exports.name = 'whaleUpdate';

exports.type = 0x80803df9;

exports.subtype = 0x0f;
exports.subtype = 0x10;
exports.subtypeLength = 1; // 1 byte -> UInt8

exports.pack = null; // Only from server to client
Expand Down
2 changes: 1 addition & 1 deletion packets/version.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ exports.unpack = function(data) {
var minor = data.readLong();
var patch = data.readLong();

if (major == 2 && minor == 1 && patch >= 1) {
if (major == 2 && minor == 1 && patch >= 5) {
console.log('Cool, we have connected to a supported version of Artemis!');
} else {
console.warn('Unsupported version of Artemis!!!');
Expand Down
44 changes: 25 additions & 19 deletions public/javascripts/map.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,21 @@
// 0x01: player ship
// 0x02: weapons bridge station
// 0x03: engineering bridge station
// 0x04: other ship (enemy or civilian)
// 0x05: space station
// 0x06: mine
// 0x07: anomaly
// 0x09: nebula
// 0x0a: torpedo
// 0x0b: black hole
// 0x0c: asteroid
// 0x0d: generic mesh
// 0x0e: monster
// 0x0f: whale
// 0x10: drone
// 0x04: ????
// 0x05: other ship (enemy or civilian)
// 0x06: space station
// 0x07: mine
// 0x08: anomaly

// 0x0a: ??? nebula
// 0x0b: ??? torpedo

// 0x0c: black hole
// 0x0d: asteroid
// 0x0e: ??? generic mesh
// 0x0f: ??? monster
// 0x10: ??? whale
// 0x11: ??? drone



Expand All @@ -31,36 +34,39 @@ function getStyle(type,isEnemy,name) {
if (type==1) {
strokeColor = '#00ff00';
fillColor = '#40c040';
} else if (type==4) {
} else if (type==5) {
if (isEnemy) {
strokeColor = '#ff0000';
fillColor = '#c04040';
} else {
strokeColor = '#00ffff';
fillColor = '#40c0c0';
}
} else if (type==5) {
} else if (type==6) {
strokeColor = '#ffff00'; // Stations
fillColor = '#c0c040';
} else if (type==6) {
} else if (type==7) {
strokeColor = '#ffffff'; // Mines
fillColor = '#666666';
radius = 2;
} else if (type==9) {
} else if (type==10) {
strokeColor = [0xff,0x00,0xff,.05]; // Nebulae
fillColor = [0xc0,0x40,0xc0,.2];
radius = 15;
} else if (type==11) {
} else if (type==12) {
strokeColor = '#404040'; // Black hole
fillColor = '#000000';
radius = 15;
} else if (type==12) {
} else if (type==13) {
strokeColor = '#ffbf80'; // Asteroid
fillColor = '#c06640';
} else if (type==15) {
strokeColor = '#ff80ff'; // Space Monster
fillColor = '#804080';
} else if (type==16) {
strokeColor = '#00ff80'; // Space Whales
fillColor = '#40c080';
} else if (type==16) {
} else if (type==17) {
strokeColor = '#ffffff'; // Drone
fillColor = '#666666';
} else if (type==-1) {
Expand Down
Loading