using FiestaBot.Instances.Networking;
using FiestaBot.Login.ClientPacket;
using FiestaBot.Login.Networking;

namespace FiestaBot.Login.Handlers
{
    internal class Login02Handler
    {
        [LoginPacketHandler(2, 4)]
        public static void Ping(LoginClient Socket, Packet Packet)
        {
            Packet.Dispose();

            Packet p = new Packet(2, 5);
            Socket.SendPacket(p);
        }

        [LoginPacketHandler(2, 7)]
        public static void ReceiveXor(LoginClient Socket, Packet Packet)
        {
            Packet.ReadShort(out short Xor);

            Socket.Crypto = new FiestaCrypto(Xor);

            Packet.Dispose();

            //Send version & clienthash
            LoginPacket.SendWipe(Socket);
            //LoginPacket.SendVersion(Socket);
            //LoginPacket.SendHash(Socket);
        }
    }
}
