예제 #1
0
        public override void OnMapChange(byte old, byte cur)
        {
            List <Mobile> list = new List <Mobile>(World.Mobiles.Values);

            for (int i = 0; i < list.Count; i++)
            {
                Mobile m = list[i];
                if (m != this && m.Map != cur)
                {
                    m.Remove();
                }
            }

            list = null;

            World.Items.Clear();
            for (int i = 0; i < Contains.Count; i++)
            {
                Item item = (Item)Contains[i];
                World.AddItem(item);
                item.Contains.Clear();
            }

            if (Config.GetBool("AutoSearch") && Backpack != null)
            {
                PlayerData.DoubleClick(Backpack);
            }
        }
예제 #2
0
        public override void OnMapChange(byte old, byte cur)
        {
            ArrayList list = new ArrayList(World.Mobiles.Values);

            for (int i = 0; i < list.Count; i++)
            {
                Mobile m = (Mobile)list[i];
                if (m != this && m.Map != cur)
                {
                    m.Remove();
                }
            }

            World.Items.Clear();
            Counter.Reset();
            for (int i = 0; i < Contains.Count; i++)
            {
                Item item = (Item)Contains[i];
                World.AddItem(item);
                item.Contains.Clear();
            }

            if (Config.GetBool("AutoSearch") && Backpack != null)
            {
                PlayerData.DoubleClick(Backpack);
            }

            ClientCommunication.PostMapChange(cur);

            if (Engine.MainWindow != null && Engine.MainWindow.MapWindow != null)
            {
                Engine.MainWindow.MapWindow.PlayerMoved();
            }
        }
예제 #3
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;
        }
예제 #4
0
파일: Player.cs 프로젝트: uotools/razor-1
        public override void OnMapChange(byte old, byte cur)
        {
            ArrayList list = new ArrayList(World.Mobiles.Values);

            for (int i = 0; i < list.Count; i++)
            {
                Mobile m = (Mobile)list[i];
                if (m != this && m.Map != cur)
                {
                    m.Remove();
                }
            }

            World.Items.Clear();
            for (int i = 0; i < Contains.Count; i++)
            {
                Item item = (Item)Contains[i];
                World.AddItem(item);
                item.Contains.Clear();
            }
        }
예제 #5
0
        private static void LoadWorldState()
        {
            int end = m_GZIn.Compressed.ReadInt32();

            end += (int)m_GZIn.Position;

            try
            {
                World.AddMobile(World.Player = new PlayerData(m_GZIn.Compressed, m_Version));
                while (m_GZIn.Position < end)
                {
                    byte type = m_GZIn.Compressed.ReadByte();
                    if (type == 1)
                    {
                        World.AddMobile(new Mobile(m_GZIn.Compressed, m_Version));
                    }
                    else if (type == 0)
                    {
                        World.AddItem(new Item(m_GZIn.Compressed, m_Version));
                    }
                }
            }
            catch (Exception e)
            {
                new MessageDialog("Error Reading PacketVideo", true, e.ToString()).ShowDialog(Engine.ActiveWindow);
            }

            foreach (Mobile m in World.Mobiles.Values)
            {
                m.AfterLoad();
            }

            foreach (Item i in World.Items.Values)
            {
                i.AfterLoad();
            }
        }
예제 #6
0
파일: Player.cs 프로젝트: dissident76/Razor
        public override void OnMapChange(byte old, byte cur)
        {
            List <Mobile> list = new List <Mobile>(World.Mobiles.Values);

            for (int i = 0; i < list.Count; i++)
            {
                Mobile m = list[i];
                if (m != this && m.Map != cur)
                {
                    m.Remove();
                }
            }

            list = null;

            World.Items.Clear();
            Counter.Reset();
            for (int i = 0; i < Contains.Count; i++)
            {
                Item item = (Item)Contains[i];
                World.AddItem(item);
                item.Contains.Clear();
            }

            if (Config.GetBool("AutoSearch") && Backpack != null)
            {
                PlayerData.DoubleClick(Backpack);
            }

            UOAssist.PostMapChange(cur);

            if (Engine.MainWindow != null && Engine.MainWindow.MapWindow != null)
            {
                Engine.MainWindow.SafeAction(s => s.MapWindow.PlayerMoved());
            }
        }
예제 #7
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();
        }
예제 #8
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();
        }