Esempio n. 1
0
        public override void OnFilter(PacketReader p, PacketHandlerEventArgs args)
        {
            if (args.Block)
            {
                return;
            }

            // 0, 1, 2
            Serial      serial = p.ReadUInt32();            // 3, 4, 5, 6
            ushort      body   = p.ReadUInt16();            // 7, 8
            MessageType type   = (MessageType)p.ReadByte(); // 9

            if (type != m_Type)
            {
                return;
            }

            ushort hue  = p.ReadUInt16();            // 10, 11
            ushort font = p.ReadUInt16();
            string name = p.ReadStringSafe(30);
            string text = p.ReadStringSafe();

            for (int i = 0; i < m_Strings.Length; i++)
            {
                if (text.IndexOf(m_Strings[i]) != -1)
                {
                    args.Block = true;
                    return;
                }
            }
        }
Esempio n. 2
0
 private static void OnMove(PacketReader p, PacketHandlerEventArgs args)
 {
     if (playerMoved != null)
     {
         playerMoved();
     }
 }
Esempio n. 3
0
        private void OnSingleClick(PacketReader pvSrc, PacketHandlerEventArgs args)
        {
            Serial serial = pvSrc.ReadUInt32();

            for (int i = 0; i < m_Items.Count; i++)
            {
                Item item;
                if (m_Items[i] is Serial)
                {
                    item = World.FindItem((Serial)m_Items[i]);
                    if (item != null)
                    {
                        m_Items[i] = item;
                    }
                }

                item = m_Items[i] as Item;
                if (item == null)
                {
                    continue;
                }

                if (item.Serial == serial)
                {
                    Client.Instance.SendToClient(new UnicodeMessage(item.Serial, item.ItemID,
                                                                    Assistant.MessageType.Label, 0x3B2, 3, Language.CliLocName, "",
                                                                    Language.Format(LocString.UseOnceHBA1, i + 1)));
                    break;
                }
            }
        }
Esempio n. 4
0
 private static void OnRemoveObject(PacketReader p, PacketHandlerEventArgs args)
 {
     if (removeObject != null)
     {
         removeObject(p.ReadUInt32());
     }
 }
Esempio n. 5
0
        public override void OnFilter(PacketReader p, PacketHandlerEventArgs args)
        {
            if (args.Block)
            {
                return;
            }

            Serial      serial = p.ReadUInt32();
            ushort      body   = p.ReadUInt16();
            MessageType type   = (MessageType)p.ReadByte();
            ushort      hue    = p.ReadUInt16();
            ushort      font   = p.ReadUInt16();
            int         num    = p.ReadInt32();

            // paladin spells
            if (num >= 1060718 && num <= 1060727)
            {
                type = MessageType.Spell;
            }
            if (type != m_Type)
            {
                return;
            }

            for (int i = 0; i < m_Nums.Length; i++)
            {
                if (num == m_Nums[i])
                {
                    args.Block = true;
                    return;
                }
            }
        }
Esempio n. 6
0
 private static void OnMobileStatus(Packet p, PacketHandlerEventArgs args)
 {
     if (p.ReadUInt32() == World.Player.Serial && World.Player.IsGhost)
     {
         p.Seek(50, SeekOrigin.Begin);
         p.Write(World.Player.StamMax);
     }
 }
Esempio n. 7
0
 private static void EquipUpdate(Packet p, PacketHandlerEventArgs args)
 {
     p.Seek(8, SeekOrigin.Begin);
     if (p.ReadByte() == 0x1D)
     {
         Opened = true;
     }
 }
Esempio n. 8
0
 private static void OnCloseGump(PacketReader p, PacketHandlerEventArgs e)
 {
     p.MoveToData();
     if (p.ReadUInt16() == 4 && p.ReadUInt32() == gumpID)
     {
         responseID = 0;
     }
 }
Esempio n. 9
0
 public override void OnFilter(PacketReader p, PacketHandlerEventArgs args)
 {
     if (Client.Instance.AllowBit(FeatureBit.WeatherFilter))
     {
         args.Block = true;
         Client.Instance.ForceSendToClient(new SeasonChange(0, true));
     }
 }
