public static GetArgument ( string line, int index ) : PolaMUD.Argument | ||
line | string | The input string |
index | int | The index of the desired argument (1 is always the command itself) |
return | PolaMUD.Argument |
public bool CommandTestAct(Player user, Command command, string text) { Type type = typeof(Mob); Argument arg1 = Parser.GetArgument(text, 2, user, type, SearchLocations.Room); if (arg1.Reference == null) { //user.SendMessage("They aren't here!\n\r"); type = typeof(Player); arg1 = Parser.GetArgument(text, 2, user, type, SearchLocations.Room); if (arg1.Reference == null) { user.SendMessage("They aren't here!\n\r"); return(false); } } Mob target = (Mob)arg1.Reference; Communications.DeliverMessage (user, target, MessageVector.Character, "You test the NarrateAction method! $N picks $S nose!\n\r", ""); Communications.DeliverMessage (user, target, MessageVector.Target, "$n tests the NarrateAction method! You pick your nose!\n\r", ""); Communications.DeliverMessage (user, target, MessageVector.ThirdParty, "$n tests the NarrateAction method! $N picks $S nose!\n\r", ""); return(true); }
public bool SetTargetAllyAsFirstArg(Mob user, string text) { Type type = typeof(Mob); Argument arg1 = Parser.GetArgument(text, 2, user, type, SearchLocations.Room); Mob target = (Mob)arg1.Reference; if (target == null) { if (user.TargetAlly == null) { user.SendMessage("They aren't here!\n\r"); return(false); } else { target = user.TargetAlly; } } if (user.TargetAlly == null) { user.TargetAlly = target; } return(true); }
public void HandleClientMenu(string command) { Argument arg1 = Parser.GetArgument(command, 1); Skill skill = null; switch (arg1.Text) { case "telnet": ClientType = ClientType.Telnet; CombatType = CombatType.Realtime; break; case "full": ClientType = ClientType.Full; CombatType = CombatType.Realtime; break; case "android": ClientType = ClientType.Android; CombatType = CombatType.TurnBased; break; } Menu = null; SendMessage("Thanks, " + Name + ". Please enjoy your stay.\n\r\n\r"); Room = Global.Limbo.Add(this, this.Name + " has arrived.\n\r"); }
public bool CommandSkill(Player user, Command command, string text) { string skill = command.Text; //TODO: Make this execute skills with the generic "skill" command so that we don't have to have a verb for // every skill for debugging purposes if (skill == "skill") { skill = Parser.GetArgument(text, 2).Text; text = text.Substring(6); } bool found = false; string literalKey = ""; foreach (string key in user.Skills.Keys) { if (key.ToLower().StartsWith(skill)) { found = true; literalKey = key; break; } } if (found) { user.Skills[literalKey].Skill.Action(user, text); } else { user.SendMessage("You don't know that skill!\n\r"); } return(true); }
public bool CommandScreen(Player user, Command command, string text) { if (Parser.GetArgument(text, 2).Text == "turnbattle") { if (user.Battle != null && user.CombatType == CombatType.Realtime) { Mob mob = null; foreach (Mob batmob in user.Battle.Participants) { if (!(batmob is Player)) { mob = batmob; } } user.SendMobileMessage( "t=screen" + "~ename=" + mob.Name + "~erace=" + mob.Race.ToString() + "~ehp=" + mob.Health + "~emhp=" + mob.MaxHealth + "~name=" + user.Name + "~race=" + user.Race.ToString() + "~hp=" + user.Health + "~mhp=" + user.MaxHealth + "\n\r"); } } return(true); }
public bool CommandBattle(Player user, Command command, string text) { if (user.ClientType != ClientType.Android) { user.SendMessage("Hey, you're not supposed to be using this combat system!\n\rI'll let it slide, this time...\n\r", "dupe"); } Type type = typeof(Mob); Argument arg1 = Parser.GetArgument(text, 2, user, type, SearchLocations.Room); if (arg1.Reference == null) { user.SendMessage("They aren't here!\n\r"); return(false); } Mob target = (Mob)arg1.Reference; Combat.StartTurnCombat(user, target); DynamicMenu menu = new DynamicMenu(user, "HandleTurnBattleMenu"); menu.List.Add("skill1", new Command("skill1", "", false, "Use skill slot #")); menu.List.Add("skill2", new Command("skill2", "", false, "Use skill slot #")); menu.List.Add("skill3", new Command("skill3", "", false, "Use skill slot #")); menu.List.Add("skill4", new Command("skill4", "", false, "Use skill slot #")); menu.List.Add("skill5", new Command("skill5", "", false, "Use skill slot #")); menu.List.Add("skill6", new Command("skill6", "", false, "Use skill slot #")); menu.List.Add("flee", new Command("flee", "", false, "Run away from the fight")); user.Menu = menu; return(true); }
public void HandleTurnBattleMenu(string command) { if (TargetEnemy == null || Battle == null || !(Battle is TurnBattle)) { SendMessage("You are not in a battle!\n\r"); Menu = null; Battle = null; TargetEnemy = null; return; } if (((TurnBattle)Battle).CurrentTurn != this) { SendMessage("It's not yet your turn!\n\r", "dupe"); return; } Argument arg1 = Parser.GetArgument(command, 1); SkillInstance skill = null; switch (arg1.Text) { case "skill1": skill = SkillSlots[0]; break; case "skill2": skill = SkillSlots[1]; break; case "skill3": skill = SkillSlots[2]; break; case "skill4": skill = SkillSlots[3]; break; case "skill5": skill = SkillSlots[4]; break; case "skill6": skill = SkillSlots[5]; break; } if (skill == null) { SendMessage("You don't have an ability in that slot!"); return; } skill.Arguments = command; ((TurnBattle)Battle).HandleTurn(skill); }
public bool CommandLook(Player user, Command command, string text) { if (Parser.GetArgument(text, 2).Text != "") { // do some crap for arguments here } user.Room.Display(user); return(true); }
public bool CommandDb(Player user, Command command, string text) { if (Parser.GetArgument(text, 2).Text == "entities") { if (Parser.GetArgument(text, 3).Text == "list") { int count = 1; foreach (Thing thing in Global.Things) { user.SendMessage(count + ". " + "[" + thing.Name + "] #" + thing.IndexNumber + "; type: " + thing.GetType() + "\n\r"); count++; } } } if (Parser.GetArgument(text, 2).Text == "menu") { DynamicMenu menu = new DynamicMenu(user, "HandleMenu"); menu.List.Add("waffle", new Command("waffle", "", false, "Menu item 1")); menu.List.Add("carrot", new Command("carrot", "", false, "Menu item 2")); menu.List.Add("apple", new Command("apple", "", false, "Menu item 3")); user.Menu = menu; user.SendMessage("Please select from the following: waffle, carrot, apple\n\r"); } if (Parser.GetArgument(text, 2).Text == "littleman") { AreaLittleMan littleMan = new AreaLittleMan(300, 7); Area area = littleMan.Generate(); Room room = area.Rooms[0]; Instance instance = InstanceManager.NewInstance(user, Convert.ToInt32(Parser.GetArgument(text, 3).Text)); instance.Area = area; user.Move(room); } if (Parser.GetArgument(text, 2).Text == "map") { Area area = user.Room.Area; } if (Parser.GetArgument(text, 2).Text == "instance") { InstanceManager.NewInstance(user, Convert.ToInt32(Parser.GetArgument(text, 3).Text)); } if (Parser.GetArgument(text, 2).Text == "killinstance") { InstanceManager.RemoveInstance(user); } if (Parser.GetArgument(text, 2).Text == "bat") { Mob mob = new Mob(); mob.Name = "test mob #" + Combat.Random.Next(0, 9); mob.Skills.Add("Autoattack", new SkillInstance(Global.SkillTable["Autoattack"], new SkillAI())); } return(true); }
/// <summary> /// Password input dialog displayed immediately on login. /// </summary> /// <param name="command"></param> public void HandlePasswordInput(string command) { Argument arg1 = Parser.GetArgument(command, 1); if (!Authenticate(arg1.Text)) { // disconnect bad password SendMessage("That's a bad password young man!\n\r"); return; } DynamicMenu nextMenu = new DynamicMenu(this, "HandleClientMenu", "Please select your client type:\n\r- telnet\n\r- full\n\r- android\n\r"); nextMenu.List.Add("telnet", new Command("telnet", "", false, "Sets your client type as a telnet connection (telnet, terminal, MUD client)")); nextMenu.List.Add("full", new Command("full", "", false, "Sets your client type as the official rich client")); nextMenu.List.Add("android", new Command("android", "", false, "Sets your client type as an Android phone")); Menu = nextMenu; }
public bool CommandKill(Player user, Command command, string text) { Type type = typeof(Mob); Argument arg1 = Parser.GetArgument(text, 2, user, type, SearchLocations.Room); if (arg1.Reference == null) { user.SendMessage("They aren't here!\n\r"); return(false); } Mob target = (Mob)arg1.Reference; user.WaitPulses += Global.RoundDuration; if (user.TargetEnemy == null) { user.TargetEnemy = target; } Combat.OneHit(user, target); return(true); }