Lua Parameter type 0 is now signed int. Type 1 in unsigned int. ShopSalesman script uses signed.

This commit is contained in:
Filip Maj 2016-01-31 12:23:12 -05:00
parent 45b9f9a064
commit fe69f069ea
3 changed files with 26 additions and 15 deletions

View File

@ -192,6 +192,7 @@ namespace FFXIVClassic_Lobby_Server
//Update Position //Update Position
case 0x00CA: case 0x00CA:
//Update Position //Update Position
//subpacket.debugPrintSubPacket();
UpdatePlayerPositionPacket posUpdate = new UpdatePlayerPositionPacket(subpacket.data); UpdatePlayerPositionPacket posUpdate = new UpdatePlayerPositionPacket(subpacket.data);
player.updatePlayerActorPosition(posUpdate.x, posUpdate.y, posUpdate.z, posUpdate.rot, posUpdate.moveState); player.updatePlayerActorPosition(posUpdate.x, posUpdate.y, posUpdate.z, posUpdate.rot, posUpdate.moveState);

View File

@ -75,6 +75,19 @@ namespace FFXIVClassic_Lobby_Server.common
((input << 24) & 0xff000000); ((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) public static uint MurmurHash2(string key, uint seed)
{ {
// 'm' and 'r' are mixing constants generated offline. // 'm' and 'r' are mixing constants generated offline.

View File

@ -29,7 +29,7 @@ namespace FFXIVClassic_Map_Server
switch (code) switch (code)
{ {
case 0x0: //Int32 case 0x0: //Int32
value = Utils.swapEndian(reader.ReadUInt32()); value = Utils.swapEndian(reader.ReadInt32());
break; break;
case 0x1: //Int32 case 0x1: //Int32
value = Utils.swapEndian(reader.ReadUInt32()); value = Utils.swapEndian(reader.ReadUInt32());
@ -86,11 +86,8 @@ namespace FFXIVClassic_Map_Server
writer.Write((Byte)l.typeID); writer.Write((Byte)l.typeID);
switch (l.typeID) switch (l.typeID)
{ {
case 0x0: //Int32 case 0x0: //Int32
if (l.value is uint) writer.Write((Int32)Utils.swapEndian((Int32)l.value));
writer.Write((UInt32)Utils.swapEndian((UInt32)l.value));
else
writer.Write((UInt32)Utils.swapEndian((UInt32)(Int32)l.value));
break; break;
case 0x1: //Int32 case 0x1: //Int32
writer.Write((UInt32)Utils.swapEndian((UInt32)l.value)); writer.Write((UInt32)Utils.swapEndian((UInt32)l.value));
@ -139,7 +136,7 @@ namespace FFXIVClassic_Map_Server
switch (code) switch (code)
{ {
case 0x0: //Int32 case 0x0: //Int32
value = Utils.swapEndian(reader.ReadUInt32()); value = Utils.swapEndian(reader.ReadInt32());
break; break;
case 0x1: //Int32 case 0x1: //Int32
value = Utils.swapEndian(reader.ReadUInt32()); value = Utils.swapEndian(reader.ReadUInt32());
@ -231,11 +228,11 @@ namespace FFXIVClassic_Map_Server
{ {
if (d.Type == DataType.Number) 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) 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) else if (d.Type == DataType.String)
{ {
@ -260,13 +257,13 @@ namespace FFXIVClassic_Map_Server
private static void addToList(object o, List<LuaParam> luaParams) private static void addToList(object o, List<LuaParam> luaParams)
{ {
if (o is uint) if (o is int)
{
luaParams.Add(new LuaParam(0x0, (uint)o));
}
else if (o is int)
{ {
luaParams.Add(new LuaParam(0x0, (int)o)); luaParams.Add(new LuaParam(0x0, (int)o));
}
else if (o is uint)
{
luaParams.Add(new LuaParam(0x1, (uint)o));
} }
else if (o is double) else if (o is double)
{ {
@ -316,7 +313,7 @@ namespace FFXIVClassic_Map_Server
switch (lParams[i].typeID) switch (lParams[i].typeID)
{ {
case 0x0: //Int32 case 0x0: //Int32
dumpString += String.Format("0x{0:X}", (uint)lParams[i].value); dumpString += String.Format("0x{0:X}", (int)lParams[i].value);
break; break;
case 0x1: //Int32 case 0x1: //Int32
dumpString += String.Format("0x{0:X}", (uint)lParams[i].value); dumpString += String.Format("0x{0:X}", (uint)lParams[i].value);