public void HandleCompressedObjectUpdate(PacketIn packet)
 {
     try
     {
         Int32 size = packet.ReadInt32();
         byte[] decomped = netLogic.Shared.Compression.Decompress(size, packet.ReadRemaining());
         packet = new PacketIn(decomped, 1);
         HandleObjectUpdate(packet);
     }
     catch(Exception ex)
     {
         Log.WriteLine(netLogic.Shared.LogType.Error, "{1} \n {0}", ex.StackTrace, ex.Message);
     }
 }
Esempio n. 2
0
        public void _ItemQuerySingleResponse(PacketIn packet)
        {
            UInt32 ItemID;
              //  UInt32 unk;
               // uint unk8;
              //  string s;

            ItemID = packet.ReadUInt32();

            if (!(ItemID == 0x80000000)) // invalid item flag?
            {
                ItemProto proto = new ItemProto();
                proto.Id = ItemID;
                proto.Class = packet.ReadUInt32();
                proto.SubClass = packet.ReadUInt32();
                packet.ReadUInt32();
                proto.Name = packet.ReadString();
                packet.ReadByte();
                packet.ReadByte();
                packet.ReadByte();
                proto.DisplayInfoID = packet.ReadUInt32();
                proto.Quality = packet.ReadUInt32();
                proto.Flags = packet.ReadUInt32();
                proto.Faction = packet.ReadUInt32();
                proto.BuyPrice = packet.ReadUInt32();
                proto.SellPrice = packet.ReadUInt32();
                proto.InventoryType = packet.ReadUInt32();
                proto.AllowableClass = packet.ReadUInt32();
                proto.AllowableRace = packet.ReadUInt32();
                proto.ItemLevel = packet.ReadUInt32();
                proto.RequiredLevel = packet.ReadUInt32();
                proto.RequiredSkill = packet.ReadUInt32();
                proto.RequiredSkillRank = packet.ReadUInt32();
                proto.RequiredSpell = packet.ReadUInt32();
                proto.RequiredHonorRank = packet.ReadUInt32();
                proto.RequiredCityRank = packet.ReadUInt32();
                proto.RequiredReputationFaction = packet.ReadUInt32();
                proto.RequiredReputationRank = packet.ReadUInt32();
                proto.MaxCount = packet.ReadUInt32();
                proto.Stackable = packet.ReadUInt32();
                proto.ContainerSlots = packet.ReadUInt32();
                proto.StatsCount = packet.ReadUInt32();
                for (UInt32 i = 0; i<proto.StatsCount; i++)
                {
                    proto.ItemStat = new _ItemStat[10];
                    proto.ItemStat[i].ItemStatType = packet.ReadUInt32();
                    proto.ItemStat[i].ItemStatValue = packet.ReadUInt32();
                }
                proto.ScalingStatDistribution = packet.ReadUInt32();
                proto.ScalingStatValue = packet.ReadUInt32();
                for (int i = 0; i < 2; i++)
                {
                    proto.Damage = new _ItemDamage[2];
                    proto.Damage[i].DamageMin = packet.ReadFloat();
                    proto.Damage[i].DamageMax = packet.ReadFloat();
                    proto.Damage[i].DamageType = packet.ReadUInt32();
                }
                proto.Armor = packet.ReadUInt32();
                proto.HolyRes = packet.ReadUInt32();
                proto.FireRes = packet.ReadUInt32();
                proto.NatureRes = packet.ReadUInt32();
                proto.FrostRes = packet.ReadUInt32();
                proto.ShadowRes = packet.ReadUInt32();
                proto.ArcaneRes = packet.ReadUInt32();
                proto.Delay = packet.ReadUInt32();
                proto.Ammo_type = packet.ReadUInt32();
                proto.RangedModRange = packet.ReadFloat();
                for (int i = 0; i < 5; i++)
                {
                    proto.Spells = new _ItemSpell[5];
                    proto.Spells[i].SpellId = packet.ReadUInt32();
                    proto.Spells[i].SpellTrigger = packet.ReadUInt32();
                    proto.Spells[i].SpellCharges = packet.ReadUInt32();
                    proto.Spells[i].SpellCooldown = packet.ReadUInt32();
                    proto.Spells[i].SpellCategory = packet.ReadUInt32();
                    proto.Spells[i].SpellCategoryCooldown = packet.ReadUInt32();
                }
                proto.Bonding = packet.ReadUInt32();
                proto.Description = packet.ReadString();
                proto.PageText = packet.ReadUInt32();
                proto.LanguageID = packet.ReadUInt32();
                proto.PageMaterial = packet.ReadUInt32();
                proto.StartQuest = packet.ReadUInt32();
                proto.LockID = packet.ReadUInt32();
                proto.Material = packet.ReadUInt32();
                proto.Sheath = packet.ReadUInt32();
                proto.RandomProperty = packet.ReadUInt32();
                proto.RandomSuffix = packet.ReadUInt32();
                proto.Block = packet.ReadUInt32();
                proto.ItemSet = packet.ReadUInt32();
                proto.MaxDurability = packet.ReadUInt32();
                proto.Area = packet.ReadUInt32();
                proto.Map = packet.ReadUInt32();
                proto.BagFamily = packet.ReadUInt32();
                proto.TotemCategory = packet.ReadUInt32();
                for (UInt32 i = 0; i < 3; i++)
                {
                    proto.Socket = new _ItemSocket[3];
                    proto.Socket[i].Color = packet.ReadUInt32();
                    proto.Socket[i].Content = packet.ReadUInt32();
                }
                proto.socketBonus = packet.ReadUInt32();
                proto.GemProperties = packet.ReadUInt32();
                proto.RequiredDisenchantSkill = packet.ReadUInt32();
                proto.ArmorDamageModifier = packet.ReadFloat();
                proto.Duration = packet.ReadInt32();
                proto.ItemLimitCategory = packet.ReadUInt32();
                proto.HolidayId = packet.ReadUInt32();

                //TODO
               /* objmgr.Add(proto);
                objmgr.AssignNameToObj(proto->Id, TYPEID_ITEM, proto->Name);
                objmgr.AssignNameToObj(proto->Id, TYPEID_CONTAINER, proto->Name);*/

            }
        }
