private static void ClearBlacklists() { // Clear the temporary blacklist every 90 seconds (default was 90) if (DateTime.Now.Subtract(dateSinceBlacklist90Clear).TotalSeconds > 90) { dateSinceBlacklist90Clear = DateTime.Now; hashRGUIDBlacklist90 = new HashSet <int>(); // Refresh profile blacklists now, just in case UsedProfileManager.RefreshProfileBlacklists(); } // Clear the full blacklist every 60 seconds (default was 60) if (DateTime.Now.Subtract(dateSinceBlacklist60Clear).TotalSeconds > 60) { dateSinceBlacklist60Clear = DateTime.Now; hashRGUIDBlacklist60 = new HashSet <int>(); } // Clear the temporary blacklist every 15 seconds (default was 15) if (DateTime.Now.Subtract(dateSinceBlacklist15Clear).TotalSeconds > 15) { dateSinceBlacklist15Clear = DateTime.Now; hashRGUIDBlacklist15 = new HashSet <int>(); } // Clear our very short-term ignore-monster blacklist (from not being able to raycast on them or already dead units) if (DateTime.Now.Subtract(dateSinceBlacklist3Clear).TotalMilliseconds > 3000) { dateSinceBlacklist3Clear = DateTime.Now; NeedToClearBlacklist3 = false; hashRGUIDBlacklist3 = new HashSet <int>(); } }
/// <summary> /// Receive Pulse event from DemonBuddy. /// </summary> public void OnPulse() { try { if (ZetaDia.Me == null) { return; } if (!ZetaDia.IsInGame || !ZetaDia.Me.IsValid || ZetaDia.IsLoadingWorld) { return; } // hax for sending notifications after a town run if (!Zeta.CommonBot.Logic.BrainBehavior.IsVendoring && !PlayerStatus.IsInTown) { TownRun.SendEmailNotification(); TownRun.SendMobileNotifications(); } // See if we should update the stats file if (DateTime.Now.Subtract(ItemStatsLastPostedReport).TotalSeconds > 10) { ItemStatsLastPostedReport = DateTime.Now; OutputReport(); } // Recording of all the XML's in use this run UsedProfileManager.RecordProfile(); Monk_MaintainTempestRush(); } catch (Exception ex) { DbHelper.Log(LogCategory.UserInformation, "Exception in Pulse: {0}", ex.ToString()); } }
/// <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) { // Recording of all the XML's in use this run try { string sThisProfile = Zeta.CommonBot.Settings.GlobalSettings.Instance.LastProfile; if (sThisProfile != CurrentProfile) { listProfilesLoaded.Add(sThisProfile); CurrentProfile = sThisProfile; if (FirstProfile == "") { FirstProfile = sThisProfile; } } } catch { } // Update actors if possible (if already in-game) if (ZetaDia.IsInGame && !ZetaDia.IsLoadingWorld && ZetaDia.Actors != null) { ZetaDia.Actors.Update(); NavHelper.UpdateSearchGridProvider(true); } HasMappedPlayerAbilities = false; if (!bMaintainStatTracking) { ItemStatsWhenStartedBot = DateTime.Now; ItemStatsLastPostedReport = DateTime.Now; bMaintainStatTracking = true; } else { DbHelper.Log(TrinityLogLevel.Normal, LogCategory.UserInformation, "Note: Maintaining item stats from previous run. To reset stats fully, please restart DB."); } UsedProfileManager.RefreshProfileBlacklists(); ReplaceTreeHooks(); PlayerMover.TimeLastRecordedPosition = DateTime.Now; PlayerMover.timeLastRestartedGame = DateTime.Now; GoldInactivity.ResetCheckGold(); if (Zeta.CommonBot.Settings.CharacterSettings.Instance.KillRadius < 20) { DbHelper.Log(TrinityLogLevel.Normal, LogCategory.UserInformation, "WARNING: Low Kill Radius detected, currently set to: {0} (you can change this through Demonbuddy bot settings)", Zeta.CommonBot.Settings.CharacterSettings.Instance.KillRadius); } if (Zeta.CommonBot.Settings.CharacterSettings.Instance.LootRadius < 50) { DbHelper.Log(TrinityLogLevel.Normal, LogCategory.UserInformation, "WARNING: Low Gold Loot Radius detected, currently set to: {0} (you can change this through Demonbuddy bot settings)", Zeta.CommonBot.Settings.CharacterSettings.Instance.LootRadius); } if (StashRule == null) { StashRule = new ItemRules.Interpreter(); } StashRule.readConfiguration(); }