public Open() { Name = "open"; Synonyms.Are("open, uncover, undo, unwrap"); Grammars.Add("<noun>", OpenObject); Grammars.Add("<noun> with <held>", UnlockObject); }
public SwitchOn() { Name = "switch"; Grammars.Add("<noun>", SwitchOnObject); Grammars.Add("<noun> on", SwitchOnObject); Grammars.Add("on <noun>", SwitchOnObject); }
public Pick() { Name = "pick up"; Synonyms.Are("pick"); Grammars.Add("up <multi>", PickUpObject); Grammars.Add("<multi> up", PickUpObject); }
public Empty() { Name = "empty"; Grammars.Add("<noun>", EmptyObject); Grammars.Add("out <noun>", EmptyObject); Grammars.Add("<noun> out", EmptyObject); }
public Remove() { Name = "remove"; //Synonyms.Are("take", "carry", "hold"); Grammars.Add(K.HELD_TOKEN, Disrobe); Grammars.Add(K.MULTI_TOKEN, Take); }
public Ask() { Name = "ask"; //Grammars.Add("<creature> 'about' <topic>", AttackObject); Grammars.Add("<noun> 'about' <topic>", OnAsk); Grammars.Add("<noun> 'for' <noun>", OnAskFor); }
public Close() { Name = "close"; Synonyms.Are("cover", "shut"); Grammars.Add("<noun>", CloseObject); Grammars.Add("up <noun>", CloseObject); Grammars.Add("off <noun>", SwitchOffObject); }
public Look() { Name = "look"; Synonyms.Are("l"); Grammars.Add(Grammar.Empty, LookAtRoom); Grammars.Add("at <noun>", ExamineObject); Grammars.Add("<noun>", ExamineObject); }
public Go() { Name = "go"; Synonyms.Are("g", "walk", "run"); Grammars.Add(Grammar.Empty, VagueGo); Grammars.Add(K.DIRECTION_TOKEN, () => false); Grammars.Add(K.NOUN_TOKEN, EnterIt); }
public Put() { Name = "put"; Grammars.Add("<multi> [in,inside,into] <noun>", InsertObject); Grammars.Add("<multiheld> [on,onto] <noun>", PutOnObject); Grammars.Add("on <held>", WearObject); Grammars.Add("down <multiheld>", DropObject); Grammars.Add("<multiheld> down", DropObject); }
public Put() { Name = "put"; Grammars.Add("<multi> in <noun>", InsertObject); Grammars.Add("<multiheld> on <noun>", PutOnObject); Grammars.Add("on <held>", WearObject); Grammars.Add("down <multiheld>", DropObject); Grammars.Add("<multiheld> down", DropObject); }
public Turn() { Name = "turn"; Synonyms.Are("turn", "rotate", "screw", "twist", "unscrew"); Grammars.Add("<noun>", TurnObject); Grammars.Add("<noun> on", SwitchOnObject); Grammars.Add("<noun> off", SwitchOffObject); Grammars.Add("on <noun>", SwitchOnObject); Grammars.Add("off <noun>", SwitchOffObject); }
public void Prepare(AttrTree tree) { Grammars.Clear(); foreach (AttrTree g in tree) { Grammars.Add(g.Node, g); } foreach (AttrTree g in tree) { ScanLexicon(g); } }
public Eat() { Name = "eat"; Grammars.Add("<held>", EatObject); }
public Enter() { Name = "enter"; SetDirection(room => room.IN(), "in"); Grammars.Add("<noun>", EnterObject); }
protected void ReadFromXml(XmlReader reader) { bool inGrammar = false; Resource resource = null; Response response = null; while (reader.Read()) { switch (reader.Name) { case "grammars": inGrammar = reader.IsStartElement(); break; case "include": if (inGrammar && reader.IsStartElement()) { Grammars.Add(new Include() { Href = reader.GetAttribute("href") }); } break; case "resources": if (reader.IsStartElement()) { resource = new Resource(); BaseURL = reader.GetAttribute("base"); } else { Resources.Add(resource); resource = null; } break; case "resource": if (reader.IsStartElement()) { resource.Path = reader.GetAttribute("path"); } break; case "method": if (reader.IsStartElement()) { resource.method = new Method(); resource.method.Name = reader.GetAttribute("name"); resource.method.Id = reader.GetAttribute("id"); } break; case "request": if (reader.IsStartElement()) { resource.method.request = new Request(); } break; case "param": if (reader.IsStartElement()) { if (resource.method.request.Params == null) { resource.method.request.Params = new List <Param>(); } resource.method.request.Params.Add(new Param() { Name = reader.GetAttribute("name"), Style = reader.GetAttribute("style"), Type = reader.GetAttribute("type"), Required = reader.GetAttribute("required") == "true" }); } break; case "response": if (reader.IsStartElement()) { response = new Response(); response.Status = Convert.ToInt32(reader.GetAttribute("status")); } else { if (resource.method.response == null) { resource.method.response = new List <Response>(); } resource.method.response.Add(response); } break; case "representation": if (reader.IsStartElement()) { response.representation = new Representation() { MediaType = reader.GetAttribute("mediaType"), Element = reader.GetAttribute("element") }; } break; } } }
public Drop() { Name = "drop"; Synonyms.Are("drop", "discard", "throw"); Grammars.Add("<multiheld>", DropObject); }
public Release() { Name = "release"; Synonyms.Are("free"); Grammars.Add("<noun>", ReleaseObject); }
public Insert() { Name = "insert"; Grammars.Add("<multi> in <noun>", InsertObject); }
public SwitchOff() { Name = "switch"; Grammars.Add("<noun> off", SwitchOffObject); Grammars.Add("off <noun>", SwitchOffObject); }
public Drink() { Name = "drink"; Synonyms.Are("sip", "swallow"); Grammars.Add("<noun>", DrinkObject); }
public Lock() { Name = "lock"; Grammars.Add("<noun>", LockObject); Grammars.Add("<noun> with <held>", LockObject); }
public Fill() { Name = "fill"; Grammars.Add("<noun>", FillObject); }
public Rub() { Name = "rub"; Grammars.Add("<noun>", RubObject); }
public Catch() { Name = "catch"; Synonyms.Are("capture"); Grammars.Add("<noun>", CatchObject); }
public Get() { Name = "get"; Grammars.Add("<multi>", TakeSingle); }
public Attack() { Name = "attack"; Synonyms.Are("break, crack, destroy, fight, hit, kill, murder, punch, smash, thump, torture, wreck"); Grammars.Add(K.NOUN_TOKEN, AttackObject); }
public Inv() { Name = "inventory"; Synonyms.Are("i", "inv", "inventory"); Grammars.Add(Grammar.Empty, DisplayInventory); }
public Disrobe() { Synonyms.Are("doff", "shed"); Grammars.Add(K.HELD_TOKEN, OnDisrobe); }
public Examine() { Name = "examine"; Synonyms.Are("examine", "x", "check", "describe", "watch"); Grammars.Add("<noun>", ExamineObject); }