コード例 #1
0
ファイル: CharacterControl.cs プロジェクト: herbfunk/Funky
        public static RunStatus GamblingCharacterSwitchBehavior()
        {
            if (!_delayer.Test(5d))
                return RunStatus.Running;

            if (GamblingCharacterSwitchToMain)
            {
                if (!_initalDelayStarted)
                {
                    _initalstartTime = DateTime.Now;
                    _initalDelayStarted = true;
                }
                var initaldelayStartSecs = DateTime.Now.Subtract(_initalstartTime).TotalSeconds;
                if (initaldelayStartSecs < 7)
                {
                    BotMain.StatusText = "[Funky] Switching to Main Hero (Waiting for inital delay! [" + initaldelayStartSecs + " secs])";
                    return RunStatus.Running;
                }

                BotMain.StatusText = "[Funky] Switching to Main Hero";
                ZetaDia.Memory.ClearCache();
                HeroInfo curheroinfo = new HeroInfo(ZetaDia.Service.Hero);

                if (!curheroinfo.Equals(MainHeroInfo))
                {//Need To Switch back to main hero!

                    Logger.DBLog.DebugFormat("Current Hero Info Mismatched -- Current Hero {0}\r\nMain Hero{1}",
                        curheroinfo.ToString(), MainHeroInfo.ToString());

                    if (_mainHeroIndexes.Count == 0)
                    {//Get a list of possible heroes using our index list (matching hero class and name)
                        foreach (var c in HeroIndexInfo.Characters.Where(c => c.Class == MainHeroInfo.Class && c.Name == MainHeroInfo.Name))
                        {
                            _mainHeroIndexes.Add(c.Index);
                        }
                    }
                    else
                    {//Switch and remove index from list
                        int mainheroIndex = _mainHeroIndexes.First();
                        Logger.DBLog.InfoFormat("[Funky] Switching to Main Hero -- Index {0}", mainheroIndex);
                        ZetaDia.Service.GameAccount.SwitchHero(mainheroIndex);
                        _mainHeroIndexes.RemoveAt(0);
                    }
                }
                else
                {//Finished! Reset the variables.
                    FunkyGame.ShouldRefreshAccountDetails = true;
                    PluginSettings.LoadSettings();
                    _initalDelayStarted = false;
                    MainHeroInfo = null;
                    AltHeroInfo = null;
                    GamblingCharacterSwitch = false;
                    GamblingCharacterSwitchToMain = false;
                    _mainHeroIndexes.Clear();
                    return RunStatus.Success;
                }

                return RunStatus.Running;
            }

            //Update Main Hero Info and Switch to Alt Hero!
            if (MainHeroInfo == null)
            {
                if (!_initalDelayStarted)
                {
                    _initalstartTime = DateTime.Now;
                    _initalDelayStarted = true;
                }
                var initaldelayStartSecs = DateTime.Now.Subtract(_initalstartTime).TotalSeconds;
                if (initaldelayStartSecs < 7)
                {
                    BotMain.StatusText = "[Funky] Switching to Alt Hero (Waiting for inital delay! [" + initaldelayStartSecs + " secs])";
                    return RunStatus.Running;
                }

                BotMain.StatusText = "[Funky] Switching to Alt Hero";
                return CharacterSwitch();
            }

            //Update Alt Hero Info and Start Adventure Mode Game!
            if (AltHeroInfo == null)
                return UpdateAltHero();

            //Finished for now.. lets load the new game and let combat control take over!
            FunkyGame.ShouldRefreshAccountDetails = true;
            GamblingCharacterSwitch = false;
            AltHeroGamblingEnabled = true;
            _initalDelayStarted = false;
            return RunStatus.Success;
        }
コード例 #2
0
ファイル: CharacterControl.cs プロジェクト: herbfunk/Funky
        public static RunStatus GamblingCharacterSwitchBehavior()
        {
            if (!_delayer.Test(5d))
            {
                return(RunStatus.Running);
            }

            if (GamblingCharacterSwitchToMain)
            {
                if (!_initalDelayStarted)
                {
                    _initalstartTime    = DateTime.Now;
                    _initalDelayStarted = true;
                }
                var initaldelayStartSecs = DateTime.Now.Subtract(_initalstartTime).TotalSeconds;
                if (initaldelayStartSecs < 7)
                {
                    BotMain.StatusText = "[Funky] Switching to Main Hero (Waiting for inital delay! [" + initaldelayStartSecs + " secs])";
                    return(RunStatus.Running);
                }

                BotMain.StatusText = "[Funky] Switching to Main Hero";
                ZetaDia.Memory.ClearCache();
                HeroInfo curheroinfo = new HeroInfo(ZetaDia.Service.Hero);

                if (!curheroinfo.Equals(MainHeroInfo))
                {//Need To Switch back to main hero!
                    Logger.DBLog.DebugFormat("Current Hero Info Mismatched -- Current Hero {0}\r\nMain Hero{1}",
                                             curheroinfo.ToString(), MainHeroInfo.ToString());

                    if (_mainHeroIndexes.Count == 0)
                    {//Get a list of possible heroes using our index list (matching hero class and name)
                        foreach (var c in HeroIndexInfo.Characters.Where(c => c.Class == MainHeroInfo.Class && c.Name == MainHeroInfo.Name))
                        {
                            _mainHeroIndexes.Add(c.Index);
                        }
                    }
                    else
                    {//Switch and remove index from list
                        int mainheroIndex = _mainHeroIndexes.First();
                        Logger.DBLog.InfoFormat("[Funky] Switching to Main Hero -- Index {0}", mainheroIndex);
                        ZetaDia.Service.GameAccount.SwitchHero(mainheroIndex);
                        _mainHeroIndexes.RemoveAt(0);
                    }
                }
                else
                {//Finished! Reset the variables.
                    FunkyGame.ShouldRefreshAccountDetails = true;
                    PluginSettings.LoadSettings();
                    _initalDelayStarted           = false;
                    MainHeroInfo                  = null;
                    AltHeroInfo                   = null;
                    GamblingCharacterSwitch       = false;
                    GamblingCharacterSwitchToMain = false;
                    _mainHeroIndexes.Clear();
                    return(RunStatus.Success);
                }

                return(RunStatus.Running);
            }



            //Update Main Hero Info and Switch to Alt Hero!
            if (MainHeroInfo == null)
            {
                if (!_initalDelayStarted)
                {
                    _initalstartTime    = DateTime.Now;
                    _initalDelayStarted = true;
                }
                var initaldelayStartSecs = DateTime.Now.Subtract(_initalstartTime).TotalSeconds;
                if (initaldelayStartSecs < 7)
                {
                    BotMain.StatusText = "[Funky] Switching to Alt Hero (Waiting for inital delay! [" + initaldelayStartSecs + " secs])";
                    return(RunStatus.Running);
                }

                BotMain.StatusText = "[Funky] Switching to Alt Hero";
                return(CharacterSwitch());
            }

            //Update Alt Hero Info and Start Adventure Mode Game!
            if (AltHeroInfo == null)
            {
                return(UpdateAltHero());
            }


            //Finished for now.. lets load the new game and let combat control take over!
            FunkyGame.ShouldRefreshAccountDetails = true;
            GamblingCharacterSwitch = false;
            AltHeroGamblingEnabled  = true;
            _initalDelayStarted     = false;
            return(RunStatus.Success);
        }