public override bool OnDragDrop(Mobile from, Item dropped) { CTFControl ctfc = FindCTFControl(); // we will need to use the SessionId to locate an available session if (ctfc != null) { // process it ctfc.OnDragDrop(this, from, dropped); } else { this.Say("I cannot take that at this time."); } return(base.OnDragDrop(from, dropped)); }
public override void OnSpeech(SpeechEventArgs e) { CTFControl ctfc = FindCTFControl(); try { if (!e.Handled && e.Mobile.InRange(this.Location, 4)) { // if our CTF understands the text if (CTFControl.UnderstandsSpeech(e) && ctfc != null) { // process it ctfc.OnSpeech(this, e); } else 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.Murderer) { 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); }