<CustomBehavior File="RunCode" Type="Definition">
<![CDATA[public static System.Windows.Window GetSettingsWindow() {var settings = new Settings(); settings.PropertyChanged += (sender, args) => {settings.Save(); }; var settingsWindow = new System.Windows.Window {Title = "Profile Settings", SizeToContent = System.Windows.SizeToContent.WidthAndHeight, ResizeMode = System.Windows.ResizeMode.NoResize, Topmost = true, DataContext = settings }; settingsWindow.Closing += (sender, args) => {settings.Save(); }; var grid = new System.Windows.Controls.Grid {Width = 210, Height = 320 }; settingsWindow.Content = grid; var minItemLevelLabel = new System.Windows.Controls.Label {HorizontalAlignment = System.Windows.HorizontalAlignment.Left, VerticalAlignment = System.Windows.VerticalAlignment.Top, Margin = new System.Windows.Thickness(10, 10, 0, 0), Content = "Min Item Level:"}; grid.Children.Add(minItemLevelLabel); var minItemLevelTextBox = new System.Windows.Controls.TextBox {HorizontalAlignment = System.Windows.HorizontalAlignment.Left, VerticalAlignment = System.Windows.VerticalAlignment.Top, Margin = new System.Windows.Thickness(148, 15, 0, 0), Width = 50 }; minItemLevelTextBox.SetBinding(System.Windows.Controls.TextBox.TextProperty, new System.Windows.Data.Binding(nameof(settings.MinItemLevel)) {Source = settings }); grid.Children.Add(minItemLevelTextBox); var doBattleMapLabel = new System.Windows.Controls.Label {HorizontalAlignment = System.Windows.HorizontalAlignment.Left, VerticalAlignment = System.Windows.VerticalAlignment.Top, Margin = new System.Windows.Thickness(10, 41, 0, 0), Content = "Do Battle Map:"}; grid.Children.Add(doBattleMapLabel); var doBattleMapCheckBox = new System.Windows.Controls.CheckBox {HorizontalAlignment = System.Windows.HorizontalAlignment.Left, VerticalAlignment = System.Windows.VerticalAlignment.Top, Margin = new System.Windows.Thickness(148, 47, 0, 0) }; doBattleMapCheckBox.SetBinding(System.Windows.Controls.CheckBox.IsCheckedProperty, new System.Windows.Data.Binding(nameof(settings.DoBattleMap)) {Source = settings }); grid.Children.Add(doBattleMapCheckBox); var doAllObjectiveZonesLabel = new System.Windows.Controls.Label {HorizontalAlignment = System.Windows.HorizontalAlignment.Left, VerticalAlignment = System.Windows.VerticalAlignment.Top, Margin = new System.Windows.Thickness(10, 72, 0, 0), Content = "Do All Objective Zones:"}; grid.Children.Add(doAllObjectiveZonesLabel); var doAllObjectiveZonesCheckBox = new System.Windows.Controls.CheckBox {HorizontalAlignment = System.Windows.HorizontalAlignment.Left, VerticalAlignment = System.Windows.VerticalAlignment.Top, Margin = new System.Windows.Thickness(148, 78, 0, 0) }; doAllObjectiveZonesCheckBox.SetBinding(System.Windows.Controls.CheckBox.IsCheckedProperty, new System.Windows.Data.Binding(nameof(settings.DoAllObjectiveZones)) {Source = settings }); grid.Children.Add(doAllObjectiveZonesCheckBox); var doToothAndClawLabel = new System.Windows.Controls.Label {HorizontalAlignment = System.Windows.HorizontalAlignment.Left, VerticalAlignment = System.Windows.VerticalAlignment.Top, Margin = new System.Windows.Thickness(10, 103, 0, 0), Content = "Do Tooth And Claw:"}; grid.Children.Add(doToothAndClawLabel); var doToothAndClawCheckBox = new System.Windows.Controls.CheckBox {HorizontalAlignment = System.Windows.HorizontalAlignment.Left, VerticalAlignment = System.Windows.VerticalAlignment.Top, Margin = new System.Windows.Thickness(148, 109, 0, 0) }; doToothAndClawCheckBox.SetBinding(System.Windows.Controls.CheckBox.IsCheckedProperty, new System.Windows.Data.Binding(nameof(settings.DoToothAndClaw)) {Source = settings }); grid.Children.Add(doToothAndClawCheckBox); var useBalefulTokensLabel = new System.Windows.Controls.Label {HorizontalAlignment = System.Windows.HorizontalAlignment.Left, VerticalAlignment = System.Windows.VerticalAlignment.Top, Margin = new System.Windows.Thickness(10, 134, 0, 0), Content = "Use Baleful Tokens:"}; grid.Children.Add(useBalefulTokensLabel); var useBalefulTokensCheckBox = new System.Windows.Controls.CheckBox {HorizontalAlignment = System.Windows.HorizontalAlignment.Left, VerticalAlignment = System.Windows.VerticalAlignment.Top, Margin = new System.Windows.Thickness(148, 140, 0, 0) }; useBalefulTokensCheckBox.SetBinding(System.Windows.Controls.CheckBox.IsCheckedProperty, new System.Windows.Data.Binding(nameof(settings.UseBalefulTokens)) {Source = settings }); grid.Children.Add(useBalefulTokensCheckBox); var useHooksLabel = new System.Windows.Controls.Label {HorizontalAlignment = System.Windows.HorizontalAlignment.Left, VerticalAlignment = System.Windows.VerticalAlignment.Top, Margin = new System.Windows.Thickness(10, 165, 0, 0), Content = "Use Hooks:"}; grid.Children.Add(useHooksLabel); var useHooksCheckBox = new System.Windows.Controls.CheckBox {HorizontalAlignment = System.Windows.HorizontalAlignment.Left, VerticalAlignment = System.Windows.VerticalAlignment.Top, Margin = new System.Windows.Thickness(148, 171, 0, 0) }; useHooksCheckBox.SetBinding(System.Windows.Controls.CheckBox.IsCheckedProperty, new System.Windows.Data.Binding(nameof(settings.UseHooks)) {Source = settings}); grid.Children.Add(useHooksCheckBox); var useAvoidsLabel = new System.Windows.Controls.Label {HorizontalAlignment = System.Windows.HorizontalAlignment.Left, VerticalAlignment = System.Windows.VerticalAlignment.Top, Margin = new System.Windows.Thickness(10, 196, 0, 0), Content = "Use Avoids:"}; grid.Children.Add(useAvoidsLabel); var useAvoidsCheckBox = new System.Windows.Controls.CheckBox {HorizontalAlignment = System.Windows.HorizontalAlignment.Left, VerticalAlignment = System.Windows.VerticalAlignment.Top, Margin = new System.Windows.Thickness(148, 202, 0, 0) }; useAvoidsCheckBox.SetBinding(System.Windows.Controls.CheckBox.IsCheckedProperty, new System.Windows.Data.Binding(nameof(settings.UseAvoids)) {Source = settings }); grid.Children.Add(useAvoidsCheckBox); var grindSaberstalkersLabel = new System.Windows.Controls.Label {HorizontalAlignment = System.Windows.HorizontalAlignment.Left, VerticalAlignment = System.Windows.VerticalAlignment.Top, Margin = new System.Windows.Thickness(10, 227, 0, 0), Content = "Grind Saberstalkers:"}; grid.Children.Add(grindSaberstalkersLabel); var grindSaberstalkersCheckBox = new System.Windows.Controls.CheckBox {HorizontalAlignment = System.Windows.HorizontalAlignment.Left, VerticalAlignment = System.Windows.VerticalAlignment.Top, Margin = new System.Windows.Thickness(148, 233, 0, 0) }; grindSaberstalkersCheckBox.SetBinding(System.Windows.Controls.CheckBox.IsCheckedProperty, new System.Windows.Data.Binding(nameof(settings.GrindSaberstalkers)) {Source = settings }); grid.Children.Add(grindSaberstalkersCheckBox); var grindSaberstalkersILvlLabel = new System.Windows.Controls.Label {HorizontalAlignment = System.Windows.HorizontalAlignment.Left, VerticalAlignment = System.Windows.VerticalAlignment.Top, Margin = new System.Windows.Thickness(10, 258, 0, 0), Content = "Grind Saberstalkers ILvl:"}; grid.Children.Add(grindSaberstalkersILvlLabel); var grindSaberstalkersILvlTextBox = new System.Windows.Controls.TextBox {HorizontalAlignment = System.Windows.HorizontalAlignment.Left, VerticalAlignment = System.Windows.VerticalAlignment.Top, Margin = new System.Windows.Thickness(148, 262, 0, 0), Width = 50 }; grindSaberstalkersILvlTextBox.SetBinding(System.Windows.Controls.TextBox.TextProperty, new System.Windows.Data.Binding(nameof(settings.GrindSaberstalkersILvl)) {Source = settings }); grid.Children.Add(grindSaberstalkersILvlTextBox); var turnInBlueprintsLabel = new System.Windows.Controls.Label {HorizontalAlignment = System.Windows.HorizontalAlignment.Left, VerticalAlignment = System.Windows.VerticalAlignment.Top, Margin = new System.Windows.Thickness(10, 289, 0, 0), Content = "Turn In Blueprints:"}; grid.Children.Add(turnInBlueprintsLabel); var turnInBlueprintsCheckBox = new System.Windows.Controls.CheckBox {HorizontalAlignment = System.Windows.HorizontalAlignment.Left, VerticalAlignment = System.Windows.VerticalAlignment.Top, Margin = new System.Windows.Thickness(148, 295, 0, 0) }; turnInBlueprintsCheckBox.SetBinding(System.Windows.Controls.CheckBox.IsCheckedProperty, new System.Windows.Data.Binding(nameof(settings.TurnInBlueprints)) {Source = settings }); grid.Children.Add(turnInBlueprintsCheckBox); return settingsWindow; } public class Settings : Styx.Helpers.Settings {private static readonly string _settingsPath = Path.Combine(CharacterSettingsDirectory, "Profiles", "BuddyTeamTannanDailySettings.xml"); public static Settings Instance => new Settings(_settingsPath); public Settings() : base(_settingsPath, null) {} private Settings(string settingsPath, string oldSettingsPath = null) : base(settingsPath, oldSettingsPath) {} private int _minItemLevel = 645; [Setting] public int MinItemLevel {get {return _minItemLevel; } set {if (value == _minItemLevel) return; _minItemLevel = value; OnPropertyChanged(); } } private bool _doBattleMap = true; [Setting] public bool DoBattleMap {get {return _doBattleMap; } set {if (value == _doBattleMap) return; _doBattleMap = value; OnPropertyChanged(); } } private bool _doAllObjectiveZones = true; [Setting] public bool DoAllObjectiveZones {get {return _doAllObjectiveZones; } set {if (value == _doAllObjectiveZones) return; _doAllObjectiveZones = value; OnPropertyChanged(); } } private bool _doToothAndClaw = true; [Setting] public bool DoToothAndClaw {get {return _doToothAndClaw; } set {if (value == _doToothAndClaw) return; _doToothAndClaw = value; OnPropertyChanged(); } } private bool _useBalefulTokens = true; [Setting] public bool UseBalefulTokens {get {return _useBalefulTokens; } set {if (value == _useBalefulTokens) return; _useBalefulTokens = value; OnPropertyChanged(); } } private bool _useHooks = true; [Setting] public bool UseHooks {get {return _useHooks; } set {if (value == _useHooks) return; _useHooks = value; OnPropertyChanged(); } } private bool _useAvoids = true; [Setting] public bool UseAvoids {get {return _useAvoids; } set {if (value == _useAvoids) return; _useAvoids = value; OnPropertyChanged(); } } private bool _grindSaberstalkers = false; [Setting] public bool GrindSaberstalkers {get {return _grindSaberstalkers; } set {if (value == _grindSaberstalkers) return; _grindSaberstalkers = value; OnPropertyChanged(); } } private int _grindSaberstalkersILvl = 670; [Setting] public int GrindSaberstalkersILvl {get {return _grindSaberstalkersILvl; } set {if (value == _grindSaberstalkersILvl) return; _grindSaberstalkersILvl = value; OnPropertyChanged(); } } private bool _turnInBlueprints = true; [Setting] public bool TurnInBlueprints {get {return _turnInBlueprints; } set {if (value == _turnInBlueprints) return; _turnInBlueprints = value; OnPropertyChanged(); } } } public static Task<T> StartSTATask<T>(Func<T> func) {var tcs = new TaskCompletionSource<T>(); var thread = new System.Threading.Thread(() => {try {tcs.SetResult(func()); } catch (Exception e) {tcs.SetException(e); Logging.Write(e.ToString()); } }); thread.SetApartmentState(System.Threading.ApartmentState.STA); thread.IsBackground = true; thread.Start(); return tcs.Task; } public void Initialize() {System.Windows.Application.Current.Dispatcher.BeginInvoke((Action)(() => {var grid = (System.Windows.Controls.Grid)((Honorbuddy.MainWindow)System.Windows.Application.Current.MainWindow).Content; var profileConfigButton = grid.Children.OfType<System.Windows.Controls.Button>().FirstOrDefault(btn => btn.Name == "btnProfileSettings"); if (profileConfigButton != null) return; profileConfigButton = new System.Windows.Controls.Button {Name = "btnProfileSettings", HorizontalAlignment = System.Windows.HorizontalAlignment.Right, VerticalAlignment = System.Windows.VerticalAlignment.Bottom, Margin = new System.Windows.Thickness(0, 0, 8, 55), Content = "Profile Config", Height = 20, Width = 120 }; grid.Children.Add(profileConfigButton); profileConfigButton.Click += (sender, args) => {StartSTATask(() => {var window = GetSettingsWindow(); window.ShowDialog(); return true; }); }; })); Styx.CommonBot.BotEvents.OnBotStopped += args => {System.Windows.Application.Current.Dispatcher.BeginInvoke((Action) (() => {var grid = (System.Windows.Controls.Grid) ((Honorbuddy.MainWindow) System.Windows.Application.Current.MainWindow).Content; var profileConfigButton = grid.Children.OfType<System.Windows.Controls.Button>() .FirstOrDefault(btn => btn.Name == "btnProfileSettings"); grid.Children.Remove(profileConfigButton); })); }; } ]]>
</CustomBehavior>
<CustomBehavior File="RunCode" Code="Initialize();"/>
<CustomBehavior File="RunCode" Code="Logging.Write(System.Windows.Media.Colors.Orange, "[Notification]\n\nPlease note the 'Profile Config' button above the stop bot button.\n\nYou can use this to customize how the profile will behave.\n\nPlease set your configuration now.");" />