Esempio n. 1
0
        public override void OnPositionChanging(Point3D oldPos)
        {
            if (!IsGhost)
            {
                StealthSteps.OnMove();
            }

            AutoOpenDoors(false);

            List <Mobile> mlist = new List <Mobile>(World.Mobiles.Values);

            for (int i = 0; i < mlist.Count; i++)
            {
                Mobile m = mlist[i];
                if (m != this)
                {
                    if (!Utility.InRange(m.Position, Position, VisRange))
                    {
                        m.Remove();
                    }
                    else
                    {
                        Targeting.CheckLastTargetRange(m);
                    }
                }
            }

            mlist = null;


            List <Item>    ilist = new List <Item>(World.Items.Values);
            ScavengerAgent s     = ScavengerAgent.Instance;

            for (int i = 0; i < ilist.Count; i++)
            {
                Item item = ilist[i];
                if (item.Deleted || item.Container != null)
                {
                    continue;
                }

                int dist = Utility.Distance(item.GetWorldPosition(), Position);
                if (item != DragDropManager.Holding && (dist > MultiVisRange || (!item.IsMulti && dist > VisRange)))
                {
                    item.Remove();
                }
                else if (!IsGhost && Visible && dist <= 2 && s.Enabled && item.Movable)
                {
                    s.Scavenge(item);
                }
            }

            ilist = null;

            if (Engine.MainWindow != null && Engine.MainWindow.MapWindow != null)
            {
                Engine.MainWindow.SafeAction(f => f.MapWindow.PlayerMoved());
            }

            base.OnPositionChanging(oldPos);
        }
Esempio n. 2
0
        public void Undress()
        {
            if (World.Player == null)
            {
                return;
            }

            int  count      = 0;
            Item undressBag = World.Player.Backpack;

            if (undressBag == null)
            {
                World.Player.SendMessage(LocString.NoBackpack);
                return;
            }

            if (Macros.MacroManager.AcceptActions)
            {
                Macros.MacroManager.Action(new Macros.UnDressAction(Name));
            }

            if (ScriptManager.Recording)
            {
                ScriptManager.AddToScript($"undress '{Name}'");
            }

            if (m_UndressBag.IsValid)
            {
                Item bag = World.FindItem(m_UndressBag);
                if (bag != null && (bag.RootContainer == World.Player ||
                                    (bag.RootContainer == null && Utility.InRange(bag.GetWorldPosition(),
                                                                                  World.Player.Position, 2))))
                {
                    undressBag = bag;
                }
                else
                {
                    World.Player.SendMessage(LocString.UndressBagRange);
                }
            }

            for (int i = 0; i < Items.Count; i++)
            {
                Item item = null;
                if (Items[i] is Serial)
                {
                    item = World.FindItem((Serial)Items[i]);
                }
                else if (Items[i] is ItemID)
                {
                    item = World.Player.FindItemByID((ItemID)Items[i]);
                }

                if (item == null || DragDropManager.CancelDragFor(item.Serial) || item.Container != World.Player)
                {
                    continue;
                }
                else
                {
                    DragDropManager.DragDrop(item, undressBag);
                    count++;
                }
            }

            World.Player.SendMessage(LocString.UndressQueued, count);
        }
Esempio n. 3
0
        internal void AutoStackResource()
        {
            if (!IsResource || !RazorEnhanced.Settings.General.ReadBool("AutoStack") || m_AutoStackCache.Contains(Serial))
            {
                return;
            }

            foreach (Item check in World.Items.Values)
            {
                if (check.Container == null && check.ItemID == ItemID && check.Hue == Hue && Utility.InRange(World.Player.Position, check.Position, 2))
                {
                    DragDropManager.DragDrop(this, check);
                    m_AutoStackCache.Add(Serial);
                    return;
                }
            }

            DragDropManager.DragDrop(this, World.Player.Position);
            m_AutoStackCache.Add(Serial);
        }
