コード例 #1
0
ファイル: MountTask.cs プロジェクト: zneel/TheNoobBot
        public static MountCapacity GetMountCapacity(bool ignoreDeactivatedFlyMount = false)
        {
            if (!AllowMounting || Usefuls.PlayerUsingVehicle || ObjectManager.ObjectManager.Me.IsDead)
            {
                return(MountCapacity.Feet);
            }
            if (_startupCheck || SettingsHasChanged)
            {
                // 1st Check if mounts in general settings exist
                _aquaMount   = nManagerSetting.CurrentSetting.AquaticMountName;
                _groundMount = nManagerSetting.CurrentSetting.GroundMountName;
                _flyMount    = nManagerSetting.CurrentSetting.FlyingMountName;
                if (!string.IsNullOrEmpty(_aquaMount.Trim()))
                {
                    _spellAquaMount = new Spell(_aquaMount);
                }
                if (!string.IsNullOrEmpty(_groundMount.Trim()))
                {
                    _spellGroundMount = new Spell(_groundMount);
                }
                if (!string.IsNullOrEmpty(_flyMount.Trim()))
                {
                    _spellFlyMount = new Spell(_flyMount);
                }
                _spellTravelForm = new Spell("Travel Form");

                if (ObjectManager.ObjectManager.Me.Level >= 16 && _groundMount != string.Empty && nManagerSetting.CurrentSetting.UseGroundMount && !_spellGroundMount.KnownSpell)
                {
                    Others.ShowMessageBox(Translate.Get(Translate.Id.ThisGroundMountDoesNotExist) + _groundMount);
                    _groundMount = string.Empty;
                }
                if (ObjectManager.ObjectManager.Me.Level >= 18 && _aquaMount != string.Empty && !_spellAquaMount.KnownSpell)
                {
                    Others.ShowMessageBox(Translate.Get(Translate.Id.ThisAquaticMountDoesNotExist) + _aquaMount);
                    _aquaMount = string.Empty;
                }
                if (ObjectManager.ObjectManager.Me.Level >= 58 && _flyMount != string.Empty && !_spellFlyMount.KnownSpell)
                {
                    Others.ShowMessageBox(Translate.Get(Translate.Id.ThisFlyingMountDoesNotExist) + _flyMount);
                    _flyMount = string.Empty;
                }
                if (ObjectManager.ObjectManager.Me.Level >= 60 && _aquaMount != string.Empty && _localizedAbysalMountName == string.Empty)
                {
                    _localizedAbysalMountName = SpellManager.GetSpellInfo(75207).Name;
                }

                Spell wisdom4Winds = new Spell(115913);
                _wisdom4Winds = wisdom4Winds.KnownSpell;
                Spell coldWeather = new Spell(54197);
                _coldWeather = coldWeather.KnownSpell;
                Spell flightMasterLicense = new Spell(90267);
                _flightMasterLicense = flightMasterLicense.KnownSpell;
                _dreaneorFly         = Usefuls.IsCompletedAchievement(10018, false); // Draenor Pathfinder (account wide)

                _brokenIslesFly = Usefuls.IsCompletedAchievement(11446, false);      // Broken Isles Pathfinder, Part Two (account wide)

                _startupCheck      = false;
                SettingsHasChanged = false;
            }
            if (ObjectManager.ObjectManager.Me.InCombatBlizzard)
            {
                return(MountCapacity.Feet);
            }
            if (_groundMount == string.Empty && _flyMount == string.Empty && _aquaMount == string.Empty)
            {
                if (((ObjectManager.ObjectManager.Me.Level >= 20 && Skill.GetValue(SkillLine.Riding) > 0) ||
                     (ObjectManager.ObjectManager.Me.WowClass == WoWClass.Druid && ObjectManager.ObjectManager.Me.Level >= 16)) &&
                    _noMountsInSettings != 1)
                {
                    MessageBox.Show(Translate.Get(Translate.Id.No_mounts_in_settings));
                    _noMountsInSettings++;
                    return(MountCapacity.Feet);
                }
            }

            if (ObjectManager.ObjectManager.Me.HaveBuff(ObjectManager.WoWUnit.CombatMount))
            {
                return(MountCapacity.Feet);
            }

            if (!HaveSpaceToMount())
            {
                return(MountCapacity.Feet); // mount later if we don't have enough space at the moment.
            }
            // Wherever we are if we have an aquatic mount and are swimming
            if (((ObjectManager.ObjectManager.Me.Level >= 20 && Skill.GetValue(SkillLine.Riding) > 0) ||
                 (ObjectManager.ObjectManager.Me.WowClass == WoWClass.Druid && ObjectManager.ObjectManager.Me.Level >= 18)) &&
                Usefuls.IsSwimming &&
                _aquaMount != string.Empty)
            {
                // The Abyssal Seahorse is selected
                if (_aquaMount == _localizedAbysalMountName)
                {
                    // We are in Vashjir
                    //  Kelp'thar Forest       || Abyssal Depths         || Shimmering Expanse
                    if (Usefuls.AreaId == 4815 || Usefuls.AreaId == 5145 || Usefuls.AreaId == 5144)
                    {
                        return(MountCapacity.Swimm);
                    }
                    // We are NOT in Vashjir
                    return(MountCapacity.Feet);
                }
                else // (_aquaMount != _localizedAbysalMountName)
                {
                    return(MountCapacity.Swimm);
                }
            }

            if (Usefuls.IsOutdoors)
            {
                if (ObjectManager.ObjectManager.Me.HaveBuff(178256)) // Panicked Rush
                {
                    return(MountCapacity.Feet);                      // Tannan Jungle Intro to leave to the docks.
                }
                if ((ObjectManager.ObjectManager.Me.Level >= 60 || (ObjectManager.ObjectManager.Me.WowClass == WoWClass.Druid && ObjectManager.ObjectManager.Me.Level >= 58)) &&
                    _flyMount != string.Empty &&
                    Usefuls.IsFlyableArea && (!nManagerSetting.CurrentSetting.DeactivateFlyingMount || ignoreDeactivatedFlyMount))
                {
                    ContinentId cont   = (ContinentId)Usefuls.ContinentId;
                    bool        canFly = _brokenIslesFly && cont == ContinentId.BrokenIsles;

                    // We are in Draenor and we have the achievement
                    if (!canFly && _dreaneorFly && (cont == ContinentId.Draenor || Usefuls.ContinentNameMpqByContinentId(Usefuls.ContinentId) == "TanaanJungle"))
                    {
                        canFly = true;
                    }

                    // We are in Pandaria and with "Wisdom of the Four Winds" aura
                    if (!canFly && _wisdom4Winds && cont == ContinentId.Pandaria)
                    {
                        canFly = true;
                    }

                    // We are in Northfend with "Cold Weather Flying" aura
                    if (!canFly && _coldWeather && cont == ContinentId.Northrend)
                    {
                        canFly = true;
                    }

                    // We are in Azeroth/Kalimdor/Deptholm with "Flight Master's License" aura
                    if (!canFly && _flightMasterLicense &&
                        (cont == ContinentId.Azeroth || cont == ContinentId.Kalimdor || cont == ContinentId.Maelstrom || cont == ContinentId.AllianceGunship))
                    {
                        canFly = true;
                    }

                    // We are in Outland and Expert Flying or better
                    Spell expertRider  = new Spell(34090);
                    Spell artisanRider = new Spell(34091);
                    Spell masterRider  = new Spell(90265);
                    if (!canFly && cont == ContinentId.Outland &&
                        (expertRider.KnownSpell || artisanRider.KnownSpell || masterRider.KnownSpell))
                    {
                        canFly = true;
                    }

                    if (canFly)
                    {
                        if (!Usefuls.IsFlying && ObjectManager.ObjectManager.Me.IsAlive)
                        {
                            LastKnownFlyablePoint = ObjectManager.ObjectManager.Me.Position;
                        }
                        return(MountCapacity.Fly);
                    }

                    // More work to be done with spell 130487 = "Cloud Serpent Riding"
                }
                if (((ObjectManager.ObjectManager.Me.Level >= 20 && Skill.GetValue(SkillLine.Riding) > 0) ||
                     (ObjectManager.ObjectManager.Me.WowClass == WoWClass.Druid && ObjectManager.ObjectManager.Me.Level >= 16) ||
                     _spellGroundMount.KnownSpell && _spellGroundMount.Id == 179245 || _spellGroundMount.Id == 179244) && _groundMount != string.Empty)
                {
                    return(MountCapacity.Ground);
                }
            }
            return(MountCapacity.Feet);
        }