示例#1
0
        public void LoadSettings()
        {
            var path         = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
            var settingsPath = Path.Combine(path, Cache.Instance.FilterPath(_characterName) + ".xml");

            var reloadSettings = _characterName != Cache.Instance.DirectEve.Me.Name;

            if (File.Exists(settingsPath))
            {
                reloadSettings = _lastModifiedDate != File.GetLastWriteTime(settingsPath);
            }

            if (!reloadSettings)
            {
                return;
            }

            _characterName    = Cache.Instance.DirectEve.Me.Name;
            _lastModifiedDate = File.GetLastWriteTime(settingsPath);

            if (!File.Exists(settingsPath))
            {
                // Clear settings
                AgentName = string.Empty;

                AutoStart = false;

                SaveLog = false;

                maxLineConsole = 1000;

                waitDecline = false;

                Disable3D = false;

                RandomDelay = 0;

                minStandings = 10;

                MinimumDelay = 0;

                MinimumDelay = 0;
                minStandings = 10;


                WindowXPosition = null;
                WindowYPosition = null;

                LootHangar = string.Empty;
                AmmoHangar = string.Empty;

                MissionsPath = Path.Combine(path, "Missions");

                bookmarkWarpOut = string.Empty;

                MaximumHighValueTargets = 0;
                MaximumLowValueTargets  = 0;

                Ammo.Clear();
                FactionFitting.Clear();
                MissionFitting.Clear();

                MinimumAmmoCharges = 0;

                WeaponGroupId = 0;

                ReserveCargoCapacity = 0;

                MaximumWreckTargets = 0;

                SpeedTank     = false;
                OrbitDistance = 0;
                NosDistance   = 38000;
                MinimumPropulsionModuleDistance  = 0;
                MinimumPropulsionModuleCapacitor = 0;

                ActivateRepairModules   = 0;
                DeactivateRepairModules = 0;

                MinimumShieldPct    = 0;
                MinimumArmorPct     = 0;
                MinimumCapacitorPct = 0;
                SafeShieldPct       = 0;
                SafeArmorPct        = 0;
                SafeCapacitorPct    = 0;

                UseDrones                        = false;
                DroneTypeId                      = 0;
                DroneControlRange                = 0;
                DroneMinimumShieldPct            = 0;
                DroneMinimumArmorPct             = 0;
                DroneMinimumCapacitorPct         = 0;
                DroneRecallCapacitorPct          = 0;
                LongRangeDroneRecallCapacitorPct = 0;

                UseGatesInSalvage = false;

                Blacklist.Clear();
                FactionBlacklist.Clear();

                return;
            }

            var xml = XDocument.Load(settingsPath).Root;

            DebugStates      = (bool?)xml.Element("debugStates") ?? false;
            DebugPerformance = (bool?)xml.Element("debugPerformance") ?? false;

            AutoStart = (bool?)xml.Element("autoStart") ?? false;

            SaveLog = (bool?)xml.Element("saveLog") ?? false;

            maxLineConsole = (int?)xml.Element("maxLineConsole") ?? 1000;

            waitDecline = (bool?)xml.Element("waitDecline") ?? false;

            Disable3D = (bool?)xml.Element("disable3D") ?? false;

            RandomDelay  = (int?)xml.Element("randomDelay") ?? 0;
            MinimumDelay = (int?)xml.Element("minimumDelay") ?? 0;
            minStandings = (float?)xml.Element("minStandings") ?? 10;

            UseGatesInSalvage = (bool?)xml.Element("useGatesInSalvage") ?? false;

            BattleshipInvasionLimit    = (int?)xml.Element("battleshipInvasionLimit") ?? 0;
            BattlecruiserInvasionLimit = (int?)xml.Element("battlecruiserInvasionLimit") ?? 0;
            CruiserInvasionLimit       = (int?)xml.Element("cruiserInvasionLimit") ?? 0;
            FrigateInvasionLimit       = (int?)xml.Element("frigateInvasionLimit") ?? 0;
            InvasionRandomDelay        = (int?)xml.Element("invasionRandomDelay") ?? 0;
            InvasionMinimumDelay       = (int?)xml.Element("invasionMinimumDelay") ?? 0;

            EnableStorylines = (bool?)xml.Element("enableStorylines") ?? false;

            WindowXPosition = (int?)xml.Element("windowXPosition");
            WindowYPosition = (int?)xml.Element("windowYPosition");

            CombatShipName  = (string)xml.Element("combatShipName");
            SalvageShipName = (string)xml.Element("salvageShipName");

            LootHangar = (string)xml.Element("lootHangar");
            AmmoHangar = (string)xml.Element("ammoHangar");

            CreateSalvageBookmarks = (bool?)xml.Element("createSalvageBookmarks") ?? false;
            BookmarkPrefix         = (string)xml.Element("bookmarkPrefix") ?? "Salvage:";
            MinimumWreckCount      = (int?)xml.Element("minimumWreckCount") ?? 1;
            AfterMissionSalvaging  = (bool?)xml.Element("afterMissionSalvaging") ?? false;
            UnloadLootAtStation    = (bool?)xml.Element("unloadLootAtStation") ?? false;

            AgentName = (string)xml.Element("agentName");

            bookmarkWarpOut = (string)xml.Element("bookmarkWarpOut");

            var missionsPath = (string)xml.Element("missionsPath");

            MissionsPath = !string.IsNullOrEmpty(missionsPath) ? Path.Combine(path, missionsPath) : Path.Combine(path, "Missions");

            MaximumHighValueTargets = (int?)xml.Element("maximumHighValueTargets") ?? 2;
            MaximumLowValueTargets  = (int?)xml.Element("maximumLowValueTargets") ?? 2;

            Ammo.Clear();
            var ammoTypes = xml.Element("ammoTypes");

            if (ammoTypes != null)
            {
                foreach (var ammo in ammoTypes.Elements("ammoType"))
                {
                    Ammo.Add(new Ammo(ammo));
                }
            }

            MinimumAmmoCharges = (int?)xml.Element("minimumAmmoCharges") ?? 0;

            FactionFitting.Clear();
            var factionFittings = xml.Element("factionfittings");

            if (factionFittings != null)
            {
                foreach (var factionfitting in factionFittings.Elements("factionfitting"))
                {
                    FactionFitting.Add(new FactionFitting(factionfitting));
                }
                if (FactionFitting.Exists(m => m.Faction.ToLower() == "default"))
                {
                    DefaultFitting = FactionFitting.Find(m => m.Faction.ToLower() == "default");
                    if (!(DefaultFitting.Fitting == "") && !(DefaultFitting.Fitting == null))
                    {
                        FittingsDefined = true;
                    }
                    else
                    {
                        Logging.Log("Settings: Error! No default fitting specified or fitting is incorrect.  Fitting manager will not be used.");
                    }
                }
                else
                {
                    Logging.Log("Settings: Error! No default fitting specified or fitting is incorrect.  Fitting manager will not be used.");
                }
            }
            else
            {
                Logging.Log("Settings: No faction fittings specified.  Fitting manager will not be used.");
            }

            MissionFitting.Clear();
            var missionFittings = xml.Element("missionfittings");

            if (missionFittings != null)
            {
                foreach (var missionfitting in missionFittings.Elements("missionfitting"))
                {
                    MissionFitting.Add(new MissionFitting(missionfitting));
                }
            }

            WeaponGroupId = (int?)xml.Element("weaponGroupId") ?? 0;

            ReserveCargoCapacity = (int?)xml.Element("reserveCargoCapacity") ?? 0;

            MaximumWreckTargets = (int?)xml.Element("maximumWreckTargets") ?? 0;

            SpeedTank     = (bool?)xml.Element("speedTank") ?? false;
            OrbitDistance = (int?)xml.Element("orbitDistance") ?? 0;
            NosDistance   = (int?)xml.Element("NosDistance") ?? 38000;
            MinimumPropulsionModuleDistance  = (int?)xml.Element("minimumPropulsionModuleDistance") ?? 5000;
            MinimumPropulsionModuleCapacitor = (int?)xml.Element("minimumPropulsionModuleCapacitor") ?? 0;

            ActivateRepairModules   = (int?)xml.Element("activateRepairModules") ?? 65;
            DeactivateRepairModules = (int?)xml.Element("deactivateRepairModules") ?? 95;

            MinimumShieldPct    = (int?)xml.Element("minimumShieldPct") ?? 100;
            MinimumArmorPct     = (int?)xml.Element("minimumArmorPct") ?? 100;
            MinimumCapacitorPct = (int?)xml.Element("minimumCapacitorPct") ?? 50;
            SafeShieldPct       = (int?)xml.Element("safeShieldPct") ?? 0;
            SafeArmorPct        = (int?)xml.Element("safeArmorPct") ?? 0;
            SafeCapacitorPct    = (int?)xml.Element("safeCapacitorPct") ?? 0;

            LootEverything = (bool?)xml.Element("lootEverything") ?? true;

            UseDrones                        = (bool?)xml.Element("useDrones") ?? true;
            DroneTypeId                      = (int?)xml.Element("droneTypeId") ?? 0;
            DroneControlRange                = (int?)xml.Element("droneControlRange") ?? 0;
            DroneMinimumShieldPct            = (int?)xml.Element("droneMinimumShieldPct") ?? 50;
            DroneMinimumArmorPct             = (int?)xml.Element("droneMinimumArmorPct") ?? 50;
            DroneMinimumCapacitorPct         = (int?)xml.Element("droneMinimumCapacitorPct") ?? 0;
            DroneRecallShieldPct             = (int?)xml.Element("droneRecallShieldPct") ?? 0;
            DroneRecallArmorPct              = (int?)xml.Element("droneRecallArmorPct") ?? 0;
            DroneRecallCapacitorPct          = (int?)xml.Element("droneRecallCapacitorPct") ?? 0;
            LongRangeDroneRecallShieldPct    = (int?)xml.Element("longRangeDroneRecallShieldPct") ?? 0;
            LongRangeDroneRecallArmorPct     = (int?)xml.Element("longRangeDroneRecallArmorPct") ?? 0;
            LongRangeDroneRecallCapacitorPct = (int?)xml.Element("longRangeDroneRecallCapacitorPct") ?? 0;

            Blacklist.Clear();
            var blacklist = xml.Element("blacklist");

            if (blacklist != null)
            {
                foreach (var mission in blacklist.Elements("mission"))
                {
                    Blacklist.Add((string)mission);
                }
            }

            FactionBlacklist.Clear();
            var factionblacklist = xml.Element("factionblacklist");

            if (factionblacklist != null)
            {
                foreach (var faction in factionblacklist.Elements("faction"))
                {
                    FactionBlacklist.Add((string)faction);
                }
            }

            if (SettingsLoaded != null)
            {
                SettingsLoaded(this, new EventArgs());
            }
        }
示例#2
0
        //You can modify these lists in order to affect how the bot acts
        //List<String> Cleanse = new List<String> { "Aftermath", "Concussive Shot", "Slow", "Infected Wounds", "Freeze", "Frost Nova", "Piercing Howl", "Earthgrab", "Entangling Roots", "Frost Shock", "Entrapment", "Chains of Ice", "Chilled", "Shattered Barrier", "Cone of Cold", "Frostbolt" };
        //List<String> Rotation = new List<String> { "Frost Strike", "Obliterate", "Howling Blast" };

        /*List<String> Rotation = new List<String> { "Necrotic Strike", "Howling Blast", "Frost Strike" };
         * List<String> RangedRotation = new List<String> { "Death Grip", "Howling Blast", "Death Coil" };
         * List<String> Interrupts = new List<String> { "Mind Freeze", "Strangulate", "Arcane Torrent" };
         * List<String> CD = new List<String> { "Horn of Winter", "Blood Tap", "Outbreak", "Pillar of Frost", "Raise Dead" };
         * List<Act> HealRotation = new List<Act> { new Act("Lichborne", 30.0f), new Act("Icebound Fortitude", 50.0f), new Act("Anti-Magic Shell", 60.0f) };
         * List<Trinket> Trinkets = new List<Trinket> { new Trinket("Badge of Victory", null, 0, 100.0f), new Trinket("Essence of the Eternal Flame", null, 0, 100.0f), new Trinket("Apparatus of Khaz'goroth", "Titanic Power", 5, 60.0f), new Trinket("Fury of Angerforge", "Raw Fury", 5, 60.0f) };
         * float LichbornHealPercent = 50.0f;*/

        public override void Combat()
        {
            Target = Me.CurrentTarget;


            int Toggle = Lua.GetReturnVal <int>("return Toggle and 0 or 1", 0);

            if (Toggle != 1)
            {
                return;
            }

            if (Target == null || !Target.Attackable)
            {
                return;
            }

            //Lets try some new logic here..lets go for the owner
            else if (Target != null && Target.IsPet)
            {
                WoWUnit Owner = Target.CreatedByUnit;
                if (Owner != null && Owner.IsValid && Owner.IsAlive)
                {
                    Blacklist.Add(Target, new TimeSpan(0, 0, 5));
                    Logging.Write("Changing targets to pet owner");
                    Target = Owner;
                    TargetUnit(Target);
                }
            }
            //Face the target
            Face(Target);


            //Always try and move ontop of the enemy target..unless were casting
            if (!Me.IsCasting)
            {
                Move(Target.Location);
            }


            if (Target.Distance < 2 && Manual)
            {
                Navigator.PlayerMover.MoveStop();
            }


            if (Me.IsCasting)
            {
            }
            else if ((Target.Distance > 30 || !Target.IsAlive) && Me.Combat && Manual)
            {
                Logging.Write(Target.Name + " is currently " + Target.Distance.ToString() + " dropping target");
                Me.ClearTarget();
                SeekTarget();
            }
            else if (isAuraActive("Freezing Fog") && CanCast("Howling Blast"))
            {
                Cast("Howling Blast");
            }
            else if ((Target.Distance >= 5d && Target.Distance < 20d))
            {
                if (Target.MovementInfo.ForwardSpeed > 7.0f && CanCast("Chains of Ice"))
                {
                    Cast("Chains of Ice");
                }
                else
                {
                    foreach (String Ability in EzFrostSettings.Instance.RangedRotation)
                    {
                        cctc(Target, Ability);
                    }
                }
                Move(Target.Location);
            }

            else if (Target.IsWithinMeleeRange)
            {
                foreach (String Ability in EzFrostSettings.Instance.Cooldowns)
                {
                    cctc(Ability);
                }



                if (EzFrostSettings.Instance.EmpowerRuneWeapon && Me.DeathRuneCount == 0 && Me.UnholyRuneCount == 0 && Me.FrostRuneCount == 0)
                {
                    cctc("Empower Rune Weapon");
                }


                if (Target.IsCasting && Target.CanInterruptCurrentSpellCast)
                {
                    foreach (String Ability in EzFrostSettings.Instance.KickRotation)
                    {
                        if (cctc(Ability))
                        {
                            Thread.Sleep(50);
                            break;
                        }
                    }
                }
                else if ((Me.HealthPercent < 30.0f || isAuraActive("Dark Succor")) && CanCast("Death Strike") && Me.HealthPercent < 80.0f)
                {
                    Cast("Death Strike");
                }
                else
                {
                    if (isAuraActive("Killing Machine") && (CanCast("Obliterate") || CanCast("Frost Strike")))
                    {
                        //If the target has both disaeses then obl, otherwise frost strike
                        if (CanCast("Obliterate"))
                        {
                            Cast("Obliterate");
                        }
                        else
                        {
                            Cast("Frost Strike");
                        }
                    }

                    foreach (String Ability in EzFrostSettings.Instance.Rotation)
                    {
                        if (cctc(Ability))
                        {
                            break;
                        }
                    }
                }
                Usetrinkets();
            }
        }
