Beispiel #1
0
        public Champion GenerateChampion(int level, ChampionClass championClass, ChampionType championType)
        {
            Champion    result    = null;
            Equipment   equipment = new Equipment();
            List <Item> items     = new List <Item>();

            switch (championClass)
            {
            case ChampionClass.Mage:
            {
                result = new Champion(championClass, championType, string.Empty, this.GenerateExperience(level), level,
                                      StatisticsGenerator.GenerateChampionStatistics(level, championClass, StatisticsGeneratorBoostType.Normal),
                                      StatisticsGenerator.GenerateChampionStatistics(level, championClass, StatisticsGeneratorBoostType.MegaIncrease), //magic
                                      StatisticsGenerator.GenerateChampionStatistics(level, championClass, StatisticsGeneratorBoostType.MegaDecrease), //ranged
                                      StatisticsGenerator.GenerateChampionStatistics(level, championClass, StatisticsGeneratorBoostType.MegaDecrease), //melle
                                      StatisticsGenerator.GenerateChampionStatistics(level, championClass, StatisticsGeneratorBoostType.MegaDecrease), //dexterity
                                      StatisticsGenerator.GenerateChampionStatistics(level, championClass, StatisticsGeneratorBoostType.MegaIncrease), //inteli
                                      StatisticsGenerator.GenerateChampionStatistics(level, championClass, StatisticsGeneratorBoostType.MegaDecrease), //streng
                                      false, equipment, items);

                break;
            }

            case ChampionClass.Range:
            {
                result = new Champion(championClass, championType, string.Empty, this.GenerateExperience(level), level,
                                      StatisticsGenerator.GenerateChampionStatistics(level, championClass, StatisticsGeneratorBoostType.Normal),
                                      StatisticsGenerator.GenerateChampionStatistics(level, championClass, StatisticsGeneratorBoostType.MegaDecrease), //magic
                                      StatisticsGenerator.GenerateChampionStatistics(level, championClass, StatisticsGeneratorBoostType.MegaIncrease), //ranged
                                      StatisticsGenerator.GenerateChampionStatistics(level, championClass, StatisticsGeneratorBoostType.MegaDecrease), //melle
                                      StatisticsGenerator.GenerateChampionStatistics(level, championClass, StatisticsGeneratorBoostType.MegaIncrease), //dexterity
                                      StatisticsGenerator.GenerateChampionStatistics(level, championClass, StatisticsGeneratorBoostType.MegaDecrease), //inteli
                                      StatisticsGenerator.GenerateChampionStatistics(level, championClass, StatisticsGeneratorBoostType.MegaDecrease), //streng
                                      false, equipment, items);

                break;
            }

            case ChampionClass.Warrior:
            {
                result = new Champion(championClass, championType, string.Empty, this.GenerateExperience(level), level,
                                      StatisticsGenerator.GenerateChampionStatistics(level, championClass, StatisticsGeneratorBoostType.Normal),
                                      StatisticsGenerator.GenerateChampionStatistics(level, championClass, StatisticsGeneratorBoostType.MegaDecrease), //magic
                                      StatisticsGenerator.GenerateChampionStatistics(level, championClass, StatisticsGeneratorBoostType.MegaDecrease), //ranged
                                      StatisticsGenerator.GenerateChampionStatistics(level, championClass, StatisticsGeneratorBoostType.MegaIncrease), //melle
                                      StatisticsGenerator.GenerateChampionStatistics(level, championClass, StatisticsGeneratorBoostType.MegaDecrease), //dexterity
                                      StatisticsGenerator.GenerateChampionStatistics(level, championClass, StatisticsGeneratorBoostType.MegaDecrease), //inteli
                                      StatisticsGenerator.GenerateChampionStatistics(level, championClass, StatisticsGeneratorBoostType.MegaIncrease), //streng
                                      false, equipment, items);

                break;
            }
            }

            return(result);
        }
Beispiel #2
0
 public Champion(string name, ChampionType type, Ability leftMouse,
                 Ability rightMouse, Ability q, Ability f, Ability e)
 {
     _name       = name;
     _type       = type;
     _leftMouse  = leftMouse;
     _rightMouse = rightMouse;
     _q          = q;
     _f          = f;
     _e          = e;
 }
