Пример #1
0
        public static void InsertExtraChampData(champions Champ)
        {
            string champJSON = File.ReadAllText(Path.Combine(Client.ExecutingDirectory, "Assets", "data", "en_US", "champion", Champ.name + ".json"));
            JavaScriptSerializer serializer = new JavaScriptSerializer();
            Dictionary<string, object> deserializedJSON = serializer.Deserialize<Dictionary<string, object>>(champJSON);
            Dictionary<string, object> temp = deserializedJSON["data"] as Dictionary<string, object>;
            Dictionary<string, object> champData = temp[Champ.name] as Dictionary<string, object>;

            Champ.Lore = champData["lore"] as string;
            Champ.ResourceType = champData["partype"] as string;
            Champ.Skins = champData["skins"] as ArrayList;
            ArrayList Spells = (ArrayList)champData["spells"];
            Champ.Spells = new List<Spell>();

            foreach (Dictionary<string, object> champSpells in Spells)
            {
                Spell NewSpell = new Spell();
                NewSpell.ID = champSpells["id"] as string;
                NewSpell.Name = champSpells["name"] as string;
                NewSpell.Description = champSpells["description"] as string;
                NewSpell.Tooltip = champSpells["tooltip"] as string;
                NewSpell.MaxRank = champSpells["maxrank"] as string;

                Champ.Spells.Add(NewSpell);
            }
        }
Пример #2
0
        public static void InsertExtraChampData(champions Champ)
        {
            string champJSON = File.ReadAllText(Path.Combine(Client.ExecutingDirectory, "Assets", "data", "en_US", "champion", Champ.name + ".json"));
            JavaScriptSerializer serializer = new JavaScriptSerializer();
            Dictionary<string, object> deserializedJSON = serializer.Deserialize<Dictionary<string, object>>(champJSON);
            Dictionary<string, object> temp = deserializedJSON["data"] as Dictionary<string, object>;
            Dictionary<string, object> champData = temp[Champ.name] as Dictionary<string, object>;

            Champ.Lore = champData["lore"] as string;
            Champ.ResourceType = champData["partype"] as string;
            Champ.Skins = champData["skins"] as ArrayList;
            ArrayList Spells = (ArrayList)champData["spells"];
            Champ.Spells = new List<Spell>();

            foreach (Dictionary<string, object> champSpells in Spells)
            {
                Spell NewSpell = new Spell();
                NewSpell.ID = champSpells["id"] as string;
                NewSpell.Name = champSpells["name"] as string;
                NewSpell.Description = champSpells["description"] as string;
                NewSpell.Tooltip = champSpells["tooltip"] as string;
                NewSpell.MaxRank = (int)champSpells["maxrank"];
                Dictionary<string, object> Image = (Dictionary<string, object>)champSpells["image"];
                NewSpell.Image = Image["full"] as string;
                foreach (Dictionary<string, object> x in (ArrayList)champSpells["vars"])
                {
                    string Type = x["link"] as string;
                    Type = Type.Replace("spelldamage", "Ability Power");
                    Type = Type.Replace("bonusattackdamage", "Bonus Attack Damage");
                    Type = Type.Replace("attackdamage", "Total Attack Damage");
                    Type = Type.Replace("armor", "Armor");
                    NewSpell.Tooltip = NewSpell.Tooltip.Replace("{{ " + x["key"] + " }}", Convert.ToString(x["coeff"]) + " " + Type);
                }

                int i = 0;
                foreach (ArrayList x in (ArrayList)champSpells["effect"])
                {
                    string Scaling = "";
                    if (x == null)
                        continue;

                    foreach (var y in x)
                        Scaling += y + "/";

                    Scaling = Scaling.Substring(0, Scaling.Length - 1);

                    i++;
                    NewSpell.Tooltip = NewSpell.Tooltip.Replace("{{ e" + i + " }}", Scaling);
                }

                NewSpell.Tooltip = NewSpell.Tooltip.Replace("<br>", Environment.NewLine);
                NewSpell.Tooltip = Regex.Replace(NewSpell.Tooltip, "<.*?>", string.Empty);

                Champ.Spells.Add(NewSpell);
            }
        }
        public void RenderChampions(int ChampionId)
        {
            champions Champ = champions.GetChampion(ChampionId);
            TheChamp = Champ;
            if (TheChamp.IsFavourite)
                FavouriteLabel.Content = "Unfavourite";
            else
                FavouriteLabel.Content = "Favourite";
            ChampionName.Content = Champ.displayName;
            ChampionTitle.Content = Champ.title;
            ChampionProfileImage.Source = Champ.icon;
            AttackProgressBar.Value = Champ.ratingAttack;
            DefenseProgressBar.Value = Champ.ratingDefense;
            AbilityProgressBar.Value = Champ.ratingMagic;
            DifficultyProgressBar.Value = Champ.ratingDifficulty;

            HPLabel.Content = string.Format("HP: {0} (+{1} per level)", Champ.healthBase, Champ.healthLevel);
            ResourceLabel.Content = string.Format("{0}: {1} (+{2} per level)", Champ.ResourceType, Champ.manaBase, Champ.manaLevel);
            HPRegenLabel.Content = string.Format("HP/5: {0} (+{1} per level)", Champ.healthRegenBase, Champ.healthRegenLevel);
            ResourceRegenLabel.Content = string.Format("{0}/5: {1} (+{2} per level)", Champ.ResourceType, Champ.manaRegenBase, Champ.manaRegenLevel);
            MagicResistLabel.Content = string.Format("MR: {0} (+{1} per level)", Champ.magicResistBase, Champ.magicResistLevel);
            ArmorLabel.Content = string.Format("Armor: {0} (+{1} per level)", Champ.armorBase, Champ.armorLevel);
            AttackDamageLabel.Content = string.Format("AD: {0} (+{1} per level)", Champ.attackBase, Champ.attackLevel);
            RangeLabel.Content = string.Format("Range: {0}", Champ.range);
            MovementSpeedLabel.Content = string.Format("Speed: {0}", Champ.moveSpeed);

            foreach (Dictionary<string, object> Skins in Champ.Skins)
            {
                int Skin = Convert.ToInt32(Skins["id"]);
                ListViewItem item = new ListViewItem();
                Image skinImage = new Image();
                var uriSource = Path.Combine(Client.ExecutingDirectory, "Assets", "champions", championSkins.GetSkin(Skin).portraitPath);
                skinImage.Source = Client.GetImage(uriSource);
                skinImage.Width = 96.25;
                skinImage.Height = 175;
                skinImage.Stretch = Stretch.UniformToFill;
                item.Tag = Skin;
                item.Content = skinImage;
                SkinSelectListView.Items.Add(item);
            }

            foreach (Spell Sp in Champ.Spells)
            {
                ChampionDetailAbility detailAbility = new ChampionDetailAbility();
                detailAbility.DataContext = Sp;
                var uriSource = Path.Combine(Client.ExecutingDirectory, "Assets", "spell", Sp.Image);
                detailAbility.AbilityImage.Source = Client.GetImage(uriSource);
                AbilityListView.Items.Add(detailAbility);
            }

            ChampionImage.Source = Client.GetImage(Path.Combine(Client.ExecutingDirectory, "Assets", "champions", Champ.splashPath));

            LoreText.Text = Champ.Lore.Replace("<br>", Environment.NewLine);
            TipsText.Text = string.Format("Tips while playing {0}:{1}{2}{2}{2}Tips while playing aginst {0}:{3}", Champ.displayName, Champ.tips.Replace("*", Environment.NewLine + "*"), Environment.NewLine, Champ.opponentTips.Replace("*", Environment.NewLine + "*"));
        }
