예제 #1
0
 protected override Composite CreateBehavior()
 {
     return(new PrioritySelector(
                new Decorator(ret => !ConditionCheck(),
                              new Action(ret => _done = true)),
                new Decorator(ret => Talk.DialogOpen,
                              new Action(r =>
     {
         Talk.Next();
     })
                              ),
                new Decorator(ret => casted,
                              new Sequence(
                                  new Sleep(3, 5),
                                  new Action(r => casted = false)
                                  )
                              ),
                new Decorator(ret => Core.Me.Location.Distance(Position) <= Distance && IsFinished,
                              new Action(ret => _done = true)),
                new Decorator(ret => Core.Me.Location.Distance(Position) <= Distance,
                              new PrioritySelector(
                                  new Decorator(ret => Actionmanager.InSpellInRangeLOS(1, GameObjectManager.GetObjectByNPCId(NPC)) == Enums.SpellRangeCheck.ErrorNotInLineOfSight,
                                                CommonBehaviors.MoveToLos(r => GameObjectManager.GetObjectByNPCId(NPC), true)
                                                ),
                                  new Decorator(ret => true,
                                                new Action(r =>
     {
         if (Core.Player.IsMounted)
         {
             Actionmanager.Dismount();
         }
         Navigator.PlayerMover.MoveStop();
         if (!Core.Player.IsCasting)
         {
             Actionmanager.DoActionLocation(Enums.ActionType.KeyItem, ItemID, XYZ);
             casted = true;
         }
     })
                                                )
                                  )
                              ),
                CommonBehaviors.MoveAndStop(ret => Position, Distance, stopInRange: true, destinationName: Name)
                ));
 }
예제 #2
0
        private static async Task EnterDiadem()
        {
            await Navigation.GetTo(886, new Vector3(-17.82406f, -16f, 141.3146f));

            var Aurvael = GameObjectManager.GetObjectByNPCId(1031694);

            if (Aurvael != null)
            {
                Aurvael.Interact();
                if (await Coroutine.Wait(3000, () => Talk.DialogOpen))
                {
                    Talk.Next();
                }

                await Coroutine.Wait(3000, () => SelectString.IsOpen);

                if (SelectString.IsOpen)
                {
                    SelectString.ClickSlot(0);
                    await Coroutine.Wait(3000, () => SelectYesno.IsOpen);

                    SelectYesno.Yes();

                    await Coroutine.Wait(30000, () => ContentsFinderConfirm.IsOpen);

                    await Coroutine.Yield();

                    while (ContentsFinderConfirm.IsOpen)
                    {
                        DutyManager.Commence();
                        await Coroutine.Yield();

                        if (await Coroutine.Wait(30000, () => CommonBehaviors.IsLoading))
                        {
                            await Coroutine.Yield();

                            await Coroutine.Wait(Timeout.Infinite, () => !CommonBehaviors.IsLoading);
                        }
                    }
                    await Coroutine.Sleep(2500);
                }
            }
        }
예제 #3
0
        public bool Lanosca_spezial()
        {
            {
                //Logging.Write("We trying to communicate with Ferry skipper ");
                //in this case we need to take the ferry
                if (GameObjectManager.GetObjectByName("Ferry Skipper") != null && Core.Player.CurrentTarget.EnglishName != "Ferry Skipper")
                {
                    GameObjectManager.GetObjectByName("Ferry Skipper").Target();
                    Core.Player.CurrentTarget.Interact();
                    Thread.Sleep(1000);
                    Talk.Next();
                    Thread.Sleep(1000);
                    SelectYesno.ClickYes();
                    Thread.Sleep(1000);;
                }
            }

            return(false);
        }
예제 #4
0
        public async Task <bool> Run()
        {
            if (CommonBehaviors.IsLoading)
            {
                await Coroutine.Wait(-1, () => !CommonBehaviors.IsLoading);

                return(true);
            }

            if (QuestLogManager.InCutscene)
            {
                TreeRoot.StatusText = "InCutscene";
                if (AgentCutScene.Instance != null)
                {
                    AgentCutScene.Instance.PromptSkip();
                    await Coroutine.Wait(250, () => SelectString.IsOpen);

                    if (SelectString.IsOpen)
                    {
                        SelectString.ClickSlot(0);
                    }
                    return(true);
                }
            }

            if (Talk.DialogOpen)
            {
                Talk.Next();
                return(true);
            }

            //wait if the barrier is still up
            if (DirectorManager.ActiveDirector is InstanceContentDirector activeAsInstance)
            {
                if (activeAsInstance.TimeLeftInDungeon == TimeSpan.Zero)
                {
                    return(true);
                }
            }

            return(false);
        }
예제 #5
0
        protected override Composite CreateBehavior()
        {
            return(new PrioritySelector(
                       ctx => NPC,

                       new Decorator(r => SelectIconString.IsOpen, new Action(r =>
            {
                if (DialogOption1 == -1)
                {
                    TreeRoot.Stop("No DialogOption1 supplied, but found dialog window.");
                    throw new ArgumentException("No DialogOption1 supplied, but found dialog window.");
                    return RunStatus.Failure;
                }

                SelectIconString.ClickSlot((uint)DialogOption1);
                return RunStatus.Success;
            })),

                       new Decorator(r => SelectString.IsOpen, new Action(r =>
            {
                if (DialogOption2 == -1)
                {
                    TreeRoot.Stop("No DialogOption2 supplied, but found dialog window.");
                    throw new ArgumentException("No DialogOption2 supplied, but found dialog window.");
                    return RunStatus.Failure;
                }

                SelectString.ClickSlot((uint)DialogOption2);
                return RunStatus.Success;
            })),

                       new Decorator(r => dialogwasopen && !Core.Player.HasTarget, new Action(r => { DoneTalking = true; return RunStatus.Success; })),
                       new Decorator(r => Talk.DialogOpen, new Action(r => { Talk.Next(); return RunStatus.Success; })),
                       //new Action(r => { dialogwasopen = true; return RunStatus.Success; })
                       new Decorator(r => Shop.Open, new ActionRunCoroutine(ctx => BuyItems())),


                       CommonBehaviors.MoveAndStop(ret => XYZ, ret => InteractDistance, true, ret => $"[{GetType().Name}] Moving to {XYZ} so we can buy {ItemNames} from {vendorName}"),
                       new Decorator(ret => NPC == null, new Sequence(new SucceedLogger(r => $"Waiting at {Core.Player.Location} for {vendorName} to spawn so we can purchase {ItemNames}"), new WaitContinue(5, ret => NPC != null, new Action(ret => RunStatus.Failure)))),
                       new Action(ret => NPC.Interact())
                       ));
        }
예제 #6
0
        public async Task <bool> SelectRetainerAndSkipDialog(uint index, byte attempts = 20, ushort interval = 200)
        {
            var result          = SendActionResult.None;
            var requestAttempts = 0;
            await Behaviors.Wait(interval, () => RetainerList.IsOpen);

            while (result != SendActionResult.Success && !Talk.DialogOpen && requestAttempts++ < attempts && Behaviors.ShouldContinue)
            {
                result = SelectRetainer(index);
                if (result == SendActionResult.InjectionError)
                {
                    await Behaviors.Sleep(interval);
                }
                if (result == SendActionResult.InvalidWindow)
                {
                    await Refresh(interval);
                }

                await Behaviors.Wait(interval, () => Talk.DialogOpen);
            }

            if (requestAttempts > attempts)
            {
                return(false);
            }

            await Behaviors.Sleep(interval);

            await Behaviors.Wait(5000, () => Talk.DialogOpen);

            // Dialog didin't open somehow
            if (!Talk.DialogOpen)
            {
                return(false);
            }

            Talk.Next();

            await Behaviors.Wait(interval, () => SelectString.IsOpen);

            return(SelectString.IsOpen);
        }
