private void Handle_CreatureQuery(WoWReader wr)
        {
            Entry entry = new Entry();

            entry.entry   = wr.ReadUInt32();
            entry.name    = wr.ReadString();
            entry.blarg   = wr.ReadBytes(3);
            entry.subname = wr.ReadString();
            entry.flags   = wr.ReadUInt32();
            entry.subtype = wr.ReadUInt32();
            entry.family  = wr.ReadUInt32();
            entry.rank    = wr.ReadUInt32();

            BoogieCore.Log(LogType.NeworkComms, "Got CreatureQuery Response - Entry: {0} - Name: {1} - SubName {2}", entry.entry, entry.name, entry.subname);
            if (EntryList.ContainsKey(entry.entry) == false)
            {
                EntryList.Add(entry.entry, entry);
            }

            if (EntryQueue.ContainsKey(entry.entry))
            {
                EntryQueue.Remove(entry.entry);
            }

            foreach (Object obj in BoogieCore.world.getObjectList())
            {
                if (obj.Fields != null)
                {
                    if (obj.Fields[(int)UpdateFields.OBJECT_FIELD_ENTRY] == entry.entry)
                    {
                        if (entry.name.Contains("Auctioneer") && SentHello == false)
                        {
                            WoWWriter ww = new WoWWriter(OpCode.MSG_AUCTION_HELLO);
                            ww.Write(obj.GUID.GetOldGuid());
                            Send(ww.ToArray());
                            BoogieCore.Log(LogType.SystemDebug, "Sent AH Hello!");
                            SentHello = true;
                        }

                        obj.Name    = entry.name;
                        obj.SubName = entry.subname;
                        obj.SubType = entry.subtype;
                        obj.Family  = entry.family;
                        obj.Rank    = entry.rank;
                    }
                }
            }
        }
Esempio n. 2
0
        // Update Player, with Player Object Update Fields :D
        public void updatePlayer(Object po)
        {
            if (!inited)
            {
                return;
            }

            obj = po;

            BoogieCore.Log(LogType.System, "Player Class Updated!");

            level = po.Fields[(int)UpdateFields.UNIT_FIELD_LEVEL];
            //exp = po.Fields[(int)UpdateFields.PLAYER_XP];
            //nextlevelexp = po.Fields[(int)UpdateFields.PLAYER_NEXT_LEVEL_XP];
            hp = po.Fields[(int)UpdateFields.UNIT_FIELD_HEALTH];       // probably wrong?
        }
        private void Handle_NameQuery(WoWReader wr)
        {
            WoWGuid guid   = new WoWGuid(wr.ReadUInt64());
            string  name   = wr.ReadString();
            UInt16  unk    = wr.ReadByte();
            UInt32  Race   = wr.ReadUInt32();
            UInt32  Gender = wr.ReadUInt32();
            UInt32  Level  = wr.ReadUInt32();

            BoogieCore.Log(LogType.NeworkComms, "Got NameQuery Response - GUID: {4} Name: {0} - Race: {1} - Gender: {2} - Level: {3}", name, Race, Gender, Level, BitConverter.ToUInt64(guid.GetNewGuid(), 0));

            Object obj = BoogieCore.world.getObject(guid);

            if (obj != null)    // Update existing object
            {
                obj.Name   = name;
                obj.Race   = Race;
                obj.Gender = Gender;
                obj.Level  = Level;
                BoogieCore.world.updateObject(obj);
            }
            else                // Create new Object        -- FIXME: Add to new 'names only' list?
            {
                obj        = new Object();
                obj.GUID   = guid;
                obj.Name   = name;
                obj.Race   = Race;
                obj.Gender = Gender;
                obj.Level  = Level;
                BoogieCore.world.newObject(obj, true);
            }

            /* Process chat message if we looked them up now */
            for (int i = 0; i < ChatQueued.Count; i++)
            {
                ChatQueue message = (ChatQueue)ChatQueued[i];
                if (message.GUID.GetOldGuid() == guid.GetOldGuid())
                {
                    BoogieCore.Event(new Event(EventType.EVENT_CHAT, Time.GetTime(), message, name));
                    ChatQueued.Remove(message);
                }
            }

            // WoWChat uses this to retrive names on friends and ignore list.
            BoogieCore.Event(new Event(EventType.EVENT_NAMEQUERY_RESPONSE, Time.GetTime(), guid, name));
        }
Esempio n. 4
0
        /// <summary>Tells the server to retrieve the mail list. Must be near a mailbox to work.</summary>
        public void getMail()
        {
            // Find the mailbox on the object list. (FIXME: Need to work out which is closest, and check if we are in range?)

            /*for (int i = 0; i < mObjects.Count; i++)
             * {
             *  if(mObjects[i].Fields != null)  // Must have Fields
             *      if(mObjects[i].Fields.Length >= (uint)UpdateFields.GAMEOBJECT_END)  // Fields array must go far enough
             *          if(mObjects[i].Fields[(int)UpdateFields.GAMEOBJECT_TYPE_ID] == (uint)GAMEOBJECT_TYPES.GAMEOBJECT_TYPE_MAILBOX) // If its a mailbox
             *          {
             *              BoogieCore.Log(LogType.SystemDebug, "Attempting to read mail using mailbox {0}", mObjects[i].GUID);
             *              BoogieCore.WorldServerClient.Query_GetMailList(mObjects[i].GUID);
             *              return;
             *          }
             * }*/
            BoogieCore.Log(LogType.SystemDebug, "No nearby or known mailbox found!");
        }
Esempio n. 5
0
        private void Handle_AuthResponse(WoWReader wr)
        {
            byte error = wr.ReadByte();

            if (error != 0x0C)
            {
                BoogieCore.Log(LogType.Error, "WS: Authentication Failed: Error = {0}", error);
                return;
            }
            BoogieCore.Log(LogType.System, "WS: Authentication Successful!");

            BoogieCore.Log(LogType.System, "WS: Requesting Character List...");

            WoWWriter ww = new WoWWriter(OpCode.CMSG_CHAR_ENUM);

            Send(ww.ToArray());
            PingTimer.Enabled = true;
        }
Esempio n. 6
0
        private void Ping(object source, ElapsedEventArgs e)
        {
            if (!mSocket.Connected)
            {
                PingTimer.Enabled = false;
                PingTimer.Stop();
                return;
            }

            Ping_Req_Time = MM_GetTime();

            BoogieCore.Log(LogType.NeworkComms, "Ping!");
            WoWWriter ww = new WoWWriter(OpCode.CMSG_PING);

            ww.Write(Ping_Seq);
            ww.Write(Latency);
            Send(ww.ToArray());
        }
