Exemplo n.º 1
0
        private static void EquipmentUpdate(PacketReader p)
        {
            Serial serial = p.ReadUInt32();

            Item i = World.FindItem(serial);

            if (i == null)
            {
                World.AddItem(i = new Item(serial));
                Item.UpdateContainers();
            }

            if (World.Player != null && World.Player.Holding == i)
            {
                World.Player.Holding = null;
            }

            ushort iid = p.ReadUInt16();

            i.ItemID = (ushort)(iid + p.ReadSByte()); // signed, itemID offset
            i.Layer  = p.ReadByte();
            Serial ser = p.ReadUInt32();              // cont must be set after hue (for counters)

            i.Hue = p.ReadUInt16();

            i.Container = ser;
        }
Exemplo n.º 2
0
        private static void MobileUpdate(PacketReader p)
        {
            if (World.Player == null)
            {
                return;
            }

            Serial serial = p.ReadUInt32();
            Mobile m      = World.FindMobile(serial);

            if (m == null)
            {
                World.AddMobile(m = new Mobile(serial));
            }
            m.Body = (ushort)(p.ReadUInt16() + p.ReadSByte());
            m.Hue  = p.ReadUInt16();
            bool wasPoisoned = m.Poisoned;

            m.ProcessPacketFlags(p.ReadByte());

            ushort x = p.ReadUInt16();
            ushort y = p.ReadUInt16();

            p.ReadUInt16();             //always 0?
            m.Direction = (Direction)p.ReadByte();
            m.Position  = new Point3D(x, y, p.ReadSByte());

            Item.UpdateContainers();
        }
Exemplo n.º 3
0
        private static void ClearItems(string[] param)
        {
            Client.Instance.SendToClient(new UnicodeMessage(0xFFFFFFFF, -1, MessageType.Regular, 0x3B2, 3,
                                                            Language.CliLocName, "System", "Clearing all items from memory cache"));

            World.Items.Clear();
            Resync(param);

            Item.UpdateContainers();

            Client.Instance.SendToClient(new UnicodeMessage(0xFFFFFFFF, -1, MessageType.Regular, 0x3B2, 3,
                                                            Language.CliLocName, "System", "All items in memory cache have been cleared"));
        }
Exemplo n.º 4
0
        private static void WorldItem(PacketReader p)
        {
            Item item;
            uint serial = p.ReadUInt32();

            item = World.FindItem(serial & 0x7FFFFFFF);
            if (item == null)
            {
                World.AddItem(item = new Item(serial & 0x7FFFFFFF));
            }

            item.Container = null;
            if (World.Player.Holding == item)
            {
                World.Player.Holding = null;
            }

            ushort itemID = p.ReadUInt16();

            item.ItemID = (ushort)(itemID & 0x7FFF);

            if ((serial & 0x80000000) != 0)
            {
                item.Amount = p.ReadUInt16();
            }
            else
            {
                item.Amount = 0;
            }

            if ((itemID & 0x8000) != 0)
            {
                item.ItemID = (ushort)(item.ItemID + p.ReadSByte());
            }

            ushort x = p.ReadUInt16();
            ushort y = p.ReadUInt16();

            if ((x & 0x8000) != 0)
            {
                item.Direction = p.ReadByte();
            }
            else
            {
                item.Direction = 0;
            }

            short z = p.ReadSByte();

            item.Position = new Point3D(x & 0x3FFF, y & 0x3FFF, z);

            if ((y & 0x8000) != 0)
            {
                item.Hue = p.ReadUInt16();
            }
            else
            {
                item.Hue = 0;
            }

            byte flags = 0;

            if ((y & 0x4000) != 0)
            {
                flags = p.ReadByte();
            }

            item.ProcessPacketFlags(flags);

            Item.UpdateContainers();
        }
Exemplo n.º 5
0
        private static void MobileIncoming(PacketReader p)
        {
            Serial  serial   = p.ReadUInt32();
            ushort  body     = p.ReadUInt16();
            Point3D position = new Point3D(p.ReadUInt16(), p.ReadUInt16(), p.ReadSByte());

            if (Utility.Distance(World.Player.Position, position) > 18)
            {
                return;
            }

            Mobile m = World.FindMobile(serial);

            if (m == null)
            {
                World.AddMobile(m = new Mobile(serial));
            }

            bool wasHidden = !m.Visible;

            m.Body      = body;
            m.Position  = position;
            m.Direction = (Direction)p.ReadByte();
            m.Hue       = p.ReadUInt16();
            bool wasPoisoned = m.Poisoned;

            m.ProcessPacketFlags(p.ReadByte());
            byte oldNoto = m.Notoriety;

            m.Notoriety = p.ReadByte();

            while (true)
            {
                serial = p.ReadUInt32();
                if (!serial.IsItem)
                {
                    break;
                }

                Item item = World.FindItem(serial);
                if (item == null)
                {
                    World.AddItem(item = new Item(serial));
                }

                if (World.Player.Holding == item)
                {
                    World.Player.Holding = null;
                }

                ushort id = p.ReadUInt16();
                item.ItemID = (ushort)(id & 0x3FFF);
                item.Layer  = p.ReadByte();

                if ((id & 0x8000) != 0)
                {
                    item.Hue = p.ReadUInt16();
                }
                else
                {
                    item.Hue = 0;
                }

                item.Container = m;
            }
            Item.UpdateContainers();
        }