public static void ClearLOS_OnCommand(Server.Commands.CommandEventArgs args) { for (int i = 0x7FFF0000; i < 0x7FFFFE00; i++) { args.Mobile.Send(new RemoveLOSPacket(i)); } }
public virtual void ExecuteList(Server.Commands.CommandEventArgs e, ArrayList list) { for (int i = 0; i < list.Count; ++i) { Execute(e, list[i]); } }
public override void Execute(Server.Commands.CommandEventArgs e, object obj) { Mobile m = (Mobile)obj; CommandLogging.WriteLine(e.Mobile, "{0} {1} {2} {3}", e.Mobile.AccessLevel, CommandLogging.Format(e.Mobile), m_Value ? "hiding" : "unhiding", CommandLogging.Format(m)); /*Effects.SendLocationEffect( new Point3D( m.X + 1, m.Y, m.Z + 4 ), m.Map, 0x3728, 13 ); * Effects.SendLocationEffect( new Point3D( m.X + 1, m.Y, m.Z ), m.Map, 0x3728, 13 ); * Effects.SendLocationEffect( new Point3D( m.X + 1, m.Y, m.Z - 4 ), m.Map, 0x3728, 13 ); * Effects.SendLocationEffect( new Point3D( m.X, m.Y + 1, m.Z + 4 ), m.Map, 0x3728, 13 ); * Effects.SendLocationEffect( new Point3D( m.X, m.Y + 1, m.Z ), m.Map, 0x3728, 13 ); * Effects.SendLocationEffect( new Point3D( m.X, m.Y + 1, m.Z - 4 ), m.Map, 0x3728, 13 ); * * Effects.SendLocationEffect( new Point3D( m.X + 1, m.Y + 1, m.Z + 11 ), m.Map, 0x3728, 13 ); * Effects.SendLocationEffect( new Point3D( m.X + 1, m.Y + 1, m.Z + 7 ), m.Map, 0x3728, 13 ); * Effects.SendLocationEffect( new Point3D( m.X + 1, m.Y + 1, m.Z + 3 ), m.Map, 0x3728, 13 ); * Effects.SendLocationEffect( new Point3D( m.X + 1, m.Y + 1, m.Z - 1 ), m.Map, 0x3728, 13 ); * * m.PlaySound( 0x228 );*/ m.Hidden = m_Value; if (m_Value) { AddResponse("They have been hidden."); } else { AddResponse("They have been revealed."); } }
public virtual void Execute(Server.Commands.CommandEventArgs e) { if (e.Length >= 1) { BaseCommand command = (BaseCommand)m_Commands[e.GetString(0)]; if (command == null) { e.Mobile.SendMessage("That is either an invalid command name or one that does not support this modifier."); } else if (e.Mobile.AccessLevel < command.AccessLevel) { e.Mobile.SendMessage("You do not have access to that command."); } else { string[] oldArgs = e.Arguments; string[] args = new string[oldArgs.Length - 1]; for (int i = 0; i < args.Length; ++i) { args[i] = oldArgs[i + 1]; } Process(e.Mobile, command, args); } } else { e.Mobile.SendMessage("You must supply a command name."); } }
public override void Execute(Server.Commands.CommandEventArgs e, object obj) { Mobile from = e.Mobile; Mobile targ = (Mobile)obj; NetState state = targ.NetState; if (state != null) { CommandLogging.WriteLine(from, "{0} {1} firewalling {2}", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(targ)); try { Firewall.Add(((IPEndPoint)state.Socket.RemoteEndPoint).Address); AddResponse("They have been firewalled."); } catch (Exception ex) { LogFailure(ex.Message); } } else { LogFailure("They are not online."); } }
private void OnConfirmCallback(Mobile from, bool okay, object state) { object[] states = (object[])state; Server.Commands.CommandEventArgs e = (Server.Commands.CommandEventArgs)states[0]; ArrayList list = (ArrayList)states[1]; bool flushToLog = false; if (okay) { AddResponse("Delete command confirmed."); if (list.Count > 20) { CommandLogging.Enabled = false; } base.ExecuteList(e, list); if (list.Count > 20) { flushToLog = true; CommandLogging.Enabled = true; } } else { AddResponse("Delete command aborted."); } Flush(from, flushToLog); }
public override bool ValidateArgs(BaseCommandImplementor impl, Server.Commands.CommandEventArgs e) { if (e.Length >= 1) { Type t = ScriptCompiler.FindTypeByName(e.GetString(0)); if (t == null) { e.Mobile.SendMessage("No type with that name was found."); string match = e.GetString(0).Trim(); if (match.Length < 3) { e.Mobile.SendMessage("Invalid search string."); e.Mobile.SendGump(new Server.Gumps.AddGump(e.Mobile, match, 0, Type.EmptyTypes, false)); } else { e.Mobile.SendGump(new Server.Gumps.AddGump(e.Mobile, match, 0, (Type[])Server.Gumps.AddGump.Match(match).ToArray(typeof(Type)), true)); } } else { return(true); } } else { e.Mobile.SendGump(new Server.Gumps.CategorizedAddGump(e.Mobile)); } return(false); }
public override void Execute(Server.Commands.CommandEventArgs e, object obj) { IPoint3D p = obj as IPoint3D; if (p == null) { return; } Mobile from = e.Mobile; SpellHelper.GetSurfaceTop(ref p); CommandLogging.WriteLine(from, "{0} {1} teleporting to {2}", from.AccessLevel, CommandLogging.Format(from), new Point3D(p)); Point3D fromLoc = from.Location; Point3D toLoc = new Point3D(p); from.Location = toLoc; from.ProcessDelta(); if (!from.Hidden) { Effects.SendLocationParticles(EffectItem.Create(fromLoc, from.Map, EffectItem.DefaultDuration), 0x3728, 10, 10, 2023); Effects.SendLocationParticles(EffectItem.Create(toLoc, from.Map, EffectItem.DefaultDuration), 0x3728, 10, 10, 5023); from.PlaySound(0x1FE); } }
public override void Execute(Server.Commands.CommandEventArgs e, object obj) { if (e.Length == 1) { Mobile mob = (Mobile)obj; Mobile from = e.Mobile; if (mob.Player) { NetState ns = mob.NetState; if (ns == null) { LogFailure("That player is not online."); } else { string url = e.GetString(0); CommandLogging.WriteLine(from, "{0} {1} requesting to open web browser of {2} to {3}", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(mob), url); AddResponse("Awaiting user confirmation..."); mob.SendGump(new WarningGump(1060637, 30720, String.Format("A game master is requesting to open your web browser to the following URL:<br>{0}", url), 0xFFC000, 320, 240, new WarningGumpCallback(OpenBrowser_Callback), new object[] { from, url })); } } else { LogFailure("That is not a player."); } } else { LogFailure("Format: OpenBrowser <url>"); } }
public override void ExecuteList(Server.Commands.CommandEventArgs e, ArrayList list) { ArrayList packs = new ArrayList(list.Count); for (int i = 0; i < list.Count; ++i) { object obj = list[i]; Container cont = null; if (obj is Mobile) { cont = ((Mobile)obj).Backpack; } else if (obj is Container) { cont = (Container)obj; } if (cont != null) { packs.Add(cont); } else { LogFailure("That is not a container."); } } Add.Invoke(e.Mobile, e.Mobile.Location, e.Mobile.Location, e.Arguments, packs); }
public static void FindRunes_OnCommand(Server.Commands.CommandEventArgs e) { foreach (Item item in World.Items.Values) { if (item is RecallRune) { RecallRune rune = (RecallRune)item; if (rune.Marked && rune.TargetMap != null && IsBad(rune.Target, rune.TargetMap)) { object root = item.RootParent; if (root is Mobile) { if (((Mobile)root).AccessLevel < AccessLevel.GameMaster) { e.Mobile.SendAsciiMessage("Rune: '{4}' {0} [{1}]: {2} ({3})", item.GetWorldLocation(), item.Map, root.GetType().Name, ((Mobile)root).Name, rune.Description); } } else { e.Mobile.SendAsciiMessage("Rune: '{3}' {0} [{1}]: {2}", item.GetWorldLocation(), item.Map, root == null ? "(null)" : root.GetType().Name, rune.Description); } } } } }
public static void FindByName_OnCommand(Server.Commands.CommandEventArgs e) { if (e.Length == 1) { string name = e.GetString(0).ToLower(); foreach (Item item in World.Items.Values) { if (item.Name != null && item.Name.ToLower().IndexOf(name) >= 0) { object root = item.RootParent; if (root is Mobile) { e.Mobile.SendAsciiMessage("{0} [{1}]: {2} ({3})", item.GetWorldLocation(), item.Map, root.GetType().Name, ((Mobile)root).Name); } else { e.Mobile.SendAsciiMessage("{0} [{1}]: {2}", item.GetWorldLocation(), item.Map, root == null ? "(null)" : root.GetType().Name); } } } } else { e.Mobile.SendAsciiMessage("Format: FindByName <name>"); } }
public static void FollowCommand_OnCommand(Server.Commands.CommandEventArgs args) { Mobile m = args.Mobile; Timer t = null; bool foundValue = false; if (m_Table.ContainsKey(m)) { foundValue = m_Table.TryGetValue(m, out t); } if (foundValue || t != null) { if (t != null) { t.Stop(); } if (m_Table.Remove(m)) { m.SendMessage("Follow procedure successfully halted."); } } else { m.SendMessage("Select the mobile to begin following."); m.Target = new InternalTarget(m_Table); } }
public static void RebuildCategorization_OnCommand(Server.Commands.CommandEventArgs e) { CategoryEntry root = new CategoryEntry(null, "Add Menu", new CategoryEntry[] { Items, Mobiles }); Export(root, "Data/objects.xml", "Objects"); e.Mobile.SendMessage("Categorization menu rebuilt."); }
public static void Vis_OnCommand(Server.Commands.CommandEventArgs e) { if (e.Mobile is PlayerMobile) { e.Mobile.Target = new VisTarget(); e.Mobile.SendMessage("Select person to add or remove from your visibility list."); } }
public override void Execute(Server.Commands.CommandEventArgs e, object obj) { Mobile mob = (Mobile)obj; Mobile from = e.Mobile; if (m_Value) { if (!mob.Alive) { LogFailure("They are already dead."); } else if (!mob.CanBeDamaged()) { LogFailure("They cannot be harmed."); } else { CommandLogging.WriteLine(from, "{0} {1} killing {2}", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(mob)); mob.Kill(); AddResponse("They have been killed."); } } else { if (mob.IsDeadBondedPet) { BaseCreature bc = mob as BaseCreature; if (bc != null) { CommandLogging.WriteLine(from, "{0} {1} resurrecting {2}", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(mob)); bc.PlaySound(0x214); bc.FixedEffect(0x376A, 10, 16); bc.ResurrectPet(); AddResponse("It has been resurrected."); } } else if (!mob.Alive) { CommandLogging.WriteLine(from, "{0} {1} resurrecting {2}", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(mob)); mob.PlaySound(0x214); mob.FixedEffect(0x376A, 10, 16); mob.Resurrect(); AddResponse("They have been resurrected."); } else { LogFailure("They are not dead."); } } }
public static void ClearGuildListeners_OnCommand(Server.Commands.CommandEventArgs args) { if (_table.ContainsKey(args.Mobile)) { _table.Remove(args.Mobile); } args.Mobile.SendMessage("You are no longer listening to any private guild chat."); }
public static void MoonGen_OnCommand(Server.Commands.CommandEventArgs e) { DeleteAll(); int count = 0; count += MoonGen(PMList.Felucca); World.Broadcast(0x35, true, "{0} moongates generated.", count); }
public void RunCommand(Mobile from, object obj, BaseCommand command, string[] args) { try { Server.Commands.CommandEventArgs e = new Server.Commands.CommandEventArgs(from, command.Commands[0], GenerateArgString(args), args); if (!command.ValidateArgs(this, e)) { return; } bool flushToLog = false; if (obj is ArrayList) { ArrayList list = (ArrayList)obj; if (list.Count > 20) { CommandLogging.Enabled = false; } else if (list.Count == 0) { command.LogFailure("Nothing was found to use this command on."); } command.ExecuteList(e, list); if (list.Count > 20) { flushToLog = true; CommandLogging.Enabled = true; } } else if (obj != null) { if (command.ListOptimized) { ArrayList list = new ArrayList(); list.Add(obj); command.ExecuteList(e, list); } else { command.Execute(e, obj); } } command.Flush(from, flushToLog); } catch (Exception ex) { from.SendMessage(ex.Message); } }
public static void ListenToAlliance_OnCommand(Server.Commands.CommandEventArgs args) { args.Mobile.SendMessage("Target an aligned guild member."); args.Mobile.BeginTarget(-1, false, Server.Targeting.TargetFlags.None, delegate(Mobile from, object obj) { if (obj is Mobile) { Mobile m = obj as Mobile; if (m.Guild != null) { Guild g = m.Guild as Guild; if (g != null && g.Alliance != null) { if (_table.ContainsKey(from) && _table[from].Contains(g)) { _table[from].Remove(g); if (_table[from].Count < 1) { _table.Remove(from); } from.SendMessage("You are no longer listening to that alliance\'s private chat."); } else { if (_table.ContainsKey(from)) { _table[from].Add(g); } else { List <Guild> list = new List <Guild>(); list.Add(g); _table.Add(from, list); } from.SendMessage("You are now listening to that alliance\'s private chat."); } } else { from.SendMessage("Their guild is not part of an alliance."); } } else { from.SendMessage("They are not in a guild."); } } }); }
public override void ExecuteList(Server.Commands.CommandEventArgs e, ArrayList list) { if (list.Count > 0) { e.Mobile.SendGump(new InterfaceGump(e.Mobile, list, 0)); } else { AddResponse("No matching objects found."); } }
public override void Execute(Server.Commands.CommandEventArgs e, object obj) { if (obj is HouseSign) { ((HouseSign)obj).RefreshHouse(e.Mobile); } else { LogFailure("That is not a house sign."); } }
public override void ExecuteList(Server.Commands.CommandEventArgs e, ArrayList list) { if (list.Count == 1) { AddResponse("There is one matching object."); } else { AddResponse(String.Format("There are {0} matching objects.", list.Count)); } }
public override void Execute(Server.Commands.CommandEventArgs e, object obj) { Mobile mob = (Mobile)obj; Mobile from = e.Mobile; CommandLogging.WriteLine(from, "{0} {1} telling {2} \"{3}\"", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(mob), e.ArgString); mob.SendMessage(0x35, "{0} tells you: {1}", from.Name, e.ArgString); AddResponse(String.Format("You tell them: {0}", e.ArgString)); }
public static void ValidateName_OnCommand(Server.Commands.CommandEventArgs e) { if (Validate(e.ArgString, 2, 16, true, true, true, 1, SpaceDashPeriodQuote)) { e.Mobile.SendAsciiMessage(0x59, "That name is considered valid."); } else { e.Mobile.SendAsciiMessage(0x22, "That name is considered invalid."); } }
private static void Dupe_OnCommand(Server.Commands.CommandEventArgs e) { int amount = 1; if (e.Length >= 1) { amount = e.GetInt32(0); } e.Mobile.Target = new DupeTarget(false, amount > 0 ? amount : 1); e.Mobile.SendMessage("What do you wish to dupe?"); }
public static void SetAllSkills_OnCommand(Server.Commands.CommandEventArgs arg) { if (arg.Length != 1) { arg.Mobile.SendMessage("SetAllSkills <value>"); } else { arg.Mobile.Target = new AllSkillsTarget(arg.GetDouble(0)); } }
public override void Execute(Server.Commands.CommandEventArgs args, object o) { if (o is AddonComponent) { BaseAddon addon = ((AddonComponent)o).Addon; if (addon.Components.Count > 0) { for (int i = 0; i < addon.Components.Count; i++) { AddonComponent component = (AddonComponent)((addon.Components)[i]); Static newStatic = new Static(component.ItemID); newStatic.Hue = component.Hue; newStatic.MoveToWorld(new Point3D(component.Location), component.Map); } } addon.Delete(); AddResponse("The add-on has been converted to static objects."); } else if (o is Item && !(o is Static)) { Item i = (Item)o; Static newItem = new Static(i.ItemID); newItem.Hue = i.Hue; newItem.Layer = i.Layer; newItem.Light = i.Light; newItem.MoveToWorld(new Point3D(i.Location), i.Map); if (i.Parent == args.Mobile) { newItem.Bounce(args.Mobile); } if (i is Container) { ((Container)i).Destroy(); } else { i.Delete(); } AddResponse("The item has been converted to a static."); } else { LogFailure("This command only works with non-static items or add-ons."); } }
public static void SHTelGen_OnCommand(Server.Commands.CommandEventArgs e) { World.Broadcast(0x35, true, "Solen hives teleporters are being generated, please wait."); DateTime startTime = DateTime.Now; int count = new SHTeleporterCreator().CreateSHTeleporters(); DateTime endTime = DateTime.Now; World.Broadcast(0x35, true, "{0} solen hives teleporters have been created. The entire process took {1:F1} seconds.", count, (endTime - startTime).TotalSeconds); }
public static void Convert_OnCommand(Server.Commands.CommandEventArgs e) { e.Mobile.SendMessage("Converting all players to PlayerMobile. You will be disconnected. Please Restart the server after the world has finished saving."); ArrayList mobs = new ArrayList(World.Mobiles.Values); int count = 0; foreach (Mobile m in mobs) { if (m.Player && !(m is PlayerMobile)) { count++; if (m.NetState != null) { m.NetState.Dispose(); } PlayerMobile pm = new PlayerMobile(m.Serial); pm.DefaultMobileInit(); ArrayList copy = new ArrayList(m.Items); for (int i = 0; i < copy.Count; i++) { pm.AddItem((Item)copy[i]); } CopyProps(pm, m); for (int i = 0; i < m.Skills.Length; i++) { pm.Skills[i].Base = m.Skills[i].Base; pm.Skills[i].SetLockNoRelay(m.Skills[i].Lock); } World.Mobiles[m.Serial] = pm; } } if (count > 0) { NetState.ProcessDisposedQueue(); World.Save(); Console.WriteLine("{0} players have been converted to PlayerMobile. Please restart the server.", count); while (true) { Console.ReadLine(); } } else { e.Mobile.SendMessage("Couldn't find any Players to convert."); } }
public void RunCommand( Mobile from, object obj, BaseCommand command, string[] args ) { try { Server.Commands.CommandEventArgs e = new Server.Commands.CommandEventArgs( from, command.Commands[0], GenerateArgString( args ), args ); if ( !command.ValidateArgs( this, e ) ) return; bool flushToLog = false; if ( obj is ArrayList ) { ArrayList list = (ArrayList)obj; if ( list.Count > 20 ) CommandLogging.Enabled = false; else if ( list.Count == 0 ) command.LogFailure( "Nothing was found to use this command on." ); command.ExecuteList( e, list ); if ( list.Count > 20 ) { flushToLog = true; CommandLogging.Enabled = true; } } else if ( obj != null ) { if ( command.ListOptimized ) { ArrayList list = new ArrayList(); list.Add( obj ); command.ExecuteList( e, list ); } else { command.Execute( e, obj ); } } command.Flush( from, flushToLog ); } catch ( Exception ex ) { from.SendMessage( ex.Message ); } }
public override void ExecuteList( Server.Commands.CommandEventArgs e, ArrayList list ) { if ( list.Count == 0 ) { LogFailure( "Nothing was found to use this command on." ); return; } try { BaseCommand[] commands = new BaseCommand[m_BatchCommands.Count]; Server.Commands.CommandEventArgs[] eventArgs = new Server.Commands.CommandEventArgs[m_BatchCommands.Count]; for ( int i = 0; i < m_BatchCommands.Count; ++i ) { BatchCommand bc = (BatchCommand)m_BatchCommands[i]; string commandString, argString; string[] args; bc.GetDetails( out commandString, out argString, out args ); BaseCommand command = (BaseCommand)m_Scope.Commands[commandString]; commands[i] = command; eventArgs[i] = new Server.Commands.CommandEventArgs( e.Mobile, commandString, argString, args ); if ( command == null ) { e.Mobile.SendMessage( "That is either an invalid command name or one that does not support this modifier: {0}.", commandString ); return; } else if ( e.Mobile.AccessLevel < command.AccessLevel ) { e.Mobile.SendMessage( "You do not have access to that command: {0}.", commandString ); return; } else if ( !command.ValidateArgs( m_Scope, eventArgs[i] ) ) { return; } } for ( int i = 0; i < commands.Length; ++i ) { BaseCommand command = commands[i]; BatchCommand bc = (BatchCommand)m_BatchCommands[i]; if ( list.Count > 20 ) CommandLogging.Enabled = false; ArrayList usedList; if ( Utility.InsensitiveCompare( bc.Object, "Current" ) == 0 ) { usedList = list; } else { Hashtable propertyChains = new Hashtable(); usedList = new ArrayList( list.Count ); for ( int j = 0; j < list.Count; ++j ) { object obj = list[j]; if ( obj == null ) continue; Type type = obj.GetType(); PropertyInfo[] chain = (PropertyInfo[])propertyChains[type]; string failReason = ""; if ( chain == null && !propertyChains.Contains( type ) ) propertyChains[type] = chain = Properties.GetPropertyInfoChain( e.Mobile, type, bc.Object, PropertyAccess.Read, ref failReason ); if ( chain == null ) continue; PropertyInfo endProp = Properties.GetPropertyInfo( ref obj, chain, ref failReason ); if ( endProp == null ) continue; try { obj = endProp.GetValue( obj, null ); if ( obj != null ) usedList.Add( obj ); } catch { } } } command.ExecuteList( eventArgs[i], usedList ); if ( list.Count > 20 ) CommandLogging.Enabled = true; command.Flush( e.Mobile, list.Count > 20 ); } } catch ( Exception ex ) { e.Mobile.SendMessage( ex.Message ); } }