예제 #7
0
        private async Task OpenMenu()
        {
            Logger.Verbose("Attempting to interact with: {0}", DataManager.GetLocalizedNPCName((int)Constants.CaptainNpcId));

            GameObjectManager.GetObjectByNPCId(Constants.CaptainNpcId).Interact();
            await Coroutine.Yield();

            //wait while false
            await Coroutine.Wait(3000, () => HasWindowOpen || Talk.DialogOpen);

            if (Talk.DialogOpen)
            {
                Talk.Next();
                await Coroutine.Yield();
            }
            if (!HasWindowOpen)
            {
                Logger.Verbose("Failed to open window. trying again...");
            }
        }
예제 #8
0
            /// <summary>
            /// Skips Talk dialogs if Open.
            /// </summary>
            private static async Task <bool> HandleTalkDialogOpen()
            {
                if (!Talk.DialogOpen)
                {
                    return(false);
                }

                while (Talk.DialogOpen)
                {
                    Talk.Next();
                    await Common.Sleep(50);

                    if (!Talk.DialogOpen)
                    {
                        break;
                    }
                }

                return(true);
            }
예제 #9
0
        /// <summary>
        /// Will skip cutscenes by trying to exit out of them or advance the dialogue.
        /// </summary>
        /// <returns></returns>
        private bool ExecuteSkipCutscene()
        {
            // Try to skip the cutscene
            AgentCutScene.Instance.PromptSkip();

            if (AgentCutScene.Instance.CanSkip && SelectString.IsOpen)
            {
                SelectString.ClickSlot(0);
                return(true);
            }

            // If that is not an option, at least try to forward it as fast as possible...
            if (Talk.DialogOpen)
            {
                Talk.Next();
                return(true);
            }

            return(false);
        }
예제 #10
0
        protected static async Task <bool> ShortCircuit(GameObject obj, bool persistentObject = false, bool ignoreCombat = false, int mSecsPassed = 0)
        {
            var Timer = new Stopwatch();

            Timer.Start();

            while (obj.IsTargetable && obj.IsVisible || QuestLogManager.InCutscene)
            {
                if (mSecsPassed > 0 && Timer.ElapsedMilliseconds >= mSecsPassed)
                {
                    Timer.Stop();
                    return(false);
                }

                if (persistentObject && !Me.IsCasting)
                {
                    Blacklist.Add(Me.CurrentTarget.ObjectId, BlacklistFlags.SpecialHunt, TimeSpan.FromSeconds(30), "Persistent Object");
                    await Coroutine.Sleep(1000);

                    return(false);
                }

                if (!ignoreCombat && Me.InCombat)
                {
                    await Coroutine.Sleep(1000);

                    return(false);
                }

                if (Talk.DialogOpen)
                {
                    Talk.Next();
                    await Coroutine.Sleep(100);
                }

                await Coroutine.Yield();
            }

            Timer.Stop();
            return(false);
        }
예제 #11
0
        internal async Task <VentureCheck> CheckRetainer()
        {
            foreach (var lines in SelectString.Lines())
            {
                // TODO: Add CN 'in progress' text.
                if (lines.Contains("(Complete on ") ||
                    lines.Contains("(Abschluss am ") ||
                    lines.Contains("[Fin le ") ||
                    lines.Contains("確認 [~"))
                {
                    return(VentureCheck.InProgress);
                }

                if (lines.EndsWith("(Complete)") ||
                    lines.EndsWith("Unternehmung einsehen") ||
                    lines.EndsWith("tâche terminée") ||
                    lines.EndsWith("[完了]") ||
                    lines.EndsWith("[探险归来]"))
                {
                    // Click on the completed venture
                    SelectString.ClickSlot(5);
                    await Coroutine.Wait(5000, () => RetainerTaskResult.IsOpen);

                    // Assign a new venture
                    RetainerTaskResult.Reassign();
                    await Coroutine.Wait(5000, () => RetainerTaskAsk.IsOpen);

                    // Confirm new venture
                    RetainerTaskAsk.Confirm();
                    await Coroutine.Wait(5000, () => Talk.DialogOpen);

                    // Skip dialog
                    Talk.Next();
                    return(VentureCheck.Completed);
                }
            }
            return(VentureCheck.None);
        }
예제 #12
0
        public static async Task BuyFCAction(GrandCompany grandCompany, int actionId)
        {
            await InteractWithNpc(GCNpc.OIC_Quartermaster, grandCompany);

            await Coroutine.Wait(5000, () => Talk.DialogOpen || Conversation.IsOpen);

            if (!Talk.DialogOpen)
            {
                await InteractWithNpc(GCNpc.OIC_Quartermaster, grandCompany);

                await Coroutine.Wait(5000, () => Talk.DialogOpen);
            }

            if (Talk.DialogOpen || Conversation.IsOpen)
            {
                if (Talk.DialogOpen)
                {
                    Talk.Next();
                    await Coroutine.Wait(5000, () => Conversation.IsOpen);
                }

                if (Conversation.IsOpen)
                {
                    Conversation.SelectLine(0);
                    await Coroutine.Wait(10000, () => FreeCompanyExchange.Instance.IsOpen);

                    if (FreeCompanyExchange.Instance.IsOpen)
                    {
                        await Coroutine.Sleep(500);

                        await FreeCompanyExchange.Instance.BuyAction(actionId);

                        FreeCompanyExchange.Instance.Close();
                    }
                }
            }
        }
예제 #13
0
        public static async Task <bool> ExitRetainer(bool exitList = false)
        {
            if (RetainerTasks.IsInventoryOpen())
            {
                RetainerTasks.CloseInventory();

                await Coroutine.Wait(3000, () => RetainerTasks.IsOpen);
            }
            if (RetainerTasks.IsOpen)
            {
                RetainerTasks.CloseTasks();

                await Coroutine.Wait(3000, () => Talk.DialogOpen);
            }
            if (Talk.DialogOpen)
            {
                Talk.Next();
                await Coroutine.Wait(3000, () => RetainerList.Instance.IsOpen);
            }

            if (!exitList)
            {
                return(RetainerList.Instance.IsOpen);
            }

            if (!RetainerList.Instance.IsOpen)
            {
                return(true);
            }

            await RetainerRoutine.CloseRetainers();

            await Coroutine.Wait(3000, () => !RetainerList.Instance.IsOpen);

            return(!RetainerList.Instance.IsOpen);
        }
예제 #14
0
        /// <summary>
        /// Will automatically advance dialogue when possible.
        /// </summary>
        /// <returns></returns>
        private bool ExecuteAutoAdvanceDialogue()
        {
            // Auto progress text box
            if (Talk.DialogOpen)
            {
                if (BotBase.Instance.ForceSkipTalk)
                {
                    //lock (Core.Memory.Executor.AssemblyLock)
                    //{
                    //	Core.Memory.CallInjected64<uint>(Offsets.Instance.SkipTalk, RaptureAtkUnitManager.GetWindowByName("Talk").Pointer);
                    //}

                    RaptureAtkUnitManager.GetWindowByName("Talk").SendAction(0);
                }
                else
                {
                    Talk.Next();
                }

                return(true);
            }

            return(false);
        }
