private void SortList() { mainView.ManaTotal.Text = "Mana needed: " + manaTracker.ManaNeededToRefillItems; mainView.UnretainedTotal.Text = "Unretained Items: " + manaTracker.NumberOfUnretainedItems; if (mainView.ManaList.RowCount == 0) { return; } for (int row = 0; row < mainView.ManaList.RowCount - 1; row++) { for (int compareRow = row + 1; compareRow < mainView.ManaList.RowCount; compareRow++) { if (double.Parse(((HudStaticText)mainView.ManaList[row][6]).Text) > double.Parse(((HudStaticText)mainView.ManaList[compareRow][6]).Text)) { VirindiViewService.ACImage obj0 = ((HudPictureBox)mainView.ManaList[row][0]).Image; ((HudPictureBox)mainView.ManaList[row][0]).Image = ((HudPictureBox)mainView.ManaList[compareRow][0]).Image; ((HudPictureBox)mainView.ManaList[compareRow][0]).Image = obj0; string obj1 = ((HudStaticText)mainView.ManaList[row][1]).Text; ((HudStaticText)mainView.ManaList[row][1]).Text = ((HudStaticText)mainView.ManaList[compareRow][1]).Text; ((HudStaticText)mainView.ManaList[compareRow][1]).Text = obj1; VirindiViewService.ACImage obj2 = ((HudPictureBox)mainView.ManaList[row][2]).Image; ((HudPictureBox)mainView.ManaList[row][2]).Image = ((HudPictureBox)mainView.ManaList[compareRow][2]).Image; ((HudPictureBox)mainView.ManaList[compareRow][2]).Image = obj2; string obj3 = ((HudStaticText)mainView.ManaList[row][3]).Text; ((HudStaticText)mainView.ManaList[row][3]).Text = ((HudStaticText)mainView.ManaList[compareRow][3]).Text; ((HudStaticText)mainView.ManaList[compareRow][3]).Text = obj3; string obj4 = ((HudStaticText)mainView.ManaList[row][4]).Text; ((HudStaticText)mainView.ManaList[row][4]).Text = ((HudStaticText)mainView.ManaList[compareRow][4]).Text; ((HudStaticText)mainView.ManaList[compareRow][4]).Text = obj4; string obj5 = ((HudStaticText)mainView.ManaList[row][5]).Text; ((HudStaticText)mainView.ManaList[row][5]).Text = ((HudStaticText)mainView.ManaList[compareRow][5]).Text; ((HudStaticText)mainView.ManaList[compareRow][5]).Text = obj5; string obj6 = ((HudStaticText)mainView.ManaList[row][6]).Text; ((HudStaticText)mainView.ManaList[row][6]).Text = ((HudStaticText)mainView.ManaList[compareRow][6]).Text; ((HudStaticText)mainView.ManaList[compareRow][6]).Text = obj6; } } } }
public void SetImage(string name, VirindiViewService.ACImage image) { HudButton temp = (HudButton)popoutview[name]; temp.Image = image; }
void LoadConfig(string configName) { for (int i = 0; i < ConfigChoice.Count; i++) { if (((HudStaticText)ConfigChoice[i]).Text == configName.Trim()) { ConfigChoice.Current = i; } } string[] configInfo = Util.GetConfig(configName.Trim()); if (configInfo != null) { foreach (string line in configInfo) { try { if (line.Contains("LAYOUT:")) { string layoutTemp = line.Remove(0, "LAYOUT:".Length).Trim(); GenerateLayout(layoutTemp); } else { string[] col = line.Split(','); if (view[col[0]].GetType() == typeof(HudButton)) { HudButton temp = (HudButton)view[col[0]]; string currentTabName = col[0].Substring(0, col[0].IndexOf('_')); //check if button exists if (temp != null) { //Check if button should be set to visible if (col[1].Contains("NOTSET")) { temp.Visible = false; popoutWindows[currentTabName].ChangeBtnInfo(col[0], false, ""); } //If button is an image button // Register the button event handler and make visible else { if (col[1].Contains("[") && col[1].Contains("]")) { //Remove button, replace with image button and register bindings //temp.Visible = false; string clean = col[1].Replace("[", ""); clean = clean.Replace("]", ""); //Format : [<icon id>|<text>] int iconImage = 0; if (!clean.Contains("|")) { iconImage = int.Parse(clean); VirindiViewService.ACImage tempImage = new VirindiViewService.ACImage(iconImage); popoutWindows[currentTabName].SetImage(col[0], tempImage); popoutWindows[currentTabName].ChangeBtnInfo(col[0], true, ""); temp.Image = tempImage; temp.Text = ""; } else { string[] imageSettings = clean.Split('|'); iconImage = int.Parse(imageSettings[0]); int iconBG = 0; if (imageSettings.Length > 1) { if (int.TryParse(imageSettings[1], out iconBG)) { popoutWindows[currentTabName].SetImage(col[0], new VirindiViewService.ACImage(iconImage)); popoutWindows[currentTabName].ChangeBtnInfo(col[0], true, ""); temp.Image = new VirindiViewService.ACImage(iconImage); temp.Image = new VirindiViewService.ACImage(iconBG); Util.WriteToChat("Adding Double Image"); if (imageSettings.Length == 3) { temp.Text = imageSettings[2]; } } else { VirindiViewService.ACImage tempImage = new VirindiViewService.ACImage(iconImage); popoutWindows[currentTabName].SetImage(col[0], tempImage); popoutWindows[currentTabName].ChangeBtnInfo(col[0], true, imageSettings[1]); temp.Image = tempImage; if (imageSettings.Length == 2) { temp.Text = imageSettings[1]; } } } } } else { temp.Text = col[1]; popoutWindows[currentTabName].ChangeBtnInfo(col[0], true, col[1]); } temp.Visible = true; //Creates the event handler for each button if (col[2].Contains("[player]")) { col[2] = col[2].Replace("[player]", Core.CharacterFilter.Name); } if (col[2].Contains("[loc]")) { col[2] = col[2].Replace("[loc]", Core.WorldFilter.GetByName(Core.CharacterFilter.Name).First.Coordinates().ToString()); } var regexItem = new Regex("^[a-zA-Z0-9 ]*$"); if (col[2].StartsWith("/") || regexItem.IsMatch(col[2])) { //if is a /tell command if (col.Length == 4 && col[2].StartsWith("/")) { EventHandler newEvent = new EventHandler((s, e) => ClickCommand(s, e, col[2] + "," + col[3])); EventHandler newPopupEvent = new EventHandler((s, e) => ClickCommand(s, e, col[2] + "," + col[3])); popoutWindows[currentTabName].SetEvent(col[0], newPopupEvent); if (regEvents.ContainsKey(col[0])) { //Unregister the event handler temp.Hit -= regEvents[col[0]]; //Store the event inside the dictionary so we can unregister it later regEvents[col[0]] = newEvent; } else { //Replace the event regEvents[col[0]] = newEvent; } //Register the event temp.Hit += newEvent; } //Handle / commands else if (col[2].StartsWith("/")) { EventHandler newEvent = new EventHandler((s, e) => ClickCommand(s, e, col[2])); EventHandler newPopupEvent = new EventHandler((s, e) => ClickCommand(s, e, col[2])); popoutWindows[currentTabName].SetEvent(col[0], newPopupEvent); if (regEvents.ContainsKey(col[0])) { //Unregister the event handler temp.Hit -= regEvents[col[0]]; //Store the event inside the dictionary so we can unregister it later regEvents[col[0]] = newEvent; } else { //Replace the event regEvents[col[0]] = newEvent; } //Register the event temp.Hit += newEvent; } //Handle raw text else { EventHandler newEvent = new EventHandler((s, e) => ClickCommand(s, e, chatLoc + " " + col[2])); EventHandler newPopupEvent = new EventHandler((s, e) => ClickCommand(s, e, chatLoc + " " + col[2])); popoutWindows[currentTabName].SetEvent(col[0], newPopupEvent); if (regEvents.ContainsKey(col[0])) { //Unregister the event handler temp.Hit -= regEvents[col[0]]; //Store the event inside the dictionary so we can unregister it later regEvents[col[0]] = newEvent; } else { //Replace the event regEvents[col[0]] = newEvent; } //Register the event temp.Hit += newEvent; } } else { EventHandler newEvent = new EventHandler((s, e) => ClickCommand(s, e, chatLoc + " " + col[2])); EventHandler newPopupEvent = new EventHandler((s, e) => ClickCommand(s, e, chatLoc + " " + col[2])); popoutWindows[currentTabName].SetEvent(col[0], newPopupEvent); if (regEvents.ContainsKey(col[0])) { //Unregister the event handler temp.Hit -= regEvents[col[0]]; //Store the event inside the dictionary so we can unregister it later regEvents[col[0]] = newEvent; } else { //Replace the event regEvents[col[0]] = newEvent; } //Register the event temp.Hit += newEvent; } } } } } } catch (Exception ex) { Util.WriteToChat("Error Loading Config at :" + line + "\n : Error: " + ex.Message + "\n" + ex.StackTrace); } } } else { Util.WriteToChat("Error Loading Config!"); } }