示例#3
0
        private static void HandleCombatLog(object sender, LuaEventArgs args)
        {
            var e = new CombatLogEventArgs(args.EventName, args.FireTimeStamp, args.Args);

            if (e.SourceGuid != StyxWoW.Me.Guid)
            {
                return;
            }

            // Logger.WriteDebug("[CombatLog] " + e.Event + " - " + e.SourceName + " - " + e.SpellName);

            switch (e.Event)
            {
            default:
                Logger.WriteDebug("[CombatLog] filter out this event -- " + e.Event + " - " + e.SourceName + " - " + e.SpellName);
                break;

            case "SPELL_CAST_FAILED":
                if (SingularSettings.Instance.EnableDebugLogging)
                {
                    Logger.WriteDebug("[CombatLog] {0}:{1} cast of {2}#{3} failed: '{4}'",
                                      e.SourceName,
                                      e.SourceGuid,
                                      e.SpellName,
                                      e.SpellId,
                                      e.Args[14]
                                      );
                }
                break;

            case "SPELL_AURA_APPLIED":
            case "SPELL_CAST_SUCCESS":
                if (e.SourceGuid != StyxWoW.Me.Guid)
                {
                    return;
                }

                // Update the last spell we cast. So certain classes can 'switch' their logic around.
                Spell.LastSpellCast = e.SpellName;
                //Logger.WriteDebug("Successfully cast " + Spell.LastSpellCast);

                // Force a wait for all summoned minions. This prevents double-casting it.
                if (StyxWoW.Me.Class == WoWClass.Warlock && e.SpellName.StartsWith("Summon "))
                {
                    StyxWoW.SleepForLagDuration();
                }
                break;

            case "SWING_MISSED":
                if (e.Args[11].ToString() == "EVADE")
                {
                    Logger.Write("Mob is evading swing. Blacklisting it!");
                    Blacklist.Add(e.DestGuid, TimeSpan.FromMinutes(30));
                    if (StyxWoW.Me.CurrentTargetGuid == e.DestGuid)
                    {
                        StyxWoW.Me.ClearTarget();
                    }

                    BotPoi.Clear("Blacklisting evading mob");
                    StyxWoW.SleepForLagDuration();
                }
                else if (e.Args[11].ToString() == "IMMUNE")
                {
                    WoWUnit unit = e.DestUnit;
                    if (unit != null && !unit.IsPlayer)
                    {
                        Logger.WriteDebug("{0} is immune to {1} spell school", unit.Name, e.SpellSchool);
                        SpellImmunityManager.Add(unit.Entry, e.SpellSchool);
                    }
                }
                break;

            case "SPELL_MISSED":
            case "RANGE_MISSED":
                // DoT casting spam can occur when running on test dummy with low +hit
                //  ..  and multiple misses occurring. this should help troubleshoot
                //  ..  false reports of flawed rotation
                if (SingularSettings.Instance.EnableDebugLogging)
                {
                    Logger.WriteFile(
                        "[CombatLog] {0} {1}#{2} {3}",
                        e.Event,
                        e.SpellName,
                        e.SpellId,
                        e.Args[14]
                        );
                }

                if (e.Args[14].ToString() == "EVADE")
                {
                    Logger.Write("Mob is evading ranged attack. Blacklisting it!");
                    Blacklist.Add(e.DestGuid, TimeSpan.FromMinutes(30));
                    if (StyxWoW.Me.CurrentTargetGuid == e.DestGuid)
                    {
                        StyxWoW.Me.ClearTarget();
                    }

                    BotPoi.Clear("Blacklisting evading mob");
                    StyxWoW.SleepForLagDuration();
                }
                else if (e.Args[14].ToString() == "IMMUNE")
                {
                    WoWUnit unit = e.DestUnit;
                    if (unit != null && !unit.IsPlayer)
                    {
                        Logger.WriteDebug("{0} is immune to {1} spell school", unit.Name, e.SpellSchool);
                        SpellImmunityManager.Add(unit.Entry, e.SpellSchool);
                    }
                }
                break;
            }
        }
示例#4
0
文件: Loot.cs 项目: mastahg/DeepDive
        /// <summary>
        /// Handles opening treasure coffers or opening an exit portal
        /// </summary>
        /// <returns></returns>
        internal async Task <bool> TreasureOrExit()
        {
            var tries = 0;
            var npcid = Target.Unit.NpcId;

            if (Target.Location.Distance2D(Core.Me.Location) >= 3)
            {
                await CommonTasks.MoveAndStop(new MoveToParameters(Target.Location, Target.Name), 2.5f, true);

                return(true);
            }

            pomanderCapped = false;
            //Unsubscribe first to prevent subscriptions from persisting
            GamelogManager.MessageRecevied -= GamelogManagerOnMessageRecevied;
            GamelogManager.MessageRecevied += GamelogManagerOnMessageRecevied;

            while (!DeepDungeon.StopPlz && (Target.Unit != null && Target.Unit.IsValid) && tries < 3 && !pomanderCapped)
            {
                try
                {
                    //if we are a transformed we can't open a chest
                    if (Constants.AuraTransformed)
                    {
                        Logger.Warn("Unable to open chest. Waiting for aura to end...");
                        await CommonTasks.StopMoving("Waiting on aura to end");

                        await Coroutine.Wait(TimeSpan.FromSeconds(30),
                                             () => !Constants.AuraTransformed || Core.Me.InCombat || DeepDungeon.StopPlz);

                        return(true);
                    }


                    await Coroutine.Yield();

                    if (Core.Me.HasAura(Auras.Lust))
                    {
                        await Tasks.Common.CancelAura(Auras.Lust);
                    }

                    Logger.Verbose("Attempting to interact with: {0} ({1} / 3)", Target.Name, tries + 1);

                    if (!PartyManager.IsInParty || PartyManager.IsPartyLeader ||
                        PartyManager.IsInParty && Constants.IsExitObject(Target.Unit))
                    {
                        await CommonTasks.StopMoving("Interacting with chest");

                        if (!await ObjectInteraction(Target.Unit))
                        {
                            break;
                        }
                    }
                    else
                    {
                        await CommonTasks.StopMoving("Waiting for leader to use chest");
                    }

                    await Coroutine.Sleep(700);

                    if (!Target.Unit.IsValid)
                    {
                        break;
                    }

                    if (!Target.Unit.IsTargetable)
                    {
                        break;
                    }

                    if (SelectYesno.IsOpen)
                    {
                        break;
                    }
                }
                finally
                {
                    tries++;
                }
            }
            GamelogManager.MessageRecevied -= GamelogManagerOnMessageRecevied;

            await Coroutine.Wait(500, () => SelectYesno.IsOpen);

            //if this is an exit
            if (SelectYesno.IsOpen)
            {
                SelectYesno.ClickYes();
                await Coroutine.Wait(TimeSpan.MaxValue, () => DeepDungeon.StopPlz || QuestLogManager.InCutscene || NowLoading.IsVisible);

                return(true);
            }

            if (Target.Unit != null && Target.Unit.IsValid)
            {
                Blacklist.Add(Target.Unit.ObjectId, TimeSpan.FromMinutes(5), $"Tried to Interact with the Target {tries} times");
            }

            Poi.Clear($"Tried to Interact with the Target {tries} times");

            return(false);
        }
示例#5
0
 //Skinning
 private void _HasSkinning()
 {
     if (!hasKnife)
     {
         foreach (WoWItem knife in ObjectManager.GetObjectsOfType <WoWItem>(false))
         {
             if (knife.BagSlot != -1)
             {
                 if (knife.Entry.Equals(7005))
                 {
                     hasKnife = true;
                 }
                 if (knife.Entry.Equals(12709))
                 {
                     hasKnife = true;
                 }
                 if (knife.Entry.Equals(40772))
                 {
                     hasKnife = true;
                 }
                 if (knife.Entry.Equals(40893))
                 {
                     hasKnife = true;
                 }
                 if (knife.Entry.Equals(19901))
                 {
                     hasKnife = true;
                 }
             }
         }
         if (hasKnife)
         {
             Log("Character has a Skinning knife!", null, null);
         }
     }
     if (!hasKnife && !informedKnife)
     {
         Log("Character has no Skinning Knife! Go get one!", null, null); informedKnife = true;
     }
     if (hasKnife)
     {
         if (!ExtensiveCombatCheck() && !Me.Mounted && !Me.IsCasting)
         {
             ObjectManager.Update();
             var DeadMobs = (from o in ObjectManager.GetObjectsOfType <WoWUnit>(false, false)
                             where !o.IsAlive && o.CanSkin && o.Distance < 15 && !Blacklist.Contains(o.Guid)
                             orderby o.DistanceSqr ascending
                             select o);
             if (DeadMobs.Count() > 0)
             {
                 foreach (WoWUnit _Mob in DeadMobs)
                 {
                     if (_Mob.SkinType == WoWCreatureSkinType.Leather && !_Mob.Lootable && !Me.Looting)
                     {
                         Log("Found Skin-Able: ", _Mob.Name, ".");
                         while (!ExtensiveCombatCheck() && _Mob.Distance > _Mob.InteractRange)
                         {
                             Navigator.MoveTo(_Mob.Location);
                         }
                         Navigator.PlayerMover.MoveStop();
                         Thread.Sleep(100); StyxWoW.SleepForLagDuration();
                         _Mob.Interact();
                         while (Me.IsCasting)
                         {
                             Thread.Sleep(100);
                         }
                         Thread.Sleep(250);
                         while (Styx.Logic.Inventory.Frames.LootFrame.LootFrame.Instance.IsVisible)
                         {
                             Thread.Sleep(100);
                         }
                         Log("Finished Skinning.", null, null);
                         Blacklist.Add(_Mob.Guid, TimeSpan.FromMinutes(5));
                         JustInteracted.Start();
                     }
                 }
             }
             DeadMobs = null;
             return;
         }
     }
 }
示例#6
0
        /// <summary>
        /// Function to Find and Interact with NPCs
        /// </summary>
        public void findAndInteractNPC()
        {
            #region create a List with NPCs in reach
            ObjectManager.Update();
            List <WoWUnit> objList = ObjectManager.GetObjectsOfType <WoWUnit>()
                                     .Where(o => (!Blacklist.Contains(o.Guid, Rarekiller.Settings.Flags) && (
                                                      ((o.Entry == 50409) && Rarekiller.Settings.Camel) || ((o.Entry == 50410) && Rarekiller.Settings.Camel) || // 50409 might be the porting Camel Figurine
                                                      (Rarekiller.AnotherMansTreasureList.ContainsKey(Convert.ToInt32(o.Entry)) && Rarekiller.Settings.AnotherMansTreasure && o.Entry < 200000) ||
                                                      (Rarekiller.InteractNPCList.ContainsKey(Convert.ToInt32(o.Entry)) && Rarekiller.Settings.InteractNPC) ||
                                                      (o.Entry == 43929 && Rarekiller.Settings.Blingtron && o.QuestGiverStatus == QuestGiverStatus.AvailableRepeatable) || //ToDo - Is Quest completed 31752
                                                      ((o.Entry == 48959) && Rarekiller.Settings.TestFigurineInteract) //Testcase rostiger Amboss - Schnotzz Landing
                                                      )))
                                     .OrderBy(o => o.Distance).ToList();
            List <WoWUnit> RareList = ObjectManager.GetObjectsOfType <WoWUnit>()
                                      .Where(r => ((r.CreatureRank == Styx.WoWUnitClassificationType.Rare) && r.Level > 85 && !r.IsDead)).OrderBy(r => r.Distance).ToList();
            #endregion

            bool Forceground = false;

            foreach (WoWUnit o in objList)
            {
                Logging.WriteQuiet(Colors.MediumPurple, "Rarekiller: Find NPC {0} ID {1}", o.Name, o.Entry);
                Logging.WriteDiagnostic(Colors.MediumPurple, "Rarekiller: NPC Location: {0} / {1} / {2}", Convert.ToString(o.X), Convert.ToString(o.Y), Convert.ToString(o.Z));
                if (Rarekiller.Settings.LUAoutput)
                {
                    Lua.DoString("print('NPCScan: Find {0} ID {1}')", o.Name, o.Entry);
                }

                if (Rarekiller.Settings.Alert)
                {
                    Rarekiller.Alert();
                }

                #region don't collect if ...
                // ----------------- Underground ----------
                //if not ID of Underground NPCs of Another Mans Treasure --> don't collect
                if (!(o.Entry == 64227))
                {
                    if (o.IsIndoors && Me.IsFlying && Me.IsOutdoors && (o.Location.Distance(Me.Location) > 30))
                    {
                        Logging.Write(Colors.MediumPurple, "Rarekiller: Can't reach NPC because it is Indoors and I fly Outdoors {0}, Blacklist and Move on", o.Name);
                        if (Rarekiller.Settings.LUAoutput)
                        {
                            Lua.DoString("print('NPCScan: NPC is Indoors')", o.Name);
                        }
                        Blacklist.Add(o.Guid, Rarekiller.Settings.Flags, TimeSpan.FromSeconds(Rarekiller.Settings.Blacklist5));
                        return;
                    }
                }
// -----------------  don't collect if Rare Pandaria Elite Around
                if (RareList != null)
                {
                    foreach (WoWUnit r in RareList)
                    {
                        if (r.Location.Distance(o.Location) < 30)
                        {
                            Logging.Write(Colors.MediumPurple, "Rarekiller: Can't reach NPC because there's a Rare Elite around, Blacklist and move on", o.Name);
                            if (Rarekiller.Settings.LUAoutput)
                            {
                                Lua.DoString("print('NPCScan: NPC Elite Rare around')", o.Name);
                            }
                            Blacklist.Add(o.Guid, Rarekiller.Settings.Flags, TimeSpan.FromSeconds(Rarekiller.Settings.Blacklist5));
                            return;
                        }
                    }
                }
                if (Rarekiller.Settings.PlayerScan && RarekillerSecurity.PlayerAround(o))
                {
                    Logging.Write(Colors.MediumPurple, "Rarekiller: There are other Players around, so move on");
                    if (Rarekiller.Settings.LUAoutput)
                    {
                        Lua.DoString("print('NPCScan: Other Players around')");
                    }
                    Blacklist.Add(o.Guid, Rarekiller.Settings.Flags, TimeSpan.FromSeconds(Rarekiller.Settings.Blacklist5));
                    return;
                }
                if (Rarekiller.DontInteract)
                {
                    return;
                }
                #endregion

                #region Move to Helperpoint if found known Figurine under a Tent
                if (Me.IsFlying && ((o.Location.Distance(ProblemCamel1) < 10) || (o.Location.Distance(ProblemCamel2) < 10) ||
                                    (o.Location.Distance(ProblemCamel3) < 10) || (o.Location.Distance(ProblemCamel4) < 20)))
                {
                    WoWPoint HelperPointCamel = o.Location;
                    HelperPointCamel.X = HelperPointCamel.X + 20;
                    HelperPointCamel.Z = HelperPointCamel.Z + 5;
                    Logging.Write(Colors.MediumPurple, "Rarekiller: Found a Problem Figurine {0} so dismount and walk", o.Entry);
                    if (!Rarekiller.MoveTo(HelperPointCamel, 3, false))
                    {
                        return;
                    }
                    //if (!Rarekiller.DescendToLand(o)) return;
                    Rarekiller.Dismount();
                    Forceground = true;
                }
                #endregion

                #region Move to Helperpoint if known Underground NPC
                if (Me.IsFlying && o.Entry == 64227)
                {
                    if (!Rarekiller.MoveTo(LandingPoint64227, 5, false))
                    {
                        return;
                    }
                    Rarekiller.Dismount();
                    Forceground = true;
                }
                #endregion

                #region Move to NPC
                if (Me.IsFlying && Forceground)
                {
                    Logging.Write(Colors.MediumPurple, "Rarekiller: Failure in Programming. Fly again to Helperpoint and Dismount", o.Entry);
                    return;
                }
                if (!Rarekiller.MoveTo(o, 4, Forceground))
                {
                    return;
                }
                Logging.WriteDiagnostic(Colors.MediumPurple, "Rarekiller: NPC Location: {0} / {1} / {2}", Convert.ToString(o.X), Convert.ToString(o.Y), Convert.ToString(o.Z));
                Logging.WriteDiagnostic(Colors.MediumPurple, "Rarekiller: My Location: {0} / {1} / {2}", Convert.ToString(Me.X), Convert.ToString(Me.Y), Convert.ToString(Me.Z));
                Rarekiller.Dismount();
                #endregion

                o.Interact();
                o.Interact();
                o.Interact();
                Logging.Write(Colors.MediumPurple, "Rarekiller: Interact with NPC - ID {0}", o.Entry);
                Thread.Sleep(300);

                //Another Mans Treasure NPCs
                if (o.Entry == 65552 || o.Entry == 64272 || o.Entry == 64004 || o.Entry == 64191 || o.Entry == 64227)
                {
                    Thread.Sleep(1000);
                    Lua.DoString("RunMacroText(\"/click GossipTitleButton1\");");
                    Thread.Sleep(1000);
                }
                //Blingtron
                if (o.Entry == 43929)
                {
                    Thread.Sleep(1000);
                    Lua.DoString("SelectGossipAvailableQuest(GetNumGossipAvailableQuests())");
                    Thread.Sleep(1000);
                    Lua.DoString("RunMacroText(\"/click QuestFrameCompleteQuestButton\")");
                    Thread.Sleep(1000);
                    Blacklist.Add(o.Guid, Rarekiller.Settings.Flags, TimeSpan.FromSeconds(Rarekiller.Settings.Blacklist60));
                }
            }
        }
        public void KillAeonaxx()
        {
            bool CastSuccess      = false;
            bool CastSuccessThrow = true;
            bool CastSuccessShoot = true;

            ObjectManager.Update();
            List <WoWUnit> objList1 = ObjectManager.GetObjectsOfType <WoWUnit>()
                                      .Where(aenoaxx => (!aenoaxx.Dead && (aenoaxx.Location.Distance(Me.Location) < 40) && ((Rarekiller.Settings.Aeonaxx && (aenoaxx.Entry == 51236)) || //Aenoaxx hostile
                                                                                                                            (Rarekiller.Settings.TestWelpTargeting && Rarekiller.inCombat && (aenoaxx.Entry == 33687)) || // Testcase Chillmaw
                                                                                                                            (Rarekiller.Settings.TestKillAeonaxx && (aenoaxx.Entry == 31146)) // Testcase Training Dummy
                                                                                                                            )))
                                      .OrderBy(aenoaxx => aenoaxx.Entry).ToList();

            foreach (WoWUnit aeonaxx in objList1)
            {
                if (!aeonaxx.Dead && !aeonaxx.IsPet && !Blacklist.Contains(aeonaxx.Guid))
                {
                    if ((aeonaxx.Entry == 51236) && !Me.IsOnTransport)
                    {
                        Logging.Write(System.Drawing.Color.DarkOrange, "Rarekiller: Find {0} ID {1}, but I don't mounted him", aeonaxx.Name, aeonaxx.Entry);
                        Blacklist.Add(aeonaxx.Guid, TimeSpan.FromSeconds(Rarekiller.Settings.Blacklist60));
                        Logging.Write(System.Drawing.Color.DarkOrange, "Rarekiller: Blacklist Mob for 60 Minutes.");
                        return;
                    }

                    Logging.Write(System.Drawing.Color.MediumPurple, "Rarekiller: Find a hunted Mob called {0} ID {1}", aeonaxx.Name, aeonaxx.Entry);

                    while (!aeonaxx.Dead)
                    {
                        //if (Rarekiller.Settings.DeveloperLogs)
                        Logging.WriteDebug("Rarekiller: Scan for Aeonaxx Adds to Kill");
                        ObjectManager.Update();
                        List <WoWUnit> objList2 = ObjectManager.GetObjectsOfType <WoWUnit>()
                                                  .Where(add => (!add.Dead && (add.Location.Distance(Me.Location) < 40) && ((Rarekiller.Settings.Aeonaxx && (add.Entry == 44038)) || //Young Stone Drake
                                                                                                                            (Rarekiller.Settings.TestWelpTargeting && Rarekiller.inCombat && (add.Entry == 33695))))) // Testcase Cultist Bombadier
                                                  .OrderBy(add => add.Entry).ToList();

                        foreach (WoWUnit add in objList2)
                        {
                            // Kill Welpling
                            while (!add.Dead)
                            {
                                if (Me.CurrentTarget != add)
                                {
                                    add.Target();
                                    Logging.Write("Rarekiller Part Aeonaxx: Target {0}", Me.CurrentTarget.Name);
                                }
                                if (!Me.IsAutoAttacking)
                                {
                                    Lua.DoString("StartAttack()");
                                }

                                if (Me.Class == WoWClass.Hunter)
                                {
                                    Rarekiller.RotaHunter.HunterKill(add);
                                }
                                else if (Me.Class == WoWClass.Druid)
                                {
                                    Rarekiller.RotaDruid.DruidKill(add);
                                }
                                else if (Me.Class == WoWClass.DeathKnight)
                                {
                                    Rarekiller.RotaDK.DKKill(add);
                                }
                                else if (Me.Class == WoWClass.Warrior)
                                {
                                    Rarekiller.RotaWarrior.WarriorKill(add);
                                }
                                else if (Me.Class == WoWClass.Warlock)
                                {
                                    Rarekiller.RotaWarlock.WarlockKill(add);
                                }
                                else if (Me.Class == WoWClass.Shaman)
                                {
                                    Rarekiller.RotaShaman.ShamanKill(add);
                                }
                                else if (Me.Class == WoWClass.Paladin)
                                {
                                    Rarekiller.RotaPaladin.PaladinKill(add);
                                }
                                else if (Me.Class == WoWClass.Mage)
                                {
                                    Rarekiller.RotaMage.MageKill(add);
                                }
                                else if (Me.Class == WoWClass.Rogue)
                                {
                                    Rarekiller.RotaRogue.RogueKill(add);
                                }
                                else if (Me.Class == WoWClass.Priest)
                                {
                                    Rarekiller.RotaPriest.PriestKill(add);
                                }
                            }
                        }

                        //Damage to Aeonaxx
                        if (Me.CurrentTarget != aeonaxx)
                        {
                            aeonaxx.Target();
                        }
                        if (!Me.IsAutoAttacking)
                        {
                            Lua.DoString("StartAttack()");
                        }

                        if (Me.Class == WoWClass.Hunter)
                        {
                            Rarekiller.RotaHunter.HunterKill(aeonaxx);
                        }
                        else if (Me.Class == WoWClass.Druid)
                        {
                            Rarekiller.RotaDruid.DruidKill(aeonaxx);
                        }
                        else if (Me.Class == WoWClass.DeathKnight)
                        {
                            Rarekiller.RotaDK.DKKill(aeonaxx);
                        }
                        else if (Me.Class == WoWClass.Warrior)
                        {
                            Rarekiller.RotaWarrior.WarriorKill(aeonaxx);
                        }
                        else if (Me.Class == WoWClass.Warlock)
                        {
                            Rarekiller.RotaWarlock.WarlockKill(aeonaxx);
                        }
                        else if (Me.Class == WoWClass.Shaman)
                        {
                            Rarekiller.RotaShaman.ShamanKill(aeonaxx);
                        }
                        else if (Me.Class == WoWClass.Paladin)
                        {
                            Rarekiller.RotaPaladin.PaladinKill(aeonaxx);
                        }
                        else if (Me.Class == WoWClass.Mage)
                        {
                            Rarekiller.RotaMage.MageKill(aeonaxx);
                        }
                        else if (Me.Class == WoWClass.Rogue)
                        {
                            Rarekiller.RotaRogue.RogueKill(aeonaxx);
                        }
                        else if (Me.Class == WoWClass.Priest)
                        {
                            Rarekiller.RotaPriest.PriestKill(aeonaxx);
                        }
                    }
                }
            }
        }
