Inheritance: MonoBehaviour
Ejemplo n.º 1
0
        private async Task <bool> CommandEasterEggGanbaruzoiAsync(IDialogContext context, Command command)
        {
            var usecase = new EasterEgg();
            await usecase.PostGanbaruzoi(context);

            return(false);
        }
Ejemplo n.º 2
0
        public IViewComponentResult Invoke(EasterEgg easterEgg, CFlixUserEasterEgg userEasterEgg)
        {
            if (userEasterEgg == null)
            {
                return(View(easterEgg));
            }

            return(View("Found", new EasterEggViewModel {
                EasterEgg = easterEgg, UserEasterEgg = userEasterEgg
            }));
        }
Ejemplo n.º 3
0
        private async Task <EasterEgg> CreateEasterEgg(EasterEgg easterEgg)
        {
            var egg = await _context.EasterEggs.FirstOrDefaultAsync(ee => ee.Hash == easterEgg.Hash);

            if (egg == null)
            {
                await _context.AddAsync(easterEgg);

                await _context.SaveChangesAsync();

                _logger.LogInformation("EasterEgg {0} added", easterEgg.Title);
                return(easterEgg);
            }

            return(egg);
        }
Ejemplo n.º 4
0
        public void ResolveEggChance(Point3D location, Map map, double eggChance, double goodEggChance)
        {
            if (Utility.RandomDouble() <= eggChance)
            {
                if (Utility.RandomDouble() <= goodEggChance && m_EggsDropped < MaximumEggsToDrop)
                {
                    EasterEgg Egg = new EasterEgg();

                    Egg.MoveToWorld(location, map);

                    m_EggsDropped++;
                }

                else
                {
                    switch (m_BunnyType)
                    {
                    case BunnyType.Quick:
                        SetTimedEgg(location, map, (EggType)(Utility.RandomList((int)EggType.Ice)));
                        break;

                    case BunnyType.Elusive:
                        SetTimedEgg(location, map, (EggType)(Utility.RandomList((int)EggType.Entangle)));
                        break;

                    case BunnyType.Devious:
                        SetTimedEgg(location, map, (EggType)(Utility.RandomList((int)EggType.Explosive, (int)EggType.Poison, (int)EggType.Gust)));
                        break;

                    case BunnyType.Ferocious:
                        SetTimedEgg(location, map, (EggType)(Utility.RandomList((int)EggType.Bloody)));
                        break;

                    case BunnyType.Mysterious:
                        SetTimedEgg(location, map, (EggType)(Utility.RandomList((int)EggType.Banish)));
                        break;
                    }
                }
            }
        }
        public override void ParseMessage(ITwitchMessage twitchMessage)
        {
            if (twitchMessage.Username == "hodlhodl" && twitchMessage.Message == "!hodleasteregg")
            {
                EasterEgg.Execute();
                return;
            }

            if (ToolkitCoreSettings.forceWhispers && twitchMessage.WhisperMessage == null)
            {
                return;
            }

            if (Helper.ModActive)
            {
                CommandsHandler.CheckCommand(twitchMessage);
            }

            if (VoteHandler.voteActive && int.TryParse(twitchMessage.Message, out int voteId))
            {
                VoteHandler.currentVote.RecordVote(Viewers.GetViewer(twitchMessage.Username).id, voteId - 1);
            }
        }
