Ejemplo n.º 1
0
 public void SetCharacter(Character character)
 {
     _region = character.Region;
     _realm  = character.Realm;
     _name   = character.Name;
     _class  = character.Class;
     buildTreeFramework();
 }
Ejemplo n.º 2
0
    public bool HireNewMercenary(Character.CharacterClass p_characterClass)
    {
        if (PlayerData.playerGold < _mercenaryPrices[(int)p_characterClass])
        {
            return(false);
        }

        return(true);
    }
Ejemplo n.º 3
0
 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;
 }
Ejemplo n.º 4
0
 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;
 }
Ejemplo n.º 5
0
        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() + ")";
        }
Ejemplo n.º 6
0
    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);
        }
    }
Ejemplo n.º 7
0
 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);
         }
     }
 }
Ejemplo n.º 8
0
        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() + ")";
        }
Ejemplo n.º 9
0
 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";
     }
 }
Ejemplo n.º 10
0
        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);
                }
            }
        }
Ejemplo n.º 11
0
        /// <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);
        }
Ejemplo n.º 12
0
        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";
            }
        }
Ejemplo n.º 13
0
        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;
        }
Ejemplo n.º 14
0
 public void SetParameters(TalentTree tree, Character.CharacterClass charClass)
 {
     buildTrees(tree, charClass);
 }
Ejemplo n.º 15
0
 /// <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);
     }
 }
Ejemplo n.º 16
0
 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())));
 }