diff --git a/lib/protocol.js b/lib/protocol.js index 0d2f984..b660973 100644 --- a/lib/protocol.js +++ b/lib/protocol.js @@ -1173,7 +1173,7 @@ function get(packetId, toServer) { function createPacketBuffer(packetId, params, isServer) { var size = 1; var fields = [ new UByteWriter(packetId) ]; - var packet = get(packetId, isServer); + var packet = get(packetId, !isServer); packet.forEach(function(fieldInfo) { var value = params[fieldInfo.name]; var Writer = types[fieldInfo.type][1]; @@ -1196,7 +1196,7 @@ function parsePacket(buffer, isServer) { var packetId = buffer.readUInt8(0); var size = 1; var results = { id: packetId }; - var packetInfo = get(packetId, !isServer); + var packetInfo = get(packetId, isServer); assert.ok(packetInfo, "Unrecognized packetId: " + packetId); var i, fieldInfo, read, readResults; for (i = 0; i < packetInfo.length; ++i) { diff --git a/test/test.js b/test/test.js index ee24f41..9b401b3 100644 --- a/test/test.js +++ b/test/test.js @@ -359,6 +359,9 @@ describe("client", function() { done(); }, SURVIVE_TIME); }); + client.on(0x0d, function(packet) { + assert.ok(packet.stance > packet.y, "stance should be > y"); + }); }); }); });