public NPCInteractTask(PPather pather, NodeTask node) : base(pather, node) { NPC = node.GetValueOfId("NPC").GetStringValue(); location = node.GetValueOfId("Location").GetLocationValue(); UseMount = node.GetBoolValueOfId("UseMount"); }
public TaxiTask(PPather pather, NodeTask node) : base(pather, node) { if (GetLocationOfNPC() == null) { PPather.WriteLine("*** NPC " + NPC + " is unknown"); } }
public UntilTask(PPather pather, NodeTask node) : base(pather, node) { if (node.subTasks.Count == 1) { childTask = pather.CreateTaskFromNode(node.subTasks[0], this); } }
public GroupFollowTask(PPather pather, NodeTask node) : base(pather, node) { Distance = node.GetValueOfId("Distance").GetFloatValue(); if (Distance == 0.0f) Distance = 10f; UseMount = node.GetBoolValueOfId("UseMount"); }
public WalkTask(PPather pather, NodeTask node) : base(pather, node) { if (node.GetValueOfId("Order").GetStringValue() != null) { order = node.GetValueOfId("Order").GetStringValue().ToLower(); } }
public RestTask(PPather pather, NodeTask node) : base(pather, node) { RestHealth = GContext.Main.RestHealth; RestMana = GContext.Main.RestMana; PPather.WriteLine("Rest health: " + RestHealth + " mana: " + RestMana); }
private void ProcessScriptLine(int lineNumber, string line) { // Comment/empty lines if (line.StartsWith("#") || string.IsNullOrWhiteSpace(line)) { return; } // Clear configuration if (line.StartsWith("!clear")) { configStore.ClearKeys(); Console.WriteLine("Config cleared"); return; } // Set configuration var match = Regex.Match(line, @"^!set (?<key>[^=]+)=(?<value>.*)"); if (match.Success) { string configKey = match.Groups["key"].Value; string configValue = match.Groups["value"].Value; configStore.UpdateKey(ConfigSectionName, configKey, configValue); Console.WriteLine("Set config: {0}={1}", configKey, configValue); return; } // Run test case var fields = line.Split(','); var impact = new MockImpactDetail() { ComputeImpact = (ResourceImpactEnum)Enum.Parse(typeof(ResourceImpactEnum), fields[0]), DiskImpact = (ResourceImpactEnum)Enum.Parse(typeof(ResourceImpactEnum), fields[1]), NetworkImpact = (ResourceImpactEnum)Enum.Parse(typeof(ResourceImpactEnum), fields[2]), OsImpact = (ResourceImpactEnum)Enum.Parse(typeof(ResourceImpactEnum), fields[3]), EstimatedImpactDurationInSeconds = long.Parse(fields[4]), }; string expectedResultString = fields[5]; string message = string.Format("Line {0}: {1}", lineNumber, line); if (expectedResultString.StartsWith("!")) { Verify.Throws <Exception>(() => translator.TranslateImpactDetailToNodeTask(impact), message); } else { NodeTask actualResult = translator.TranslateImpactDetailToNodeTask(impact); NodeTask expectedResult = (NodeTask)Enum.Parse(typeof(NodeTask), expectedResultString); Verify.AreEqual(expectedResult, actualResult, message); } }
public QuestPickupTask(PPather pather, NodeTask node) : base(pather, node) { Name = node.GetValueOfId("Name").GetStringValue(); ID = node.GetValueOfId("ID").GetStringValue(); if (ID == null || ID == "") { ID = Name; } }
public HotspotTask(PPather pather, NodeTask node) : base(pather, node) { // save us the hassle of case sensitive checking order = node.GetValueOfId("Order").GetStringValue(); currentHotSpotIndex = -1; if (order == "reverse") { currentHotSpotIndex = Locations.Count; } }
public HotspotTask(NodeTask node) : base(node) { // save us the hassle of case sensitive checking this.order = node.GetValueOfId("Order").GetStringValue(); this.currentHotSpotIndex = -1; if (this.order == "reverse") { this.currentHotSpotIndex = this.Locations.Count; } }
public PlaceSpellTask(PPather pather, NodeTask node) : base(pather, node) { Value v = nodetask.GetValueOfId("SpellTab"); if (v == null) { this.SpellTab = ""; } else { this.SpellTab = v.GetStringValue(); } v = nodetask.GetValueOfId("SpellName"); if (v == null) { this.SpellName = ""; } else { this.SpellName = v.GetStringValue(); } v = nodetask.GetValueOfId("SpellRank"); if (v == null) { this.SpellRank = ""; } else { this.SpellRank = v.GetStringValue(); } v = nodetask.GetValueOfId("TargetBar"); if (v == null) { this.TargetBar = ""; } else { this.TargetBar = v.GetStringValue(); } v = nodetask.GetValueOfId("TargetButton"); if (v == null) { this.TargetButton = ""; } else { this.TargetButton = v.GetStringValue(); } }
public AssistTask(PPather pather, NodeTask node) : base(pather, node) { MinLevel = node.GetValueOfId("MinLevel").GetIntValue(); MaxLevel = node.GetValueOfId("MaxLevel").GetIntValue(); Distance = node.GetValueOfId("Distance").GetFloatValue(); if (Distance == 0.0f) { Distance = 1E30f; } UseMount = node.GetBoolValueOfId("UseMount"); }
public VendorTask(PPather pather, NodeTask node) : base(pather, node) { if (NPC == null || NPC == "") { NPC = node.GetValueOfId("RepairNPC").GetStringValue(); if (NPC == null || NPC == "") { NPC = node.GetValueOfId("SellNPC").GetStringValue(); } } }
public RunnerTask(PPather pather, NodeTask node) : base(pather, node) { Locations = new List <Location>(); Value hs = node.GetValueOfId("Locations"); List <Value> hs_list = hs.GetCollectionValue(); foreach (Value v in hs_list) { Location l = v.GetLocationValue(); Locations.Add(l); } UseMount = node.GetBoolValueOfId("UseMount"); }
public LogTask(PPather pather, NodeTask node) : base(pather, node) { Value v = nodetask.GetValueOfId("Text"); if (v == null) { text = ""; } else { text = v.GetStringValue(); } }
public SeqTask(PPather pather, NodeTask node) : base(pather, node) { sequence = new List <Task>(); foreach (NodeTask nt in node.subTasks) { Task t = pather.CreateTaskFromNode(nt, this); if (t != null) { sequence.Add(t); } } currentSequence = 0; }
public DangerTask(PPather pather, NodeTask node) : base(pather, node) { DangerDistance = node.GetValueOfId("Distance").GetFloatValue(); if (DangerDistance == 0) { // Check if using $DangerDistance DangerDistance = node.GetValueOfId("DangerDistance").GetFloatValue(); if (DangerDistance == 0) { DangerDistance = 20; } } }
public CastSpellTask(PPather pather, NodeTask node) : base(pather, node) { Value v = nodetask.GetValueOfId("Key"); if (v == null) { spell = ""; } else { spell = v.GetStringValue(); } }
public QuestGoalTask(PPather pather, NodeTask node) : base(pather, node) { Name = node.GetValueOfId("Name").GetStringValue(); ID = node.GetValueOfId("ID").GetStringValue(); if (ID == null || ID == "") { ID = Name; } if (node.subTasks != null && node.subTasks.Count > 0) { childTask = pather.CreateTaskFromNode(node.subTasks[0], this); } }
public BGQueueTask(PPather pather, NodeTask node) : base(pather, node) { Battlefield = node.GetValueOfId("Battlefield").GetStringValue(); if (Battlefield == null || Battlefield.Length == 0) { PPather.WriteLine("*** BGQueue: Battlefield is missing"); } if (GetLocationOfNPC() == null) { PPather.WriteLine("*** BGQueue: NPC '" + NPC + "' is unknown"); } }
public static Task CreateTaskFromNode(NodeTask node, Task parent) { Task n = ParserTask.GetTask(node); if (n != null) { n.Parent = parent; } else { Logger.Log("!Warning:Unknown task type: " + node.Type); return(null); } return(n); }
public static ParserTask GetTask(PPather ppather, NodeTask node) { // string s = ""; // foreach (string key in registeredTasks.Keys) // s += key + ","; // PPather.WriteLine("Types: " + s); if (!registeredTasks.ContainsKey(node.type)) { PPather.WriteLine("No registered task for " + node.type); return(null); } //PPather.WriteLine("Attempting to instantiate " + registeredTasks[node.type]); // (In some big task files, the above line can crash Glider) ConstructorInfo ci = null; Object o = null; try { ci = registeredTasks[node.type].GetConstructor(new Type[] { ppather.GetType(), node.GetType() }); o = ci.Invoke(new object[] { ppather, node }); } catch (Exception e) { // an exception here is fatal, popup a dialog // to give some feedback and rethrow the error string s = "Error instantiating \"" + node.type + "\" task\n\n" + e.GetType().FullName + "\n" + e.Message; if (null != e.InnerException) { s += "\n\nInner exception:" + e.InnerException.GetType().FullName + "\n" + e.InnerException.Message; } System.Windows.Forms.MessageBox.Show(s); throw e; } if (null == o) { PPather.WriteLine("Created null"); } return((ParserTask)o); }
public LootTask(PPather pather, NodeTask node) : base(pather, node) { Value or = node.GetValueOfId("Skin"); Skin = or.GetBoolValue(); Distance = node.GetValueOfId("Distance").GetFloatValue(); if (Distance == 0.0f) { Distance = 30.0f; } UseMount = node.GetBoolValueOfId("UseMount"); this.ignoreSkin = node.GetValueOfId("IgnoreSkin").GetStringCollectionValues(); }
public HarvestTask(PPather pather, NodeTask node) : base(pather, node) { Value v_names = node.GetValueOfId("Names"); if (v_names != null) { names = v_names.GetStringCollectionValues(); } Value v_types = node.GetValueOfId("Types"); List <Value> types_list = v_types.GetCollectionValue(); foreach (Value v in types_list) { string s = v.GetStringValue(); if (s == "Herb" || s == "Flower") { HarvestFlower = true; PPather.WriteLine("Want to harvest flowers"); } if (s == "Mine" || s == "Mineral") { HarvestMineral = true; PPather.WriteLine("Want to harvest minerals"); } if (s == "Chest" || s == "Treasure") { HarvestTreasure = true; PPather.WriteLine("Want to harvest chests"); } } times = node.GetValueOfId("Times").GetIntValue(); Distance = node.GetValueOfId("Distance").GetFloatValue(); if (Distance == 0.0f) { Distance = 90.0f; } HostileDistance = node.GetValueOfId("HostileDistance").GetFloatValue(); UseMount = node.GetBoolValueOfId("UseMount"); }
public BuyTask(PPather pather, NodeTask node) : base(pather, node) { if (NPC == null || NPC == "") { NPC = node.GetValueOfId("BuyNPC").GetStringValue(); } BuySets = new List <BuySet>(); Value sets = node.GetValueOfId("Items"); List <Value> sets_list = sets.GetCollectionValue(); foreach (Value v in sets_list) { BuySet set = v.GetBuySetValue(); BuySets.Add(set); } }
public QuestHandinTask(PPather pather, NodeTask node) : base(pather, node) { Name = node.GetValueOfId("Name").GetStringValue(); ID = node.GetValueOfId("ID").GetStringValue(); if (ID == null || ID == "") { ID = Name; } Reward = node.GetValueOfId("Reward").GetIntValue(); if (Reward == 0) { Reward = 1; } Repeatable = node.GetValueOfId("Repeatable").GetBoolValue(); }
public StateMachine() { this.reader = null; this.astRoot = null; if (RemoteTask.FileExist(Settings.TaskFile)) { this.reader = RemoteTask.GetFile(Settings.TaskFile); } else { MessageBox.Show(string.Format("Your selected task file wasn't found:\n{0}", Settings.TaskFile)); this.StopAll(""); } if (this.reader != null) { this.pproc = new Preprocessor(this.reader); this.taskParser = new TaskParser(new StreamReader(this.pproc.ProcessedStream)); this.astRoot = this.taskParser.ParseTask(null); this.reader.Close(); } else { this.StopAll("TextReader was null. File not found?"); } this.root = new RootNode(); this.root.AddTask(this.astRoot); this.root.BindSymbols(); // Just to make it a tad faster this.taskQueue = new Stack <Task>(); this.activityQueue = new Stack <Activity>(); this.rootTask = TaskCreator.CreateTaskFromNode(this.root, null); if (this.rootTask == null) { this.StopAll("No root task"); } TaskInfo.Root = this.rootTask; TaskCreator.CreateTreeFromTasks(this.rootTask); this.activity = null; this.taskTimer = new GTimer(300); //300 this.nothingToDoTimer = new GTimer(3 * 1000); this.tick = new GTimer(100); }
public UseItemTask(PPather pather, NodeTask node) : base(pather, node) { Value vin = node.GetValueOfId("Name"); if (vin != null) { vItemName = vin.GetStringValue(); } Value vid = node.GetValueOfId("Delay"); if (vid != null) { vItemDelay = vid.GetIntValue(); } Value vt = node.GetValueOfId("Times"); if (vt != null) { vTimes = vt.GetIntValue(); } }
protected RunnerTask(NodeTask node) : base(node) { this.Locations = new List <Location>(); Value hs = node.GetValueOfId("Locations"); List <Value> hsList = hs.GetCollectionValue(); foreach (Value v in hsList) { Location l = v.GetLocationValue(); this.Locations.Add(l); } this.useMount = node.GetBoolValueOfId("UseMount"); var expression = node.GetExpressionOfId("HowClose"); if (expression != null) { this.howClose = node.GetFloatValueOfId("HowClose"); } else { this.howClose = 3.0f; } }
public SetStateTask(PPather pather, NodeTask node) : base(pather, node) { Value v = nodetask.GetValueOfId("Key"); if (v == null) { key = ""; } else { this.key = v.GetStringValue(); } v = nodetask.GetValueOfId("Value"); if (v == null) { value = ""; } else { this.value = v.GetStringValue(); } }