Esempio n. 7
0
        private void Handle_NewWorld(WoWReader wr)
        {
            Object obj = BoogieCore.world.getPlayerObject();

            WorldZone(obj.GUID.GetOldGuid());

            UInt32 mapid = wr.ReadUInt32();

            BoogieCore.world.zoned(mapid);          // Tell World we zoned, and give new mapid
            obj.coord = new Coordinate(wr.ReadSingle(), wr.ReadSingle(), wr.ReadSingle(), wr.ReadSingle());
            WoWWriter ww = new WoWWriter(OpCode.MSG_MOVE_WORLDPORT_ACK);

            //ww.Write(BoogieCore.world.getPlayerObject().GUID.GetOldGuid());
            Send(ww.ToArray());
            SendMoveHeartBeat(obj.coord);
            BoogieCore.Log(LogType.System, "Got worldport for mapid: {0} xyz: {1} {2} {3}", mapid, obj.coord.X, obj.coord.Y, obj.coord.Z);
            BoogieCore.world.updatePlayerLocationUI();
        }
Esempio n. 8
0
        private bool HandleLogonProof()
        {
            byte op    = win.ReadByte();
            byte error = win.ReadByte();

            if (error > 0)
            {
                BoogieCore.Log(LogType.System, "Login Proof: Error = {0}", error);
                return(false);
            }

            M2 = win.ReadBytes(20);
            int    unknown = win.ReadInt32();
            UInt16 unk2    = win.ReadUInt16();

            win.ReadUInt32();

            return(true);
        }
Esempio n. 9
0
        private byte[] GenerateCrc(byte[] crcsalt)
        {
            Sha1Hash sha;

            byte[] buffer1 = new byte[0x40];
            byte[] buffer2 = new byte[0x40];

            for (int i = 0; i < 0x40; ++i)
            {
                buffer1[i] = 0x36;
                buffer2[i] = 0x5c;
            }

            for (int i = 0; i < crcsalt.Length; ++i)
            {
                buffer1[i] ^= crcsalt[i];
                buffer2[i] ^= crcsalt[i];
            }

            sha = new Sha1Hash();
            sha.Update(buffer1);


            try
            {
                FileStream fs     = new FileStream("hash.bin", FileMode.Open, FileAccess.Read);
                byte[]     Buffer = new byte[fs.Length];
                fs.Read(Buffer, 0, (int)fs.Length);
                sha.Update(Buffer);
            }
            catch (Exception e)
            {
                BoogieCore.Log(LogType.Error, e.Message);
            }

            byte[] hash1 = sha.Final();

            sha = new Sha1Hash();
            sha.Update(buffer2);
            sha.Update(hash1);
            return(sha.Final());
        }
Esempio n. 10
0
        // Initialize Player, with Player Object Update Fields :D
        public void setPlayer(Object po)
        {
            obj = po;
            BoogieCore.Log(LogType.System, "Player Class Initialized!");

            level        = po.Fields[(int)UpdateFields.UNIT_FIELD_LEVEL];
            exp          = po.Fields[(int)UpdateFields.PLAYER_XP];
            nextlevelexp = po.Fields[(int)UpdateFields.PLAYER_NEXT_LEVEL_XP];
            hp           = po.Fields[(int)UpdateFields.UNIT_FIELD_HEALTH];          // probably wrong?

            // Create contained Objects
            questLog  = new QuestLog(po);
            inventory = new Inventory(po);
            bank      = new Bank(po);
            equipped  = new Equipped(po);
            talents   = new Talents(po);
            buffs     = new Buffs(po);
            debuffs   = new Debuffs(po);

            inited = true;
        }
Esempio n. 11
0
        public bool Connect(IPEndPoint ep)
        {
            try
            {
                mSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.IP);

                mSocket.Connect(ep);

                ns   = new NetworkStream(mSocket, true);
                win  = new WoWReader(ns);
                wout = new WoWWriter(ns);

                BoogieCore.Log(LogType.System, "Connected successfully.");
                return(true);
            }
            catch (Exception ex)
            {
                BoogieCore.Log(LogType.System, "Failed to open connection to realm list server. Details below:\n{0}", ex.Message);
                return(false);
            }
        }
Esempio n. 12
0
        public bool Logon()
        {
            if (mSocket.Connected == false)
            {
                return(false);
            }

            BoogieCore.Log(LogType.System, "Login Challenge: Sending...");
            DoLogonChallenge();
            BoogieCore.Log(LogType.System, "Login Challenge: Waiting on response...");

            if (HandleLogonChallenge() == false)
            {
                BoogieCore.Log(LogType.System, "Login Challenge: Failed!");
                mSocket.Close();
                return(false);
            }

            BoogieCore.Log(LogType.System, "Login Challenge: Success!");
            BoogieCore.Log(LogType.System, "Login Proof: Sending...");
            DoLogonProof();
            BoogieCore.Log(LogType.System, "Login Proof: Waiting on response...");

            if (HandleLogonProof() == false)
            {
                BoogieCore.Log(LogType.System, "Login Proof: Authentication Failure.");
                mSocket.Close();
                return(false);
            }

            BoogieCore.Log(LogType.System, "Login Proof: Authentication Successful");
            BoogieCore.Log(LogType.System, "Sending RealmList Request...");
            SendRealmlistRequest();
            BoogieCore.Log(LogType.System, "Retrieving RealmList...");
            RetrieveRealmList();
            mSocket.Close();
            return(true);
        }
Esempio n. 13
0
        private void Handle_GameObjectQuery(WoWReader wr)
        {
            Entry entry = new Entry();

            entry.entry = wr.ReadUInt32();
            if (entry.entry < 1 || wr.Remaining < 4)
            {
                BoogieCore.Log(LogType.System, "Got {1} in GameObject query response for entryid or remaining in packet too small {0}", wr.Remaining, entry.entry);
                return;
            }

            entry.Type      = wr.ReadUInt32();
            entry.DisplayID = wr.ReadUInt32();
            entry.name      = wr.ReadString();

            BoogieCore.Log(LogType.NeworkComms, "Got GameObject Query Response - Entry: {0} - Name: {1} - Type {2}", entry.entry, entry.name, entry.Type);
            if (EntryList.ContainsKey(entry.entry) == false)
            {
                EntryList.Add(entry.entry, entry);
            }

            if (EntryQueue.ContainsKey(entry.entry))
            {
                EntryQueue.Remove(entry.entry);
            }

            foreach (Object obj in BoogieCore.world.getObjectList())
            {
                if (obj.Fields != null)
                {
                    if (obj.Fields[(int)UpdateFields.OBJECT_FIELD_ENTRY] == entry.entry)
                    {
                        obj.Type = (byte)entry.Type;
                        obj.Name = entry.name;
                    }
                }
            }
        }
