protected override void OnTarget(Mobile from, object targeted) { if (targeted is Mobile && m_type < 2) { Mobile targ = ( Mobile )targeted; if (from != targ && from.AccessLevel > targ.AccessLevel) { CommandLogging.WriteLine(from, "{0} {1} forcing speech on {2}.", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(targ)); if (m_toSay.StartsWith(CommandSystem.Prefix)) { targ.SendMessage("{0} makes you invoke {1}.", from.Name, m_toSay); CommandSystem.Handle(targ, String.Format("{0}{1}", CommandSystem.Prefix, m_toSay.Substring(1))); } else { targ.Say(m_toSay); } } else if (from == targ) { from.SendMessage("You don't need this command to make yourself say something!"); } else if (from.AccessLevel <= targ.AccessLevel) { from.SendMessage("You cannot do that."); } } else if (targeted is Item && m_type != 1) { Item targ = (Item)targeted; object root = targ.RootParent; if (root == null) { targ.PublicOverheadMessage(MessageType.Regular, (SpeechHueOverride < 0 ? Utility.RandomDyedHue() : SpeechHueOverride), false, m_toSay); } else if (root is Mobile) { if (from != ((Mobile)root) && from.AccessLevel > ((Mobile)root).AccessLevel) { CommandLogging.WriteLine(from, "{0} {1} forcing speech on {2}.", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(((Mobile)root))); if (m_toSay.StartsWith(CommandSystem.Prefix)) { ((Mobile)root).SendMessage("{0} makes you invoke {1}.", from.Name, m_toSay); CommandSystem.Handle(((Mobile)root), String.Format("{0}{1}", CommandSystem.Prefix, m_toSay.Substring(1))); } else { ((Mobile)root).Say(m_toSay); } } else if (from == ((Mobile)root)) { from.SendMessage("You don't need this command to make yourself say something!"); } else if (from.AccessLevel <= ((Mobile)root).AccessLevel) { from.SendMessage("You cannot do that."); } } else if (root is Item) { targ.PublicOverheadMessage(MessageType.Regular, (SpeechHueOverride < 0 ? Utility.RandomDyedHue() : SpeechHueOverride), false, m_toSay); } } else if (targeted is StaticTarget && m_type != 1) { StaticOverhead s = new StaticOverhead(); s.MoveToWorld(((StaticTarget)targeted).Location, from.Map); s.PublicOverheadMessage(MessageType.Regular, (SpeechHueOverride < 0 ? Utility.RandomDyedHue() : SpeechHueOverride), false, m_toSay); } else { from.SendMessage("Invalid Target Type"); } }
protected override void OnTarget(Mobile from, object targeted) { if (targeted is Mobile && m_type < 2) { Mobile targ = (Mobile) targeted; if (from != targ && from.AccessLevel > targ.AccessLevel) { CommandLogging.WriteLine(from, "{0} {1} forcing speech on {2}.", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(targ)); if (m_toSay.StartsWith(CommandSystem.Prefix)) { targ.SendMessage("{0} makes you invoke {1}.", from.Name, m_toSay); CommandSystem.Handle(targ, String.Format("{0}{1}", CommandSystem.Prefix, m_toSay.Substring(1))); } else { if (targ.Player) { PlayerMobile pm = (PlayerMobile) targ; DoSpeech(pm, m_toSay); } else targ.Say(m_toSay); } } else if (from == targ) from.SendMessage("You don't need this command to make yourself say something!"); else if (from.AccessLevel <= targ.AccessLevel) from.SendMessage("You cannot do that."); } else if (targeted is Item && m_type != 1) { Item targ = (Item) targeted; object root = targ.RootParent; if (root == null) targ.PublicOverheadMessage(MessageType.Regular, (SpeechHueOverride < 0 ? Utility.RandomDyedHue() : SpeechHueOverride), false, m_toSay); else if (root is Mobile) { if (from != (root) && from.AccessLevel > ((Mobile) root).AccessLevel) { CommandLogging.WriteLine(from, "{0} {1} forcing speech on {2}.", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format((root))); if (m_toSay.StartsWith(CommandSystem.Prefix)) { ((Mobile) root).SendMessage("{0} makes you invoke {1}.", from.Name, m_toSay); CommandSystem.Handle(((Mobile) root), String.Format("{0}{1}", CommandSystem.Prefix, m_toSay.Substring(1))); } else ((Mobile) root).Say(m_toSay); } else if (from == (root)) from.SendMessage("You don't need this command to make yourself say something!"); else if (from.AccessLevel <= ((Mobile) root).AccessLevel) from.SendMessage("You cannot do that."); } else if (root is Item) targ.PublicOverheadMessage(MessageType.Regular, (SpeechHueOverride < 0 ? Utility.RandomDyedHue() : SpeechHueOverride), false, m_toSay); } else if (targeted is StaticTarget && m_type != 1) { StaticOverhead s = new StaticOverhead(); s.MoveToWorld(((StaticTarget) targeted).Location, from.Map); s.PublicOverheadMessage(MessageType.Regular, (SpeechHueOverride < 0 ? Utility.RandomDyedHue() : SpeechHueOverride), false, m_toSay); } else from.SendMessage("Invaild Target Type"); }