public static void Animate_OnCommand( CommandEventArgs e ) { if ( e.Length == 6 ) { e.Mobile.Animate( e.GetInt32( 0 ), e.GetInt32( 1 ), e.GetInt32( 2 ), e.GetBoolean( 3 ), e.GetBoolean( 4 ), e.GetInt32( 5 ) ); } else { e.Mobile.SendMessage( "Format: Animate <action> <frameCount> <repeatCount> <forward> <repeat> <delay>" ); } }
private static void NudgeSelfUp_OnCommand( CommandEventArgs e ) { if(e.Arguments.Length > 0) { int zoffset = e.GetInt32(0); e.Mobile.Location = new Point3D(e.Mobile.Location, e.Mobile.Location.Z + zoffset); } }
private static void Light_OnCommand( CommandEventArgs e ) { if ( e.Length >= 1 ) { LevelOverride = e.GetInt32( 0 ); e.Mobile.SendMessage( "Global light level override has been changed to {0}.", m_LevelOverride ); } else { LevelOverride = int.MinValue; e.Mobile.SendMessage( "Global light level override has been cleared." ); } }
private static void Light_OnCommand(CommandEventArgs e) { if (e.Length >= 1) { LevelOverride = e.GetInt32(0); e.Mobile.SendMessage("Global light level override has been changed to {0}.", m_LevelOverride); } else { LevelOverride = int.MinValue; e.Mobile.SendMessage("Global light level override has been cleared."); } }
private static void PrintMessage_OnCommand(CommandEventArgs arg) { Mobile from = arg.Mobile; if (arg.Length <= 0) { from.SendMessage("Usage: PrintMessage <msg_number>"); return; } // What message do we print int message = arg.GetInt32(0); from.SendLocalizedMessage(message); from.SendMessage("Done."); }
public static void DupeMS_OnCommand( CommandEventArgs e ) { Mobile from = e.Mobile; int count = 1; try { count = e.GetInt32( 0 ); } catch{} if( count <= 0 ) count = 1; from.Target = new InternalTarget( count ); }
public override void Execute( CommandEventArgs e ) { if ( e.Length >= 2 ) { Serial serial = e.GetInt32( 0 ); object obj = null; if ( serial.IsItem ) obj = World.FindItem( serial ); else if ( serial.IsMobile ) obj = World.FindMobile( serial ); if ( obj == null ) { e.Mobile.SendMessage( "That is not a valid serial." ); } else { BaseCommand command = null; Commands.TryGetValue( e.GetString( 1 ), out command ); 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 - 2]; for ( int i = 0; i < args.Length; ++i ) args[i] = oldArgs[i + 2]; RunCommand( e.Mobile, obj, command, args ); } } } else { e.Mobile.SendMessage( "You must supply an object serial and a command name." ); } }
private static void Props_OnCommand( CommandEventArgs e ) { if ( e.Length == 1 ) { IEntity ent = World.FindEntity( e.GetInt32( 0 ) ); if ( ent == null ) e.Mobile.SendMessage( "No object with that serial was found." ); else if ( !BaseCommand.IsAccessible( e.Mobile, ent ) ) e.Mobile.SendMessage( "That is not accessible." ); else e.Mobile.SendGump( new PropertiesGump( e.Mobile, ent ) ); } else { e.Mobile.Target = new PropsTarget( true ); } }
private static void FindSkill_OnCommand(CommandEventArgs arg) { Mobile from = arg.Mobile; SkillName skill; // Init elapsed with 2nd of arguments passed to command int elapsed = arg.GetInt32(1); // Test the skill argument input to make sure it's valid try { // Try to set var holding skill arg to enum equivalent skill = (SkillName)Enum.Parse(typeof(SkillName), arg.GetString(0), true); } catch { // Skill not valid, return without performing mob search from.SendMessage("You have specified an invalid skill."); return; } ArrayList MobsMatched = FindSkillMobs(skill, elapsed); if (MobsMatched.Count > 0) { // Found some, so loop and display foreach (PlayerMobile pm in MobsMatched) { if (!pm.Hidden || from.AccessLevel > pm.AccessLevel || pm == from) from.SendMessage("{0}, x:{1}, y:{2}, z:{3}", pm.Name, pm.Location.X, pm.Location.Y, pm.Location.Z); } } else { // Found none, so inform. from.SendMessage("Nobody online has used that skill recently."); } }
private static void SplashGold_OnCommand(CommandEventArgs e) { int amount = 1; if (e.Length >= 1) amount = e.GetInt32(0); if (amount < 100) { e.Mobile.SendMessage("Splash at least 100 gold."); } else if (amount > 2800000) { e.Mobile.SendMessage("Amount exceeded. Use an amount less than 2800000."); } else { e.Mobile.Target = new SplashTarget(amount > 0 ? amount : 1); e.Mobile.SendMessage("Where do you want the center of the gold splash to be?"); } }
public override void Execute( CommandEventArgs e ) { if ( e.Length >= 2 ) { int range = e.GetInt32( 0 ); if ( range < 0 ) { e.Mobile.SendMessage( "The range must not be negative." ); } else { BaseCommand command = null; Commands.TryGetValue( e.GetString( 1 ), out command ); 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 - 2]; for ( int i = 0; i < args.Length; ++i ) args[i] = oldArgs[i + 2]; Process( range, e.Mobile, command, args ); } } } else { e.Mobile.SendMessage( "You must supply a range and a command name." ); } }
public static void FactionStartScheduleInXMinutes(CommandEventArgs arg) { PlayerMobile pm_Mobile = arg.Mobile as PlayerMobile; if (pm_Mobile == null) { return; } if (arg.Length == 1) { try { int minutes = arg.GetInt32(0); if (minutes <= 0) { pm_Mobile.SendMessage("Minutes must be more than 0."); return; } CurrentEventPosition = 1; CurrentCyclePosition = 1; NextScheduledCaptureEventStartTime = DateTime.UtcNow + TimeSpan.FromMinutes(minutes) + EventsInCycle[0]; } catch { pm_Mobile.SendMessage("Error in arguments. Usage: [FactionStartScheduleInXMinutes minutes"); return; } } pm_Mobile.SendMessage("Current DateTime: " + DateTime.UtcNow.ToString()); pm_Mobile.SendMessage("Faction Schedule set to start at: " + NextScheduledCaptureEventStartTime.ToString()); }
public static void GrantTownSilver_OnCommand( CommandEventArgs e ) { Town town = FromRegion( e.Mobile.Region ); if ( town == null ) { e.Mobile.SendMessage( "You are not in a faction town." ); } else if ( e.Length == 0 ) { e.Mobile.SendMessage( "Format: GrantTownSilver <amount>" ); } else { town.Silver += e.GetInt32( 0 ); e.Mobile.SendMessage( "You have granted {0:N0} silver to the town. It now has {1:N0} silver.", e.GetInt32( 0 ), town.Silver ); } }
public override void Execute( CommandEventArgs e, object obj ) { Mobile from = e.Mobile; Mobile to = obj as Mobile; if ( e.Length == 0 ) { GoGump.DisplayTo( from, to ); return; } else if ( e.Length == 1 ) { try { int ser = e.GetInt32( 0 ); IEntity ent = World.FindEntity( ser ); if ( ent is Item ) { Item item = (Item)ent; Map map = item.Map; Point3D loc = item.GetWorldLocation(); Mobile owner = item.RootParent as Mobile; if( owner != null && (owner.Map != null && owner.Map != Map.Internal) && !BaseCommand.IsAccessible( from, owner ) /* !from.CanSee( owner )*/ ) from.SendMessage( "You can not go to what you can not see." ); else if ( owner != null && (owner.Map == null || owner.Map == Map.Internal) && owner.Hidden && owner.AccessLevel >= from.AccessLevel ) from.SendMessage( "You can not go to what you can not see." ); else if ( !FixMap( ref map, ref loc, item ) ) from.SendMessage( "That is an internal item and you cannot go to it." ); else to.MoveToWorld( loc, map ); return; } else if ( ent is Mobile ) { Mobile m = (Mobile)ent; Map map = m.Map; Point3D loc = m.Location; Mobile owner = m; if ( owner != null && (owner.Map != null && owner.Map != Map.Internal) && !BaseCommand.IsAccessible( from, owner ) /* !from.CanSee( owner )*/ ) from.SendMessage( "You can not go to what you can not see." ); else if ( owner != null && (owner.Map == null || owner.Map == Map.Internal) && owner.Hidden && owner.AccessLevel >= from.AccessLevel ) from.SendMessage( "You can not go to what you can not see." ); else if ( !FixMap( ref map, ref loc, m ) ) from.SendMessage( "That is an internal mobile and you cannot go to it." ); else to.MoveToWorld( loc, map ); return; } else { string name = e.GetString( 0 ); Map map; for ( int i = 0; i < Map.AllMaps.Count; ++i ) { map = Map.AllMaps[i]; if ( map.MapIndex == 0x7F || map.MapIndex == 0xFF ) continue; if ( Insensitive.Equals( name, map.Name ) ) { to.Map = map; return; } } Dictionary<string, Region> list = to.Map.Regions; foreach( KeyValuePair<string, Region> kvp in list ) { Region r = kvp.Value; if ( Insensitive.Equals( r.Name, name ) ) { to.Location = new Point3D( r.GoLocation ); return; } } for( int i = 0; i < Map.AllMaps.Count; ++i ) { Map m = Map.AllMaps[i]; if( m.MapIndex == 0x7F || m.MapIndex == 0xFF || from.Map == m ) continue; foreach( Region r in m.Regions.Values ) { if( Insensitive.Equals( r.Name, name ) ) { to.MoveToWorld( r.GoLocation, m ); return; } } } if ( ser != 0 ) from.SendMessage( "No object with that serial was found." ); else from.SendMessage( "No region with that name was found." ); return; } } catch { } from.SendMessage( "Region name not found" ); } else if ( e.Length == 2 || e.Length == 3 ) { Map map = from.Map; if ( map != null ) { try { /* * This to avoid being teleported to (0,0) if trying to teleport * to a region with spaces in its name. */ int x = int.Parse( e.GetString( 0 ) ); int y = int.Parse( e.GetString( 1 ) ); int z = (e.Length == 3 ) ? int.Parse( e.GetString( 2 ) ) : map.GetAverageZ( x, y ); to.Location = new Point3D( x, y, z ); } catch { from.SendMessage( "Region name not found." ); } } } else if ( e.Length == 6 ) { Map map = from.Map; if ( map != null ) { Point3D p = Sextant.ReverseLookup( map, e.GetInt32( 3 ), e.GetInt32( 0 ), e.GetInt32( 4 ), e.GetInt32( 1 ), Insensitive.Equals( e.GetString( 5 ), "E" ), Insensitive.Equals( e.GetString( 2 ), "S" ) ); if ( p != Point3D.Zero ) to.Location = p; else from.SendMessage( "Sextant reverse lookup failed." ); } } else { from.SendMessage( "Format: Go [name | serial | (x y [z]) | (deg min (N | S) deg min (E | W)]" ); } }
public static void Sound_OnCommand(CommandEventArgs e) { if (e.Length == 1) PlaySound(e.Mobile, e.GetInt32(0), true); else if (e.Length == 2) PlaySound(e.Mobile, e.GetInt32(0), e.GetBoolean(1)); else e.Mobile.SendMessage("Format: Sound <index> [toAll]"); }
public static void Light_OnCommand(CommandEventArgs e) { e.Mobile.LightLevel = e.GetInt32(0); }
private static void Go_OnCommand(CommandEventArgs e) { Mobile from = e.Mobile; if (e.Length == 0) { GoGump.DisplayTo(from); } else if (e.Length == 1) { try { int ser = e.GetInt32(0); IEntity ent = World.FindEntity(ser); if (ent is Item) { Item item = (Item)ent; Map map = item.Map; Point3D loc = item.GetWorldLocation(); Mobile owner = item.RootParent as Mobile; if (owner != null && (owner.Map != null && owner.Map != Map.Internal) && !from.CanSee(owner)) { from.SendMessage("You can not go to what you can not see."); return; } else if (owner != null && (owner.Map == null || owner.Map == Map.Internal) && owner.Hidden && owner.AccessLevel >= from.AccessLevel) { from.SendMessage("You can not go to what you can not see."); return; } else if (!FixMap(ref map, ref loc, item)) { from.SendMessage("That is an internal item and you cannot go to it."); return; } from.MoveToWorld(loc, map); return; } else if (ent is Mobile) { Mobile m = (Mobile)ent; Map map = m.Map; Point3D loc = m.Location; Mobile owner = m; if (owner != null && (owner.Map != null && owner.Map != Map.Internal) && !from.CanSee(owner)) { from.SendMessage("You can not go to what you can not see."); return; } else if (owner != null && (owner.Map == null || owner.Map == Map.Internal) && owner.Hidden && owner.AccessLevel >= from.AccessLevel) { from.SendMessage("You can not go to what you can not see."); return; } else if (!FixMap(ref map, ref loc, m)) { from.SendMessage("That is an internal mobile and you cannot go to it."); return; } from.MoveToWorld(loc, map); return; } else { string name = e.GetString(0); ArrayList list = from.Map.Regions; for (int i = 0; i < list.Count; ++i) { Region r = (Region)list[i]; if (Insensitive.Equals(r.Name, name)) { from.Location = new Point3D(r.GoLocation); return; } } if (ser != 0) from.SendMessage("No object with that serial was found."); else from.SendMessage("No region with that name was found."); return; } } catch (Exception ex) { EventSink.InvokeLogException(new LogExceptionEventArgs(ex)); } from.SendMessage("Region name not found"); } else if (e.Length == 2) { Map map = from.Map; if (map != null) { int x = e.GetInt32(0), y = e.GetInt32(1); int z = map.GetAverageZ(x, y); from.Location = new Point3D(x, y, z); } } else if (e.Length == 3) { from.Location = new Point3D(e.GetInt32(0), e.GetInt32(1), e.GetInt32(2)); } else if (e.Length == 6) { Map map = from.Map; if (map != null) { Point3D p = Sextant.ReverseLookup(map, e.GetInt32(3), e.GetInt32(0), e.GetInt32(4), e.GetInt32(1), Insensitive.Equals(e.GetString(5), "E"), Insensitive.Equals(e.GetString(2), "S")); if (p != Point3D.Zero) from.Location = p; else from.SendMessage("Sextant reverse lookup failed."); } } else { from.SendMessage("Format: Go [name | serial | (x y [z]) | (deg min (N | S) deg min (E | W)]"); } }
public static void TileZ_OnCommand(CommandEventArgs e) { if (e.Length >= 2) { string[] subArgs = new string[e.Length - 1]; for (int i = 0; i < subArgs.Length; ++i) subArgs[i] = e.Arguments[i + 1]; BoundingBoxPicker.Begin(e.Mobile, new BoundingBoxCallback(TileBox_Callback), new TileState(e.GetInt32(0), subArgs)); } else { e.Mobile.SendMessage("Format: TileZ <z> <type> [params] [set {<propertyName> <value> ...}]"); } }
public static void AcquireRare_OnCommand(CommandEventArgs e) { try { if (e.Length != 1 && e.Length != 2) { e.Mobile.SendMessage("Incorrect number of arguments. Format : [acquirerare (<rare level>) <rare group name>"); return; } Regex ValidRarityPatt = new Regex("^[0-9]$"); if (!ValidRarityPatt.IsMatch(e.GetString(0))) { // Invalid e.Mobile.SendMessage("You may only enter an number to represent a rarity level. Format : [acquirerare (<rare level>) <rare group name>"); return; } int iRarity = e.GetInt32(0); // Check rarity level is ok if (iRarity < 0 || iRarity > 10) { // Invalid e.Mobile.SendMessage("Item rarity is scaled from 0 (most common) to 10 (most rare)."); return; } e.Mobile.Backpack.AddItem( (e.Length == 1 ? RareFactory.AcquireRare((short)iRarity) // only have rarity : RareFactory.AcquireRare((short)iRarity, e.GetString(1)) // rarity + group )); } catch (Exception ex) { LogHelper.LogException(ex); e.Mobile.SendMessage(ex.Message); } }
private static void SpawnEditorGo_OnCommand(CommandEventArgs e) { if (e == null) return; Mobile from = e.Mobile; // Make sure a map name was given at least if (from != null && e.Length >= 1) { // Get the map Map NewMap = null; string MapName = e.Arguments[0]; // Convert the xml map value to a real map object if (string.Compare(MapName, Map.Trammel.Name, true) == 0) NewMap = Map.Trammel; else if (string.Compare(MapName, Map.Felucca.Name, true) == 0) NewMap = Map.Felucca; else if (string.Compare(MapName, Map.Ilshenar.Name, true) == 0) NewMap = Map.Ilshenar; else if (string.Compare(MapName, Map.Malas.Name, true) == 0) NewMap = Map.Malas; else if (string.Compare(MapName, Map.Tokuno.Name, true) == 0) NewMap = Map.Tokuno; else { from.SendMessage("Map '{0}' does not exist!", MapName); return; } // Now that the map has been determined, continue // Check if the request is to simply change maps if (e.Length == 1) { // Map Change ONLY from.Map = NewMap; } else if (e.Length == 3) { // Map & X Y ONLY if (NewMap != null) { int x = e.GetInt32(1); int y = e.GetInt32(2); int z = NewMap.GetAverageZ(x, y); from.Map = NewMap; from.Location = new Point3D(x, y, z); } } else if (e.Length == 4) { // Map & X Y Z from.Map = NewMap; from.Location = new Point3D(e.GetInt32(1), e.GetInt32(2), e.GetInt32(3)); } else { from.SendMessage("Format: XmlGo <map> | <map> <x> <y> [z]"); } } }
public static void AthiFindIt_OnCommand(CommandEventArgs e) { if ( e.Length == 1 ) { int serial = e.GetInt32( 0 ); Item item = World.FindItem(serial); Mobile mobil = World.FindMobile(serial); if (item != null) { object root = item.RootParent; if (root is Mobile) e.Mobile.SendMessage("{0} [{1}]: {2} ({3})", item.GetWorldLocation(), item.Map, root.GetType().Name, ((Mobile)root).Name); else e.Mobile.SendMessage("{0} [{1}]: {2}", item.GetWorldLocation(), item.Map, root == null ? "(null)" : root.GetType().Name); } else if (mobil != null) { e.Mobile.SendMessage("{0} [{1}]: {2} ", mobil.Location, mobil.Map, mobil.Name); } else e.Mobile.SendMessage("There are no item/mobile with this serial number"); } else if( e.Length == 2) { int serial = e.GetInt32(0); string property = e.GetString(1); Item item = World.FindItem(serial); if (item != null) switch (property) { case "get": { object root = item.RootParent; if (root is Mobile) e.Mobile.SendMessage("{0} [{1}]: {2} ({3})", item.GetWorldLocation(), item.Map, root.GetType().Name, ((Mobile)root).Name); else e.Mobile.SendMessage("{0} [{1}]: {2}", item.GetWorldLocation(), item.Map, root == null ? "(null)" : root.GetType().Name); if (e.Mobile.PlaceInBackpack(item)) e.Mobile.SendMessage("The item has been placed in your backpack."); else e.Mobile.SendMessage("Your backpack could not hold the item."); break; } case "go": { object root = item.RootParent; if (root is Mobile) { e.Mobile.SendMessage("{0} [{1}]: {2} ({3})", item.GetWorldLocation(), item.Map, root.GetType().Name, ((Mobile)root).Name); e.Mobile.MoveToWorld(((Mobile)root).Location, ((Mobile)root).Map); } else { e.Mobile.SendMessage("{0} [{1}]: {2}", item.GetWorldLocation(), item.Map, root == null ? "(null)" : root.GetType().Name); e.Mobile.MoveToWorld(item.GetWorldLocation(), item.Map); } e.Mobile.SendMessage("You have been teleported to the item's Location"); break; } case "del": { object root = item.RootParent; if (root is Mobile) e.Mobile.SendMessage("{0} [{1}]: {2} ({3})", item.GetWorldLocation(), item.Map, root.GetType().Name, ((Mobile)root).Name); else e.Mobile.SendMessage("{0} [{1}]: {2}", item.GetWorldLocation(), item.Map, root == null ? "(null)" : root.GetType().Name); item.Delete(); e.Mobile.SendMessage("Item has been deleted."); break; } default: { e.Mobile.SendMessage("Wrong Parameter try [go/get/del]"); break; } } else e.Mobile.SendMessage("There is no item with this serial number"); } else if (e.Length == 3 && e.GetString(2) == "mobile") { int serial = e.GetInt32(0); string property = e.GetString(1); Mobile mobil = World.FindMobile(serial); if (mobil != null) switch (property) { case "get": { e.Mobile.SendMessage("{0} [{1}]: {2} ", mobil.Location, mobil.Map, mobil.Name); if (mobil is IMount) if (((BaseMount)mobil).Rider != null) { Mobiles.BaseMount.Dismount(((BaseMount)mobil).Rider); } mobil.MoveToWorld(e.Mobile.Location, e.Mobile.Map); e.Mobile.SendMessage("The mobile has been found and moved to you"); break; } case "go": { e.Mobile.SendMessage("{0} [{1}]: {2} ", mobil.Location, mobil.Map, mobil.Name); if (mobil is IMount) if (((BaseMount)mobil).Rider != null) { Mobiles.BaseMount.Dismount(((BaseMount)mobil).Rider); } e.Mobile.MoveToWorld(mobil.Location, mobil.Map); e.Mobile.SendMessage("You have been teleported to the mobile's Location"); break; } case "del": { if (mobil is PlayerMobile) { e.Mobile.SendMessage("You can not delete Players with this command"); } else { mobil.Delete(); e.Mobile.SendMessage("Mobile has been deleted."); } break; } default: { e.Mobile.SendMessage("Wrong Parameter try [go/get/del]"); break; } } else e.Mobile.SendMessage("There is no mobile with this serial number"); } else { e.Mobile.SendMessage("Format: AthiFindIt <serial int32> [go/get/del] [mobile]"); } }
public override void Execute( CommandEventArgs e, object obj ) { Mobile from = e.Mobile; if ( e.Length == 1 ) { int index = e.GetInt32( 0 ); Mobile mob = (Mobile)obj; CommandLogging.WriteLine( from, "{0} {1} playing sound {2} for {3}", from.AccessLevel, CommandLogging.Format( from ), index, CommandLogging.Format( mob ) ); mob.Send( new PlaySound( index, mob.Location ) ); } else { from.SendMessage( "Format: PrivSound <index>" ); } }
public static void TileXYZ_OnCommand(CommandEventArgs e) { if (e.Length >= 6) { Point3D p = new Point3D(e.GetInt32(0), e.GetInt32(1), e.GetInt32(4)); Point3D p2 = new Point3D(p.X + e.GetInt32(2) - 1, p.Y + e.GetInt32(3) - 1, e.GetInt32(4)); string[] subArgs = new string[e.Length - 5]; for (int i = 0; i < subArgs.Length; ++i) subArgs[i] = e.Arguments[i + 5]; Add.Invoke(e.Mobile, p, p2, subArgs); } else { e.Mobile.SendMessage("Format: TileXYZ <x> <y> <w> <h> <z> <type> [params] [set {<propertyName> <value> ...}]"); } }