Beispiel #1
0
        private static void SendFoodAndSyrupInput()
        {
            if (CraftingComplete())
            {
                return;
            }

            // check if timers is passed
            bool useFood  = (HotkeySet[HKType.Food] != null && DateTime.Compare(NextFoodUse, DateTime.Now) <= 0);
            bool useSyrup = (HotkeySet[HKType.Syrup] != null && DateTime.Compare(NextSyrupUse, DateTime.Now) <= 0);

            // leave if neither are to be used
            if (!useFood && !useSyrup)
            {
                return;
            }
            UICommunicator.UpdateStatus("Refreshing Consumables...");
            Logger.Write("Refreshing Consumables");

            // enter a craft and leave it out
            Break(500);

            try
            {
                ProcessManager.DisableInputs();
                Break(50);
                SendInput(HotkeySet[HKType.Confirm], 3);
                SendInput(HotkeySet[HKType.Cancel]);
                Break(50);
            }
            finally
            {
                ProcessManager.EnableInputs();
            }

            Break(1500);

            try
            {
                ProcessManager.DisableInputs();
                Break(100);
                SendInput(HotkeySet[HKType.Confirm]);
                SendInput(HotkeySet[HKType.Cancel]);
                SendInput(HotkeySet[HKType.Confirm]);
                Break(50);
            }
            finally
            {
                ProcessManager.EnableInputs();
            }

            Break(2000);

            // use food and syrup as needed
            if (useFood)
            {
                UICommunicator.UpdateStatus("Using Food...");
                Logger.Write("Using Food");
                SendInput(HotkeySet[HKType.Food]);
                NextFoodUse = CalculateNextConsumableUse(Settings.FoodDuration);
                UICommunicator.UpdateFood(NextFoodUse);
            }
            if (useSyrup)
            {
                UICommunicator.UpdateStatus("Using Syrup...");
                Logger.Write("Using Syrup");
                SendInput(HotkeySet[HKType.Syrup]);
                NextSyrupUse = CalculateNextConsumableUse(STANDARD_SYRUP_TIME);
                UICommunicator.UpdateSyrup(NextSyrupUse);
            }
        }
Beispiel #2
0
        private static void RunCraftingEngine(CancellationToken token)
        {
            // PROCESS:
            // set queue parameters
            // calcualte overall time for full process
            // macro 1
            // macro 2
            // macro 3
            // collectable if needed
            // food if needed
            // pot if needed
            // begin next craft

            try
            {
                // Set crafting parameters
                UICommunicator.ResetValues();
                UICommunicator.ErrorMessageHandler = ErrorMessageHandler;
                UICommunicator.UpdateStatus("Setting up for Crafting...");
                UICommunicator.StartTimedProgressBarUpdates();
                UICommunicator.UpdateCompletedUIInfo(0, Settings.CraftCount);


                CraftCount = 1;
                TotalCount = 0;
                if (HotkeySet[HKType.Food] != null)
                {
                    NextFoodUse = CalculateNextConsumableUse(Settings.StartingFoodTime);
                    UICommunicator.UpdateFood(NextFoodUse);
                }
                if (HotkeySet[HKType.Syrup] != null)
                {
                    NextSyrupUse = CalculateNextConsumableUse(Settings.StartingSyrupTime);
                    UICommunicator.UpdateSyrup(NextSyrupUse);
                }


                // If crafts remaining was 0, loop infinitley
                // If not, craft until quota is met
                while (!CraftingComplete())
                {
                    // UI MESSAGE: Set timer for overall craft
                    UICommunicator.UpdateCraftUIInfo(CraftCount, Settings.CraftCount);

                    // Add requested delay
                    Break(Settings.StartingDelay);

                    // Begin Craft Timer:
                    RunCraftProgressBar();

                    // Initiate Macro 1
                    SendMacroInput(HotkeySet[HKType.Macro1], 1);

                    // Initiate Macro 2
                    SendMacroInput(HotkeySet[HKType.Macro2], 2);

                    // Initiate Macro 3
                    SendMacroInput(HotkeySet[HKType.Macro3], 3);

                    // Update UI Message
                    TotalCount = CraftCount;
                    UICommunicator.UpdateCompletedUIInfo(TotalCount, Settings.CraftCount);

                    // Collectable Menu Option
                    SendCollectableConfirmationInput();

                    // Standard delay for menus
                    Break(STANDARD_MENU_DELAY);

                    // Use Food and Syrup
                    SendFoodAndSyrupInput();

                    // Prepare next craft if crafting is not finished
                    PrepareNextCraftInput();
                    Break(STANDARD_ANIMATION_DELAY);

                    CraftCount += 1;
                }
            }
            catch (Exception e) when(!(e is CraftCancelRequest))
            {
                ErrorMessageHandler(e);
            }
            finally
            {
                EndCraftingProcess();
            }
        }