示例#8
0
        protected override Composite CreateBehavior()
        {
            return(_root ?? (_root =
                                 new Decorator(ret => !_isDone,
                                               new PrioritySelector(
                                                   new Decorator(ret => IsQuestComplete(),
                                                                 new PrioritySelector(
                                                                     new Decorator(ret => Me.IsOnTransport,
                                                                                   new Action(delegate
            {
                DLog("Quest complete - cancelling Flame Ascendancy");
                Lua.DoString("VehicleExit()");
                StyxWoW.SleepForLagDuration();
                return RunStatus.Success;
            })
                                                                                   ),
                                                                     new Action(delegate
            {
                _isDone = true;
                StyxWoW.SleepForLagDuration();
                return RunStatus.Success;
            })
                                                                     )
                                                                 ),

                                                   // loop waiting for target only if no buff
                                                   new Decorator(ret => Target == null,
                                                                 new Action(delegate
            {
                StyxWoW.SleepForLagDuration();
                return RunStatus.Success;
            })
                                                                 ),

                                                   // loop waiting for CurrentTarget only if no buff
                                                   new Decorator(ret => Target != Me.CurrentTarget,
                                                                 new Action(delegate
            {
                WoWUnit target = Target;
                target.Target();
                StyxWoW.SleepForLagDuration();
                return RunStatus.Success;
            })
                                                                 ),

                                                   // use item to get buff (enter vehicle)
                                                   new Decorator(ret => !Me.IsOnTransport,
                                                                 new Action(delegate
            {
                WoWItem item = ObjectManager.GetObjectsOfType <WoWItem>().FirstOrDefault(i => i != null && i.Entry == 42481);
                if (item == null)
                {
                    Log("ERROR - quest item Talisman of Flame Ascendancy not in inventory");
                    TreeRoot.Stop();
                }

                Log("Use: {0}", item.Name);
                item.Use(true);
                StyxWoW.SleepForLagDuration();
                return RunStatus.Success;
            })
                                                                 ),

                                                   new Decorator(ret => Target.Distance > 5,
                                                                 new Action(delegate
            {
                DLog("Moving towards target");
                Navigator.MoveTo(Target.Location);
                return RunStatus.Success;
            })
                                                                 ),

                                                   new Decorator(ret => Target.Distance <= 5 && Me.IsMoving,
                                                                 new Action(delegate
            {
                DLog("At target, so stopping");
                WoWMovement.MoveStop();
                return RunStatus.Success;
            })
                                                                 ),

                                                   new Decorator(ret => !StyxWoW.GlobalCooldown && !Blacklist.Contains(2),
                                                                 new Action(delegate
            {
                Log("Cast Flame Shield");
                Lua.DoString("RunMacroText(\"/click BonusActionButton4\")");
                Blacklist.Add(2, TimeSpan.FromMilliseconds(8000));
                return RunStatus.Success;
            })
                                                                 ),

                                                   new Decorator(ret => !StyxWoW.GlobalCooldown && !Blacklist.Contains(1),
                                                                 new Action(delegate
            {
                Log("Cast Attack");
                Lua.DoString("RunMacroText(\"/click BonusActionButton1\")");
                Blacklist.Add(1, TimeSpan.FromMilliseconds(1500));
                return RunStatus.Success;
            })
                                                                 ),

                                                   new Action(delegate
            {
                DLog("Waiting for Cooldown");
                return lastStateReturn;
            })
                                                   )
                                               )
                             ));
        }
        /// <summary>
        /// Creates the behavior used for pulling mobs, (approach, attack)
        /// </summary>
        /// <returns></returns>
        private PrioritySelector CreatePullBehavior()
        {
            return(new PrioritySelector(

                       new Decorator(ret => AmplifySettings.Instance.MoveDisable && !Me.GotTarget && !Me.CurrentTarget.IsFriendly && !Me.CurrentTarget.Dead && Me.CurrentTarget.Attackable,
                                     new ActionIdle()),
                       // Use leaders target
                       new Decorator(
                           ret => !AmplifySettings.Instance.MoveDisable &&
                           Me.IsInParty && !Me.IsInInstance && RaFHelper.Leader != null && RaFHelper.Leader.GotTarget && Me.GotTarget &&
                           Me.CurrentTargetGuid != RaFHelper.Leader.CurrentTargetGuid,
                           new Action(ret =>
                                      RaFHelper.Leader.CurrentTarget.Target())),

                       // Clear target and return failure if it's tagged by someone else
                       new Decorator(ret => !Me.IsInParty && Me.GotTarget && Me.CurrentTarget.TaggedByOther,
                                     new Action(delegate
            {
                SpellManager.StopCasting();

                Log("Current target is not tagged by me, Aborting pull!");
                Blacklist.Add(Me.CurrentTarget, TimeSpan.FromMinutes(30));
                Me.ClearTarget();
                return RunStatus.Failure;
            })
                                     ),

                       // If we are casting we assume we are already pulling so let it 'return' smoothly.
                       // if we are in combat pull suceeded and the combat behavior should run
                       new Decorator(ret => (Me.IsCasting || Me.Combat) && Me.CurrentTarget.Distance < PullDistance + 3,
                                     new Action(delegate { return RunStatus.Success; })),

/*
 *              // Make sure we got a proper target
 *              new Decorator(ret => !Me.GotTarget && !Me.IsInParty,
 *                            new Action(delegate
 *                            {
 *                                Targeting.Instance.TargetList[0].Target();
 *                                WoWMovement.Face();
 *                                Thread.Sleep(100);
 *                                return RunStatus.Success;
 *                            })),
 */
                       // Blacklist target's we can't move to
                       new Decorator(ret => !IsBattleGround() && !Me.IsInInstance && Navigator.GeneratePath(Me.Location, Me.CurrentTarget.Location).Length <= 0,
                                     new Action(delegate
            {
                Blacklist.Add(Me.CurrentTargetGuid, TimeSpan.FromDays(365));
                Log("Failed to generate path to: {0} blacklisted!",
                    Me.CurrentTarget.Name);
                return RunStatus.Success;
            })
                                     ),

                       // Move closer to the target if we are too far away or in !Los
                       new Decorator(ret => !AmplifySettings.Instance.MoveDisable && Me.GotTarget && (Me.CurrentTarget.Distance > PullDistance - 1 || !Me.CurrentTarget.InLineOfSight),
                                     new Action(delegate
            {
                Log("Moving towards:{0}", Me.CurrentTarget);
                Navigator.MoveTo(Me.CurrentTarget.Location);
            })),

                       // Stop moving if we are moving
                       new Decorator(ret => !AmplifySettings.Instance.MoveDisable && Me.IsMoving,
                                     new Action(ret => WoWMovement.MoveStop())),

                       new Decorator(ret => !AmplifySettings.Instance.MoveDisable && Me.GotTarget && !Me.IsFacing(Me.CurrentTarget),
                                     new Action(ret => WoWMovement.Face())
                                     ),


                       new PrioritySelector(



                           //Pull spells, Check Arcane Missles if Proc
                           new Decorator(ret => SpellManager.CanCast("Arcane Missiles") && Me.Auras.ContainsKey("Arcane Missiles!") && AmplifySettings.Instance.Pull_ProcArcaneMissles,
                                         new PrioritySelector(
                                             CreateSpellCheckAndCast("Arcane Missiles")
                                             )),

                           //Low Level Forced Fireball, should never be run after level 4
                           new Decorator(ret => !SpellManager.HasSpell("Frostbolt"),
                                         new PrioritySelector(
                                             CreateSpellCheckAndCast("Fireball")
                                             )),

                           //Normal Pull Spells Toggled by Settings.
                           new Decorator(ret => SpellManager.HasSpell(CurrentPullSpell),
                                         new PrioritySelector(
                                             CreateSpellCheckAndCast(CurrentPullSpell)
                                             )),


                           //Step Through Pet Logic.
                           new Decorator(ret => Me.GotAlivePet && AmplifySettings.Instance.Freeze && Me.CurrentTarget.Distance > 10 && !WillChain(0, Me.CurrentTarget.Location) && (!FreezeTimer.IsRunning || FreezeTimer.Elapsed.Seconds > 30),
                                         new Action(ctx => Freeze()))



                           )
                       ));
        }
示例#10
0
        /// <summary>
        ///     Handles opening treasure coffers or opening an exit portal
        /// </summary>
        /// <returns></returns>
        internal async Task <bool> TreasureOrExit()
        {
            int tries = 0;

/*            if (Target.Unit.IsValid && Target.Unit.NpcId == EntityNames.BossExit)
 *          {
 *
 *          }*/

            if (Target.Location.Distance2D(Core.Me.Location) >= 3)
            {
                await CommonTasks.MoveAndStop(new MoveToParameters(Target.Location, Target.Name), 2.5f, true);

                return(true);
            }

            while (!DeepDungeonHoH.StopPlz && tries < 3 && Target.Unit.IsValid)
            {
                //if we are a frog / lust we can't open a chest
                if (Constants.AuraTransformed)
                {
                    Logger.Warn("Unable to open chest. Waiting for aura to end...");
                    await CommonTasks.StopMoving("Waiting on aura to end");

                    await Coroutine.Wait(TimeSpan.FromSeconds(30),
                                         () => !Constants.AuraTransformed || Core.Me.InCombat || DeepDungeonHoH.StopPlz);

                    return(true);
                }

                await Coroutine.Yield();

                Logger.Verbose("Attempting to interact with: {0} ({1} / 3)", Target.Name, tries + 1);

                Target.Unit.Target();
                //if (!Settings.Instance.NotLeader || (Settings.Instance.NotLeader && Target.Unit != null && (Target.Unit.NpcId == EntityNames.FloorExit || Target.Unit.NpcId == EntityNames.LobbyExit || Target.Unit.NpcId == EntityNames.BossExit)))
                if (!PartyManager.IsInParty || PartyManager.IsPartyLeader ||
                    PartyManager.IsInParty && Constants.IsExitObject(Target.Unit))
                {
                    if (Constants.IsExitObject(Target.Unit))
                    {
                        Logger.Debug("At Exit");
                        await Coroutine.Sleep(500);
                    }


                    await CommonTasks.StopMoving("Leader Interacting");

                    Target.Unit.Interact();
                }
                else
                {
                    await CommonTasks.StopMoving("Waiting for leader to use chest");
                }

                await Coroutine.Sleep(500);

                tries++;

                if (!Target.Unit.IsValid)
                {
                    break;
                }

                if (!Target.Unit.IsTargetable)
                {
                    break;
                }

                if (SelectYesno.IsOpen)
                {
                    break;
                }
            }

            await Coroutine.Wait(1000, () => SelectYesno.IsOpen);

            //if this is an exit
            if (SelectYesno.IsOpen)
            {
                SelectYesno.ClickYes();
                await Coroutine.Sleep(1000);

                Logger.Debug("Is window open : {0}", RaptureAtkUnitManager.GetWindowByName("DeepDungeonResult"));
                if (RaptureAtkUnitManager.GetWindowByName("DeepDungeonResult") != null)
                {
                    Logger.Debug("Calling Close");
                    await Coroutine.Sleep(2000);

                    RaptureAtkUnitManager.GetWindowByName("DeepDungeonResult").SendAction(1, 3, uint.MaxValue);
                }
                await Coroutine.Wait(TimeSpan.MaxValue,
                                     () => DeepDungeonHoH.StopPlz || QuestLogManager.InCutscene || NowLoading.IsVisible);

                return(true);
            }

            Blacklist.Add(Target.Unit.ObjectId, TimeSpan.FromMinutes(1),
                          $"Tried to Interact with the Target {tries} times");
            Poi.Clear($"Tried to Interact with the Target {tries} times");

            return(false);
        }