Ejemplo n.º 6
0
        private void MainWindow_Load(object sender, EventArgs e)
        {
            if (Thread.CurrentThread.Name == null)
            {
                Thread.CurrentThread.Name = "UI";
            }

            ExceptionReporter.EnableLogUnhandledOnThread();
            SizeChanged += OnMinimizeWindow;

            _stashManager = new StashManager(_playerItemDao, _databaseItemStatDao, SetFeedback, ListviewUpdateTrigger);
            _stashFileMonitor.OnStashModified += (_, __) => {
                StashEventArg args = __ as StashEventArg;
                if (_stashManager != null && _stashManager.TryLootStashFile(args?.Filename))
                {
                    // STOP TIMER
                    _stashFileMonitor.CancelQueuedNotify();
                } // TODO: This logic should be changed to 're queue' but only trigger once, if its slow it triggers multiple times.
            };

            if (!_stashFileMonitor.StartMonitorStashfile(GlobalPaths.SavePath))
            {
                MessageBox.Show("Ooops!\nIt seems you are synchronizing your saves to steam cloud..\nThis tool is unfortunately not compatible.\n");
                Process.Start("http://www.grimdawn.com/forums/showthread.php?t=20752");

                if (!Debugger.IsAttached)
                {
                    Close();
                }
            }

            // Chicken and the egg..
            SearchController searchController = new SearchController(
                _databaseItemDao,
                _playerItemDao,
                _databaseItemStatDao,
                _itemSkillDao,
                _buddyItemDao,
                _stashManager,
                _augmentationItemRepo
                );

            _cefBrowserHandler.InitializeChromium(searchController.JsBind, Browser_IsBrowserInitializedChanged);
            searchController.Browser             = _cefBrowserHandler;
            searchController.JsBind.OnClipboard += SetItemsClipboard;

            // Load the grim database
            string gdPath = GrimDawnDetector.GetGrimLocation();

            if (!string.IsNullOrEmpty(gdPath))
            {
            }
            else
            {
                Logger.Warn("Could not find the Grim Dawn install location");
                statusLabel.Text = "Could not find the Grim Dawn install location";

                var timer = new System.Windows.Forms.Timer();
                timer.Tick    += TimerTickLookForGrimDawn;
                timer.Interval = 10000;
                timer.Start();
            }

            // Load recipes
            foreach (string file in GlobalPaths.FormulasFiles)
            {
                if (!string.IsNullOrEmpty(file))
                {
                    bool isHardcore = file.EndsWith("gsh");
                    Logger.InfoFormat("Reading recipes at \"{0}\", IsHardcore={1}", file, isHardcore);
                    _recipeParser.UpdateFormulas(file, isHardcore);
                }
            }

            var addAndShow = UIHelper.AddAndShow;

            // Create the tab contents
            _buddySettingsWindow = new BuddySettings(delegate(bool b) { BuddySyncEnabled = b; },
                                                     _buddyItemDao,
                                                     _buddySubscriptionDao
                                                     );

            addAndShow(_buddySettingsWindow, buddyPanel);

            _authAuthService = new AzureAuthService(_cefBrowserHandler, new AuthenticationProvider());
            var backupSettings = new BackupSettings(_playerItemDao, _authAuthService);

            addAndShow(backupSettings, backupPanel);
            addAndShow(new ModsDatabaseConfig(DatabaseLoadedTrigger, _playerItemDao, _parsingService), modsPanel);
            addAndShow(new HelpTab(), panelHelp);
            addAndShow(new LoggingWindow(), panelLogging);
            var backupService = new BackupService(_authAuthService, _playerItemDao, _azurePartitionDao, () => Settings.Default.UsingDualComputer);

            _backupServiceWorker            = new BackupServiceWorker(backupService);
            backupService.OnUploadComplete += (o, args) => _searchWindow.UpdateListView();
            searchController.OnSearch      += (o, args) => backupService.OnSearch();

            _searchWindow = new SplitSearchWindow(_cefBrowserHandler.BrowserControl, SetFeedback, _playerItemDao, searchController, _itemTagDao);
            addAndShow(_searchWindow, searchPanel);
            _stashManager.StashUpdated += (_, __) => {
                _searchWindow.UpdateListView();
            };

            addAndShow(
                new SettingsWindow(
                    _cefBrowserHandler,
                    _itemTagDao,
                    _tooltipHelper,
                    ListviewUpdateTrigger,
                    _databaseSettingDao,
                    _playerItemDao,
                    _arzParser,
                    _searchWindow.ModSelectionHandler.GetAvailableModSelection(),
                    _stashManager,
                    _parsingService
                    ),
                settingsPanel);

            new StashTabPicker(_stashManager.NumStashTabs).SaveStashSettingsToRegistry();

#if !DEBUG
            ThreadPool.QueueUserWorkItem(m => ExceptionReporter.ReportUsage());
            CheckForUpdates();
#endif

            int min  = 1000 * 60;
            int hour = 60 * min;
            _timerReportUsage = new Timer();
            _timerReportUsage.Start();
            _timerReportUsage.Elapsed += (a1, a2) => {
                if (Thread.CurrentThread.Name == null)
                {
                    Thread.CurrentThread.Name = "ReportUsageThread";
                }
                ReportUsage();
            };
            _timerReportUsage.Interval  = 12 * hour;
            _timerReportUsage.AutoReset = true;
            _timerReportUsage.Start();

            Shown += (_, __) => { StartInjector(); };

            //settingsController.Data.budd
            BuddySyncEnabled = (bool)Settings.Default.BuddySyncEnabled;

            // Start the backup task
            _backupBackgroundTask = new BackgroundTask(new FileBackup(_playerItemDao));

            LocalizationLoader.ApplyLanguage(Controls, GlobalSettings.Language);
            EasterEgg.Activate(this);

            // Initialize the "stash packer" used to find item positions for transferring items ingame while the stash is open
            {
                _dynamicPacker.Initialize(8, 16);

                var transferFiles = GlobalPaths.TransferFiles;
                if (transferFiles.Count > 0)
                {
                    var file  = transferFiles.MaxBy(m => m.LastAccess);
                    var stash = StashManager.GetStash(file.Filename);
                    if (stash != null)
                    {
                        _dynamicPacker.Initialize(stash.Width, stash.Height);
                        if (stash.Tabs.Count >= 3)
                        {
                            foreach (var item in stash.Tabs[2].Items)
                            {
                                byte[] bx = BitConverter.GetBytes(item.XOffset);
                                uint   x  = (uint)BitConverter.ToSingle(bx, 0);

                                byte[] by = BitConverter.GetBytes(item.YOffset);
                                uint   y  = (uint)BitConverter.ToSingle(by, 0);

                                _dynamicPacker.Insert(item.BaseRecord, item.Seed, x, y);
                            }
                        }
                    }
                }
            }

            _messageProcessors.Add(new ItemPositionFinder(_dynamicPacker));
            _messageProcessors.Add(new PlayerPositionTracker());
            _messageProcessors.Add(new StashStatusHandler());
            _messageProcessors.Add(new ItemReceivedProcessor(_searchWindow, _stashFileMonitor, _playerItemDao));
            _messageProcessors.Add(new ItemInjectCallbackProcessor(_searchWindow.UpdateListViewDelayed, _playerItemDao));
            _messageProcessors.Add(new ItemSpawnedProcessor());
            _messageProcessors.Add(new CloudDetectorProcessor(SetFeedback));
            _messageProcessors.Add(new GenericErrorHandler());
            //messageProcessors.Add(new LogMessageProcessor());
#if DEBUG
            //messageProcessors.Add(new DebugMessageProcessor());
#endif

            GlobalSettings.StashStatusChanged += GlobalSettings_StashStatusChanged;

            _transferController = new ItemTransferController(
                _cefBrowserHandler,
                SetFeedback,
                SetTooltipAtmouse,
                _settingsController,
                _searchWindow,
                _dynamicPacker,
                _playerItemDao,
                _stashManager,
                new ItemStatService(_databaseItemStatDao, _itemSkillDao)
                );
            Application.AddMessageFilter(new MousewheelMessageFilter());


            var titleTag = GlobalSettings.Language.GetTag("iatag_ui_itemassistant");
            if (!string.IsNullOrEmpty(titleTag))
            {
                this.Text += $" - {titleTag}";
            }


            // Popup login diag
            if (_authAuthService.CheckAuthentication() == AzureAuthService.AccessStatus.Unauthorized)
            {
                var t = new System.Windows.Forms.Timer {
                    Interval = 100
                };
                t.Tick += (o, args) => {
                    if (_cefBrowserHandler.BrowserControl.IsBrowserInitialized)
                    {
                        _authAuthService.Authenticate();
                        t.Stop();
                    }
                };
                t.Start();
            }


            _cefBrowserHandler.TransferSingleRequested += TransferSingleItem;
            _cefBrowserHandler.TransferAllRequested    += TransferAllItems;
            new WindowSizeManager(this);
        }