예제 #15
0
 protected override Composite CreateBehavior()
 {
     return(new PrioritySelector(
                new Decorator(ret => Talk.DialogOpen,
                              new Action(r =>
     {
         Talk.Next();
     })
                              ),
                new Decorator(ret => IsOpen,
                              new Sequence(
                                  new Sleep(1, 2),
                                  new Action(r =>
     {
         //Logging.Write("Accepting leve...");
         AcceptLeve((uint)LeveId);
     }),
                                  new Sleep(1, 2),
                                  new Action(r =>
     {
         leveopened = true;
         //Logging.Write("Closing GuildLeve window...");
         Close();
     }),
                                  new Sleep(1, 2)
                                  )
                              ),
                new Decorator(ret => SelectYesno.IsOpen,
                              new Action(r =>
     {
         SelectYesno.ClickYes();
     })
                              ),
                new Decorator(ret => SelectString.IsOpen,
                              new Action(r =>
     {
         if (!leveopened)
         {
             SelectString.ClickLineContains(LeveType);
         }
         else
         {
             SelectString.ClickSlot(4);
         }
     })
                              ),
                new Decorator(ret => JournalResult.IsOpen,
                              new Action(r =>
     {
         JournalResult.Complete();
     })
                              ),
                new Decorator(ret => interacted && !Core.Player.HasTarget,
                              new Action(r =>
     {
         _done = true;
     })
                              ),
                new Decorator(ret => Vector3.Distance(Core.Player.Location, XYZ) > 3,
                              CommonBehaviors.MoveTo(r => XYZ, "Moving to PickupLeve location")
                              ),
                new Decorator(ret => Vector3.Distance(Core.Player.Location, XYZ) <= 3 && MovementManager.IsMoving,
                              ff14bot.Behavior.CommonBehaviors.MoveStop()
                              ),
                new Decorator(ret => Vector3.Distance(Core.Player.Location, XYZ) <= 3 && !MovementManager.IsMoving && !interacted,
                              new Action(r =>
     {
         GameObjectManager.GetObjectByNPCId((uint)NpcId).Interact();
         interacted = true;
     })
                              ),
                new ActionAlwaysSucceed()
                ));
 }
예제 #16
0
        protected async Task <bool> Gardening()
        {
            var watering = GardenManager.Plants.Where(r => !Blacklist.Contains(r) && r.Distance2D(Core.Player) < 5).ToArray();

            foreach (var plant in watering)
            {
                //Water it if it needs it or if we have fertilized it 5 or more times.
                if (AlwaysWater || GardenManager.NeedsWatering(plant))
                {
                    var result = GardenManager.GetCrop(plant);
                    if (result != null)
                    {
                        Log("Watering {0} {1:X}", result, plant.ObjectId);
                        plant.Interact();
                        if (await Coroutine.Wait(5000, () => Talk.DialogOpen))
                        {
                            Talk.Next();
                            if (await Coroutine.Wait(5000, () => SelectString.IsOpen))
                            {
                                if (await Coroutine.Wait(5000, () => SelectString.LineCount > 0))
                                {
                                    //Harvest drops it down to two
                                    if (SelectString.LineCount == 4)
                                    {
                                        SelectString.ClickSlot(1);
                                        await Coroutine.Sleep(PostInteractDelay);
                                    }
                                    else
                                    {
                                        Log("Plant is ready to be harvested");
                                        SelectString.ClickSlot(1);
                                    }
                                }
                            }
                        }
                    }
                    else
                    {
                        Log("GardenManager.GetCrop returned null {0:X}", plant.ObjectId);
                    }
                }
            }
            var plants = GardenManager.Plants.Where(r => r.Distance2D(Core.Player) < 5).ToArray();

            foreach (var plant in plants)
            {
                var result = GardenManager.GetCrop(plant);
                if (result != null)
                {
                    Log("Fertilizing {0} {1:X}", GardenManager.GetCrop(plant), plant.ObjectId);
                    plant.Interact();
                    if (await Coroutine.Wait(5000, () => Talk.DialogOpen))
                    {
                        Talk.Next();
                        if (await Coroutine.Wait(5000, () => SelectString.IsOpen))
                        {
                            if (await Coroutine.Wait(5000, () => SelectString.LineCount > 0))
                            {
                                //Harvest drops it down to two
                                if (SelectString.LineCount == 4)
                                {
                                    SelectString.ClickSlot(0);
                                    if (await Coroutine.Wait(2000, () => GardenManager.ReadyToFertilize))
                                    {
                                        if (GardenManager.Fertilize() == FertilizeResult.Success)
                                        {
                                            LogVerbose("Plant with objectId {0:X} was fertilized", plant.ObjectId);
                                            await Coroutine.Sleep(PostInteractDelay);
                                        }
                                    }
                                    else
                                    {
                                        LogVerbose("Plant with objectId {0:X} not able to be fertilized, trying again later", plant.ObjectId);
                                    }
                                }
                                else
                                {
                                    LogVerbose("Plant is ready to be harvested");
                                    SelectString.ClickSlot(1);
                                }
                            }
                        }
                    }
                }
            }
            return(_done = true);
        }
예제 #17
0
        protected override Composite CreateBehavior()
        {
            return(new PrioritySelector(
                       new Decorator(ret => ShouldStop(),
                                     new Action(r => OnDoneWhile())),
                       new Decorator(ret => DateTime.Now > saveNow + TimeSpan.FromSeconds(_timeout) && currentstep == 0,
                                     new Action(r => OnTimeout())),
                       // This one will run always kind of a pulse one
                       new Sequence(
                           new Action(r => CountDeath()),
                           new Action(r => IsFateStillActive()),
                           new Action(r => UpdateFateData()),
                           new ActionAlwaysFail() //always fail that the rest of the tree is traveresd
                           ),
                       //Start fighting Fate Mobs but only when we are in close range to the fate position.TBD enhance this filter

                       #region sync//level Sync

                       new Decorator(r => currentfate != null && FateManager.WithinFate && currentfate.MaxLevel < Core.Player.ClassLevel && !Core.Me.IsLevelSynced,
                                     new ActionRunCoroutine(async r =>
            {
                Logging.Write("Applying Level Sync.");

                ToDoList.LevelSync();

                await Coroutine.Sleep(500);

                return false;
            })
                                     ),

                       #endregion sync//level Sync

                       #region Movment

                       new Decorator(
                           ret => currentstep == 1 && Vector3.Distance(Core.Player.Location, Position) > (currentfate.Radius - 10),
                           UseFlight ? new ActionRunCoroutine(obj => FlyTo(Position, true, true)) : CommonBehaviors.MoveAndStop(ret => Position, Distance, stopInRange: true, destinationName: "Moving to Fates.")

                           ),

                       #region Handin

                       new Decorator(r => currentfate != null && FateManager.WithinFate && currentfate.Icon == FateIconType.KillHandIn && currentfate.TimeLeft.Minutes <= 8,
                                     new Sequence(
                                         new Action(r =>
            {
                Poi.Clear("Handing in items.");
                Logging.Write("Hand-in Fate");
                var npc = GameObjectManager
                          .GetObjectsOfType <BattleCharacter>()
                          .Where(
                    b => b.IsFate && !b.CanAttack && b.FateId == currentfate.Id);
                var q = from s in npc
                        group s by s into g
                        orderby g.Count() descending
                        select g.Key;
                if (q.LastOrDefault() == null)
                {
                    Logging.Write("Could not find handin NPC. Something is wrong.");
                    return;
                }
                tempProvider = CombatTargeting.Instance.Provider;
                CombatTargeting.Instance.Provider = new NullTargetingProvider();
                MoveTo(q.LastOrDefault().Location);
                GameObjectManager.GetObjectByNPCId(q.LastOrDefault().NpcId).Interact();
                Talk.Next();
                InventoryManager.GetBagByInventoryBagId(InventoryBagId.KeyItems).FilledSlots.LastOrDefault().Handover();
                Request.HandOver();
                CombatTargeting.Instance.Provider = tempProvider;
            }),
                                         new ActionAlwaysFail() //always fail that the rest of the tree is traveresd
                                         )),

                       new Decorator(ret => Talk.DialogOpen,
                                     new Action(r =>
            {
                Talk.Next();
            })),
                       new Decorator(ret => Request.IsOpen,
                                     new Action(r =>
            {
                GameObjectManager.GetObjectByNPCId(npc.NpcId).Interact();
                InventoryManager.GetBagByInventoryBagId(InventoryBagId.KeyItems).FilledSlots.LastOrDefault().Handover();
                Request.HandOver();
            })),

                       //Find fates

                       #endregion Handin

                       #endregion Movment

                       #region escort

                       new Decorator(r => currentfate != null && fateid != 0 && Poi.Current.Type != PoiType.Kill,
                                     new ActionRunCoroutine(async r => MoveToFocusedFate())

                                     ),

                       #endregion escort

                       new Decorator(ret => currentfate == null && currentstep == 0,
                                     new Sequence(
                                         new Action(r =>
            {
                getFates();
                if (currentfate != null)
                {
                    GoFate();
                }
                else
                {
                    GoHunting();
                }
            }
                                                    )
                                         )),
                       new ActionAlwaysSucceed()
                       ));
        }
