示例#1
0
文件: Player.cs 项目: uotools/razor-1
        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") && ClientCommunication.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);
        }