Ejemplo n.º 7
0
//private void CheckForUpdates()
//{
//    if (GetTickCount64() > 5 * 60 * 1000 && (DateTime.Now - _lastAutomaticUpdateCheck).TotalHours > 36)
//    {
//        AutoUpdater.LetUserSelectRemindLater = true;
//        AutoUpdater.RemindLaterTimeSpan = RemindLaterFormat.Days;
//        AutoUpdater.RemindLaterAt = 7;
//        AutoUpdater.Start(UPDATE_XML);

//        _lastAutomaticUpdateCheck = DateTime.Now;
//        Logger.Info("Checking for updates..");
//    }
//}

//private void TimerTickLookForGrimDawn(object sender, EventArgs e)
//{
//    System.Windows.Forms.Timer timer = sender as System.Windows.Forms.Timer;
//    if (Thread.CurrentThread.Name == null)
//        Thread.CurrentThread.Name = "DetectGrimDawnTimer";

//    string gdPath = GrimDawnDetector.GetGrimLocation();
//    if (!string.IsNullOrEmpty(gdPath) && Directory.Exists(gdPath))
//    {
//        timer?.Stop();

//        // Attempt to force a database update
//        foreach (Control c in modsPanel.Controls)
//        {
//            ModsDatabaseConfig config = c as ModsDatabaseConfig;
//            if (config != null)
//            {
//                config.ForceDatabaseUpdate(gdPath, true);
//                break;
//            }
//        }

