public ConfirmRegisterGump(Mobile from, FightBroker fb) : base(50, 50)
            {
                from.CloseGump(typeof(ConfirmRegisterGump));

                AddPage(0);

                AddBackground(10, 10, 190, 140, 0x242C);

                AddHtml(30, 30, 150, 75, String.Format("<div align=CENTER>{0}</div>", "Do you wish to register with the fight broker?"), false, false);

                AddButton(40, 105, 0x81A, 0x81B, 0x1, GumpButtonType.Reply, 0);                   // Okay
                AddButton(110, 105, 0x819, 0x818, 0x2, GumpButtonType.Reply, 0);                  // Cancel
                m_Broker = fb;
            }
        public void AddMobileConfirmed(Mobile m)
        {
            int totalCost = REGISTRATION_FEE + REGISTRATION_ADDITION * FightBroker.Participants.Count;

            if (GetGoldFrom(m, totalCost))
            {
                if (FightBroker.AddParticipant(m))
                {
                    SayTo(m, "You have registered for {0} gold - be wary, people will find you now!", totalCost);
                }
                else
                {
                    SayTo(m, "You are already registered!");
                }
            }
            else
            {
                SayTo(m, "You don't have enough money for this.");
            }
        }
        public override void OnSpeech(SpeechEventArgs e)
        {
            try
            {
                if (!e.Handled && e.Mobile.InRange(this.Location, 4))
                {
                    if (e.Speech.ToLower().IndexOf("cost") != -1)
                    {
                        Direction = GetDirectionTo(e.Mobile);

                        SayTo(e.Mobile, "It costs {0} gold to find someone.", WHERE_FEE);
                        SayTo(e.Mobile, "It currently costs {0} gold to register.", REGISTRATION_FEE + REGISTRATION_ADDITION * FightBroker.Participants.Count);
                    }
                    else if (e.Speech.ToLower().IndexOf("register") != -1)
                    {
                        Direction = GetDirectionTo(e.Mobile);

                        FightBroker.FlushOldParticipants();
                        if (FightBroker.IsAlreadyRegistered(e.Mobile))
                        {
                            SayTo(e.Mobile, "You are already registered!");
                        }
                        else
                        {
                            e.Mobile.SendGump(new ConfirmRegisterGump(e.Mobile, this));
                        }
                    }
                    else if (e.Speech.ToLower().IndexOf("list") != -1)
                    {
                        Direction = GetDirectionTo(e.Mobile);

                        bool bDisplayOnlineOnly = false;
                        if (e.Speech.ToLower().IndexOf("online") != -1)
                        {
                            bDisplayOnlineOnly = true;
                        }

                        FightBroker.FlushOldParticipants();
                        if (FightBroker.Participants.Count > 0)
                        {
                            //SayTo(e.Mobile, "Here are the people registered:");
                            Say("Here are the people registered:");
                            int originalspeechhue = SpeechHue;
                            foreach (FightMember fm in FightBroker.Participants)
                            {
                                if (!(bDisplayOnlineOnly && fm.Mobile.Map == Map.Internal))
                                {
                                    string output;
                                    if (fm.Mobile.Guild == null || fm.Mobile.DisplayGuildTitle == false)
                                    {
                                        output = string.Format("{0}{1}", fm.Mobile.Name, fm.Mobile.Map != Map.Internal ? "" : " (offline)");
                                    }
                                    else
                                    {
                                        output = string.Format("{0} [{2}]{1}", fm.Mobile.Name, fm.Mobile.Map != Map.Internal ? "" : " (offline)", fm.Mobile.Guild.Abbreviation);
                                    }

                                    if (fm.Mobile.Kills >= 5)
                                    {
                                        SpeechHue = 0x21;
                                    }
                                    else if (fm.Mobile.Criminal)
                                    {
                                        SpeechHue = 0x3B1;
                                    }
                                    else
                                    {
                                        SpeechHue = 0x58;
                                    }
                                    //SayTo(e.Mobile, output);
                                    Say(output);
                                    SpeechHue = originalspeechhue;
                                }
                            }
                        }
                        else
                        {
                            //SayTo(e.Mobile, "Nobody has been brave enough to join recently.");
                            Say("Nobody has been brave enough to join recently.");
                        }
                    }
                    else if (e.Speech.ToLower().IndexOf("where") != -1)
                    {
                        Direction = GetDirectionTo(e.Mobile);

                        FightBroker.FlushOldParticipants();
                        if (FightBroker.IsAlreadyRegistered(e.Mobile))
                        {
                            string name;
                            if (e.Speech.ToLower().IndexOf("where is ") == -1)
                            {
                                name = e.Speech.Substring(e.Speech.ToLower().IndexOf("where ") + 6);
                            }
                            else
                            {
                                name = e.Speech.Substring(e.Speech.ToLower().IndexOf("where is ") + 9);
                            }
                            SayTo(e.Mobile, "So, you wish to find {0}, that will cost you {1} gold.", name, WHERE_FEE);
                            if (FightBroker.IsMatchedAndLoggedIn(name))
                            {
                                if (GetGoldFrom(e.Mobile, WHERE_FEE))
                                {
                                    FightBroker.SendLocation(e.Mobile, name);
                                    e.Mobile.SendMessage("You have spent {0} gold to find {1}", WHERE_FEE, name);
                                }
                                else
                                {
                                    SayTo(e.Mobile, "You don't have enough money for this.");
                                }
                            }
                            else
                            {
                                SayTo(e.Mobile, "{0} isn't registered.", name);
                            }
                        }
                        else
                        {
                            SayTo(e.Mobile, "You must be registered to locate someone.");
                        }
                    }
                }
            }
            catch (Exception exc)
            {
                LogHelper.LogException(exc);
                System.Console.WriteLine("Error in FightBroker.OnSpeech():");
                System.Console.WriteLine(exc.Message);
                System.Console.WriteLine(exc.StackTrace);
            }

            base.OnSpeech(e);
        }
        private static void FightBroker_OnCommand(CommandEventArgs e)
        {
            Mobile m = e.Mobile;

            try
            {
                if (e.Length == 0)
                {
                    m.SendMessage("valid command formats are:");
                    m.SendMessage("[fightbroker list");
                    m.SendMessage("[fightbroker where <name>");
                }
                else
                {
                    string cmd = e.GetString(0);
                    if (cmd.ToLower() == "list")
                    {
                        int hue = 0x58;
                        FightBroker.FlushOldParticipants();
                        if (FightBroker.Participants.Count > 0)
                        {
                            m.SendMessage("Here are the people registered:");
                            foreach (FightMember fm in FightBroker.Participants)
                            {
                                string output;
                                if (fm.Mobile.Guild == null || fm.Mobile.DisplayGuildTitle == false)
                                {
                                    output = string.Format("{0}{1}", fm.Mobile.Name, fm.Mobile.Map != Map.Internal ? "" : " (offline)");
                                }
                                else
                                {
                                    output = string.Format("{0} [{2}]{1}", fm.Mobile.Name, fm.Mobile.Map != Map.Internal ? "" : " (offline)", fm.Mobile.Guild.Abbreviation);
                                }

                                if (fm.Mobile.Kills >= 5)
                                {
                                    hue = 0x21;
                                }
                                else if (fm.Mobile.Criminal)
                                {
                                    hue = 0x3B1;
                                }
                                else
                                {
                                    hue = 0x58;
                                }
                                m.SendMessage(hue, output);
                            }
                        }
                        else
                        {
                            m.SendMessage("The fightbroker list is empty.");
                        }
                    }
                    else if (cmd.ToLower() == "where")
                    {
                        string name;
                        int    index = e.ArgString.ToLower().IndexOf("where") + 6;
                        if (index > e.ArgString.Length)
                        {
                            m.SendMessage("Please specify a name: [fightbroker where <name>");
                        }
                        else
                        {
                            name = e.ArgString.Substring(index);
                            if (FightBroker.IsMatchedAndLoggedIn(name))
                            {
                                FightBroker.SendLocation(m, name);
                            }
                            else
                            {
                                m.SendMessage("{0} is not registered or is not logged in", name);
                            }
                        }
                    }
                    else
                    {
                        m.SendMessage("valid command formats are:");
                        m.SendMessage("[fightbroker list");
                        m.SendMessage("[fightbroker where <name>");
                    }
                }
            }
            catch (Exception ex)
            {
                LogHelper.LogException(ex);
                System.Console.WriteLine("Caught exception in [fightbroker command: " + ex.Message);
                System.Console.WriteLine(ex.StackTrace);
            }
        }
			public ConfirmRegisterGump( Mobile from, FightBroker fb) : base( 50, 50 )
			{
				from.CloseGump( typeof(ConfirmRegisterGump) );

				AddPage( 0 );

				AddBackground( 10, 10, 190, 140, 0x242C );

				AddHtml( 30, 30, 150, 75, String.Format( "<div align=CENTER>{0}</div>", "Do you wish to register with the fight broker?" ), false, false );

				AddButton( 40, 105, 0x81A, 0x81B, 0x1, GumpButtonType.Reply, 0 ); // Okay
				AddButton( 110, 105, 0x819, 0x818, 0x2, GumpButtonType.Reply, 0 ); // Cancel
				m_Broker = fb;
			}