public override bool ValidateArgs( BaseCommandImplementor impl, 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 AddGump( e.Mobile, match, 0, Type.EmptyTypes, false ) ); } else { e.Mobile.SendGump( new AddGump( e.Mobile, match, 0, AddGump.Match( match ).ToArray(), true ) ); } } else { return true; } } else { e.Mobile.SendGump( new CategorizedAddGump( e.Mobile ) ); } return false; }
public override void ExecuteList( CommandEventArgs e, ArrayList list ) { if ( list.Count > 0 ) { List<string> columns = new List<string>(); columns.Add( "Object" ); if ( e.Length > 0 ) { int offset = 0; if ( Insensitive.Equals( e.GetString( 0 ), "view" ) ) ++offset; while ( offset < e.Length ) columns.Add( e.GetString( offset++ ) ); } e.Mobile.SendGump( new InterfaceGump( e.Mobile, columns.ToArray(), list, 0, null ) ); } else { AddResponse( "No matching objects found." ); } }
public static void FindItemByType_OnCommand(CommandEventArgs e) { try { if (e.Length == 1) { LogHelper Logger = new LogHelper("FindItemByType.log", e.Mobile, false); string name = e.GetString(0); foreach (Item item in World.Items.Values) { if (item != null && item.GetType().ToString().ToLower().IndexOf(name.ToLower()) >= 0) { Logger.Log(LogType.Item, item); } } Logger.Finish(); } else { e.Mobile.SendMessage("Format: FindItemByType <type>"); } } catch (Exception ex) { EventSink.InvokeLogException(new LogExceptionEventArgs(ex)); } }
public static void FindMultiByType_OnCommand(CommandEventArgs e) { try { if (e.Length == 1) { LogHelper Logger = new LogHelper("FindMultiByType.log", e.Mobile, false); string name = e.GetString(0); foreach (ArrayList list in Server.Multis.BaseHouse.Multis.Values) { for (int i = 0; i < list.Count; i++) { BaseHouse house = list[i] as BaseHouse; // like Server.Multis.Tower if (house.GetType().ToString().ToLower().IndexOf(name.ToLower()) >= 0) { Logger.Log(house); } } } Logger.Finish(); } else { e.Mobile.SendMessage("Format: FindMultiByType <type>"); } } catch (Exception ex) { EventSink.InvokeLogException(new LogExceptionEventArgs(ex)); } }
public override void Execute( CommandEventArgs e, object obj ) { if ( e.Length < 2 ) LogFailure( "Format: SetPvP <propertyName> <value>" ); else if ( obj is PlayerMobile ) { PlayerMobile from = (PlayerMobile)obj; FSPvpPointSystem.FSPvpSystem.PvpStats ps = FSPvpSystem.GetPvpStats( from ); for ( int i = 0; ( i+1 ) < e.Length; i += 2 ) { string result = Properties.SetValue( e.Mobile, ps, e.GetString( i ), e.GetString( i+1 ) ); if ( result == "Property has been set." ) AddResponse( result ); else LogFailure( result ); } } }
public static void FindItemByID_OnCommand(CommandEventArgs e) { try { if (e.Length == 1) { //erl: LogHelper class handles generic logging functionality LogHelper Logger = new LogHelper("FindItemByID.log", e.Mobile, false); int ItemId = 0; string sx = e.GetString(0).ToLower(); try { if (sx.StartsWith("0x")) { // assume hex sx = sx.Substring(2); ItemId = int.Parse(sx, System.Globalization.NumberStyles.AllowHexSpecifier); } else { // assume decimal ItemId = int.Parse(sx); } } catch { e.Mobile.SendMessage("Format: FindItemByID <ItemID>"); return; } foreach (Item ix in World.Items.Values) { if (ix is Item) if (ix.ItemID == ItemId) { Logger.Log(LogType.Item, ix); } } Logger.Finish(); } else e.Mobile.SendMessage("Format: FindItemByID <ItemID>"); } catch (Exception err) { e.Mobile.SendMessage("Exception: " + err.Message); } e.Mobile.SendMessage("Done."); }
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 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."); } }
public static void FindItemByName_OnCommand(CommandEventArgs e) { if (e.Length == 1) { LogHelper Logger = new LogHelper("FindItemByName.log", e.Mobile, false); string name = e.GetString(0).ToLower(); foreach (Item item in World.Items.Values) if (item.Name != null && item.Name.ToLower().IndexOf(name) >= 0) Logger.Log(LogType.Item, item); Logger.Finish(); } else { e.Mobile.SendMessage("Format: FindItemByName <name>"); } }
public static void SetSkill_OnCommand( CommandEventArgs arg ) { if ( arg.Length != 2 ) { arg.Mobile.SendMessage( "SetSkill <skill name> <value>" ); } else { SkillName skill; try { skill = (SkillName)Enum.Parse( typeof( SkillName ), arg.GetString( 0 ), true ); } catch { arg.Mobile.SendLocalizedMessage( 1005631 ); // You have specified an invalid skill to set. return; } arg.Mobile.Target = new SkillTarget( skill, arg.GetDouble( 1 ) ); } }
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 GetSkill_OnCommand( CommandEventArgs arg ) { if ( arg.Length != 1 ) { arg.Mobile.SendMessage( "GetSkill <skill name>" ); } else { SkillName skill; try { skill = (SkillName)Enum.Parse( typeof( SkillName ), arg.GetString( 0 ), true ); } catch { arg.Mobile.SendAsciiMessage( "You have specified an invalid skill to set." ); // return; } arg.Mobile.Target = new SkillTarget( skill ); } }
public static void ImportSpawners_OnCommand( CommandEventArgs e ) { if ( e.Arguments.Length >= 1 ) { string filename = e.GetString( 0 ); string filePath = Path.Combine( "Saves/Spawners", filename ); if ( File.Exists( filePath ) ) { XmlDocument doc = new XmlDocument(); doc.Load( filePath ); XmlElement root = doc["spawners"]; int successes = 0, failures = 0; foreach ( XmlElement spawner in root.GetElementsByTagName( "spawner" ) ) { try { ImportSpawner( spawner ); successes++; } catch { failures++; } } e.Mobile.SendMessage( "{0} spawners loaded successfully from {1}, {2} failures.", successes, filePath, failures ); } else { e.Mobile.SendMessage( "File {0} does not exist.", filePath ); } } else { e.Mobile.SendMessage( "Usage: [ImportSpawners <filename>" ); } }
public static void FindGuild_OnCommand(CommandEventArgs e) { Guild temp = null; PlayerMobile ptemp = null; if (e.Length == 1) { string name = e.GetString(0).ToLower(); foreach (Item n in World.Items.Values) { if (n is Guildstone && n != null) { if (((Guildstone)n).Guild != null) temp = ((Guildstone)n).Guild; if (temp.Abbreviation.ToLower() == name) { if (n.Parent != null && n.Parent is PlayerMobile) { ptemp = (PlayerMobile)n.Parent; e.Mobile.SendMessage("Guild Stone Found on Mobile {2}:{0}, {1}", ptemp.Name, ptemp.Location, ptemp.Account); } else { e.Mobile.SendMessage("Guild Stone Found {0}", n.Location); } return; } } } e.Mobile.SendMessage("Guild Stone not found in world"); } else { e.Mobile.SendMessage("Format: FindGuild <abbreviation>"); } }
public static void FindChar_OnCommand( CommandEventArgs e ) { if ( e.Length == 1 ) { string name = e.GetString( 0 ).ToLower(); foreach ( Account pm in Accounts.Table.Values ) { if ( pm == null ) return; int index = 0; for ( int i = 0; i < pm.Length; ++i ) { Mobile m = pm[i]; if ( m == null ) continue; if (m.Name.ToLower().IndexOf( name ) >= 0) { e.Mobile.SendMessage( "Character: {0}, Belongs to Account: {1}", m.Name, pm ); } else continue; ++index; } } e.Mobile.SendMessage( "Done."); } else { e.Mobile.SendMessage( "Format: FindChar <name>" ); } }
public static void FindByName_OnCommand( 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.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 { e.Mobile.SendMessage( "Format: FindByName <name>" ); } }
private static void ProTag_OnCommand(CommandEventArgs e) { Mobile m = e.Mobile; if (e.Length == 0) { m.SendMessage("Who do you want to get the ProTags from?"); m.Target = new GetAllProTags(); } else if (e.Length == 1 && e.GetString(0) == "ClearAll") { DeleteAllProTags(m); } else if (e.Length >= 2) { string subcommand = e.GetString(0); string property = e.GetString(1); switch (subcommand.ToLower()) { case "set": if (e.Length == 3) { string value = e.GetString(2); m.SendMessage("Who do you want to set this ProTag?"); m.Target = new SetProTag(property, value); } else { m.SendMessage("Usage: [ProTag Set <property> <value>"); } break; case "get": m.SendMessage("Who do you want to get this ProTag from?"); m.Target = new GetProTag(property); break; case "del": m.SendMessage("Who do you want to delete this ProTag from?"); m.Target = new DelProTag(property); break; default: m.SendMessage("Usage: [ProTag [GET|SET|DEL] <property>"); break; } } else { m.SendMessage("Usage: [ProTag [GET|SET|DEL] <property>"); } }
public static void XmlImportMSF_OnCommand(CommandEventArgs e) { if (e.Arguments.Length >= 1) { /* // I'm not sure what the default location for .msf files is string filename = e.GetString( 0 ); string filePath = Path.Combine( "Data/Megaspawner", filename ); */ string filePath = e.GetString(0); if (File.Exists(filePath)) { XmlDocument doc = new XmlDocument(); doc.Load(filePath); XmlElement root = doc["MegaSpawners"]; if (root != null) { int successes = 0, failures = 0; foreach (XmlElement spawner in root.GetElementsByTagName("MegaSpawner")) { try { ImportMegaSpawner(e.Mobile, spawner); successes++; } catch (Exception ex) { e.Mobile.SendMessage(33, "{0} {1}", ex.Message, spawner.InnerText); failures++; } } e.Mobile.SendMessage("{0} megaspawners loaded successfully from {1}, {2} failures.", successes, filePath, failures); } else { e.Mobile.SendMessage("Invalid .msf file. No MegaSpawners node found"); } } else e.Mobile.SendMessage("File {0} does not exist.", filePath); } else e.Mobile.SendMessage("Usage: [XmlImportMSF <filename>"); }
public override void Execute(CommandEventArgs e, object obj) { if (e.Length >= 2) { string result = BaseXmlSpawner.SetPropertyValue(null, obj, e.GetString(0), e.GetString(1)); if (result == "Property has been set.") AddResponse(result); else LogFailure(result); } else { LogFailure("Format: XmlSet <propertyName> <value>"); } }
public static void DoubleClick_OnCommand( CommandEventArgs e ) { try { Type type = null; Mobile from = e.Mobile; if( from != null) { if (e.Arguments.Length == 1) type = ScriptCompiler.FindTypeByName( e.GetString( 0 ) ); if( type != null) { Container backpack = from.Backpack; if( backpack != null ) { Item item = backpack.FindItemByType(type); if (item != null) { Targeting.Target.Cancel( from ); from.SendMessage("Oggetto trovato."); item.OnDoubleClick(from); } else from.SendMessage("Oggetto non trovato."); } else from.SendMessage( "Non hai il backpack!!!" ); } else from.SendMessage("Nessun oggetto con quel nome trovato."); } } catch { } }
public static void GSGG_OnCommand(CommandEventArgs e) { try { if (e.Length == 0) { e.Mobile.SendMessage("GSGG is " + GSGG + " hours."); } else { string strParam = e.GetString(0); double param = Double.Parse(strParam); if (param < 0) param = 0.0; e.Mobile.SendMessage("Setting GSGG to " + param + " hours."); GSGG = param; } } catch (Exception exc) { LogHelper.LogException(exc); e.Mobile.SendMessage("There was a problem with the [gsgg command!! See console log"); System.Console.WriteLine("Error with [GSGG!"); System.Console.WriteLine(exc.Message); System.Console.WriteLine(exc.StackTrace); } }
public override void Execute(CommandEventArgs e, object obj) { if (e.Length >= 2) { string prop = e.GetString(0); string val = e.GetString(1); int p1 = val.IndexOf('%', 0); if (p1 >= 0) { int p2 = val.IndexOf('%', p1 + 1); if (p2 > 0) { //found a token, look it up. string token = val.Substring(p1 + 1, p2 - p1 - 1); string token_value = Properties.GetOnlyValue(e.Mobile, obj, token); if (token_value != null) { val = val.Replace("%" + token + "%", token_value); } } } string result = Properties.SetValue(e.Mobile, obj, prop, val); if (result == "Property has been set.") AddResponse(result); else LogFailure(result); } else { LogFailure("Format: Set <propertyName> <value>"); } }
public static void FindItem_OnCommand(CommandEventArgs e) { if (e.Length > 1) { LogHelper Logger = new LogHelper("finditem.log", e.Mobile, false); // Extract property & value from command parameters string sProp = e.GetString(0); string sVal = ""; if (e.Length > 2) { sVal = e.GetString(1); // Concatenate the strings for (int argi = 2; argi < e.Length; argi++) sVal += " " + e.GetString(argi); } else sVal = e.GetString(1); Regex PattMatch = new Regex("= \"*" + sVal, RegexOptions.IgnoreCase); // Loop through assemblies and add type if has property Type[] types; Assembly[] asms = ScriptCompiler.Assemblies; ArrayList MatchTypes = new ArrayList(); for (int i = 0; i < asms.Length; ++i) { types = ScriptCompiler.GetTypeCache(asms[i]).Types; foreach (Type t in types) { if (typeof(Item).IsAssignableFrom(t)) { // Reflect type PropertyInfo[] allProps = t.GetProperties(BindingFlags.Static | BindingFlags.Instance | BindingFlags.Public); foreach (PropertyInfo prop in allProps) if (prop.Name.ToLower() == sProp.ToLower()) MatchTypes.Add(t); } } } // Loop items and check vs. types foreach (Item item in World.Items.Values) { Type t = item.GetType(); bool match = false; foreach (Type MatchType in MatchTypes) { if (t == MatchType) { match = true; break; } } if (match == false) continue; // Reflect instance of type (matched) if (PattMatch.IsMatch(Properties.GetValue(e.Mobile, item, sProp))) Logger.Log(LogType.ItemSerial, item); } Logger.Finish(); } else { // Badly formatted e.Mobile.SendMessage("Format: FindItem <property> <value>"); } }
public virtual void Execute( CommandEventArgs e ) { if ( e.Length >= 1 ) { BaseCommand command = null; m_Commands.TryGetValue( e.GetString( 0 ), 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 - 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 static void HalloweenTrickOrTreat(CommandEventArgs arg) { PlayerMobile player = arg.Mobile as PlayerMobile; if (player == null) { return; } if (arg.Length == 0) { if (m_TrickOrTreatEnabled) { m_TrickOrTreatEnabled = false; player.SendMessage("Halloween Trick or Treating: Disabled"); } else { m_TrickOrTreatEnabled = true; player.SendMessage("Halloween Trick or Treating: Enabled"); } } if (arg.Length == 1) { try { string value = arg.GetString(0); if (value == "enable") { if (m_TrickOrTreatEnabled) { player.SendMessage("Halloween Trick or Treating is already enabled."); return; } else { player.SendMessage("Halloween Trick or Treating: Enabled."); m_TrickOrTreatEnabled = true; return; } } else if (value == "disable") { if (!m_TrickOrTreatEnabled) { player.SendMessage("Halloween Trick or Treating is already disabled."); return; } else { player.SendMessage("Halloween Trick or Treating: Disabled."); m_TrickOrTreatEnabled = false; return; } } } catch { player.SendMessage("Error in arguments. Usage: [HalloweenTrickOrTreat enable or [HalloweenTrickOrTreat disable"); } } }
public static void Password_OnCommand( CommandEventArgs e ) { Mobile from = e.Mobile; Account acct = from.Account as Account; if ( acct == null ) return; IPAddress[] accessList = acct.LoginIPs; if ( accessList.Length == 0 ) return; NetState ns = from.NetState; if ( ns == null ) return; if ( e.Length == 0 ) { from.SendMessage( "You must specify the new password." ); return; } else if ( e.Length == 1 ) { from.SendMessage( "To prevent potential typing mistakes, you must type the password twice. Use the format:" ); from.SendMessage( "Password \"(newPassword)\" \"(repeated)\"" ); return; } string pass = e.GetString( 0 ); string pass2 = e.GetString( 1 ); if ( pass != pass2 ) { from.SendMessage( "The passwords do not match." ); return; } bool isSafe = true; for ( int i = 0; isSafe && i < pass.Length; ++i ) isSafe = ( pass[i] >= 0x20 && pass[i] < 0x80 ); if ( !isSafe ) { from.SendMessage( "That is not a valid password." ); return; } try { IPAddress ipAddress = ((IPEndPoint)ns.Socket.RemoteEndPoint).Address; if ( Utility.IPMatchClassC( accessList[0], ipAddress ) ) { acct.SetPassword( pass ); from.SendMessage( "The password to your account has changed." ); } else { PageEntry entry = PageQueue.GetEntry( from ); if ( entry != null ) { if ( entry.Message.StartsWith( "[Automated: Change Password]" ) ) from.SendMessage( "You already have a password change request in the help system queue." ); else from.SendMessage( "Your IP address does not match that which created this account." ); } else if ( PageQueue.CheckAllowedToPage( from ) ) { from.SendMessage( "Your IP address does not match that which created this account. A page has been entered into the help system on your behalf." ); from.SendLocalizedMessage( 501234, "", 0x35 ); /* The next available Counselor/Game Master will respond as soon as possible. * Please check your Journal for messages every few minutes. */ PageQueue.Enqueue( new PageEntry( from, String.Format( "[Automated: Change Password]<br>Desired password: {0}<br>Current IP address: {1}<br>Account IP address: {2}", pass, ipAddress, accessList[0] ), PageType.Account ) ); } } } catch { } }
public override void Execute( 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 static void Cast_OnCommand(CommandEventArgs e) { if (e.Length == 1) { if (!Multis.DesignContext.Check(e.Mobile)) return; // They are customizing Spell spell = SpellRegistry.NewSpell(e.GetString(0), e.Mobile, null); if (spell != null) spell.Cast(); else e.Mobile.SendMessage("That spell was not found."); } else { e.Mobile.SendMessage("Format: Cast <name>"); } }
public override void Execute( CommandEventArgs e, object obj ) { if ( e.Length >= 2 ) { for ( int i = 0; (i+1) < e.Length; i += 2 ) { string result = Properties.SetValue( e.Mobile, obj, e.GetString( i ), e.GetString( i+1 ) ); if ( result == "Property has been set." ) AddResponse( result ); else LogFailure( result ); } } else { LogFailure( "Format: Set <propertyName> <value>" ); } }
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 override void Execute( CommandEventArgs e, object obj ) { if ( e.Length >= 1 ) { for ( int i = 0; i < e.Length; ++i ) { string result = Properties.GetValue( e.Mobile, obj, e.GetString( i ) ); if ( result == "Property not found." || result == "Property is write only." || result.StartsWith( "Getting this property" ) ) LogFailure( result ); else AddResponse( result ); } } else { LogFailure( "Format: Get <propertyName>" ); } }
public static void Equip_OnCommand( CommandEventArgs e ) { try { Type type = null; Mobile from = e.Mobile; if( from != null) { if (e.Arguments.Length == 1) type = ScriptCompiler.FindTypeByName( e.GetString( 0 ) ); if( type != null) { Container backpack = from.Backpack; if( backpack != null ) { Item item = backpack.FindItemByType(type); if (item != null && item.Movable) { // Targeting.Target.Cancel( from ); if( from.EquipItem( item ) == true ) from.SendMessage("Item equipped."); else from.SendMessage("Item not equipped."); } else from.SendMessage("Item not found."); } else from.SendMessage( "You don't have a Backpack." ); } else from.SendMessage("No type with that name was found."); } } catch { } }