示例#1
0
        public override void OnButtonClick(int buttonID)
        {
            switch ((Buttons)buttonID)
            {
            case Buttons.Heal:
                GameActions.CastSpell(29);
                TargetSystem.TargetGameObject(_partyMember.Mobile);

                //
                break;

            case Buttons.Cure:
                GameActions.CastSpell(11);

                //
                break;

            case Buttons.Bandage:

                //
                break;

            case Buttons.Pin:

                if (!_isPinned)
                {
                    _pinButton.ButtonGraphicNormal = 0x2331;
                    _isPinned = true;
                    CanMove   = false;
                    CanCloseWithRightClick = false;
                }
                else
                {
                    _pinButton.ButtonGraphicNormal = 0x2330;
                    _isPinned = false;
                    CanMove   = true;
                    CanCloseWithRightClick = true;
                }

                break;
            }
        }
示例#2
0
        private void OnLeftMouseButtonUp(object sender, EventArgs e)
        {
            if (TargetSystem.IsTargeting)
            {
                switch (TargetSystem.TargetingState)
                {
                case TargetType.Position:
                case TargetType.Object:
                    GameObject obj = null;

                    if (IsMouseOverUI)
                    {
                        Control control = Engine.UI.MouseOverControl;

                        if (control is ItemGump gumpling)
                        {
                            obj = gumpling.Item;
                        }
                        else if (control.Parent is HealthBarGump 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;
                        Engine.UI.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 Item item:
                            if (item.IsCorpse)
                            {
                                MergeHeldItem(item);
                            }
                            else
                            {
                                SelectedObject = item;

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