Exemple #1
0
        public override void Update(double totalMS, double frameMS)
        {
            if (loginScene.UpdateScreen)
            {
                RemoveChildren(currentStepGump);
                AddChildren(currentStepGump = GetGumpForStep(loginScene.CurrentLoginStep));
                loginScene.UpdateScreen     = false;
            }

            base.Update(totalMS, frameMS);
        }
Exemple #2
0
        private void HandleMouseActions()
        {
            SelectedObject = null;

            if (IsHoldingItem)
            {
                if (IsMouseOverUI && InputManager.HandleMouseEvent(MouseEvent.Up, MouseButton.Left))
                {
                    GumpControl target = UIManager.MouseOverControl;

                    if (target is ItemGumpling gumpling && !(target is ItemGumplingPaperdoll))
                    {
                        Item item = gumpling.Item;
                        SelectedObject = item;

                        if (TileData.IsContainer((long)item.ItemData.Flags))
                        {
                            DropHeldItemToContainer(item);
                        }
                        else if (HeldItem.Graphic == item.Graphic && TileData.IsStackable((long)HeldItem.ItemData.Flags))
                        {
                            MergeHeldItem(item);
                        }
                        else
                        {
                            if (item.Container.IsItem)
                            {
                                DropHeldItemToContainer(World.Items.Get(item.Container), (ushort)(target.X + (InputManager.MousePosition.X - target.ScreenCoordinateX) - _heldOffset.X), (ushort)(target.Y + (InputManager.MousePosition.Y - target.ScreenCoordinateY) - _heldOffset.Y));
                            }
                        }
                    }
                    else if (target is GumpPicContainer container)
                    {
                        SelectedObject = container.Item;
                        int x = InputManager.MousePosition.X - _heldOffset.X - (target.X + target.Parent.X);
                        int y = InputManager.MousePosition.Y - _heldOffset.Y - (target.Y + target.Parent.Y);
                        DropHeldItemToContainer(container.Item, (ushort)x, (ushort)y);
                    }
                    else if (target is ItemGumplingPaperdoll || target is GumpPic pic && pic.IsPaperdoll || target is EquipmentSlot)
                    {
                        if (TileData.IsWearable((long)HeldItem.ItemData.Flags))
                        {
                            WearHeldItem();
                        }
                    }
                    else if (target is GumpPicBackpack backpack)
                    {
                        DropHeldItemToContainer(backpack.BackpackItem);
                    }
                }
Exemple #3
0
        public LoginGump() : base(0, 0)
        {
            loginScene             = Service.Get <LoginScene>();
            CanCloseWithRightClick = false;

            // Background
            AddChildren(new GumpPicTiled(0, 0, 640, 480, 0x0E14));
            // Border
            AddChildren(new GumpPic(0, 0, 0x157C, 0));
            AddChildren(currentStepGump = GetGumpForStep(loginScene.CurrentLoginStep));

            // UO Flag
            AddChildren(new GumpPic(0, 4, 0x15A0, 0));

            // Quit Button
            AddChildren(new Button(0, 0x1589, 0x158B, 0x158A)
            {
                X = 555, Y = 4, ButtonAction = ButtonAction.Activate
            });
        }
Exemple #4
0
        private void SearchId(object sender, EventArgs e)
        {
            if (!Utils.ConvertStringToInt(textBoxGraphic.Text, out int graphic, 0, Ultima.Art.GetMaxItemID()))
            {
                return;
            }

            if (GumpControl.Search(graphic))
            {
                return;
            }

            DialogResult result = MessageBox.Show("No used index found", "Result", MessageBoxButtons.OKCancel,
                                                  MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);

            if (result == DialogResult.Cancel)
            {
                Close();
            }
        }
Exemple #5
0
        public UIManager()
        {
            GameCursor   = new GameCursor(this);
            _sbUI        = Service.Get <SpriteBatchUI>();
            InputManager = Service.Get <InputManager>();

            InputManager.MouseDragging += (sender, e) =>
            {
                if (_isDraggingControl)
                {
                    DoDragControl(Mouse.Position);
                }
            };

            InputManager.LeftMouseButtonDown += (sender, e) =>
            {
                if (!IsModalControlOpen && ObjectsBlockingInputExists)
                {
                    return;
                }

                if (MouseOverControl != null)
                {
                    MakeTopMostGump(MouseOverControl);
                    MouseOverControl.InvokeMouseDown(Mouse.Position, MouseButton.Left);

                    if (MouseOverControl.AcceptKeyboardInput)
                    {
                        _keyboardFocusControl = MouseOverControl;
                    }
                    _mouseDownControls[(int)MouseButton.Left] = MouseOverControl;
                }
                else
                {
                    if (IsModalControlOpen)
                    {
                        _gumps.ForEach(s =>
                        {
                            if (s.ControlInfo.IsModal && s.ControlInfo.ModalClickOutsideAreaClosesThisControl)
                            {
                                s.Dispose();
                            }
                        });
                    }
                }
            };

            InputManager.LeftMouseButtonUp += (sender, e) =>
            {
                if (!IsModalControlOpen && ObjectsBlockingInputExists)
                {
                    return;
                }

                //if (MouseOverControl == null)
                //    return;
                const int btn = (int)MouseButton.Left;
                EndDragControl(Mouse.Position);

                if (MouseOverControl != null)
                {
                    if (_mouseDownControls[btn] != null && MouseOverControl == _mouseDownControls[btn])
                    {
                        MouseOverControl.InvokeMouseClick(Mouse.Position, MouseButton.Left);
                    }
                    MouseOverControl.InvokeMouseUp(Mouse.Position, MouseButton.Left);

                    if (_mouseDownControls[btn] != null && MouseOverControl != _mouseDownControls[btn])
                    {
                        _mouseDownControls[btn].InvokeMouseUp(Mouse.Position, MouseButton.Left);
                    }
                }
                else
                {
                    _mouseDownControls[btn]?.InvokeMouseUp(Mouse.Position, MouseButton.Left);
                }

                _mouseDownControls[btn] = null;
            };

            InputManager.LeftMouseDoubleClick += () =>
            {
                if (!IsModalControlOpen && ObjectsBlockingInputExists)
                {
                    return(false);
                }
                if (MouseOverControl != null && IsMouseOverUI)
                {
                    return(MouseOverControl.InvokeMouseDoubleClick(Mouse.Position, MouseButton.Left));
                }

                return(false);
            };

            InputManager.RightMouseButtonDown += (sender, e) =>
            {
                if (!IsModalControlOpen && ObjectsBlockingInputExists)
                {
                    return;
                }

                if (MouseOverControl != null)
                {
                    MakeTopMostGump(MouseOverControl);
                    MouseOverControl.InvokeMouseDown(Mouse.Position, MouseButton.Right);

                    if (MouseOverControl.AcceptKeyboardInput)
                    {
                        _keyboardFocusControl = MouseOverControl;
                    }
                    _mouseDownControls[(int)MouseButton.Right] = MouseOverControl;
                }
                else
                {
                    if (IsModalControlOpen)
                    {
                        _gumps.ForEach(s =>
                        {
                            if (s.ControlInfo.IsModal && s.ControlInfo.ModalClickOutsideAreaClosesThisControl)
                            {
                                s.Dispose();
                            }
                        });
                    }
                }
            };

            InputManager.RightMouseButtonUp += (sender, e) =>
            {
                if (!IsModalControlOpen && ObjectsBlockingInputExists)
                {
                    return;
                }

                //if (MouseOverControl == null)
                //    return;
                const int btn = (int)MouseButton.Right;
                EndDragControl(Mouse.Position);

                if (MouseOverControl != null)
                {
                    if (_mouseDownControls[btn] != null && MouseOverControl == _mouseDownControls[btn])
                    {
                        MouseOverControl.InvokeMouseClick(Mouse.Position, MouseButton.Right);
                    }
                    MouseOverControl.InvokeMouseUp(Mouse.Position, MouseButton.Right);

                    if (_mouseDownControls[btn] != null && MouseOverControl != _mouseDownControls[btn])
                    {
                        _mouseDownControls[btn].InvokeMouseUp(Mouse.Position, MouseButton.Right);
                    }
                }
                else
                {
                    _mouseDownControls[btn]?.InvokeMouseUp(Mouse.Position, MouseButton.Right);
                }

                _mouseDownControls[btn] = null;
            };

            InputManager.MouseWheel += (sender, isup) =>
            {
                if (!IsModalControlOpen && ObjectsBlockingInputExists)
                {
                    return;
                }

                if (MouseOverControl != null && MouseOverControl.AcceptMouseInput)
                {
                    MouseOverControl.InvokeMouseWheel(isup ? MouseEvent.WheelScrollUp : MouseEvent.WheelScrollDown);
                }
            };
            InputManager.KeyDown   += (sender, e) => { _keyboardFocusControl?.InvokeKeyDown(e.keysym.sym, e.keysym.mod); };
            InputManager.KeyUp     += (sender, e) => { _keyboardFocusControl?.InvokeKeyUp(e.keysym.sym, e.keysym.mod); };
            InputManager.TextInput += (sender, e) => { _keyboardFocusControl?.InvokeTextInput(e); };
        }
Exemple #6
0
        private void CreateSpellDetailsPage(int page, bool isright, int circle, SpellDefinition spell)
        {
            if (_spellBookType == SpellBookType.Magery)
            {
                AddChildren(new Label(SpellsMagery.CircleNames[circle], false, 0x0288, font: 6)
                {
                    X = isright ? 64 + 162 : 85, Y = 10
                }, page);
            }

            GumpPic spellImage = new GumpPic(isright ? 225 : 62, 40, (Graphic)(spell.GumpIconID - 0x1298), 0)
            {
                LocalSerial = (uint)(Graphic)(spell.GumpIconID - 0x1298), Tag = spell.ID
            };

            spellImage.DragBegin += (sender, e) =>
            {
                GumpControl     ctrl = (GumpControl)sender;
                SpellDefinition def  = SpellsMagery.GetSpell((int)ctrl.Tag);

                UseSpellButtonGump gump = new UseSpellButtonGump(def)
                {
                    X = Mouse.Position.X - 22, Y = Mouse.Position.Y - 22
                };
                UIManager.Add(gump);
                UIManager.AttemptDragControl(gump, Mouse.Position, true);
            };
            AddChildren(spellImage, page);

            Label spellnameLabel = new Label(spell.Name, false, 0x0288, 80, 6)
            {
                X = isright ? 275 : 112, Y = 34
            };

            AddChildren(spellnameLabel, page);

            if (spell.Regs.Length > 0)
            {
                AddChildren(new GumpPicTiled(isright ? 225 : 62, 88, 120, 4, 0x0835), page);

                AddChildren(new Label("Reagents:", false, 0x0288, font: 6)
                {
                    X = isright ? 225 : 62, Y = 92
                }, page);
                string reagList = spell.CreateReagentListString(",\n");

                if (_spellBookType == SpellBookType.Magery)
                {
                    int y = spellnameLabel.Height < 24 ? 31 : 24;
                    y += spellnameLabel.Height;

                    AddChildren(new Label(SpellsMagery.SpecialReagentsChars[spell.ID - 1][1], false, 0x0288, font: 8)
                    {
                        X = isright ? 275 : 112, Y = y
                    }, page);
                }

                AddChildren(new Label(reagList, false, 0x0288, font: 9)
                {
                    X = isright ? 225 : 62, Y = 114
                }, page);
            }
        }
Exemple #7
0
        private void CreateBook()
        {
            Clear();
            _pageCornerLeft = _pageCornerRight = null;
            GetBookInfo(_spellBookType, out Graphic bookGraphic, out Graphic minimizedGraphic, out Graphic iconStartGraphic, out int maxSpellsCount, out int spellIndexOffset, out int spellsOnPage, out int dictionaryPagesCount);
            AddChildren(new GumpPic(0, 0, bookGraphic, 0));
            AddChildren(_pageCornerLeft        = new GumpPic(50, 8, 0x08BB, 0));
            _pageCornerLeft.LocalSerial        = 0;
            _pageCornerLeft.Page               = int.MaxValue;
            _pageCornerLeft.MouseClick        += PageCornerOnMouseClick;
            _pageCornerLeft.MouseDoubleClick  += PageCornerOnMouseDoubleClick;
            AddChildren(_pageCornerRight       = new GumpPic(321, 8, 0x08BC, 0));
            _pageCornerRight.LocalSerial       = 1;
            _pageCornerRight.Page              = 1;
            _pageCornerRight.MouseClick       += PageCornerOnMouseClick;
            _pageCornerRight.MouseDoubleClick += PageCornerOnMouseDoubleClick;
            int totalSpells = 0;

            for (int circle = 0; circle < 8; circle++)
            {
                for (int i = 1; i <= 8; i++)
                {
                    if (_spellBook.HasSpell(circle, i))
                    {
                        _spells[circle * 8 + i - 1] = 1;
                        totalSpells++;
                    }
                }
            }

            _maxPage = (dictionaryPagesCount >> 1) + ((totalSpells + 1) >> 1);
            int  offs            = 0;
            bool isMageSpellbook = false;

            if (_spellBookType == SpellBookType.Magery)
            {
                isMageSpellbook = true;

                AddChildren(new Button((int)ButtonCircle.Circle_1_2, 0x08B1, 0x08B1)
                {
                    X = 58, Y = 175, ButtonAction = ButtonAction.Activate, ToPage = 1
                });

                AddChildren(new Button((int)ButtonCircle.Circle_1_2, 0x08B2, 0x08B2)
                {
                    X = 93, Y = 175, ButtonAction = ButtonAction.Activate, ToPage = 1
                });

                AddChildren(new Button((int)ButtonCircle.Circle_3_4, 0x08B3, 0x08B3)
                {
                    X = 130, Y = 175, ButtonAction = ButtonAction.Activate, ToPage = 2
                });

                AddChildren(new Button((int)ButtonCircle.Circle_3_4, 0x08B4, 0x08B4)
                {
                    X = 164, Y = 175, ButtonAction = ButtonAction.Activate, ToPage = 2
                });

                AddChildren(new Button((int)ButtonCircle.Circle_5_6, 0x08B5, 0x08B5)
                {
                    X = 227, Y = 175, ButtonAction = ButtonAction.Activate, ToPage = 3
                });

                AddChildren(new Button((int)ButtonCircle.Circle_5_6, 0x08B6, 0x08B6)
                {
                    X = 260, Y = 175, ButtonAction = ButtonAction.Activate, ToPage = 3
                });

                AddChildren(new Button((int)ButtonCircle.Circle_7_8, 0x08B7, 0x08B7)
                {
                    X = 297, Y = 175, ButtonAction = ButtonAction.Activate, ToPage = 4
                });

                AddChildren(new Button((int)ButtonCircle.Circle_7_8, 0x08B8, 0x08B8)
                {
                    X = 332, Y = 175, ButtonAction = ButtonAction.Activate, ToPage = 4
                });
            }

            for (int i = 1; i <= (dictionaryPagesCount >> 1); i++)
            {
                int page = i;

                for (int j = 0; j < 2; j++)
                {
                    if (page == 1 && _spellBookType == SpellBookType.Chivalry)
                    {
                        Label label = new Label("Tithing points\nAvailable: " + World.Player.TithingPoints, false, 0x0288, font: 6)
                        {
                            X = 62, Y = 162
                        };
                        AddChildren(label, page);
                    }

                    int  indexX      = 106;
                    int  dataX       = 62;
                    int  y           = 0;
                    uint spellSerial = 100;

                    if (j % 2 != 0)
                    {
                        indexX      = 269;
                        dataX       = 225;
                        spellSerial = 1000;
                    }

                    Label text = new Label("INDEX", false, 0x0288, font: 6)
                    {
                        X = indexX, Y = 10
                    };
                    AddChildren(text, page);

                    if (isMageSpellbook)
                    {
                        text = new Label(SpellsMagery.CircleNames[(i - 1) * 2 + j % 2], false, 0x0288, font: 6)
                        {
                            X = dataX, Y = 30
                        };
                        AddChildren(text, page);
                    }

                    for (int k = 0; k < spellsOnPage; k++)
                    {
                        if (_spells[offs] > 0)
                        {
                            GetSpellNames(offs, out string name, out string abbreviature, out string reagents);

                            text = new HoveredLabel(name, false, 0x0288, 0x33, font: 9)
                            {
                                X = dataX, Y = 52 + y, LocalSerial = (uint)((dictionaryPagesCount >> 1) + (offs >> 1) + 1), AcceptMouseInput = true
                            };

                            text.MouseClick += (sender, e) =>
                            {
                                HoveredLabel l = (HoveredLabel)sender;
                                SetActivePage((int)l.LocalSerial.Value);
                            };
                            AddChildren(text, page);
                            y += 15;
                        }

                        offs++;
                    }
                }
            }

            int  page1            = (dictionaryPagesCount >> 1) + 1;
            int  topTextY         = _spellBookType == SpellBookType.Magery ? 10 : 6;
            bool haveReagents     = _spellBookType <= SpellBookType.Necromancy;
            bool haveAbbreviature = _spellBookType != SpellBookType.Bushido && _spellBookType != SpellBookType.Ninjitsu;

            for (int i = 0; i < maxSpellsCount; i++)
            {
                if (_spells[i] <= 0)
                {
                    continue;
                }

                int  iconX      = 62;
                int  topTextX   = 87;
                int  iconTextX  = 112;
                uint iconSerial = 100 + (uint)i;


                if (i > 0)
                {
                    if (i % 2 != 0)
                    {
                        iconX      = 225;
                        topTextX   = 244 - 20;
                        iconTextX  = 275;
                        iconSerial = 1000 + (uint)(i);
                    }
                    else
                    {
                        page1++;
                    }
                }

                GetSpellNames(i, out string name, out string abbreviature, out string reagents);

                if (isMageSpellbook)
                {
                    Label text = new Label(SpellsMagery.CircleNames[i >> 3], false, 0x0288, font: 6)
                    {
                        X = topTextX, Y = topTextY
                    };
                    AddChildren(text, page1);

                    text = new Label(name, false, 0x0288, 80, 6)
                    {
                        X = iconTextX, Y = 34
                    };
                    AddChildren(text, page1);
                    int abbreviatureY = 26;

                    if (text.Height < 24)
                    {
                        abbreviatureY = 31;
                    }
                    abbreviatureY += text.Height;

                    text = new Label(abbreviature, false, 0x0288, font: 8)
                    {
                        X = iconTextX, Y = abbreviatureY
                    };
                    AddChildren(text, page1);
                }
                else
                {
                    Label text = new Label(name, false, 0x0288, font: 6)
                    {
                        X = topTextX, Y = topTextY
                    };
                    AddChildren(text, page1);

                    if (haveAbbreviature)
                    {
                        text = new Label(abbreviature, false, 0x0288, 80, 6)
                        {
                            X = iconTextX, Y = 34
                        };
                        AddChildren(text, page1);
                    }
                }

                GumpPic icon = new GumpPic(iconX, 40, (Graphic)(iconStartGraphic + i), 0)
                {
                    X = iconX, Y = 40, LocalSerial = iconSerial
                };

                icon.DragBegin += (sender, e) =>
                {
                    GumpControl     ctrl = (GumpControl)sender;
                    int             idx  = (int)(ctrl.LocalSerial > 1000 ? ctrl.LocalSerial - 1000 : ctrl.LocalSerial - 100) + 1;
                    SpellDefinition?def  = null;

                    switch (_spellBookType)
                    {
                    case SpellBookType.Magery:
                        def = SpellsMagery.GetSpell(idx);

                        break;

                    case SpellBookType.Necromancy:
                        def = SpellsNecromancy.GetSpell(idx);

                        break;

                    case SpellBookType.Chivalry:
                        def = SpellsChivalry.GetSpell(idx);

                        break;

                    case SpellBookType.Bushido:
                        def = SpellsBushido.GetSpell(idx);

                        break;

                    case SpellBookType.Ninjitsu:
                        def = SpellsNinjitsu.GetSpell(idx);

                        break;

                    case SpellBookType.Spellweaving:
                        def = SpellsSpellweaving.GetSpell(idx);

                        break;

                    case SpellBookType.Mysticism:
                        def = SpellsMysticism.GetSpell(idx);

                        break;

                    default:

                        throw new ArgumentOutOfRangeException();
                    }

                    UseSpellButtonGump gump = new UseSpellButtonGump(def.Value)
                    {
                        X = Mouse.Position.X - 22, Y = Mouse.Position.Y - 22
                    };
                    UIManager.Add(gump);
                    UIManager.AttemptDragControl(gump, Mouse.Position, true);
                };
                AddChildren(icon, page1);

                if (haveReagents)
                {
                    AddChildren(new GumpPicTiled(iconX, 88, 120, 5, 0x0835), page1);

                    Label text = new Label("Reagents:", false, 0x0288, font: 6)
                    {
                        X = iconX, Y = 92
                    };
                    AddChildren(text, page1);

                    text = new Label(reagents, false, 0x0288, font: 9)
                    {
                        X = iconX, Y = 114
                    };
                    AddChildren(text, page1);
                }

                if (!isMageSpellbook)
                {
                    GetSpellRequires(i, out int requiriesY, out string requires);

                    Label text = new Label(requires, false, 0x0288, font: 6)
                    {
                        X = iconX, Y = requiriesY
                    };
                    AddChildren(text, page1);
                }
            }

            SetActivePage(1);
        }
Exemple #8
0
 public GumpControlInfo(GumpControl control)
 {
     Control = control;
 }
Exemple #9
0
        private void OnLeftMouseButtonUp(object sender, EventArgs e)
        {
            if (TargetSystem.IsTargeting && IsMouseOverWorld)
            {
                switch (TargetSystem.TargetingState)
                {
                case TargetType.Position:
                case TargetType.Object:
                    GameObject obj = null;

                    if (IsMouseOverUI)
                    {
                        GumpControl control = UIManager.MouseOverControl;

                        if (control is ItemGumpling gumpling)
                        {
                            obj = gumpling.Item;
                        }
                        //else if (control.RootParent is Mobil)
                    }
                    else if (IsMouseOverWorld)
                    {
                        obj = SelectedObject;
                    }

                    if (obj != null)
                    {
                        TargetSystem.MouseTargetingEventObject(obj);
                        Mouse.LastLeftButtonClickTime = 0;
                    }

                    break;

                case TargetType.Nothing:

                    break;

                default:
                    Log.Message(LogTypes.Warning, "Not implemented.");

                    break;
                }
            }
            else if (IsHoldingItem)
            {
                SelectedObject = null;

                if (IsMouseOverUI)
                {
                    GumpControl target = UIManager.MouseOverControl;

                    if (target is ItemGumpling gumpling && !(target is ItemGumplingPaperdoll))
                    {
                        Item item = gumpling.Item;
                        SelectedObject = item;

                        if (TileData.IsContainer((long)item.ItemData.Flags))
                        {
                            DropHeldItemToContainer(item);
                        }
                        else if (HeldItem.Graphic == item.Graphic && TileData.IsStackable((long)HeldItem.ItemData.Flags))
                        {
                            MergeHeldItem(item);
                        }
                        else
                        {
                            if (item.Container.IsItem)
                            {
                                DropHeldItemToContainer(World.Items.Get(item.Container), (ushort)(target.X + (Mouse.Position.X - target.ScreenCoordinateX) - _heldOffset.X), (ushort)(target.Y + (Mouse.Position.Y - target.ScreenCoordinateY) - _heldOffset.Y));
                            }
                        }
                    }
                    else if (target is GumpPicContainer container)
                    {
                        SelectedObject = container.Item;
                        int x = Mouse.Position.X - _heldOffset.X - (target.X + target.Parent.X);
                        int y = Mouse.Position.Y - _heldOffset.Y - (target.Y + target.Parent.Y);
                        DropHeldItemToContainer(container.Item, (ushort)x, (ushort)y);
                    }
                    else if (target is ItemGumplingPaperdoll || (target is GumpPic pic && pic.IsPaperdoll) || target is EquipmentSlot || target?.Parent is PaperDollGump)
                    {
                        if (TileData.IsWearable((long)HeldItem.ItemData.Flags))
                        {
                            WearHeldItem();
                        }
                    }
                    else if (target is GumpPicBackpack backpack)
                    {
                        DropHeldItemToContainer(backpack.BackpackItem);
                    }
                }
        private void OnLeftMouseButtonUp(object sender, EventArgs e)
        {
            if (TargetSystem.IsTargeting)
            {
                switch (TargetSystem.TargetingState)
                {
                case TargetType.Position:
                case TargetType.Object:
                    GameObject obj = null;

                    if (IsMouseOverUI)
                    {
                        GumpControl control = UIManager.MouseOverControl;

                        if (control is ItemGump gumpling)
                        {
                            obj = gumpling.Item;
                        }
                        else if (control.Parent is MobileHealthGump healthGump)
                        {
                            obj = healthGump.Mobile;
                        }
                    }
                    else if (IsMouseOverWorld)
                    {
                        obj = SelectedObject;
                    }

                    if (obj != null)
                    {
                        TargetSystem.TargetGameObject(obj);
                        Mouse.LastLeftButtonClickTime = 0;
                    }

                    break;

                case TargetType.Nothing:

                    break;

                case TargetType.SetTargetClientSide:
                    obj = null;
                    if (IsMouseOverWorld)
                    {
                        obj = SelectedObject;
                    }
                    if (obj != null)
                    {
                        TargetSystem.TargetGameObject(obj);
                        Mouse.LastLeftButtonClickTime = 0;
                        UIManager.Add(new InfoGump(obj));
                    }
                    break;

                default:
                    Log.Message(LogTypes.Warning, "Not implemented.");

                    break;
                }
            }
            else if (IsHoldingItem)
            {
                SelectedObject = null;

                if (IsMouseOverWorld)
                {
                    GameObject obj = _mousePicker.MouseOverObject;

                    if (obj != null && obj.Distance < Constants.DRAG_ITEMS_DISTANCE)
                    {
                        switch (obj)
                        {
                        case Mobile mobile:
                            MergeHeldItem(mobile);

                            break;

                        case IDynamicItem dyn:

                            if (dyn is Item item)
                            {
                                if (item.IsCorpse)
                                {
                                    MergeHeldItem(item);
                                }
                                else
                                {
                                    SelectedObject = item;

                                    if (item.Graphic == HeldItem.Graphic && HeldItem is IDynamicItem dyn1 && TileData.IsStackable(dyn1.ItemData.Flags))
                                    {
                                        MergeHeldItem(item);
                                    }
                                    else
                                    {
                                        DropHeldItemToWorld(obj.Position.X, obj.Position.Y, (sbyte)(obj.Position.Z + dyn.ItemData.Height));
                                    }
                                }
                            }
                            else
                            {
                                DropHeldItemToWorld(obj.Position.X, obj.Position.Y, (sbyte)(obj.Position.Z + dyn.ItemData.Height));
                            }

                            break;