Esempio n. 14
0
        public void Send(byte[] Data)
        {
#if (LOG)
            WoWReader wr   = new WoWReader(Data);
            UInt16    Op2  = wr.ReadUInt16();
            OpCode    Op   = (OpCode)Op2;
            int       left = wr.Remaining;

            tw.Write("{");
            tw.Write("CLIENT");
            tw.Write("}");
            tw.WriteLine(" Packet: (0x{2:x4}) {1} PacketSize = {0} TimeStamp = 0", Data.Length, Op, Op2);
            tw.WriteLine("|------------------------------------------------|----------------|");
            tw.WriteLine("|00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F |0123456789ABCDEF|");
            tw.WriteLine("|------------------------------------------------|----------------|");
            Debug.DumpBuffer(wr.ReadRemaining(), left, tw);
            tw.WriteLine("-------------------------------------------------------------------");
            tw.WriteLine();
            tw.Flush();
#endif
            int    Length = Data.Length;
            byte[] Packet = new byte[2 + Length];
            Packet[0] = (byte)(Length >> 8);
            Packet[1] = (byte)(Length & 0xff);
            Data.CopyTo(Packet, 2);
            mCrypt.Encrypt(Packet, mSendCryptSize);

            try
            {
                mSocket.Send(Packet);
            }
            catch (SocketException e)
            {
                BoogieCore.Log(LogType.Error, "Unable to send packet! Error: {0}", e.Message);
                isRunning = false;
            }
        }
Esempio n. 15
0
        private void Handle_MessageChat(WoWReader wr)
        {
            string  channel = null;
            UInt64  guid = 0;
            WoWGuid fguid = null, fguid2 = null;


            byte   Type     = wr.ReadByte();
            UInt32 Language = wr.ReadUInt32();

            fguid = new WoWGuid(wr.ReadUInt64());
            wr.ReadUInt32(); // rank?

            if ((ChatMsg)Type == ChatMsg.CHAT_MSG_CHANNEL)
            {
                channel = wr.ReadString();
                //pvp_rank = wr.ReadUInt32();
            }

            //if (Type == 0 || Type == 1 || Type == 5 || Type == 0x53)
            //{
            fguid2 = new WoWGuid(wr.ReadUInt64());

            //}

            UInt32 Length  = wr.ReadUInt32();
            string Message = wr.ReadString();
            byte   afk     = wr.ReadByte();


            string username = null;


            ChatQueue que = new ChatQueue();

            que.GUID     = fguid;
            que.Type     = Type;
            que.Language = Language;
            if ((ChatMsg)Type == ChatMsg.CHAT_MSG_CHANNEL)
            {
                que.Channel = channel;
            }
            que.Length  = Length;
            que.Message = Message;
            que.AFK     = afk;

            if (fguid.GetOldGuid() == 0)
            {
                username = "******";
            }
            else
            {
                username = BoogieCore.world.getObjectName(fguid);
            }

            if (username == null)
            {
                ChatQueued.Add(que);
                QueryName(guid);
                return;
            }
            ParseCommands(que, username);

            BoogieCore.Event(new Event(EventType.EVENT_CHAT, Time.GetTime(), que, username));
        }
Esempio n. 16
0
 /// <summary>Warps the player to the supplied coordinate.</summary>
 /// <param name="c">Coordinate to warp the player to.</param>
 public void warpPlayerTo(Coordinate c)
 {
     BoogieCore.Log(LogType.System, "World: Attemping to warp player to: {0}", c);
     BoogieCore.WorldServerClient.SendMoveHeartBeat(c);
 }
Esempio n. 17
0
 private void Handle_MailList(WoWReader wr)
 {
     BoogieCore.Log(LogType.NeworkComms, "WS: Recieved Mail List.. {0} bytes.", wr.Remaining);
     SMSG_Debug(wr);
 }
Esempio n. 18
0
 public void StartRunForward()
 {
     BoogieCore.Log(LogType.System, "Starting run forward!");
     BoogieCore.WorldServerClient.StartMoveForward();
 }
Esempio n. 19
0
 private void Handle_SpellLogExecute(WoWReader wr)
 {
     BoogieCore.Log(LogType.NeworkComms, "WS: Recieved Spell Log Execute..");
     SMSG_Debug(wr);
 }
Esempio n. 20
0
 private void Handle_LoginSetTimeSpeed(WoWReader wr)
 {
     BoogieCore.Log(LogType.NeworkComms, "WS: Recieved Login SetTimeSpeed (??)..");
     SMSG_Debug(wr);
 }
Esempio n. 21
0
 private void Handle_InitWorldStates(WoWReader wr)
 {
     BoogieCore.Log(LogType.NeworkComms, "WS: Recieved Init World States..");
     SMSG_Debug(wr);
 }
Esempio n. 22
0
        // Initialize the Core :D
        public static void InitCore(CallBackLog l, CallBackEvent e)
        {
            // Can't run this more than once
            if (inited)
            {
                return;
            }

            // We need to be able to Log stuff
            if (l == null)
            {
                return;
            }
            if (e == null)
            {
                return;
            }

            Log   = l;
            Event = e;

            Log(LogType.System, "BoogieBot.dll Initializing...");

            // Initialize everything
            try
            {
                if (!File.Exists(Environment.CurrentDirectory + "/" + BoogieCore.BoogieBotConfigFileName))
                {
                    throw new FileNotFoundException("Configuration file not found.", BoogieCore.BoogieBotConfigFileName);
                }

                configFile = new IniReader(Environment.CurrentDirectory + "/boogiebot.ini");

                // NOTE: Set any OS specific variables so things can be done differently later, ie. Windows or Linux, etc.
                OperatingSystem os = Environment.OSVersion;
                switch (os.Platform)
                {
                case PlatformID.Win32Windows:
                    Log(LogType.System, "> Operating System: Windows");
                    break;

                case PlatformID.Win32NT:
                    Log(LogType.System, "> Operating System: Windows NT");
                    break;

                case PlatformID.Unix:
                    Log(LogType.System, "> Operating System: Unix");
                    break;
                }
                Log(LogType.System, "> OS Version: {0}.{1}  (Build: {2})  ({3})", os.Version.Major, os.Version.Minor, os.Version.Build, os.ServicePack);

                // Find WoW's Folder
                wowPath = BoogieCore.getWowPath();
                Log(LogType.System, "> WowPath: {0}", wowPath);

                // Find WoW's Version
                wowVersion = BoogieCore.getWoWVersion();
                Log(LogType.System, "> WoW Version: World of Warcraft {0}.{1}.{2}.{3} ({4}) Found!  Emulating this version.", wowVersion.major, wowVersion.minor, wowVersion.update, wowVersion.build, BoogieCore.WowTypeString);


                world  = new World();
                player = new Player();

                //areaTable = new AreaTable();
                //mapTable = new MapTable();
            }
            catch (Exception ex)
            {
                // Bot Start up Failed. Log why, and rethrow the exception.
                Log(LogType.System, ex.Message);
                Log(LogType.System, ex.StackTrace);

                throw new Exception("BoogieBot.dll Init Failure.", ex);
            }

            inited = true;
            Log(LogType.System, "BoogieBot.dll Initialized.");
        }