Esempio n. 3
0
        public void HandleChat(PacketIn packet)
        {
            try
            {

                string channel = null;
                UInt64 guid = 0;
                GameGuid fguid = null, fguid2 = null;
                string username = null;

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

                guid = packet.ReadUInt64();
                fguid = new GameGuid(guid);
                packet.ReadInt32();

                if ((ChatMsg)Type == ChatMsg.CHAT_MSG_CHANNEL)
                {
                    channel = packet.ReadString();
                }

                if (Type == 47)
                    return;
                fguid2 = new GameGuid(packet.ReadUInt64());

                UInt32 Length = packet.ReadUInt32();
                string Message = Encoding.Default.GetString(packet.ReadBytes((int)Length));

                //Message = Regex.Replace(Message, @"\|H[a-zA-z0-9:].|h", ""); // Why do i should need spells and quest linked? ;>
                Message = Regex.Replace(Message, @"\|[rc]{1}[a-zA-z0-9]{0,8}", ""); // Colorfull chat message also isn't the most important thing.

                byte afk = 0;

                if (fguid.GetOldGuid() == 0)
                {
                    username = "******";
                }
                else
                {
                    //if (netLogicCore.ObjectMgr.objectExists(fguid))
                        //username = netLogicCore.ObjectMgr.GetObject(fguid).Name;
                }

                if (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;
                    ChatQueued.Add(que);
                    QueryName(guid);
                    return;
                }

                object[] param = new object[] { (ChatMsg)Type, channel, username, Message };
                netInstance.Event(new Event(EventType.EVENT_CHAT_MSG, "0", param));
                //Log.WriteLine(LogType.Chat, "[{1}] {0}", Message, username);
            }
            catch (Exception ex)
            {
                Log.WriteLine(LogType.Error, "Exception Occured");
                Log.WriteLine(LogType.Error, "Message: {0}", ex.Message);
                Log.WriteLine(LogType.Error, "Stacktrace: {0}", ex.StackTrace);
            }
        }