fBaseXtensions.Behaviors.OutOfGame.OutOfGameBehavior C# (CSharp) Method

OutOfGameBehavior() public static method

public static OutOfGameBehavior ( object ret ) : RunStatus
ret object
return RunStatus
        public static RunStatus OutOfGameBehavior(object ret)
        {
            if (CharacterControl.GamblingCharacterSwitch)
            {
                return CharacterControl.GamblingCharacterSwitchBehavior();
            }

            if (MuleBehavior)
            {
                if (!InitMuleBehavior)
                {
                    Finished = false;
                    InitMuleBehavior = true;
                    NewMuleGame.BotHeroName = ZetaDia.Service.Hero.Name;
                    NewMuleGame.BotHeroIndex = 0;
                    NewMuleGame.LastProfile = ProfileManager.CurrentProfile.Path;
                    NewMuleGame.LastHandicap = CharacterSettings.Instance.MonsterPowerLevel;
                }

                if (!CreatedCharacter)
                {
                    RunStatus NewHeroStatus = CreateNewHero();

                    if (NewHeroStatus == RunStatus.Success)
                    {
                        CreatedCharacter = true;
                        //Setup Settings
                        //Bot.Character.Account.UpdateCurrentAccountDetails();
                        Settings.PluginSettings.LoadSettings();
                    }
                    return RunStatus.Running;
                }

                if (!RanProfile)
                {
                    RunStatus NewGameStatus = NewMuleGame.BeginNewGameProfile();
                    if (NewGameStatus == RunStatus.Success)
                    {
                        RanProfile = true;
                        return RunStatus.Success;
                    }
                    return RunStatus.Running;
                }

                RunStatus FinishStatus = NewMuleGame.FinishMuleBehavior();
                if (FinishStatus == RunStatus.Success)
                {
                    Finished = true;
                    RanProfile = false;
                    CreatedCharacter = false;
                    InitMuleBehavior = false;
                    MuleBehavior = false;
                    //Load Settings
                    //Bot.Character.Account.UpdateCurrentAccountDetails();
                    Settings.PluginSettings.LoadSettings();

                    return RunStatus.Success;
                }
                return RunStatus.Running;

            }

            if (ExitGameBehavior.BehaviorEngaged)
            {
                //Get First or Last Used Profile..
                TrackedProfile firstProfile = FunkyGame.CurrentStats.GetFirstProfile();

                string profile = firstProfile != null ? firstProfile.ProfileName :
                                GlobalSettings.Instance.LastProfile;

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

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

            //Custom Hero Setting Game Difficulty
            if (!CharacterControl.GameDifficultyChanged)
            {
                CharacterControl.GameDifficultyChanged = true;
                var customdifficulty = (GameDifficulty) Enum.Parse(typeof (GameDifficulty), FunkyBaseExtension.Settings.General.CustomDifficulty);
                CharacterSettings.Instance.GameDifficulty = customdifficulty;
            }

            return RunStatus.Success;
        }