Ejemplo n.º 1
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();
            }
        }