예제 #18
0
        public static async Task SmallTalk(int waitTime = 500)
        {
            await Coroutine.Wait(waitTime, () => InSmallTalk);

            while (InSmallTalk)
            {
                await Coroutine.Yield();

                if (CommonBehaviors.IsLoading)
                {
                    await Coroutine.Wait(-1, () => !CommonBehaviors.IsLoading);
                }

                if (SelectYesno.IsOpen)
                {
                    SelectYesno.ClickNo();
                }

                if (SelectString.IsOpen)
                {
                    if (!await WindowEscapeSpam("SelectString"))
                    {
                        if (SelectString.Lines().Contains("Cancel"))
                        {
                            SelectString.ClickLineContains("Cancel");
                        }
                        else if (SelectString.Lines().Contains("Quit"))
                        {
                            SelectString.ClickLineContains("Quit");
                        }
                        else if (SelectString.Lines().Contains("Exit"))
                        {
                            SelectString.ClickLineContains("Exit");
                        }
                        else
                        {
                            SelectString.ClickSlot((uint)(SelectString.LineCount - 1));
                        }
                    }
                }

                if (SelectIconString.IsOpen)
                {
                    if (!await WindowEscapeSpam("SelectIconString"))
                    {
                        if (SelectIconString.Lines().Contains("Cancel"))
                        {
                            SelectString.ClickLineContains("Cancel");
                        }
                        else if (SelectIconString.Lines().Contains("Quit"))
                        {
                            SelectString.ClickLineContains("Quit");
                        }
                        else if (SelectIconString.Lines().Contains("Exit"))
                        {
                            SelectString.ClickLineContains("Exit");
                        }
                        else
                        {
                            SelectIconString.ClickSlot((uint)(SelectIconString.LineCount - 1));
                        }
                    }
                }

                while (QuestLogManager.InCutscene)
                {
                    AgentCutScene.Instance.PromptSkip();
                    if (AgentCutScene.Instance.CanSkip && SelectString.IsOpen)
                    {
                        SelectString.ClickSlot(0);
                    }
                    await Coroutine.Yield();
                }

                while (Talk.DialogOpen)
                {
                    Talk.Next();
                    await Coroutine.Wait(100, () => !Talk.DialogOpen);

                    await Coroutine.Wait(100, () => Talk.DialogOpen);

                    await Coroutine.Yield();
                }

                if (JournalAccept.IsOpen)
                {
                    JournalAccept.Decline();
                }

                await Coroutine.Wait(500, () => InSmallTalk);
            }
        }
예제 #19
0
        public static async Task RetainerSellItems(IEnumerable <BagSlot> items)
        {
            if (await HelperFunctions.GetNumberOfRetainers() == 0)
            {
                Log("No retainers found to sell items to.");

                return;
            }

            List <BagSlot> bagSlots = items.ToList();

            if (!bagSlots.Any())
            {
                Log("No items found to sell.");
                return;
            }

            await StopBusy();

            if (!await HelperFunctions.UseSummoningBell())
            {
                Log("Couldn't get to summoning bell.");
                return;
            }

            await RetainerRoutine.SelectRetainer(0);

            RetainerTasks.OpenInventory();
            if (!await Coroutine.Wait(3000, RetainerTasks.IsInventoryOpen))
            {
                Log("Couldn't get Retainer inventory open.");
                RetainerTasks.CloseInventory();
                await Coroutine.Wait(3000, () => RetainerTasks.IsOpen);

                RetainerTasks.CloseTasks();
                await Coroutine.Wait(3000, () => Talk.DialogOpen);

                if (Talk.DialogOpen)
                {
                    Talk.Next();
                }
                await Coroutine.Wait(3000, () => RetainerList.Instance.IsOpen);

                await RetainerRoutine.CloseRetainers();

                return;
            }

            int itemCount = bagSlots.Count;
            int i         = 1;

            foreach (var bagSlot in bagSlots)
            {
                if (!bagSlot.IsValid || !bagSlot.IsFilled)
                {
                    Log("BagSlot isn't valid or filled.");
                    i++;
                    continue;
                }

                string name = bagSlot.Name;
                Log($"Attempting to sell #{i++} of {itemCount}: {name}");
                int waitTime = 600;

                bagSlot.RetainerSellItem();

                if (await Coroutine.Wait(500, () => SelectYesno.IsOpen))
                {
                    SelectYesno.ClickYes();
                }
                else
                {
                    waitTime -= 500;
                }

                if (!await Coroutine.Wait(5000, () => !bagSlot.IsValid || !bagSlot.IsFilled))
                {
                    Log($"We couldn't sell {name}.");
                }
                else
                {
                    Log($"Sold {name}.");
                }

                await Coroutine.Sleep(waitTime);
            }

            RetainerTasks.CloseInventory();
            await Coroutine.Wait(3000, () => RetainerTasks.IsOpen);

            RetainerTasks.CloseTasks();
            await Coroutine.Wait(3000, () => SelectYesno.IsOpen);

            SelectYesno.ClickYes();
            await Coroutine.Wait(3000, () => Talk.DialogOpen);

            if (Talk.DialogOpen)
            {
                Talk.Next();
            }
            await Coroutine.Wait(3000, () => RetainerList.Instance.IsOpen);

            await RetainerRoutine.CloseRetainers();
        }
예제 #20
0
        private async Task BuyItem(int itemId, int npcId, int count, int selectString, bool dialog)
        {
            var unit = GameObjectManager.GetObjectsByNPCId((uint)npcId).OrderBy(r => r.Distance()).FirstOrDefault();

            if (unit == null)
            {
                _isDone = true;
                return;
            }

            if (!ShopExchangeItem.Instance.IsOpen && unit.Location.Distance(Core.Me.Location) > 4f)
            {
                await Navigation.OffMeshMove(unit.Location);

                await Coroutine.Sleep(500);
            }

            unit.Interact();

            if (dialog)
            {
                await Coroutine.Wait(5000, () => Talk.DialogOpen);

                while (Talk.DialogOpen)
                {
                    Talk.Next();
                    await Coroutine.Sleep(1000);
                }
            }

            await Coroutine.Wait(5000, () => ShopExchangeItem.Instance.IsOpen || Conversation.IsOpen);

            if (Conversation.IsOpen)
            {
                Conversation.SelectLine((uint)selectString);

                if (dialog)
                {
                    await Coroutine.Wait(5000, () => Talk.DialogOpen);

                    while (Talk.DialogOpen)
                    {
                        Talk.Next();
                        await Coroutine.Sleep(1000);
                    }
                }


                await Coroutine.Wait(5000, () => ShopExchangeItem.Instance.IsOpen);


                if (ShopExchangeItem.Instance.IsOpen)
                {
                    //Log("Opened");
                    await ShopExchangeItem.Instance.Purchase((uint)itemId, (uint)count);
                }

                await Coroutine.Wait(2000, () => ShopExchangeItem.Instance.IsOpen);

                if (ShopExchangeItem.Instance.IsOpen)
                {
                    ShopExchangeItem.Instance.Close();
                }
            }
            else if (ShopExchangeItem.Instance.IsOpen)
            {
                await ShopExchangeItem.Instance.Purchase((uint)itemId, (uint)count);
            }

            _isDone = true;
        }