示例#11
0
 public static void BlacklistPool(WoWGameObject pool, TimeSpan time, string reason)
 {
     Blacklist.Add(pool.Guid, BlacklistFlags.Node, time, reason);
     BotPoi.Clear(reason);
 }
示例#12
0
        public override void Combat()
        {
            isPulling = false;
            _combatLoop.Reset();
            _combatLoop.Start();

            if (_settings.showDebug)
            {
                slog("Starting Combat Loop!");
            }


            try
            {
                if (Battlegrounds.IsInsideBattleground)
                {
                    if (Me.GotTarget &&
                        Me.CurrentTarget.IsPet)
                    {
                        Blacklist.Add(Me.CurrentTarget, TimeSpan.FromDays(1));
                        Me.ClearTarget();
                        return;
                    }
                }

                #region bugged mobs
                if (Me.GotTarget && (!fightTimer.IsRunning || Me.CurrentTarget.Guid != lastGuid))
                {
                    fightTimer.Reset();
                    fightTimer.Start();
                    lastGuid = Me.CurrentTarget.Guid;
                    slog("Killing " + Me.CurrentTarget.Name + " at distance " +
                         System.Math.Round(targetDistance).ToString() + ".");
                }

                if (Me.GotTarget && !Me.CurrentTarget.IsPlayer &&
                    fightTimer.ElapsedMilliseconds > 25 * 1000 &&
                    Me.CurrentTarget.HealthPercent > 95)
                {
                    slog(" This " + Me.CurrentTarget.Name + " is a bugged mob.  Blacklisting for 1 hour.");

                    Blacklist.Add(Me.CurrentTarget.Guid, TimeSpan.FromHours(1.00));
                    Me.ClearTarget();

                    Styx.Helpers.KeyboardManager.PressKey('S');
                    Thread.Sleep(5 * 1000);
                    Styx.Helpers.KeyboardManager.ReleaseKey('S');
                    Me.ClearTarget();
                    lastGuid = 0;
                    return;
                }

                #endregion

                DotEmUp();     // Thanks to CodeNameG

                SmartTarget(); // TM :P

                if (Me.GotTarget)
                {
                    if (isTotem)
                    {
                        slog("Killing totem {0}", Me.CurrentTarget.Name);
                        KillTotem();
                        //                        Thread.Sleep(_settings.myLag);
                    }
                }
                else
                {
                    _combatLoop.Stop();
                    if (_settings.showDebug)
                    {
                        slog("Exiting Combat Loop (NoTarget)! Duration {0}ms", _combatLoop.ElapsedMilliseconds);
                    }
                    return;
                }


                //Thread.Sleep(_settings.myLag);

                if (Me.GotAlivePet)
                {
                    if (Me.GotTarget && Me.CurrentTarget.CurrentTargetGuid == Me.Guid)
                    {
                        Lua.DoString("PetAttack()");
                        slog("Target is attacking me, calling {0} to get aggro", Me.Pet.Name);
                    }
                    Lua.DoString("PetAttack()");
                }
                followTimer.Reset();
                followTimer.Start();


                while (targetDistance > shadowRange + 2)
                {
                    slog("{0} yard from {1}.", System.Math.Round(targetDistance).ToString(), Me.CurrentTarget.Name);
                    Navigator.MoveTo(attackPoint);
                    //WoWMovement.ClickToMove(Me.CurrentTarget.Location, (float)shadowRange);
                    Thread.Sleep(_settings.myLag);
                    if (followTimer.ElapsedMilliseconds > 20000 && Me.CurrentTarget.IsPlayer)
                    {
                        followTimer.Stop();
                        slog("Followed for more than 20 secs!");
                        Me.ClearTarget();
                        Lua.DoString("PetFollow()");
                        return;
                    }
                }
                followTimer.Stop();


                CheckSummon();

                while (Me.IsCasting)
                {
                    Thread.Sleep(_settings.myLag);
                }
                if (Me.GotTarget)
                {
                    CombatDecision();
                }

                if (targetDistance <= 4 && !Me.IsCasting)
                {
                    WoWMovement.Face();
                    Thread.Sleep(_settings.myLag);
                    if (!Me.IsAutoAttacking)
                    {
                        Lua.DoString("StartAttack()");
                    }
                }
            }
            catch (Exception ex)
            {
                if (_settings.showDebug)
                {
                    slog(ex.Source);
                    slog(ex.Message);
                    slog(ex.StackTrace);
                }
            }

            _combatLoop.Stop();

            if (_settings.showDebug)
            {
                slog("Exiting Combat Loop! Duration {0}ms", _combatLoop.ElapsedMilliseconds);
            }
        }
示例#13
0
        public override void Pull()
        {
            isPulling = true;
            while (Me.IsMoving)
            {
                WoWMovement.MoveStop();
            }

            _pulLoop.Reset();
            _pulLoop.Start();
            if (_settings.showDebug)
            {
                slog("Starting Pull Loop!");
            }
            dismountTimer.Start();

            while ((dismountTimer.ElapsedMilliseconds < 5000 && dismountTimer.IsRunning) && !Me.GotAlivePet)
            {
                if (_settings.showDebug)
                {
                    slog("Wait for pet or 5s - now {0} ms! {1}", dismountTimer.ElapsedMilliseconds, dismountTimer.IsRunning);
                    slog("PetAlive {0}!", Me.GotAlivePet);
                }
                Thread.Sleep(_settings.myLag);
            }
            if (_settings.showDebug)
            {
                slog("Wait ends!");
            }

            if (combatChecks)
            {
                if (Battlegrounds.IsInsideBattleground && Me.CurrentTarget.Mounted)
                {
                    Blacklist.Add(Me.CurrentTarget.Guid, TimeSpan.FromSeconds(30));
                    Me.ClearTarget();
                    return;
                }
                if (Me.CurrentTarget.Guid != lastGuid)
                {
                    fightTimer.Reset();
                    lastGuid = Me.CurrentTarget.Guid;
                    slog("Killing " + Me.CurrentTarget.Name + " at distance " +
                         System.Math.Round(targetDistance).ToString() + ".");
                    pullTimer.Reset();
                    pullTimer.Start();
                }
                else
                {
                    if (pullTimer.ElapsedMilliseconds > 30 * 1000)
                    {
                        slog("Cannot pull " + Me.CurrentTarget.Name + " now.  Blacklist for 30 minutes.");
                        Blacklist.Add(Me.CurrentTarget.Guid, TimeSpan.FromMinutes(30));
                    }
                }


                if (Me.GotAlivePet && Me.GotTarget)
                {
                    if (!Me.Pet.IsAutoAttacking && Me.Level > 10)
                    {
                        // Me.Pet.
                        Lua.DoString("PetAttack()");
                        slog("Let " + Me.Pet.Name + " gain aggro.");
                        Thread.Sleep(_settings.petAttackDelay);
                    }
                }

//                if (!Me.IsAutoAttacking)
//                {
//                    Lua.DoString("StartAttack()");
//                    Thread.Sleep(_settings.myLag);
//               }


                while (targetDistance > shadowRange + 2)
                {
                    slog("{0} yard from {1}.", Math.Round(targetDistance).ToString(), Me.CurrentTarget.Name);
                    Navigator.MoveTo(attackPoint);
                    //WoWMovement.ClickToMove(Me.CurrentTarget.Location, (float)shadowRange);
                    Thread.Sleep(_settings.myLag);
                    if (pullTimer.ElapsedMilliseconds > 10000)
                    {
                        Me.ClearTarget();
                        Lua.DoString("PetFollow()");
                        return;
                    }
                }

                while (!Me.CurrentTarget.InLineOfSightOCD && targetDistance > 2)
                {
                    slog("Not in LOS, closing the target");
                    Navigator.MoveTo(Me.CurrentTarget.Location);
                    //WoWMovement.ClickToMove(Me.CurrentTarget.Location, (float)(targetDistance - 1) );
                    Thread.Sleep(_settings.myLag * 2);
                    if (pullTimer.ElapsedMilliseconds > 12000)
                    {
                        Me.ClearTarget();
                        Lua.DoString("PetFollow()");
                        return;
                    }
                }

                while (Me.IsMoving)
                {
                    WoWMovement.MoveStop();
                }

                CombatDecision();


                _pulLoop.Stop();

                if (_settings.showDebug)
                {
                    slog("Exiting Pull Loop! Duration {0}ms", _pulLoop.ElapsedMilliseconds);
                }
            }
        }
示例#14
0
        public static async Task <bool> UseItem(uint itemId, GameObject obj, int waitTime = 0, bool blacklistAfter = false, int blacklistDuration = 30)
        {
            var bagSlot = InventoryManager.FilledSlots.FirstOrDefault(s => s.RawItemId == itemId);

            if (bagSlot == null)
            {
                return(false);
            }

            if (obj == null)
            {
                return(false);
            }

            while (true)
            {
                if (Core.Me.IsDead)
                {
                    return(false);
                }

                if (SelectString.IsOpen)
                {
                    if (selectStringIndex.Count > 0)
                    {
                        SelectString.ClickSlot((uint)selectStringIndex.Dequeue());
                    }
                    else
                    {
                        SelectString.ClickSlot(0);
                    }
                }

                if (Talk.DialogOpen)
                {
                    Talk.Next();
                    await Coroutine.Sleep(300);

                    continue;
                }

                if (MovementManager.IsMoving)
                {
                    await CommonTasks.StopMoving();

                    await Coroutine.Sleep(300);

                    continue;
                }

                if (Core.Me.IsMounted)
                {
                    await CommonTasks.StopAndDismount();

                    await Coroutine.Sleep(300);

                    continue;
                }

                if (Core.Me.CurrentTarget != obj)
                {
                    obj.Target();
                    await Coroutine.Sleep(300);

                    continue;
                }

                if (bagSlot.Item.IsGroundTargeting)
                {
                    bagSlot.UseItem(obj.Location);
                }
                else
                {
                    bagSlot.UseItem(obj);
                }

                if (await Coroutine.Wait(1000, () => Core.Me.IsCasting))
                {
                    if (await Coroutine.Wait(15000, () => !Core.Me.IsCasting))
                    {
                        if (await Coroutine.Wait(5000, () => !obj.IsValid || !obj.IsTargetable || !obj.IsVisible || !bagSlot.CanUse(obj)))
                        {
                            break;
                        }
                    }
                }
                else
                {
                    return(false);
                }
            }

            if (waitTime > 0)
            {
                await Coroutine.Sleep(waitTime);
            }

            if (blacklistAfter)
            {
                Blacklist.Add(obj, BlacklistFlags.SpecialHunt, TimeSpan.FromSeconds(blacklistDuration), "BlacklistAfter");
            }

            return(true);
        }
        public override void Pulse()
        {
            if (!isInitialize)
            {
                updateList(true); isInitialize = true;
            }

            if (!complete && !Me.Combat)
            {
                List <WoWUnit> _Unit = ObjectManager.GetObjectsOfType <WoWUnit>();
                foreach (WoWUnit critterUnit in _Unit)
                {
                    bool achievementFound = false;

                    #region love Achievement
                    if (loveAchievement.Contains(critterUnit.Name))
                    {
                        slog("found: " + critterUnit.Name);
                        achievementFound = true;

                        while (achievementFound)
                        {
                            TreeRoot.StatusText = Name + ": " + Me.Name + " love " + critterUnit.Name;
                            WoWMovement.MoveStop();
                            RunMakro("/tar " + critterUnit.Name);
                            RunMakro("/love");
                            RunMakro("/cleartarget");
                            slog("{0} love {1}", Me.Name, critterUnit.Name);
                            loveAchievement.Remove(critterUnit.Name);
                            achievementFound = false;
                        }
                    }
                    #endregion

                    #region kill Achievement
                    while (killAchievement.Contains(critterUnit.Name) && critterUnit.IsAlive && !Completed(2556) && !Blacklist.Contains(critterUnit.Guid) && !Me.OnTaxi)
                    {
                        //System.Media.SystemSounds.Asterisk.Play();
                        WoWMovement.MoveStop();
                        if (!achievementFound)
                        {
                            slog("found: " + critterUnit.Name);
                        }
                        achievementFound = true;

                        while ((Me.IsFlying || !Navigator.CanNavigateFully(Me.Location, critterUnit.WorldLocation)) && critterUnit.IsIndoors)
                        {
                            WoWMovement.ClickToMove(StyxWoW.Me.Location.Add(0, 0, -10));
                        }
                        while ((Me.IsFlying || !Navigator.CanNavigateFully(Me.Location, critterUnit.WorldLocation)) && !critterUnit.IsIndoors)
                        {
                            WoWPoint critterPosi = critterUnit.Location;

                            while (critterPosi.Distance(Me.Location) >= 5)
                            {
                                WoWMovement.ClickToMove(critterPosi);
                                Thread.Sleep(100);
                            }
                        }
                        WoWMovement.MoveStop();

                        while (achievementFound && Navigator.CanNavigateFully(Me.Location, critterUnit.WorldLocation) && !Me.Combat && critterUnit.Distance >= 4)
                        {
                            critterUnit.Face();
                            Thread.Sleep(1500);
                            if (Me.Class == WoWClass.Druid && SpellManager.HasSpell(768))
                            {
                                slog("(Dismount) switch to {0}", WoWSpell.FromId(768).Name); WoWSpell.FromId(768).Cast(); Thread.Sleep(1500);
                            }
                            else if (Me.Mounted)
                            {
                                slog("Dismount!"); RunMakro("/dismount");
                            }

                            if (backPoint == WoWPoint.Empty && !Me.IsSwimming)
                            {
                                slog("set retreat position to " + Me.Location.ToString()); backPoint = Me.Location;
                            }

                            if (!retreatTimer.IsRunning)
                            {
                                retreatTimer.Start();
                            }

                            if (!Me.Combat && achievementFound)
                            {
                                int maxStuckTimer = (500 * ((int)critterUnit.Distance + 1));
                                //slog("maxStuckTimer: {0}", maxStuckTimer);
                                slog("Move to {0}, Distance: {1}yards", critterUnit.Name, (int)critterUnit.Distance);
                                stuckTimer.Reset(); stuckTimer.Start();

                                while (stuckTimer.ElapsedMilliseconds <= maxStuckTimer && !Me.Combat && critterUnit.Distance >= 2)
                                {
                                    if (backPoint == WoWPoint.Empty && !Me.IsSwimming)
                                    {
                                        slog("set retreat position to " + Me.Location.ToString()); backPoint = Me.Location;
                                    }
                                    TreeRoot.StatusText = (Name + ": Move to " + critterUnit.Name + ", Distance: " + (int)critterUnit.Distance + "yards");
                                    Navigator.MoveTo(critterUnit.Location);
                                    Thread.Sleep(100);
                                }
                                stuckTimer.Stop();

                                if (stuckTimer.ElapsedMilliseconds >= maxStuckTimer)
                                {
                                    Blacklist.Add(critterUnit.Guid, new TimeSpan(0, 5, 0));
                                    achievementFound = false; moveBack = true; stuckTimer.Stop(); Me.ClearTarget();
                                    retreatTimer.Stop(); retreatTime = (retreatTimer.ElapsedMilliseconds + 5000); retreatTimer.Reset();
                                    slog("we stuck! Blacklist - Name: {0} / GuId: {1} - After: {2}ms", critterUnit.Name, critterUnit.Guid, stuckTimer.ElapsedMilliseconds);
                                    TreeRoot.StatusText = Name + " we stuck! Blacklist - Name: " + critterUnit.Name + " / GuId: " + critterUnit.Guid.ToString() + " - After: " + stuckTimer.ElapsedMilliseconds + "ms";
                                    return;
                                }
                            }
                            retreatTimer.Stop(); retreatTime = (retreatTimer.ElapsedMilliseconds + 5000); retreatTimer.Reset();
                            //slog("set retreatTime to: " + retreatTime + "ms");

                            if (Me.Combat)
                            {
                                return;
                            }
                            WoWMovement.MoveStop();

                            while (!Me.Combat && achievementFound && critterUnit.Distance <= 5)
                            {
                                critterUnit.Target();
                                slog("slay {0}..", critterUnit.Name);

                                stuckTimer.Reset(); stuckTimer.Start();
                                while (critterUnit.IsAlive && stuckTimer.ElapsedMilliseconds <= 10000 && !Me.Combat)
                                {
                                    critterUnit.Interact(); TreeRoot.StatusText = Name + ": slay " + critterUnit.Name;
                                }
                                stuckTimer.Stop();

                                if (stuckTimer.ElapsedMilliseconds >= 10000)
                                {
                                    Blacklist.Add(critterUnit.Guid, new TimeSpan(0, 5, 0));
                                    moveBack = true; achievementFound = false; Me.ClearTarget();
                                    slog("we stuck! Blacklist Name: {0} / GuId: {1}", critterUnit.Name, critterUnit.Guid);
                                    TreeRoot.StatusText = Name + " we stuck! Blacklist Name: " + Name + " / GuId: " + critterUnit.Guid.ToString();
                                }
                                else
                                {
                                    //updateList(false);
                                    killAchievement.Remove(critterUnit.Name);
                                    moveBack         = true;
                                    achievementFound = false;
                                }
                            }
                        }
                    }
                    #endregion

                    #region back to retreat position
                    while (moveBack && !Me.Combat && backPoint != WoWPoint.Empty && !achievementFound && !Me.OnTaxi)
                    {
                        if (!IsOutdoors())
                        {
                            slog("Move back to retreat position: " + backPoint.ToString() + " / Distance: " + (int)backPoint.Distance(Me.Location) + "yards");
                            stuckTimer.Reset(); stuckTimer.Start();
                            while (Me.Location.Distance(backPoint) >= 5 && !Me.Combat && stuckTimer.ElapsedMilliseconds <= (retreatTime))
                            {
                                TreeRoot.StatusText = (Name + ": Move back to retreat. Distance: " + (double)backPoint.Distance(Me.Location) + "yards");
                                Navigator.MoveTo(backPoint);
                                Thread.Sleep(100);
                            }
                            stuckTimer.Stop();
                            WoWMovement.MoveStop();

                            if (Me.Combat)
                            {
                                return;
                            }
                            if (stuckTimer.ElapsedMilliseconds >= (retreatTime))
                            {
                                slog("sorry we stuck... logout...  :("); Thread.Sleep(2000); RunMakro("/logout"); Thread.Sleep(21000);
                            }
                        }
                        backPoint = WoWPoint.Empty; moveBack = false;
                    }
                    #endregion

                    if (moveBack && backPoint == WoWPoint.Empty)
                    {
                        moveBack = false;
                    }
                    //Logging.WriteDebug(Name + " Achievement done or blacklist!");
                }
            }
        }
