public HeroDataConverter() { heroesName = new List<string>(); heroesUrl = new List<string>(); skillImages = new List<string>(); skillNames = new List<string>(); skillDescriptions = new List<string>(); primaryStatsImages = new List<string>(); primaryStatsValues = new Dictionary<string, string>(); manaCostDictionary = new List<KeyValuePair<string, string>>(); coolDownList = new List<KeyValuePair<string, string>>(); abilityCastType = new List<KeyValuePair<string, string>>(); skillTargetAffectedType = new List<KeyValuePair<string, string>>(); skillDamageType = new List<KeyValuePair<string, string>>(); skillRemainingValues = new Dictionary<string, Dictionary<string, string>>(); heroCreator = new HeroCreator(); skillCreator = new SkillCreator(); agilityPackHelper = new AgilityPackHelper(); heroesName = GetHeroesName(); foreach (var heroName in heroesName) { getDataFromHtml(heroName); createSkillEffectName(heroName); //heroCreator.createHero(heroName, biography); //createSkill(); //createPrimaryAttributes(); } }
public HeroDataConverter() { heroesNames = new List<string>(); heroesUrl = new List<string>(); skillImages = new List<string>(); skillNames = new List<string>(); skillDescriptions = new List<string>(); skillRemainingValuesDescriptions = new List<string>(); primaryStatsImages = new List<string>(); primaryStatsValues = new Dictionary<string, string>(); manaCostDictionary = new List<KeyValuePair<string, string>>(); coolDownList = new List<KeyValuePair<string, string>>(); abilityCastType = new List<KeyValuePair<string, string>>(); skillTargetAffectedType = new List<KeyValuePair<string, string>>(); skillDamageType = new List<KeyValuePair<string, string>>(); skillRemainingValues = new Dictionary<Skill, Dictionary<string, string>>(); heroCreator = new HeroCreator(); skillCreator = new SkillCreator(); agilityPackHelper = new AgilityPackHelper(); heroesNames = GetHeroesName(); for (int i = 0; i < heroesNames.Count; i++) { if (!isInsert) currentHero = heroCreator.getHeroByName(heroesNames[i]); else heroCreator.createHero(heroName, biography); getDataFromHtml(heroName); //createSkillEffectName(heroName); //createSkill(); //createPrimaryAttributes(); } foreach (var heroName in heroesNames) { } }
public SkillEffectName InsertSkillEffectName(string name, string heroName, Skill skill, List<string> skillEffectValues) { HeroCreator heroCreator = new HeroCreator(); SkillEffectName skillEffectName; Hero hero = heroCreator.getHeroByName(heroName); Skill completeSkill = SkillCreator.SelectSkill(skill.Name, hero.ID); bool exists = checkIfSkillNameExists(name, completeSkill, completeSkill.Description, out skillEffectName); if (!exists) { skillEffectName.Name = name.Trim(); skillEffectName.SkillId = completeSkill.ID; if (skillEffectValues.FirstOrDefault() != null) skillEffectName.ValueLv1 = skillEffectValues.First(); if (skillEffectValues.ElementAtOrDefault(1) != null) skillEffectName.ValueLv2 = skillEffectValues.ElementAt(1); if (skillEffectValues.ElementAtOrDefault(2) != null) skillEffectName.ValueLv3 = skillEffectValues.ElementAt(2); if (skillEffectValues.ElementAtOrDefault(3) != null) skillEffectName.ValueLv4 = skillEffectValues. ElementAt(3); if (skillEffectValues.LastOrDefault() != null) skillEffectName.ValueScepter = skillEffectValues.Last(); using (Dota2Entities ctx = new Dota2Entities()) { try { skillEffectName = ctx.SkillEffectName.Add(skillEffectName); ctx.SaveChanges(); Console.WriteLine("Skill " + name + " Created"); } catch (Exception e) { throw e; } } } return skillEffectName; }