Esempio n. 10
0
 private static void OnServerTarget(PacketReader p, PacketHandlerEventArgs args)
 {
     if (prevQueue != null)
     {
         Targeting.QueuedTarget = prevQueue;
         prevQueue = null;
     }
 }
Esempio n. 11
0
        private static void WorldItem(PacketReader p, PacketHandlerEventArgs args)
        {
            Item item = World.FindItem(p.ReadUInt32() & 0x7fffffff);

            if (item.ItemID == 0x2006 && item.DistanceTo(World.Player) < 3)
            {
                new SpeechAction(MessageType.Regular, World.Player.SpeechHue, 3, null, null, ".grab").Perform();
            }
        }
Esempio n. 12
0
 private static void OnGump(PacketReader p, PacketHandlerEventArgs args)
 {
     if (args.Block)
     {
         return;
     }
     p.ReadUInt32();
     Task.Factory.StartNew(CheckPosition, p.ReadUInt16());
 }
Esempio n. 13
0
        private void OnMapChange(Packet p, PacketHandlerEventArgs args)
        {
            ushort id = p.ReadUInt16();

            if (id == 8 || id == 6)
            {
                map.Redraw();
            }
        }
Esempio n. 14
0
        private static void WorldItem(PacketReader p, PacketHandlerEventArgs args)
        {
            Item item = World.FindItem(p.ReadUInt32() & 0x7FFFFFFF);

            if (item != null && item.DistanceTo(World.Player) < 3 && World.Player.GetItemOnLayer(Layer.Mount) == null && World.Player.IsPlayer())
            {
                DoIt(item);
            }
        }
Esempio n. 15
0
        private static void WorldItem(PacketReader p, PacketHandlerEventArgs args)
        {
            Item item = World.FindItem(p.ReadUInt32() & 0x7FFFFFFF);

            if (item != null && item.ItemID == 0x2006 && item.Hue >= 0x0530 && item.Hue <= 0x0539 && item.Amount == 0x0096 && item.DistanceTo(World.Player) < 3)
            {
                Carve(item);
            }
        }
Esempio n. 16
0
 private void OnPartySpeech(PacketReader p, PacketHandlerEventArgs args)
 {
     if (p.ReadInt16() == 6 && p.ReadByte() == 4)
     {
         Mobile mobile = World.FindMobile(p.ReadUInt32());
         string text   = p.ReadUnicodeStringSafe();
         textBox.AddLine(string.Format("[P] {0}: {1}", mobile == null || string.IsNullOrEmpty(mobile.Name) ? "Unknown" : mobile.GetName(), text), partyColor);
     }
 }
Esempio n. 17
0
        private static void ContainerContent(Packet p, PacketHandlerEventArgs args)
        {
            ushort count = p.ReadUInt16();

            for (; count > 0; count--)
            {
                ContainerContentUpdate(p, args);
                p.Seek(15, SeekOrigin.Current);
            }
        }
Esempio n. 18
0
 private static void OnDeath(PacketReader p, PacketHandlerEventArgs args)
 {
     if (p.ReadUInt32() == currentSerial && timer != null && timer.Running)
     {
         timer.Stop();
         OnTimer();
         args.Block = true;
         ClientCommunication.SendToClient(p);
     }
 }
Esempio n. 19
0
        private static void OnAttack(PacketReader p, PacketHandlerEventArgs args)
        {
            Mobile mobile = World.FindMobile(p.ReadUInt32());

            if (mobile != null && (FriendsAgent.IsFriend(mobile) || mobile.Notoriety == 1 || mobile.Notoriety == 2 || mobile.Renamable))
            {
                WorldEx.SendMessage("Attack blocked.");
                args.Block = true;
            }
        }
Esempio n. 20
0
        private static void NewTarget(PacketReader p, PacketHandlerEventArgs args)
        {
            AllowGround = p.ReadBoolean(); // allow ground
            CurrentID   = p.ReadUInt32();  // target uid
            CurFlags    = p.ReadByte();    // flags

            LastTarget.TargID = CurrentID;
            LastTarget.Flags  = CurFlags;
            HasTarget         = true;
        }
