示例#1
0
 internal static void LoadAllocation()
 {
     _profile = new CustomAllocation(_profilesDir, Settings.AllocationFile);
     try
     {
         _profile.ReloadAllocation();
     }
     catch (Exception e)
     {
         Log(e.Message);
     }
 }
示例#2
0
        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
            };

            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,
                        BalanceCube           = true,
                        CombatEnabled         = false,
                        GlobalEnabled         = true,
                        QuickDiggers          = new int[] {},
                        QuickLoadout          = new int[] {},
                        UseButterMajor        = false,
                        ManualMinors          = false,
                        UseButterMinor        = false,
                        ActivateFruits        = 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);
            }
            catch (Exception e)
            {
                Log(e.Message);
                Log(e.StackTrace);
            }
        }
示例#3
0
 private void LoadAllocation()
 {
     _profile.ReloadAllocation();
 }
示例#4
0
 internal static void LoadAllocation()
 {
     _profile = new CustomAllocation(_profilesDir, Settings.AllocationFile);
     _profile.ReloadAllocation();
 }