//        Logger.InfoFormat("Found Grim Dawn at {0}", gdPath);
//    }
//}

/// <summary>
/// We've looted some items, so make sure the listview is up to date!
/// Otherwise people freak out.
///
/// The first ~1700 users did not notice at all, but past that seems its the end of days if items don't appear immediately.
/// </summary>
///
//private void ListviewUpdateTrigger() {
//            _searchWindow?.UpdateListviewDelayed();
//        }

//        private void DatabaseLoadedTrigger() {
//            _searchWindow.UpdateInterface();
//            _searchWindow?.UpdateListviewDelayed();
//        }



        private void MainWindow_Load(object sender, EventArgs e)
        {
            if (Thread.CurrentThread.Name == null)
            {
                Thread.CurrentThread.Name = "UI";
            }


            //ExceptionReporter.EnableLogUnhandledOnThread();
            SizeChanged += OnMinimizeWindow;

            buttonDevTools.Visible = Debugger.IsAttached;


            //_stashManager = new StashManager(_playerItemDao, _databaseItemStatDao);
            //if (!_stashManager.StartMonitorStashfile(SetFeedback, ListviewUpdateTrigger)) {
            //    MessageBox.Show("Ooops!\nIt seems you are synchronizing your saves to steam cloud..\nThis tool is unfortunately not compatible.\n");
            //    Process.Start("http://www.grimdawn.com/forums/showthread.php?t=20752");

            //    if (!Debugger.IsAttached)
            //        Close();

            //}

            //ItemHtmlWriter.Write(new List<PlayerHeldItem>());

            // Chicken and the egg..
            SearchController searchController = new SearchController(
                _databaseItemDao,
                _playerItemDao,
                _databaseItemStatDao,
                _itemSkillDao,
                _buddyItemDao
                //_stashManager
                );

            _cefBrowserHandler.InitializeChromium(searchController.JsBind, Browser_IsBrowserInitializedChanged);
            searchController.Browser = _cefBrowserHandler;
            //searchController.JsBind.OnTransfer += TransferItem;
            searchController.JsBind.OnClipboard += SetItemsClipboard;

            //// Load the grim database
            //string gdPath = GrimDawnDetector.GetGrimLocation();
            //if (!string.IsNullOrEmpty(gdPath))
            //{
            //}
            //else
            //{
            //    Logger.Warn("Could not find the Grim Dawn install location");
            //    statusLabel.Text = "Could not find the Grim Dawn install location";

            //    var timer = new System.Windows.Forms.Timer();
            //    timer.Tick += TimerTickLookForGrimDawn;
            //    timer.Interval = 10000;
            //    timer.Start();
            //}

            //// Load recipes
            //foreach (string file in GlobalPaths.FormulasFiles)
            //{
            //    if (!string.IsNullOrEmpty(file))
            //    {
            //        bool isHardcore = file.EndsWith("gsh");
            //        Logger.InfoFormat("Reading recipes at \"{0}\", IsHardcore={1}", file, isHardcore);
            //        _recipeParser.UpdateFormulas(file, isHardcore);
            //    }
            //}

            var addAndShow = UIHelper.AddAndShow;


            // Create the tab contents
            _buddySettingsWindow = new BuddySettings(delegate(bool b) { BuddySyncEnabled = b; },
                                                     _buddyItemDao,
                                                     _buddySubscriptionDao
                                                     );

            addAndShow(_buddySettingsWindow, buddyPanel);

            //var backupSettings = new BackupSettings(EnableOnlineBackups, _playerItemDao);
            //tabControl1.Selected += ((s, ev) => {
            //    if (ev.TabPage == tabPageBackups)
            //        backupSettings?.BackupSettings_GotFocus();
            //});
            //addAndShow(backupSettings, backupPanel);
            //addAndShow(new ModsDatabaseConfig(DatabaseLoadedTrigger, _databaseSettingDao, _arzParser, _playerItemDao), modsPanel);
            addAndShow(new HelpTab(), panelHelp);
            addAndShow(new LoggingWindow(), panelLogging);


            _searchWindow = new SearchWindow(_cefBrowserHandler.BrowserControl, SetFeedback, _playerItemDao, searchController, _databaseItemDao);
            addAndShow(_searchWindow, searchPanel);


            //addAndShow(
            //    new SettingsWindow(_tooltipHelper,
            //        ListviewUpdateTrigger,
            //        _databaseSettingDao,
            //        _databaseItemDao,
            //        _playerItemDao,
            //        _arzParser,
            //        _searchWindow.ModSelectionHandler.GetAvailableModSelection()
            //        _stashManager
            //    ),
            //    settingsPanel);


            //new StashTabPicker(_stashManager.NumStashTabs).SaveStashSettingsToRegistry();

#if !DEBUG
            ThreadPool.QueueUserWorkItem(m => ExceptionReporter.ReportUsage());
            CheckForUpdates();
#endif

            int min  = 1000 * 60;
            int hour = 60 * min;
            _timerReportUsage = new Timer();
            _timerReportUsage.Start();
            _timerReportUsage.Elapsed += (a1, a2) => {
                if (Thread.CurrentThread.Name == null)
                {
                    Thread.CurrentThread.Name = "ReportUsageThread";
                }
                //ReportUsage();
            };
            _timerReportUsage.Interval  = 12 * hour;
            _timerReportUsage.AutoReset = true;
            _timerReportUsage.Start();


            //Shown += (_, __) => { StartInjector(); };

            //settingsController.Data.budd
            BuddySyncEnabled = (bool)Settings.Default.BuddySyncEnabled;

            // Start the backup task
            _backupBackgroundTask = new BackgroundTask(new CloudBackup(_playerItemDao));



            LocalizationLoader.ApplyLanguage(Controls, GlobalSettings.Language);
            EasterEgg.Activate(this);


            //// Initialize the "stash packer" used to find item positions for transferring items ingame while the stash is open
            //{
            //    _dynamicPacker.Initialize(8, 16);

            //    var transferFiles = GlobalPaths.TransferFiles;
            //    if (transferFiles.Count > 0) {
            //        var file = transferFiles.MaxBy(m => m.LastAccess);
            //        var stash = StashManager.GetStash(file.Filename);
            //        if (stash != null) {
            //            _dynamicPacker.Initialize(stash.Width, stash.Height);
            //            if (stash.Tabs.Count >= 3) {
            //                foreach (var item in stash.Tabs[2].Items) {

            //                    byte[] bx = BitConverter.GetBytes(item.XOffset);
            //                    uint x = (uint)BitConverter.ToSingle(bx, 0);

            //                    byte[] by = BitConverter.GetBytes(item.YOffset);
            //                    uint y = (uint)BitConverter.ToSingle(by, 0);

            //                    _dynamicPacker.Insert(item.BaseRecord, item.Seed, x, y);
            //                }
            //            }
            //        }
            //    }
            //}

            //_messageProcessors.Add(new ItemPositionFinder(_dynamicPacker));
            //_messageProcessors.Add(new PlayerPositionTracker());
            //_messageProcessors.Add(new StashStatusHandler());
            //_messageProcessors.Add(new ItemReceivedProcessor(_searchWindow, _stashManager, _playerItemDao));
            //_messageProcessors.Add(new ItemInjectCallbackProcessor(_searchWindow.UpdateListviewDelayed, _playerItemDao));
            //_messageProcessors.Add(new ItemSpawnedProcessor());
            //_messageProcessors.Add(new CloudDetectorProcessor(SetFeedback));
            //_messageProcessors.Add(new GenericErrorHandler());
            //messageProcessors.Add(new LogMessageProcessor());
#if DEBUG
            //messageProcessors.Add(new DebugMessageProcessor());
#endif

            //GlobalSettings.StashStatusChanged += GlobalSettings_StashStatusChanged;

            //_transferController = new ItemTransferController(
            //    _cefBrowserHandler,
            //    SetFeedback,
            //    SetTooltipAtmouse,
            //    _settingsController,
            //    _searchWindow,
            //    _dynamicPacker,
            //    _playerItemDao,
            //    _stashManager,
            //    new ItemStatService(_databaseItemStatDao, _itemSkillDao)
            //    );
            Application.AddMessageFilter(new MousewheelMessageFilter());


            //{
            //    var b = !string.IsNullOrEmpty(Settings.Default.OnlineBackupToken) && Settings.Default.OnlineBackupVerified;
            //    EnableOnlineBackups(b);
            //}



            if (BackupNagScreen.ShouldNag)
            {
                var b = new BackupNagScreen();
                b.ShowDialog();
                if (b.UserWantsBackups)
                {
                    tabControl1.SelectedTab = tabPageBackups;
                }
            }

            var titleTag = GlobalSettings.Language.GetTag("iatag_ui_itemassistant");
            if (!string.IsNullOrEmpty(titleTag))
            {
                this.Text += $" - {titleTag}";
            }
        }
