More session handling code added.

This commit is contained in:
Filip Maj
2016-08-24 14:18:37 -04:00
parent a1ca960543
commit 4aae16e458
4 changed files with 109 additions and 56 deletions

View File

@@ -0,0 +1,36 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FFXIVClassic_World_Server.Packets.Receive
{
class HelloPacket
{
public bool invalidPacket = false;
public uint sessionId;
public HelloPacket(byte[] data)
{
using (MemoryStream mem = new MemoryStream(data))
{
using (BinaryReader binReader = new BinaryReader(mem))
{
try
{
byte[] readIn = new byte[12];
binReader.BaseStream.Seek(0x14, SeekOrigin.Begin);
binReader.Read(readIn, 0, 12);
sessionId = UInt32.Parse(Encoding.ASCII.GetString(readIn));
}
catch (Exception)
{
invalidPacket = true;
}
}
}
}
}
}

View File

@@ -6,9 +6,12 @@ namespace FFXIVClassic_World_Server.Packets.Send.Login
{
class Login0x7ResponsePacket
{
public const ushort OPCODE = 0x0008;
public const uint PACKET_SIZE = 0x18;
public static SubPacket BuildPacket(uint actorID)
{
byte[] data = new byte[0x18];
byte[] data = new byte[PACKET_SIZE];
using (MemoryStream mem = new MemoryStream(data))
{
@@ -17,15 +20,14 @@ namespace FFXIVClassic_World_Server.Packets.Send.Login
try
{
binWriter.Write((UInt32)actorID);
binWriter.Write((UInt32)type);
binWriter.Write((UInt32)Utils.UnixTimeStampUTC());
}
catch (Exception)
{
}
{}
}
}
return BasePacket.CreatePacket(data, false, false);
return new SubPacket(false, OPCODE, 0, 0, data);
}
}
}