public void ResetControllers() { CombatController = new RuleController(); PullController = new RuleController(); BuffController = new RuleController(); RestController = new RuleController(); PrePullController = new RuleController(); }
internal void LoadController(XmlNodeList xmlNodeList, RuleController ruleController) { foreach (XmlNode xmlMainNode in xmlNodeList) { foreach (XmlNode xmlNode in xmlMainNode.ChildNodes) { if (xmlNode.Name.Equals("Rule")) { //We got our hands on a rule, lets load it. var rule = new Rule(); foreach (XmlNode childNode in xmlNode) { switch (childNode.Name) { case "Name": rule.Name = childNode.InnerText; break; case "Script": rule.Script = childNode.InnerText; break; case "MatchAll": rule.MatchAll = Convert.ToBoolean(childNode.InnerText); break; case "ShouldTarget": rule.ShouldTarget = (Target)Enum.Parse(typeof(Target), childNode.InnerText); break; case "Priority": rule.Priority = Convert.ToInt32(childNode.InnerText); break; case "Action": rule.LoadAction(childNode); break; default: AbstractCondition condition = LoadConditions(childNode); if (condition != null) { rule.AddCondition(condition); } break; } } ruleController.AddRule(rule); } } } }
public void Load(XmlNode rotation) { Rules = new RuleController(); GlobalCooldown = 1600; try { foreach (XmlNode childNode in rotation.ChildNodes) { switch (childNode.Name) { case "Name": Name = childNode.InnerText; break; case "GlobalCooldown": GlobalCooldown = Convert.ToInt32(childNode.InnerText); break; case "Active": Active = Convert.ToBoolean(childNode.InnerText); break; case "Ctrl": Ctrl = Convert.ToBoolean(childNode.InnerText); break; case "Alt": Alt = Convert.ToBoolean(childNode.InnerText); break; case "Shift": Shift = Convert.ToBoolean(childNode.InnerText); break; case "Key": Key = childNode.InnerText; break; case "Windows": Windows = Convert.ToBoolean(childNode.InnerText); break; case "Rules": LoadController(childNode.ChildNodes, Rules); break; } } } catch (Exception e) { Logging.Write("Something went wrong when loading Rotation: " + e); } }
public void Load(string fileToLoad) { CombatController = new RuleController(); PullController = new RuleController(); BuffController = new RuleController(); RestController = new RuleController(); PrePullController = new RuleController(); GlobalCooldown = 1600; try { Name = Path.GetFileNameWithoutExtension(fileToLoad); _doc = new XmlDocument(); _doc.Load(fileToLoad); } catch (Exception e) { Logging.Write("Error in loaded behavior: " + e); return; } try { try { CombatDistance = Convert.ToInt32(_doc.GetElementsByTagName("CombatDistance")[0].InnerText); try { PullDistance = Convert.ToInt32(_doc.GetElementsByTagName("PullDistance")[0].InnerText); } catch { PullDistance = 25; } try { PrePullDistance = Convert.ToInt32(_doc.GetElementsByTagName("PrePullDistance")[0].InnerText); } catch { PrePullDistance = 30; } UseAutoAttack = Convert.ToBoolean(_doc.GetElementsByTagName("UseAutoAttack")[0].InnerText); SendPet = Convert.ToBoolean(_doc.GetElementsByTagName("SendPet")[0].InnerText); try { GlobalCooldown = Convert.ToInt32(_doc.GetElementsByTagName("GlobalCooldown")[0].InnerText); } catch { GlobalCooldown = 2000; } } catch { } LoadController(_doc.GetElementsByTagName("CombatController"), CombatController); LoadController(_doc.GetElementsByTagName("BuffController"), BuffController); LoadController(_doc.GetElementsByTagName("RestController"), RestController); LoadController(_doc.GetElementsByTagName("PullController"), PullController); LoadController(_doc.GetElementsByTagName("PrePullController"), PrePullController); } catch (Exception e) { Logging.Write("Something went wrong when loading behavior: " + e); } }
internal void LoadController(XmlNodeList xmlNodeList, RuleController ruleController) { foreach (XmlNode xmlMainNode in xmlNodeList) { if (xmlMainNode.Name.Equals("Rule")) { //We got our hands on a rule, lets load it. var rule = new Rule(); foreach (XmlNode childNode in xmlMainNode) { switch (childNode.Name) { case "Name": rule.Name = childNode.InnerText; break; case "Script": rule.Script = childNode.InnerText; break; case "MatchAll": rule.MatchAll = Convert.ToBoolean(childNode.InnerText); break; case "ShouldTarget": rule.ShouldTarget = (Target) Enum.Parse(typeof (Target), childNode.InnerText); break; case "Priority": rule.Priority = Convert.ToInt32(childNode.InnerText); break; case "Action": rule.LoadAction(childNode); break; default: AbstractCondition condition = LoadConditions(childNode); if (condition != null) rule.AddCondition(condition); break; } } ruleController.AddRule(rule); } } }
public void ResetControllers() { Rules = new RuleController(); }
public Rotation() { Rules = new RuleController(); GlobalCooldown = 1600; Key = string.Empty; }