示例#1
0
        public override void OnButtonPress(int num)
        {
            switch (num)
            {
            case 1:
                World.Player.SendMessage(MsgLevel.Force, LocString.TargItemAdd);
                Targeting.OneTimeTarget(new Targeting.TargetResponseCallback(OnTarget));
                break;

            case 2:
                if (m_SubList == null)
                {
                    break;
                }

                if (m_SubList.SelectedIndex >= 0)
                {
                    BuyEntry e = (BuyEntry)m_Items[m_SubList.SelectedIndex];

                    InputDialogGump inputGump = new InputDialogGump(OnItemChangeAmountResponse, m_SubList.SelectedIndex, Language.GetString(LocString.EnterAmount), e.Amount.ToString());
                    inputGump.SendGump();
                }

                break;

            case 3:

                if (MessageBox.Show(Language.GetString(LocString.Confirm), Language.GetString(LocString.ClearList),
                                    MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    if (m_SubList.SelectedIndex >= 0)
                    {
                        m_Items.RemoveAt(m_SubList.SelectedIndex);
                        m_SubList.Items.RemoveAt(m_SubList.SelectedIndex);
                        m_SubList.SelectedIndex = -1;
                    }
                }

                break;

            case 4:

                if (MessageBox.Show(Language.GetString(LocString.Confirm), Language.GetString(LocString.ClearList),
                                    MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    m_SubList.Items.Clear();
                    m_Items.Clear();
                }

                break;

            case 5:
                m_Enabled        = !m_Enabled;
                m_EnableBTN.Text = Language.GetString(m_Enabled ? LocString.PushDisable : LocString.PushEnable);
                break;
            }
        }
示例#2
0
        private void OnTarget(bool location, Serial serial, Point3D loc, ushort gfx)
        {
            if (!location && !serial.IsMobile)
            {
                InputDialogGump inputGump = new InputDialogGump(OnItemTargetAmountResponse, gfx, Language.GetString(LocString.EnterAmount), "0");
                inputGump.SendGump();

                //AddInputCallback = new BuyAgentAddInputCallback(OnItemTargetAmountResponse);
            }

            Engine.MainWindow.SafeAction(s => s.ShowMe());
        }
示例#3
0
        public void SetItemAmount(int itemId, bool fromGump = false)
        {
            int      itemIndex = Items.FindIndex(a => a.Id == itemId);
            BuyEntry item      = Items[itemIndex];

            if (item != null)
            {
                _fromGump = fromGump;

                InputDialogGump inputGump = new InputDialogGump(OnItemChangeAmountResponse, itemIndex, Language.GetString(LocString.EnterAmount), item.Amount.ToString());
                inputGump.SendGump();
            }
        }
示例#4
0
        private void OnItemTarget(bool location, Serial serial, Point3D loc, ushort gfx)
        {
            if (location || serial.IsMobile)
            {
                return;
            }

            Item item = World.FindItem(serial);

            if (item != null)
            {
                gfx = item.ItemID;
            }

            if (gfx == 0 || gfx >= 0x4000)
            {
                return;
            }

            InputDialogGump inputGump = new InputDialogGump(OnItemTargetAmountResponse, gfx, Language.GetString(LocString.EnterAmount), "1");

            inputGump.SendGump();
        }
示例#5
0
        protected void BeginRename(PlayerMobile m)
        {
            if (m == null || m.Deleted)
            {
                return;
            }

            _NameInput = SuperGump.Send(
                new InputDialogGump(m)
            {
                Limit = 16,
                Title = "Name Your Entity",
                Html  =
                    "Give your talisman entity a name!\n\n" +
                    "Name length must be between 1 and 16 letters and contain no invalid characters, numbers, or white-space.\n\n" +
                    "When you're done, click OK to summon your entity!",
                AcceptHandler = b => _NameInput = null,
                CancelHandler = b =>
                {
                    _NameInput = null;

                    m.SendMessage("You decide not to name your entity.");
                },
                Callback = (b, t) =>
                {
                    if (VerifyName(m, t, true) != NameResultMessage.Allowed)
                    {
                        return;
                    }

                    EntityName = t;

                    SummonEntity(m);
                }
            });
        }
示例#6
0
        protected override void CompileMenuOptions(MenuGumpOptions list)
        {
            if (User.AccessLevel >= MOTD.Access)
            {
                list.AppendEntry(
                    new ListGumpEntry(
                        "Login Popup [" + (MOTD.CMOptions.LoginPopup ? "Enabled" : "Disabled") + "]",
                        button =>
                {
                    MOTD.CMOptions.LoginPopup = !MOTD.CMOptions.LoginPopup;
                    Refresh(true);
                },
                        (MOTD.CMOptions.LoginPopup ? HighlightHue : ErrorHue)));

                list.AppendEntry(
                    new ListGumpEntry(
                        "Load Messages",
                        button =>
                {
                    MOTD.Messages.Import();
                    Refresh(true);
                },
                        HighlightHue));

                list.AppendEntry(
                    new ListGumpEntry(
                        "Save Messages",
                        button =>
                {
                    MOTD.Messages.Export();
                    Refresh(true);
                },
                        HighlightHue));

                list.AppendEntry(
                    new ListGumpEntry(
                        "Delete All",
                        button =>
                {
                    if (UseConfirmDialog)
                    {
                        Send(
                            new ConfirmDialogGump(
                                User,
                                this,
                                title: "Delete All Messages?",
                                html:
                                "All messages in the MOTD database will be deleted, erasing all data associated with them.\nThis action can not be reversed.\n\nDo you want to continue?",
                                onAccept: subButton =>
                        {
                            DeleteAllMessages();
                            Refresh(true);
                        }));
                    }
                    else
                    {
                        DeleteAllMessages();
                        Refresh(true);
                    }
                },
                        HighlightHue));

                list.AppendEntry(
                    new ListGumpEntry(
                        "New Message",
                        button =>
                {
                    _NewMessageInput = new InputDialogGump(
                        User,
                        this,
                        title: "Create New Message?",
                        html: "This action will create a new MOTD message with the selected title.\nDo you want to continue?",
                        callback: OnConfirmCreateMessage);
                    Send(_NewMessageInput);
                },
                        HighlightHue));
            }

            base.CompileMenuOptions(list);
        }
示例#7
0
        public override void OnButtonPress(int num)
        {
            switch (num)
            {
            case 1:
                World.Player.SendMessage(MsgLevel.Force, LocString.TargItemAdd);
                Targeting.OneTimeTarget(new Targeting.TargetResponseCallback(OnTarget));
                break;

            case 2:
                if (m_SubList.SelectedIndex >= 0)
                {
                    m_Items.RemoveAt(m_SubList.SelectedIndex);
                    m_SubList.Items.RemoveAt(m_SubList.SelectedIndex);
                    m_SubList.SelectedIndex = -1;
                }

                break;

            case 3:
                if (m_HotBag == Serial.Zero)
                {
                    World.Player.SendMessage(MsgLevel.Force, LocString.TargCont);
                    Targeting.OneTimeTarget(new Targeting.TargetResponseCallback(OnHBTarget));
                }
                else
                {
                    Item hb = World.FindItem(m_HotBag);
                    if (hb != null)
                    {
                        if (hb.ObjPropList.Remove(Language.GetString(LocString.SellHB)))
                        {
                            hb.OPLChanged();
                        }
                    }

                    m_HotBag = Serial.Zero;
                    SetHBText();
                }

                break;

            case 4:
                if (MessageBox.Show(Language.GetString(LocString.Confirm), Language.GetString(LocString.ClearList),
                                    MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    m_SubList.Items.Clear();
                    m_Items.Clear();
                }

                break;

            case 5:

                InputDialogGump gump = new InputDialogGump(OnChangeSellMaxAmount, 0, Language.GetString(LocString.EnterAmount), Config.GetInt("SellAgentMax").ToString());
                gump.SendGump();

                break;

            case 6:
                m_Enabled        = !m_Enabled;
                m_EnableBTN.Text = Language.GetString(m_Enabled ? LocString.PushDisable : LocString.PushEnable);
                break;
            }
        }
示例#8
0
        public override void OnButtonPress(int num)
        {
            switch (num)
            {
            case 1:
            {
                Targeting.OneTimeTarget(new Targeting.TargetResponseCallback(OnItemTarget));
                World.Player.SendMessage(MsgLevel.Force, LocString.TargItemAdd);
                break;
            }

            case 2:
            {
                if (m_SubList.SelectedIndex >= 0 && m_SubList.SelectedIndex < m_Items.Count)
                {
                    m_Items.RemoveAt(m_SubList.SelectedIndex);
                    m_SubList.Items.RemoveAt(m_SubList.SelectedIndex);
                }

                break;
            }

            case 3:
            {
                int i = m_SubList.SelectedIndex;
                if (i < 0 || i > m_Items.Count)
                {
                    return;
                }

                RestockItem ri = (RestockItem)m_Items[i];

                InputDialogGump inputGump = new InputDialogGump(OnItemTargetChangeResponse, m_SubList.SelectedIndex, Language.GetString(LocString.EnterAmount), ri.Amount.ToString());
                inputGump.SendGump();

                break;
            }

            case 4:
            {
                if (MessageBox.Show(Language.GetString(LocString.Confirm), Language.GetString(LocString.ClearList),
                                    MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    m_SubList.Items.Clear();
                    m_Items.Clear();
                }

                break;
            }

            case 5:
            {
                if (m_HotBag == Serial.Zero)
                {
                    SetHB();
                }
                else
                {
                    m_HotBag = Serial.Zero;
                    SetHBText();
                }

                break;
            }

            case 6:
            {
                OnHotKey();
                break;
            }
            }
        }
示例#9
0
        protected virtual void OpenGump(Mobile m, TEntity t)
        {
            if (_Gump != null)
            {
                _Gump.Close();
                _Gump = null;
            }

            if (Names != null && Names.Count > 0)
            {
                m.SendMessage("Select a name from the registry...");

                var opts = new MenuGumpOptions();

                foreach (var name in Names.OrderByNatural())
                {
                    var n = name;

                    opts.AppendEntry(
                        new ListGumpEntry(
                            n,
                            () =>
                    {
                        _Gump = null;
                        ApplyName(m, t, n);
                    }));
                }

                var menu = new MenuGump(m as PlayerMobile, null, opts);

                menu.OnActionClose += HandleGumpClose;
                _Gump = menu.Send();
            }
            else
            {
                string name;
                int    limit;

                if (t is Item)
                {
                    name  = (t as Item).Name;
                    limit = 20;
                }
                else if (t is Mobile)
                {
                    name  = (t as Mobile).RawName;
                    limit = 20;
                }
                else
                {
                    name  = String.Empty;
                    limit = 0;
                }

                var dialog = new InputDialogGump(m as PlayerMobile)
                {
                    Title     = "",
                    Html      = "",
                    InputText = name,
                    Limit     = limit,
                    Callback  = (b, n) =>
                    {
                        _Gump = null;
                        ApplyName(m, t, n);
                    }
                };

                dialog.OnActionClose += HandleGumpClose;
                _Gump = dialog.Send();
            }
        }