Esempio n. 23
0
        private void Handle_AuthRequest(WoWReader wr)
        {
            BoogieCore.Log(LogType.System, "WS: Recieved Authentication Challenge: Sending out response");
            ServerSeed = wr.ReadUInt32();
            ClientSeed = (UInt32)random.Next();

            Sha1Hash sha = new Sha1Hash();

            sha.Update(mUsername);
            sha.Update(0); // t
            sha.Update(ClientSeed);
            sha.Update(ServerSeed);
            sha.Update(Key);
            byte[] Digest = sha.Final();

            WoWWriter ww = new WoWWriter(OpCode.CMSG_AUTH_SESSION);

            ww.Write(BoogieCore.configFile.ReadInteger("WoW", "Build"));
            ww.Write((UInt32)0);
            ww.Write(mUsername);
            ww.Write(ClientSeed);
            ww.Write(Digest);

            StreamReader SR;
            WoWWriter    buffer = new WoWWriter();

            SR = File.OpenText("Addons.txt");
            string Line = SR.ReadLine();

            while (Line != null)
            {
                string[] Fields   = new string[3];
                string   Name     = null;
                UInt64   Checksum = 0;
                byte     unk      = 0x0;

                Fields   = Line.Split(':');
                Name     = Fields[0];
                Checksum = UInt64.Parse(Fields[1]);
                //unk = (Fields[2].ToCharArray())[0];

                if (Name != null && Checksum > 0)
                {
                    buffer.Write(Name);
                    buffer.Write(Checksum);
                    buffer.Write(unk);

                    //BoogieCore.Log("Adding addon {0} with the checksum {1}", Name, Checksum);
                }

                Line = SR.ReadLine();
            }

            SR.Close();

            byte[] buffer2 = Foole.Utils.Compression.Compress(buffer.ToArray());
            UInt32 Size    = (UInt32)buffer.ToArray().Length;

            ww.Write(Size);
            ww.Write(buffer2);

            Send(ww);

            mCrypt.Init(Key);
        }
Esempio n. 24
0
        private void Handle_CharEnum(WoWReader wr)
        {
            BoogieCore.Log(LogType.NeworkComms, "WS: Recieved Character List..");
            byte count = wr.ReadByte();

            characterList = new Character[count];

            for (int i = 0; i < count; i++)
            {
                characterList[i].GUID        = wr.ReadUInt64();
                characterList[i].Name        = wr.ReadString();
                characterList[i].Race        = wr.ReadByte();
                characterList[i].Class       = wr.ReadByte();
                characterList[i].Gender      = wr.ReadByte();
                characterList[i].Skin        = wr.ReadByte();
                characterList[i].Face        = wr.ReadByte();
                characterList[i].HairStyle   = wr.ReadByte();
                characterList[i].HairColor   = wr.ReadByte();
                characterList[i].FacialHair  = wr.ReadByte();
                characterList[i].Level       = wr.ReadByte();
                characterList[i].ZoneID      = wr.ReadUInt32();
                characterList[i].MapID       = wr.ReadUInt32();
                characterList[i].X           = wr.ReadFloat();
                characterList[i].Y           = wr.ReadFloat();
                characterList[i].Z           = wr.ReadFloat();
                characterList[i].Guild       = wr.ReadUInt32();
                characterList[i].Unk         = wr.ReadUInt32();
                characterList[i].RestState   = wr.ReadByte();
                characterList[i].PetInfoID   = wr.ReadUInt32();
                characterList[i].PetLevel    = wr.ReadUInt32();
                characterList[i].PetFamilyID = wr.ReadUInt32();

                CharEquipment[] equip = new CharEquipment[20];

                for (int x = 0; x < 20; x++)
                {
                    equip[x].EntryID = wr.ReadUInt32();
                    equip[x].Type    = wr.ReadByte();
                    wr.ReadUInt32(); // enchant (2.4 patch)
                }

                characterList[i].Equipment = equip;
            }

            BoogieCore.Log(LogType.NeworkComms, "{0} characters in total.", characterList.Length);

            String defaultChar = BoogieCore.configFile.ReadString("Connection", "DefaultChar");

            if (defaultChar != "")
            {
                foreach (Character c in characterList)
                {
                    if (c.Name.ToLower() == defaultChar.ToLower())
                    {
                        BoogieCore.Log(LogType.System, "Defaulting to Character {0}", defaultChar);
                        BoogieCore.WorldServerClient.LoginChar(c.GUID);
                        return;
                    }
                }
            }

            if (count < 1)
            {
                string name = RandomString(6, false);
                BoogieCore.Log(LogType.System, "Auto-Generating Human Character with the name {0}", name);

                WoWWriter ww = new WoWWriter(OpCode.CMSG_CHAR_CREATE);
                ww.Write(name);
                ww.Write((byte)1); // race - human
                ww.Write((byte)1); // class - warrior
                ww.Write((byte)0); // gender - male
                ww.Write((byte)1); // skin
                ww.Write((byte)1); // face
                ww.Write((byte)1); // hair style
                ww.Write((byte)1); // hair color
                ww.Write((byte)1); // facial hair
                ww.Write((byte)1); // outfit id
                Send(ww.ToArray());
                ww = new WoWWriter(OpCode.CMSG_CHAR_ENUM);
                Send(ww.ToArray());
                return;
            }

            if (count == 1)
            {
                BoogieCore.Log(LogType.System, "Defaulting to Character {0}", characterList[0].Name);
                BoogieCore.WorldServerClient.LoginChar(characterList[0].GUID);
                return;
            }

            BoogieCore.Event(new Event(EventType.EVENT_CHAR_LIST, Time.GetTime(), characterList));
        }
