Example #1
0
        /// <summary>
        ///     Ensures that the resource file passed exists
        ///     and returns the XElement obj associated with the file.
        /// </summary>
        /// <returns></returns>
        private List <Ability> LoadResources(IMemoryAPI api)
        {
            List <Ability> resources = new List <Ability>();

            SpellMapper   spellMapper   = new SpellMapper();
            AbilityMapper abilityMapper = new AbilityMapper();
            ItemMapper    itemMapper    = new ItemMapper();

            for (Int32 i = 0; i < 100000; i++)
            {
                EliteAPI.IItem item = api.Resource.GetItem(i);
                if (api.Player.HasAbility((uint)i))
                {
                    EliteAPI.IAbility ability = api.Resource.GetAbility(i);
                    if (ability != null)
                    {
                        if ((TargetType)ability.ValidTargets != TargetType.Unknown)
                        {
                            resources.Add(abilityMapper.Map(ability));
                        }
                    }
                }

                if (api.Player.HasSpell((uint)i))
                {
                    EliteAPI.ISpell spell = api.Resource.GetSpell(i);
                    if (spell != null)
                    {
                        resources.Add(spellMapper.Map(spell));
                    }
                }
            }

            return(resources);
        }
        /// <summary>
        ///     Ensures that the resource file passed exists
        ///     and returns the XElement obj associated with the file.
        /// </summary>
        /// <returns></returns>
        private List <Ability> LoadResources(IMemoryAPI api)
        {
            List <Ability> resources = new List <Ability>();

            SpellMapper   spellMapper   = new SpellMapper();
            AbilityMapper abilityMapper = new AbilityMapper();
            ItemMapper    itemMapper    = new ItemMapper();

            for (Int32 i = 0; i < 100000; i++)
            {
                EliteAPI.IItem    item    = api.Resource.GetItem(i);
                EliteAPI.ISpell   spell   = api.Resource.GetSpell(i);
                EliteAPI.IAbility ability = api.Resource.GetAbility(i);

                if (item != null)
                {
                    resources.Add(itemMapper.Map(item));
                }
                if (spell != null)
                {
                    resources.Add(spellMapper.Map(spell));
                }
                if (ability != null)
                {
                    resources.Add(abilityMapper.Map(ability));
                }
            }

            return(resources);
        }