Пример #1
0
        /// <summary>
        /// Injected to TownRun Composite at Step3 (just after identifying legendaries).
        /// </summary>
        public async static Task <bool> ExecutePreVendor()
        {
            // Task returning True = We're done, move on.
            // Task returning False = Re-execute from start.

            if (!ZetaDia.IsInTown)
            {
                return(false);
            }

            Logger.LogVerbose("PreVendor Hook Started");

            try
            {
                var quest = new RiftQuest();
                if (ZetaDia.IsInTown && quest.State == QuestState.NotStarted && quest.Step == RiftStep.Completed && ZetaDia.Me.IsParticipatingInTieredLootRun)
                {
                    Logger.Log("Waiting...");
                    await Coroutine.Sleep(500);
                }

                if (ZetaDia.Me.IsParticipatingInTieredLootRun)
                {
                    return(false);
                }

                // Learn some recipies.
                if (!await UseCraftingRecipes.Execute())
                {
                    return(true);
                }

                // Destroy white/blue/yellow items to convert crafting materials.
                if (!await CubeItemsToMaterials.Execute())
                {
                    return(true);
                }

                // Gamble first for cube legendary rares, bag space permitting.
                if (!await Gamble.Execute())
                {
                    return(true);
                }

                // Run this before vendoring to use the rares we picked up.
                if (!await CubeRaresToLegendary.Execute())
                {
                    return(true);
                }
            }
            catch (Exception ex)
            {
                Logger.LogError("Exception in VendorHook {0}", ex);

                if (ex is CoroutineStoppedException)
                {
                    throw;
                }
            }

            return(false);
        }