Exemplo n.º 1
0
        public static async Task <bool> RecipeBotRunner()
        {
            if (!ZetaDia.IsInTown)
            {
                return(false);
            }

            // For Smith plans, move to blacksmith
            // Use Item if not already known
            if (HasSmithPlans && Forge != null && UIElements.SalvageWindow.IsVisible)
            {
                ZetaDia.Me.Inventory.UseItem(BackPackSmithPlans.FirstOrDefault().DynamicId);
                return(true);
            }
            // Open Blacksmith window
            if (HasSmithPlans && Forge != null && !UIElements.SalvageWindow.IsVisible)
            {
                if (Forge.Distance > 10f)
                {
                    var moveResult = await CommonCoroutines.MoveAndStop(Forge.Position, 10f, "Forge Location");

                    if (moveResult == MoveResult.ReachedDestination)
                    {
                        return(false);
                    }
                }
                else
                {
                    Forge.Interact();
                    return(true);
                }
            }

            // Upgrade Blacksmith to max.. not sure if we can do that?
            // If already known: Move to Vendor
            // Sell Item

            // For Jeweler plans
            // Move to Jeweler
            // Open Window
            // Upgrade Jeweler to max
            // Use Item if not already known
            // If already Known: move to vendor
            // Sell Item

            if (await MoveToAndOpenStash())
            {
                return(true);
            }

            // Couldn't move to stash, something derpd?
            if (Stash == null)
            {
                return(false);
            }

            // Transfer Plans to backpack until pack full
            while (UIElements.StashWindow.IsVisible && TrinityItemManager.FindValidBackpackLocation(false) != TrinityItemManager.NoFreeSlot)
            {
                ZetaDia.Me.Inventory.QuickWithdraw(FirstStashPlan);
            }


            return(false);
        }