public override IQuestAction CreateNew(string source, Quest parentQuest) { // Source must match pattern Match match = Test(source); if (!match.Success) { return(null); } // Factory new pcat PcAt pcat = new PcAt(parentQuest); // If this is a classic "pc at" action, use a declared location if (string.IsNullOrEmpty(match.Groups["placeType"].Value)) { pcat.placeSymbol = new Symbol(match.Groups["aPlace"].Value); } else { string name = match.Groups["placeType"].Value; Table placesTable = QuestMachine.Instance.PlacesTable; if (placesTable.HasValue(name)) { // Store values int p1 = Place.CustomParseInt(placesTable.GetValue("p1", name)); if (p1 != 0 && p1 != 1) { throw new Exception("PcAt: This trigger condition can only be used with building types (p1=0) in Quests-Places table."); } pcat.p2 = Place.CustomParseInt(placesTable.GetValue("p2", name)); pcat.p3 = Place.CustomParseInt(placesTable.GetValue("p3", name)); } else { throw new Exception(string.Format("PcAt: Could not find place type name in data table: '{0}'", name)); } } pcat.taskSymbol = new Symbol(match.Groups["aTask"].Value); pcat.textId = Parser.ParseInt(match.Groups["id"].Value); return(pcat); }
public override IQuestAction CreateNew(string source, Quest parentQuest) { // Source must match pattern Match match = Test(source); if (!match.Success) { return(null); } // Factory new pcat PcAt pcat = new PcAt(parentQuest); pcat.placeSymbol = new Symbol(match.Groups["aPlace"].Value); pcat.taskSymbol = new Symbol(match.Groups["aTask"].Value); pcat.textId = Parser.ParseInt(match.Groups["id"].Value); return(pcat); }