示例#16
0
        public void Execute()
        {
            if (WowInterface.CharacterManager.Equipment.Items.Any(e => e.Value.MaxDurability > 0 &&
                                                                  ((double)e.Value.Durability / (double)e.Value.MaxDurability * 100.0) <= Config.ItemRepairThreshold) &&
                WowInterface.Db.TryGetPointsOfInterest(WowInterface.ObjectManager.MapId, PoiType.Repair, WowInterface.Player.Position, 4096.0f, out IEnumerable <Vector3> repairNpcs))
            {
                GoToNpcAndRepair(repairNpcs);
                return;
            }

            if (GrindingSpot == null)
            {
                GrindingSpot = SelectNextGrindingSpot();
                return;
            }

            double distanceToSpot = GrindingSpot.Position.GetDistance(WowInterface.Player.Position);

            IEnumerable <WowUnit> nearUnits = WowInterface.ObjectManager.GetNearEnemies <WowUnit>(GrindingSpot.Position, GrindingSpot.Radius)
                                              .Where(e => e.Level >= GrindingSpot.MinLevel &&
                                                     e.Level <= GrindingSpot.MaxLevel &&
                                                     !Blacklist.Contains(e.Guid) &&
                                                     e.Position.GetDistance(GrindingSpot.Position) < GrindingSpot.Radius)
                                              .OrderBy(e => e.Position.GetDistance2D(WowInterface.Player.Position));

            if (WowInterface.Player.IsInCombat && WowInterface.Player.IsMounted)
            {
                WowInterface.HookManager.LuaDismissCompanion();
            }

            if (distanceToSpot < GrindingSpot.Radius)
            {
                if (nearUnits != null && nearUnits.Any())
                {
                    LookingForEnemiesSince = default;
                    WowUnit nearestUnit = nearUnits.FirstOrDefault(e => e.Guid == TargetGuid);

                    bool switchedTarget = false;

                    if (nearestUnit == null)
                    {
                        TargetGuid     = nearUnits.First().Guid;
                        nearestUnit    = nearUnits.FirstOrDefault(e => e.Guid == TargetGuid);
                        switchedTarget = true;
                    }

                    if (TargetInLosEvent.Run() || switchedTarget)
                    {
                        TargetInLos = WowInterface.HookManager.WowIsInLineOfSight(WowInterface.Player.Position, nearestUnit.Position);
                    }

                    if (nearestUnit.Position.GetDistance(WowInterface.Player.Position) < 20.0f && TargetInLos)
                    {
                        WowInterface.HookManager.WowTargetGuid(nearestUnit.Guid);
                        WowInterface.Globals.ForceCombat = true;
                    }
                    else
                    {
                        if (!WowInterface.MovementEngine.SetMovementAction(MovementAction.Move, nearestUnit.Position))
                        {
                            ++BlacklistCounter;

                            if (BlacklistCounter > 2)
                            {
                                WowInterface.MovementEngine.StopMovement();
                                Blacklist.Add(nearestUnit.Guid);
                                BlacklistCounter = 0;
                            }
                        }
                    }
                }
                else
                {
                    if (DateTime.UtcNow - LookingForEnemiesSince > TimeSpan.FromSeconds(30))
                    {
                        GrindingSpot   = SelectNextGrindingSpot();
                        TargetPosition = default;
                        return;
                    }
                    else if (!WowInterface.MovementEngine.Path.Any() || WowInterface.Player.Position.GetDistance(TargetPosition) < 3.0f)
                    {
                        MoveToRandomPositionOnSpot();
                    }
                }
            }
            else
            {
                if (WowInterface.ObjectManager.Partymembers.Any(e => e.IsDead || e.Position.GetDistance(WowInterface.Player.Position) > 30.0f))
                {
                    WowInterface.MovementEngine.StopMovement();
                    return;
                }

                if (!WowInterface.MovementEngine.Path.Any() || WowInterface.Player.Position.GetDistance(TargetPosition) < 3.0f)
                {
                    MoveToRandomPositionOnSpot();
                }
            }
        }
示例#17
0
        /// <summary>
        /// Function to Find and Kill Dormus
        /// </summary>
        public void findAndKillDormus()
        {
            bool CastSuccess = false;
            //Testcases --> 51756 = Blutelfenjunge --> 52008 = Resortangestellter --> 50245 = Dormus
            int IDDormus = 50245;
            //Testcases --> 6346 = Fear Ward --> 974 = Earthsschild --> Dormus' Rage = 93269
            int IDDormusAura = 93269;

            ObjectManager.Update();
            WoWUnit Dormus = ObjectManager.GetObjectsOfType <WoWUnit>().Where(u => u.Entry == IDDormus).OrderBy(u => u.Distance).FirstOrDefault();

            #region Move to Dormus Helperpoint
            while (Me.HasAura(IDDormusAura) && Dormus == null && !Me.Combat && Me.Location.Distance(DormusPoint) > 5 && Me.Location.Distance(DormusPoint) < 500)
            {
                WoWMovement.ClickToMove(DormusPoint);
                Logging.Write(Colors.MediumPurple, "Rarekiller: Dormus not in sight, Swim to Dormus Helper Point");
                Thread.Sleep(500);

                ObjectManager.Update();
                Dormus = ObjectManager.GetObjectsOfType <WoWUnit>().Where(u => u.Entry == IDDormus).OrderBy(u => u.Distance).FirstOrDefault();
            }
            #endregion

            if (Dormus != null)
            {
                if (!Dormus.IsDead)
                {
                    Logging.WriteQuiet(Colors.MediumPurple, "Rarekiller: Find {0}", Dormus.Name);

                    if (Rarekiller.Settings.Alert)
                    {
                        Rarekiller.Alert();
                    }

                    Dormus.Target();

                    #region Move to Dormus
                    // ------------- Move to Dormus with Klick to Move -------------------

                    while (DormusPoint.Distance(Me.Location) > 5 && Me.HasAura(IDDormusAura) && !Dormus.IsDead && !Rarekiller.Settings.ReachedDormusHelperpoint)
                    {
                        WoWMovement.ClickToMove(DormusPoint);
                        Thread.Sleep(100);
                        Logging.Write(Colors.MediumPurple, "Rarekiller: Move out of Water to Helperpoint");
                        if (Rarekiller.ToonInvalidCombat)
                        {
                            return;
                        }
                    }
                    Logging.Write(Colors.MediumPurple, "Rarekiller: Reached Dormus Helperpoint");
                    Rarekiller.Settings.ReachedDormusHelperpoint = true;

                    while (Dormus.Location.Distance(Me.Location) > 3 && Me.HasAura(IDDormusAura) && !Dormus.IsDead)
                    {
                        if (Navigator.CanNavigateFully(Me.Location, Dormus.Location))
                        {
                            Navigator.MoveTo(Dormus.Location);
                        }
                        else
                        {
                            Logging.Write(Colors.MediumPurple, "Rarekiller: Navigation Issue, use Click to Move");
                            WoWMovement.ClickToMove(Dormus.Location);
                        }
                        Thread.Sleep(100);
                        Logging.Write(Colors.MediumPurple, "Rarekiller: Move to Dormus");
                        if (Rarekiller.ToonInvalidCombat)
                        {
                            return;
                        }
                    }
                    WoWMovement.MoveStop();
                    #endregion

                    #region Pull Dormus
                    // ------------- pull Dormus  -------------------
                    Logging.Write(Colors.MediumPurple, "Rarekiller: Distance: {0}", Dormus.Location.Distance(Me.Location));
                    Dormus.Target();
                    Dormus.Face();
                    Thread.Sleep(100);


                    if (!(Rarekiller.Settings.DefaultPull) && SpellManager.HasSpell(Rarekiller.Settings.Pull))
                    {
                        CastSuccess = RarekillerSpells.CastSafe(Rarekiller.Settings.Pull, Dormus, false);
                    }
                    //CastSuccess = SpellManager.Cast(Rarekiller.Settings.Pull, Dormus);
                    else if (SpellManager.HasSpell(Rarekiller.Spells.FastPullspell))
                    {
                        CastSuccess = RarekillerSpells.CastSafe(Rarekiller.Spells.FastPullspell, Dormus, false);
                    }
                    //CastSuccess = SpellManager.Cast(Rarekiller.Spells.FastPullspell, Dormus);
                    else
                    {
                        Logging.Write(Colors.MediumPurple, "Rarekiller: I have no Pullspell");
                    }
                    if (!CastSuccess && SpellManager.HasSpell("Shoot"))
                    {
                        CastSuccess = RarekillerSpells.CastSafe("Shoot", Dormus, true);
                    }
                    //CastSuccess = SpellManager.Cast("Shoot", Dormus);
                    if (CastSuccess)
                    {
                        Logging.Write(Colors.MediumPurple, "Rarekiller: successfully pulled Dormus");
                        Logging.WriteDiagnostic(Colors.MediumPurple, "Rarekiller: Pull Distance: {0}", Dormus.Location.Distance(Me.Location));
                        return;
                    }
                    else if (!CastSuccess && Me.Combat)
                    {
                        Logging.Write(Colors.MediumPurple, "Rarekiller: got Aggro");
                    }
                    else
                    {
                        Logging.Write(Colors.MediumPurple, "Rarekiller: Pull Fails --> next try");
                    }
                    #endregion
                }
                else if (!Blacklist.Contains(Dormus.Guid, Rarekiller.Settings.Flags))
                {
                    if (Dormus.CanLoot)
                    {
                        if (!Rarekiller.Loothelper(Dormus))
                        {
                            return;
                        }
                    }

                    if (!Blacklist.Contains(Dormus.Guid, Rarekiller.Settings.Flags))
                    {
                        Logging.Write(Colors.MediumPurple, "Rarekiller: Find {0}, but sadly he's dead", Dormus.Name);
                        Blacklist.Add(Dormus.Guid, Rarekiller.Settings.Flags, TimeSpan.FromSeconds(Rarekiller.Settings.Blacklist60));
                        Logging.Write(Colors.MediumPurple, "Rarekiller: Blacklist Unit for 60 Minutes.");
                    }
                }
            }
        }
示例#18
0
        //{
        //    get
        //    {
        //        var badGuys = (CombatTargeting.Instance.Provider as DDCombatTargetingProvider)?.GetObjectsByWeight();

        //        var anyBadGuysAround = badGuys != null && badGuys.Any();

        //        //if (Beta.Target != null && Beta.Target.IsValid && !Blacklist.Contains(Beta.Target.ObjectId, (BlacklistFlags)DeepDungeonManager.Level) && Beta.Target.Type != GameObjectType.GatheringPoint)
        //        //    return null;

        //        // Party member is dead
        //        if (PartyManager.AllMembers.Any(member => member.CurrentHealth == 0))
        //        {
        //            // Select Cairn of Return as highest priority if it is known and can be used.
        //            if (CairnOfReturn != null && DeepDungeonManager.ReturnActive)
        //                return CairnOfReturn;

        //            // If the Cairn of Return is not yet active and there are any mobs around: Kill the mobs.
        //            if (anyBadGuysAround)
        //                return new Poi(badGuys.First(), PoiType.Kill);
        //        }

        //        // Cairn of Passage
        //        if (LevelComplete && Portal != null)
        //            return Portal;

        //        // Bosses or Pomander of Rage / Pomander of Lust
        //        if ((DeepDungeonManager.BossFloor || Core.Me.HasAura(Auras.Lust)) && anyBadGuysAround)
        //            return new Poi(badGuys.First(), PoiType.Kill);

        //        // Chests
        //        if (LastEntities != null && LastEntities.Any())
        //            return LastEntities.First();

        //        // Kill something
        //        if (anyBadGuysAround)
        //            return new Poi(badGuys.First(), PoiType.Kill);

        //        return new Poi(
        //            SafeSpots.OrderByDescending(i => i.Distance2D(Core.Me.Location)).First(),
        //            PoiType.Hotspot
        //        );


        //    }
        //}

        internal void AddToBlackList(GameObject obj, string reason)
        {
            Blacklist.Add(obj, (BlacklistFlags)_floor, TimeSpan.FromMinutes(3), reason);
            Poi.Clear(reason);
        }
 internal void AddToBlackList(GameObject obj, TimeSpan time, string reason)
 {
     Blacklist.Add(obj, (BlacklistFlags)_floor, time, reason);
     Poi.Clear(reason);
 }
