protected override void OnDone() { if (SelectYesno.IsOpen) { SelectYesno.ClickNo(); } if (Request.IsOpen) { Request.Cancel(); } if (Window <MasterPieceSupply> .IsOpen) { MasterPieceSupply.Close(); } if (Window <ShopExchangeCurrency> .IsOpen) { ShopExchangeCurrency.Close(); } if (SelectIconString.IsOpen) { SelectIconString.ClickSlot(uint.MaxValue); } }
/// <summary> /// Clicks the SelectIconString of the corresponding Quest. /// </summary> /// <param name="questId"></param> private static async Task <bool> HandleIconString(int questId) { var name = DataManager.GetLocalizedQuestName(questId); if (!SelectIconString.IsOpen) { return(false); } while (SelectIconString.IsOpen) { if (questId > 0) { SelectIconString.ClickLineEquals(name); await Common.Sleep(50); } else { SelectIconString.ClickSlot(0); await Common.Sleep(50); } if (!SelectIconString.IsOpen) { break; } } return(true); }
private void CloseWindows() { if (SelectYesno.IsOpen) { SelectYesno.ClickNo(); } if (Request.IsOpen) { Request.Cancel(); } if (JournalResult.IsOpen) { JournalResult.Decline(); } if (SelectString.IsOpen) { SelectString.ClickSlot(uint.MaxValue); } if (SelectIconString.IsOpen) { SelectIconString.ClickSlot(uint.MaxValue); } if (Shop.Open) { Shop.Close(); } }
protected override RunStatus PostAction(object context) { List <string> lines; try { lines = SelectIconString.Lines(); } catch { return(RunStatus.Failure); } if (lines == null) { return(RunStatus.Failure); } int lineCount = lines.Count; int choiceIndex = lineCount - choiceOffset; if (choiceIndex >= lineCount || choiceIndex < 0) { return(RunStatus.Failure); } SelectIconString.ClickSlot((uint)choiceIndex); Logger.CardinalMessage("Selected icon string: {0}", lines[choiceIndex]); return(RunStatus.Success); }
private async Task BuyScrip(int itemId, int count, int selectString) { await Coroutine.Sleep(500); var unit = GameObjectManager.GetObjectsByNPCIds <Character>(npcIds).OrderBy(r => r.Distance()).FirstOrDefault(); if (unit == null) { _isDone = true; return; } if (!ShopExchangeCurrency.Open && unit.Location.Distance(Core.Me.Location) > 4f) { await Navigation.OffMeshMove(unit.Location); await Coroutine.Sleep(500); } unit.Interact(); await Coroutine.Wait(5000, () => SelectIconString.IsOpen); if (SelectIconString.IsOpen) { SelectIconString.ClickSlot((uint)0); await Coroutine.Wait(5000, () => SelectString.IsOpen); SelectString.ClickSlot((uint)selectString); await Coroutine.Wait(5000, () => ShopExchangeCurrency.Open); if (ShopExchangeCurrency.Open) { ShopExchangeCurrency.Purchase((uint)itemId, (uint)count); await Coroutine.Wait(5000, () => SelectYesno.IsOpen); SelectYesno.ClickYes(); await Coroutine.Sleep(1000); ShopExchangeCurrency.Close(); await Coroutine.Wait(5000, () => SelectString.IsOpen); SelectString.ClickSlot((uint)(SelectString.LineCount - 1)); await Coroutine.Wait(5000, () => SelectString.IsOpen); } } _isDone = true; }
public static void SelectQuit() { uint line; if (SelectString.IsOpen) { line = (uint)(SelectString.LineCount - 1); SelectString.ClickSlot(line); } else if (SelectIconString.IsOpen) { line = (uint)(SelectIconString.LineCount - 1); SelectIconString.ClickSlot(line); } }
public static void SelectLine(uint line) { if (SelectString.IsOpen) { SelectString.ClickSlot(line); } else if (SelectIconString.IsOpen) { SelectIconString.ClickSlot(line); } else if (CutSceneSelectString.IsOpen) { CutSceneSelectString.ClickSlot(line); } }
private async Task BuyItem(int itemId, int npcId, int count, int selectString) { var unit = GameObjectManager.GetObjectsByNPCId <Character>((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(); await Coroutine.Wait(5000, () => SelectIconString.IsOpen); if (SelectIconString.IsOpen) { SelectIconString.ClickSlot((uint)selectString); 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(); } } _isDone = true; }
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()) )); }
public static async Task UseNpcTransition(uint oldzone, Vector3 transition, uint npcId, uint dialogOption) { await GetTo(oldzone, transition); var unit = GameObjectManager.GetObjectByNPCId(npcId); if (!unit.IsWithinInteractRange) { await OffMeshMoveInteract(unit); } unit.Target(); unit.Interact(); await Coroutine.Wait(5000, () => SelectIconString.IsOpen || DialogOpen); if (DialogOpen) { Next(); } if (SelectIconString.IsOpen) { SelectIconString.ClickSlot(dialogOption); await Coroutine.Wait(5000, () => DialogOpen || SelectYesno.IsOpen); } if (DialogOpen) { Next(); } await Coroutine.Wait(3000, () => SelectYesno.IsOpen); if (SelectYesno.IsOpen) { SelectYesno.Yes(); } await Coroutine.Wait(3000, () => !SelectYesno.IsOpen); }
private static async Task <bool> OpenCorrectShopWindow(uint npcId) { if (WorldManager.ZoneId == IdyllshireZoneId) { return(true); } var npc = GameObjectManager.GetObjectByNPCId(npcId); if (npc == null) { return(false); } npc.Interact(); await Coroutine.Sleep(TimeSpan.FromMilliseconds(MainSettings.Instance.ActionDelay)); SelectIconString.ClickSlot(0); await Coroutine.Wait(TimeSpan.FromMilliseconds(MainSettings.Instance.ActionDelay), () => Shop.Open); return(Shop.Open); }
protected override Composite CreateBehavior() { return(new PrioritySelector( new Decorator(ret => QuestId == 65643 && SelectYesno.IsOpen, new Action(r => { SelectYesno.ClickYes(); }) ), new Decorator(ret => QuestId == 65646 && SelectString.IsOpen, new Action(r => { SelectString.ClickSlot(2); }) ), new Decorator(ret => QuestId == 65647 && SelectYesno.IsOpen, new Action(r => { SelectYesno.ClickYes(); }) ), new Decorator(ret => QuestId == 65728 && SelectYesno.IsOpen, new Action(r => { SelectYesno.ClickYes(); }) ), new Decorator(ret => QuestId == 65729 && SelectYesno.IsOpen, new Action(r => { SelectYesno.ClickYes(); }) ), new Decorator(ret => QuestId == 65740 && SelectYesno.IsOpen, new Action(r => { SelectYesno.ClickYes(); }) ), new Decorator(ret => QuestId == 65748 && SelectYesno.IsOpen, new Action(r => { SelectYesno.ClickYes(); }) ), new Decorator(ret => QuestId == 65770 && SelectString.IsOpen, new Action(r => { SelectString.ClickSlot(1); }) ), new Decorator(ret => QuestId == 65963 && SelectYesno.IsOpen, new Action(r => { SelectYesno.ClickYes(); }) ), new Decorator(ret => QuestId == 66426 && SelectString.IsOpen, new Action(r => { SelectString.ClickSlot(2); }) ), new Decorator(ret => QuestId == 66601 && SelectYesno.IsOpen, new Action(r => { SelectYesno.ClickYes(); }) ), new Decorator(ret => QuestId == 66824 && SelectYesno.IsOpen, new Action(r => { SelectYesno.ClickYes(); }) ), new Decorator(ret => QuestId == 66976 && SelectYesno.IsOpen, new Action(r => { SelectYesno.ClickYes(); }) ), new Decorator(ret => QuestId == 67130 && SelectIconString.IsOpen, new Action(r => { SelectIconString.ClickSlot(0); }) ), new Decorator(ret => QuestId == 67179 && SelectYesno.IsOpen, new Action(r => { SelectYesno.ClickYes(); }) ), new Decorator(ret => QuestId == 67183 && SelectYesno.IsOpen, new Action(r => { SelectYesno.ClickYes(); }) ), new Decorator(ret => QuestId == 67254 && SelectYesno.IsOpen, new Action(r => { SelectYesno.ClickYes(); }) ), new Decorator(ret => QuestId == 67596 && SelectString.IsOpen, new Action(r => { SelectString.ClickSlot(3); }) ), new Decorator(ret => QuestId == 67677 && SelectYesno.IsOpen, new Action(r => { SelectYesno.ClickYes(); }) ), new Decorator(ret => QuestId == 67692 && SelectYesno.IsOpen, new Action(r => { SelectYesno.ClickYes(); }) ), new Decorator(ret => QuestId == 67769 && SelectYesno.IsOpen, new Action(r => { SelectYesno.ClickYes(); }) ), new Decorator(ret => QuestId == 67774 && SelectYesno.IsOpen, new Action(r => { SelectYesno.ClickYes(); }) ), new Decorator(ret => QuestId == 67783 && SelectYesno.IsOpen, new Action(r => { SelectYesno.ClickYes(); }) ), new Decorator(ret => QuestId == 67948 && SelectYesno.IsOpen, new Action(r => { SelectYesno.ClickYes(); }) ), new Decorator(ret => QuestId == 67982 && SelectYesno.IsOpen, new Action(r => { SelectYesno.ClickYes(); }) ), new Decorator(ret => QuestId == 68005 && SelectYesno.IsOpen, new Action(r => { SelectYesno.ClickYes(); }) ), new Decorator(ret => QuestId == 68029 && SelectString.IsOpen, new Action(r => { SelectString.ClickSlot(1); }) ), new Decorator(ret => QuestId == 68045 && SelectYesno.IsOpen, new Action(r => { SelectYesno.ClickYes(); }) ), new Decorator(ret => QuestId == 68051 && SelectString.IsOpen, new Action(r => { SelectString.ClickSlot(1); }) ), new Decorator(ret => QuestId == 68066 && SelectYesno.IsOpen, new Action(r => { SelectYesno.ClickYes(); }) ), new Decorator(ret => QuestId == 68079 && SelectString.IsOpen, new Action(r => { SelectString.ClickSlot(1); }) ), new Decorator(ret => QuestId == 68096 && SelectYesno.IsOpen, new Action(r => { SelectYesno.ClickYes(); }) ), new Decorator(ret => QuestId == 68105 && SelectYesno.IsOpen, new Action(r => { SelectYesno.ClickYes(); }) ), new Decorator(ret => QuestId == 68109 && SelectYesno.IsOpen, new Action(r => { SelectYesno.ClickYes(); }) ), new Decorator(ret => QuestId == 68484 && SelectString.IsOpen, new Action(r => { SelectString.ClickSlot(2); }) ), new Decorator(ret => QuestId == 68487 && SelectYesno.IsOpen, new Action(r => { SelectYesno.ClickYes(); }) ), new Decorator(ret => QuestId == 68502 && SelectYesno.IsOpen, new Action(r => { SelectYesno.ClickYes(); }) ), new Decorator(ret => QuestId == 68506 && SelectString.IsOpen, new Action(r => { SelectString.ClickSlot(0); }) ), new Decorator(ret => QuestId == 68508 && SelectYesno.IsOpen, new Action(r => { SelectYesno.ClickYes(); }) ), new Decorator(ret => QuestId == 68558 && SelectYesno.IsOpen, new Action(r => { SelectYesno.ClickYes(); }) ), new Decorator(ret => QuestId == 68562 && SelectYesno.IsOpen, new Action(r => { SelectYesno.ClickYes(); }) ), base.CreateBehavior() )); }
protected Composite Behavior() { return(new PrioritySelector( // can tag execute? new Decorator(ret => !CanRepair(), new Action(r => { _done = true; }) ), new Decorator(ret => CraftingLog.IsOpen, new ActionRunCoroutine(ctx => StopCrafting()) ), // stage 1: Find the NPC new Decorator(ret => Poi.Current.Type == PoiType.None, new PrioritySelector( new Decorator(ret => GameObjectManager.GetObjectByNPCId(NpcId) != null, new Action(r => { NPC = GameObjectManager.GetObjectByNPCId(NpcId); Poi.Current = new Poi(NPC, PoiType.Vendor); }) ), new Decorator(ret => XYZ != null && Core.Player.Location.Distance(XYZ) > 20f, CommonBehaviors.MoveAndStop(ret => XYZ, 19f, true, null, RunStatus.Success) ), new Decorator(ret => NPC == null, new Action(r => { _done = true; }) ) ) ), // stage 2: go to NPC and Interact new Decorator(ret => Poi.Current.Type == PoiType.Vendor && !Repair.IsOpen, new PrioritySelector( new Decorator(ret => SelectIconString.IsOpen, new Action(r => { SelectIconString.ClickSlot(DialogOption); }) ), new Decorator(ret => Core.Player.Location.Distance(Poi.Current.Location) > 3f, CommonBehaviors.MoveAndStop(ret => Poi.Current.Location, 2f, true, null, RunStatus.Failure) ), new Decorator(ret => Poi.Current.Type == PoiType.Vendor, new Action(r => { Poi.Current.Unit.Interact(); }) ) )), // stage 3: repair new Decorator(ret => Repair.IsOpen, new PrioritySelector( new Decorator(ret => Repaired, new Action(r => { Repair.Close(); _done = true; }) ), new Decorator(ret => Repair.IsOpen && !RepairAllClicked, new Action(r => { RepairAllClicked = true; Repair.RepairAll(); }) ), new Decorator(ret => SelectYesno.IsOpen, new Action(r => { SelectYesno.ClickYes(); Repaired = true; }) ) )) )); }
protected override async Task <bool> Main() { if (interactTimeout.Elapsed.TotalSeconds > Timeout) { Logger.Error(Localization.Localization.ExTurnInGuildLeve_TurninTimeout); isDone = true; return(true); } if (!checkedTransport) { checkedTransport = true; StatusText = Localization.Localization.ExTurnInGuildLeve_CheckTransport; var selectYesnoCountWindow = new SelectYesnoCount(); if (await selectYesnoCountWindow.Refresh(2000)) { StatusText = Localization.Localization.ExTurnInGuildLeve_SelectTransport; if (AcceptTransport) { selectYesnoCountWindow.Yes(); await Coroutine.Wait(5000, () => CommonBehaviors.IsLoading); await Coroutine.Wait(System.Threading.Timeout.Infinite, () => !CommonBehaviors.IsLoading); } else { await selectYesnoCountWindow.CloseInstance(); } return(true); } } // Movement if (ExProfileBehavior.Me.Distance(Location) > 3.5) { StatusText = Localization.Localization.ExTurnInGuildLeve_Move + NpcId; await Location.MoveTo(radius : 3.4f, name : " NpcId: " + NpcId); return(true); } if (!interactTimeout.IsRunning) { interactTimeout.Restart(); } // Interact if (Core.Target == null && ExProfileBehavior.Me.Distance(Location) <= 3.5) { return(await InteractWithNpc()); } if (Talk.DialogOpen) { await HandleTalk(); } if (SelectIconString.IsOpen) { if (iconStringIndex == 9001) { iconStringIndex = (uint)SelectIconString.Lines().Count - 1; } // We will just click the last quest and decrement until we have either no quests left or none to turn in. SelectIconString.ClickSlot(--iconStringIndex); await Coroutine.Sleep(500); if (iconStringIndex == uint.MaxValue) { Logger.Warn(Localization.Localization.ExTurnInGuildLeve_NothingToTurnin); isDone = true; return(true); } return(true); } if (SelectString.IsOpen) { var lines = SelectString.Lines(); // If Collect Reward exists, we click that; otherwise we will click Close. (-1 as uint = uint.MaxValue) var index = (uint)lines.IndexOf(CollectRewardText, StringComparer.InvariantCultureIgnoreCase); if (index != uint.MaxValue) { Logger.Info(Localization.Localization.ExTurnInGuildLeve_CollectReward, WorldManager.EorzaTime); SelectString.ClickSlot(index); await Coroutine.Yield(); return(true); } // If yes is an option, click it to turn in more items.(crafting) index = (uint)lines.IndexOf(YesText, StringComparer.InvariantCultureIgnoreCase); if (index != uint.MaxValue) { Logger.Info(Localization.Localization.ExTurnInGuildLeve_TurninMore, WorldManager.EorzaTime); SelectString.ClickSlot(index); await Coroutine.Yield(); return(true); } Logger.Warn(Localization.Localization.ExTurnInGuildLeve_NoRewardsLeft); isDone = true; SelectString.ClickSlot(index); await Coroutine.Yield(); return(true); } if (Request.IsOpen) { var itemCount = Memory.Request.ItemsToTurnIn.Length; var itemId = Memory.Request.ItemId1; IEnumerable <BagSlot> itemSlots = InventoryManager.FilledInventoryAndArmory.Where( bs => bs.RawItemId == itemId && !Blacklist.Contains((uint)bs.Pointer.ToInt32(), BlacklistFlags.Loot)).ToArray(); if (HqOnly) { itemSlots = itemSlots.Where(bs => bs.IsHighQuality); } if (NqOnly) { itemSlots = itemSlots.Where(bs => !bs.IsHighQuality); } var items = itemSlots.Take(itemCount).ToArray(); if (items.Length == 0) { Logger.Warn(Localization.Localization.ExTurnInGuildLeve_NoItemToTurnin, HqOnly, NqOnly, itemId); isDone = true; return(true); } StatusText = Localization.Localization.ExTurnInGuildLeve_TurnIn; var isHq = items.Any(i => i.IsHighQuality); var itemName = items[0].EnglishName; var requestAttempts = 0; while (Request.IsOpen && requestAttempts++ < 5 && Behaviors.ShouldContinue) { foreach (var item in items) { item.Handover(); await Coroutine.Yield(); } await Coroutine.Wait(1000, () => Request.HandOverButtonClickable); if (Request.HandOverButtonClickable) { Request.HandOver(); if (isHq) { await Coroutine.Wait(2000, () => !Request.IsOpen && SelectYesno.IsOpen); } else { await Coroutine.Wait(2000, () => !Request.IsOpen); } } } turnedItemsIn = true; if (SelectYesno.IsOpen) { SelectYesno.ClickYes(); await Coroutine.Yield(); Logger.Info(Localization.Localization.ExTurnInGuildLeve_TurnInHq, itemName, WorldManager.EorzaTime); } else { Logger.Info(Localization.Localization.ExTurnInGuildLeve_TurnInNq, itemName, WorldManager.EorzaTime); } await HandleTalk(); await Coroutine.Wait(2000, () => JournalResult.IsOpen); return(true); } if (JournalResult.IsOpen) { await Coroutine.Wait(2000, () => JournalResult.ButtonClickable); JournalResult.Complete(); Logger.Info(Localization.Localization.ExTurnInGuildLeve_Complete, WorldManager.EorzaTime); await Coroutine.Wait(2000, () => !JournalResult.IsOpen); await HandleTalk(); return(true); } if (!await WaitForOpenWindow()) { if (MultipleQuests) { Logger.Info(Localization.Localization.ExTurnInGuildLeve_OpenWindow); CloseWindows(); ExProfileBehavior.Me.ClearTarget(); } else { isDone = true; } } return(true); }
private async Task <bool> ResolveItem() { if (item != null) { return(false); } var slots = InventoryManager.FilledInventoryAndArmory.Where( i => !Blacklist.Contains((uint)i.Pointer.ToInt32(), BlacklistFlags.Loot)).ToArray(); if (Collectables == null) { item = slots.FirstOrDefault(i => i.Collectability > 0); } else { foreach (var collectable in Collectables) { var bagslots = slots.Where(i => i.Collectability >= collectable.Value && i.Collectability <= collectable.MaxValueForTurnIn).ToArray(); if (collectable.Id > 0) { item = bagslots.FirstOrDefault(i => i.RawItemId == collectable.Id); } item = item ?? bagslots.FirstOrDefault( i => string.Equals(collectable.LocalName, i.Name, StringComparison.InvariantCultureIgnoreCase)) ?? bagslots.FirstOrDefault( i => string.Equals(collectable.Name, i.EnglishName, StringComparison.InvariantCultureIgnoreCase)); if (item != null) { break; } } } if (item != null && item.Item != null) { Logger.Verbose(Localization.Localization.ExTurnInCollectable_AttemptingTurnin, item.EnglishName, item.Pointer.ToString("X8")); return(false); } if ((turnedItemsIn || ForcePurchase) && !await HandleSkipPurchase()) { return(false); } if (SelectYesno.IsOpen) { SelectYesno.ClickNo(); } if (Request.IsOpen) { Request.Cancel(); } var masterpieceSupply = new MasterPieceSupply(); if (masterpieceSupply.IsValid) { await masterpieceSupply.CloseInstanceGently(); } var shopExchangeCurrency = new ShopExchangeCurrency(); if (shopExchangeCurrency.IsValid) { await shopExchangeCurrency.CloseInstanceGently(); } if (SelectIconString.IsOpen) { SelectIconString.ClickSlot(uint.MaxValue); } return(isDone = true); }
private async Task <bool> PurchaseItems() { if (ExProfileBehavior.Me.Location.Distance(shopExchangeCurrencyNpc.Location) > 4) { // too far away, should go back to MoveToNpc return(true); } StatusText = Localization.Localization.ExTurnInCollectable_Purchase; var itemsToPurchase = ShopPurchases.Where(ShouldPurchaseItem).ToArray(); var npc = GameObjectManager.GetObjectByNPCId(shopExchangeCurrencyNpc.NpcId); var shopType = ShopType.Yellow50; var shopExchangeCurrency = new ShopExchangeCurrency(); foreach (var purchaseItem in itemsToPurchase) { var purchaseItemInfo = Data.ShopItemMap[purchaseItem.ShopItem]; var purchaseItemData = purchaseItemInfo.ItemData; if (shopType != purchaseItemInfo.ShopType && shopExchangeCurrency.IsValid) { await shopExchangeCurrency.CloseInstanceGently(); } shopType = purchaseItemInfo.ShopType; // target var ticks = 0; while (Core.Target == null && !shopExchangeCurrency.IsValid && ticks++ < 10 && Behaviors.ShouldContinue) { npc.Target(); await Coroutine.Wait(1000, () => Core.Target != null); } // check for timeout if (ticks > 10) { Logger.Error(Localization.Localization.ExTurnInCollectable_TargetingTimeout); isDone = true; return(true); } // interact ticks = 0; while (!SelectIconString.IsOpen && !shopExchangeCurrency.IsValid && ticks++ < 10 && Behaviors.ShouldContinue) { npc.Interact(); await Coroutine.Wait(1000, () => SelectIconString.IsOpen); } // check for timeout if (ticks > 10) { Logger.Error(Localization.Localization.ExTurnInCollectable_InteractingTimeout); isDone = true; return(true); } if (purchaseItemInfo.Index == (int)ShopItem.OnHighOrchestrionRoll && Location != Locations.RhalgrsReach || purchaseItemInfo.Index >= (int)ShopItem.MoonbeamSilk && purchaseItemInfo.Index <= (int)ShopItem.RaziqcoatHq && Location != Locations.RhalgrsReach || purchaseItemInfo.Index == (int)ShopItem.GardenGravel && Location != Locations.RhalgrsReach || purchaseItemInfo.Index == (int)ShopItem.SongsofSaltandSufferingOrchestrionRoll && Location != Locations.RhalgrsReach) { Logger.Warn(Localization.Localization.ExTurnInCollectable_FailedPurchaseGorRhalgrsReach, purchaseItemData.EnglishName); continue; } ticks = 0; while (SelectIconString.IsOpen && ticks++ < 5 && Behaviors.ShouldContinue) { SelectIconString.ClickSlot((uint)purchaseItemInfo.ShopJob); await Coroutine.Wait(1000, () => SelectString.IsOpen); SelectString.ClickSlot((purchaseItemInfo.ShopJob == ShopJob.Gatherer && purchaseItemInfo.ShopType > ShopType.Yellow61) ? (uint)purchaseItemInfo.ShopType - 1 : (uint)purchaseItemInfo.ShopType); await shopExchangeCurrency.Refresh(5000); } if (ticks > 5 || !shopExchangeCurrency.IsValid) { Logger.Error(Localization.Localization.ExTurnInCollectable_InteractingTimeout); if (SelectIconString.IsOpen) { SelectIconString.ClickSlot(uint.MaxValue); } isDone = true; return(true); } await Coroutine.Sleep(600); int scripsLeft; while (purchaseItemData.ItemCount() < purchaseItem.MaxCount && (scripsLeft = Memory.Scrips.GetRemainingScripsByShopType(purchaseItemInfo.ShopJob, purchaseItemInfo.ShopType) ) >= purchaseItemInfo.Cost && Behaviors.ShouldContinue) { var qtyLeftToBuy = purchaseItem.MaxCount - (int)purchaseItemData.ItemCount(); var qtyBuyable = scripsLeft / purchaseItemInfo.Cost; var qtyToBuy = Math.Min(99, Math.Min(qtyLeftToBuy, qtyBuyable)); var indexPurchaseItem = (Location != Locations.Idyllshire && Location != Locations.RhalgrsReach && purchaseItemInfo.ShopJob == ShopJob.Crafter && purchaseItemInfo.ShopType == ShopType.Yellow58 && purchaseItemInfo.Index >= (int)ShopItem.MoonbeamSilk - 200) ? purchaseItemInfo.Index - 12 : purchaseItemInfo.Index; if (!await shopExchangeCurrency.PurchaseItem(indexPurchaseItem, (uint)qtyToBuy, 20)) { Logger.Error(Localization.Localization.ExTurnInCollectable_PurchaseTimeout, purchaseItemData.EnglishName); await shopExchangeCurrency.CloseInstance(); isDone = true; return(true); } var left = scripsLeft; await Coroutine.Wait( 5000, () => (scripsLeft = Memory.Scrips.GetRemainingScripsByShopType(purchaseItemInfo.ShopJob, purchaseItemInfo.ShopType)) != left); Logger.Info( Localization.Localization.ExTurnInCollectable_Purchased, purchaseItemData.EnglishName, purchaseItemInfo.Cost * qtyToBuy, purchaseItemInfo.ShopType, WorldManager.EorzaTime, scripsLeft, qtyToBuy); await Coroutine.Yield(); } await Coroutine.Sleep(1000); } Logger.Info(Localization.Localization.ExTurnInCollectable_PurchaseComplete); SelectYesno.ClickNo(); if (SelectIconString.IsOpen) { SelectIconString.ClickSlot(uint.MaxValue); } await shopExchangeCurrency.CloseInstance(); isDone = true; return(true); }
private async Task <bool> ResolveItem() { if (item != null) { return(false); } var slots = InventoryManager.FilledInventoryAndArmory.Where( i => !Blacklist.Contains((uint)i.Pointer.ToInt64(), BlacklistFlags.Loot)).ToArray(); var blackListDictionnary = new Dictionary <string, uint> { { "Fire Moraine", 5214 }, { "Lightning Moraine", 5218 }, { "Radiant Fire Moraine", 5220 }, { "Radiant Lightning Moraine", 5224 }, { "Bright Fire Rock", 12966 }, { "Bright Lightning Rock", 12967 }, { "Granular Clay", 12968 }, { "Peat Moss", 12969 }, { "Black Soil", 12970 }, { "Highland Oregano", 12971 }, { "Furymint", 12972 }, { "Clary Sage", 12973 }, { "Lover's Laurel", 15948 }, { "Radiant Astral Moraine", 15949 }, { "Near Eastern Antique", 17549 }, { "Coerthan Souvenir", 17550 }, { "Maelstrom Materiel ", 17551 }, { "Heartfelt Gift", 17552 }, { "Orphanage Donation", 17553 }, { "Dated Radz-at-Han Coin", 17557 }, { "Ice Stalagmite", 17558 }, { "Duskfall Moss", 17559 }, { "Glass Eye", 17560 }, { "Rainbow Pigment", 17561 }, { "Thavnairian Leaf", 17562 }, { "Ghost Faerie", 17563 }, { "Red Sky Coral", 17564 }, { "Lovers' Clam", 17565 }, { "River Shrimp", 17566 }, { "Windtea Leaves", 19916 }, { "Torreya Branch", 19937 }, { "Schorl", 20009 }, { "Perlite", 20010 }, { "Almandine", 20011 }, { "Doman Yellow", 20012 }, { "Gyr Abanian Souvenir", 20775 }, { "Far Eastern Antique", 20776 }, { "Gold Saucer Consolation Prize", 20777 }, { "M Tribe Sundries", 20778 }, { "Resistance Materiel", 20779 }, { "Starcrack", 20780 }, { "Shishu Koban", 20781 }, { "Cotter Dynasty Relic", 20782 }, { "Peaks Pigment", 20783 }, { "Yellow Kudzu Root", 20784 }, { "Gyr Abanian Chub", 20785 }, { "Coral Horse", 20786 }, { "Maiden's Heart", 20787 }, { "Velodyna Salmon", 20788 }, { "Purple Buckler", 20789 }, { "Gyr Abanian Remedies", 23143 }, { "Anti-shark Harpoon", 23144 }, { "Coerthan Cold-weather Gear", 23145 }, { "Sui-no-Sato Special", 23146 }, { "Cloud Pearl", 23147 }, { "Yanxian Soil", 23220 }, { "Yanxian Verbena", 23221 } }; if (Collectables == null) { item = slots.FirstOrDefault(i => i.Collectability > 0 && !blackListDictionnary.ContainsValue(i.RawItemId)); } else { foreach (var collectable in Collectables) { var bagslots = slots.Where(i => i.Collectability >= collectable.Value && i.Collectability <= collectable.MaxValueForTurnIn).ToArray(); if (collectable.Id > 0) { item = bagslots.FirstOrDefault(i => i.RawItemId == collectable.Id); } item = item ?? bagslots.FirstOrDefault( i => string.Equals(collectable.LocalName, i.Name, StringComparison.InvariantCultureIgnoreCase)) ?? bagslots.FirstOrDefault( i => string.Equals(collectable.Name, i.EnglishName, StringComparison.InvariantCultureIgnoreCase)); if (item != null) { break; } } } if (item != null && item.Item != null) { Logger.Verbose(Localization.Localization.ExTurnInCollectable_AttemptingTurnin, item.EnglishName, item.Pointer.ToString("X8")); return(false); } if ((turnedItemsIn || ForcePurchase) && !await HandleSkipPurchase()) { return(false); } if (SelectYesno.IsOpen) { SelectYesno.ClickNo(); } if (Request.IsOpen) { Request.Cancel(); } var masterpieceSupply = new MasterPieceSupply(); if (masterpieceSupply.IsValid) { await masterpieceSupply.CloseInstanceGently(); } var shopExchangeCurrency = new ShopExchangeCurrency(); if (shopExchangeCurrency.IsValid) { await shopExchangeCurrency.CloseInstanceGently(); } if (SelectIconString.IsOpen) { SelectIconString.ClickSlot(uint.MaxValue); } return(isDone = true); }
private async Task <bool> PurchaseItems() { if (ExProfileBehavior.Me.Location.Distance(shopExchangeCurrencyNpc.Location) > 4) { // too far away, should go back to MoveToNpc return(true); } StatusText = Localization.Localization.ExTurnInCollectable_Purchase; var itemsToPurchase = ShopPurchases.Where(ShouldPurchaseItem).ToArray(); var npc = GameObjectManager.GetObjectByNPCId(shopExchangeCurrencyNpc.NpcId); var shopType = ShopType.RedGatherer50; var shopExchangeCurrency = new ShopExchangeCurrency(); foreach (var purchaseItem in itemsToPurchase) { var purchaseItemInfo = Data.ShopItemMap[purchaseItem.ShopItem]; var purchaseItemData = purchaseItemInfo.ItemData; if (shopType != purchaseItemInfo.ShopType && shopExchangeCurrency.IsValid) { await shopExchangeCurrency.CloseInstanceGently(); } shopType = purchaseItemInfo.ShopType; // target var ticks = 0; while (Core.Target == null && !shopExchangeCurrency.IsValid && ticks++ < 10 && Behaviors.ShouldContinue) { npc.Target(); await Coroutine.Wait(1000, () => Core.Target != null); } // check for timeout if (ticks > 10) { Logger.Error(Localization.Localization.ExTurnInCollectable_TargetingTimeout); isDone = true; return(true); } // interact ticks = 0; while (!SelectIconString.IsOpen && !shopExchangeCurrency.IsValid && ticks++ < 10 && Behaviors.ShouldContinue) { npc.Interact(); await Coroutine.Wait(1000, () => SelectIconString.IsOpen); } // check for timeout if (ticks > 10) { Logger.Error(Localization.Localization.ExTurnInCollectable_InteractingTimeout); isDone = true; return(true); } #if RB_CN if ((Location == Locations.MorDhona) && (purchaseItemInfo.ShopType == ShopType.YellowCrafterItems || purchaseItemInfo.ShopType == ShopType.YellowGathererItems)) { Logger.Warn(Localization.Localization.ExTurnInCollectable_FailedPurchaseMorDhona, purchaseItemData.EnglishName); continue; } ticks = 0; while (SelectIconString.IsOpen && ticks++ < 5 && Behaviors.ShouldContinue) { if ((Location == Locations.MorDhona) && (purchaseItemInfo.ShopType == ShopType.RedGatherer50 || purchaseItemInfo.ShopType == ShopType.RedGatherer58)) { SelectIconString.ClickSlot((uint)purchaseItemInfo.ShopType - 5); } else { SelectIconString.ClickSlot((uint)purchaseItemInfo.ShopType); } await shopExchangeCurrency.Refresh(5000); } #else if ((Location == Locations.MorDhona) && (purchaseItemInfo.ShopType == ShopType.YellowCrafterItems || purchaseItemInfo.ShopType == ShopType.YellowGathererItems)) { Logger.Warn(Localization.Localization.ExTurnInCollectable_FailedPurchaseMorDhona, purchaseItemData.EnglishName); continue; } ticks = 0; while (SelectIconString.IsOpen && ticks++ < 5 && Behaviors.ShouldContinue) { if ((Location == Locations.MorDhona) && (purchaseItemInfo.ShopType == ShopType.RedGatherer50 || purchaseItemInfo.ShopType == ShopType.RedGatherer58)) { SelectIconString.ClickSlot((uint)purchaseItemInfo.ShopType - 5); } else { SelectIconString.ClickSlot((uint)purchaseItemInfo.ShopType); } await shopExchangeCurrency.Refresh(5000); } #endif if (ticks > 5 || !shopExchangeCurrency.IsValid) { Logger.Error(Localization.Localization.ExTurnInCollectable_InteractingTimeout); if (SelectIconString.IsOpen) { SelectIconString.ClickSlot(uint.MaxValue); } isDone = true; return(true); } await Coroutine.Sleep(600); int scripsLeft; while (purchaseItemData.ItemCount() < purchaseItem.MaxCount && (scripsLeft = Memory.Scrips.GetRemainingScripsByShopType(purchaseItemInfo.ShopType)) >= purchaseItemInfo.Cost && Behaviors.ShouldContinue) { var qtyLeftToBuy = purchaseItem.MaxCount - (int)purchaseItemData.ItemCount(); var qtyBuyable = scripsLeft / purchaseItemInfo.Cost; var qtyToBuy = Math.Min(99, Math.Min(qtyLeftToBuy, qtyBuyable)); if (!await shopExchangeCurrency.PurchaseItem(purchaseItemInfo.Index, (uint)qtyToBuy, 20)) { Logger.Error(Localization.Localization.ExTurnInCollectable_PurchaseTimeout, purchaseItemData.EnglishName); await shopExchangeCurrency.CloseInstance(); isDone = true; return(true); } var left = scripsLeft; await Coroutine.Wait( 5000, () => (scripsLeft = Memory.Scrips.GetRemainingScripsByShopType(purchaseItemInfo.ShopType)) != left); Logger.Info( Localization.Localization.ExTurnInCollectable_Purchased, purchaseItemData.EnglishName, purchaseItemInfo.Cost * qtyToBuy, purchaseItemInfo.ShopType, WorldManager.EorzaTime, scripsLeft, qtyToBuy); await Coroutine.Yield(); } await Coroutine.Sleep(1000); } Logger.Info(Localization.Localization.ExTurnInCollectable_PurchaseComplete); SelectYesno.ClickNo(); if (SelectIconString.IsOpen) { SelectIconString.ClickSlot(uint.MaxValue); } await shopExchangeCurrency.CloseInstance(); isDone = true; return(true); }
public async Task <bool> Shop() { var npcId = GameObjectManager.GetObjectByNPCId(1012301); if (!npcId.IsWithinInteractRange) { var _target = npcId.Location; Navigator.PlayerMover.MoveTowards(_target); while (_target.Distance2D(Core.Me.Location) >= 4) { Navigator.PlayerMover.MoveTowards(_target); await Coroutine.Sleep(100); } Navigator.PlayerMover.MoveStop(); } npcId.Interact(); await Coroutine.Wait(5000, () => SelectIconString.IsOpen); SelectIconString.ClickSlot(0); await Coroutine.Wait(5000, () => SelectString.IsOpen); SelectString.ClickSlot(5); await Coroutine.Sleep(700); var windowName = "ShopExchangeCurrency"; await Coroutine.Wait(5000, () => RaptureAtkUnitManager.GetWindowByName(windowName) != null); var windowByName = RaptureAtkUnitManager.GetWindowByName(windowName); if (windowByName == null) { return(false); } while (SpecialCurrencyManager.GetCurrencyCount(SpecialCurrency.YellowCraftersScrips) > 50 && InventoryManager.FreeSlots > 1) { if (windowByName != null) { windowByName.SendAction(4, 3, 0, 3, 0x19, 3, 1, 0, 0); } await Coroutine.Wait(5000, () => SelectYesno.IsOpen); if (SelectYesno.IsOpen) { SelectYesno.Yes(); } await Coroutine.Sleep(700); } windowByName.SendAction(1, 3uL, 4294967295uL); await Coroutine.Wait(5000, () => SelectString.IsOpen); SelectString.ClickSlot((uint)(SelectString.LineCount - 1)); await Coroutine.Sleep(700); return(true); }
private async Task <bool> ResolveItem() { if (item != null) { return(false); } var slots = InventoryManager.FilledInventoryAndArmory.Where( i => !Blacklist.Contains((uint)i.Pointer.ToInt64(), BlacklistFlags.Loot)).ToArray(); Dictionary <string, uint> BlackListDictionnary = new Dictionary <string, uint> { { "Fire Moraine", 5214 }, { "Lightning Moraine", 5218 }, { "Radiant Fire Moraine", 5220 }, { "Radiant Lightning Moraine", 5224 }, { "Bright Fire Rock", 12966 }, { "Bright Lightning Rock", 12967 }, { "Granular Clay", 12968 }, { "Peat Moss", 12969 }, { "Black Soil", 12970 }, { "Highland Oregano", 12971 }, { "Furymint", 12972 }, { "Clary Sage", 12973 }, { "Lover's Laurel", 15948 }, { "Radiant Astral Moraine", 15949 }, { "Dated Radz-at-Han Coin", 17557 }, { "Ice Stalagmite", 17558 }, { "Duskfall Moss", 17559 }, { "Glass Eye", 17560 }, { "Rainbow Pigment", 17561 }, { "Thavnairian Leaf", 17562 }, { "Ghost Faerie", 17563 }, { "Red Sky Coral", 17564 }, { "Lovers' Clam", 17565 }, { "River Shrimp", 17566 }, { "Windtea Leaves", 19916 }, { "Torreya Branch", 19937 }, { "Schorl", 20009 }, { "Perlite", 20010 }, { "Almandine", 20011 }, { "Doman Yellow", 20012 } }; if (Collectables == null) { item = slots.FirstOrDefault(i => i.Collectability > 0 && !BlackListDictionnary.ContainsValue(i.RawItemId)); } else { foreach (var collectable in Collectables) { var bagslots = slots.Where(i => i.Collectability >= collectable.Value && i.Collectability <= collectable.MaxValueForTurnIn).ToArray(); if (collectable.Id > 0) { item = bagslots.FirstOrDefault(i => i.RawItemId == collectable.Id); } item = item ?? bagslots.FirstOrDefault( i => string.Equals(collectable.LocalName, i.Name, StringComparison.InvariantCultureIgnoreCase)) ?? bagslots.FirstOrDefault( i => string.Equals(collectable.Name, i.EnglishName, StringComparison.InvariantCultureIgnoreCase)); if (item != null) { break; } } } if (item != null && item.Item != null) { Logger.Verbose(Localization.Localization.ExTurnInCollectable_AttemptingTurnin, item.EnglishName, item.Pointer.ToString("X8")); return(false); } if ((turnedItemsIn || ForcePurchase) && !await HandleSkipPurchase()) { return(false); } if (SelectYesno.IsOpen) { SelectYesno.ClickNo(); } if (Request.IsOpen) { Request.Cancel(); } var masterpieceSupply = new MasterPieceSupply(); if (masterpieceSupply.IsValid) { await masterpieceSupply.CloseInstanceGently(); } var shopExchangeCurrency = new ShopExchangeCurrency(); if (shopExchangeCurrency.IsValid) { await shopExchangeCurrency.CloseInstanceGently(); } if (SelectIconString.IsOpen) { SelectIconString.ClickSlot(uint.MaxValue); } return(isDone = true); }
protected override Composite CreateBehavior() { return(new PrioritySelector( new Decorator(ret => QuestId == 65643 && SelectYesno.IsOpen, new Action(r => { SelectYesno.ClickYes(); }) ), new Decorator(ret => QuestId == 65646 && SelectString.IsOpen, new Action(r => { SelectString.ClickSlot(2); }) ), new Decorator(ret => QuestId == 65647 && SelectYesno.IsOpen, new Action(r => { SelectYesno.ClickYes(); }) ), new Decorator(ret => QuestId == 65728 && SelectYesno.IsOpen, new Action(r => { SelectYesno.ClickYes(); }) ), new Decorator(ret => QuestId == 65729 && SelectYesno.IsOpen, new Action(r => { SelectYesno.ClickYes(); }) ), new Decorator(ret => QuestId == 65740 && SelectYesno.IsOpen, new Action(r => { SelectYesno.ClickYes(); }) ), new Decorator(ret => QuestId == 65963 && SelectYesno.IsOpen, new Action(r => { SelectYesno.ClickYes(); }) ), new Decorator(ret => QuestId == 66426 && SelectString.IsOpen, new Action(r => { SelectString.ClickSlot(2); }) ), new Decorator(ret => QuestId == 66601 && SelectYesno.IsOpen, new Action(r => { SelectYesno.ClickYes(); }) ), new Decorator(ret => QuestId == 66976 && SelectYesno.IsOpen, new Action(r => { SelectYesno.ClickYes(); }) ), new Decorator(ret => QuestId == 67130 && SelectIconString.IsOpen, new Action(r => { SelectIconString.ClickSlot(0); }) ), new Decorator(ret => QuestId == 67179 && SelectYesno.IsOpen, new Action(r => { SelectYesno.ClickYes(); }) ), new Decorator(ret => QuestId == 67183 && SelectYesno.IsOpen, new Action(r => { SelectYesno.ClickYes(); }) ), new Decorator(ret => QuestId == 67254 && SelectYesno.IsOpen, new Action(r => { SelectYesno.ClickYes(); }) ), new Decorator(ret => QuestId == 67596 && SelectString.IsOpen, new Action(r => { SelectString.ClickSlot(3); }) ), new Decorator(ret => QuestId == 67692 && SelectYesno.IsOpen, new Action(r => { SelectYesno.ClickYes(); }) ), new Decorator(ret => QuestId == 67769 && SelectYesno.IsOpen, new Action(r => { SelectYesno.ClickYes(); }) ), new Decorator(ret => QuestId == 67774 && SelectYesno.IsOpen, new Action(r => { SelectYesno.ClickYes(); }) ), new Decorator(ret => QuestId == 67783 && SelectYesno.IsOpen, new Action(r => { SelectYesno.ClickYes(); }) ), base.CreateBehavior() )); }
protected async Task<bool> TurnIn() { foreach (var slot in InventoryManager.FilledSlots) { // Adamantite // Chysahl Green // Thunderbolt Eel // Eventide Jade // Periwinkle // Tiny Axolotl if ((slot.RawItemId == 12538 && slot.Collectability >= 380 && ItemIds.Contains(12538)) || (slot.RawItemId == 12900 && slot.Collectability >= 380 && ItemIds.Contains(12900)) || (slot.RawItemId == 12828 && slot.Collectability >= 579 && ItemIds.Contains(12828)) || (slot.RawItemId == 13760 && slot.Collectability >= 450 && ItemIds.Contains(13760)) || (slot.RawItemId == 13762 && slot.Collectability >= 450 && ItemIds.Contains(13762)) || (slot.RawItemId == 12774 && slot.Collectability >= 321 && ItemIds.Contains(12774))) { _haveItem = true; } } if (_haveItem) { Log("Start"); if (GatheringManager.WindowOpen) { Log("Waiting for gathering window to close"); Thread.Sleep(2000); } if (FishingManager.State != FishingState.None) { Log("Stop fishing"); ActionManager.DoAction("Quit", Core.Me); await Coroutine.Wait(5000, () => FishingManager.State == FishingState.None); } if (WorldManager.ZoneId != 478) { await TeleportTo(478, 75); } var destination = new Vector3(-18.48964f, 206.4994f, 53.98175f); if (Core.Me.Distance(destination) > CharacterSettings.Instance.MountDistance && !Core.Me.IsMounted) { while (!Core.Me.IsMounted) { await CommonTasks.MountUp(); } } while (Core.Me.Distance(destination) > 1f) { var sprintDistance = Math.Min(20.0f, CharacterSettings.Instance.MountDistance); Navigator.MoveTo(destination); await Coroutine.Yield(); if (Core.Me.Distance(destination) > sprintDistance && !Core.Me.IsMounted) { ActionManager.Sprint(); await Coroutine.Sleep(500); } } if (Core.Me.Distance(destination) <= 1f) { await CommonTasks.StopAndDismount(); } GameObjectManager.GetObjectByNPCId(1012229).Interact(); await Coroutine.Wait(5000, () => SelectIconString.IsOpen); SelectIconString.ClickSlot(0); await Coroutine.Sleep(2000); foreach (var item in InventoryManager.FilledSlots) { // Adamantite if (item.RawItemId == 12538 && item.Collectability >= 380 && ItemIds.Contains(12538)) { int tick = 0; while (item.IsFilled && tick < 3) { Log("Attempting to Turn In Adamantite Ore"); RaptureAtkUnitManager.GetWindowByName("ShopExchangeItem").SendAction(2, 0, 0, 1, 16); await Coroutine.Sleep(1000); RaptureAtkUnitManager.GetWindowByName("ShopExchangeItemDialog").SendAction(1, 0, 0); await Coroutine.Wait(1000, () => Request.IsOpen); item.Handover(); await Coroutine.Wait(1000, () => Request.HandOverButtonClickable); Request.HandOver(); await Coroutine.Sleep(2000); tick++; } } // Chysahl Green if (item.RawItemId == 12900 && item.Collectability >= 380 && ItemIds.Contains(12900)) { int tick = 0; while (item.IsFilled && tick < 3) { Log("Attempting to Turn In Chysahl Green"); RaptureAtkUnitManager.GetWindowByName("ShopExchangeItem").SendAction(2, 0, 0, 1, 17); await Coroutine.Sleep(1000); RaptureAtkUnitManager.GetWindowByName("ShopExchangeItemDialog").SendAction(1, 0, 0); await Coroutine.Wait(1000, () => Request.IsOpen); item.Handover(); await Coroutine.Wait(1000, () => Request.HandOverButtonClickable); Request.HandOver(); await Coroutine.Sleep(2000); tick++; } } // Thunderbolt Eel if (item.RawItemId == 12828 && item.Collectability >= 579 && ItemIds.Contains(12828)) { int tick = 0; while (item.IsFilled && tick < 3) { Log("Attempting to Turn In Thunderbolt Eel"); RaptureAtkUnitManager.GetWindowByName("ShopExchangeItem").SendAction(2, 0, 0, 1, 18); await Coroutine.Sleep(1000); RaptureAtkUnitManager.GetWindowByName("ShopExchangeItemDialog").SendAction(1, 0, 0); await Coroutine.Wait(1000, () => Request.IsOpen); item.Handover(); await Coroutine.Wait(1000, () => Request.HandOverButtonClickable); Request.HandOver(); await Coroutine.Sleep(2000); tick++; } } // Eventide Jade if (item.RawItemId == 13760 && item.Collectability >= 450 && ItemIds.Contains(13760)) { int tick = 0; while (item.IsFilled && tick < 3) { Log("Attempting to Turn In Eventide Jade"); RaptureAtkUnitManager.GetWindowByName("ShopExchangeItem").SendAction(2, 0, 0, 1, 19); await Coroutine.Sleep(1000); RaptureAtkUnitManager.GetWindowByName("ShopExchangeItemDialog").SendAction(1, 0, 0); await Coroutine.Wait(1000, () => Request.IsOpen); item.Handover(); await Coroutine.Wait(1000, () => Request.HandOverButtonClickable); Request.HandOver(); await Coroutine.Sleep(2000); tick++; } } // Periwinkle if (item.RawItemId == 13762 && item.Collectability >= 450 && ItemIds.Contains(13762)) { int tick = 0; while (item.IsFilled && tick < 3) { Log("Attempting to Turn In Periwinkle"); RaptureAtkUnitManager.GetWindowByName("ShopExchangeItem").SendAction(2, 0, 0, 1, 20); await Coroutine.Sleep(1000); RaptureAtkUnitManager.GetWindowByName("ShopExchangeItemDialog").SendAction(1, 0, 0); await Coroutine.Wait(1000, () => Request.IsOpen); item.Handover(); await Coroutine.Wait(1000, () => Request.HandOverButtonClickable); Request.HandOver(); await Coroutine.Sleep(2000); tick++; } } // Tiny Axolotl if (item.RawItemId == 12774 && item.Collectability >= 321) { int tick = 0; while (item.IsFilled && tick < 3) { Log("Attempting to Turn In Tiny Axolotl"); RaptureAtkUnitManager.GetWindowByName("ShopExchangeItem").SendAction(2, 0, 0, 1, 21); await Coroutine.Sleep(1000); RaptureAtkUnitManager.GetWindowByName("ShopExchangeItemDialog").SendAction(1, 0, 0); await Coroutine.Wait(1000, () => Request.IsOpen); item.Handover(); await Coroutine.Wait(1000, () => Request.HandOverButtonClickable); Request.HandOver(); await Coroutine.Sleep(2000); tick++; } } } RaptureAtkUnitManager.GetWindowByName("ShopExchangeItem").SendAction(1, 3, uint.MaxValue); _haveItem = false; await Coroutine.Sleep(500); Log("Done"); } else { Log("Nothing to Turn In"); } return _done = true; }
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() )); }
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); } }
private async Task <bool> HandleWindows() { while (WindowsOpen()) { if (SelectString.IsOpen) { if (DialogOption > -1) { SelectString.ClickSlot((uint)DialogOption); } SelectString.ClickLineEquals(QuestName); await Coroutine.Sleep(100); } if (SelectIconString.IsOpen) { if (DialogOption > -1) { SelectIconString.ClickSlot((uint)DialogOption); } SelectIconString.ClickLineEquals(QuestName); await Coroutine.Sleep(100); } if (SelectYesno.IsOpen) { SelectYesno.ClickYes(); await Coroutine.Sleep(100); } if (Request.IsOpen) { var items = InventoryManager.FilledInventoryAndArmory.ToArray(); for (int i = 0; i < ItemIds.Length; i++) { BagSlot item; if (RequiresHq[i]) { item = items.FirstOrDefault(z => z.RawItemId == ItemIds[i] && z.IsHighQuality && !usedSlots.Contains(z)); } else { item = items.FirstOrDefault(z => z.RawItemId == ItemIds[i] && !usedSlots.Contains(z)); } item.Handover(); usedSlots.Add(item); } usedSlots.Clear(); Request.HandOver(); await Coroutine.Sleep(100); } if (JournalResult.IsOpen) { if (JournalResult.ButtonClickable) { JournalResult.Complete(); } if (hasRewards) { JournalResult.SelectSlot(RewardSlot); } await Coroutine.Sleep(100); } if (JournalAccept.IsOpen) { JournalAccept.Accept(); await Coroutine.Sleep(100); } if (Talk.DialogOpen) { Talk.Next(); await Coroutine.Sleep(100); } 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); } } } await Coroutine.Yield(); } return(QuestLogManager.InCutscene || Core.Player.HasTarget); }