예제 #1
0
        public static bool Equip(Item item, Layer layer)
        {
            if (layer == Layer.Invalid || layer > Layer.LastUserValid || item == null || item.Layer == Layer.Invalid || item.Layer > Layer.LastUserValid)
            {
                return(false);
            }

            if (item != null && World.Player != null && item.IsChildOf(World.Player.Backpack))
            {
                DragDropManager.DragDrop(item, World.Player, layer);
                return(true);
            }

            return(false);
        }
예제 #2
0
파일: Spells.cs 프로젝트: DarkLotus/Klip
        private void Cast()
        {
            if (Config.GetBool("SpellUnequip"))
            {
                Item pack = World.Player.Backpack;
                if (pack != null)
                {
                    // dont worry about uneqipping RuneBooks or SpellBooks
                    Item item = World.Player.GetItemOnLayer(Layer.RightHand);
#if DEBUG
                    if (item != null && item.ItemID != 0x22C5 && item.ItemID != 0xE3B && item.ItemID != 0xEFA &&
                        !item.IsVirtueShield)
#else
                    if (item != null && item.ItemID != 0x22C5 && item.ItemID != 0xE3B && item.ItemID != 0xEFA)
#endif
                    {
                        DragDropManager.Drag(item, item.Amount);
                        DragDropManager.Drop(item, pack);
                    }

                    item = World.Player.GetItemOnLayer(Layer.LeftHand);
#if DEBUG
                    if (item != null && item.ItemID != 0x22C5 && item.ItemID != 0xE3B && item.ItemID != 0xEFA &&
                        !item.IsVirtueShield)
#else
                    if (item != null && item.ItemID != 0x22C5 && item.ItemID != 0xE3B && item.ItemID != 0xEFA)
#endif
                    {
                        DragDropManager.Drag(item, item.Amount);
                        DragDropManager.Drop(item, pack);
                    }
                }
            }



            if (World.Player != null)
            {
                World.Player.LastSpell  = GetID();
                LastCastTime            = DateTime.UtcNow;
                Targeting.SpellTargetID = 0;
            }
        }
예제 #3
0
파일: Item.cs 프로젝트: Reetus/Razor-1
        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);
        }
예제 #4
0
파일: Item.cs 프로젝트: mozkandemir/RE
        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);
        }
예제 #5
0
        private void Cast()
        {
            if (RazorEnhanced.Settings.General.ReadBool("SpellUnequip"))
            {
                Item pack = World.Player.Backpack;
                if (pack != null)
                {
                    // dont worry about uneqipping RuneBooks or SpellBooks
                    Item item = World.Player.GetItemOnLayer(Layer.RightHand);
#if DEBUG
                    if (item != null && item.ItemID != 0x22C5 && item.ItemID != 0xE3B && item.ItemID != 0xEFA && !item.IsVirtueShield)
#else
                    if (item != null && item.ItemID != 0x22C5 && item.ItemID != 0xE3B && item.ItemID != 0xEFA)
#endif
                    {
                        DragDropManager.Drag(item, item.Amount);
                        DragDropManager.Drop(item, pack);
                    }

                    item = World.Player.GetItemOnLayer(Layer.LeftHand);
#if DEBUG
                    if (item != null && item.ItemID != 0x22C5 && item.ItemID != 0xE3B && item.ItemID != 0xEFA && !item.IsVirtueShield)
#else
                    if (item != null && item.ItemID != 0x22C5 && item.ItemID != 0xE3B && item.ItemID != 0xEFA)
#endif
                    {
                        DragDropManager.Drag(item, item.Amount);
                        DragDropManager.Drop(item, pack);
                    }
                }
            }

            Assistant.UOAssist.PostSpellCast(this.Number);

            if (World.Player != null)
            {
                World.Player.LastSpell  = GetID();
                LastCastTime            = DateTime.Now;
                Targeting.SpellTargetID = 0;
            }
        }
예제 #6
0
        public static bool Unequip(Layer layer)
        {
            if (layer == Layer.Invalid || layer > Layer.LastUserValid)
            {
                return(false);
            }

            Item item = World.Player.GetItemOnLayer(layer);

            if (item != null)
            {
                Item pack = DressList.FindUndressBag(item);
                if (pack != null)
                {
                    DragDropManager.DragDrop(item, pack);
                    return(true);
                }
            }

            return(false);
        }
