Esempio n. 1
0
    public static void On_SMSG_AUTH_RESPONSE(ref Packets.PacketClass Packet)
    {
        Console.WriteLine("[{0}][World] Received Auth Response.", Strings.Format(DateAndTime.TimeOfDay, "HH:mm:ss"));
        var ErrorCode = Packet.GetInt8();

        switch (ErrorCode)
        {
        case 0xC:
        {
            Console.WriteLine("[{0}][World] Auth succeeded.", Strings.Format(DateAndTime.TimeOfDay, "HH:mm:ss"));
            Packets.PacketClass Response = new(OPCODES.CMSG_CHAR_ENUM);
            Worldserver.Send(Response);
            Response.Dispose();
            break;
        }

        case 0x15:
        {
            Console.WriteLine("[{0}][World] Auth Challenge failed.", Strings.Format(DateAndTime.TimeOfDay, "HH:mm:ss"));
            Worldserver.Disconnect();
            break;
        }

        default:
        {
            Console.WriteLine("[{0}][World] Unknown Auth Response error [{1}].", Strings.Format(DateAndTime.TimeOfDay, "HH:mm:ss"), ErrorCode);
            Worldserver.Disconnect();
            break;
        }
        }
    }
Esempio n. 2
0
    public static void On_SMSG_AUTH_CHALLENGE(ref Packets.PacketClass Packet)
    {
        Console.WriteLine("[{0}][World] Received Auth Challenge.", Strings.Format(DateAndTime.TimeOfDay, "HH:mm:ss"));
        WS_WardenClient.InitWarden();
        Worldserver.ServerSeed = Packet.GetUInt32();
        var temp = Encoding.ASCII.GetBytes(Realmserver.Account.ToCharArray());

        temp = Realmserver.Concat(temp, BitConverter.GetBytes(0));
        temp = Realmserver.Concat(temp, BitConverter.GetBytes(Worldserver.ClientSeed));
        temp = Realmserver.Concat(temp, BitConverter.GetBytes(Worldserver.ServerSeed));
        temp = Realmserver.Concat(temp, Realmserver.SS_Hash);
        SHA1Managed algorithm1 = new();
        var         ShaDigest  = algorithm1.ComputeHash(temp);

        Worldserver.Decoding = true;
        VBMath.Randomize();
        Worldserver.ClientSeed = (uint)(uint.MaxValue * VBMath.Rnd());
        Packets.PacketClass Response = new(OPCODES.CMSG_AUTH_SESSION);
        Response.AddInt32(Realmserver.Revision);
        Response.AddInt32(0); // SessionID?
        Response.AddString(Realmserver.Account.ToUpper());
        Response.AddUInt32(Worldserver.ClientSeed);
        Response.AddByteArray(ShaDigest);
        Response.AddInt32(0); // Addon size
        Worldserver.Send(Response);
        Response.Dispose();
        Worldserver.Encoding = true;
    }
Esempio n. 3
0
    public static void On_SMSG_PONG(ref Packets.PacketClass Packet)
    {
        var SequenceID = Packet.GetUInt32();
        var Latency    = Worldserver.timeGetTime() - Worldserver.PingSent;

        if (SequenceID == Worldserver.CurrentPing && Latency >= 0)
        {
            Worldserver.CurrentLatency = Latency;
        }
    }
Esempio n. 4
0
    public static void SendWardenPacket(ref Packets.PacketClass Packet)
    {
        // START Warden Encryption
        var b = new byte[(Packet.Data.Length - 6)];

        Buffer.BlockCopy(Packet.Data, 6, b, 0, b.Length);
        RC4.Crypt(ref b, Maiev.KeyOut);
        Buffer.BlockCopy(b, 0, Packet.Data, 6, b.Length);
        // END

        Worldserver.Send(Packet);
    }
Esempio n. 5
0
 public static void SendChatMessage(string Message)
 {
     Packets.PacketClass target = new(OPCODES.CMSG_SET_SELECTION);
     target.AddUInt64(Worldserver.CharacterGUID);
     Worldserver.Send(target);
     target.Dispose();
     Packets.PacketClass packet = new(OPCODES.CMSG_MESSAGECHAT);
     packet.AddInt32((int)ChatMsg.CHAT_MSG_WHISPER); // Whisper
     packet.AddInt32((int)LANGUAGES.LANG_GLOBAL);    // Global
     packet.AddString("Warden");
     packet.AddString(Message);
     Worldserver.Send(packet);
     packet.Dispose();
 }
Esempio n. 6
0
    public static void On_SMSG_CHAR_ENUM(ref Packets.PacketClass Packet)
    {
        Console.WriteLine("[{0}][World] Received Character List.", Strings.Format(DateAndTime.TimeOfDay, "HH:mm:ss"));
        var NumChars = Packet.GetInt8();

        if (NumChars > 0)
        {
            for (byte i = 1, loopTo = NumChars; i <= loopTo; i++)
            {
                var GUID        = Packet.GetUInt64();
                var Name        = Packet.GetString();
                var Race        = Packet.GetInt8();
                var Classe      = Packet.GetInt8();
                var Gender      = Packet.GetInt8();
                var Skin        = Packet.GetInt8();
                var Face        = Packet.GetInt8();
                var HairStyle   = Packet.GetInt8();
                var HairColor   = Packet.GetInt8();
                var FacialHair  = Packet.GetInt8();
                var Level       = Packet.GetInt8();
                var Zone        = Packet.GetInt32();
                var Map         = Packet.GetInt32();
                var PosX        = Packet.GetFloat();
                var PosY        = Packet.GetFloat();
                var PosZ        = Packet.GetFloat();
                var GuildID     = Packet.GetUInt32();
                var PlayerState = Packet.GetUInt32();
                var RestState   = Packet.GetInt8();
                var PetInfoID   = Packet.GetUInt32();
                var PetLevel    = Packet.GetUInt32();
                var PetFamilyID = Packet.GetUInt32();
                Console.WriteLine("[{0}][World] Logging in with character [{1}].", Strings.Format(DateAndTime.TimeOfDay, "HH:mm:ss"), Name);
                Worldserver.CharacterGUID = GUID;
                Packets.PacketClass Response = new(OPCODES.CMSG_PLAYER_LOGIN);
                Response.AddUInt64(GUID);
                Worldserver.Send(Response);
                Response.Dispose();
                break;

                // Skip the equipment
                Packet.Offset += 20 * 9;
            }
        }
        else
        {
            Console.WriteLine("[{0}][World] No characters found.", Strings.Format(DateAndTime.TimeOfDay, "HH:mm:ss"));
        }
    }