Esempio n. 25
0
        private void Handle_ObjUpdate(WoWReader wr, bool Compressed)
        {
            if (Compressed)
            {
                Int32  size     = wr.ReadInt32();
                byte[] decomped = Foole.Utils.Compression.Decompress(size, wr.ReadRemaining());
                wr = new WoWReader(decomped);
            }

            WoWGuid guid;
            UInt32  blockCount;
            byte    unk1;
            byte    blockType;
            byte    objTypeId;

            blockCount = wr.ReadUInt32();
            unk1       = wr.ReadByte();

            BoogieCore.Log(LogType.Error, "Got obj update with {0} blocks", blockCount);
            for (UInt32 i = 0; i < blockCount; i++)
            {
                blockType = wr.ReadByte();
                #if (DEBUG)
                BoogieCore.Log(LogType.NeworkComms, "Block #{0}/{1} Type: {2}", i + 1, blockCount, blockType);
                #endif

                switch (blockType)
                {
                case 0:     // Fields update
                {
                    byte mask = wr.ReadByte();

                    if (mask == 0x00)
                    {
                        break;
                    }

                    guid = new WoWGuid(mask, wr.ReadBytes(WoWGuid.BitCount8(mask)));

                    UpdateMask UpdateMask = new UpdateMask();
                    byte       bc         = wr.ReadByte(); // Block Count

                    UpdateMask.SetCount((ushort)(bc * 32));
                    UpdateMask.SetMask(wr.ReadBytes(bc * 4), bc);
#if (DEBUG)
                    BoogieCore.Log(LogType.Error, "Field Update! FieldCount: {0}", UpdateMask.GetCount());
#endif
                    UInt32[] Fields = new UInt32[UpdateMask.GetCount()];

                    Object obj = BoogieCore.World.getObject(guid);

                    if (obj == null)
                    {
                        BoogieCore.Log(LogType.Error, "Object with the guid {0} not recognized in field update.", guid.GetOldGuid());
                    }

                    for (ushort x = 0; x < UpdateMask.GetCount(); x++)
                    {
                        if (UpdateMask.GetBit(x))
                        {
                            if (obj == null)         // FixMe
                            {
                                wr.ReadUInt32();
                            }
                            else
                            {
                                obj.Fields[x] = wr.ReadUInt32();
                            }
                        }
                    }

                    // Update Player Class if these are Player Fields being changed.
                    if (obj != null)
                    {
                        if (obj.GUID.GetOldGuid() == BoogieCore.Player.Character.GUID)
                        {
                            BoogieCore.Player.updatePlayer(obj);
                        }
                    }

                    break;
                }

                case 1:     // Movement Update
                {
                    byte mask = wr.ReadByte();

                    if (mask == 0x00)
                    {
                        break;
                    }

                    guid = new WoWGuid(mask, wr.ReadBytes(WoWGuid.BitCount8(mask)));
#if (DEBUG)
                    BoogieCore.Log(LogType.NeworkComms, "Got Movement update for GUID {0}", BitConverter.ToUInt64(guid.GetNewGuid(), 0));
#endif
                    UInt32 flags2 = 0, unk3;
                    float  posX = 0;
                    float  posY = 0;
                    float  posZ = 0;
                    float  facing = 0;
                    float  walkSpeed, runSpeed, backWalkSpeed, swimSpeed, backSwimSpeed, turnRate = 0;

                    byte flags = wr.ReadByte();

                    if ((flags & 0x20) >= 1)
                    {
                                #if (DEBUG)
                        BoogieCore.Log(LogType.NeworkComms, "(flags & 20)");
#endif
                        flags2 = wr.ReadUInt32();
                        wr.ReadByte();         // 2.3.3
                        unk3 = wr.ReadUInt32();
                    }

                    if ((flags & 0x40) >= 1)
                    {
                                #if (DEBUG)
                        BoogieCore.Log(LogType.NeworkComms, "(flags & 40)");
#endif
                        posX   = wr.ReadSingle();
                        posY   = wr.ReadSingle();
                        posZ   = wr.ReadSingle();
                        facing = wr.ReadSingle();
#if (DEBUG)
                        BoogieCore.Log(LogType.NeworkComms, "Position - X: {0} Y: {1} Z: {2} Orient: {3} ", posX, posY, posZ, facing);
#endif
                        if ((flags2 & 0x02000000) >= 1)         // player being transported
                        {
#if (DEBUG)
                            BoogieCore.Log(LogType.NeworkComms, "(flags2 & 0x02000000)");
#endif
                            wr.ReadUInt32();            //guidlow
                            wr.ReadUInt32();            //guidhigh
                            wr.ReadSingle();            //x
                            wr.ReadSingle();            //y
                            wr.ReadSingle();            //z
                            wr.ReadSingle();            //o
                            wr.ReadSingle();            // unk
                        }
                    }


                    if ((flags & 0x20) >= 1)
                    {
                                #if (DEBUG)
                        BoogieCore.Log(LogType.NeworkComms, "(flags & 20)");
#endif
                        wr.ReadSingle();         //unk
                        if ((flags2 & 0x2000) >= 1)
                        {
#if (DEBUG)
                            BoogieCore.Log(LogType.NeworkComms, "(flags & 2000)");
#endif
                            wr.ReadSingle();         // pos unk1
                            wr.ReadSingle();         // pos unk1
                            wr.ReadSingle();         // pos unk1
                            wr.ReadSingle();         // pos unk1
                            //BoogieCore.Log(LogType.NeworkComms, "Position 2 - X: {0} Y: {1} Z: {2} Orient: {3} ", punk1, punk2, punk3, punk1);
                        }
                    }

                    if ((flags & 0x20) >= 1)
                    {
                                #if (DEBUG)
                        BoogieCore.Log(LogType.NeworkComms, "(flags & 20)");
#endif
                        walkSpeed     = wr.ReadSingle();
                        runSpeed      = wr.ReadSingle();
                        backWalkSpeed = wr.ReadSingle();
                        swimSpeed     = wr.ReadSingle();
                        backSwimSpeed = wr.ReadSingle();
                        wr.ReadSingle();         //unk1
                        wr.ReadSingle();         //unk2
                        turnRate = wr.ReadSingle();
                        //BoogieCore.Log(LogType.NeworkComms, "Speed - (flags & 0x20)");
                    }

                    if ((flags & 0x20) >= 1)
                    {
                        //BoogieCore.Log(LogType.NeworkComms, "(flags & 0x20)");
                        if ((flags2 & 0x00400000) >= 1)
                        {
                            //BoogieCore.Log(LogType.NeworkComms, "(flags2 & 0x00400000)");
                            UInt32 splineFlags;

                            splineFlags = wr.ReadUInt32();

                            if ((splineFlags & 0x00010000) >= 1)
                            {
                                //BoogieCore.Log(LogType.NeworkComms, "(splineFlags & 0x00010000)");
                                posX = wr.ReadSingle();
                                posY = wr.ReadSingle();
                                posZ = wr.ReadSingle();
                                //BoogieCore.Log(LogType.NeworkComms, "Position 3 - X: {0} Y: {1} Z: {2} Orient: {3} ", posX, posY, posZ, facing);
                            }

                            if ((splineFlags & 0x00020000) >= 1)
                            {
                                //BoogieCore.Log(LogType.NeworkComms, "(splineFlags & 0x00020000)");
                                wr.ReadUInt64();
                            }

                            if ((splineFlags & 0x00040000) >= 1)
                            {
                                //BoogieCore.Log(LogType.NeworkComms, "(splineFlags & 0x00040000)");
                                float f;
                                f = wr.ReadSingle();
                            }

                            UInt32 time1, time2, splineCount, unk4;

                            //1.8
                            time1       = wr.ReadUInt32();
                            time2       = wr.ReadUInt32();
                            unk4        = wr.ReadUInt32();
                            splineCount = wr.ReadUInt32();
                            //BoogieCore.Log(LogType.NeworkComms, "splineCount = {0}", splineCount);

                            for (UInt32 j = 0; j < splineCount + 1; j++)
                            {
                                posX = wr.ReadSingle();
                                posY = wr.ReadSingle();
                                posZ = wr.ReadSingle();
                                //BoogieCore.Log(LogType.NeworkComms, "Position 4 - X: {0} Y: {1} Z: {2} Orient: {3} ", posX, posY, posZ, facing);
                            }
                        }
                    }

                    if ((flags & 0x8) >= 1)
                    {
                                #if (DEBUG)
                        BoogieCore.Log(LogType.NeworkComms, "(flags & 8)");
#endif
                        wr.ReadUInt32();
                        if ((flags & 0x10) >= 1)
                        {
#if (DEBUG)
                            BoogieCore.Log(LogType.NeworkComms, "(flags & 10)");
#endif
                            wr.ReadUInt32();
                        }
                    }
                    else if ((flags & 0x10) >= 1)
                    {
                                #if (DEBUG)
                        BoogieCore.Log(LogType.NeworkComms, "(flags & 10)");
#endif
                        wr.ReadUInt32();
                    }

                    if ((flags & 0x2) >= 1)
                    {
                                #if (DEBUG)
                        BoogieCore.Log(LogType.NeworkComms, "(flags & 0x2)");
#endif
                        wr.ReadUInt32();
                    }

                    break;
                }

                case 2:     // ObjCreate
                case 3:     // ObjCreate
                {
                    byte mask = wr.ReadByte();

                    guid      = new WoWGuid(mask, wr.ReadBytes(WoWGuid.BitCount8(mask)));
                    objTypeId = wr.ReadByte();
                            #if (DEBUG)
                    BoogieCore.Log(LogType.NeworkComms, "Got Object Create Mask: 0x{0:x2} GUID: {1} ObjTypeID: {2} ", mask, BitConverter.ToUInt64(guid.GetNewGuid(), 0), objTypeId);
#endif
                    UInt32 flags2 = 0, unk3;
                    float  posX = 0;
                    float  posY = 0;
                    float  posZ = 0;
                    float  facing = 0;
                    float  walkSpeed = 0, runSpeed = 0, backWalkSpeed = 0, swimSpeed = 0, backSwimSpeed = 0, turnRate = 0;

                    byte flags = wr.ReadByte();

                    if ((flags & 0x20) >= 1)
                    {
                        //BoogieCore.Log(LogType.NeworkComms, "(flags & 20)");
                        flags2 = wr.ReadUInt32();
                        wr.ReadByte();         // 2.3.3
                        unk3 = wr.ReadUInt32();
                    }

                    if ((flags & 0x40) >= 1)
                    {
                        //BoogieCore.Log(LogType.NeworkComms, "(flags & 40)");
                        posX   = wr.ReadSingle();
                        posY   = wr.ReadSingle();
                        posZ   = wr.ReadSingle();
                        facing = wr.ReadSingle();
                        //BoogieCore.Log(LogType.NeworkComms, "Position - X: {0} Y: {1} Z: {2} Orient: {3} ", posX, posY, posZ, facing);

                        if (((flags & 0x20) >= 1 && (flags2 & 0x0200) >= 1))            // player being transported
                        {
                            //BoogieCore.Log(LogType.NeworkComms, "(flags & 0x20 && flags2 & 0x0200)");
                            wr.ReadUInt32();            //guidlow
                            wr.ReadUInt32();            //guidhigh
                            wr.ReadSingle();            //x
                            wr.ReadSingle();            //y
                            wr.ReadSingle();            //z
                            wr.ReadSingle();            //o
                            wr.ReadSingle();            // unk
                        }
                    }


                    if ((flags & 0x20) >= 1)
                    {
                        //BoogieCore.Log(LogType.NeworkComms, "(flags & 20)");
                        wr.ReadSingle();         //unk
                        if ((flags2 & 0x2000) >= 1)
                        {
                            //BoogieCore.Log(LogType.NeworkComms, "(flags & 2000)");
                            wr.ReadSingle();         // pos unk1
                            wr.ReadSingle();         // pos unk1
                            wr.ReadSingle();         // pos unk1
                            wr.ReadSingle();         // pos unk1
                            //BoogieCore.Log(LogType.NeworkComms, "Position 2 - X: {0} Y: {1} Z: {2} Orient: {3} ", punk1, punk2, punk3, punk1);
                        }
                    }

                    if ((flags & 0x20) >= 1)
                    {
                        //BoogieCore.Log(LogType.NeworkComms, "(flags & 20)");
                        walkSpeed     = wr.ReadSingle();
                        runSpeed      = wr.ReadSingle();
                        backWalkSpeed = wr.ReadSingle();
                        swimSpeed     = wr.ReadSingle();
                        backSwimSpeed = wr.ReadSingle();
                        wr.ReadSingle();         //unk1
                        wr.ReadSingle();         //unk2
                        turnRate = wr.ReadSingle();
                        //BoogieCore.Log(LogType.NeworkComms, "Speed - (flags & 0x20)");
                    }

                    if ((flags & 0x20) >= 1)
                    {
                        //BoogieCore.Log(LogType.NeworkComms, "(flags & 0x20)");
                        if ((flags2 & 0x08000000) >= 1)
                        {
                            //BoogieCore.Log(LogType.NeworkComms, "(flags2 & 0x00400000)");
                            UInt32 splineFlags;

                            splineFlags = wr.ReadUInt32();

                            if ((splineFlags & 0x00010000) >= 1)
                            {
                                BoogieCore.Log(LogType.NeworkComms, "(splineFlags & 0x00010000)");
                                posX = wr.ReadSingle();
                                posY = wr.ReadSingle();
                                posZ = wr.ReadSingle();
                                BoogieCore.Log(LogType.NeworkComms, "Position 3 - X: {0} Y: {1} Z: {2} Orient: {3} ", posX, posY, posZ, facing);
                            }

                            if ((splineFlags & 0x00020000) >= 1)
                            {
                                BoogieCore.Log(LogType.NeworkComms, "(splineFlags & 0x00020000)");
                                wr.ReadUInt64();
                            }

                            if ((splineFlags & 0x00040000) >= 1)
                            {
                                BoogieCore.Log(LogType.NeworkComms, "(splineFlags & 0x00040000)");
                                float f;
                                f = wr.ReadSingle();
                            }

                            UInt32 time1, time2, splineCount, unk4;

                            //1.8
                            time1       = wr.ReadUInt32();
                            time2       = wr.ReadUInt32();
                            unk4        = wr.ReadUInt32();
                            splineCount = wr.ReadUInt32();
                            BoogieCore.Log(LogType.NeworkComms, "splineCount = {0}", splineCount);

                            for (UInt32 j = 0; j < splineCount + 1; j++)
                            {
                                posX = wr.ReadSingle();
                                posY = wr.ReadSingle();
                                posZ = wr.ReadSingle();
                                //BoogieCore.Log(LogType.NeworkComms, "Position 4 - X: {0} Y: {1} Z: {2} Orient: {3} ", posX, posY, posZ, facing);
                            }
                        }
                    }

                    if ((flags & 0x8) >= 1)
                    {
                        //BoogieCore.Log(LogType.NeworkComms, "(flags & 8)");
                        wr.ReadUInt32();
                        if ((flags & 0x10) >= 1)
                        {
                            //BoogieCore.Log(LogType.NeworkComms, "(flags & 10)");
                            wr.ReadUInt32();
                        }
                    }
                    else if ((flags & 0x10) >= 1)
                    {
                        //BoogieCore.Log(LogType.NeworkComms, "(flags & 10)");
                        wr.ReadUInt32();
                    }

                    if ((flags & 0x2) >= 1)
                    {
                        //BoogieCore.Log(LogType.NeworkComms, "(flags & 0x2)");
                        wr.ReadUInt32();
                    }

                    UpdateMask UpdateMask = new UpdateMask();

                    byte bc = wr.ReadByte();         // Block Count
                    //BoogieCore.Log(LogType.Error, "Block Count = {0}, Mask = {1}, flags = {2}, flags2 = {3}", bc * 32, mask, flags, flags2);


                    UpdateMask.SetCount((ushort)(bc * 32));
                    UpdateMask.SetMask(wr.ReadBytes(bc * 4), bc);

                    if (UpdateMask.GetCount() > 2500)
                    {
                        int count = UpdateMask.GetCount();
                        BoogieCore.Log(LogType.Error, "Bad mask count = {0} ! aborting parse", count);
                        return;
                    }

                    //BoogieCore.Log(LogType.NeworkComms, "(ObjCreate) FieldCount: {0}", UpdateMask.GetCount());
                    UInt32[] Fields = new UInt32[UpdateMask.GetCount()];

                    for (ushort x = 0; x < UpdateMask.GetCount(); x++)
                    {
                        if (UpdateMask.GetBit(x))
                        {
                            Fields[x] = wr.ReadUInt32();
                        }
                    }



                    if (!BoogieCore.world.objectExists(guid))           // Add new Object
                    {
                        UInt32 entryid = Fields[(int)UpdateFields.OBJECT_FIELD_ENTRY];
                        Object NewObj  = new Object();
                        NewObj.GUID          = guid;
                        NewObj.coord         = new Coordinate(posX, posY, posZ, facing);
                        NewObj.Type          = flags;
                        NewObj.Fields        = Fields;
                        NewObj.walkSpeed     = walkSpeed;
                        NewObj.runSpeed      = runSpeed;
                        NewObj.backWalkSpeed = backWalkSpeed;
                        NewObj.swimSpeed     = swimSpeed;
                        NewObj.backSwimSpeed = backSwimSpeed;
                        NewObj.turnRate      = turnRate;

                        BoogieCore.world.newObject(NewObj, false);
                        //MoveUpdateTimer.Enabled = true;

                        if (objTypeId == 4)
                        {
                            QueryName(guid);
                            BoogieCore.Log(LogType.NeworkComms, "Adding new Player {0}", BitConverter.ToUInt64(guid.GetNewGuid(), 0));
                        }
                        if (objTypeId == 3 || objTypeId == 5)
                        {
                            BoogieCore.Log(LogType.System, "Querying for name of object with an entry of {0} and type of {1}", entryid, objTypeId);
                            if (EntryList.ContainsKey(entryid) == false && EntryQueue.ContainsKey(entryid) == false)
                            {
                                EntryQueue.Add(entryid, true);
                                if (objTypeId == 3)
                                {
                                    WoWWriter wr2 = CreatureQuery(guid, entryid);
                                    Send(wr2.ToArray());
                                    BoogieCore.Log(LogType.NeworkComms, "Adding new Unit {0}", BitConverter.ToUInt64(guid.GetNewGuid(), 0));
                                }
                                if (objTypeId == 5)
                                {
                                    WoWWriter wr2 = GameObjectQuery(guid, entryid);
                                    Send(wr2.ToArray());
                                    BoogieCore.Log(LogType.NeworkComms, "Adding new GameObject {0}", BitConverter.ToUInt64(guid.GetNewGuid(), 0));
                                }
                            }
                        }
                    }
                    else            // Update Existing Object
                    {
                        Object updateObj = BoogieCore.world.getObject(guid);

                        updateObj.coord  = new Coordinate(posX, posY, posZ, facing);
                        updateObj.Type   = flags;
                        updateObj.Fields = Fields;
                        BoogieCore.world.updateObject(updateObj);
                    }
                    break;
                }

                case 4:     // Out Of Range update
                {
                    UInt32 count = wr.ReadUInt32();

                    for (UInt32 j = 0; j < count; j++)
                    {
                        byte mask = wr.ReadByte();

                        guid = new WoWGuid(mask, wr.ReadBytes(WoWGuid.BitCount8(mask)));

                        BoogieCore.world.delObject(guid);
                    }

                    break;
                }
                }
            }
        }