Пример #4
0
 public ChampStats(int champName, int playerName)
 {
     Champ = champions.GetChampion(champName);
     ChampID = Champ.id;
     Load(playerName);
 }
Пример #5
0
 public ChampStats(string champName, string playerName)
 {
     Champ = champions.GetChampion(champName);
     ChampID = Champ.id;
     LoadName(playerName);
 }
        public void RenderChampions(int championId)
        {
            champions champ = champions.GetChampion(championId);
            TheChamp = champ;
            FavoUriteLabel.Content = TheChamp.IsFavoUrite ? "UnfavoUrite" : "FavoUrite";
            ChampionName.Content = champ.displayName;
            ChampionTitle.Content = champ.title;
            ChampionProfileImage.Source = champ.icon;
            AttackProgressBar.Value = champ.ratingAttack;
            DefenseProgressBar.Value = champ.ratingDefense;
            AbilityProgressBar.Value = champ.ratingMagic;
            DifficultyProgressBar.Value = champ.ratingDifficulty;

            HPLabel.Content = string.Format("HP: {0} (+{1} per level)", champ.healthBase, champ.healthLevel);
            ResourceLabel.Content = string.Format("{0}: {1} (+{2} per level)", champ.ResourceType, champ.manaBase,
                champ.manaLevel);
            HPRegenLabel.Content = string.Format("HP/5: {0} (+{1} per level)", champ.healthRegenBase,
                champ.healthRegenLevel);
            ResourceRegenLabel.Content = string.Format("{0}/5: {1} (+{2} per level)", champ.ResourceType,
                champ.manaRegenBase, champ.manaRegenLevel);
            MagicResistLabel.Content = string.Format("MR: {0} (+{1} per level)", champ.magicResistBase,
                champ.magicResistLevel);
            ArmorLabel.Content = string.Format("Armor: {0} (+{1} per level)", champ.armorBase, champ.armorLevel);
            AttackDamageLabel.Content = string.Format("AD: {0} (+{1} per level)", champ.attackBase, champ.attackLevel);
            RangeLabel.Content = string.Format("Range: {0}", champ.range);
            MovementSpeedLabel.Content = string.Format("Speed: {0}", champ.moveSpeed);

            if (champ.Skins != null)
                foreach (Dictionary<string, object> skins in champ.Skins)
                {
                    int skin = Convert.ToInt32(skins["id"]);
                    var item = new ListViewItem();
                    var skinImage = new Image();
                    string UriSource = Path.Combine(Client.ExecutingDirectory, "Assets", "champions",
                        championSkins.GetSkin(skin).portraitPath);
                    skinImage.Source = Client.GetImage(UriSource);
                    skinImage.Width = 96.25;
                    skinImage.Height = 175;
                    skinImage.Stretch = Stretch.UniformToFill;
                    item.Tag = skin;
                    item.Content = skinImage;
                    SkinSelectListView.Items.Add(item);
                }

            if (champ.Spells != null)
                foreach (ChampionDetailAbility detailAbility in from sp in champ.Spells
                    let UriSource = Path.Combine(Client.ExecutingDirectory, "Assets", "spell", sp.Image)
                    select new ChampionDetailAbility
                    {
                        AbilityImage = {Source = Client.GetImage(UriSource)},
                        AbilityName = {Content = sp.Name},
                        AbilityDescription = {Text = sp.Description.Replace("<br>", Environment.NewLine)}
                    })
                    AbilityListView.Items.Add(detailAbility);

            ChampionImage.Source =
                Client.GetImage(Path.Combine(Client.ExecutingDirectory, "Assets", "champions", champ.splashPath));

            if (champ.Lore != null)
                LoreText.Text = champ.Lore.Replace("<br>", Environment.NewLine);

            TipsText.Text = string.Format("Tips while playing {0}:{1}{2}{2}{2}Tips while playing aginst {0}:{3}",
                champ.displayName, champ.tips.Replace("*", Environment.NewLine + "*"), Environment.NewLine,
                champ.opponentTips.Replace("*", Environment.NewLine + "*"));
        }
