Example #1
0
        public Character(PacketReader reader)
        {
            GUID = reader.ReadUInt64();
            Name = reader.ReadCString();
            Race = reader.ReadByte();
            Class = reader.ReadByte();
            Gender = (Gender)reader.ReadByte();
            Bytes = reader.ReadBytes(5);
            Level = reader.ReadByte();
            ZoneId = reader.ReadUInt32();
            MapId = reader.ReadUInt32();
            X = reader.ReadSingle();
            Y = reader.ReadSingle();
            Z = reader.ReadSingle();
            GuildId = reader.ReadUInt32();
            Flags = reader.ReadUInt32();
            reader.ReadUInt32();
            reader.ReadByte();
            PetInfoId = reader.ReadUInt32();
            PetLevel = reader.ReadUInt32();
            PetFamilyId = reader.ReadUInt32();

            for (int i = 0; i < Items.Length - 1; ++i)
                Items[i] = new Item(reader);

            for (int i = 0; i < 4; ++i)
            {
                reader.ReadUInt32();
                reader.ReadByte();
                reader.ReadUInt32();
            }
        }
Example #2
0
 void HandleChannelList(PacketReader reader)
 {
     byte type = reader.ReadByte();
     string name = reader.ReadCString();
     ChannelFlags flags = (ChannelFlags)reader.ReadByte();
     UInt32 size = reader.ReadUInt32();
     for (UInt32 i = 0; i < size; i++)
     {
         reader.ReadUInt64();
         reader.ReadByte();
     }
 }
Example #3
0
        void HandleServerChatMessage(PacketReader reader)
        {
            ChatType type = (ChatType)reader.ReadByte();
            Language language;
            UInt64 targetGUID;
            UInt64 targetGUIDOther;
            UInt32 messageLength;
            string channelName = null;
            string message;

            if ((type != ChatType.CHAT_TYPE_CHANNEL && type != ChatType.CHAT_TYPE_WHISPER))
                language = (Language)reader.ReadUInt32();
            else
                language = (Language)reader.ReadUInt32();

            targetGUID = reader.ReadUInt64();
            reader.ReadUInt32();

            switch (type)
            {
                case ChatType.CHAT_TYPE_CHANNEL:
                    channelName = reader.ReadCString();
                    break;
            }

            targetGUIDOther = reader.ReadUInt64();
            messageLength = reader.ReadUInt32();
            message = reader.ReadCString();
            reader.ReadByte();

            PlayerName result = PlayerNameList.Find(
                delegate(PlayerName playerName)
                {
                    return playerName.GUID == targetGUID;
                });

            if (type == ChatType.CHAT_TYPE_SYSTEM)
            {
                foreach (string syntax in message.Split('\n'))
                    if (!CmdList.Contains(syntax)) // Prevent double message
                        CmdList.Add(syntax);
            }

            if (result != null)
            {
                QueryChatMessage.Type = type;
                QueryChatMessage.Message = message;
                QueryChatMessage.Name = result.Name;
                if (channelName != null)
                    QueryChatMessage.ChannelName = channelName;
                ReceiveMsg = QueryChatMessage;
            }
            else
            {
                QueryChatMessage.Type = type;
                QueryChatMessage.Message = message;
                if (channelName != null)
                    QueryChatMessage.ChannelName = channelName;
            }

            if (targetGUID > 0)
            {
                PacketWriter writer = new PacketWriter(Opcodes.CMSG_NAME_QUERY);
                writer.Write(targetGUID);
                Send(writer);
            }
        }