Esempio n. 26
0
        protected void processData(byte[] Data)
        {
            WoWReader wr = new WoWReader(Data);
            OpCode    Op = (OpCode)wr.ReadUInt16();

            BoogieCore.Log(LogType.NeworkComms, "Debugging packet for opcode: {0}", Op);
            SMSG_Debug(new WoWReader(Data));

            try
            {
                switch (Op)
                {
                case OpCode.SMSG_AUTH_CHALLENGE:
                    Handle_AuthRequest(wr);
                    break;

                case OpCode.SMSG_AUTH_RESPONSE:
                    Handle_AuthResponse(wr);
                    break;

                case OpCode.SMSG_CHAR_ENUM:
                    Handle_CharEnum(wr);
                    break;

                case OpCode.SMSG_WARDEN_DATA:
                    // Warden was figured out. but I won't give it out. GL
                    break;

                case OpCode.SMSG_ACCOUNT_DATA_MD5:
                    WoWWriter ww = new WoWWriter(OpCode.CMSG_UPDATE_ACCOUNT_DATA);
                    ww.Write(0x00000002);
                    ww.Write((UInt32)0);
                    Send(ww.ToArray());
                    break;

                case OpCode.SMSG_PONG:
                {
                    UInt32 Server_Seq = wr.ReadUInt32();
                    if (Server_Seq == Ping_Seq)
                    {
                        Ping_Res_Time = MM_GetTime();
                        Latency       = Ping_Res_Time - Ping_Req_Time;
                        Ping_Seq     += 1;
                        //BoogieCore.Log(LogType.NeworkComms, "Got pong'd with a latency of: {0} sequence: {1}", Latency, Server_Seq);
                    }
                    else
                    {
                        BoogieCore.Log(LogType.Error, "Server pong'd bad sequence! Ours: {0} Theirs: {1}", Ping_Seq, Server_Seq);
                    }
                    break;
                }

                case OpCode.SMSG_ITEM_QUERY_SINGLE_RESPONSE:
                    BoogieCore.Log(LogType.NeworkComms, "Got Item Response");
                    break;

                case OpCode.SMSG_SET_PROFICIENCY:
                    break;

                case OpCode.MSG_MOVE_HEARTBEAT:
                case OpCode.MSG_MOVE_START_TURN_RIGHT:
                case OpCode.MSG_MOVE_STOP:
                case OpCode.MSG_MOVE_START_TURN_LEFT:
                case OpCode.MSG_MOVE_START_FORWARD:
                case OpCode.MSG_MOVE_START_BACKWARD:
                case OpCode.MSG_MOVE_STOP_TURN:
                case OpCode.MSG_MOVE_START_STRAFE_LEFT:
                case OpCode.MSG_MOVE_START_STRAFE_RIGHT:
                case OpCode.MSG_MOVE_STOP_STRAFE:
                case OpCode.MSG_MOVE_FALL_LAND:
                case OpCode.MSG_MOVE_JUMP:
                case OpCode.MSG_MOVE_SET_FACING:
                    MovementHandler(wr);
                    break;

                case OpCode.SMSG_EMOTE:
                    break;

                case OpCode.SMSG_WEATHER:
                    break;

                case OpCode.MSG_MOVE_TELEPORT_ACK:
                    TeleportHandler(wr);
                    break;

                case OpCode.SMSG_NEW_WORLD:
                    Handle_NewWorld(wr);
                    break;

                case OpCode.SMSG_FORCE_MOVE_UNROOT:
                    SendMoveHeartBeat(BoogieCore.world.getPlayerObject().GetCoordinates());
                    break;

                case OpCode.SMSG_UPDATE_OBJECT:
                    Handle_ObjUpdate(wr, false);
                    break;

                case OpCode.SMSG_DESTROY_OBJECT:
                    Handle_ObjDestroy(wr);
                    break;

                case OpCode.SMSG_COMPRESSED_UPDATE_OBJECT:
                    Handle_ObjUpdate(wr, true);
                    break;

                case OpCode.SMSG_SPELL_START:
                    break;

                case OpCode.SMSG_SPELL_GO:
                    break;

                case OpCode.SMSG_CAST_RESULT:
                    break;

                case OpCode.SMSG_MESSAGECHAT:
                    Handle_MessageChat(wr);
                    break;

                case OpCode.SMSG_CHANNEL_NOTIFY:
                    break;

                case OpCode.SMSG_NAME_QUERY_RESPONSE:
                    Handle_NameQuery(wr);
                    break;

                case OpCode.SMSG_CREATURE_QUERY_RESPONSE:
                    Handle_CreatureQuery(wr);
                    break;

                case OpCode.SMSG_GAMEOBJECT_QUERY_RESPONSE:
                    SMSG_Debug(wr);
                    break;

                case OpCode.MSG_AUCTION_HELLO:
                    BoogieCore.Log(LogType.NeworkComms, "Got ah Hello!");
                    Query_AH(AHEntry);
                    break;

                case OpCode.SMSG_AUCTION_LIST_RESULT:
                    BoogieCore.Log(LogType.NeworkComms, "Got ah response!");
                    Query_AH(AHEntry);
                    break;

                case OpCode.SMSG_FRIEND_LIST:
                    Handle_FriendsList(wr);
                    break;

                case OpCode.SMSG_FRIEND_STATUS:
                    Handle_FriendStatus(wr);
                    break;

                //case OpCode.SMSG_IGNORE_LIST:
                //    Handle_IgnoreList(wr);
                //    break;
                case OpCode.SMSG_INIT_WORLD_STATES:
                    Handle_InitWorldStates(wr);
                    break;

                case OpCode.SMSG_INITIAL_SPELLS:
                    Handle_InitialSpells(wr);
                    break;

                case OpCode.SMSG_LEARNED_SPELL:
                    Handle_LearntSpell(wr);
                    break;

                case OpCode.SMSG_SUPERCEDED_SPELL:
                    Handle_SupercededSpell(wr);
                    break;

                case OpCode.SMSG_INITIALIZE_FACTIONS:
                    Handle_InitializeFactions(wr);
                    break;

                case OpCode.SMSG_LOGIN_SETTIMESPEED:
                    Handle_LoginSetTimeSpeed(wr);
                    break;

                case OpCode.SMSG_SPELLLOGEXECUTE:
                    Handle_SpellLogExecute(wr);
                    break;

                case OpCode.SMSG_MAIL_LIST_RESULT:
                    Handle_MailList(wr);
                    break;

                case OpCode.SMSG_SEND_MAIL_RESULT:
                    // We don't send mail (yet).
                    break;

                case OpCode.SMSG_RECEIVED_MAIL:
                    // You've got MAIL!
                    break;

                case OpCode.SMSG_LIST_INVENTORY:
                    Handle_VendorInventoryList(wr);
                    break;

                case OpCode.SMSG_ACTION_BUTTONS:
                    Handle_ActionButtons(wr);
                    break;

                case OpCode.SMSG_LEVELUP_INFO:
                    Handle_LevelUp(wr);
                    break;

                case OpCode.SMSG_LOG_XPGAIN:
                    Handle_XpGain(wr);
                    break;

                default:
                    BoogieCore.Log(LogType.NeworkComms, "Got unknown opcode: {0} length: {1}", Op, wr.Remaining);
                    break;
                }
            }
            catch (Exception ex)
            {
                BoogieCore.Log(LogType.Error, "Caught Exception while processing packet with opcode of {0}:  Exception is: {1}", Op, ex.Message);
                //BoogieCore.Log(LogType.Error, "{0}", ex.StackTrace);
            }
        }