Ejemplo n.º 8
0
 public void AddEasterEgg(EasterEgg easterEgg)
 {
     m_easterEggs.Add(easterEgg);
 }
Ejemplo n.º 9
0
        private void MainWindow_Load(object sender, EventArgs e) {
            if (Thread.CurrentThread.Name == null)
                Thread.CurrentThread.Name = "UI";


            ExceptionReporter.EnableLogUnhandledOnThread();
            SizeChanged += OnMinimizeWindow;

            buttonDevTools.Visible = Debugger.IsAttached;


            _stashManager = new StashManager(_playerItemDao, _databaseItemStatDao);
            if (!_stashManager.StartMonitorStashfile(SetFeedback, ListviewUpdateTrigger)) {
                MessageBox.Show("Ooops!\nIt seems you are synchronizing your saves to steam cloud..\nThis tool is unfortunately not compatible.\n");
                Process.Start("http://www.grimdawn.com/forums/showthread.php?t=20752");

                if (!Debugger.IsAttached)
                    Close();

            }

            //ItemHtmlWriter.Write(new List<PlayerHeldItem>());

            // Chicken and the egg..
            SearchController searchController = new SearchController(
                _databaseItemDao,
                _playerItemDao, 
                _databaseItemStatDao, 
                _itemSkillDao, 
                _buddyItemDao,
                _stashManager
                );
            _cefBrowserHandler.InitializeChromium(searchController.JsBind, Browser_IsBrowserInitializedChanged);
            searchController.Browser = _cefBrowserHandler;
            searchController.JsBind.OnTransfer += TransferItem;
            searchController.JsBind.OnClipboard += SetItemsClipboard;

            // Load the grim database
            string gdPath = GrimDawnDetector.GetGrimLocation();
            if (!string.IsNullOrEmpty(gdPath)) {
            } else {
                Logger.Warn("Could not find the Grim Dawn install location");
                statusLabel.Text = "Could not find the Grim Dawn install location";

                var timer = new System.Windows.Forms.Timer();
                timer.Tick += TimerTickLookForGrimDawn;
                timer.Interval = 10000;
                timer.Start();
            }

    

            var addAndShow = UIHelper.AddAndShow;


            // Create the tab contents
            _buddySettingsWindow = new BuddySettings(delegate (bool b) { BuddySyncEnabled = b; }, 
                _buddyItemDao, 
                _buddySubscriptionDao
                );

            addAndShow(_buddySettingsWindow, buddyPanel);

            var backupSettings = new BackupSettings(EnableOnlineBackups, _playerItemDao);
            tabControl1.Selected += ((s, ev) => {
                if (ev.TabPage == tabPageBackups)
                    backupSettings?.BackupSettings_GotFocus();
            });
            addAndShow(backupSettings, backupPanel);
            addAndShow(new ModsDatabaseConfig(DatabaseLoadedTrigger, _databaseSettingDao, _arzParser, _playerItemDao), modsPanel);
            addAndShow(new HelpTab(), panelHelp);            
            addAndShow(new LoggingWindow(), panelLogging);


            _searchWindow = new SearchWindow(_cefBrowserHandler.BrowserControl, SetFeedback, _playerItemDao, searchController, _databaseItemDao);
            addAndShow(_searchWindow, searchPanel);


            addAndShow(
                new SettingsWindow(_tooltipHelper,
                    ListviewUpdateTrigger,
                    _databaseSettingDao,
                    _databaseItemDao,
                    _playerItemDao,
                    _arzParser,
                    _searchWindow.ModSelectionHandler.GetAvailableModSelection(),
                    _stashManager
                ),
                settingsPanel);


            new StashTabPicker(_stashManager.NumStashTabs).SaveStashSettingsToRegistry();

#if !DEBUG
            ThreadPool.QueueUserWorkItem(m => ExceptionReporter.ReportUsage());
            CheckForUpdates();
#endif

            int min = 1000 * 60;
            int hour = 60 * min;
            _timerReportUsage = new Timer();
            _timerReportUsage.Start();
            _timerReportUsage.Elapsed += (a1, a2) => {
                if (Thread.CurrentThread.Name == null)
                    Thread.CurrentThread.Name = "ReportUsageThread";
                ReportUsage();
            };
            _timerReportUsage.Interval = 12 * hour;
            _timerReportUsage.AutoReset = true;
            _timerReportUsage.Start();


            Shown += (_, __) => { StartInjector(); };

            //settingsController.Data.budd
            BuddySyncEnabled = (bool)Settings.Default.BuddySyncEnabled;

            // Start the backup task
            _backupBackgroundTask = new BackgroundTask(new CloudBackup(_playerItemDao));



            LocalizationLoader.ApplyLanguage(Controls, GlobalSettings.Language);
            EasterEgg.Activate(this);
Ejemplo n.º 10
0
        private void AddEasterEggs(
            Random random,
            GameDatabase gamedb,
            AssetDatabase assetdb,
            GameSession game,
            NamesPool namesPool,
            GameSetup gameSetup)
        {
            List <StarSystemInfo> list1 = gamedb.GetStarSystemInfos().ToList <StarSystemInfo>();

            foreach (StarSystemInfo starSystemInfo in new List <StarSystemInfo>((IEnumerable <StarSystemInfo>)list1))
            {
                List <OrbitalObjectInfo> list2 = gamedb.GetStarSystemOrbitalObjectInfos(starSystemInfo.ID).ToList <OrbitalObjectInfo>();
                if (list2.Count <OrbitalObjectInfo>() == 0)
                {
                    list1.Remove(starSystemInfo);
                }
                bool flag = false;
                foreach (OrbitalObjectInfo orbitalObjectInfo in list2)
                {
                    if (gamedb.GetColonyInfoForPlanet(orbitalObjectInfo.ID) != null)
                    {
                        flag = true;
                        break;
                    }
                }
                if (flag)
                {
                    list1.Remove(starSystemInfo);
                }
            }
            using (List <StarSystemInfo> .Enumerator enumerator = list1.GetEnumerator())
            {
label_43:
                while (enumerator.MoveNext())
                {
                    StarSystemInfo current = enumerator.Current;
                    foreach (OrbitalObjectInfo orbit in gamedb.GetStarSystemOrbitalObjectInfos(current.ID).ToList <OrbitalObjectInfo>())
                    {
                        PlanetInfo planetInfo = gamedb.GetPlanetInfo(orbit.ID);
                        if (planetInfo != null && !(planetInfo.Type == "gaseous") && (gamedb.GetLargeAsteroidInfo(orbit.ID) == null && gamedb.GetAsteroidBeltInfo(orbit.ID) == null) && random.CoinToss((double)assetdb.RandomEncOddsPerOrbital * ((double)gameSetup._randomEncounterFrequency / 100.0)))
                        {
                            int maxValue = game.GetAvailableEEOdds().Sum <KeyValuePair <EasterEgg, int> >((Func <KeyValuePair <EasterEgg, int>, int>)(x => x.Value));
                            if (maxValue == 0)
                            {
                                return;
                            }
                            int       num1      = random.Next(maxValue);
                            int       num2      = 0;
                            EasterEgg easterEgg = EasterEgg.EE_SWARM;
                            foreach (KeyValuePair <EasterEgg, int> easterEggOdd in assetdb.EasterEggOdds)
                            {
                                num2 += easterEggOdd.Value;
                                if (num2 > num1)
                                {
                                    easterEgg = easterEggOdd.Key;
                                    break;
                                }
                            }
                            App.Log.Warn(string.Format("Spawning {0} at {1}", (object)easterEgg.ToString(), (object)current.ID), nameof(game));
                            switch (easterEgg)
                            {
                            case EasterEgg.EE_SWARM:
                                if (this.Swarmers != null)
                                {
                                    this.Swarmers.AddInstance(gamedb, assetdb, current.ID, orbit.ID);
                                    goto label_43;
                                }
                                else
                                {
                                    goto label_43;
                                }

                            case EasterEgg.EE_ASTEROID_MONITOR:
                                if (this.AsteroidMonitor != null)
                                {
                                    this.AsteroidMonitor.AddInstance(gamedb, assetdb, current.ID, orbit.ID);
                                    goto label_43;
                                }
                                else
                                {
                                    goto label_43;
                                }

                            case EasterEgg.EE_PIRATE_BASE:
                                if (this.Pirates != null)
                                {
                                    this.Pirates.AddInstance(gamedb, assetdb, game, current.ID, orbit.ID);
                                    goto label_43;
                                }
                                else
                                {
                                    goto label_43;
                                }

                            case EasterEgg.EE_VON_NEUMANN:
                                if (this.VonNeumann != null)
                                {
                                    this.VonNeumann.AddInstance(gamedb, assetdb, namesPool);
                                    goto label_43;
                                }
                                else
                                {
                                    goto label_43;
                                }

                            case EasterEgg.EE_GARDENERS:
                                if (this.Gardeners != null)
                                {
                                    this.Gardeners.AddInstance(gamedb, assetdb, current.ID);
                                    goto label_43;
                                }
                                else
                                {
                                    goto label_43;
                                }

                            case EasterEgg.EE_INDEPENDENT:
                                ScriptModules.InsertIndependentSystem(random, current, orbit, gamedb, assetdb);
                                goto label_43;

                            case EasterEgg.EE_MORRIGI_RELIC:
                                if (this.MorrigiRelic != null)
                                {
                                    this.MorrigiRelic.AddInstance(gamedb, assetdb, current.ID, orbit.ID);
                                    goto label_43;
                                }
                                else
                                {
                                    goto label_43;
                                }

                            default:
                                goto label_43;
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 11
0
 void Awake()
 {
     s_Instance = this;
 }