public void Update() { _timeLeft -= Time.deltaTime; settingsForm.UpdateProgressBar((int)Math.Floor(_timeLeft / 10 * 100)); if (Input.GetKeyDown(KeyCode.F1)) { if (!settingsForm.Visible) { settingsForm.Show(); } settingsForm.BringToFront(); } if (Input.GetKeyDown(KeyCode.F2)) { Settings.GlobalEnabled = !Settings.GlobalEnabled; settingsForm.UpdateActive(Settings.GlobalEnabled); } if (Input.GetKeyDown(KeyCode.F3)) { QuickSave(); } if (Input.GetKeyDown(KeyCode.F7)) { QuickLoad(); } if (Input.GetKeyDown(KeyCode.F4)) { Settings.AutoQuestITOPOD = !Settings.AutoQuestITOPOD; settingsForm.UpdateITOPOD(Settings.AutoQuestITOPOD); } if (Input.GetKeyDown(KeyCode.F5)) { DumpEquipped(); } if (Input.GetKeyDown(KeyCode.F8)) { if (Settings.QuickLoadout.Length > 0) { if (_tempSwapped) { Log("Restoring Previous Loadout"); LoadoutManager.RestoreTempLoadout(); } else { Log("Equipping Quick Loadout"); LoadoutManager.SaveTempLoadout(); LoadoutManager.ChangeGear(Settings.QuickLoadout); } } if (Settings.QuickDiggers.Length > 0) { if (_tempSwapped) { Log("Equipping Previous Diggers"); DiggerManager.RestoreTempDiggers(); } else { Log("Equipping Quick Diggers"); DiggerManager.SaveTempDiggers(); DiggerManager.EquipDiggers(Settings.QuickDiggers); } } _tempSwapped = !_tempSwapped; } // F11 reserved for testing //if (Input.GetKeyDown(KeyCode.F11)) //{ // Character.realExp += 10000; //} }
public void Start() { _dir = Path.Combine(Environment.ExpandEnvironmentVariables("%userprofile%/Desktop"), "NGUInjector"); if (!Directory.Exists(_dir)) { Directory.CreateDirectory(_dir); } var logDir = Path.Combine(_dir, "logs"); if (!Directory.Exists(logDir)) { Directory.CreateDirectory(logDir); } OutputWriter = new StreamWriter(Path.Combine(logDir, "inject.log")) { AutoFlush = true }; LootWriter = new StreamWriter(Path.Combine(logDir, "loot.log")) { AutoFlush = true }; CombatWriter = new StreamWriter(Path.Combine(logDir, "combat.log")) { AutoFlush = true }; AllocationWriter = new StreamWriter(Path.Combine(logDir, "allocation.log")) { AutoFlush = true }; PitSpinWriter = new StreamWriter(Path.Combine(logDir, "pitspin.log"), true) { AutoFlush = true }; try { Character = FindObjectOfType <Character>(); Log("Injected"); LogLoot("Starting Loot Writer"); LogCombat("Starting Combat Writer"); LogAllocation("Started Allocation Writer"); Controller = Character.inventoryController; PlayerController = FindObjectOfType <PlayerController>(); _invManager = new InventoryManager(); _yggManager = new YggdrasilManager(); _questManager = new QuestManager(); _combManager = new CombatManager(); LoadoutManager.ReleaseLock(); DiggerManager.ReleaseLock(); Settings = new SavedSettings(_dir); if (!Settings.LoadSettings()) { var temp = new SavedSettings(null) { PriorityBoosts = new int[] { }, YggdrasilLoadout = new int[] { }, SwapYggdrasilLoadouts = true, HighestAKZone = 0, SwapTitanLoadouts = true, TitanLoadout = new int[] { }, ManageDiggers = true, ManageYggdrasil = true, ManageEnergy = true, ManageMagic = true, ManageInventory = true, ManageGear = true, AutoConvertBoosts = true, SnipeZone = 0, FastCombat = false, PrecastBuffs = true, AutoFight = false, AutoQuest = true, AutoQuestITOPOD = false, AllowMajorQuests = false, GoldDropLoadout = new int[] {}, AutoMoneyPit = false, AutoSpin = false, MoneyPitLoadout = new int[] {}, AutoRebirth = false, ManageWandoos = false, InitialGoldZone = -1, MoneyPitThreshold = 1e5, NextGoldSwap = false, BoostBlacklist = new int[] {}, GoldZone = 0, CombatMode = 0, RecoverHealth = false, SnipeBossOnly = true, AllowZoneFallback = false, QuestFastCombat = true, AbandonMinors = false, MinorAbandonThreshold = 30, QuestCombatMode = 0, AutoBuyEM = false, AutoSpellSwap = false, CounterfeitThreshold = 400, SpaghettiThreshold = 30, BloodNumberThreshold = 1e10, CubePriority = 0, CombatEnabled = false, GlobalEnabled = true, QuickDiggers = new int[] {}, QuickLoadout = new int[] {}, UseButterMajor = false, ManualMinors = false, UseButterMinor = false, ActivateFruits = true, ManageR3 = true, WishPriorities = new int[] {}, BeastMode = true }; Settings.MassUpdate(temp); Log($"Created default settings"); } settingsForm = new SettingsForm(); _profile = new CustomAllocation(_dir); _profile.ReloadAllocation(); ConfigWatcher = new FileSystemWatcher { Path = _dir, Filter = "settings.json", NotifyFilter = NotifyFilters.LastWrite, EnableRaisingEvents = true }; ConfigWatcher.Changed += (sender, args) => { if (IgnoreNextChange) { IgnoreNextChange = false; return; } Settings.LoadSettings(); settingsForm.UpdateFromSettings(Settings); }; AllocationWatcher = new FileSystemWatcher { Path = _dir, Filter = "allocation.json", NotifyFilter = NotifyFilters.LastWrite, EnableRaisingEvents = true }; AllocationWatcher.Changed += (sender, args) => { LoadAllocation(); }; Settings.SaveSettings(); Settings.LoadSettings(); settingsForm.UpdateFromSettings(Settings); settingsForm.Show(); InvokeRepeating("AutomationRoutine", 0.0f, 10.0f); InvokeRepeating("SnipeZone", 0.0f, .1f); InvokeRepeating("MonitorLog", 0.0f, 1f); InvokeRepeating("QuickStuff", 0.0f, .5f); InvokeRepeating("ShowBoostProgress", 0.0f, 60.0f); } catch (Exception e) { Log(e.Message); Log(e.StackTrace); } }
public void Start() { try { _dir = Path.Combine(Environment.ExpandEnvironmentVariables("%userprofile%/Desktop"), "NGUInjector"); if (!Directory.Exists(_dir)) { Directory.CreateDirectory(_dir); } var logDir = Path.Combine(_dir, "logs"); if (!Directory.Exists(logDir)) { Directory.CreateDirectory(logDir); } OutputWriter = new StreamWriter(Path.Combine(logDir, "inject.log")) { AutoFlush = true }; LootWriter = new StreamWriter(Path.Combine(logDir, "loot.log")) { AutoFlush = true }; CombatWriter = new StreamWriter(Path.Combine(logDir, "combat.log")) { AutoFlush = true }; AllocationWriter = new StreamWriter(Path.Combine(logDir, "allocation.log")) { AutoFlush = true }; PitSpinWriter = new StreamWriter(Path.Combine(logDir, "pitspin.log"), true) { AutoFlush = true }; _profilesDir = Path.Combine(_dir, "profiles"); if (!Directory.Exists(_profilesDir)) { Directory.CreateDirectory(_profilesDir); } var oldPath = Path.Combine(_dir, "allocation.json"); var newPath = Path.Combine(_profilesDir, "default.json"); if (File.Exists(oldPath) && !File.Exists(newPath)) { File.Move(oldPath, newPath); } } catch (Exception e) { Log(e.Message); Log(e.StackTrace); Loader.Unload(); return; } try { Character = FindObjectOfType <Character>(); Log("Injected"); LogLoot("Starting Loot Writer"); LogCombat("Starting Combat Writer"); Controller = Character.inventoryController; PlayerController = FindObjectOfType <PlayerController>(); _invManager = new InventoryManager(); _yggManager = new YggdrasilManager(); _questManager = new QuestManager(); _combManager = new CombatManager(); LoadoutManager.ReleaseLock(); DiggerManager.ReleaseLock(); Settings = new SavedSettings(_dir); if (!Settings.LoadSettings()) { var temp = new SavedSettings(null) { PriorityBoosts = new int[] { }, YggdrasilLoadout = new int[] { }, SwapYggdrasilLoadouts = false, HighestAKZone = 0, SwapTitanLoadouts = false, TitanLoadout = new int[] { }, ManageDiggers = true, ManageYggdrasil = true, ManageEnergy = true, ManageMagic = true, ManageInventory = true, ManageGear = true, AutoConvertBoosts = true, SnipeZone = 0, FastCombat = false, PrecastBuffs = true, AutoFight = false, AutoQuest = false, AutoQuestITOPOD = false, AllowMajorQuests = false, GoldDropLoadout = new int[] {}, AutoMoneyPit = false, AutoSpin = false, MoneyPitLoadout = new int[] {}, AutoRebirth = false, ManageWandoos = false, MoneyPitThreshold = 1e5, DoGoldSwap = false, BoostBlacklist = new int[] {}, CombatMode = 0, RecoverHealth = false, SnipeBossOnly = true, AllowZoneFallback = false, QuestFastCombat = true, AbandonMinors = false, MinorAbandonThreshold = 30, QuestCombatMode = 0, AutoBuyEM = false, AutoSpellSwap = false, CounterfeitThreshold = 400, SpaghettiThreshold = 30, BloodNumberThreshold = 1e10, CastBloodSpells = false, IronPillThreshold = 10000, BloodMacGuffinAThreshold = 6, BloodMacGuffinBThreshold = 6, CubePriority = 0, CombatEnabled = false, GlobalEnabled = false, QuickDiggers = new int[] {}, QuickLoadout = new int[] {}, UseButterMajor = false, ManualMinors = false, UseButterMinor = false, ActivateFruits = false, ManageR3 = true, WishPriorities = new int[] {}, BeastMode = true, ManageNGUDiff = true, AllocationFile = "default", TitanGoldTargets = new bool[ZoneHelpers.TitanZones.Length], ManageGoldLoadouts = false, ResnipeTime = 3600, TitanMoneyDone = new bool[ZoneHelpers.TitanZones.Length], TitanSwapTargets = new bool[ZoneHelpers.TitanZones.Length], GoldCBlockMode = false, DebugAllocation = false, AdventureTargetITOPOD = false, ITOPODRecoverHP = false, ITOPODCombatMode = 0, ITOPODBeastMode = true, ITOPODFastCombat = true, ITOPODPrecastBuffs = false, DisableOverlay = false, OptimizeITOPODFloor = false, YggSwapThreshold = 1, UpgradeDiggers = true }; Settings.MassUpdate(temp); Log($"Created default settings"); } settingsForm = new SettingsForm(); if (string.IsNullOrEmpty(Settings.AllocationFile)) { Settings.SetSaveDisabled(true); Settings.AllocationFile = "default"; Settings.SetSaveDisabled(false); } if (Settings.TitanGoldTargets == null || Settings.TitanGoldTargets.Length == 0) { Settings.SetSaveDisabled(true); Settings.TitanGoldTargets = new bool[ZoneHelpers.TitanZones.Length]; Settings.SetSaveDisabled(false); } if (Settings.TitanMoneyDone == null || Settings.TitanMoneyDone.Length == 0) { Settings.SetSaveDisabled(true); Settings.TitanMoneyDone = new bool[ZoneHelpers.TitanZones.Length]; Settings.SetSaveDisabled(false); } if (Settings.TitanSwapTargets == null || Settings.TitanSwapTargets.Length == 0) { Settings.SetSaveDisabled(true); Settings.TitanSwapTargets = new bool[ZoneHelpers.TitanZones.Length]; Settings.SetSaveDisabled(false); } LoadAllocation(); LoadAllocationProfiles(); ZoneWatcher = new FileSystemWatcher { Path = _dir, Filter = "zoneOverride.json", NotifyFilter = NotifyFilters.LastWrite, EnableRaisingEvents = true }; ZoneWatcher.Changed += (sender, args) => { Log(_dir); ZoneStatHelper.CreateOverrides(_dir); }; ConfigWatcher = new FileSystemWatcher { Path = _dir, Filter = "settings.json", NotifyFilter = NotifyFilters.LastWrite, EnableRaisingEvents = true }; ConfigWatcher.Changed += (sender, args) => { if (IgnoreNextChange) { IgnoreNextChange = false; return; } Settings.LoadSettings(); settingsForm.UpdateFromSettings(Settings); LoadAllocation(); }; AllocationWatcher = new FileSystemWatcher { Path = _profilesDir, Filter = "*.json", NotifyFilter = NotifyFilters.LastWrite | NotifyFilters.FileName, EnableRaisingEvents = true }; AllocationWatcher.Changed += (sender, args) => { LoadAllocation(); }; AllocationWatcher.Created += (sender, args) => { LoadAllocationProfiles(); }; AllocationWatcher.Deleted += (sender, args) => { LoadAllocationProfiles(); }; AllocationWatcher.Renamed += (sender, args) => { LoadAllocationProfiles(); }; Settings.SaveSettings(); Settings.LoadSettings(); LogAllocation("Started Allocation Writer"); ZoneStatHelper.CreateOverrides(_dir); settingsForm.UpdateFromSettings(Settings); settingsForm.Show(); InvokeRepeating("AutomationRoutine", 0.0f, 10.0f); InvokeRepeating("SnipeZone", 0.0f, .1f); InvokeRepeating("MonitorLog", 0.0f, 1f); InvokeRepeating("QuickStuff", 0.0f, .5f); InvokeRepeating("ShowBoostProgress", 0.0f, 60.0f); InvokeRepeating("SetResnipe", 0f, 1f); reference = this; } catch (Exception e) { Log(e.ToString()); Log(e.StackTrace); Log(e.InnerException.ToString()); } }