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
case 0x00CA:
//Update Position
//subpacket.debugPrintSubPacket();
UpdatePlayerPositionPacket posUpdate = new UpdatePlayerPositionPacket(subpacket.data);
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);
}
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.

View File

@ -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());
@ -87,10 +87,7 @@ namespace FFXIVClassic_Map_Server
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));
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,14 +257,14 @@ namespace FFXIVClassic_Map_Server
private static void addToList(object o, List<LuaParam> 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)
{
if (((double)o) % 1 == 0)
@ -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);