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> ...}]"); } }
private static bool Learn_OnCommand(CommandEventArgs e) { if (e.Length == 0) { e.SendMessage("Usage: .learn <ID>"); return(false); } int id = e.GetInt32(0); e.Target.LearnSpell(Convert.ToInt32(id)); e.SendMessage("Character \"{0}\" has learned spell with ID = \"{1}\"", e.Target.Name, id); return(true); }
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 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(GenericPackets.PlaySound(index, mob.Location)); } else { from.SendMessage("Format: PrivSound <index>"); } }
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 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 bool Cast_OnCommand(CommandEventArgs e) { if (e.Length == 1) { try { e.Player.FakeCast(e.GetInt32(0), e.Target); return(true); } catch (Exception) { e.SendMessage("Invalid spell id or spell needs in target!"); return(false); } } else { e.SendMessage("Usage: .Cast <Spell Id>"); return(false); } }
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?"); } }
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 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); 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)) { from.Map = map; return; } } Dictionary <string, Region> list = from.Map.Regions; foreach (KeyValuePair <string, Region> kvp in list) { Region r = kvp.Value; if (Insensitive.Equals(r.Name, name)) { from.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)) { from.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) { 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)]"); } }
private static bool Inc_OnCommand(CommandEventArgs e) { if (e.Length >= 2) { for (int i = 0; (i + 1) < e.Length; i += 2) { if (e.Target is Character) { string now = Server.Scripts.Properties.CharacterProperties.GetValue(e.Target, e.GetString(i)); if ((Utility.ToInt32(now) != 0) && (e.GetInt32(i + 1) != 0)) { if (Server.Scripts.Properties.CharacterProperties.SetValue(e.Target, e.GetString(i), (Utility.ToInt32(now) + e.GetInt32(i + 1)).ToString())) { e.SendMessage("Property \"{0}\" of character \"{2}\" incresed on \"{1}\".", e.GetString(i), e.GetString(i + 1), e.Target.Name); return(true); } } if (!Server.Scripts.Properties.MobileProperties.HasProperty(e.GetString(i))) { e.SendMessage("Property \"{0}\" on mobile \"{1}\" dont exist.", e.GetString(i), e.Target.Name); return(false); } now = Server.Scripts.Properties.MobileProperties.GetValue(e.Target, e.GetString(i)); if ((Utility.ToInt32(now) != 0) && (e.GetInt32(i + 1) != 0)) { if (Server.Scripts.Properties.MobileProperties.SetValue(e.Target, e.GetString(i), (Utility.ToInt32(now) + e.GetInt32(i + 1)).ToString())) { e.SendMessage("Property \"{0}\" of mobile \"{2}\" incresed on \"{1}\".", e.GetString(i), e.GetString(i + 1), e.Target.Name); return(true); } else { e.SendMessage("Cannot incrise property \"{0}\" of mobile \"{2}\" on value \"{1}\".", e.GetString(i), e.GetString(i + 1), e.Target.Name); return(false); } } else { e.SendMessage("\"{0}\" is not integer value", e.GetString(i + 1)); return(false); } } else { if (!Server.Scripts.Properties.MobileProperties.HasProperty(e.GetString(i))) { e.SendMessage("Property \"{0}\" on mobile \"{1}\" dont exist.", e.GetString(i), e.Target.Name); return(false); } string now = Server.Scripts.Properties.MobileProperties.GetValue(e.Target, e.GetString(i)); if ((Utility.ToInt32(now) != 0) && (e.GetInt32(i + 1) != 0)) { if (Server.Scripts.Properties.MobileProperties.SetValue(e.Target, e.GetString(i), (Utility.ToInt32(now) + e.GetInt32(i + 1)).ToString())) { e.SendMessage("Property \"{0}\" of mobile \"{2}\" incresed on \"{1}\".", e.GetString(i), e.GetString(i + 1), e.Target.Name); return(true); } else { e.SendMessage("Cannot incrise property \"{0}\" of mobile \"{2}\" on value \"{1}\".", e.GetString(i), e.GetString(i + 1), e.Target.Name); return(false); } } else { e.SendMessage("\"{0}\" is not integer value", e.GetString(i + 1)); return(false); } } } return(false); } else { e.SendMessage("Format: Inc <propertyName> <value> [<propertyName> <value> ...]"); return(false); } }
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 Light_OnCommand(CommandEventArgs e) { e.Mobile.LightLevel = e.GetInt32(0); }