示例#1
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;
            }

            if (!InputBox.Show(Engine.MainWindow, Language.GetString(LocString.EnterAmount),
                               Language.GetString(LocString.InputReq), "1"))
            {
                return;
            }

            RestockItem ri = new RestockItem(gfx, InputBox.GetInt(1));

            Add(ri);

            Engine.MainWindow.SafeAction(s => s.ShowMe());
        }
示例#2
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;
            }

            if (!InputBox.Show(Engine.MainWindow, Language.GetString(LocString.EnterAmount),
                               Language.GetString(LocString.InputReq), "1"))
            {
                return;
            }

            RestockItem ri = new RestockItem(gfx, InputBox.GetInt(1));

            foreach (RestockItem restockItem in m_Items)
            {
                if (restockItem.ItemID.Value == gfx)
                {
                    World.Player.SendMessage(MsgLevel.Force, LocString.ItemExists);
                    return;
                }
            }

            m_Items.Add(ri);
            m_SubList.Items.Add(ri);

            World.Player.SendMessage(MsgLevel.Force, LocString.ItemAdded);

            Engine.MainWindow.SafeAction(s => s.ShowMe());
        }
示例#3
0
        private void OnTarget(bool location, Serial serial, Point3D loc, ushort gfx)
        {
            Engine.MainWindow.SafeAction(s => s.ShowMe());

            if (!location && !serial.IsMobile)
            {
                if (InputBox.Show(Engine.MainWindow, Language.GetString(LocString.EnterAmount),
                                  Language.GetString(LocString.InputReq)))
                {
                    ushort count = (ushort)InputBox.GetInt(0);
                    if (count <= 0)
                    {
                        return;
                    }

                    Add(new BuyEntry(gfx, count));
                }
            }
        }
示例#4
0
文件: SellAgent.cs 项目: 9iks/Razor-1
        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:
                if (InputBox.Show(Language.GetString(LocString.EnterAmount)))
                {
                    Config.SetProperty("SellAgentMax", InputBox.GetInt(100));
                }

                m_AmountButton.Text = Language.Format(LocString.SellAmount, Config.GetInt("SellAgentMax"));
                break;

            case 6:
                m_Enabled        = !m_Enabled;
                m_EnableBTN.Text = Language.GetString(m_Enabled ? LocString.PushDisable : LocString.PushEnable);
                break;
            }
        }
示例#5
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];
                if (!InputBox.Show(Engine.MainWindow, Language.GetString(LocString.EnterAmount),
                                   Language.GetString(LocString.InputReq), ri.Amount.ToString()))
                {
                    return;
                }

                ri.Amount = InputBox.GetInt(ri.Amount);

                m_SubList.BeginUpdate();
                m_SubList.Items.Clear();
                for (int j = 0; j < m_Items.Count; j++)
                {
                    m_SubList.Items.Add(m_Items[j]);
                }

                m_SubList.SelectedIndex = i;
                m_SubList.EndUpdate();
                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;
            }
            }
        }
示例#6
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];
                    ushort   amount = e.Amount;
                    if (InputBox.Show(Engine.MainWindow, Language.GetString(LocString.EnterAmount),
                                      Language.GetString(LocString.InputReq), amount.ToString()))
                    {
                        e.Amount = (ushort)InputBox.GetInt(1);
                        m_SubList.BeginUpdate();
                        m_SubList.Items.Clear();
                        for (int i = 0; i < m_Items.Count; i++)
                        {
                            m_SubList.Items.Add(m_Items[i]);
                        }

                        m_SubList.EndUpdate();
                    }
                }

                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;
            }
        }
示例#7
0
        public override void OnButtonPress(int num)
        {
            ConfigItem item = listBox.SelectedItem as ConfigItem;

            if (item == null)
            {
                return;
            }
            if (item.Value is string)
            {
                if (InputBox.Show("Input string") && !string.IsNullOrEmpty(InputBox.GetString()))
                {
                    item.Value = InputBox.GetString();
                }
            }
            else if (item.Value is bool)
            {
                item.Value = !(bool)item.Value;
            }
            else if (item.Value is uint)
            {
                Targeting.OneTimeTarget((l, s, p, g) =>
                {
                    item.Value = s == World.Player.Serial ? 0 : s.Value;
                    listBox.Items[listBox.SelectedIndex] = item;
                });
            }
            else if (item.Value is byte)
            {
                if (InputBox.Show("Input value") && (InputBox.GetInt(-1) >= 0 || InputBox.GetInt(-1) <= 100))
                {
                    item.Value = (byte)InputBox.GetInt(-1);
                }
            }
            else if (item.Value is ushort)
            {
                HueEntry hueEntry = new HueEntry((ushort)item.Value);
                if (hueEntry.ShowDialog(Engine.MainWindow) == DialogResult.OK)
                {
                    item.Value = (ushort)hueEntry.Hue;
                }
            }
            else if (item.Value.GetType().IsEnum)
            {
                Type type  = item.Value.GetType();
                int  value = (int)item.Value;
                while (!Enum.IsDefined(type, ++value))
                {
                    if (value >= Enum.GetValues(type).Length)
                    {
                        value = -1;
                    }
                }
                item.Value = Enum.ToObject(type, value);
            }
            else
            {
                throw new NotImplementedException();
            }
            listBox.Items[listBox.SelectedIndex] = item;
        }