Beispiel #3
0
 public Player(ChampionClass championClass, ChampionType championType, string name,
               int experience, int level, Statistics vitality, Statistics magicArmor, Statistics rangedArmor, Statistics melleArmor,
               Statistics dexterity, Statistics intelligence, Statistics strength, bool illness, Equipment equipment, List <Item> bagpack)
     : base(championClass, championType, name, experience, level, vitality, magicArmor, rangedArmor, melleArmor, dexterity, intelligence, strength, illness, equipment, bagpack)
 {
     this.MaxCapacity = 100;
     this.Team        = new Champion[3];
     for (int i = 0; i < this.Team.Length; i++)
     {
         this.Team[i] = new Champion();
     }
 }
Beispiel #4
0
        //CONSTRUCTORS************************************************************

        public Champion(ChampionClass championClass, ChampionType championType, string name,
                        int experience, int level, Statistics vitality, Statistics magicArmor, Statistics rangedArmor, Statistics melleArmor,
                        Statistics dexterity, Statistics intelligence, Statistics strength, bool illness, Equipment equipment, List <Item> bagpack)
        {
            this.Name          = name;
            this.ChampionClass = championClass;
            this.ChampionType  = championType;
            this.Experience    = experience;
            this.Level         = level;
            this.Vitality      = vitality;
            this.MagicArmor    = magicArmor;
            this.RangedArmor   = rangedArmor;
            this.MelleArmor    = melleArmor;
            this.Dexterity     = dexterity;
            this.Intelligence  = intelligence;
            this.Strength      = strength;
            this.IsIllness     = illness;

            this.Equipment = equipment;
            this.Bagpack   = new List <Item>(bagpack);

            CalculateHash();
        }
