Beispiel #1
0
        private static void GameEvents_OnGameChanged(object sender, EventArgs e)
        {
            ClearCachesOnGameChange(sender, e);

            // reload the profile juuuuuuuuuuuust in case Demonbuddy missed it... which it is known to do on disconnects
            //string currentProfilePath = ProfileManager.CurrentProfile.Path;
            //ProfileManager.Load(currentProfilePath);
            //Navigator.SearchGridProvider.Update();
            ResetEverythingNewGame();
            UsedProfileManager.SetProfileInWindowTitle();
        }
Beispiel #2
0
        /// <summary>
        /// This is wired up by Plugin.OnEnabled, and called when the bot is started
        /// </summary>
        /// <param name="bot"></param>
        private static void TrinityBotStart(IBot bot)
        {
            Logger.Log("Bot Starting");
            DateTime timeBotStart = DateTime.UtcNow;

            V.ValidateLoad();

            // Recording of all the XML's in use this run
            try
            {
                string sThisProfile = GlobalSettings.Instance.LastProfile;
                if (sThisProfile != CurrentProfile)
                {
                    ProfileHistory.Add(sThisProfile);
                    CurrentProfile = sThisProfile;
                    if (FirstProfile == "")
                    {
                        FirstProfile = sThisProfile;
                    }
                }

                DebugUtil.LogSystemInformation();
            }
            catch
            {
            }

            if (!ItemDropStats.MaintainStatTracking)
            {
                ItemDropStats.ItemStatsWhenStartedBot   = DateTime.UtcNow;
                ItemDropStats.ItemStatsLastPostedReport = DateTime.UtcNow;
                ItemDropStats.MaintainStatTracking      = true;
            }
            else
            {
                Logger.Log(TrinityLogLevel.Info, LogCategory.UserInformation,
                           "Note: Maintaining item stats from previous run. To reset stats fully, please restart DB.");
            }

            TrinityItemManager.ResetBackPackCheck();

            BeginInvoke(UsedProfileManager.RefreshProfileBlacklists);
            UsedProfileManager.SetProfileInWindowTitle();

            BotManager.ReplaceTreeHooks();
            TreeHooks.Instance.OnHooksCleared += BotManager.InstanceOnOnHooksCleared;


            PlayerMover.TimeLastRecordedPosition = DateTime.UtcNow;
            PlayerMover.LastRestartedGame        = DateTime.UtcNow;
            Logger.Log("Bot Starting, Resetting Gold Inactivity Timer");
            GoldInactivity.Instance.ResetCheckGold();
            XpInactivity.Instance.ResetCheckXp();

            if (CharacterSettings.Instance.KillRadius < 20)
            {
                Logger.Log("WARNING: Low Kill Radius detected, currently set to: {0} (you can change this through Demonbuddy bot settings)",
                           CharacterSettings.Instance.KillRadius);
            }

            if (CharacterSettings.Instance.LootRadius < 50)
            {
                Logger.Log("WARNING: Low Gold Loot Radius detected, currently set to: {0} (you can change this through Demonbuddy bot settings)",
                           CharacterSettings.Instance.LootRadius);
            }

            if (Settings.Loot.ItemFilterMode == ItemFilterMode.TrinityWithItemRules)
            {
                try
                {
                    if (StashRule == null)
                    {
                        StashRule = new Interpreter();
                    }
                }
                catch (Exception ex)
                {
                    Logger.LogError("Error configuring ItemRules Interpreter: " + ex);
                }
            }

            Logger.LogDebug("Trinity BotStart took {0:0}ms", DateTime.UtcNow.Subtract(timeBotStart).TotalMilliseconds);
        }