public override void Pulse() { if (StyxWoW.Me.Level == 68) { InactivityDetector.ForceLogout(true); } if (DateTime.Now > _end) { InactivityDetector.ForceLogout(true); } }
private async static Task <bool> CastLine() { if (!LineRecastTimer.IsFinished) { return(false); } LineRecastTimer.Reset(); _castCounter++; SpellManager.Cast("Fishing"); await CommonCoroutines.SleepForLagDuration(); StyxWoW.ResetAfk(); InactivityDetector.Reset(); return(true); }
internal static RunStatus DeathWaitAction(object ret) { //if (!UIElements.ReviveAtCorpseButton.IsEnabled) //{ // UIElements.ReviveAtLastCheckpointButton.Click(); //} if (FunkyBaseExtension.Settings.Death.WaitForPotionCooldown) { //Check Potion Cast Flags.. PowerManager.CanCastFlags potionCastFlags; if (!PowerManager.CanCast(SNOPower.DrinkHealthPotion, out potionCastFlags)) { if (potionCastFlags.HasFlag(PowerManager.CanCastFlags.PowerUnusableOnCooldown)) { InactivityDetector.Reset(); return(RunStatus.Running); } } } if (FunkyBaseExtension.Settings.Death.WaitForAllSkillsCooldown) { if (FunkyGame.Hero.Class.AC == ActorClass.Wizard && Hotbar.HasBuff(SNOPower.Wizard_Archon)) { Hotbar.RefreshHotbar(); InactivityDetector.Reset(); return(RunStatus.Running); } foreach (var skill in Hotbar.HotbarSkills) { PowerManager.CanCastFlags skillCastFlags; if (!PowerManager.CanCast(skill.Power, out skillCastFlags)) { if (skillCastFlags.HasFlag(PowerManager.CanCastFlags.PowerUnusableOnCooldown)) { InactivityDetector.Reset(); return(RunStatus.Running); } } } } GoldInactivity.LastCoinageUpdate = DateTime.Now; return(RunStatus.Success); }
public override void Initialize() { base.Test = (ref CacheObject obj) => { if (obj == null) { // See if we should wait for milliseconds for possible loot drops before continuing run if (DateTime.Now.Subtract(FunkyGame.Targeting.Cache.lastHadUnitInSights).TotalMilliseconds <= FunkyBaseExtension.Settings.General.AfterCombatDelay && DateTime.Now.Subtract(FunkyGame.Targeting.Cache.lastHadEliteUnitInSights).TotalMilliseconds <= 10000 || //Cut the delay time in half for non-elite monsters! DateTime.Now.Subtract(FunkyGame.Targeting.Cache.lastHadUnitInSights).TotalMilliseconds <= FunkyBaseExtension.Settings.General.AfterCombatDelay) { obj = new CacheObject(FunkyGame.Hero.Position, TargetType.NoMovement, 20000, "WaitForLootDrops", 2f, -1); return(true); } //Herbfunks wait after loot containers are opened. 3s for rare chests, half the settings delay for everything else. if ((DateTime.Now.Subtract(FunkyGame.Targeting.Cache.lastHadRareChestAsTarget).TotalMilliseconds <= 3750) || (DateTime.Now.Subtract(FunkyGame.Targeting.Cache.lastHadContainerAsTarget).TotalMilliseconds <= (FunkyBaseExtension.Settings.General.AfterCombatDelay * 1.25))) { obj = new CacheObject(FunkyGame.Hero.Position, TargetType.NoMovement, 20000, "ContainerLootDropsWait", 2f, -1); return(true); } if (DateTime.Now.Subtract(FunkyGame.Targeting.Cache.lastSeenCursedShrine).TotalMilliseconds <= (1000)) { if (FunkyGame.AdventureMode && SettingAdventureMode.AdventureModeSettingsTag.AllowCombatModifications && FunkyGame.Bounty.CurrentBountyCacheEntry != null && FunkyGame.Bounty.CurrentBountyCacheEntry.Type == BountyTypes.CursedEvent) { Logger.DBLog.Info("[Funky] Cursed Object Found During Cursed Bounty -- Enabling LOS movement for all Units!"); SettingLOSMovement.LOSSettingsTag.MiniumRangeObjects = 10; SettingLOSMovement.LOSSettingsTag.MaximumRange = 125; FunkyGame.Game.AllowAnyUnitForLOSMovement = true; SettingCluster.ClusterSettingsTag = SettingCluster.DisabledClustering; } obj = new CacheObject(FunkyGame.Hero.Position, TargetType.NoMovement, 20000, "CursedShrineWait", 2f, -1); return(true); } if (DateTime.Now.Subtract(FunkyGame.Targeting.Cache.lastHadSwitchAsTarget).TotalMilliseconds <= (4000)) { obj = new CacheObject(FunkyGame.Hero.Position, TargetType.NoMovement, 20000, "SwitchWait", 2f, -1); return(true); } // Finally, a special check for waiting for wrath of the berserker cooldown before engaging Azmodan if (Hotbar.HasPower(SNOPower.Barbarian_WrathOfTheBerserker) && FunkyBaseExtension.Settings.Barbarian.bWaitForWrath && !FunkyGame.Hero.Class.Abilities[SNOPower.Barbarian_WrathOfTheBerserker].AbilityUseTimer() && FunkyGame.Hero.CurrentWorldDynamicID == 121214 && (Vector3.Distance(FunkyGame.Hero.Position, new Vector3(711.25f, 716.25f, 80.13903f)) <= 40f || Vector3.Distance(FunkyGame.Hero.Position, new Vector3(546.8467f, 551.7733f, 1.576313f)) <= 40f)) { Logger.DBLog.InfoFormat("[Funky] Waiting for Wrath Of The Berserker cooldown before continuing to Azmodan."); obj = new CacheObject(FunkyGame.Hero.Position, TargetType.NoMovement, 20000, "GilesWaitForWrath", 0f, -1); InactivityDetector.Reset(); return(true); } // And a special check for wizard archon if (Hotbar.HasPower(SNOPower.Wizard_Archon) && !FunkyGame.Hero.Class.Abilities[SNOPower.Wizard_Archon].AbilityUseTimer() && FunkyBaseExtension.Settings.Wizard.bWaitForArchon && ZetaDia.CurrentWorldId == 121214 && (Vector3.Distance(FunkyGame.Hero.Position, new Vector3(711.25f, 716.25f, 80.13903f)) <= 40f || Vector3.Distance(FunkyGame.Hero.Position, new Vector3(546.8467f, 551.7733f, 1.576313f)) <= 40f)) { Logger.DBLog.InfoFormat("[Funky] Waiting for Wizard Archon cooldown before continuing to Azmodan."); obj = new CacheObject(FunkyGame.Hero.Position, TargetType.NoMovement, 20000, "GilesWaitForArchon", 0f, -1); InactivityDetector.Reset(); return(true); } // And a very sexy special check for WD BigBadVoodoo if (Hotbar.HasPower(SNOPower.Witchdoctor_BigBadVoodoo) && !PowerManager.CanCast(SNOPower.Witchdoctor_BigBadVoodoo) && ZetaDia.CurrentWorldId == 121214 && (Vector3.Distance(FunkyGame.Hero.Position, new Vector3(711.25f, 716.25f, 80.13903f)) <= 40f || Vector3.Distance(FunkyGame.Hero.Position, new Vector3(546.8467f, 551.7733f, 1.576313f)) <= 40f)) { Logger.DBLog.InfoFormat("[Funky] Waiting for WD BigBadVoodoo cooldown before continuing to Azmodan."); obj = new CacheObject(FunkyGame.Hero.Position, TargetType.NoMovement, 20000, "GilesWaitForVoodooo", 0f, -1); InactivityDetector.Reset(); return(true); } //Currently preforming an interactive profile behavior (check if in town and not vendoring) if (FunkyGame.Game.InteractableCachedObject != null && (!FunkyGame.Hero.bIsInTown || !BrainBehavior.IsVendoring)) { if (FunkyGame.Game.InteractableCachedObject.Position.Distance(FunkyGame.Hero.Position) > 50f) { //if (FunkyGame.Targeting.Cache.LastCachedTarget.Position != Bot.Game.Profile.InteractableCachedObject.Position) // Navigator.Clear(); //Generate the path here so we can start moving.. Navigation.Navigation.NP.MoveTo(FunkyGame.Game.InteractableCachedObject.Position, "ReturnToOOCLoc", true); //Setup a temp target that the handler will use obj = new CacheObject(FunkyGame.Game.InteractableCachedObject.Position, TargetType.LineOfSight, 1d, "ReturnToOOCLoc", 10f, FunkyGame.Game.InteractableCachedObject.RAGUID); return(true); } } //Check if we engaged in combat.. bool EngagedInCombat = false; float distanceFromStart = 0f; if (!FunkyGame.Targeting.Cache.LastCachedTarget.Equals(ObjectCache.FakeCacheObject) && !FunkyGame.Targeting.Cache.Backtracking && FunkyGame.Targeting.Cache.StartingLocation != Vector3.Zero) { EngagedInCombat = true; distanceFromStart = FunkyGame.Hero.Position.Distance(FunkyGame.Targeting.Cache.StartingLocation); //lets see how far we are from our starting location. if (distanceFromStart > 20f && !Navigation.Navigation.CanRayCast(FunkyGame.Hero.Position, PlayerMover.vLastMoveTo, UseSearchGridProvider: true)) { Logger.Write(LogLevel.Movement, "Updating Navigator in Target Refresh"); SkipAheadCache.ClearCache(); Navigator.Clear(); //Navigator.MoveTo(Funky.PlayerMover.vLastMoveTo, "original destination", true); } } //Check if our current path intersects avoidances. (When not in town, and not currently inside avoidance) if (!FunkyGame.Hero.bIsInTown && (FunkyBaseExtension.Settings.Avoidance.AttemptAvoidanceMovements) && //|| FunkyGame.Hero.CriticalAvoidance) Navigation.Navigation.NP.CurrentPath.Count > 0 && FunkyGame.Targeting.Cache.Environment.TriggeringAvoidances.Count == 0) { if (ObjectCache.Obstacles.TestVectorAgainstAvoidanceZones(FunkyGame.Hero.Position, Navigation.Navigation.NP.CurrentPath.Current)) { obj = new CacheObject(FunkyGame.Hero.Position, TargetType.NoMovement, 20000, "AvoidanceIntersection", 2.5f, -1); return(true); } } //Backtracking Check.. if (EngagedInCombat && FunkyBaseExtension.Settings.Backtracking.EnableBacktracking && distanceFromStart >= FunkyBaseExtension.Settings.Backtracking.MinimumDistanceFromStart) { FunkyGame.Targeting.Cache.Backtracking = true; obj = new CacheObject(FunkyGame.Targeting.Cache.StartingLocation, TargetType.Backtrack, 20000, "Backtracking", 2.5f); return(true); } } return(obj != null); }; }
private async static Task <bool> FollowPath() { if (!AutoAnglerSettings.Instance.Poolfishing && !AutoAnglerBot.Instance.Profile.FishAtHotspot) { return(false); } if (!AutoAnglerBot.Instance.Profile.FishAtHotspot && (BotPoi.Current.Type == PoiType.Harvest || LootTargeting.Instance.FirstObject != null)) { return(false); } if (await CheckLootFrame()) { return(true); } // dks can refresh water walking while flying around. if (AutoAnglerSettings.Instance.UseWaterWalking && Me.Class == WoWClass.DeathKnight && !WaterWalking.IsActive && await WaterWalking.Cast()) { return(true); } var moveto = AutoAnglerBot.Instance.Profile.CurrentPoint; if (moveto == WoWPoint.Zero) { return(false); } if (AutoAnglerBot.Instance.Profile.FishAtHotspot && Navigator.AtLocation(moveto)) { return(false); } float precision = Me.IsFlying ? AutoAnglerSettings.Instance.PathPrecision : 3; if (Me.Location.Distance(moveto) <= precision) { AutoAnglerBot.Instance.Profile.CycleToNextPoint(); } if (AutoAnglerSettings.Instance.Fly) { if (!StyxWoW.Me.Mounted && Flightor.MountHelper.CanMount) { var zenFlightAura = StyxWoW.Me.GetAuraByName("Zen Flight"); if (zenFlightAura != null) { zenFlightAura.TryCancelAura(); await CommonCoroutines.SleepForLagDuration(); } Flightor.MountHelper.MountUp(); return(true); } Flightor.MoveTo(moveto); } else { if (!StyxWoW.Me.Mounted && Mount.ShouldMount(moveto) && Mount.CanMount()) { Mount.MountUp(() => moveto); } var result = Navigator.MoveTo(moveto); if (result != MoveResult.Failed && result != MoveResult.PathGenerationFailed) { InactivityDetector.Reset(); } } return(true); }
public override void Pulse() { if (!_pulseTimer.IsFinished) { return; } _pulseTimer.Reset(); if (LogoutAtCap && WoWCurrency.GetCurrencyByType(WoWCurrencyType.HonorPoints).Amount > 3750 && WoWCurrency.GetCurrencyByType(WoWCurrencyType.JusticePoints).Amount > 3750) { Slog("HonorPoints and Justice Points are Capped! Logging out!"); InactivityDetector.ForceLogout(true); } // We should avoid overriding any poi set by the core if (BotPoi.Current.Type != PoiType.None) { return; } // There are no vendors in battlegrounds or dungeons ! if (Styx.Logic.Battlegrounds.IsInsideBattleground || Me.IsInInstance) { return; } // First item in the list. We should check item by item so we don't end up buying the last item in the list with lower cost. var firstItem = BuyItemList.FirstOrDefault(); // BuyItemList looks to be empty. Wait for user to populate the list if (firstItem == null) { return; } // Should check if we have enough currency. var currencyType = Enum.Parse(typeof(WoWCurrencyType), firstItem.ItemCostType); // Something went wrong with parsing. We should avoid buying that item. if (!(currencyType is WoWCurrencyType)) { Slog("Couldn't parse item's cost type ({0}). Please consult to the plugin writer", firstItem.ItemCostType); BuyItemList.Remove(firstItem); return; } // Actually checking if we have enough of that currency now. var currency = WoWCurrency.GetCurrencyByType((WoWCurrencyType)currencyType); var currencyJp = WoWCurrency.GetCurrencyByType(WoWCurrencyType.JusticePoints); var currencyHp = WoWCurrency.GetCurrencyByType(WoWCurrencyType.HonorPoints); if (currency == null) { return; } if (currency.Amount < firstItem.ItemCost) { // Don't ever buy justice points to buy honor points and vice versa. Otherwise we will enter in an endless loop which will drop // the total of our points. if (firstItem.ItemId != 392 && firstItem.ItemId != 395 && BuyOppositePointToBuildUp) { if (currency.CurrencyType == WoWCurrencyType.JusticePoints && currencyHp.Amount >= 375) { // We set this to true here. So we don't end up spending all our honor points if the Only remove hp/jp points when capped is true _forceAddedPoints = true; if (Me.IsAlliance) { var buyJusticePoint = new BuyItemInfo { ItemCost = 375, ItemName = "Justice Points", ItemSupplierId = 52029, ItemId = 395, ItemCostType = WoWCurrencyType.HonorPoints.ToString() }; Slog( "Adding Justice Point to the Buy List so we can build up Justice Points to buy {0}.", firstItem.ItemName); BuyItemList.Insert(0, buyJusticePoint); } if (Me.IsHorde) { var buyJusticePoint = new BuyItemInfo { ItemCost = 375, ItemName = "Justice Points", ItemSupplierId = 52033, ItemId = 395, ItemCostType = WoWCurrencyType.HonorPoints.ToString() }; Slog( "Adding Justice Point to the Buy List so we can build up Justice Points to buy {0}.", firstItem.ItemName); BuyItemList.Insert(0, buyJusticePoint); } } if (currency.CurrencyType == WoWCurrencyType.HonorPoints && currencyJp.Amount >= 375) { // We set this to true here. So we don't end up spending all our justice points if the Only remove hp/jp points when capped is true _forceAddedPoints = true; if (Me.IsAlliance) { var buyHonorPoint = new BuyItemInfo { ItemCost = 375, ItemName = "Honor Points", ItemSupplierId = 52028, ItemId = 392, ItemCostType = WoWCurrencyType.JusticePoints.ToString() }; Slog("Adding HonorPoint to the Buy List so we can build up HonorPoints to buy {0}.", firstItem.ItemName); BuyItemList.Insert(0, buyHonorPoint); } if (Me.IsHorde) { var buyHonorPoint = new BuyItemInfo { ItemCost = 375, ItemName = "Honor Points", ItemSupplierId = 52034, ItemId = 392, ItemCostType = WoWCurrencyType.JusticePoints.ToString() }; Slog("Adding HonorPoint to the Buy List so we can build up HonorPoints to buy {0}.", firstItem.ItemName); BuyItemList.Insert(0, buyHonorPoint); } } } return; } // We need to find the vendor var vendorAsUnit = ObjectManager.GetObjectsOfType <WoWUnit>(false, false).FirstOrDefault( u => u.Entry == firstItem.ItemSupplierId); Vendor vendor; // Vendor is not around. This won't work if (vendorAsUnit == null) { // Check the database for the vendor as a second hope NpcResult npc = NpcQueries.GetNpcById(firstItem.ItemSupplierId); if (npc != null) { vendor = new Vendor(npc.Entry, npc.Name, Vendor.VendorType.Unknown, npc.Location); } else { Slog("Please move your toon close to the vendor. Otherwise HonorCap won't be able to buy items."); return; } } else { vendor = new Vendor(vendorAsUnit, Vendor.VendorType.Unknown); } // Setting ItemToBuy here so VendorBehavior knows which item we want. ItemToBuy = firstItem; //We need to make sure vender is usable, so removing blacklist. if (Blacklist.Contains(vendorAsUnit)) { Slog("For whatever reason vender is blacklisted, Clearing Blacklist."); Blacklist.Flush(); } // Finally setting the poi BotPoi.Current = new BotPoi(vendor, PoiType.Buy); }