예제 #21
0
        protected override Composite CreateBehavior()
        {
            return(new PrioritySelector(
                       new Decorator(ret => currentstep >= wayhome.Count(),
                                     new Sequence(
                                         new Action(r =>
            {
                _done = true;
                Logging.Write("We reached the end of our path");
            }),
                                         new ActionAlwaysSucceed()
                                         )
                                     ),

                       new Decorator(ret => SelectIconString.IsOpen,
                                     new Sequence(
                                         new Action(r =>
            {
                Logging.Write("Inside SelctIconString");
                SelectIconString.ClickSlot(localindex);
            }

                                                    ),
                                         new Sleep(2, 4)
                                         )),

                       new Decorator(ret => SelectString.IsOpen,
                                     new Sequence(
                                         new Action(r =>
            {
                Logging.Write("Inside SelctString");
                SelectString.ClickSlot(localindex);
            }

                                                    ),
                                         new Sleep(2, 4)
                                         )),
                       new Decorator(ret => Talk.DialogOpen,
                                     new Sequence(
                                         new Action(r =>
            {
                Logging.Write("Inside Talk");
                Talk.Next();
            }

                                                    ),
                                         new Sleep(2, 4)
                                         )),

                       new Decorator(ret => SelectYesno.IsOpen,
                                     new Sequence(
                                         new Action(r =>
            {
                Logging.Write("Inside YesNog");
                SelectYesno.ClickYes();
                stepcomplete = false;

                currentstep++;
                Logging.Write("Increased Currentstep {0}", currentstep);
            }

                                                    ),
                                         new Sleep(10, 10)
                                         )),

                       new Decorator(ret => ConditionCheck() && wayhome[currentstep].Communicationlocalindex > 0 && Vector3.Distance(Core.Player.Location, Position) <= Distance,
                                     new Sequence(
                                         new Action(r =>
            {
                ff14bot.Managers.MovementManager.MoveForwardStop();
                Logging.Write("Stopping player");
            }),
                                         new Action(r =>
            {
                Logging.Write("Setting Communication localindex to:" + wayhome[currentstep].Communicationlocalindex);
                localindex = (uint)wayhome[currentstep].Communicationlocalindex - 1;
                GameObjectManager.GetObjectByNPCId(Present_NPC).Target();
                Logging.Write("Found NPC with NpcId " + Present_NPC);
                Core.Player.CurrentTarget.Interact();
                //  await Buddy.Coroutines.Coroutine.Sleep(1000);
            }),
                                         new Sleep(1, 4)
                                         )),

                       new Decorator(ret => WorldManager.ZoneId.ToString() == "139" && Core.Player.Location.X > -300.0000 && wayhome[currentstep].Name == "Upper La Noscea-->Western La Noscea",
                                     //  new Decorator(ret => wayhome[currentstep].Name == "Upper La Noscea-->Western La Noscea",
                                     new Sequence(
                                         new Action(r => Lanosca_spezial()),
                                         new Action(r => Position = new Vector3("219.4604, -0.9591975, 258.5569")),
                                         CommonBehaviors.MoveAndStop(ret => Position, 1, stopInRange: true, destinationName: "Ferry Skipper")
                                         )),

                       new Decorator(ret => Vector3.Distance(Core.Player.Location, Position) > Distance,
                                     new Sequence(
                                         //  new Action(r =>           Logging.Write("Moving player")),

                                         new Action(r => Position = new Vector3((float)wayhome[currentstep].x, (float)wayhome[currentstep].y, (float)wayhome[currentstep].z)),
                                         CommonBehaviors.MoveAndStop(ret => Position, Distance - 1, stopInRange: true, destinationName: "travelbot"),

                                         new Action(r => DistanceToTarget = Core.Me.Location.Distance(Position))
                                         //new Action(r =>            Logging.Write("Distance to Target is {0}",DistanceToTarget))
                                         )),

                       new Decorator(ret => Vector3.Distance(Core.Player.Location, Position) <= Distance && wayhome[currentstep].Communicationlocalindex < 0,
                                     new Sequence(

                                         new Action(r => MovementManager.MoveForwardStart()),
                                         new Sleep(1000),
                                         new Action(r => MovementManager.MoveForwardStop()),
                                         new Sleep(5000),
                                         new Action(r =>
            {
                stepcomplete = true;

                currentstep++;
                Logging.Write("Increased Currentstep {0}", currentstep);
            }))),

                       new ActionAlwaysSucceed()
                       ));
        }
예제 #22
0
        protected override async Task <bool> Main()
        {
            var retainerList = new RetainerList();

            foreach (var unit in GameObjectManager.GetObjectsOfType <EventObject>().OrderBy(r => r.Distance()))
            {
                if (unit.Name == "Summoning Bell" || unit.Name == "Sonnette" || unit.Name == "Krämerklingel" || unit.Name == "リテイナーベル" || unit.Name == "传唤铃")
                {
                    unit.Interact();
                    break;
                }
            }

            if (!await Coroutine.Wait(5000, () => RetainerList.IsOpen))
            {
                return(isDone = true);
            }

            while (retainersLeft < RetainerCount)
            {
                Log("Checking Retainer Nº {0}", retainersLeft + 1);
                // Open specified retainer
                await retainerList.OpenRetainer(retainersLeft);

                retainersLeft++;
                await Coroutine.Wait(5000, () => Talk.DialogOpen);

                // Skip dialog
                Talk.Next();
                await Coroutine.Wait(5000, () => SelectString.IsOpen);

                foreach (var retainer in GameObjectManager.GetObjectsOfType <BattleCharacter>(true).OrderBy(r => r.Distance()))
                {
                    if (retainer.Type.ToString() == "Retainer")
                    {
                        retainerName = retainer.Name;
                        break;
                    }
                }

                switch (await CheckRetainer())
                {
                case VentureCheck.Completed:
                    Log("Venture complete! Sent {0} out again.", retainerName);
                    break;

                case VentureCheck.InProgress:
                    Log("Looks like {0} is still out on a venture! Skipping.", retainerName);
                    break;

                case VentureCheck.None:
                    Log("{0} isn't assigned any ventures. Skipping.", retainerName);
                    break;

                default:
                    Log("Something went wrong?");
                    break;
                }
                await CloseRetainer();
            }

            Log("Checked all retainers.");
            // Close retainers window.
            if (!retainerList.IsValid)
            {
                await retainerList.Refresh(1000);
            }
            await retainerList.CloseInstance(300);

            return(isDone = true);
        }