示例#20
0
        public override void Pulse()
        {
            try
            {
                while (IsGameStable() && Styx.Logic.BehaviorTree.TreeRoot.IsRunning && Battlegrounds.IsInsideBattleground)
                {
                    if (Me.CurrentHealth <= 1 || Me.Combat || Me.IsCasting || Battlegrounds.Finished)
                    {
                        return;
                    }

                    if (!haveInitialized)
                    {
                        Initialize();
                    }

                    if (Battlegrounds.Current == BattlegroundType.IoC || Battlegrounds.Current == BattlegroundType.SotA)
                    {
                        slog("battleground '{0}' not supported, running profile only", Battlegrounds.Current.ToString());
                        return;
                    }

                    // during prep period of bg let bot handle buffs, timing, etc
                    if (Me.Auras.ContainsKey("Preparation"))
                    {
                        while (IsGameStable() && Me.CurrentHealth > 1 && RoutineManager.Current.NeedPullBuffs)
                        {
                            slog("Applying Pull Buffs");
                            RoutineManager.Current.PullBuff();
                            StyxWoW.SleepForLagDuration();
                        }

                        while (IsGameStable() && Me.CurrentHealth > 1 && RoutineManager.Current.NeedPreCombatBuffs)
                        {
                            slog("Applying Pre-Combat Buffs");
                            RoutineManager.Current.PreCombatBuff();
                            StyxWoW.SleepForLagDuration();
                        }

                        return;
                    }

                    // battleground is running, so validate our leader
                    if (leader != null)
                    {
                        if (!ObjectManager.ObjectList.Contains(leader) || !leader.IsValid)
                        {
                            slog("leader is no longer in group");
                            leader = null;
                        }
                        else if (leader.CurrentHealth <= 1)
                        {
                            slog("leader died");
                            leader = null;
                        }
                        else if (leader.OnTaxi)
                        {
                            slog("leader is hitching a ride");
                            leader = null;
                        }
                        else if (leader.IsStealthed)
                        {
                            slog("leader is stealthed");
                            leader = null;
                        }
                        else if (leader.Distance > (SquireSettings.Instance.LeaderScanRange + SquireSettings.Instance.LeaderOutOfRange))
                        {
                            slog("leader out of range at {0:F1} yds", leader.Distance);
                            leader = null;
                        }
                    }

                    // no leader? then find one
                    if (leader == null)
                    {
                        if (lastLeadCheck.IsRunning && lastLeadCheck.ElapsedMilliseconds < 2000)
                        {
                            return;
                        }

                        lastLeadCheck.Reset();
                        lastLeadCheck.Start();

                        leader = FindLeader();
                        SetFocus(leader);       // null clears focus
                        if (leader == null)
                        {
                            slog(">>> no leader found, running profile till we find one...");
                            return;
                        }

                        lastLeadMovement = System.Environment.TickCount + (SquireSettings.Instance.StillTimeout * 1000);
                    }

                    // update movement timeout if they are doing something
                    if (leader.IsMoving || leader.IsCasting)
                    {
                        lastLeadMovement = System.Environment.TickCount + (SquireSettings.Instance.StillTimeout * 1000);
                    }

                    // TODO:  check if near an objective, since its okay to wait there in a group
                    // if they havent done anything, bail on the current leader
                    if (lastLeadMovement < System.Environment.TickCount)
                    {
                        slog("leader still for {0} seconds, blacklisting for {1} seconds", SquireSettings.Instance.StillTimeout, SquireSettings.Instance.BlacklistTime);
                        Blacklist.Add(leader, TimeSpan.FromSeconds(SquireSettings.Instance.BlacklistTime));
                        leader = null;
                        continue;
                    }

                    if ((leader.Mounted || leader.Distance > 50) && Me.IsOutdoors && !Me.Mounted && Mount.CanMount())
                    {
                        WaitForMount();
                    }

                    WoWUnit target = null;

                    if (!IsUnitInRange(leader, Me.IsIndoors ? 10 : followDistance))
                    {
                        // slog("leader out of range, moving towards now...");
                        if (movePointDelay.ElapsedMilliseconds > SquireSettings.Instance.MoveDelayMS || (!Me.IsMoving && leader.IsMoving))
                        {
                            movePointDelay.Reset();
                            movePointDelay.Start();
                            if (!MoveToUnit(leader, 5))
                            {
                                slog("Unable to move to leader {0}, resetting...", Safe_UnitName(leader));
                                Blacklist.Add(leader, TimeSpan.FromSeconds(10));
                                leader = null;
                            }
                        }

                        if (!Me.Mounted)
                        {
                            target = FindTarget();
                        }

                        if (target == null)
                        {
                            continue;   // moving now, so just loop and check again in awhile
                        }
                    }

                    if (!leader.Mounted && Me.Mounted)
                    {
                        slog("leader not mounted, dismounting...");
                        WaitForDismount();
                    }


                    if (!leader.Combat && !leader.IsMoving && Me.IsMoving)
                    {
                        slog("leader not moving, stopping...");
                        WaitForStop();
                    }

                    CallPulse();
                    CallRest();
                    CallHeal();
                    // if (GetActualStrategy() == SquireSettings.CombatStrategy.DPS)
                    {
                        // if (!Me.Combat && leader.Combat)
                        {
                            // have a target? Then PULLL!!!!!!!!
                            if (target != null)
                            {
                                CallPull(target);
                            }
                        }
                    }
                }
            }
            catch (InvalidOperationException)
            {
                slog("Leader is no longer valid, resetting...");
                leader = null;
            }
            catch (Exception e)
            {
                slog("An Exception occured. Check debug log for details.");
                Logging.WriteDebug(">>> EXCEPTION");
                Logging.WriteException(e);
            }

            // at this point, they either stopped the bot or we are in Combat

            // now fall through and let default behavior take place
        }
        public void MountAeonaxx()
        {
            int  loothelper  = 0;
            bool CastSuccess = false;

            if (Rarekiller.Settings.DeveloperLogs)
            {
                Logging.WriteDebug("Rarekiller: Scan for Aeonaxx to Mount");
            }
            ObjectManager.Update();
            List <WoWUnit> objList = ObjectManager.GetObjectsOfType <WoWUnit>()
                                     .Where(o => ((o.Entry == 50062) || // Aeonaxx friendly
                                                  ((o.Entry == 42288) && Rarekiller.Settings.TestMountAeonaxx) //Testcase Robby Flay
                                                  ))
                                     .OrderBy(o => o.Distance).ToList();

            foreach (WoWUnit o in objList)
            {
                if (Rarekiller.Settings.WispersForBuddyCenter)
                {
                    Lua.DoString(string.Format("RunMacroText(\"/w {0} found {1}, ID {2}\")", Me.Name, o.Name, o.Entry), 0);
                }

                if (!o.Dead && !Blacklist.Contains(o.Guid))
                {
                    Logging.Write(System.Drawing.Color.MediumPurple, "Rarekiller: Find a hunted Mob called {0} ID {1}", o.Name, o.Entry);
                    if (Rarekiller.Settings.GroundMountMode)
                    {
                        Logging.Write("Rarekiller Part Aeonaxx: Can't hunt {0} in Ground Mount Mode.", o.Name);
                        Blacklist.Add(o.Guid, TimeSpan.FromSeconds(Rarekiller.Settings.Blacklist5));
                        Logging.Write(System.Drawing.Color.DarkOrange, "Rarekiller Part Aeonaxx: Blacklist Mob for 5 Minutes.");
                        return;
                    }
                    if (Rarekiller.inCombat)
                    {
                        Logging.Write("Rarekiller Part Aeonaxx: ... but I'm in another Combat, Dead or Ghost :( !!!");
                        return;
                    }
                    if (Me.IsOnTransport)
                    {
                        Logging.Write("Rarekiller Part Aeonaxx: ... but I'm on a Transport. So I already mounted him");
                        Blacklist.Add(o.Guid, TimeSpan.FromSeconds(Rarekiller.Settings.Blacklist15));
                        Logging.Write(System.Drawing.Color.DarkOrange, "Rarekiller Part Aeonaxx: Blacklist Mob for 15 Minutes.");
                        return;
                    }
                    while (Me.IsCasting)
                    {
                        Thread.Sleep(100);
                    }

                    if (Rarekiller.Settings.Alert)
                    {
                        if (File.Exists(Rarekiller.Soundfile))
                        {
                            new SoundPlayer(Rarekiller.Soundfile).Play();
                        }
                        else
                        {
                            Logging.Write(System.Drawing.Color.Red, "Rarekiller Part Aeonaxx: playing Soundfile failes");
                        }
                    }

// ------------------ Move to Aeonaxx ----------------
                    o.Target();
                    o.Face();
                    Logging.Write("Rarekiller Part MoveTo: Fly to Target");
                    while (o.Location.Distance(Me.Location) > 3)
                    {
                        Flightor.MoveTo(o.Location);
                        Thread.Sleep(100);
                    }
                    Logging.WriteDebug("Rarekiller Part Aeonaxx: {0} Location: {1} / {2} / {3}", o.Name, Convert.ToString(o.X), Convert.ToString(o.Y), Convert.ToString(o.Z));
                    Logging.WriteDebug("Rarekiller Part Aeonaxx: My Location: {0} / {1} / {2}", Convert.ToString(Me.X), Convert.ToString(Me.Y), Convert.ToString(Me.Z));

// ------------------ Mount Aeonaxx -----------------
                    o.Interact();
                    Thread.Sleep(2000);
                    Logging.Write("Rarekiller Part Aeonaxx: Interact with {0}", o.Name);
                    if (Rarekiller.Settings.WispersForBuddyCenter)
                    {
                        Lua.DoString(string.Format("RunMacroText(\"/w {0} mounted Dragon {1}, ID {2}\")", Me.Name, o.Name, o.Entry), 0);
                    }
// ------------------ Monitor whos also there -----------------
                    Logging.WriteDebug("Rarekiller Part Aeonaxx: Dragon Location: {0} / {1} / {2}", Convert.ToString(o.X), Convert.ToString(o.Y), Convert.ToString(o.Z));
                    Logging.WriteDebug("Rarekiller Part Aeonaxx: My Location: {0} / {1} / {2}", Convert.ToString(Me.X), Convert.ToString(Me.Y), Convert.ToString(Me.Z));
                    ObjectManager.Update();
                    foreach (WoWPlayer player in ObjectManager.GetObjectsOfType <WoWPlayer>())
                    {
                        Logging.Write("Rarekiller Part Aeonaxx: {0} was also here", player.Name);
                        Logging.WriteDebug("Rarekiller Part Aeonaxx: Player Location: {0} / {1} / {2}", Convert.ToString(player.X), Convert.ToString(player.Y), Convert.ToString(player.Z));
                    }

                    if (Rarekiller.Settings.ScreenAeonaxx)
                    {
                        Lua.DoString("TakeScreenshot()");
                        Thread.Sleep(300);
                        Logging.WriteDebug("Rarekiller Part Aeonaxx: Take Screenshot after Mount up");
                    }

                    if (RoutineManager.Current.NeedRest)
                    {
                        Logging.Write("Rarekiller Part Aeonaxx: CC says we need rest - Letting it do it before Fight.");
                        RoutineManager.Current.Rest();
                    }
                }
                else if (o.Dead)
                {
                    if (o.CanLoot)
                    {
// ----------------- Loot Helper for all killed Rare Mobs ---------------------
                        Logging.Write("Rarekiller Part Aeonaxx: Found lootable corpse, move to him");

// ----------------- Move to Corpse -------------------
                        Logging.Write("Rarekiller Part MoveTo: Fly to Target");
                        while (o.Location.Distance(Me.Location) > 5)
                        {
                            Flightor.MoveTo(o.Location);
                            Thread.Sleep(100);
                            if (Rarekiller.inCombat)
                            {
                                return;
                            }
                        }
                        WoWMovement.MoveStop();

                        if (Me.Auras.ContainsKey("Flight Form"))
                        {
                            Lua.DoString("CancelShapeshiftForm()");
                        }
                        else if (Me.Mounted)
                        {
                            Lua.DoString("Dismount()");
                        }

// ----------------- Loot Corpse -------------------
                        if (Rarekiller.Settings.ScreenAeonaxx)
                        {
                            Lua.DoString("TakeScreenshot()");
                            Thread.Sleep(500);
                            Logging.WriteDebug("Rarekiller Part Aeonaxx: Take Screenshot successfully killed Aeonaxx");
                        }
                        while (loothelper < 3)
                        {
                            Thread.Sleep(500);
                            WoWMovement.MoveStop();
                            o.Interact();
                            Thread.Sleep(2000);
                            Lua.DoString("RunMacroText(\"/click StaticPopup1Button1\");");
                            Thread.Sleep(4000);
                            if (!o.CanLoot)
                            {
                                Logging.Write("Rarekiller Part Aeonaxx: successfully looted");
                                Blacklist.Add(o.Guid, TimeSpan.FromSeconds(Rarekiller.Settings.Blacklist60));
                                Logging.Write(System.Drawing.Color.DarkOrange, "Rarekiller Part Aeonaxx: Blacklist Mob for 60 Minutes.");
                                return;
                            }
                            else
                            {
                                Logging.Write("Rarekiller Part Aeonaxx: Loot failed, try again");
                                loothelper = loothelper + 1;
                            }
                        }
                        Logging.Write("Rarekiller Part Aeonaxx: Loot failed 3 Times");
                    }
                    if (!Blacklist.Contains(o.Guid))
                    {
                        Logging.Write("Rarekiller Part Aeonaxx: Find {0}, but sadly he's dead", o.Name);
                        Blacklist.Add(o.Guid, TimeSpan.FromSeconds(Rarekiller.Settings.Blacklist60));
                        Logging.Write(System.Drawing.Color.DarkOrange, "Rarekiller Part Aeonaxx: Blacklist Mob for 60 Minutes.");
                    }
                }
            }
        }
            /// <summary>
            /// Handles Using an Item on a GameObject.
            /// </summary>
            /// <param name="item">The Id of the Item you want to use.</param>
            /// <param name="obj">The GameObject.</param>
            /// <param name="blackList">Should you Blacklist the object after use?</param>
            /// <param name="duration">How long do you want the Blacklist to last.</param>
            /// <returns></returns>
            public static async Task <bool> UseItem(int item, GameObject obj, bool blackList = false, int duration = 180, bool inCombat = false, int healthPercent = 40, int[] hasAnyAura = null)
            {
                var slot = InventoryManager.FilledSlots.FirstOrDefault(s => s.RawItemId == item);

                if (slot == null)
                {
                    return(false);
                }

                var count = slot.Count;

                while (true)
                {
                    if (Dialog.IsTalking)
                    {
                        await Dialog.Skip();
                        await Sleep(500);

                        continue;
                    }

                    if (inCombat && hasAnyAura != null && Helpers.HasAnyAura((obj as BattleCharacter), hasAnyAura))
                    {
                        return(false);
                    }

                    if (inCombat && Core.Me.CurrentTarget.CurrentHealthPercent > healthPercent)
                    {
                        return(false);
                    }

                    if (!inCombat && Core.Me.InCombat)
                    {
                        return(false);
                    }

                    if (!Exists(obj.Location, (int)obj.NpcId) || !obj.IsTargetable || !obj.IsValid || !slot.CanUse(obj))
                    {
                        break;
                    }
                    if (slot.Count < count)
                    {
                        break;
                    }

                    if (Core.Me.CurrentTarget != obj)
                    {
                        obj.Target();
                        await Sleep(300);

                        continue;
                    }

                    if (slot.Item.IsGroundTargeting)
                    {
                        slot.UseItem(Core.Me.CurrentTarget.Location);
                    }
                    else
                    {
                        slot.UseItem(Core.Me.CurrentTarget);
                    }
                    await Sleep(800);

                    await Coroutine.Wait(10000, () => !Core.Me.IsCasting);

                    if (!Core.Me.InCombat)
                    {
                        await Sleep(800);
                    }

                    if (blackList)
                    {
                        Blacklist.Add(obj.ObjectId, BlacklistFlags.SpecialHunt, TimeSpan.FromSeconds(duration), "BlacklistAfter");
                    }
                }

                return(true);
            }
