Beispiel #1
0
        private static void ShowBuyGump(string[] param)
        {
            if (string.IsNullOrEmpty(param[0]))
            {
                World.Player.SendMessage(MsgLevel.Error, "You must include an id or alias");
                return;
            }

            if (int.TryParse(param[0], out int agentIndex))
            {
                BuyAgent agent = BuyAgent.Agents[agentIndex - 1];

                AgentsGump gump = new AgentsGump(agent);
                gump.SendGump();
            }
            else
            {
                foreach (BuyAgent agent in BuyAgent.Agents)
                {
                    if (agent.Alias.Equals(param[0], StringComparison.OrdinalIgnoreCase))
                    {
                        AgentsGump gump = new AgentsGump(agent);
                        gump.SendGump();

                        break;
                    }
                }
            }
        }
Beispiel #2
0
        private bool OnItemChangeAmountResponse(int entryId, string input)
        {
            if (ushort.TryParse(input, out ushort amount))
            {
                if (amount <= 0)
                {
                    return(false);
                }

                BuyEntry e = (BuyEntry)Items[entryId];

                e.Amount = amount;

                if (m_SubList != null)
                {
                    m_SubList.BeginUpdate();
                    m_SubList.Items.Clear();

                    for (int i = 0; i < Items.Count; i++)
                    {
                        m_SubList.Items.Add(Items[i]);
                    }

                    m_SubList.EndUpdate();
                }

                if (_fromGump)
                {
                    _fromGump = false;

                    AgentsGump agent = new AgentsGump(this);
                    agent.SendGump();
                }
                else
                {
                    Engine.MainWindow.SafeAction(s => s.ShowMe());
                }

                return(true);
            }

            if (_fromGump)
            {
                _fromGump = false;

                AgentsGump agent = new AgentsGump(this);
                agent.SendGump();
            }
            else
            {
                Engine.MainWindow.SafeAction(s => s.ShowMe());
            }

            return(false);
        }
Beispiel #3
0
        private bool OnItemTargetChangeResponse(int restockId, string input)
        {
            if (int.TryParse(input, out int amount))
            {
                RestockItem ri = (RestockItem)Items[restockId];

                ri.Amount = amount;

                if (m_SubList != null)
                {
                    m_SubList.BeginUpdate();
                    m_SubList.Items.Clear();

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

                    m_SubList.SelectedIndex = restockId;
                    m_SubList.EndUpdate();
                }

                if (_fromGump)
                {
                    _fromGump = false;

                    AgentsGump agent = new AgentsGump(this);
                    agent.SendGump();
                }
                else
                {
                    Engine.MainWindow.SafeAction(s => s.ShowMe());
                }

                return(true);
            }

            if (_fromGump)
            {
                _fromGump = false;

                AgentsGump agent = new AgentsGump(this);
                agent.SendGump();
            }
            else
            {
                Engine.MainWindow.SafeAction(s => s.ShowMe());
            }

            return(false);
        }
Beispiel #4
0
        private void OnTarget(bool location, Serial serial, Point3D loc, ushort gfx)
        {
            if (!location && serial.IsItem && World.Player != null)
            {
                AddItem(gfx);
            }

            if (_fromGump)
            {
                _fromGump = false;

                AgentsGump agent = new AgentsGump(this);
                agent.SendGump();
            }
            else if (Engine.MainWindow != null)
            {
                Engine.MainWindow.SafeAction(s => s.ShowMe());
            }
        }
Beispiel #5
0
        private bool OnItemTargetAmountResponse(int gfx, string input)
        {
            if (ushort.TryParse(input, out ushort count))
            {
                if (count <= 0)
                {
                    return(false);
                }

                AddItem(new BuyEntry((ushort)gfx, count));

                if (_fromGump)
                {
                    _fromGump = false;

                    AgentsGump agent = new AgentsGump(this);
                    agent.SendGump();
                }
                else
                {
                    Engine.MainWindow.SafeAction(s => s.ShowMe());
                }

                return(true);
            }

            if (_fromGump)
            {
                _fromGump = false;

                AgentsGump agent = new AgentsGump(this);
                agent.SendGump();
            }
            else
            {
                Engine.MainWindow.SafeAction(s => s.ShowMe());
            }

            return(false);
        }
Beispiel #6
0
        private bool OnItemTargetAmountResponse(int gfx, string input)
        {
            if (int.TryParse(input, out int amount))
            {
                RestockItem ri = new RestockItem((ushort)gfx, amount);
                AddItem(ri);

                if (_fromGump)
                {
                    _fromGump = false;

                    AgentsGump agent = new AgentsGump(this);
                    agent.SendGump();
                }
                else
                {
                    Engine.MainWindow.SafeAction(s => s.ShowMe());
                }

                return(true);
            }

            if (_fromGump)
            {
                _fromGump = false;

                AgentsGump agent = new AgentsGump(this);
                agent.SendGump();
            }
            else
            {
                Engine.MainWindow.SafeAction(s => s.ShowMe());
            }

            return(false);
        }