diff --git a/FFXIVClassic Map Server/PacketProcessor.cs b/FFXIVClassic Map Server/PacketProcessor.cs index 3c05864a..ae0bd12c 100644 --- a/FFXIVClassic Map Server/PacketProcessor.cs +++ b/FFXIVClassic Map Server/PacketProcessor.cs @@ -192,6 +192,7 @@ namespace FFXIVClassic_Lobby_Server //Update Position case 0x00CA: //Update Position + //subpacket.debugPrintSubPacket(); UpdatePlayerPositionPacket posUpdate = new UpdatePlayerPositionPacket(subpacket.data); player.updatePlayerActorPosition(posUpdate.x, posUpdate.y, posUpdate.z, posUpdate.rot, posUpdate.moveState); diff --git a/FFXIVClassic Map Server/common/Utils.cs b/FFXIVClassic Map Server/common/Utils.cs index 055ca9b0..e63f14c2 100644 --- a/FFXIVClassic Map Server/common/Utils.cs +++ b/FFXIVClassic Map Server/common/Utils.cs @@ -75,6 +75,19 @@ namespace FFXIVClassic_Lobby_Server.common ((input << 24) & 0xff000000); } + public static int swapEndian(int input) + { + uint inputAsUint = (uint)input; + + input = (int) + (((inputAsUint >> 24) & 0xff) | + ((inputAsUint << 8) & 0xff0000) | + ((inputAsUint >> 8) & 0xff00) | + ((inputAsUint << 24) & 0xff000000)); + + return input; + } + public static uint MurmurHash2(string key, uint seed) { // 'm' and 'r' are mixing constants generated offline. diff --git a/FFXIVClassic Map Server/lua/LuaUtils.cs b/FFXIVClassic Map Server/lua/LuaUtils.cs index 42384739..686adfef 100644 --- a/FFXIVClassic Map Server/lua/LuaUtils.cs +++ b/FFXIVClassic Map Server/lua/LuaUtils.cs @@ -29,7 +29,7 @@ namespace FFXIVClassic_Map_Server switch (code) { case 0x0: //Int32 - value = Utils.swapEndian(reader.ReadUInt32()); + value = Utils.swapEndian(reader.ReadInt32()); break; case 0x1: //Int32 value = Utils.swapEndian(reader.ReadUInt32()); @@ -86,11 +86,8 @@ namespace FFXIVClassic_Map_Server writer.Write((Byte)l.typeID); switch (l.typeID) { - case 0x0: //Int32 - if (l.value is uint) - writer.Write((UInt32)Utils.swapEndian((UInt32)l.value)); - else - writer.Write((UInt32)Utils.swapEndian((UInt32)(Int32)l.value)); + case 0x0: //Int32 + writer.Write((Int32)Utils.swapEndian((Int32)l.value)); break; case 0x1: //Int32 writer.Write((UInt32)Utils.swapEndian((UInt32)l.value)); @@ -139,7 +136,7 @@ namespace FFXIVClassic_Map_Server switch (code) { case 0x0: //Int32 - value = Utils.swapEndian(reader.ReadUInt32()); + value = Utils.swapEndian(reader.ReadInt32()); break; case 0x1: //Int32 value = Utils.swapEndian(reader.ReadUInt32()); @@ -231,11 +228,11 @@ namespace FFXIVClassic_Map_Server { if (d.Type == DataType.Number) { - luaParams.Add(new LuaParam(0x0, (uint)d.Number)); + luaParams.Add(new LuaParam(0x0, (int)d.Number)); } else if (d.Type == DataType.Number) { - luaParams.Add(new LuaParam(0x0, (int)d.Number)); + luaParams.Add(new LuaParam(0x1, (uint)d.Number)); } else if (d.Type == DataType.String) { @@ -260,13 +257,13 @@ namespace FFXIVClassic_Map_Server private static void addToList(object o, List luaParams) { - if (o is uint) - { - luaParams.Add(new LuaParam(0x0, (uint)o)); - } - else if (o is int) + if (o is int) { luaParams.Add(new LuaParam(0x0, (int)o)); + } + else if (o is uint) + { + luaParams.Add(new LuaParam(0x1, (uint)o)); } else if (o is double) { @@ -316,7 +313,7 @@ namespace FFXIVClassic_Map_Server switch (lParams[i].typeID) { case 0x0: //Int32 - dumpString += String.Format("0x{0:X}", (uint)lParams[i].value); + dumpString += String.Format("0x{0:X}", (int)lParams[i].value); break; case 0x1: //Int32 dumpString += String.Format("0x{0:X}", (uint)lParams[i].value);