private void LoadSettings() { if (_ELITEAPI == null) { var msg = new CustomMessageDialog("ERROR", "You must select a character before loading configuration settings."); msg.ShowDialog(); return; } OpenFileDialog openFileDialog = new OpenFileDialog { Filter = "Text files (*.txt)|*.txt", InitialDirectory = ConfigPath }; if (openFileDialog.ShowDialog() == true) { SendCommand("hb reload"); Thread.Sleep(1000); Toggle_Attack.IsOn = false; Toggle_Curing.IsOn = false; Toggle_Curaga.IsOn = false; Toggle_Na.IsOn = false; Toggle_Erase.IsOn = false; Toggle_Buffs.IsOn = false; Toggle_Debuffs.IsOn = false; Toggle_IgnoreTrusts.IsOn = false; LoadSettingsFromConfig(openFileDialog.FileName); } }
private void Button_RemoveSet_Click(object sender, RoutedEventArgs e) { var set = cb_CurePotencySets.SelectedItem != null?cb_CurePotencySets.SelectedItem.ToString() : string.Empty; var job = cb_CurePotencySetsJobs.SelectedItem != null?cb_CurePotencySetsJobs.SelectedItem.ToString() : string.Empty; if (string.IsNullOrEmpty(set) && string.IsNullOrEmpty(job)) { return; } else if (string.IsNullOrEmpty(job) && (set == "default" || set == "None")) { var msg = new CustomMessageDialog("Denied", "You are not allowed to remove the following required sets: 'default', 'None'"); msg.ShowDialog(); return; } if (!string.IsNullOrEmpty(set) && string.IsNullOrEmpty(job)) { // remove the whole set because a job wasn't selected. ModifiedCurePotencySets.Remove(set); SetupSetsCombobox(); } else { // remove the job from the set. ModifiedCurePotencySets[set].Remove(job); SetupSetsCombobox(); cb_CurePotencySets.SelectedItem = set; } ClearPotencyTextBoxes(); }
private void Button_EditPriorities_Click(object sender, RoutedEventArgs e) { if (_HbData == null) { return; } var popup = new PrioritiesWindow(_HbData.PrioritySets); if (popup.ShowDialog() == true) { _HbData.PrioritySets = popup.ModifiedPrioritySets; if (!_HbData.SavePrioritySets()) { var msg = new CustomMessageDialog("ERROR", "There was an issue saving the data to priorities.lua"); msg.ShowDialog(); } } }
private void Button_EditCurePotency_Click(object sender, RoutedEventArgs e) { if (_HbData == null) { return; } var popup = new CurePotencyWindow(_HbData.CurePotencySets); if (popup.ShowDialog() == true) { _HbData.CurePotencySets = popup.ModifiedCurePotencySets; if (!_HbData.SaveCurePotencySets()) { var msg = new CustomMessageDialog("ERROR", "There was an issue saving the data to cure_potency.lua"); msg.ShowDialog(); } } }
private void Button_AddNewSet_Click(object sender, RoutedEventArgs e) { var set = txt_NewSetName.Text; var job = cb_NewSetJob.SelectedItem != null?cb_NewSetJob.SelectedItem.ToString() : string.Empty; if (string.IsNullOrEmpty(set) || string.IsNullOrEmpty(job)) { return; } // get default to use as a base. var baseSettings = ModifiedCurePotencySets["default"][""]; var checkForJob = string.Empty; var checkForSet = ModifiedCurePotencySets.Keys.Where(x => x.ToLower() == set.ToLower()).FirstOrDefault(); if (checkForSet == null) { ModifiedCurePotencySets.Add(set, new Dictionary <string, Dictionary <string, List <int> > >()); } else { set = checkForSet; } checkForJob = ModifiedCurePotencySets[set].Keys.Where(x => x.ToLower() == job.ToLower()).FirstOrDefault(); if (checkForJob != null) { var msg = new CustomMessageDialog("ERROR", "Job for this set already exists. Modify the existing Set > Job."); msg.ShowDialog(); SetComboboxesSelectedItems(set, job); } else { ModifiedCurePotencySets[set].Add(job, baseSettings); SetupSetsCombobox(); SetComboboxesSelectedItems(set, job); } ClearAddFields(); }
private void Select_HealbotPlayer_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (IsAdministrator()) { var cb = (ComboBox)sender; var selected = (ComboboxItem)cb.SelectedItem; _ELITEAPI = new EliteAPI((int)selected.Value); FillLists(true); SetupDefaults(); } else { var msg = new CustomMessageDialog("ERROR", "You must run this program as ADMINISTRATOR!"); msg.ShowDialog(); Select_HealbotPlayer.SelectedIndex = -1; } GetHbData(); }
private void Button_SaveBuffs_Click(object sender, RoutedEventArgs e) { if (_HbData == null) { return; } var inputDialog = new CustomInputDialog("Buff list name:", "mybuffs"); if (inputDialog.ShowDialog() == true) { var bufflistname = inputDialog.DialogValue; if (!string.IsNullOrEmpty(bufflistname)) { bufflistname = bufflistname.ToLower().Trim(); // handle duplicate list names automatically var check = _HbData.BuffLists.Where(x => x.Name.ToLower() == bufflistname).FirstOrDefault(); if (check != null) { int i = 1; while (check != null) { i++; var temp = bufflistname + i.ToString(); check = _HbData.BuffLists.Where(x => x.Name.ToLower() == temp).FirstOrDefault(); } } var buffs = new List <string>(); foreach (var item in Lb_Buffs.Items) { if (item.ToString().Contains(_ELITEAPI.Player.Name)) { buffs.Add(item.ToString().Replace(_ELITEAPI.Player.Name + " ", "").Trim()); } } var bufflist = new BuffList { Name = bufflistname, List = new Dictionary <string, List <string> > { { "me", buffs } } }; var msg = new CustomMessageDialog("Saved!", "Buff List: '" + bufflistname + "' has been saved to [..healbot\\data\\buffLists.lua]"); if (_HbData.SaveBuffList(bufflist)) { _HbData = new HealbotData(Settings.Default.WindowerPath); // reload the settings } else { msg = new CustomMessageDialog("ERROR", "An error occured while trying to save the set of buffs!" + Environment.NewLine + Environment.NewLine + "Buff list name: '" + bufflistname + "'"); } msg.ShowDialog(); } } else { var msg = new CustomMessageDialog("ERROR", "A name must be provided in order to save the buffs as a list in [..healbot\\data\\buffLists.lua]"); msg.ShowDialog(); } }