Exemplo n.º 1
0
        private void Handle_FriendStatus(WoWReader wr)
        {
            FriendsListItem friendStatus = new FriendsListItem();

            friendStatus.guid   = new WoWGuid(wr.ReadUInt64());
            friendStatus.online = wr.ReadBoolean();

            BoogieCore.Player.friendStatusUpdate(friendStatus);
        }
Exemplo n.º 2
0
        private void Handle_IgnoreList(WoWReader wr)
        {
            byte count = wr.ReadByte();

            IgnoreListItem[] ignoreList = new IgnoreListItem[count];

            for (int i = 0; i < count; i++)
            {
                ignoreList[i]      = new IgnoreListItem();
                ignoreList[i].guid = new WoWGuid(wr.ReadUInt64());
                QueryName(ignoreList[i].guid);
            }

            BoogieCore.Player.setIgnoreList(ignoreList);
        }
Exemplo n.º 3
0
        private void Handle_FriendsList(WoWReader wr)
        {
            byte count = wr.ReadByte();

            FriendsListItem[] friendsList = new FriendsListItem[count];

            for (int i = 0; i < count; i++)
            {
                friendsList[i]        = new FriendsListItem();
                friendsList[i].guid   = new WoWGuid(wr.ReadUInt64());
                friendsList[i].online = wr.ReadBoolean();
                QueryName(friendsList[i].guid);
            }

            BoogieCore.Player.setFriendList(friendsList);
        }
Exemplo n.º 4
0
        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));
        }
Exemplo n.º 5
0
        public MovementInfo(WoWReader wr)
        {
            transGuid = 0;
            flags     = wr.ReadUInt32();
            wr.ReadByte();
            time = wr.ReadUInt32();

            x           = wr.ReadFloat();
            y           = wr.ReadFloat();
            z           = wr.ReadFloat();
            orientation = wr.ReadFloat();

            if ((flags & 0x2000000) >= 1) // Transport
            {
                transGuid = wr.ReadUInt64();

                transX = wr.ReadFloat();
                transY = wr.ReadFloat();
                transZ = wr.ReadFloat();
                transO = wr.ReadFloat();
            }

            if ((flags & 0x200000) >= 1) // Swimming
            {
                unk6 = wr.ReadFloat();
            }

            if ((flags & 0x2000) >= 1) // Falling
            {
                FallTime = wr.ReadUInt32();
                unk8     = wr.ReadUInt32();
                unk9     = wr.ReadUInt32();
                unk10    = wr.ReadUInt32();
            }

            if ((flags & 0x4000000) >= 1)
            {
                unk12 = wr.ReadUInt32();
            }

            //if (wr.Remaining >= 4) unklast = wr.ReadUInt32();
        }
Exemplo n.º 6
0
        //private void GetTile(float x, float y)
        //{
        //    float X, Y;
        //    X = (x + (32.0f * 533.33333f));
        //    Y = (y + (32.0f * 533.33333f));
        //    int gx = (int)((x + (32.0f * 533.33333f)) / 533.33333f);
        //    int gy = (int)(Y / 533.33333f);
        //}

        private void Handle_ObjDestroy(WoWReader wr)
        {
            WoWGuid guid = new WoWGuid(wr.ReadUInt64());

            BoogieCore.world.delObject(guid);
        }
Exemplo n.º 7
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));
        }
Exemplo n.º 8
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));
        }