public void SetCharacter(Character character) { _region = character.Region; _realm = character.Realm; _name = character.Name; _class = character.Class; buildTreeFramework(); }
public bool HireNewMercenary(Character.CharacterClass p_characterClass) { if (PlayerData.playerGold < _mercenaryPrices[(int)p_characterClass]) { return(false); } return(true); }
public TalentIcon(TalentForm parentForm, TalentItem ti, Character.CharacterClass charClass) : this(parentForm) { Talent = ti; _name = ti.Name; CharClass = charClass; getIcon(ti, charClass); panel1.Width = _icon.Width; panel1.Height = _icon.Height; }
public TalentIcon(TalentItem ti, Character.CharacterClass charClass, Label treeLabel) : this() { Talent = ti; _name = ti.Name; _treeLabel = treeLabel; CharClass = charClass; getIcon(ti, charClass); panel1.Width = _icon.Width; panel1.Height = _icon.Height; }
private void buildPanel(Panel p, List <TalentItem> tals, Character.CharacterClass charClass, GroupBox gb, string tree) { int points = 0; int _vertbuffer = 5; int _horizbuffer = 2; int maxVert = 0; tals.ForEach(delegate(TalentItem ti) { maxVert = ti.VerticalPosition > maxVert ? ti.VerticalPosition : maxVert; }); int maxHoriz = 0; tals.ForEach(delegate(TalentItem ti) { maxHoriz = ti.HorizontalPosition > maxHoriz ? ti.HorizontalPosition : maxHoriz; }); /* "talent[i] = [0, \"Improved Eviscerate\", 3, 1, 1]; i++;" * ??, name, rank, horiz, vert */ TalentIcon bg = new TalentIcon(new TalentItem("talent[i] = [0, \"background\", 0, 0, 0];", tree), charClass, gb); p.BackgroundImage = bg.getIcon(); TalentIcon temp = new TalentIcon(); p.Width = ((maxHoriz) * _horizbuffer + maxHoriz * temp.Width); p.Height = ((maxVert) * _vertbuffer + (maxVert) * temp.Height); int vertoffset = 0; for (int row = 1; row <= maxVert; row++) { int horizoffset = 0; vertoffset += _vertbuffer; int maxCurrHoriz = 0; tals.ForEach(delegate(TalentItem ti) { if (ti.VerticalPosition == row) { maxCurrHoriz = ti.HorizontalPosition > maxCurrHoriz ? ti.HorizontalPosition : maxCurrHoriz; } }); for (int col = 1; col <= maxCurrHoriz; col++) { horizoffset += _horizbuffer; //temp = new TalentIcon(tals.Find(ti => ti.VerticalPosition == row && ti.HorizontalPosition == col), CharClass); TalentItem ti = tals.Find(delegate(TalentItem ti2) { return(ti2.VerticalPosition == row && ti2.HorizontalPosition == col); }); if (ti != null) { points += ti.PointsInvested; temp = new TalentIcon(ti, charClass, gb); temp.Location = new Point(horizoffset, vertoffset); p.Controls.Add(temp); } horizoffset += temp.Width; } vertoffset += temp.Height; } gb.Text = tree + " (" + points.ToString() + ")"; }
public Character CreateNewCharacter(Character.CharacterClass p_characterClass) { switch (p_characterClass) { case Character.CharacterClass.WARRIOR: return(warrior.WarriorConstructor()); case Character.CharacterClass.ARCHER: return(archer.ArcherConstructor()); default: return(null); } }
private void getIcon(TalentItem ti, Character.CharacterClass charclass) { if (_icon == null) { WebRequestWrapper wrw = new WebRequestWrapper(); string filePath = wrw.DownloadTalentIcon(charclass, ti.Tree.Replace(" ", ""), ti.Name.Replace(" ", "").Replace(":", "")); if (!String.IsNullOrEmpty(filePath)) { _icon = new Bitmap(filePath); } } }
private void buildPanel(Panel p, List <TalentItem> tals, Character.CharacterClass charclass, Label treeLabel, string treeName) { int points = 0; int _vertbuffer = 5; int _horizbuffer = 2; int maxVert = 0; tals.ForEach(delegate(TalentItem ti) { maxVert = ti.VerticalPosition > maxVert ? ti.VerticalPosition : maxVert; }); int maxHoriz = 0; tals.ForEach(delegate(TalentItem ti) { maxHoriz = ti.HorizontalPosition > maxHoriz ? ti.HorizontalPosition : maxHoriz; }); TalentIcon temp = new TalentIcon(); p.Width = ((maxHoriz) * _horizbuffer + maxHoriz * temp.Width); p.Height = ((maxVert) * _vertbuffer + (maxVert) * temp.Height); int vertoffset = 0; for (int row = 1; row <= maxVert; row++) { int horizoffset = 0; vertoffset += _vertbuffer; int maxCurrHoriz = 0; tals.ForEach(delegate(TalentItem ti) { if (ti.VerticalPosition == row) { maxCurrHoriz = ti.HorizontalPosition > maxCurrHoriz ? ti.HorizontalPosition : maxCurrHoriz; } }); for (int col = 1; col <= maxCurrHoriz; col++) { horizoffset += _horizbuffer; //temp = new TalentIcon(tals.Find(ti => ti.VerticalPosition == row && ti.HorizontalPosition == col), CharClass); TalentItem ti = tals.Find(delegate(TalentItem ti2) { return(ti2.VerticalPosition == row && ti2.HorizontalPosition == col); }); if (ti != null) { points += ti.PointsInvested; temp = new TalentIcon(ti, charclass, treeLabel); temp.Location = new Point(horizoffset, vertoffset); p.Controls.Add(temp); } horizoffset += temp.Width; } vertoffset += temp.Height; } treeLabel.Text = treeName + " (" + points.ToString() + ")"; }
private void buildTrees(TalentTree tree, Character.CharacterClass CharClass) { if (tree != null) { //TalentTree trees, List<TalentPanel> panels, List<Label> labels, Character.CharacterClass charclass Panel[] panels = new Panel[] { panel1, panel2, panel3 }; Label[] labels = new Label[] { label1, label2, label3 }; int index = 0; foreach (string treeName in tree.Trees.Keys) { buildPanel(panels[index], tree.Trees[treeName], CharClass, labels[index], treeName); index++; } this.Width = panel3.Location.X + panel1.Location.X + panel3.Width;; this.Height = panel1.Location.Y + panel1.Height + 40; this.Text = CharClass + " talent tree"; } }
private void getIcon(TalentItem ti, Character.CharacterClass charclass) { string filePath = ""; if (_icon == null) { WebRequestWrapper wrw = new WebRequestWrapper(); try { filePath = wrw.DownloadTalentIcon(charclass, ti.Tree.Replace(" ", ""), ti.Name.Replace(" ", "")); } catch (Exception e) { MessageBox.Show("Error downloading talent icon for " + ti.Name + ": " + e.ToString()); } if (!String.IsNullOrEmpty(filePath)) { _icon = new Bitmap(filePath); } } }
/// <summary> /// Downloads the icon associated with the talent passed in /// </summary> /// <param name="charClass">CharacterClass of the given icon</param> /// <param name="talentTree">name of the talent tree</param> /// <param name="talentName">name of the talent</param> /// <returns>The full path to the downloaded icon. Null is returned if no icon could be downloaded</returns> public string DownloadTalentIcon(Character.CharacterClass charClass, string talentTree, string talentName) { string imageName = talentTree + "_" + talentName + ".jpg"; string fullPathToSave = Path.Combine(TalentImageCachePath, charClass.ToString().ToLower() + "\\" + imageName); if (!String.IsNullOrEmpty(talentTree) && !String.IsNullOrEmpty(talentName)) { //0 = class, 1=tree, 2=talentname - all lowercase //@"http://www.worldofwarcraft.com/shared/global/talents/{0}/images/{1}/{2}.jpg"; string uri = string.Format(NetworkSettingsProvider.WoWTalentIconURI, charClass.ToString().ToLower(), talentTree.ToLower(), talentName.ToLower()); DownloadFile(uri, fullPathToSave, CONTENT_JPG); } if (!File.Exists(fullPathToSave)) { fullPathToSave = null; } return(fullPathToSave); }
private void buildTrees(TalentTree tree, Character.CharacterClass charClass) { if (tree != null) { Tree = tree; CharClass = charClass; Panel[] panels = new Panel[] { panelAssassination, panelCombat, panelSubtlety }; GroupBox[] groups = new GroupBox[] { groupBoxAssassination, groupBoxCombat, groupBoxSubtlety }; int index = 0; foreach (string treeName in tree.Trees.Keys) { buildPanel(panels[index], tree.Trees[treeName], charClass, groups[index], treeName); index++; } this.Width = groupBoxSubtlety.Location.X + groupBoxAssassination.Location.X + groupBoxSubtlety.Width; this.Height = groupBoxAssassination.Location.Y + groupBoxAssassination.Height + 40; this.Text = CharClass + " Talent Tree"; } }
public TalentIcon(TalentItem ti, Character.CharacterClass charClass, GroupBox gb) : this() { Talent = ti; _name = ti.Name; _gb = gb; CharClass = charClass; getIcon(ti, charClass); if (_icon == null) { _icon = new Bitmap(43, 45); for (int i = 0; i < 43; i++) { _icon.SetPixel(i, i, Color.Red); _icon.SetPixel(43 - i - 1, i, Color.Red); } } panelIcon.Width = _icon.Width; panelIcon.Height = _icon.Height; }
public void SetParameters(TalentTree tree, Character.CharacterClass charClass) { buildTrees(tree, charClass); }
/// <summary> /// Return character progression Title based on it's flags /// </summary> /// <param name="difficulty">aka progression</param> /// <param name="expansion"></param> /// <param name="hardcore"></param> /// <param name="charClass"></param> /// <returns></returns> public static string GetCharTitle(byte difficulty, bool expansion, bool hardcore, Character.CharacterClass charClass) { { var v = difficulty; if (expansion) { if (v >= 5 && v <= 8) { return(hardcore ? "Destroyer" : "Slayer"); } if (v >= 10 && v <= 13) { return(hardcore ? "Conqueror" : "Champion"); } if (v == 15) { return(hardcore ? "Guardian" : (charClass == Character.CharacterClass.Amazon || charClass == Character.CharacterClass.Assassin || charClass == Character.CharacterClass.Sorceress) ? "Matriarch" : "Patriarch"); } } else { if (v >= 4 && v <= 7) { return((charClass == Character.CharacterClass.Amazon || charClass == Character.CharacterClass.Assassin || charClass == Character.CharacterClass.Sorceress) ? hardcore ? "Countess" : "Dame" : hardcore ? "Count" : "Sir"); } if (v >= 8 && v <= 11) { return((charClass == Character.CharacterClass.Amazon || charClass == Character.CharacterClass.Assassin || charClass == Character.CharacterClass.Sorceress) ? hardcore ? "Duchess" : "Lady" : hardcore ? "Duke" : "Lord"); } if (v >= 8 && v <= 11) { return((charClass == Character.CharacterClass.Amazon || charClass == Character.CharacterClass.Assassin || charClass == Character.CharacterClass.Sorceress) ? hardcore ? "Queen" : "Baroness" : hardcore ? "King" : "Baron"); } } return(string.Empty); } }
public string DownloadClassTalentTree(Character.CharacterClass characterClass) { //http://www.worldofwarcraft.com/shared/global/talents/{0}/data.js return(DownloadText(string.Format(NetworkSettingsProvider.ClassTalentURI, characterClass.ToString().ToLower()))); }