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("Invaild Target Type"); } }
public static void DoCommands(int[] selections, GumpType type, Mobile from) { World.Broadcast(0x35, false, "The world is generating. This may take some time..."); string prefix = Server.Commands.CommandSystem.Prefix; foreach (int sel in selections) { foreach (CreateWorld.CommandEntry entry in CreateWorld.Commands) { if (entry.checkId == sel) { switch (type) { case CreateWorld.GumpType.Create: from.Say("Generating " + entry.Name); if (CanGenerate(entry)) { if (entry.Delay > 0) { DoDelayedCommand(from, TimeSpan.FromMinutes(entry.Delay), prefix + entry.CreateCommand); } else { CommandSystem.Handle(from, prefix + entry.CreateCommand); } if (CreateWorldData.CreateTable.ContainsKey(entry.checkId)) { CreateWorldData.CreateTable[sel] = true; } } break; case CreateWorld.GumpType.Delete: if (!String.IsNullOrEmpty(entry.DeleteCommand)) { from.Say("Deleting " + entry.Name); CommandSystem.Handle(from, prefix + entry.DeleteCommand); if (CreateWorldData.CreateTable.ContainsKey(entry.checkId)) { CreateWorldData.CreateTable[sel] = false; } } break; case CreateWorld.GumpType.Recreate: if (!String.IsNullOrEmpty(entry.DeleteCommand)) { from.Say("Recreating " + entry.Name); CommandSystem.Handle(from, prefix + entry.DeleteCommand); CommandSystem.Handle(from, prefix + entry.CreateCommand); if (CreateWorldData.CreateTable.ContainsKey(entry.checkId)) { CreateWorldData.CreateTable[sel] = true; } } break; } } } } World.Broadcast(0x35, false, "World generation complete."); }
private static void DecorateDeleteHSsecondAge_OnCommand(CommandEventArgs e) { string prefix = Server.Commands.CommandSystem.Prefix; CommandSystem.Handle(e.Mobile, String.Format("{0}DecorateDeleteHSfirstAge", prefix)); }
public static void DoCommands(int[] selections, GumpType type, Mobile from) { World.Broadcast(0x35, false, "The world is generating. This may take some time..."); string prefix = CommandSystem.Prefix; string error = null; WorldCreating = true; foreach (int sel in selections) { foreach (CommandEntry entry in Commands) { if (entry.CheckID == sel) { switch (type) { case GumpType.Create: from.Say("Generating " + entry.Name); if (CanGenerate(entry, ref error)) { if (entry.Delay > 0) { DoDelayedCommand(from, TimeSpan.FromMinutes(entry.Delay), prefix + entry.CreateCommand); } else { CommandSystem.Handle(from, prefix + entry.CreateCommand); } if (CreateWorldData.CreateTable.ContainsKey(sel)) { CreateWorldData.CreateTable[sel] = true; } } break; case GumpType.Delete: if (!string.IsNullOrEmpty(entry.DeleteCommand)) { from.Say("Deleting " + entry.Name); CommandSystem.Handle(from, prefix + entry.DeleteCommand); if (CreateWorldData.CreateTable.ContainsKey(sel)) { CreateWorldData.CreateTable[sel] = false; } } break; } } } } if (error != null) { from.SendGump(new BasicInfoGump(error, "World Generation Error")); } WorldCreating = false; World.Broadcast(0x35, false, "World generation complete."); }