Esempio n. 4
0
        public static bool DoLastTarget()
        {
            TargetInfo targ;

            if (IsSmartTargetingEnabled())
            {
                if (m_AllowGround && m_LastGroundTarg != null)
                {
                    targ = m_LastGroundTarg;
                }
                else if (m_CurFlags == 1)
                {
                    targ = m_LastHarmTarg;
                }
                else if (m_CurFlags == 2)
                {
                    targ = m_LastBeneTarg;
                }
                else
                {
                    targ = m_LastTarget;
                }

                if (targ == null)
                {
                    targ = m_LastTarget;
                }
            }
            else
            {
                if (m_AllowGround && m_LastGroundTarg != null)
                {
                    targ = m_LastGroundTarg;
                }
                else
                {
                    targ = m_LastTarget;
                }
            }

            if (targ == null)
            {
                return(false);
            }

            Point3D pos = Point3D.Zero;

            if (targ.Serial.IsMobile)
            {
                Mobile m = World.FindMobile(targ.Serial);
                if (m != null)
                {
                    pos = m.Position;

                    targ.X = pos.X;
                    targ.Y = pos.Y;
                    targ.Z = pos.Z;
                }
                else
                {
                    pos = Point3D.Zero;
                }
            }
            else if (targ.Serial.IsItem)
            {
                Item i = World.FindItem(targ.Serial);
                if (i != null)
                {
                    pos = i.GetWorldPosition();

                    targ.X = i.Position.X;
                    targ.Y = i.Position.Y;
                    targ.Z = i.Position.Z;
                }
                else
                {
                    pos    = Point3D.Zero;
                    targ.X = targ.Y = targ.Z = 0;
                }
            }
            else
            {
                if (!m_AllowGround && (targ.Serial == Serial.Zero || targ.Serial >= 0x80000000))
                {
                    World.Player.SendMessage(MsgLevel.Warning, LocString.LTGround);
                    return(false);
                }
                else
                {
                    pos = new Point3D(targ.X, targ.Y, targ.Z);
                }
            }

            if (Config.GetBool("RangeCheckLT") && Client.Instance.AllowBit(FeatureBit.RangeCheckLT) &&
                (pos == Point3D.Zero || !Utility.InRange(World.Player.Position, pos, Config.GetInt("LTRange"))))
            {
                if (Config.GetBool("QueueTargets"))
                {
                    m_QueueTarget = LastTargetAction;
                }
                World.Player.SendMessage(MsgLevel.Warning, LocString.LTOutOfRange);
                return(false);
            }

            if (CheckHealPoisonTarg(m_CurrentID, targ.Serial))
            {
                return(false);
            }

            CancelClientTarget();
            m_HasTarget = false;

            targ.TargID = m_CurrentID;

            if (m_Intercept)
            {
                OneTimeResponse(targ);
            }
            else
            {
                Client.Instance.SendToServer(new TargetResponse(targ));
            }
            return(true);
        }
Esempio n. 5
0
        public void AutoStackResource()
        {
            if (!IsResource || !Config.GetBool("AutoStack") || m_AutoStackCache.Contains(Serial))
            {
                return;
            }

            foreach (Item check in World.Items.Values)
            {
                if (check.Container == null && check.ItemID == ItemID && check.Hue == Hue && Utility.InRange(World.Player.Position, check.Position, 2))
                {
                    DragDropManager.DragDrop(this, check);
                    m_AutoStackCache.Add(Serial);
                    return;
                }
            }

            DragDropManager.DragDrop(this, World.Player.Position);
            m_AutoStackCache.Add(Serial);
        }
Esempio n. 6
0
        public static Item FindUndressBag(Item item)
        {
            Item undressBag = World.Player.Backpack;

            for (int i = 0; i < m_List.Count; i++)
            {
                DressList list = (DressList)m_List[i];
                if (list != null && (list.Items.Contains(item.Serial) || list.Items.Contains(item.ItemID)))
                {
                    if (list.m_UndressBag.IsValid)
                    {
                        Item bag = World.FindItem(list.m_UndressBag);
                        if (bag != null && (bag.RootContainer == World.Player || (bag.RootContainer == null && Utility.InRange(bag.GetWorldPosition(), World.Player.Position, 2))))
                        {
                            undressBag = bag;
                        }
                    }
                    break;
                }
            }

            return(undressBag);
        }