private static bool PopList(string command, Argument[] args, bool quiet, bool force) { if (args.Length != 2) { ScriptUtilities.ScriptErrorMsg("Usage: poplist ('list name') ('element value'/'front'/'back')"); return(true); } if (args[1].AsString() == "front") { if (force) { while (Interpreter.PopList(args[0].AsString(), true)) { } } else { Interpreter.PopList(args[0].AsString(), true); } } else if (args[1].AsString() == "back") { if (force) { while (Interpreter.PopList(args[0].AsString(), false)) { } } else { Interpreter.PopList(args[0].AsString(), false); } } else { if (force) { while (Interpreter.PopList(args[0].AsString(), args[1])) { } } else { Interpreter.PopList(args[0].AsString(), args[1]); } } return(true); }
private static bool ClickObject(string command, Argument[] args, bool quiet, bool force) { if (args.Length == 0) { ScriptUtilities.ScriptErrorMsg("Usage: clickobject (serial)"); return(true); } uint serial = args[0].AsSerial(); Client.Instance.SendToServer(new SingleClick(serial)); return(true); }
public static bool Cast(string command, Argument[] args, bool quiet, bool force) { if (args.Length == 0) { ScriptUtilities.ScriptErrorMsg("Usage: cast 'spell' [serial]"); return(true); } if (!Client.Instance.ClientRunning) { return(true); } Spell spell; if (int.TryParse(args[0].AsString(), out int spellnum)) { spell = Spell.Get(spellnum); } else { spell = Spell.GetByName(args[0].AsString()); } if (spell != null) { if (args.Length > 1) { Serial s = args[1].AsSerial(); if (force) { Targeting.ClearQueue(); } if (s > Serial.Zero && s != Serial.MinusOne) { Targeting.Target(s); } else if (!quiet) { ScriptUtilities.ScriptErrorMsg("cast - invalid serial or alias"); } } } else if (!quiet) { ScriptUtilities.ScriptErrorMsg("cast - spell name or number not valid"); } return(true); }
private static bool Pause(string command, Argument[] args, bool quiet, bool force) { if (args.Length == 0) { ScriptUtilities.ScriptErrorMsg("Usage: pause (timeout)"); return(true); } if (!ScriptManager.Pause(args[0].AsInt())) { return(true); } return(false); }
private static int ListExists(string expression, Argument[] args, bool quiet) { if (args.Length != 1) { ScriptUtilities.ScriptErrorMsg("Usage: listexists ('list name')"); return(0); } if (Interpreter.ListExists(args[0].AsString())) { return(1); } return(0); }
private static int InList(string expression, Argument[] args, bool quiet) { if (args.Length != 1) { ScriptUtilities.ScriptErrorMsg("Usage: inlist ('list name')"); return(0); } if (Interpreter.ListContains(args[0].AsString(), args[1])) { return(1); } return(0); }
private static bool Rename(string command, Argument[] args, bool quiet, bool force) { if (args.Length != 2) { ScriptUtilities.ScriptErrorMsg("Usage: rename (serial) ('name')"); return(true); } uint targetSerial = args[0].AsSerial(); if (Client.Instance.ClientRunning) { Client.Instance.SendToServer(new RenameReq(targetSerial, args[1].AsString())); } return(true); }
private static int FindAlias(string expression, Argument[] args, bool quiet) { if (args.Length < 1) { ScriptUtilities.ScriptErrorMsg("Usage: findalias (string)"); } uint serial = Interpreter.GetAlias(args[0].AsString()); if (serial == uint.MaxValue) { return(0); } return(1); }
private static int InJournal(string expression, Argument[] args, bool quiet) { if (args.Length == 0) { ScriptUtilities.ScriptErrorMsg("Usage: injournal ('text') ['author'/'system']"); return(0); } if (args.Length == 1 && Journal.ContainsSafe(args[0].AsString())) { return(1); } // TODO: // handle second argument return(0); }
// @Jaedan this crashes as we discussed private static bool WaitForGump(string command, Argument[] args, bool quiet, bool force) { if (args.Length < 2) { ScriptUtilities.ScriptErrorMsg("Usage: waitforgump (gump id/'any') (timeout)"); return(true); } if (!ScriptManager.Pause(args[0].AsInt())) { return(true); } bool _strict = args[0].AsString() != "any"; uint gumpId = _strict ? args[0].AsSerial() : uint.MaxValue; return((World.Player.HasGump || World.Player.HasCompressedGump) && (World.Player.CurrentGumpI == gumpId || !_strict)); }
public static bool ToggleHands(string command, Argument[] args, bool quiet, bool force) { if (args.Length == 0) { ScriptUtilities.ScriptErrorMsg("Usage: togglehands ('left'/'right')"); return(true); } if (args[0].AsString() == "left") { Dress.ToggleLeft(); } else { Dress.ToggleRight(); } return(true); }
private static bool UseSkill(string command, Argument[] args, bool quiet, bool force) { if (args.Length == 0) { ScriptUtilities.ScriptErrorMsg("Usage: useskill ('skill name'/'last')"); return(true); } if (args[0].AsString() == "last") { Client.Instance.SendToServer(new UseSkill(World.Player.LastSkill)); } else if (UsableSkills.TryGetValue(args[0].AsString(), out int skillId)) { Client.Instance.SendToServer(new UseSkill(skillId)); } return(true); }
private static bool UseObject(string command, Argument[] args, bool quiet, bool force) { if (args.Length == 0) { ScriptUtilities.ScriptErrorMsg("Usage: useobject (serial)"); return(true); } Serial serial = args[0].AsSerial(); if (!serial.IsValid) { ScriptUtilities.ScriptErrorMsg("useobject - invalid serial"); return(true); } Client.Instance.SendToServer(new DoubleClick(serial)); return(true); }
private static bool WaitForJournal(string command, Argument[] args, bool quiet, bool force) { if (args.Length < 2) { ScriptUtilities.ScriptErrorMsg("Usage: waitforjournal ('text') (timeout) ['author'/'system']"); return(true); } if (!ScriptManager.Pause(args[1].AsInt())) { return(true); } if (Journal.ContainsSafe(args[0].AsString())) { ScriptManager.Unpause(); return(true); } return(false); }
private static bool SetAbility(string command, Argument[] args, bool quiet, bool force) { if (args.Length < 1 || !abilities.Contains(args[0].AsString())) { ScriptUtilities.ScriptErrorMsg("Usage: setability ('primary'/'secondary'/'stun'/'disarm') ['on'/'off']"); return(true); } if (args.Length == 2 && args[1].AsString() == "on" || args.Length == 1) { switch (args[0].AsString()) { case "primary": SpecialMoves.SetPrimaryAbility(); break; case "secondary": SpecialMoves.SetSecondaryAbility(); break; case "stun": Client.Instance.SendToServer(new StunRequest()); break; case "disarm": Client.Instance.SendToServer(new DisarmRequest()); break; default: break; } } else if (args.Length == 2 && args[1].AsString() == "off") { Client.Instance.SendToServer(new UseAbility(AOSAbility.Clear)); Client.Instance.SendToClient(ClearAbility.Instance); } return(true); }
public static bool HeadMsg(string command, Argument[] args, bool quiet, bool force) { if (args.Length == 0) { ScriptUtilities.ScriptErrorMsg("Usage: headmsg ('text') [color] [serial]"); return(true); } if (!Client.Instance.ClientRunning) { return(true); } if (args.Length == 1) { World.Player.OverheadMessage(Config.GetInt("SysColor"), args[0].AsString()); } else { int hue = Utility.ToInt32(args[1].AsString(), 0); if (args.Length == 3) { uint serial = args[2].AsSerial(); Mobile m = World.FindMobile((uint)serial); if (m != null) { m.OverheadMessage(hue, args[0].AsString()); } } else { World.Player.OverheadMessage(hue, args[0].AsString()); } } return(true); }
private static bool PushList(string command, Argument[] args, bool quiet, bool force) { if (args.Length < 2 || args.Length > 3) { ScriptUtilities.ScriptErrorMsg("Usage: pushlist ('list name') ('element value') ['front'/'back']"); return(true); } bool front = false; if (args.Length == 3) { if (args[2].AsString() == "front") { front = true; } } Interpreter.PushList(args[0].AsString(), args[1], front, force); return(true); }
public static bool EquipItem(string command, Argument[] args, bool quiet, bool force) { if (!Client.Instance.ClientRunning || World.Player == null) { return(true); } if (args.Length < 2) { ScriptUtilities.ScriptErrorMsg("Usage: equipitem (serial) (layer)"); return(true); } Item equip = World.FindItem(args[0].AsSerial()); byte layer = (byte)Utility.ToInt32(args[1].AsString(), 0); if (equip != null && (Layer)layer != Layer.Invalid) { Dress.Equip(equip, (Layer)layer); } return(true); }
public static bool SysMsg(string command, Argument[] args, bool quiet, bool force) { if (args.Length == 0) { ScriptUtilities.ScriptErrorMsg("Usage: sysmsg ('text') [color]"); return(true); } if (!Client.Instance.ClientRunning) { return(true); } if (args.Length == 1) { World.Player.SendMessage(Config.GetInt("SysColor"), args[0].AsString()); } else if (args.Length == 2) { World.Player.SendMessage(Utility.ToInt32(args[1].AsString(), 0), args[0].AsString()); } return(true); }