private void SaveCurrentBehavior() { if (_behavior.Name != string.Empty) { _behavior.ResetControllers(); foreach (Node node in BeComRules.Nodes) { var rule = (Rule)node.Tag; rule.Priority = node.Index; _behavior.CombatController.AddRule(rule); } foreach (Node node in BeBuffRules.Nodes) { var rule = (Rule)node.Tag; rule.Priority = node.Index; _behavior.BuffController.AddRule(rule); } foreach (Node node in BePullRules.Nodes) { var rule = (Rule)node.Tag; rule.Priority = node.Index; _behavior.PullController.AddRule(rule); } foreach (Node node in BeRestRules.Nodes) { var rule = (Rule)node.Tag; rule.Priority = node.Index; _behavior.RestController.AddRule(rule); } foreach (Node node in BePrePullRules.Nodes) { var rule = (Rule)node.Tag; rule.Priority = node.Index; _behavior.PrePullController.AddRule(rule); } _behavior.CombatDistance = BeCombatDistance.Value; _behavior.PullDistance = BePullDistance.Value; _behavior.PrePullDistance = BePrePullDistance.Value; _behavior.UseAutoAttack = BeEnableAutoAttack.Checked; _behavior.SendPet = BeSendPet.Checked; _behavior.GlobalCooldown = BeGlobalCooldown.Value; _behavior.Save(); } }
private void BtnCreateClick(object sender, EventArgs e) { if (File.Exists(PVEBehaviorCombat.OurDirectory + "\\Behaviors\\" + TBName.Text + ".xml")) { DialogResult result = MessageBoxEx.Show("Behavior exist - overwrite?", "Behavior exist - overwrite?", MessageBoxButtons.OKCancel); switch (result) { case DialogResult.Cancel: return; } } var controller = new BehaviorController { SendPet = false, UseAutoAttack = true, PullDistance = 9, PrePullDistance = 30, CombatDistance = 3, GlobalCooldown = BeGlobalCooldown.Value, Name = TBName.Text, BuffController = new RuleController(), PrePullController = new RuleController(), PullController = new RuleController(), RestController = new RuleController(), CombatController = new RuleController() }; for (int i = 0; i < Normal.Items.Count; i++) { if (Normal.GetItemChecked(i)) { var addToBehavior = (AddToBehavior)Normal.Items[i]; AddToController(addToBehavior, controller); } } for (int i = 0; i < Spec1.Items.Count; i++) { if (Spec1.GetItemChecked(i)) { var addToBehavior = (AddToBehavior)Spec1.Items[i]; AddToController(addToBehavior, controller); } } for (int i = 0; i < Spec2.Items.Count; i++) { if (Spec2.GetItemChecked(i)) { var addToBehavior = (AddToBehavior)Spec2.Items[i]; AddToController(addToBehavior, controller); } } for (int i = 0; i < Spec3.Items.Count; i++) { if (Spec3.GetItemChecked(i)) { var addToBehavior = (AddToBehavior)Spec3.Items[i]; AddToController(addToBehavior, controller); } } AddToController((AddToBehavior)CBSelectSpecial.SelectedItem, controller); AddToController((AddToBehavior)CBSelectSpecial2.SelectedItem, controller); AddToController((AddToBehavior)CBSelectSpecial3.SelectedItem, controller); controller.Save(); PveBehaviorSettings.LoadedBeharvior = TBName.Text; PveBehaviorSettings.SaveSettings(); MessageBoxEx.Show("Created behavior, re-open the behavior settings window to load it"); }