Пример #1
0
        public void OnLoad()
        {
            DefaultDataUpdater.PerformUpdates();

            Settings = PluginSettings.LoadSettings(PluginDataDir);

            MainMenuItem = new PluginMenuItem {
                Header = Name
            };
            MainMenuItem.Click += (sender, args) =>
            {
                if (MainWindow == null)
                {
                    InitializeMainWindow();
                    Debug.Assert(MainWindow != null, "_mainWindow != null");
                    MainWindow.Show();
                }
                else
                {
                    MainWindow.Activate();
                }
            };

            Hearthstone_Deck_Tracker.API.DeckManagerEvents.OnDeckCreated.Add(HandleHearthstoneDeckUpdated);
            Hearthstone_Deck_Tracker.API.DeckManagerEvents.OnDeckUpdated.Add(HandleHearthstoneDeckUpdated);
            Hearthstone_Deck_Tracker.API.DeckManagerEvents.OnDeckDeleted.Add(HandleHearthstoneDeckDeleted);

            DispatcherTimer importTimer = new DispatcherTimer {
                Interval = new TimeSpan(0, 0, 0, 5)
            };

            importTimer.Tick     += ImportTimerOnTick;
            importTimer.IsEnabled = true;
            importTimer.Start();
        }
Пример #2
0
        public void OnInitialize()
        {
            Logger.DBLog.DebugFormat("fBaseXtensions OnInitialize Started");

            if (File.Exists(FolderPaths.PluginPath + @"\CombatRoutine.cs"))
            {
                try
                {
                    if (File.Exists(FolderPaths.RoutinePath + @"\CombatRoutine.cs"))
                    {
                        File.Delete(FolderPaths.RoutinePath + @"\CombatRoutine.cs");
                    }

                    File.Copy(FolderPaths.PluginPath + @"\CombatRoutine.cs", FolderPaths.RoutinePath + @"\CombatRoutine.cs");
                    Logger.DBLog.DebugFormat("fBaseXtensions Copied Combat Routine");
                }
                catch (Exception ex)
                {
                    Logger.DBLog.DebugFormat("fBaseXtensions Copy Combat Routine Threw Exception", ex);
                }
            }

            Settings = new PluginSettings();
            PluginSettings.LoadSettings();
            TheCache.ObjectIDCache = new IDCache();
            CharacterControl.OrginalGameDifficultySetting = CharacterSettings.Instance.GameDifficulty;
            BotMain.OnStart += EventHandling.OnBotStart;
            BotMain.OnStop  += EventHandling.OnBotStop;
            CustomConditions.Initialize();
            ObjectCache.FakeCacheObject = new CacheObject(Vector3.Zero, TargetType.None, 0d, "Fake Target", 1f);
            CharacterSettings.Instance.PropertyChanged += CharacterControl.OnDBCharacterSettingPropertyChanged;
            Logger.Write("Init Logger Completed!");
            Logger.DBLog.DebugFormat("fBaseXtensions OnInitialize Finished");
        }
Пример #3
0
        public MainConfig()
        {
            InitializeComponent();
            this.Text = "Trailers v" + PluginSettings.Version;

            PluginSettings.PerformMaintenance();
            PluginSettings.LoadSettings();

            // Populate settings
            PopulateSearchProviderSettings();
            PopulateGeneralSettings();
            PopulateLocalTrailerSettings();
            PopulateManualSearchSettings();
            PopulateAutoDownloadSettings();

            // Enable / Disable Controls States
            SetLocalSearchControlsEnabledState();
            SetManualSearchControlsEnabledState();
        }
        public void OnLoad()
        {
            Settings = PluginSettings.LoadSettings(PluginDataDir);

            MainMenuItem = new PluginMenuItem {
                Header = Name
            };
            MainMenuItem.Click += (sender, args) =>
            {
                if (MainWindow == null)
                {
                    InitializeMainWindow();
                    Debug.Assert(MainWindow != null, "_mainWindow != null");
                    MainWindow.Show();
                }
                else
                {
                    MainWindow.Activate();
                }
            };
        }
        public void OnLoad()
        {
            DefaultDataUpdater.PerformUpdates();

            Settings = PluginSettings.LoadSettings(PluginDataDir);

            // initialize image for icon
            var img = new Image();
            var bmp = new BitmapImage();

            bmp.BeginInit();
            bmp.UriSource = new Uri(@"pack://application:,,,/HearthstoneCollectionTracker;component/Internal/HSCollection.ico", UriKind.RelativeOrAbsolute);
            bmp.EndInit();

            img.Source = bmp;
            img.Width  = bmp.PixelWidth;

            MainMenuItem = new MenuItem
            {
                Header = Name,
                Icon   = img
            };

            MainMenuItem.Click += (sender, args) =>
            {
                if (_mainWindow == null)
                {
                    InitializeMainWindow();
                    _mainWindow.Show();
                }
                else
                {
                    _mainWindow.Activate();
                }
            };

            Hearthstone_Deck_Tracker.API.DeckManagerEvents.OnDeckCreated.Add(HandleHearthstoneDeckUpdated);
            Hearthstone_Deck_Tracker.API.DeckManagerEvents.OnDeckUpdated.Add(HandleHearthstoneDeckUpdated);
        }
        public void OnLoad()
        {
            DefaultDataUpdater.PerformUpdates();

            Settings = PluginSettings.LoadSettings(PluginDataDir);

            MainMenuItem        = new PluginMenuItem();
            MainMenuItem.Header = Name;
            MainMenuItem.Click += (sender, args) =>
            {
                if (_mainWindow == null)
                {
                    InitializeMainWindow();
                    _mainWindow.Show();
                }
                else
                {
                    _mainWindow.Activate();
                }
            };

            Hearthstone_Deck_Tracker.API.DeckManagerEvents.OnDeckCreated.Add(HandleHearthstoneDeckUpdated);
            Hearthstone_Deck_Tracker.API.DeckManagerEvents.OnDeckUpdated.Add(HandleHearthstoneDeckUpdated);
        }
Пример #7
0
        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);
        }