Пример #1
0
        public static void ResetBot()
        {
            Logger.DBLog.InfoFormat("Preforming reset of bot data...");
            BlacklistCache.ClearBlacklistCollections();
            GoldInactivity.LastCoinageUpdate = DateTime.Now;

            PlayerMover.iTotalAntiStuckAttempts    = 1;
            PlayerMover.vSafeMovementLocation      = Vector3.Zero;
            PlayerMover.vOldPosition               = Vector3.Zero;
            PlayerMover.iTimesReachedStuckPoint    = 0;
            PlayerMover.timeLastRecordedPosition   = DateTime.Today;
            PlayerMover.timeStartedUnstuckMeasure  = DateTime.Today;
            PlayerMover.iTimesReachedMaxUnstucks   = 0;
            PlayerMover.iCancelUnstuckerForSeconds = 0;
            PlayerMover.timeCancelledUnstuckerFor  = DateTime.Today;

            //Reset all data with bot (Playerdata, Combat Data)
            Reset();

            PlayerClass.CreateBotClass();
            //Update character info!
            FunkyGame.Hero.Update();

            //OOC ID Flags
            Targeting.Cache.ShouldCheckItemLooted   = false;
            Targeting.Cache.CheckItemLootStackCount = 0;
            //ItemIdentifyBehavior.shouldPreformOOCItemIDing = false;

            //TP Behavior Reset
            TownPortalBehavior.ResetTPBehavior();

            //Sno Trim Timer Reset
            ObjectCache.cacheSnoCollection.ResetTrimTimer();
            //clear obstacles
            ObjectCache.Obstacles.Clear();
            ObjectCache.Objects.Clear();
            //EventHandlers.EventHandlers.DumpedDeathInfo = false;
        }
Пример #2
0
        internal void CheckPrecombat()
        {
            if (FunkyGame.Hero.Class == null)
            {            //Null?
                PlayerClass.ShouldRecreatePlayerClass = true;
            }

            //Should we recreate class?
            if (PlayerClass.ShouldRecreatePlayerClass)
            {
                PlayerClass.CreateBotClass();
            }

            //Seconday Hotbar Check
            FunkyGame.Hero.Class.SecondaryHotbarBuffPresent();

            //Check if we should trim our SNO cache..
            if (DateTime.Now.Subtract(ObjectCache.cacheSnoCollection.lastTrimming).TotalMilliseconds > FunkyBaseExtension.Settings.Plugin.UnusedSNORemovalRate)
            {
                ObjectCache.cacheSnoCollection.TrimOldUnusedEntries();
            }

            ObjectCache.CheckForCacheRemoval();
        }
Пример #3
0
        private static bool GlobalOverlord(object ret)
        {
            // If we aren't in the game of a world is loading, don't do anything yet
            if (!ZetaDia.IsInGame || ZetaDia.IsLoadingWorld || ZetaDia.Me == null || ZetaDia.Me.CommonData == null)
            {
                Bot.NavigationCache.lastChangedZigZag        = DateTime.Today;
                Bot.NavigationCache.vPositionLastZigZagCheck = Vector3.Zero;
                return(false);
            }

            //check if we initialized the bot..
            if (Bot.Character.Class == null)
            {
                PlayerClass.CreateBotClass();
            }

            //Seconday Hotbar Check
            Bot.Character.Class.SecondaryHotbarBuffPresent();

            // Clear target current and reset key variables used during the target-handling function
            Bot.Targeting.ResetTargetHandling();
            Bot.Targeting.Cache.DontMove = false;

            //update current profile behavior.
            Bot.Game.Profile.CheckCurrentProfileBehavior();


            // Should we refresh target list?
            if (Bot.Targeting.Cache.ShouldRefreshObjectList)
            {
                Bot.Targeting.Cache.Refresh();

                // We have a target, start the target handler!
                if (Bot.Targeting.Cache.CurrentTarget != null)
                {
                    Bot.Targeting.Movement.RestartTracking();
                    Bot.Targeting.Cache.bWholeNewTarget   = true;
                    Bot.Targeting.Cache.DontMove          = true;
                    Bot.Targeting.Cache.bPickNewAbilities = true;
                    Bot.RunningTargetingBehavior          = true;
                    //Bot.Targeting.Cache.StartingLocation = Bot.Character_.Data.Position;
                    return(true);
                }
            }
            else
            {
                if (OutOfGame.MuleBehavior)
                {
                    if (BotMain.StatusText.Contains("Game Finished"))
                    {
                        if (ZetaDia.Actors.GetActorsOfType <GizmoPlayerSharedStash>(true, true).Any())
                        {
                            return(true);
                        }
                    }
                }
                else if (ExitGame.ShouldExitGame)
                {
                    ExitGame.BehaviorEngaged = true;
                    return(true);
                }

                return(false);
            }

            // Pop a potion when necessary
            if (Bot.Character.Class.HealthPotionAbility.CheckPreCastConditionMethod())
            {
                if (Bot.Character.Class.HealthPotionAbility.CheckCustomCombatMethod())
                {
                    Bot.Character.Class.HealthPotionAbility.AttemptToUseHealthPotion();
                }
            }

            BlacklistCache.CheckRefreshBlacklists();


            if (Bot.Settings.Debug.DebugStatusBar && bResetStatusText)
            {
                bResetStatusText   = false;
                BotMain.StatusText = "[Funky] No more targets - DemonBuddy/profile management is now in control";
            }

            Bot.RunningTargetingBehavior = false;
            // Nothing to do... do we have some maintenance we can do instead, like out of combat buffing?
            Bot.NavigationCache.lastChangedZigZag        = DateTime.Today;
            Bot.NavigationCache.vPositionLastZigZagCheck = Vector3.Zero;

            // Out of combat buffing etc. but only if we don't want to return to town etc.
            AnimationState myAnimationState = Bot.Character.Data.CurrentAnimationState;

            if ((!Bot.Character.Data.bIsInTown || Bot.Settings.AllowBuffingInTown) &&
                !TownRunManager.bWantToTownRun &&
                myAnimationState != AnimationState.Attacking && myAnimationState != AnimationState.Casting && myAnimationState != AnimationState.Channeling)
            {
                Skill Buff;
                if (Bot.Character.Class.FindBuffPower(out Buff))
                {
                    Skill.SetupAbilityForUse(ref Buff);
                    Bot.Character.Data.WaitWhileAnimating(4, true);
                    Skill.UsePower(ref Buff);
                    Buff.OnSuccessfullyUsed();
                    Bot.Character.Data.WaitWhileAnimating(3, true);
                }
            }



            // Ok let DemonBuddy do stuff this loop, since we're done for the moment
            return(false);
        }