Ejemplo n.º 1
0
        private IEnumerable <Skill> BuildWellFormedData(IEnumerable <RawSkillData> skills,
                                                        IDictionary <string, RawSkillData> index)
        {
            const string wikiLink = "http://wiki.guildwars.com/wiki/Skill";

            yield return(CreateEmptySkill(-1, wikiLink, "InvalidSkill", "Invalid Skill", "UnknownSkill.jpg"));

            yield return(CreateEmptySkill(0, wikiLink, "NoSkill", "No Skill", "NoSkill.jpg"));

            foreach (var data in skills)
            {
                if (data.NotASkill)
                {
                    yield return(new Skill
                    {
                        Id = data.SkillId,
                        IsValid = false,
                        ImageId = "unknown.jpg",
                        Campaign = GetValue(data.Campaign),
                        Profession = GetValue(data.Profession),
                        Attribute = GetValue(data.Attribute),
                        Type = GetValue(data.Type),
                        Range = GetValue(data.Range),
                        Target = GetValue(data.Target),
                        AreaOfEffect = GetValue(data.AreaOfEffect),
                        Projectile = GetValue(data.Projectile),
                        SpecialType = GetValue(data.SpecialType),
                    });

                    continue;
                }

                var relatedSkills = from skillName in data.RelatedSkills
                                    let key = skillName.ToLower()
                                              where index.ContainsKey(key)
                                              select index[key].SkillId;

                // TODO : Add skill progression information
                yield return(new Skill
                {
                    Id = data.SkillId,
                    WikiLink = data.WikiLink,
                    Name = translationProvider.FetchSkillName(data.BasicName, data.Name),
                    Description =
                        translationProvider.FetchDescription(data.BasicName, data.Description),
                    ConciseDescription =
                        translationProvider.FetchConciseDescription(data.BasicName,
                                                                    data.ConciseDescription),
                    Campaign = GetValue(data.Campaign),
                    Profession = GetValue(data.Profession),
                    Attribute = GetValue(data.Attribute),
                    Type = GetValue(data.Type),
                    Range = GetValue(data.Range),
                    Target = GetValue(data.Target),
                    AreaOfEffect = GetValue(data.AreaOfEffect),
                    Projectile = GetValue(data.Projectile),
                    SpecialType = GetValue(data.SpecialType),
                    ActivationTime = data.ActivationTime,
                    RechargeTime = data.RechargeTime,
                    EnergyCost = data.EnergyCost,
                    Sacrifice = data.Sacrifice,
                    Adrenaline = data.Adrenaline,
                    Upkeep = data.Upkeep,
                    IsElite = data.IsElite,
                    IsRemoved = data.IsRemoved,
                    IsPvEOnly = data.IsPvEOnly,
                    IsPvPVersion = data.IsPvPVersion,
                    CausesExhaustion = data.Exhaustion,
                    HasPvP = data.HasPvP,
                    IsValid = !data.IsRemoved || string.IsNullOrEmpty(data.SpecialType),
                    RelatedSkills = relatedSkills.ToList(),
                    Causes = data.Causes,
                    Removes = data.Removes,
                    Categories = data.Categories,
                    ImageId = string.Format("{0}.jpg", data.SkillId),
                    //Progression = data.Progression
                });
            }
        }