Example #1
0
        public void Stop()
        {
            ResetBotbaseVariables();

            if (LoadFlightMesh.MeshFileStream != null)
            {
                LoadFlightMesh.MeshFileStream.Dispose();
            }

            (Navigator.NavigationProvider as ServiceNavigationProvider)?.Dispose();
            Navigator.NavigationProvider = null;

            CombatTargeting.Instance.Provider = new DefaultCombatTargetingProvider();
            Blacklist.Flush();
            ChocoboManager.BlockSummon = false;

            GameSettingsManager.FaceTargetOnAction = playerFaceTargetOnAction;
            GameSettingsManager.FlightMode         = playerFlightMode;

            if (MainSettings.Instance.OverrideRestBehaviour)
            {
                Logger.SendDebugLog("Restoring the combat routine's rest behaviour.");
                TreeHooks.Instance.ReplaceHook("Rest", RoutineManager.Current.RestBehavior);
            }

            Logger.SendLog("Stopping Oracle.");
        }
Example #2
0
        public override void Pulse()
        {
            if (!StyxWoW.IsInGame || !StyxWoW.IsInWorld)
            {
                return;
            }
            if (TalentManager.Pulse())
            {
                return;
            }

            UpdateContext();
            Spell.DoubleCastPreventionDict.RemoveAll(t => DateTime.UtcNow > t);

            switch (StyxWoW.Me.Class)
            {
            case WoWClass.Hunter:
            case WoWClass.DeathKnight:
            case WoWClass.Warlock:
            case WoWClass.Mage:
                PetManager.Pulse();
                break;
            }

            if (HealerManager.NeedHealTargeting)
            {
                HealerManager.Instance.Pulse();
            }

            if (Movement)
            {
                Helpers.Movement.PulseMovement();
                TargetingGeneral.TargetingPulse();
            }

            if (!BotManager.Current.Name.Equals("BGBuddy") && !BotManager.Current.Name.Equals("Bg Bot"))
            {
                return;
            }
            if (StyxWoW.IsInGame == false || StyxWoW.Me.IsValid == false)
            {
                return;
            }
            if (StyxWoW.Me.IsActuallyInCombat && Helpers.Movement.MoveTo(StyxWoW.Me.CurrentTarget))
            {
                Blacklist.Flush();
            }
            if (TargetingPvP.TargetExists())
            {
                TargetingPvP.GetInCombat(); return;
            }
            if (StyxWoW.Me.IsDead || StyxWoW.Me.HasAura("Preparation"))
            {
                Helpers.Movement.StopMovement(true, true, true, true); StyxWoW.Me.ClearTarget(); return;
            }
            TargetingPvP.TargetPulse();
        }
Example #3
0
        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);
        }