Exemple #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);
        }
Exemple #3
0
 public Ability Map(EliteAPI.ISpell spell)
 {
     return(new Ability
     {
         CastTime = spell.CastTime,
         English = spell.Name?.FirstOrDefault() ?? "",
         Distance = spell.Range,
         Index = spell.Index,
         Id = spell.ID,
         Prefix = "/magic",
         Recast = spell.RecastDelay,
         MpCost = spell.MPCost,
         TargetType = (TargetType)spell.ValidTargets,
         AbilityType = GetAbilityType(spell)
     });
 }
Exemple #4
0
        private static AbilityType GetAbilityType(EliteAPI.ISpell spell)
        {
            var spellType = (MagicType)spell.MagicType;

            switch (spellType)
            {
            case MagicType.None:
                return(AbilityType.Unknown);

            case MagicType.WhiteMagic:
                return(AbilityType.Magic);

            case MagicType.BlackMagic:
                return(AbilityType.Magic);

            case MagicType.Summon:
                return(AbilityType.Magic);

            case MagicType.Ninjutsu:
                return(AbilityType.Ninjutsu);

            case MagicType.Song:
                return(AbilityType.Song);

            case MagicType.BlueMagic:
                return(AbilityType.Magic);

            case MagicType.Geomancy:
                return(AbilityType.Magic);

            case MagicType.Trust:
                return(AbilityType.Trust);
            }

            return(AbilityType.Unknown);
        }