예제 #23
0
        private async Task <bool> Main()
        {
            if (!checkStopwatch.IsRunning)
            {
                checkStopwatch.Restart();
            }

            if (checkStopwatch.Elapsed < Condition.OneDay)
            {
                //return false;
            }

            checkStopwatch.Restart();

            var settings = RetainerMaidSettings.Instance;
            var mybags   =
                InventoryManager.GetBagsByInventoryBagId(
                    InventoryBagId.Bag1,
                    InventoryBagId.Bag2,
                    InventoryBagId.Bag3,
                    InventoryBagId.Bag4).SelectMany(bag => bag.Select(bagSlot => bagSlot)).ToArray();

            var myFullStacks = new Stack <BagSlot>(mybags.Where(b => b.IsFullStack()));

            if (myFullStacks.Count < 1 /* settings.MinStacksForDeposit */)
            {
                return(false);
            }

            var pLocation = Core.Player.Location;
            //HousingEventObjects don't have npcids and as such would be unuseable
            //var bell = GameObjectManager.GetObjectsByNPCId<EventObject>(2000401).OrderBy(r=>r.Distance2D(pLocation)).FirstOrDefault();
            var bell =
                GameObjectManager.GameObjects.Where(r => r.IsVisible && r.EnglishName == "Summoning Bell")
                .OrderBy(r => r.Distance2D(pLocation))
                .FirstOrDefault();

            if (bell == null)
            {
                Logger.Error(Localization.Localization.RetainerMaid_NoNearestSummoningBell);
                return(false);
            }

            bell.Interact();

            await Coroutine.Wait(3000, () => SelectString.IsOpen);

            var retainerCount = SelectString.LineCount - 1;

            while (retainerCount-- > 0)
            {
                SelectString.ClickSlot((uint)retainerCount);

                await Coroutine.Wait(3000, () => Talk.DialogOpen);

                await Coroutine.Sleep(500);

                while (Talk.DialogOpen)
                {
                    Talk.Next();
                }

                await Coroutine.Wait(3000, () => Talk.DialogOpen);

                await Coroutine.Sleep(500);

                while (Talk.DialogOpen)
                {
                    Talk.Next();
                }

                await Coroutine.Wait(5000, () => SelectString.IsOpen);

                retainers.Add(new Retainer(retainerCount));

                SelectString.ClickSlot(uint.MaxValue);

                await Coroutine.Wait(5000, () => !SelectString.IsOpen);

                await Coroutine.Wait(3000, () => Talk.DialogOpen);

                await Coroutine.Sleep(500);

                while (Talk.DialogOpen)
                {
                    Talk.Next();
                }

                await Coroutine.Sleep(2000);

                bell.Interact();

                await Coroutine.Wait(5000, () => SelectString.IsOpen);
            }

            var retainer = retainers.FirstOrDefault(r => r.BagSlots.Any(bs => !bs.IsFilled));

            if (retainer == null)
            {
                return(false);
            }

            var openSlots = new Stack <BagSlot>(retainer.BagSlots.Where(bs => !bs.IsFilled));

            SelectString.ClickSlot((uint)retainer.Index);
            await Coroutine.Wait(2000, () => !SelectString.IsOpen);

            await Coroutine.Wait(2000, () => SelectString.IsOpen);

            BagSlot slot;

            while ((slot = myFullStacks.Pop()) != null)
            {
                var openSlot = openSlots.Pop();
                if (openSlot == null)
                {
                    return(false);
                }

                slot.Move(openSlot);

                await Coroutine.Yield();
            }

            return(false);
        }
예제 #24
0
        private static async Task <bool> HelpersMethod()
        {
            if (MainSettingsModel.Instance.UseAutoCutscene)
            {
                if (QuestLogManager.InCutscene)
                {
                    if (AgentCutScene.Instance.CanSkip && !SelectString.IsOpen)
                    {
                        AgentCutScene.Instance.PromptSkip();
                        if (await Coroutine.Wait(600, () => SelectString.IsOpen))
                        {
                            SelectString.ClickSlot(0);
                            await Coroutine.Sleep(1000);
                        }
                    }
                }
            }

            if (MainSettingsModel.Instance.AutoSprint && ActionManager.IsSprintReady && MovementManager.IsMoving)
            {
                ActionManager.Sprint();
            }

            if (MainSettingsModel.Instance.UseAutoTalk)
            {
                if (Core.Me.IsAlive)
                {
                    if (SelectYesno.IsOpen)
                    {
                        SelectYesno.ClickYes();
                    }
                }

                if (Talk.DialogOpen)
                {
                    Talk.Next();
                }

                //if (Request.IsOpen)
                //{
                //    Logger.ATBLog("Handing over any item(s) in your Key Items.");
                //    foreach (var s in InventoryManager.GetBagByInventoryBagId(InventoryBagId.KeyItems))
                //    {
                //        s.Handover();
                //        Logger.ATBLog(s.EnglishName);
                //        await Coroutine.Wait(250, () => Request.HandOverButtonClickable);
                //        if (Request.HandOverButtonClickable) { break; }
                //    }
                //
                //    Logger.ATBLog("Handing over any item(s) in your Inventory.");
                //    foreach (var s in InventoryManager.FilledSlots)
                //    {
                //        s.Handover();
                //        Logger.ATBLog(s.EnglishName);
                //        await Coroutine.Wait(250, () => Request.HandOverButtonClickable);
                //        if (Request.HandOverButtonClickable) { break; }
                //    }
                //
                //    if (Request.HandOverButtonClickable) { Request.HandOver(); }
                //
                //    Logger.ATBLog("Handing over any item(s) in your Armory.");
                //    foreach (var s in InventoryManager.FilledArmorySlots)
                //    {
                //        s.Handover();
                //        Logger.ATBLog(s.EnglishName);
                //        await Coroutine.Wait(250, () => Request.HandOverButtonClickable);
                //        if (Request.HandOverButtonClickable) { break; }
                //    }
                //
                //    if (Request.HandOverButtonClickable) { Request.HandOver(); }
                //    else { await Coroutine.Wait(3000, () => !Request.IsOpen); }
                //}
            }

            if (MainSettingsModel.Instance.UseAutoQuest)
            {
                if (JournalAccept.IsOpen)
                {
                    JournalAccept.Accept();
                }

                if (JournalResult.IsOpen)
                {
                    JournalResult.Complete();
                }
            }
            return(false);
        }
예제 #25
0
        //public static void Log(string text, params object[] args) { Logger.Info(text, args); }

        public static async Task <bool> Main(Vector3 gardenLoc)
        {
            var watering = GardenManager.Plants.Where(r => !Blacklist.Contains(r) && r.Distance2D(gardenLoc) < 10).ToArray();

            foreach (var plant in watering)
            {
                //Water it if it needs it or if we have fertilized it 5 or more times.
                if (AlwaysWater || GardenManager.NeedsWatering(plant))
                {
                    var result = GardenManager.GetCrop(plant);
                    if (result != null)
                    {
                        Log($"Watering {result} {plant.ObjectId:X}");
                        await Navigation.FlightorMove(plant.Location);

                        plant.Interact();
                        if (!await Coroutine.Wait(5000, () => Talk.DialogOpen))
                        {
                            continue;
                        }
                        Talk.Next();
                        if (!await Coroutine.Wait(5000, () => SelectString.IsOpen))
                        {
                            continue;
                        }
                        if (!await Coroutine.Wait(5000, () => SelectString.LineCount > 0))
                        {
                            continue;
                        }
                        if (SelectString.LineCount == 4)
                        {
                            SelectString.ClickSlot(1);
                            await Coroutine.Sleep(2300);
                        }
                        else
                        {
                            Log("Plant is ready to be harvested");
                            SelectString.ClickSlot(1);
                            await Coroutine.Sleep(1000);
                        }
                    }
                    else
                    {
                        Log($"GardenManager.GetCrop returned null {plant.ObjectId:X}");
                    }
                }
            }
            var plants = GardenManager.Plants.Where(r => r.Distance2D(gardenLoc) < 10).ToArray();

            foreach (var plant in plants)
            {
                var result = GardenManager.GetCrop(plant);
                if (result == null)
                {
                    continue;
                }
                Log($"Fertilizing {GardenManager.GetCrop(plant)} {plant.ObjectId:X}");
                await Navigation.FlightorMove(plant.Location);

                plant.Interact();
                if (!await Coroutine.Wait(5000, () => Talk.DialogOpen))
                {
                    continue;
                }
                Talk.Next();
                if (!await Coroutine.Wait(5000, () => SelectString.IsOpen))
                {
                    continue;
                }
                if (!await Coroutine.Wait(5000, () => SelectString.LineCount > 0))
                {
                    continue;
                }
                if (SelectString.LineCount == 4)
                {
                    SelectString.ClickSlot(0);
                    if (await Coroutine.Wait(2000, () => GardenManager.ReadyToFertilize))
                    {
                        if (GardenManager.Fertilize() != FertilizeResult.Success)
                        {
                            continue;
                        }
                        Log($"Plant with objectId {plant.ObjectId:X} was fertilized");
                        await Coroutine.Sleep(2300);
                    }
                    else
                    {
                        Log($"Plant with objectId {plant.ObjectId:X} not able to be fertilized, trying again later");
                    }
                }
                else
                {
                    Log("Plant is ready to be harvested");
                    SelectString.ClickSlot(1);
                    await Coroutine.Sleep(1000);
                }
            }
            return(true);
        }
