示例#1
0
 public FlightMaster(string name, int npcId, Vector3 position, ContinentId continent)
 {
     Name      = name;
     NPCId     = npcId;
     Position  = position;
     Continent = continent;
     disableTimer.Reset();
 }
示例#2
0
 public override int GetHashCode()
 {
     unchecked
     {
         int hashCode = (Position != null ? Position.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ Radius.GetHashCode();
         hashCode = (hashCode * 397) ^ (ContinentId != null ? ContinentId.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ TileX.GetHashCode();
         hashCode = (hashCode * 397) ^ TileY.GetHashCode();
         return(hashCode);
     }
 }
示例#3
0
        private static MapZone GetZoneFromContientId(ContinentId zone)
        {
            switch (zone)
            {
            case ContinentId.Kalimdor:
                return(MapZone.Kalimdor);

            case ContinentId.Azeroth:
                return(MapZone.EasternKingdoms);

            default:
                return(MapZone.Unknown);
            }
        }
示例#4
0
 // Wait on transport (Zepp, elevator etc..)
 private static void WaitOnTransport(Vector3 arrivalPoint, int distance, ContinentId destinationContinent)
 {
     if (ObjectManager.Me.InTransport)
     {
         Logger.LogDebug("Waiting inside transport...");
         while (ObjectManager.Me.Position.DistanceTo(arrivalPoint) > distance)
         {
             Thread.Sleep(5000);
             Logger.LogDebug($"We are {ObjectManager.Me.Position.DistanceTo(arrivalPoint)} yards away from arrival.");
         }
     }
     else
     {
         Logger.LogLineBroadcastImportant("ERROR : Not on transport");
     }
 }
    public static void AddTransportOffMesh(
        Vector3 waitForTransport,
        Vector3 stepIn,
        Vector3 objectDeparture,
        Vector3 objectArrival,
        Vector3 stepOut,
        int objectId,
        ContinentId continentId,
        string name     = "",
        float precision = 0.5f)
    {
        OffMeshConnection offMeshConnection = new OffMeshConnection(new List <Vector3>
        {
            waitForTransport,
            new Vector3(stepIn.X, stepIn.Y, stepIn.Z, "None")
            {
                Action = "c#: Logging.WriteNavigator(\"Waiting for transport\"); " +
                         "while (Conditions.InGameAndConnectedAndProductStartedNotInPause) " +
                         "{ " +
                         $"var elevator = ObjectManager.GetWoWGameObjectByEntry({objectId}).OrderBy(o => o.GetDistance).FirstOrDefault(); " +
                         $"if (elevator != null && elevator.IsValid && elevator.Position.DistanceTo(new Vector3({objectDeparture.X.ToString().Replace(",", ".")}, {objectDeparture.Y.ToString().Replace(",", ".")}, {objectDeparture.Z.ToString().Replace(",", ".")})) < {precision.ToString().Replace(",", ".")}) " +
                         "break; " +
                         "Thread.Sleep(100); " +
                         "}"
            },
            new Vector3(stepOut.X, stepOut.Y, stepOut.Z, "None")
            {
                Action = "c#: Logging.WriteNavigator(\"Wait to leave Elevator\"); " +
                         "while (Conditions.InGameAndConnectedAndProductStartedNotInPause) " +
                         "{ " +
                         $"var elevator = ObjectManager.GetWoWGameObjectByEntry({objectId}).OrderBy(o => o.GetDistance).FirstOrDefault(); " +
                         $"if (elevator != null && elevator.IsValid && elevator.Position.DistanceTo(new Vector3({objectArrival.X.ToString().Replace(",", ".")}, {objectArrival.Y.ToString().Replace(",", ".")}, {objectArrival.Z.ToString().Replace(",", ".")})) < {precision.ToString().Replace(",", ".")}) " +
                         "break; " +
                         "Thread.Sleep(100); " +
                         "}"
            },
        }, (int)continentId, OffMeshConnectionType.Unidirectional, true);

        offMeshConnection.Name = name;
        OffMeshConnections.Add(offMeshConnection, true);
    }
示例#6
0
        /// <summary>
        ///     大陸と地方の対応付けを解除する
        /// </summary>
        /// <param name="continentId">大陸</param>
        /// <param name="regionId">地方</param>
        private static void DetachContinentRegion(ContinentId continentId, RegionId regionId)
        {
            // 大陸の項目がなければ何もしない
            if (!ContinentRegionMap.ContainsKey(continentId))
            {
                return;
            }

            // 地方リストから地方を削除する
            if (ContinentRegionMap[continentId].Contains(regionId))
            {
                ContinentRegionMap[continentId].Remove(regionId);
                // 地方リストの項目がなくなれば大陸の項目を削除する
                if (ContinentRegionMap[continentId].Count == 0)
                {
                    ContinentRegionMap.Remove(continentId);
                }
            }
        }
示例#7
0
        /// <summary>
        ///     大陸と地方の対応付けを設定する
        /// </summary>
        /// <param name="continentId">大陸</param>
        /// <param name="regionId">地方</param>
        private static void AttachContinentRegion(ContinentId continentId, RegionId regionId)
        {
            // 大陸の項目がなければ作成する
            if (!ContinentRegionMap.ContainsKey(continentId))
            {
                ContinentRegionMap.Add(continentId, new List<RegionId>());
            }

            // 地方リストに地方を追加する
            if (!ContinentRegionMap[continentId].Contains(regionId))
            {
                ContinentRegionMap[continentId].Add(regionId);
            }
        }
示例#8
0
        /// <summary>
        ///     プロヴィンスの大陸を変更する
        /// </summary>
        /// <param name="province">プロヴィンス</param>
        /// <param name="continent">大陸</param>
        public static void ModifyContinent(Province province, ContinentId continent)
        {
            // 大陸と地方の対応付けを変更する
            DetachContinentRegion(province.Continent, province.Region);
            AttachContinentRegion(continent, province.Region);

            // 値を更新する
            province.Continent = continent;
        }
示例#9
0
 /// <summary>
 ///     大陸名を取得する
 /// </summary>
 /// <param name="continent">大陸</param>
 /// <returns>大陸名</returns>
 public static string GetContinentName(ContinentId continent)
 {
     return Config.GetText(ContinentNames[(int) continent]);
 }
示例#10
0
        public override void Run()
        {
            Logger.LogDebug("************ RUNNING TRAVEL STATE ************");
            Broadcaster.autoBroadcast = false;

            ContinentId destinationContinent = Bot.Continent;

            // HORDE
            if (ToolBox.IsHorde())
            {
                // From EK
                if ((ContinentId)Usefuls.ContinentId == ContinentId.Azeroth)
                {
                    // To Kalimdor
                    if (destinationContinent == ContinentId.Kalimdor)
                    {
                        Logger.Log("Traveling to Kalimdor");
                        TravelHelper.HordeEKToKalimdor();
                    }
                    // To Outlands
                    if (destinationContinent == ContinentId.Expansion01)
                    {
                        Logger.Log("Traveling to Outland");
                        TravelHelper.HordeEKToOutland();
                    }
                    // To Northrend
                    if (destinationContinent == ContinentId.Northrend)
                    {
                        Logger.Log("Traveling to Northrend");
                        TravelHelper.HordeEKToKalimdor();
                    }
                }

                // From Kalimdor
                if ((ContinentId)Usefuls.ContinentId == ContinentId.Kalimdor)
                {
                    // To EK
                    if (destinationContinent == ContinentId.Azeroth)
                    {
                        Logger.Log("Traveling to Eastern Kingdoms");
                        TravelHelper.HordeKalimdorToEK();
                    }
                    // To Outlands
                    if (destinationContinent == ContinentId.Expansion01)
                    {
                        Logger.Log("Traveling to Outland");
                        TravelHelper.HordeKalimdorToEK();
                    }
                    // To Northrend
                    if (destinationContinent == ContinentId.Northrend)
                    {
                        Logger.Log("Traveling to Northrend");
                        TravelHelper.HordeKalimdorToNorthrend();
                    }
                }

                // From Outlands
                if ((ContinentId)Usefuls.ContinentId == ContinentId.Expansion01)
                {
                    // To Kalimdor
                    if (destinationContinent == ContinentId.Kalimdor)
                    {
                        Logger.Log("Traveling to Kalimdor");
                        TravelHelper.HordeOutlandToKalimdor();
                    }
                    // To EK
                    if (destinationContinent == ContinentId.Azeroth)
                    {
                        Logger.Log("Traveling to Eastern Kingdoms");
                        TravelHelper.HordeOutlandToKalimdor();
                    }
                    // To Northrend
                    if (destinationContinent == ContinentId.Northrend)
                    {
                        Logger.Log("Traveling to Northrend");
                        TravelHelper.HordeOutlandToKalimdor();
                    }
                }

                // From Northrend
                if ((ContinentId)Usefuls.ContinentId == ContinentId.Northrend)
                {
                    // To Kalimdor
                    if (destinationContinent == ContinentId.Kalimdor)
                    {
                        Logger.Log("Traveling to Kalimdor");
                        TravelHelper.HordeNorthrendToKalimdor();
                    }
                    // To EK
                    if (destinationContinent == ContinentId.Azeroth)
                    {
                        Logger.Log("Traveling to Eastern Kingdoms");
                        TravelHelper.HordeNorthrendToEK();
                    }
                    // To Outland
                    if (destinationContinent == ContinentId.Expansion01)
                    {
                        Logger.Log("Traveling to Outland");
                        TravelHelper.HordeNorthrendToOutland();
                    }
                }
            }
            Broadcaster.autoBroadcast = true;
        }
示例#11
0
 public static void SetContinent(ContinentId continent)
 {
     HasSetContinent = true;
     Continent       = continent;
 }
示例#12
0
        /// <summary>
        ///     大陸ノードを追加する
        /// </summary>
        /// <param name="continent">大陸</param>
        /// <param name="parent">親ノード</param>
        private static void AddContinentTreeItem(ContinentId continent, TreeNode parent)
        {
            // 大陸ノードを追加する
            TreeNode node = new TreeNode { Text = Provinces.GetContinentName(continent), Tag = continent };
            parent.Nodes.Add(node);

            // 地方ノードを順に追加する
            if (Provinces.ContinentRegionMap.ContainsKey(continent))
            {
                foreach (RegionId region in Provinces.ContinentRegionMap[continent])
                {
                    AddRegionTreeItem(region, node);
                }
            }
        }
示例#13
0
        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);
        }