Пример #7
0
        public static void InsertExtraChampData(champions champ)
        {
            var champJson =
                File.ReadAllText(Path.Combine(Client.ExecutingDirectory, "Assets", "data", "en_US", "champion",
                    champ.name + ".json"));

            var serializer = new JavaScriptSerializer();
            var deserializedJson = serializer.Deserialize<Dictionary<string, object>>(champJson);
            //Dictionary<string, object> deserializedJSON = JsonConvert.DeserializeObject<Dictionary<string, object>>(champJSON);
            var temp = deserializedJson["data"] as Dictionary<string, object>;
            if (temp == null)
                return;

            var champData = temp[champ.name] as Dictionary<string, object>;
            //Dictionary<string, object> champData = serializer.Deserialize<Dictionary<string, object>>(temp2);
            if (champData == null)
                return;

            champ.Lore = champData["lore"] as string;
            champ.ResourceType = champData["partype"] as string;
            champ.Skins = champData["skins"] as ArrayList;
            var spells = (ArrayList) champData["spells"];
            champ.Spells = new List<Spell>();

            foreach (Dictionary<string, object> champSpells in spells)
            {
                var newSpell = new Spell
                {
                    ID = champSpells["id"] as string,
                    Name = champSpells["name"] as string,
                    Description = champSpells["description"] as string,
                    Tooltip = champSpells["tooltip"] as string,
                    MaxRank = (int) champSpells["maxrank"]
                };

                var image = (Dictionary<string, object>) champSpells["image"];
                newSpell.Image = image["full"] as string;
                foreach (Dictionary<string, object> x in (ArrayList) champSpells["vars"])
                {
                    var type = x["link"] as string;
                    if (type == null)
                        continue;

                    type = type.Replace("spelldamage", "Ability Power");
                    type = type.Replace("bonusattackdamage", "Bonus Attack Damage");
                    type = type.Replace("attackdamage", "Total Attack Damage");
                    type = type.Replace("armor", "Armor");
                    newSpell.Tooltip = newSpell.Tooltip.Replace("{{ " + x["key"] + " }}",
                        Convert.ToString(x["coeff"]) + " " + type);
                }

                var i = 0;
                foreach (var scaling in from ArrayList x in (ArrayList) champSpells["effect"]
                    where x != null
                    select x.Cast<object>().Aggregate("", (current, y) => current + (y + "/"))
                    into scaling
                    select scaling.Substring(0, scaling.Length - 1))
                {
                    i++;
                    newSpell.Tooltip = newSpell.Tooltip.Replace("{{ e" + i + " }}", scaling);
                }

                newSpell.Tooltip = newSpell.Tooltip.Replace("<br>", Environment.NewLine);
                newSpell.Tooltip = Regex.Replace(newSpell.Tooltip, "<.*?>", string.Empty);

                champ.Spells.Add(newSpell);
            }
        }
Пример #8
0
 public bool IsFreeToPlay(champions champion)
 {
     return IsFreeToPlay(champion.id);
 }