Esempio n. 21
0
 private static void OnSwing(PacketReader p, PacketHandlerEventArgs args)
 {
     p.ReadByte();
     if (p.ReadUInt32() == World.Player.Serial && timer == null)
     {
         currentSerial = p.ReadUInt32();
         currentDmg    = 0;
         timer         = Timer.DelayedCallback(TimeSpan.FromMilliseconds(250), OnTimer);
         timer.Start();
     }
 }
Esempio n. 22
0
 private static void OnDamage(PacketReader p, PacketHandlerEventArgs args)
 {
     if (p.ReadUInt32() == currentSerial && timer != null && timer.Running)
     {
         timer.Stop();
         currentDmg += p.ReadUInt16();
         args.Block  = true;
         timer.Delay = TimeSpan.FromMilliseconds(100);
         timer.Start();
     }
 }
Esempio n. 23
0
        private static void ContainerContentUpdate(Packet p, PacketHandlerEventArgs args)
        {
            Item   item = World.FindItem(p.ReadUInt32());
            ushort hue  = GetHue(item);

            if (hue != 0)
            {
                p.Seek(-2, SeekOrigin.End);
                p.Write(hue);
            }
        }
Esempio n. 24
0
 public override void OnFilter(PacketReader p, PacketHandlerEventArgs args)
 {
     if (Client.Instance.AllowBit(FeatureBit.LightFilter))
     {
         args.Block = true;
         if (World.Player != null)
         {
             World.Player.LocalLightLevel  = 0;
             World.Player.GlobalLightLevel = 0;
         }
     }
 }
Esempio n. 25
0
        private static void OnASCIIMessage(PacketReader p, PacketHandlerEventArgs args)
        {
            Serial serial  = p.ReadUInt32();
            ItemID graphic = p.ReadUInt16();
            byte   type    = p.ReadByte();
            ushort hue     = p.ReadUInt16();
            ushort font    = p.ReadUInt16();
            string name    = p.ReadStringSafe(30);
            string msg     = p.ReadStringSafe().Trim();

            Handle(asciiMessage, args, serial, graphic, type, hue, font, string.Empty, name, msg);
        }
Esempio n. 26
0
        private static void OnMessageLocalizedAffix(PacketReader p, PacketHandlerEventArgs args)
        {
            Serial serial  = p.ReadUInt32();
            ItemID graphic = p.ReadUInt16();
            byte   type    = p.ReadByte();
            ushort hue     = p.ReadUInt16();
            ushort font    = p.ReadUInt16();
            int    num     = p.ReadInt32();
            string name    = p.ReadStringSafe(30);

            Handle(localizedMessage, args, serial, graphic, type, hue, font, num, name, string.Empty);
        }
Esempio n. 27
0
        private static void OnCompressedGump(PacketReader p, PacketHandlerEventArgs e)
        {
            p.MoveToData();
            uint sender = p.ReadUInt32();
            uint id     = p.ReadUInt32();

            if (id == gumpID)
            {
                responseID = sender;
                e.Block    = enabled;
            }
        }
Esempio n. 28
0
 private static void OnTarget(PacketReader p, PacketHandlerEventArgs args)
 {
     if (door != null)
     {
         WorldEx.SendToServer(new TargetResponse(new TargetInfo {
             Serial = door.Serial, X = door.Position.X, Y = door.Position.Y, Z = door.Position.Z, Gfx = door.ItemID
         }));
         WorldEx.SendToServer(new DoubleClick(door.Serial));
         args.Block = true;
     }
     door = null;
 }
Esempio n. 29
0
        internal override void OnFilter(PacketReader p, PacketHandlerEventArgs args)
        {
            p.ReadByte();             // flags

            ushort sound = p.ReadUInt16();

            if (m_Sounds.Any(t => t == sound))
            {
                args.Block = true;
                return;
            }
        }
Esempio n. 30
0
 private static void OnMobileUpdate(Packet p, PacketHandlerEventArgs args)
 {
     if (p.ReadUInt32() == World.Player.Serial)
     {
         ushort body = p.ReadUInt16();
         if (body == 0x0192 || body == 0x0193 || body == 0x025F || body == 0x0260)
         {
             body -= 2;
         }
         p.Seek(-2, SeekOrigin.Current);
         p.Write(body);
     }
 }
Esempio n. 31
0
 public abstract void OnFilter( PacketReader p, PacketHandlerEventArgs args );