Beispiel #5
0
        public static String DownloadImageRiot(String sName, ChampionType champType, DownloadType type, String subFolder, int skinId = 0)
        {
            String name = "";
            String version = "";
            try
            {
                String json = new WebClient().DownloadString("http://ddragon.leagueoflegends.com/realms/euw.json");
                version = (string)new JavaScriptSerializer().Deserialize<Dictionary<String, Object>>(json)["v"];
            }
            catch (Exception ex)
            {
                Console.WriteLine("Cannot download file: {0}, Exception: {1}", name, ex);
                return "";
            }
            name = ConvertNames(sName);
            try
            {
                switch (champType)
                {
                    case ChampionType.Champion:
                        name = GetChampionPicName("http://ddragon.leagueoflegends.com/cdn/" + version + "/data/en_US/champion/" + sName + ".json");
                        break;

                    case ChampionType.ChampionSkin:
                        name = GetChampionSkinPicName("http://ddragon.leagueoflegends.com/cdn/" + version + "/data/en_US/champion/" + sName + ".json", skinId);
                        break;

                    case ChampionType.SpellQ:
                        name = GetSpellPicName("http://ddragon.leagueoflegends.com/cdn/" + version + "/data/en_US/champion/" + sName + ".json", 0);
                        break;

                    case ChampionType.SpellW:
                        name = GetSpellPicName("http://ddragon.leagueoflegends.com/cdn/" + version + "/data/en_US/champion/" + sName + ".json", 1);
                        break;

                    case ChampionType.SpellE:
                        name = GetSpellPicName("http://ddragon.leagueoflegends.com/cdn/" + version + "/data/en_US/champion/" + sName + ".json", 2);
                        break;

                    case ChampionType.SpellR:
                        name = GetSpellPicName("http://ddragon.leagueoflegends.com/cdn/" + version + "/data/en_US/champion/" + sName + ".json", 3);
                        break;

                    case ChampionType.SpellPassive:
                        name = GetSpellPicName("http://ddragon.leagueoflegends.com/cdn/" + version + "/data/en_US/champion/" + sName + ".json", 4);
                        break;

                    case ChampionType.Summoner1:
                    case ChampionType.Summoner2:
                        name = GetSummonerSpellPicName("http://ddragon.leagueoflegends.com/cdn/" + version + "/data/en_US/summoner.json", name);
                        break;
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("Cannot download file: {0}, ChampType: {1}, Exception: {2}", name, sName, ex);
                return "";
            }
            WebRequest request = null;
            WebRequest requestSize = null;
            if (type == DownloadType.Champion)
            {
                request =
                WebRequest.Create("http://ddragon.leagueoflegends.com/cdn/" + version + "/img/champion/" + name);
                requestSize =
                WebRequest.Create("http://ddragon.leagueoflegends.com/cdn/" + version + "/img/champion/" + name);
                requestSize.Method = "HEAD";
            }
            else if (type == DownloadType.ChampionSkinSmall)
            {
                request =
                WebRequest.Create("http://ddragon.leagueoflegends.com/cdn/img/champion/loading/" + name);
                requestSize =
                WebRequest.Create("http://ddragon.leagueoflegends.com/cdn/img/champion/loading/" + name);
                requestSize.Method = "HEAD";
            }
            else if (type == DownloadType.ChampionSkinBig)
            {
                request =
                WebRequest.Create("http://ddragon.leagueoflegends.com/cdn/img/champion/splash/" + name);
                requestSize =
                WebRequest.Create("http://ddragon.leagueoflegends.com/cdn/img/champion/splash/" + name);
                requestSize.Method = "HEAD";
            }
            else if (type == DownloadType.Spell)
            {
                //http://ddragon.leagueoflegends.com/cdn/4.20.1/img/spell/AhriFoxFire.png
                request =
                WebRequest.Create("http://ddragon.leagueoflegends.com/cdn/" + version + "/img/spell/" + name);
                requestSize =
                WebRequest.Create("http://ddragon.leagueoflegends.com/cdn/" + version + "/img/spell/" + name);
                requestSize.Method = "HEAD";
            }
            else if (type == DownloadType.Summoner)
            {
                //summonerexhaust
                if (name.Contains("summonerodingarrison"))
                    name = "SummonerOdinGarrison";
                else
                    name = name[0].ToString().ToUpper() + name.Substring(1, 7) + name[8].ToString().ToUpper() + name.Substring(9, name.Length - 9);
                request =
                WebRequest.Create("http://ddragon.leagueoflegends.com/cdn/" + version + "/img/spell/" + name);
                requestSize =
                WebRequest.Create("http://ddragon.leagueoflegends.com/cdn/" + version + "/img/spell/" + name);
                requestSize.Method = "HEAD";
            }
            else if (type == DownloadType.Passive)
            {
                request =
                WebRequest.Create("http://ddragon.leagueoflegends.com/cdn/" + version + "/img/passive/" + name);
                requestSize =
                WebRequest.Create("http://ddragon.leagueoflegends.com/cdn/" + version + "/img/passive/" + name);
                requestSize.Method = "HEAD";
            }
            else if (type == DownloadType.Item)
            {
                //http://ddragon.leagueoflegends.com/cdn/4.20.1/img/spell/AhriFoxFire.png
                request =
                WebRequest.Create("http://ddragon.leagueoflegends.com/cdn/" + version + "/img/spell/" + name);
                requestSize =
                WebRequest.Create("http://ddragon.leagueoflegends.com/cdn/" + version + "/img/spell/" + name);
                requestSize.Method = "HEAD";
            }
            else if (type == DownloadType.ProfileIcon)
            {
                //http://ddragon.leagueoflegends.com/cdn/4.20.1/img/spell/AhriFoxFire.png
                request =
                WebRequest.Create("http://ddragon.leagueoflegends.com/cdn/" + version + "/img/profileicon/" + name);
                requestSize =
                WebRequest.Create("http://ddragon.leagueoflegends.com/cdn/" + version + "/img/profileicon/" + name);
                requestSize.Method = "HEAD";
            }
            if (request == null || requestSize == null)
                return "";
            try
            {
                long fileSize = 0;
                using (WebResponse resp = requestSize.GetResponse())
                {
                    fileSize = resp.ContentLength;
                }
                if (fileSize == GetFileSize(name, subFolder))
                    return name;
                Stream responseStream;
                using (WebResponse response = request.GetResponse())
                using (responseStream = response.GetResponseStream())
                {
                    if (responseStream != null)
                    {
                        using (var memoryStream = new MemoryStream())
                        {
                            responseStream.CopyTo(memoryStream);
                            SaveImage(name, memoryStream.ToArray(), subFolder);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("Cannot download file: {0}, Exception: {1}", name, ex);
            }
            return name;
        }