示例#23
0
        private async Task <bool> FindNode(bool retryCenterHotspot = true)
        {
            if (Node != null)
            {
                return(false);
            }

            StatusText = Localization.ExGather_SearchForNodes;

            while (Behaviors.ShouldContinue)
            {
                IEnumerable <GatheringPointObject> nodes =
                    GameObjectManager.GetObjectsOfType <GatheringPointObject>().Where(gpo => gpo.CanGather).ToArray();

                if (GatherStrategy == GatherStrategy.TouchAndGo && HotSpots != null)
                {
                    if (GatherObjects != null)
                    {
                        nodes = nodes.Where(gpo => GatherObjects.Contains(gpo.EnglishName, StringComparer.InvariantCultureIgnoreCase));
                    }

                    foreach (var node in
                             nodes.Where(gpo => HotSpots.CurrentOrDefault.WithinHotSpot2D(gpo.Location))
                             .OrderBy(gpo => gpo.Location.Distance2D(ExProfileBehavior.Me.Location))
                             .Skip(1))
                    {
                        if (!Blacklist.Contains(node.ObjectId, BlacklistFlags.Interact))
                        {
                            Blacklist.Add(
                                node,
                                BlacklistFlags.Interact,
                                TimeSpan.FromSeconds(18),
                                Localization.ExGather_SkipFurthestNodes);
                        }
                    }
                }

                nodes = nodes.Where(gpo => !Blacklist.Contains(gpo.ObjectId, BlacklistFlags.Interact));

                if (FreeRange)
                {
                    nodes = nodes.Where(gpo => gpo.Distance2D(ExProfileBehavior.Me.Location) < Radius);
                }
                else
                {
                    if (HotSpots != null)
                    {
                        nodes = nodes.Where(gpo => HotSpots.CurrentOrDefault.WithinHotSpot2D(gpo.Location));
                    }
                }

                // ReSharper disable once ConvertIfStatementToConditionalTernaryExpression
                if (GatherObjects != null)
                {
                    Node =
                        nodes.OrderBy(
                            gpo =>
                            GatherObjects.FindIndex(i => string.Equals(gpo.EnglishName, i, StringComparison.InvariantCultureIgnoreCase)))
                        .ThenBy(gpo => gpo.Location.Distance2D(ExProfileBehavior.Me.Location))
                        .FirstOrDefault(gpo => GatherObjects.Contains(gpo.EnglishName, StringComparer.InvariantCultureIgnoreCase));
                }
                else
                {
                    Node = nodes.OrderBy(gpo => gpo.Location.Distance2D(ExProfileBehavior.Me.Location)).FirstOrDefault();
                }

                if (Node == null)
                {
                    if (HotSpots != null)
                    {
                        var myLocation = ExProfileBehavior.Me.Location;

                        var distanceToFurthestVisibleGameObject =
                            GameObjectManager.GameObjects.Select(o => o.Location.Distance2D(myLocation))
                            .OrderByDescending(o => o)
                            .FirstOrDefault();

                        var distanceToFurthestVectorInHotspot = myLocation.Distance2D(HotSpots.CurrentOrDefault)
                                                                + HotSpots.CurrentOrDefault.Radius;

                        if (myLocation.Distance2D(HotSpots.CurrentOrDefault) > Radius && GatherStrategy == GatherStrategy.GatherOrCollect &&
                            retryCenterHotspot && distanceToFurthestVisibleGameObject <= distanceToFurthestVectorInHotspot)
                        {
                            Logger.Verbose(Localization.ExGather_DistanceObject + distanceToFurthestVisibleGameObject);
                            Logger.Verbose(Localization.ExGather_DistanceHotSpot + distanceToFurthestVectorInHotspot);

                            Logger.Warn(
                                Localization.ExGather_NoAvailableNode);
                            await HotSpots.CurrentOrDefault.XYZ.MoveTo(radius : Radius, name : HotSpots.CurrentOrDefault.Name);

                            retryCenterHotspot = false;
                            await Coroutine.Yield();

                            continue;
                        }

                        if (!await ChangeHotSpot())
                        {
                            retryCenterHotspot = false;
                            await Coroutine.Yield();

                            continue;
                        }
                    }

                    if (FreeRange && !FreeRangeConditional())
                    {
                        await Coroutine.Yield();

                        isDone = true;
                        return(true);
                    }

                    return(true);
                }

                var entry = Blacklist.GetEntry(Node.ObjectId);
                if (entry != null && entry.Flags.HasFlag(BlacklistFlags.Interact))
                {
                    Logger.Warn(Localization.ExGather_NodeBlacklist);

                    if (await
                        Coroutine.Wait(entry.Length,
                                       () => entry.IsFinished || Node.Location.Distance2D(ExProfileBehavior.Me.Location) > Radius) ||
                        Core.Player.IsDead)
                    {
                        if (!entry.IsFinished)
                        {
                            Node = null;
                            Logger.Info(Localization.ExGather_NodeReset);
                            return(false);
                        }
                    }

                    Logger.Info(Localization.ExGather_NodeBlacklistRemoved);
                }

                Logger.Info(Localization.ExGather_NodeSet + Node);

                if (HotSpots == null)
                {
                    MovementManager.SetFacing2D(Node.Location);
                }

                if (Poi.Current.Unit != Node)
                {
                    Poi.Current = new Poi(Node, PoiType.Gather);
                }

                return(true);
            }

            return(true);
        }
示例#24
0
        private static void HandleEvadeBuggedMob(LuaEventArgs args, CombatLogEventArgs e)
        {
            WoWUnit unit = e.DestUnit;
            ulong   guid = e.DestGuid;

            if (unit == null && StyxWoW.Me.CurrentTarget != null)
            {
                unit = StyxWoW.Me.CurrentTarget;
                guid = StyxWoW.Me.CurrentTargetGuid;
                Logging.Write("Evade: bugged mob guid:{0}, so assuming current target instead", args.Args[7]);
            }

            if (unit != null)
            {
                if (!MobsThatEvaded.ContainsKey(unit.Guid))
                {
                    MobsThatEvaded.Add(unit.Guid, 0);
                }

                MobsThatEvaded[unit.Guid]++;
                if (MobsThatEvaded[unit.Guid] <= 5)
                {
                    Logging.Write("Mob {0} has evaded {1} times.  Keeping an eye on {2:X0} for now!", unit.Name,
                                  MobsThatEvaded[unit.Guid], unit.Guid);
                }
                else
                {
                    const int secondsToBlacklist = 60;

                    if (Blacklist.Contains(unit.Guid, BlacklistFlags.Combat))
                    {
                        Logging.Write(Colors.LightGoldenrodYellow,
                                      "Mob {0} has evaded {1} times. Previously blacklisted {2:X0} for {3} seconds!",
                                      unit.Name, MobsThatEvaded[unit.Guid], unit.Guid, secondsToBlacklist);
                    }
                    else
                    {
                        Logging.Write(Colors.LightGoldenrodYellow,
                                      "Mob {0} has evaded {1} times. Blacklisting {2:X0} for {3} seconds!", unit.Name,
                                      MobsThatEvaded[unit.Guid], unit.Guid, secondsToBlacklist);
                        Blacklist.Add(unit.Guid, BlacklistFlags.Combat, TimeSpan.FromSeconds(secondsToBlacklist));
                        if (!Blacklist.Contains(unit.Guid, BlacklistFlags.Combat))
                        {
                            Logging.Write(Colors.Pink, "error: blacklist does not contain entry for {0} so adding {1}",
                                          unit.Name, unit.Guid);
                        }
                    }

                    if (BotPoi.Current.Guid == unit.Guid)
                    {
                        Logging.Write("EvadeHandling: Current BotPOI type={0} is Evading, clearing now...",
                                      BotPoi.Current.Type);
                        BotPoi.Clear("Singular recognized Evade bugged mob");
                    }

                    if (StyxWoW.Me.CurrentTargetGuid == guid)
                    {
                        foreach (var target in Targeting.Instance.TargetList)
                        {
                            if (target != null &&
                                target.IsValid &&
                                target.IsAlive &&
                                !Blacklist.Contains(target, BlacklistFlags.Combat))
                            {
                                Logging.Write(Colors.Pink, "Setting target to {0} to get off evade bugged mob!",
                                              target.Name);
                                target.Target();
                                return;
                            }
                        }

                        Logging.Write(Colors.Pink,
                                      "BotBase has 0 entries in Target list not blacklisted -- nothing else we can do at this point!");
                        // StyxWoW.Me.ClearTarget();
                    }
                }
            }

            /// line below was originally in Evade logic, but commenting to avoid Sleeps
            // StyxWoW.SleepForLagDuration();
        }
示例#25
0
        //Skinning//

        //Mining
        private void _HasMining()
        {
            if (!hasPick)
            {
                foreach (WoWItem _item in ObjectManager.GetObjectsOfType <WoWItem>(false))
                {
                    if (_item.BagSlot != -1)
                    {
                        if (_item.Entry.Equals(2901))
                        {
                            hasPick = true;
                        }
                        if (_item.Entry.Equals(40893))
                        {
                            hasPick = true;
                        }
                        if (_item.Entry.Equals(40892))
                        {
                            hasPick = true;
                        }
                        if (_item.Entry.Equals(40772))
                        {
                            hasPick = true;
                        }
                        if (_item.Entry.Equals(20723))
                        {
                            hasPick = true;
                        }
                        if (_item.Entry.Equals(1959))
                        {
                            hasPick = true;
                        }
                        if (_item.Entry.Equals(756))
                        {
                            hasPick = true;
                        }
                        if (_item.Entry.Equals(9465))
                        {
                            hasPick = true;
                        }
                    }
                }
                if (hasPick)
                {
                    Log("Character has a Pickaxe!", null, null);
                }
            }
            if (!hasPick && !informedPick)
            {
                Log("Character has no Pickaxe! Go get one!", null, null); informedPick = true;
            }
            if (hasPick)
            {
                var DeadMobs = (from o in ObjectManager.GetObjectsOfType <WoWUnit>(false, false)
                                where o.Distance < 15 && !o.IsAlive && !Blacklist.Contains(o.Guid)
                                orderby o.DistanceSqr ascending
                                select o);
                if (DeadMobs.Count() > 0 && !ExtensiveCombatCheck())
                {
                    foreach (WoWUnit _Mob in DeadMobs)
                    {
                        if (_Mob.SkinType == WoWCreatureSkinType.Rock && !_Mob.Lootable && !Me.Looting)
                        {
                            Log("Found Mine-Able: ", _Mob.Name, ".");
                            while (_Mob.Distance > 5 && !ExtensiveCombatCheck())
                            {
                                Navigator.MoveTo(_Mob.Location);
                            }
                            Navigator.PlayerMover.MoveStop();
                            Thread.Sleep(100); StyxWoW.SleepForLagDuration();
                            _Mob.Interact();
                            Thread.Sleep(500);
                            while (Me.IsCasting)
                            {
                                Thread.Sleep(100);
                            }
                            Thread.Sleep(250);
                            while (Styx.Logic.Inventory.Frames.LootFrame.LootFrame.Instance.IsVisible)
                            {
                                Thread.Sleep(250);
                            }
                            Log("Finished Mining.", null, null);
                            Blacklist.Add(_Mob.Guid, TimeSpan.FromMinutes(5));
                            JustInteracted.Start();
                        }
                    }
                    DeadMobs = null;
                    return;
                }
            }
        }
示例#26
0
 //degrees = radians * 180 / Math.PI
 public override void Pull()
 {
     try
     {
         //if (initialized == false)
         //{
         //    Initialize();
         //}
         bgTargetCheck();
         getAdds();
         slog("Starting Pull");
         if (!Me.Combat && Me.GotTarget)
         {
             slog("Safe location is saved");
             prevPrevSafePoint = prevSafePoint;
             prevSafePoint     = safePoint;
             safePoint         = Me.Location;
         }
         slog("PVP Checked");
         if (Blacklist.Contains(Me.CurrentTarget.Guid))
         {
             slog("Target is blacklisted");
             Styx.Logic.Blacklist.Add(Me.CurrentTarget.Guid, System.TimeSpan.FromSeconds(30));
             Me.ClearTarget();
             //pullGuid = 0;
         }
         if (Me.CurrentTarget.Guid != lastGuid)
         {
             slog("Pull starting. Target is new");
             pullTimer.Reset();
             pullTimer.Start();
             lastGuid = Me.CurrentTarget.Guid;
             if (Me.CurrentTarget.IsPlayer)
             {
                 slog("Pull: Killing Player at distance " + Math.Round(Me.CurrentTarget.Distance).ToString() + "");
             }
             slog("Pull: Killing " + Me.CurrentTarget.Name + " at distance " + Math.Round(Me.CurrentTarget.Distance).ToString() + "");
             pullTimer.Reset();
             pullTimer.Start();
         }
         if (!Me.CurrentTarget.IsPlayer && Me.CurrentTarget.CurrentHealth > 95 && 30 * 1000 < pullTimer.ElapsedMilliseconds)
         {
             slog(" This " + Me.CurrentTarget.Name + " is a bugged mob.  Blacklisting for 1 hour.");
             Blacklist.Add(Me.CurrentTarget.Guid, TimeSpan.FromHours(1.00));
             Me.ClearTarget();
             //pullGuid = 0;
             if (Me.Location.Distance(safePoint) >= 30)
             {
                 slog("Try to move to safePoint");
                 SafeMoveToPoint(safePoint, 10000);
             }
             else if (Me.Location.Distance(prevSafePoint) >= 30)
             {
                 slog("Try to move to prevSafePoint");
                 SafeMoveToPoint(prevSafePoint, 10000);
             }
             else if (Me.Location.Distance(prevPrevSafePoint) >= 30)
             {
                 slog("Try to move to prevPrevSafePoint");
                 SafeMoveToPoint(prevPrevSafePoint, 10000);
             }
             else
             {
                 slog("Can't move to locations");
             }
         }
         if (SSSettings.Instance.UseDistract && SpellManager.CanCast("Distract"))
         {
             if (Me.IsAlive && Me.GotTarget && !Me.Combat)
             {
                 if (Me.CurrentTarget.Distance > 4 && Me.CurrentTarget.Distance < 30)
                 {
                     Distract();
                 }
             }
         }
         if (!Me.Combat && targetDistance > 4 && targetDistance < Styx.Logic.Targeting.PullDistance + 10)
         {
             slog("Move to target");
             int   a         = 0;
             float pullRange = 3.5f + StyxWoW.Me.CurrentTarget.BoundingRadius;
             while (a < 50 && ObjectManager.Me.IsAlive && ObjectManager.Me.GotTarget && ObjectManager.Me.CurrentTarget.Distance > pullRange)
             {
                 if (ObjectManager.Me.Combat)
                 {
                     slog("Combat has started.  Abandon pull.");
                     break;
                 }
                 WoWMovement.Face();
                 Navigator.MoveTo(WoWMovement.CalculatePointFrom(ObjectManager.Me.CurrentTarget.Location, 3f /* + Me.CurrentTarget.BoundingRadius */));
                 StyxWoW.SleepForLagDuration();
                 ++a;
             }
         }
         else
         {
             WoWMovement.MoveStop();
             WoWMovement.Face();
         }
         if (Me.GotTarget &&
             targetDistance <= 5 &&
             !Me.IsAutoAttacking)
         {
             slog("Final state of pulling");
             if (attackPoint != WoWPoint.Empty)
             {
                 Navigator.MoveTo(attackPoint);
             }
             if (!PocketPicked)
             {
                 if (SSSettings.Instance.UsePickPocket && SpellManager.CanCast("Pick Pocket") && Me.GotTarget && targetDistance <= 5 && !Me.CurrentTarget.IsPlayer)
                 {
                     if (Me.CurrentTarget.CreatureType == WoWCreatureType.Humanoid || Me.CurrentTarget.CreatureType == WoWCreatureType.Undead)
                     {
                         slog("Try to pickpocket");
                         PickPocket();
                         Thread.Sleep(1000);
                         PocketPicked = true;
                     }
                 }
             }
             if (SSSettings.Instance.PullType.Equals(1))
             {
                 if (Me.GotTarget && targetDistance <= 5)
                 {
                     if (SpellManager.CanCast("Cheap Shot"))
                     {
                         CheapShot();
                     }
                     else
                     {
                         Lua.DoString("StartAttack()");
                     }
                 }
             }
             if (SSSettings.Instance.PullType.Equals(2))
             {
                 if (SpellManager.CanCast("Ambush") && Me.GotTarget && targetDistance <= 5)
                 {
                     Ambush();
                 }
                 else if (SpellManager.CanCast("Backstab") && Me.GotTarget && targetDistance <= 5)
                 {
                     Backstab();
                 }
                 else
                 {
                     Lua.DoString("StartAttack()");
                 }
             }
             if (SSSettings.Instance.PullType.Equals(3))
             {
                 if (Me.GotTarget && targetDistance <= 5)
                 {
                     if (SpellManager.CanCast("Garrote"))
                     {
                         Garrote();
                     }
                     else
                     {
                         Lua.DoString("StartAttack()");
                     }
                 }
             }
             if (SSSettings.Instance.PullType.Equals(4))
             {
                 Lua.DoString("StartAttack()");
             }
             if (SSSettings.Instance.PullType.Equals(5))
             {
                 Throw();
                 Lua.DoString("StartAttack()");
             }
         }
     }
     finally
     {
         slog("Pull done.");
         PocketPicked = false;
         fightTimer.Reset();
         fightTimer.Start();
     }
 }