예제 #26
0
        public async Task <bool> HandInKupoTicket(int slot)
        {
            if ((!HWDLottery.Instance.IsOpen && KupoNpc == null) || KupoNpc.Location.Distance(Core.Me.Location) > 5f)
            {
                await Navigation.GetTo(886, new Vector3(43.59162f, -16f, 170.3864f));
            }

            if (!HWDLottery.Instance.IsOpen && KupoNpc.Location.Distance(Core.Me.Location) > 4f)
            {
                await Navigation.OffMeshMove(KupoNpc.Location);

                await Coroutine.Sleep(500);
            }

            if (!HWDLottery.Instance.IsOpen && KupoNpc != null)
            {
                KupoNpc.Interact();
                Log("Interact with npc");
                await Coroutine.Wait(5000, () => HWDLottery.Instance.IsOpen || Talk.DialogOpen);

                await Coroutine.Sleep(100);

                while (Talk.DialogOpen)
                {
                    Talk.Next();
                    await Coroutine.Wait(5000, () => !Talk.DialogOpen);
                }
                Log("Talking done");
                await Coroutine.Wait(2000, () => SelectYesno.IsOpen);

                if (SelectYesno.IsOpen)
                {
                    SelectYesno.Yes();
                    Log("Select Yes/No open");
                    await Coroutine.Wait(5000, () => HWDLottery.Instance.IsOpen);

                    await Coroutine.Sleep(4000);

                    Log("Ticket Should be loaded");
                }
            }

            if (HWDLottery.Instance.IsOpen)
            {
                Log("Clicking");
                await HWDLottery.Instance.ClickSpot(slot);

                await Coroutine.Sleep(1000);

                HWDLottery.Instance.Close();
                Log("Close");

                await Coroutine.Wait(5000, () => SelectYesno.IsOpen || Talk.DialogOpen);

                Log($"Select Yes/No {SelectYesno.IsOpen} Talk {Talk.DialogOpen}");
                while (Talk.DialogOpen)
                {
                    Talk.Next();
                    await Coroutine.Wait(2000, () => !Talk.DialogOpen);

                    await Coroutine.Wait(2000, () => Talk.DialogOpen || SelectYesno.IsOpen);
                }

                await Coroutine.Sleep(1000);

                await HandInKupoTicket(slot);
            }
            else
            {
                Log("Out of Tickets");
            }
            Log("Done with Kupo Tickets");
            return(false);
        }
예제 #27
0
        public async Task <bool> HandInItem(uint itemId, int index, int job)
        {
            if ((!HWDSupply.Instance.IsOpen && Npc == null) || Npc.Location.Distance(Core.Me.Location) > 5f)
            {
                await Navigation.GetTo(886, new Vector3(43.59162f, -16f, 170.3864f));
            }

            if (!HWDSupply.Instance.IsOpen && Npc.Location.Distance(Core.Me.Location) > 4f)
            {
                await Navigation.OffMeshMove(Npc.Location);

                await Coroutine.Sleep(500);
            }

            if (!HWDSupply.Instance.IsOpen)
            {
                //NpcId = GameObjectManager.GameObjects.First(i => i.EnglishName == EnglishName).NpcId;
                Npc.Interact();
                await Coroutine.Wait(5000, () => HWDSupply.Instance.IsOpen || Talk.DialogOpen);

                await Coroutine.Sleep(1000);

                while (Talk.DialogOpen)
                {
                    Talk.Next();
                    await Coroutine.Wait(5000, () => !Talk.DialogOpen);
                }

                await Coroutine.Sleep(1000);
            }

            if (HWDSupply.Instance.IsOpen)
            {
                if (HWDSupply.Instance.ClassSelected != job)
                {
                    HWDSupply.Instance.ClassSelected = job;
                    await Coroutine.Sleep(1000);
                }
                //var item = InventoryManager.FilledSlots.FirstOrDefault(i => i.RawItemId == itemId);

                foreach (var item in InventoryManager.FilledSlots.Where(i => i.RawItemId == itemId))
                {
                    HWDSupply.Instance.ClickItem(index);

                    await Coroutine.Wait(5000, () => Request.IsOpen);

                    await Coroutine.Sleep(700);

                    item.Handover();
                    await Coroutine.Sleep(100);

                    await Coroutine.Wait(5000, () => Request.HandOverButtonClickable);

                    Request.HandOver();

                    if (ScriptConditions.Helpers.GetSkybuilderScrips() > 9000)
                    {
                        await Coroutine.Wait(2000, () => SelectYesno.IsOpen);
                    }
                    else
                    {
                        await Coroutine.Sleep(100);
                    }

                    if (Translator.Language != Language.Chn)
                    {
                        Log($"Kupo Tickets: {HWDSupply.Instance.NumberOfKupoTickets()}");

                        if (HWDSupply.Instance.NumberOfKupoTickets() >= 9)
                        {
                            Log($"Going to turn in Kupo Tickets: {HWDSupply.Instance.NumberOfKupoTickets()}");
                            if (SelectYesno.IsOpen)
                            {
                                SelectYesno.Yes();
                                await Coroutine.Sleep(1000);
                            }

                            HWDSupply.Instance.Close();
                            await Coroutine.Sleep(2000);
                            await HandInKupoTicket(1);

                            break;
                        }
                    }

                    if (!SelectYesno.IsOpen)
                    {
                        continue;
                    }

                    SelectYesno.Yes();
                    await Coroutine.Sleep(2000);
                }
            }

            if (Request.IsOpen)
            {
                Request.Cancel();
                await Coroutine.Sleep(2000);
            }

            if (InventoryManager.FilledSlots.Any(i => i.RawItemId == itemId))
            {
                await HandInItem(itemId, index, job);
            }
            return(false);
        }
