Exemplo n.º 1
0
        ///<summary>
        ///Exiting Game Behavior
        ///</summary>
        public static RunStatus Behavior()
        {
            //Run Town Portal Behavior..
            if (TownPortalBehavior.FunkyTPOverlord(null))
            {
                TownPortalBehavior.FunkyTPBehavior(null);
                return(RunStatus.Running);
            }

            //Exit Game..
            if (ZetaDia.IsInGame)
            {
                if (DateTime.Now.Subtract(_lastExitAttempt).TotalSeconds > 4)
                {
                    Logger.DBLog.InfoFormat("[Funky] Exiting game..");
                    ZetaDia.Service.Party.LeaveGame();
                    _lastExitAttempt = DateTime.Now;
                }
                return(RunStatus.Running);
            }

            //Get First or Last Used Profile..
            string profile = Bot.Game.CurrentGameStats.Profiles.Count > 0 ? Bot.Game.CurrentGameStats.Profiles.First().ProfileName :
                             GlobalSettings.Instance.LastProfile;

            //Load Profile and Fire our left game handler
            ProfileManager.Load(profile);
            EventHandlers.FunkyOnLeaveGame(null, null);

            //Finally disable this..
            BehaviorEngaged = false;
            ShouldExitGame  = false;

            return(RunStatus.Success);
        }
Exemplo n.º 2
0
        // **********************************************************************************************
        // *****         TownRunCheckOverlord - determine if we should do a town-run or not         *****
        // **********************************************************************************************
        internal static bool GilesTownRunCheckOverlord(object ret)
        {
            bWantToTownRun = false;

            // Check if we should be forcing a town-run
            if (BrainBehavior.IsVendoring)
            {
                bWantToTownRun = true;
            }
            else
            {
                int recheckDelay = Bot.Character.Data.bIsInTown ? 1 : 6;
                if (DateTime.Now.Subtract(TimeLastCheckedForTownRun).TotalSeconds > recheckDelay)
                {
                    TimeLastCheckedForTownRun = DateTime.Now;
                    if (BrainBehavior.ShouldVendor || Bot.Character.Data.BackPack.ShouldRepairItems())
                    {
                        bCheckedItemDurability = false;
                        bCheckUnidItems        = true;
                        bWantToTownRun         = true;
                    }
                }
            }

            bLastTownRunCheckResult = bWantToTownRun;

            //Precheck prior to casting TP..
            if (bLastTownRunCheckResult)
            {
                if (!ZetaDia.IsInTown)
                {
                    bPreStashPauseDone = false;
                    Bot.NavigationCache.LOSmovementObject = null;
                    return(TownPortalBehavior.SafetyCheckForTownRun());
                }
            }

            return(bWantToTownRun);
        }