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); var algorithm1 = new SHA1Managed(); var ShaDigest = algorithm1.ComputeHash(temp); Worldserver.Decoding = true; VBMath.Randomize(); Worldserver.ClientSeed = (uint)(uint.MaxValue * VBMath.Rnd()); var Response = new Packets.PacketClass(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; }
public static void Ping(object State) { try { if (CurrentPing == uint.MaxValue) { CurrentPing = 0U; } CurrentPing = (uint)(CurrentPing + 1L); PingSent = timeGetTime(); var Ping = new Packets.PacketClass(OPCODES.CMSG_PING); Ping.AddUInt32(CurrentPing); Ping.AddInt32(CurrentLatency); Send(Ping); Ping.Dispose(); } catch (Exception) { PingTimer.Dispose(); } }
public static void OnConnect() { var LogonChallenge = new Packets.PacketClass(CMD_AUTH_LOGON_CHALLENGE); LogonChallenge.AddInt8(0x8); LogonChallenge.AddUInt16(0); // Packet length LogonChallenge.AddString("WoW"); LogonChallenge.AddInt8(VersionA); // Version LogonChallenge.AddInt8(VersionB); // Version LogonChallenge.AddInt8(VersionC); // Version LogonChallenge.AddUInt16(Revision); // Revision LogonChallenge.AddString("x86", Reversed: true); LogonChallenge.AddString("Win", Reversed: true); LogonChallenge.AddString("enUS", false, true); LogonChallenge.AddInt32(0x3C); // Timezone LogonChallenge.AddUInt32(BitConverter.ToUInt32(((IPEndPoint)Connection.LocalEndPoint).Address.GetAddressBytes(), 0)); LogonChallenge.AddInt8((byte)Account.Length); LogonChallenge.AddString(Account.ToUpper(), false); LogonChallenge.AddUInt16((ushort)(LogonChallenge.Data.Length - 4), 2); SendR(LogonChallenge); LogonChallenge.Dispose(); Console.WriteLine("[{0}][Realm] Sent Logon Challenge.", Strings.Format(DateAndTime.TimeOfDay, "HH:mm:ss")); }