예제 #28
0
        private async Task MainMenu()
        {
            TreeRoot.StatusText = "Running Main Menu";
            if (PartyManager.IsInParty && PartyManager.IsPartyLeader)
            {
                if (!IsCrossRealm)
                {
                    Logger.Warn("I am a Party Leader, waiting for everyone to join the zone.");
                    await Coroutine.Wait(TimeSpan.FromMinutes(30), PartyLeaderWaitConditions);
                }
                else
                {
                    Logger.Warn("I am a Party Leader in a XRealm Party. I assume everyone is in the zone.");
                }

                if (DeepDungeon.StopPlz)
                {
                    return;
                }

                Logger.Warn("Everyone is now in the zone");
                for (var i = 0; i < 6; i++)
                {
                    Logger.Warn("Giving them {0} seconds to do what they need to at the NPC", 60 - i * 10);
                    await Coroutine.Sleep(TimeSpan.FromSeconds(10));

                    if (DeepDungeon.StopPlz)
                    {
                        return;
                    }
                }
            }

            //read the current level state
            await ReadStartingLevel();

            // have save data and our max level is
            if (GetFloorStatus(_saveStates))
            {
                Logger.Verbose("Resetting the floor");
                await DeepDungeonSaveData.ClickReset(UseSaveSlot);

                // todo: wait for server response in a better way.
                await Coroutine.Sleep(1000);
            }

            if (_error)
            {
                lock (_errorLock)
                {
                    _error = false;
                }
            }


            if (!PartyManager.IsInParty || PartyManager.IsPartyLeader)
            {
                Logger.Verbose("Starting Save Slot Selection process");

                await DeepDungeonSaveData.ClickSaveSlot(UseSaveSlot);

                await Coroutine.Wait(2000, () => SelectString.IsOpen || ContentsFinderConfirm.IsOpen || SelectYesno.IsOpen);

                // if select yesno is open (new as of 4.36 hotfixes)
                if (SelectYesno.IsOpen)
                {
                    SelectYesno.ClickYes();
                    await Coroutine.Sleep(1000);
                }

                // if we are using an "empty" save slot
                if (SelectString.IsOpen)
                {
                    Logger.Verbose("Using Empty Save Slot");
                    Logger.Verbose("Going through the Talk dialogs...");

                    await Coroutine.Sleep(1000);

                    SelectString.ClickSlot(0);

                    await Coroutine.Sleep(1000);

                    //                    Logger.Verbose("Are you sure Fixed Party");
                    await Coroutine.Wait(1000, () => SelectYesno.IsOpen);

                    await Coroutine.Sleep(150);

                    if (SelectYesno.IsOpen)
                    {
                        SelectYesno.ClickYes();
                        await Coroutine.Sleep(150);
                    }

                    await Coroutine.Sleep(1000);

                    //-- Are you sure you want to enter alone?
                    if (!PartyManager.IsInParty)
                    {
                        //                        Logger.Verbose("Enter Alone Talk");
                        //talk stuff
                        await Coroutine.Wait(1000, () => Talk.DialogOpen);

                        await Coroutine.Sleep(150);

                        Talk.Next();

                        await Coroutine.Sleep(500);

                        //                        Logger.Verbose("Enter Alone?");
                        await Coroutine.Wait(1000, () => SelectYesno.IsOpen);

                        SelectYesno.ClickYes();
                        await Coroutine.Sleep(1000);
                    }

                    //                    Logger.Verbose("Floor 51 wait");
                    //--floor 51 logic
                    await Coroutine.Wait(1000, () => SelectString.IsOpen || ContentsFinderConfirm.IsOpen);

                    if (SelectString.IsOpen)
                    {
                        await Coroutine.Sleep(1000);

                        if (Settings.Instance.StartAt51)
                        {
                            Logger.Verbose("Start at {1}: {0}", _bettertargetFloor.End > Constants.SelectedDungeon.CheckPointLevel - 1, Constants.SelectedDungeon.CheckPointLevel);
                        }

                        if (Settings.Instance.StartAt51 && _bettertargetFloor.End > Constants.SelectedDungeon.CheckPointLevel - 1)
                        {
                            SelectString.ClickSlot(1);
                        }
                        else
                        {
                            SelectString.ClickSlot(0);
                        }
                        await Coroutine.Sleep(1000);
                    }

                    Logger.Verbose("Done with window interaction.");
                }
                else
                {
                    Logger.Verbose($"ContentsFinderConfirm is open: {ContentsFinderConfirm.IsOpen} so we aren't going through the main menu.");
                }

                _bettertargetFloor = null;
            }

            Logger.Info("Waiting on the queue, Or for an error.");
            DungeonQueue.Reset();
        }
예제 #29
0
        protected override async Task <bool> Main()
        {
            foreach (var unit in GameObjectManager.GameObjects.OrderBy(r => r.Distance()))
            {
                if (unit.NpcId == 2000401 || unit.NpcId == 2000441)
                {
                    unit.Interact();
                    break;
                }
            }
            if (!await Coroutine.Wait(5000, () => SelectString.IsOpen))
            {
                return(isDone = true);
            }
            {
                uint count     = 0;
                var  lineC     = SelectString.LineCount;
                var  countLine = (uint)lineC;
                foreach (var retainer in SelectString.Lines())
                {
                    if (retainer.EndsWith("]") || retainer.EndsWith(")"))
                    {
                        Log("Checking Retainer n° " + (count + 1));
                        // If Venture Completed
                        if (retainer.EndsWith("[探险归来]") || retainer.EndsWith("[Tâche terminée]") || retainer.EndsWith("(Venture complete)"))
                        {
                            Log("Venture Completed !");
                            // Select the retainer
                            SelectString.ClickSlot(count);
                            if (!await Coroutine.Wait(5000, () => Talk.DialogOpen))
                            {
                                continue;
                            }
                            // Skip Dialog
                            Talk.Next();
                            if (!await Coroutine.Wait(5000, () => SelectString.IsOpen))
                            {
                                continue;
                            }
                            // Click on the completed venture
                            SelectString.ClickSlot(5);
                            if (!await Coroutine.Wait(5000, () => RetainerTaskResult.IsOpen))
                            {
                                continue;
                            }
                            // Assign a new venture
                            RetainerTaskResult.Reassign();
                            if (!await Coroutine.Wait(5000, () => RetainerTaskAsk.IsOpen))
                            {
                                continue;
                            }
                            // Confirm new venture
                            RetainerTaskAsk.Confirm();
                            if (!await Coroutine.Wait(5000, () => Talk.DialogOpen))
                            {
                                continue;
                            }
                            // Skip Dialog
                            Talk.Next();
                            if (!await Coroutine.Wait(5000, () => SelectString.IsOpen))
                            {
                                continue;
                            }
                            SelectString.ClickSlot((uint)SelectString.LineCount - 1);
                            if (!await Coroutine.Wait(5000, () => Talk.DialogOpen))
                            {
                                continue;
                            }
                            // Skip Dialog
                            Talk.Next();
                            await Coroutine.Sleep(3000);

                            foreach (var unit in GameObjectManager.GameObjects.OrderBy(r => r.Distance()))
                            {
                                if (unit.NpcId == 2000401 || unit.NpcId == 2000441)
                                {
                                    unit.Interact();
                                    break;
                                }
                            }
                            if (await Coroutine.Wait(5000, () => SelectString.IsOpen))
                            {
                                count++;
                            }
                        }
                        else
                        {
                            Log("Venture not Completed !");
                            count++;
                        }
                    }
                    else
                    {
                        Log("No more Retainer to check");
                        SelectString.ClickSlot(countLine - 1);
                    }
                }
                return(isDone = true);
            }
        }
예제 #30
0
        protected override async Task <bool> Main()
        {
            var retainerList = new RetainerList();

            foreach (var unit in GameObjectManager.GameObjects.OrderBy(r => r.Distance()))
            {
                if (unit.NpcId == 2000401 || unit.NpcId == 2000441)
                {
                    unit.Interact();
                    break;
                }
            }

            if (!await Coroutine.Wait(5000, () => RetainerList.IsOpen))
            {
                return(isDone = true);
            }
            {
                uint index = 0;
                while (index < RetainerCount)
                {
                    Log("Checking Retainer n° " + (index + 1));
                    await Coroutine.Sleep(200);

                    // Select retainer
                    await retainerList.SelectRetainerAndSkipDialog(index);

                    await Coroutine.Wait(5000, () => SelectString.IsOpen);

                    string ventureLine = SelectString.Lines()[5];
                    Log("Venture Status : " + ventureLine);
                    if (ventureLine.EndsWith("(Complete)") || ventureLine.EndsWith("Unternehmung einsehen") || ventureLine.EndsWith("tâche terminée") || ventureLine.EndsWith("[完了]") || ventureLine.EndsWith("[探险归来]"))
                    {
                        Log("Venture Completed !");
                        // Click on the completed venture
                        SelectString.ClickSlot(5);
                        await Coroutine.Wait(5000, () => RetainerTaskResult.IsOpen);

                        // Assign a new venture
                        RetainerTaskResult.Reassign();
                        await Coroutine.Wait(5000, () => RetainerTaskAsk.IsOpen);

                        // Confirm new venture
                        RetainerTaskAsk.Confirm();
                        await Coroutine.Wait(5000, () => Talk.DialogOpen);

                        // Skip Dialog
                        Talk.Next();
                        await Coroutine.Wait(5000, () => SelectString.IsOpen);
                    }
                    SelectString.ClickSlot((uint)SelectString.LineCount - 1);
                    await Coroutine.Wait(5000, () => Talk.DialogOpen);

                    // Skip Dialog
                    Talk.Next();
                    await Coroutine.Wait(5000, () => RetainerList.IsOpen);

                    index++;
                }
                Log("No more Retainer to check");
                await retainerList.CloseInstanceGently();

                return(isDone = true);
            }
        }