protected void RealmList(byte type, List<byte> data)
{
UInt32 count = BitConverter.ToUInt32(data.ToArray(), 8);
Int32 offset = 12;
if (ClientlessBot.debugging)
Console.WriteLine("{0}: [BNCS] List of realms:", m_owner.Account);
for(ulong i = 1; i <= count; i++)
{
offset += 4;
String realmTitle = Utils.readNullTerminatedString(System.Text.Encoding.ASCII.GetString(data.ToArray()), ref offset);
String realmDescription = Utils.readNullTerminatedString(System.Text.Encoding.ASCII.GetString(data.ToArray()), ref offset);
if (ClientlessBot.debugging)
Console.WriteLine("{0}: [BNCS] {1}. {2}, {3}",m_owner.Account,i, realmTitle,realmDescription);
if(m_owner.Realm == null && i == 1)
{
if (ClientlessBot.debugging)
Console.WriteLine("{0}: [BNCS] No realm was specified in the ini so we're going to connect to {1}", m_owner.Account, realmTitle);
m_owner.Realm = realmTitle;
}
}
if (m_owner.LoggedIn) {
//make_game();
} else {
if (ClientlessBot.debugging)
Console.WriteLine("{0}: [BNCS] Logging on to the realm {1}", m_owner.Account, m_owner.Realm);
UInt32 clientToken = 1;
byte[] packet = BuildPacket((byte)0x3e, BitConverter.GetBytes(clientToken), Bsha1.DoubleHash(clientToken, m_owner.ServerToken, "password"), System.Text.Encoding.ASCII.GetBytes(m_owner.Realm), zero);
byte[] temp = System.Text.Encoding.ASCII.GetBytes(m_owner.Realm);
if (ClientlessBot.debugging)
{
Console.WriteLine("\tSize of realm string: {0}", temp.Length);
Console.WriteLine("\tWriting to Stream: ");
for (int i = 0; i < packet.Length; i++)
{
if (i % 8 == 0 && i != 0)
Console.Write(" ");
if (i % 16 == 0 && i != 0)
Console.WriteLine("");
Console.Write("{0:X2} ", packet[i]);
}
Console.WriteLine("");
}
m_stream.Write(packet,0,packet.Length);
}
}