示例#27
0
        /// <summary>
        ///     Handles opening treasure coffers or opening an exit portal
        /// </summary>
        /// <returns></returns>
        internal async Task <bool> TreasureOrExit()
        {
            var tries = 0;
            var npcid = Target.Unit.NpcId;

            if (Target.Location.Distance2D(Core.Me.Location) >= 3)
            {
                await CommonTasks.MoveAndStop(new MoveToParameters(Target.Location, Target.Name), 2.5f, true);

                return(true);
            }

            while (!DeepDungeon2.StopPlz && tries < 3 && Target.Unit.IsValid)
            {
                //if we are a frog / lust we can't open a chest
                if (Core.Me.HasAura(Auras.Toad) || Core.Me.HasAura(Auras.Frog) || Core.Me.HasAura(Auras.Toad2) ||
                    Core.Me.HasAura(Auras.Lust))
                {
                    Logger.Warn("Unable to open chest. Waiting for aura to end...");
                    await CommonTasks.StopMoving("Waiting on aura to end");

                    await Coroutine.Wait(TimeSpan.FromSeconds(30),
                                         () => !(Core.Me.HasAura(Auras.Toad) || Core.Me.HasAura(Auras.Frog) ||
                                                 Core.Me.HasAura(Auras.Toad2) || Core.Me.HasAura(Auras.Lust)) ||
                                         Core.Me.InCombat || DeepDungeon2.StopPlz);

                    return(true);
                }

                await Coroutine.Yield();

                if (Core.Me.HasAura(Auras.Lust))
                {
                    await Tasks.Coroutines.Common.CancelAura(Auras.Lust);
                }
                Logger.Verbose("Attempting to interact with: {0} ({1} / 3)", Target.Name, tries + 1);
                if (!PartyManager.IsInParty || PartyManager.IsPartyLeader ||
                    PartyManager.IsInParty && Constants.IsExitObject(Target.Unit))
                {
                    await CommonTasks.StopMoving("Interacting with chest");

                    if (!await ScriptHelpers.ObjectInteraction(Target.Unit))
                    {
                        break;
                    }

                    //Target.Unit.Interact();
                }
                else
                {
                    await CommonTasks.StopMoving("Waiting for leader to use chest");
                }

                await Coroutine.Sleep(700);

                tries++;

                if (!Target.Unit.IsValid)
                {
                    break;
                }

                if (!Target.Unit.IsTargetable)
                {
                    break;
                }

                if (SelectYesno.IsOpen)
                {
                    break;
                }
            }

            await Coroutine.Wait(700, () => SelectYesno.IsOpen);

            //if this is an exit
            if (SelectYesno.IsOpen)
            {
                SelectYesno.ClickYes();
                await Coroutine.Wait(TimeSpan.MaxValue,
                                     () => DeepDungeon2.StopPlz || QuestLogManager.InCutscene || NowLoading.IsVisible);

                return(true);
            }

            Blacklist.Add(Target.Unit.ObjectId, TimeSpan.FromMinutes(1),
                          $"Tried to Interact with the Target {tries+1} times");
            Poi.Clear($"Tried to Interact with the Target {tries+1} times");

            return(false);
        }
示例#28
0
        // Thanks to Singular Devs for the CombatLogEventArgs class and SpellImmunityManager.
        private static void HandleCombatLog(object sender, LuaEventArgs args)
        {
            var e = new CombatLogEventArgs(args.EventName, args.FireTimeStamp, args.Args);

            //var missType = Convert.ToString(e.Args[14]);

            switch (e.Event)
            {
            case "SWING_MISSED":
                if (e.Args[11].ToString() == "EVADE")
                {
                    CLULogger.TroubleshootLog("Mob is evading swing. Blacklisting it!");
                    Blacklist.Add(e.DestGuid, TimeSpan.FromMinutes(30));
                    if (StyxWoW.Me.CurrentTargetGuid == e.DestGuid)
                    {
                        StyxWoW.Me.ClearTarget();
                    }

                    BotPoi.Clear("Blacklisting evading mob");
                    StyxWoW.SleepForLagDuration();
                }
                else if (e.Args[11].ToString() == "IMMUNE")
                {
                    WoWUnit unit = e.DestUnit;
                    if (unit != null && !unit.IsPlayer)
                    {
                        CLULogger.TroubleshootLog("{0} is immune to {1} spell school", unit.Name, e.SpellSchool);
                        SpellImmunityManager.Add(unit.Entry, e.SpellSchool);
                    }
                }
                break;

            case "SPELL_MISSED":
            case "RANGE_MISSED":
                if (e.Args[14].ToString() == "EVADE")
                {
                    CLULogger.TroubleshootLog("Mob is evading ranged attack. Blacklisting it!");
                    Blacklist.Add(e.DestGuid, TimeSpan.FromMinutes(30));
                    if (StyxWoW.Me.CurrentTargetGuid == e.DestGuid)
                    {
                        StyxWoW.Me.ClearTarget();
                    }

                    BotPoi.Clear("Blacklisting evading mob");
                    StyxWoW.SleepForLagDuration();
                }
                else if (e.Args[14].ToString() == "IMMUNE")
                {
                    WoWUnit unit = e.DestUnit;
                    if (unit != null && !unit.IsPlayer)
                    {
                        CLULogger.TroubleshootLog("{0} is immune to {1} spell school", unit.Name, e.SpellSchool);
                        SpellImmunityManager.Add(unit.Entry, e.SpellSchool);
                    }
                }
                break;

            case "SPELL_AURA_REFRESH":
                if (e.SourceGuid == StyxWoW.Me.Guid)
                {
                    if (e.SpellId == 1822)
                    {
                        Classes.Druid.Common.RakeMultiplier = 1;

                        //TF
                        if (StyxWoW.Me.HasAura(5217))
                        {
                            Classes.Druid.Common.RakeMultiplier = Classes.Druid.Common.RakeMultiplier * 1.15;
                        }

                        //Savage Roar
                        if (StyxWoW.Me.HasAura(127538))
                        {
                            Classes.Druid.Common.RakeMultiplier = Classes.Druid.Common.RakeMultiplier * 1.3;
                        }

                        //Doc
                        if (StyxWoW.Me.HasAura(108373))
                        {
                            Classes.Druid.Common.RakeMultiplier = Classes.Druid.Common.RakeMultiplier * 1.25;
                        }
                    }
                    if (e.SpellId == 1079)
                    {
                        Classes.Druid.Common.ExtendedRip   = 0;
                        Classes.Druid.Common.RipMultiplier = 1;

                        //TF
                        if (StyxWoW.Me.HasAura(5217))
                        {
                            Classes.Druid.Common.RipMultiplier = Classes.Druid.Common.RipMultiplier * 1.15;
                        }

                        //Savage Roar
                        if (StyxWoW.Me.HasAura(127538))
                        {
                            Classes.Druid.Common.RipMultiplier = Classes.Druid.Common.RipMultiplier * 1.3;
                        }

                        //Doc
                        if (StyxWoW.Me.HasAura(108373))
                        {
                            Classes.Druid.Common.RipMultiplier = Classes.Druid.Common.RipMultiplier * 1.25;
                        }
                    }
                }
                break;

            case "SPELL_AURA_APPLIED":
                if (e.SourceGuid == StyxWoW.Me.Guid)
                {
                    if (e.SpellId == 1822)
                    {
                        Classes.Druid.Common.RakeMultiplier = 1;

                        //TF
                        if (StyxWoW.Me.HasAura(5217))
                        {
                            Classes.Druid.Common.RakeMultiplier = Classes.Druid.Common.RakeMultiplier * 1.15;
                        }

                        //Savage Roar
                        if (StyxWoW.Me.HasAura(127538))
                        {
                            Classes.Druid.Common.RakeMultiplier = Classes.Druid.Common.RakeMultiplier * 1.3;
                        }

                        //Doc
                        if (StyxWoW.Me.HasAura(108373))
                        {
                            Classes.Druid.Common.RakeMultiplier = Classes.Druid.Common.RakeMultiplier * 1.25;
                        }
                    }
                    if (e.SpellId == 1079)
                    {
                        Classes.Druid.Common.ExtendedRip   = 0;
                        Classes.Druid.Common.RipMultiplier = 1;

                        //TF
                        if (StyxWoW.Me.HasAura(5217))
                        {
                            Classes.Druid.Common.RipMultiplier = Classes.Druid.Common.RipMultiplier * 1.15;
                        }

                        //Savage Roar
                        if (StyxWoW.Me.HasAura(127538))
                        {
                            Classes.Druid.Common.RipMultiplier = Classes.Druid.Common.RipMultiplier * 1.3;
                        }

                        //Doc
                        if (StyxWoW.Me.HasAura(108373))
                        {
                            Classes.Druid.Common.RipMultiplier = Classes.Druid.Common.RipMultiplier * 1.25;
                        }
                    }
                }
                break;

            case "SPELL_AURA_REMOVED":
                if (e.SourceGuid == StyxWoW.Me.Guid)
                {
                    if (e.SpellId == 1822)
                    {
                        Classes.Druid.Common.RakeMultiplier = 0;
                    }
                    if (e.SpellId == 1079)
                    {
                        Classes.Druid.Common.ExtendedRip   = 0;
                        Classes.Druid.Common.RipMultiplier = 0;
                    }
                }
                break;
            }
        }
示例#29
0
        public override void Combat()
        {
            Target = Me.CurrentTarget;
            if (Target == null || !Target.Attackable)
            {
                return;
            }

            //Face pet-owner
            else if (Target != null && Target.IsPet)
            {
                WoWUnit Owner = Target.CreatedByUnit;
                if (Owner != null && Owner.IsValid)
                {
                    Blacklist.Add(Target, new TimeSpan(0, 0, 5));
                    Logging.Write("Changing targets to pet owner");
                    Target = Owner;
                    TargetUnit(Target);
                }
            }
            //Face the target
            Face(Target);



            //Always try and move ontop of the enemy target
            if (!Me.IsCasting)
            {
                Move(Target.Location);
            }


            if (Target.Distance < 2 && Styx.BotManager.Current.Name != "LazyRaider")
            {
                Navigator.PlayerMover.MoveStop();
            }


            if (Me.IsCasting)
            {
            }
            else if ((Target.Distance > 30 || !Target.IsAlive) && Me.Combat && Styx.BotManager.Current.Name != "LazyRaider")
            {
                Logging.Write(Target.Name + " is currently " + Target.Distance.ToString() + " dropping target");
                Me.ClearTarget();
                SeekTarget();
            }
            else if (isAuraActive("Freezing Fog") && CanCast("Howling Blast"))
            {
                Cast("Howling Blast");
            }
            else if ((Target.Distance >= 5d && Target.Distance < 20d))
            {
                if (Target.MovementInfo.CurrentSpeed > 7.0f && CanCast("Chains of Ice"))
                {
                    Cast("Chains of Ice");
                }
                else
                {
                    foreach (String Ability in RangedRotation)
                    {
                        cctc(Target, Ability);
                    }
                }
                Move(Target.Location);
            }

            else if (Target.Distance <= 6d || MeleeLatency())
            {
                foreach (String Ability in CD)
                {
                    cctc(Ability);
                }

                if (Target.IsCasting)
                {
                    foreach (String Ability in Interrupts)
                    {
                        if (cctc(Ability))
                        {
                            Thread.Sleep(50);
                            break;
                        }
                    }
                }
                else if ((Me.HealthPercent < 30.0f || isAuraActive("Dark Succor")) && CanCast("Death Strike") && Me.HealthPercent < 80.0f)
                {
                    Cast("Death Strike");
                }
                else
                {
                    if (isAuraActive("Crimson Scourge") && (CanCast("Blood Boil") || CanCast("Rune Tap")))
                    {
                        if (CanCast("Rune Tap"))
                        {
                            Cast("Rune Tap");
                        }
                        else
                        {
                            Cast("Blood Boil");
                        }
                    }

                    foreach (String Ability in Rotation)
                    {
                        if (cctc(Ability))
                        {
                            break;
                        }
                    }
                }
                Usetrinkets();
            }
        }
示例#30
0
        public override void Combat()
        {
            Target = Me.CurrentTarget;

            int Toggle = Lua.GetReturnVal <int>("return Toggle and 0 or 1", 0);

            if (Toggle != 1)
            {
                return;
            }


            if (Target == null || !Target.Attackable)
            {
                return;
            }

            //Lets try some new logic here..lets go for the owner
            else if (Target != null && Target.IsPet)
            {
                WoWUnit Owner = Target.CreatedByUnit;
                if (Owner != null && Owner.IsValid && Owner.IsAlive)
                {
                    Blacklist.Add(Target, new TimeSpan(0, 0, 5));
                    Logging.Write("Changing targets to pet owner");
                    Target = Owner;
                    TargetUnit(Target);
                }
            }
            //Face the target
            Face(Target);
            //Always try and move ontop of the enemy target


            if (Me.IsCasting)
            {
                if (Me.CastingSpell.Name != "Shattering Throw")
                {
                    Stop();
                }
                else
                {
                    Move(Target.Location);
                }
            }
            else
            {
                Move(Target.Location);
            }



            if (Target.Distance < 2)
            {
                Stop();
            }

            if ((Target.Distance > 30 || !Target.IsAlive) && Me.Combat && Manual)
            {
                Logging.Write(Target.Name + " is currently " + Target.Distance.ToString() + " dropping target");
                Me.ClearTarget();
                SeekTarget();
            }
            else if ((Target.Distance >= 8d && Target.Distance < 30d))
            {
                if (CanCast(Target, "Charge"))
                {
                    Cast(Target, "Charge");
                }
                else if (CanCast("Heroic Leap") && Charge.CooldownTimeLeft.Seconds > 0 && Charge.CooldownTimeLeft.Seconds < 8)
                {
                    SpellManager.Cast("Heroic Leap");
                    LegacySpellManager.ClickRemoteLocation(StyxWoW.Me.CurrentTarget.Location);
                }
            }

            else if (Target.IsWithinMeleeRange)
            {
                if (IsTargetInvin(Target) && CanCast("Shattering Throw"))
                {
                    Stop();
                    Cast(Target, "Shattering Throw");
                }
                else if (Target.IsCasting && Target.CanInterruptCurrentSpellCast)
                {
                    foreach (String Ability in Interrupts)
                    {
                        if (cctc(Target, Ability))
                        {
                            Thread.Sleep(50);
                            break;
                        }
                    }
                }

                //if Colossus Smash is up, use trinkets and skip everything else
                else if (IsMyAuraActive(Target, "Colossus Smash"))
                {
                    Usetrinkets();
                    //HS is off the global, use it first so we can use another ability
                    if (Me.RagePercent > 85.0f && CanCast("Heroic Strike"))
                    {
                        Cast(Target, "Heroic Strike");
                    }

                    foreach (String Ability in SmashRotation)
                    {
                        if (cctc(Target, Ability))
                        {
                            break;
                        }
                    }
                }
                else if (Target.MovementInfo.CurrentSpeed >= 7 && Slowable(Target))
                {
                    //Check if theres multltiple targets nearby

                    Cast("Piercing Howl");
                }
                else if (!IsMyAuraActive(Target, "Rend") && CanCast("Rend"))
                {
                    Cast(Target, "Rend");
                }
                else if (isAuraActive("Juggernaut") && (CanCast("Mortal Strike") || CanCast("Slam")))
                {
                    if (CanCast("Mortal Strike"))
                    {
                        Cast(Target, "Mortal Strike");
                    }
                    else
                    {
                        Cast(Target, "Slam");
                    }
                }

                else if (IsMyAuraActive(Target, "Colossus Smash") && CanCast("Recklessness") && CanCast("Bladestorm") && Manual) // && CanCast("Sweeping Strikes")
                {
                    cctc("Recklessness");
                    cctc("Sweeping Strikes");
                    cctc("Bladestorm");
                }
                else
                {
                    foreach (String Ability in CD)
                    {
                        cctc(Ability);
                    }

                    if (Me.RagePercent > 85.0f)
                    {
                        if (CanCast("Inner Rage") && !CanCast("Execute") && !CanCast("Heroic Strike") && !CanCast("Overpower") && !CanCast("Mortal Strike"))
                        {
                            Cast("Inner Rage");
                        }
                        cctc("Heroic Strike");
                    }


                    foreach (String Ability in Rotation)
                    {
                        if (cctc(Target, Ability))
                        {
                            break;
                        }
                    }
                }
            }
        }