예제 #7
0
        public void Dress()
        {
            if (World.Player == null)
            {
                return;
            }

            int         skipped = 0, gone = 0, done = 0;
            List <Item> list         = new List <Item>();
            bool        remConflicts = Config.GetBool("UndressConflicts");

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

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

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

                    // search to make sure they are not already wearing this...
                    item = World.Player.FindItemByID(id);
                    if (item != null)
                    {
                        skipped++;
                    }
                    else
                    {
                        item = World.Player.Backpack.FindItemByID(id);
                        if (item == null)
                        {
                            gone++;
                        }
                        else
                        {
                            list.Add(item);
                        }
                    }
                }
            }

            foreach (Item item in list)
            {
                if (item.Container == World.Player)
                {
                    skipped++;
                }
                else if (item.IsChildOf(World.Player.Backpack) || item.RootContainer == null)
                {
                    Layer layer = GetLayerFor(item);
                    if (layer == Layer.Invalid || layer > Layer.LastUserValid)
                    {
                        continue;
                    }

                    if (remConflicts)
                    {
                        Item conflict = World.Player.GetItemOnLayer(layer);
                        if (conflict != null)
                        {
                            DragDropManager.DragDrop(conflict, FindUndressBag(conflict));
                        }

                        // try to also undress conflicting hand(s)
                        if (layer == Layer.RightHand)
                        {
                            conflict = World.Player.GetItemOnLayer(Layer.LeftHand);
                        }
                        else if (layer == Layer.LeftHand)
                        {
                            conflict = World.Player.GetItemOnLayer(Layer.RightHand);
                        }
                        else
                        {
                            conflict = null;
                        }

                        if (conflict != null && (conflict.IsTwoHanded || item.IsTwoHanded))
                        {
                            DragDropManager.DragDrop(conflict, FindUndressBag(conflict));
                        }
                    }

                    DragDropManager.DragDrop(item, World.Player, layer);
                    done++;
                }
            }

            if (done > 0)
            {
                World.Player.SendMessage(LocString.DressQueued, done);
            }
            if (skipped > 0)
            {
                World.Player.SendMessage(LocString.AlreadyDressed, skipped);
            }
            if (gone > 0)
            {
                World.Player.SendMessage(LocString.ItemsNotFound, gone);
            }
        }
예제 #8
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 (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);
        }
예제 #9
0
            protected override void OnTick()
            {
                ArrayList requeue = null;

                m_LastTick = DateTime.UtcNow;

                if (m_Queue != null && m_Queue.Count > 0)
                {
                    this.Interval =
                        TimeSpan.FromMilliseconds(Config.GetBool("ObjectDelayEnabled")
                            ? Config.GetInt("ObjectDelay")
                            : 0);

                    //this.Interval = TimeSpan.FromMilliseconds( Config.GetInt( "ObjectDelay" ) );

                    while (m_Queue.Count > 0)
                    {
                        Serial s = (Serial)m_Queue.Peek();
                        if (s == Serial.Zero) // dragdrop action
                        {
                            DragDropManager.ProcStatus status = DragDropManager.ProcessNext(m_Queue.Count - 1);
                            if (status != DragDropManager.ProcStatus.KeepWaiting)
                            {
                                m_Queue.Dequeue(); // if not waiting then dequeue it

                                if (status == DragDropManager.ProcStatus.ReQueue)
                                {
                                    m_Queue.Enqueue(s);
                                }
                            }

                            if (status == DragDropManager.ProcStatus.KeepWaiting ||
                                status == DragDropManager.ProcStatus.Success)
                            {
                                break; // don't process more if we're waiting or we just processed something
                            }
                        }
                        else
                        {
                            m_Queue.Dequeue();
                            Client.Instance.SendToServer(new DoubleClick(s));
                            break;
                        }
                    }

                    if (requeue != null)
                    {
                        for (int i = 0; i < requeue.Count; i++)
                        {
                            m_Queue.Enqueue(requeue[i]);
                        }
                    }
                }
                else
                {
                    Stop();

                    if (m_Total > 1 && World.Player != null)
                    {
                        World.Player.SendMessage(LocString.QueueFinished, m_Total,
                                                 ((DateTime.UtcNow - m_StartTime) - this.Interval).TotalSeconds);
                    }

                    m_Last  = Serial.Zero;
                    m_Total = 0;
                }
            }
예제 #10
0
파일: Player.cs 프로젝트: dissident76/Razor
        public static bool DoubleClick(object clicked, bool silent)
        {
            Serial s;

            if (clicked is Mobile)
            {
                s = ((Mobile)clicked).Serial.Value;
            }
            else if (clicked is Item)
            {
                s = ((Item)clicked).Serial.Value;
            }
            else if (clicked is Serial)
            {
                s = ((Serial)clicked).Value;
            }
            else
            {
                s = Serial.Zero;
            }

            if (s != Serial.Zero)
            {
                Item free = null, pack = World.Player.Backpack;
                if (s.IsItem && pack != null && Config.GetBool("PotionEquip") &&
                    Client.Instance.AllowBit(FeatureBit.AutoPotionEquip))
                {
                    Item i = World.FindItem(s);
                    if (i != null && i.IsPotion && i.ItemID != 3853) // dont unequip for exploison potions
                    {
                        // dont worry about uneqipping RuneBooks or SpellBooks
                        Item left  = World.Player.GetItemOnLayer(Layer.LeftHand);
                        Item right = World.Player.GetItemOnLayer(Layer.RightHand);

                        if (left != null && (right != null || left.IsTwoHanded))
                        {
                            free = left;
                        }
                        else if (right != null && right.IsTwoHanded)
                        {
                            free = right;
                        }

                        if (free != null)
                        {
                            if (DragDropManager.HasDragFor(free.Serial))
                            {
                                free = null;
                            }
                            else
                            {
                                DragDropManager.DragDrop(free, pack);
                            }
                        }
                    }
                }

                ActionQueue.DoubleClick(silent, s);

                if (free != null)
                {
                    DragDropManager.DragDrop(free, World.Player, free.Layer, true);
                }

                if (s.IsItem)
                {
                    World.Player.m_LastObj = s;
                }
            }

            return(false);
        }
