Fixed actor state property packet not sending in string correctly. Added test command for it. Fixed bug in MurmurHash algo.

This commit is contained in:
Filip Maj 2015-11-28 10:00:18 -05:00
parent 0a6b005a0c
commit 50659afc82
4 changed files with 37 additions and 11 deletions

View File

@ -20,7 +20,6 @@ namespace FFXIVClassic_Lobby_Server
TextWriterTraceListener myWriter = new TextWriterTraceListener(System.Console.Out);
Debug.Listeners.Add(myWriter);
#endif
bool startServer = true;
Console.ForegroundColor = ConsoleColor.Cyan;
@ -87,8 +86,11 @@ namespace FFXIVClassic_Lobby_Server
Log.error("Could not load packet");
}
}
else if (split[0].Equals("property"))
{
server.testCodePacket(Utils.MurmurHash2(split[1], 0), Convert.ToUInt32(split[2], 16), split[3]);
}
}
Thread.Sleep(1000);
}
}

View File

@ -10,6 +10,7 @@ using FFXIVClassic_Lobby_Server.common;
using FFXIVClassic_Map_Server.dataobjects;
using FFXIVClassic_Lobby_Server.packets;
using System.IO;
using FFXIVClassic_Map_Server.packets.send.actor;
namespace FFXIVClassic_Lobby_Server
{
@ -204,7 +205,14 @@ namespace FFXIVClassic_Lobby_Server
if (buffer.Length < offset + packetSize)
return null;
try
{
newPacket = new BasePacket(buffer, ref offset);
}
catch (OverflowException)
{
return null;
}
return newPacket;
}
@ -215,5 +223,22 @@ namespace FFXIVClassic_Lobby_Server
{
mProcessor.sendPacket(path, conn);
}
public void testCodePacket(uint id, uint value, string target)
{
SetActorPropetyPacket changeProperty = new SetActorPropetyPacket();
changeProperty.addInt(id, value);
changeProperty.setTarget(target);
foreach (KeyValuePair<uint, Player> entry in mConnectedPlayerList)
{
SubPacket changePropertyPacket = changeProperty.buildPacket((entry.Value.actorID), (entry.Value.actorID));
BasePacket packet = BasePacket.createPacket(changePropertyPacket, true, false);
packet.debugPrintPacket();
entry.Value.getConnection1().queuePacket(packet);
entry.Value.getConnection2().queuePacket(packet);
}
}
}
}

View File

@ -96,15 +96,14 @@ namespace FFXIVClassic_Lobby_Server.common
}
// Handle the last few bytes of the input array
switch (len)
{
case 3:
h ^= (uint)data[2] << 16; goto case 2;
h ^= (uint)data[0] << 16; goto case 2;
case 2:
h ^= (uint)data[0] << 8; goto case 1;
h ^= (uint)data[len-2] << 8; goto case 1;
case 1:
h ^= data[1];
h ^= data[len-1];
h *= m;
break;
};

View File

@ -138,8 +138,8 @@ namespace FFXIVClassic_Map_Server.packets.send.actor
public void setTarget(string target)
{
binWriter.Write((byte)(0x82 + target.Length));
binWriter.Write(target);
runningByteTotal += (ushort)(1 + target.Length);
binWriter.Write(Encoding.ASCII.GetBytes(target));
runningByteTotal += (ushort)(1 + Encoding.ASCII.GetByteCount(target));
}