예제 #11
0
        private void Cast()
        {
            if (Config.GetBool("SpellUnequip") && ClientCommunication.AllowBit(FeatureBit.UnequipBeforeCast))
            {
                Item pack = World.Player.Backpack;
                if (pack != null)
                {
                    // dont worry about uneqipping RuneBooks or SpellBooks
                    Item item = World.Player.GetItemOnLayer(Layer.RightHand);
#if DEBUG
                    if (item != null && item.ItemID != 0x22C5 && item.ItemID != 0xE3B && item.ItemID != 0xEFA && !item.IsVirtueShield)
#else
                    if (item != null && item.ItemID != 0x22C5 && item.ItemID != 0xE3B && item.ItemID != 0xEFA)
#endif
                    {
                        DragDropManager.Drag(item, item.Amount);
                        DragDropManager.Drop(item, pack);
                    }

                    item = World.Player.GetItemOnLayer(Layer.LeftHand);
#if DEBUG
                    if (item != null && item.ItemID != 0x22C5 && item.ItemID != 0xE3B && item.ItemID != 0xEFA && !item.IsVirtueShield)
#else
                    if (item != null && item.ItemID != 0x22C5 && item.ItemID != 0xE3B && item.ItemID != 0xEFA)
#endif
                    {
                        DragDropManager.Drag(item, item.Amount);
                        DragDropManager.Drop(item, pack);
                    }
                }
            }

            for (int i = 0; i < Counter.List.Count; i++)
            {
                ((Counter)Counter.List[i]).Flag = false;
            }

            if (Config.GetBool("HighlightReagents"))
            {
                for (int r = 0; r < Reagents.Length; r++)
                {
                    for (int i = 0; i < Counter.List.Count; i++)
                    {
                        Counter c = (Counter)Counter.List[i];
                        if (c.Enabled && c.Format.ToLower() == Reagents[r])
                        {
                            c.Flag = true;
                            break;
                        }
                    }
                }

                if (m_UnflagTimer != null)
                {
                    m_UnflagTimer.Stop();
                }
                else
                {
                    m_UnflagTimer = new UnflagTimer();
                }
                m_UnflagTimer.Start();
            }

            ClientCommunication.RequestTitlebarUpdate();
            ClientCommunication.PostSpellCast(this.Number);

            if (World.Player != null)
            {
                World.Player.LastSpell  = GetID();
                LastCastTime            = DateTime.Now;
                Targeting.SpellTargetID = 0;
            }
        }
예제 #12
0
        internal static bool DoubleClick(object clicked, bool silent)
        {
            Serial s;

            if (clicked is Mobile)
            {
                s = ((Mobile)clicked).Serial.Value;
            }
            else if (clicked is Item)
            {
                s = ((Item)clicked).Serial.Value;
            }
            else if (clicked is Serial)
            {
                s = ((Serial)clicked).Value;
            }
            else
            {
                s = Serial.Zero;
            }

            if (s == Serial.Zero)
            {
                return(false);
            }

            Item free = null, pack = World.Player.Backpack;

            if (s.IsItem && pack != null && RazorEnhanced.Settings.General.ReadBool("PotionEquip"))
            {
                Item i = World.FindItem(s);
                if (i != null && i.IsPotion && i.ItemID != 3853) // dont unequip for exploison potions
                {
                    // dont worry about uneqipping RuneBooks or SpellBooks
                    Item left  = World.Player.GetItemOnLayer(Layer.LeftHand);
                    Item right = World.Player.GetItemOnLayer(Layer.RightHand);

                    if (left != null && (right != null || left.IsTwoHanded))
                    {
                        free = left;
                    }
                    else if (right != null && right.IsTwoHanded)
                    {
                        free = right;
                    }

                    if (free != null)
                    {
                        DragDropManager.DragDrop(free, pack);
                    }
                }
            }

            DragDropManager.DoubleClick(s);

            if (free != null)
            {
                DragDropManager.DragDrop(free, World.Player, free.Layer, true);
            }

            if (s.IsItem)
            {
                World.Player.m_LastObj = s;
            }

            return(false);
        }