protected override Composite CreateBehavior() { return(new PrioritySelector( new Decorator(ret => QuestId == 65997 && SelectYesno.IsOpen, new Action(r => { SelectYesno.ClickYes(); }) ), new Decorator(ret => QuestId == 66182 && SelectYesno.IsOpen, new Action(r => { SelectYesno.ClickYes(); }) ), new Decorator(ret => QuestId == 66856 && SelectString.IsOpen, new Action(r => { SelectString.ClickSlot(1); }) ), new Decorator(ret => QuestId == 67019 && SelectYesno.IsOpen, new Action(r => { SelectYesno.ClickYes(); }) ), new Decorator(ret => QuestId == 67238 && SelectString.IsOpen, new Action(r => { SelectString.ClickSlot(0); }) ), new Decorator(ret => QuestId == 68271 && SelectYesno.IsOpen, new Action(r => { SelectYesno.ClickYes(); }) ), new Decorator(ret => QuestId == 68299 && SelectString.IsOpen, new Action(r => { SelectString.ClickSlot(0); }) ), new Decorator(ret => QuestId == 68407 && SelectString.IsOpen, new Action(r => { SelectString.ClickSlot(0); }) ), new Decorator(ret => QuestId == 68487 && SelectYesno.IsOpen, new Action(r => { SelectYesno.ClickYes(); }) ), base.CreateBehavior() )); }
internal static async Task <BuyItemResult> BuyItem(uint itemId, uint itemAmount) { if (!Shop.Open) { return(BuyItemResult.ShopNotOpen); } if (!Shop.Items.Any(item => item.ItemId == itemId)) { return(BuyItemResult.ItemNotFound); } if (itemAmount > 99) { return(BuyItemResult.TooManyItemsRequested); } await Coroutine.Sleep(TimeSpan.FromMilliseconds(MainSettings.Instance.ActionDelay)); Shop.Purchase(itemId, itemAmount); await Coroutine.Sleep(TimeSpan.FromMilliseconds(MainSettings.Instance.ActionDelay)); SelectYesno.ClickYes(); await Coroutine.Sleep(TimeSpan.FromMilliseconds(MainSettings.Instance.ActionDelay)); Shop.Close(); return(GetItemAmount(itemId) >= itemAmount ? BuyItemResult.Success : BuyItemResult.Failure); }
public async Task PassLoot() { //if (!NeedGreed.Instance.IsOpen) var window = RaptureAtkUnitManager.GetWindowByName("_Notification"); if (!NeedGreed.Instance.IsOpen && window != null) { window.SendAction(3, 3, 0, 3, 2, 6, 0x375B30E7); await Coroutine.Wait(5000, () => NeedGreed.Instance.IsOpen); } if (NeedGreed.Instance.IsOpen) { for (int i = 0; i < NeedGreed.Instance.NumberOfItems; i++) { NeedGreed.Instance.PassItem(i); await Coroutine.Sleep(500); await Coroutine.Wait(5000, () => SelectYesno.IsOpen); if (SelectYesno.IsOpen) { SelectYesno.Yes(); } } } if (NeedGreed.Instance.IsOpen) { NeedGreed.Instance.Close(); } }
internal static async Task <bool> DeSelectRetainer() { if (!RetainerTasks.IsOpen) { return(true); } RetainerTasks.CloseTasks(); await Coroutine.Wait(1500, () => DialogOpen || SelectYesno.IsOpen); if (SelectYesno.IsOpen) { SelectYesno.Yes(); await Coroutine.Wait(1500, () => DialogOpen || RetainerList.Instance.IsOpen); } await Coroutine.Sleep(200); if (DialogOpen) { Next(); } //await Coroutine.Sleep(200); return(await Coroutine.Wait(3000, () => RetainerList.Instance.IsOpen)); }
/// <inheritdoc/> public override async Task <bool> Run() { // Open and accept revive notification if (NotificationRevive.IsOpen) { Logger.LogInformation(Translations.LOG_REVIVE_OPENED); NotificationRevive.Click(); await Coroutine.Wait(250, () => SelectYesno.IsOpen); if (SelectYesno.IsOpen) { Logger.LogInformation(Translations.LOG_REVIVE_ACCEPTED); SelectYesno.ClickYes(); } return(HANDLED_EXECUTION); } // No opportunity to revive yet? if (Core.Player.IsDead || Core.Player.IsDying) { StatusBar.Text = Translations.STATUS_DEAD_WAITING; await Coroutine.Sleep(250); return(HANDLED_EXECUTION); } return(PASS_EXECUTION); }
public async Task <bool> AetherialFlowHandler(GameObject context) { if (ScriptHelper.InCombat()) { return(false); } if (SelectYesno.IsOpen) { SelectYesno.ClickYes(); return(true); } while (!Navigator.InPosition(context.Location, Core.Me.Location, 3f) && ScriptHelper.IsTodoChecked(0)) { Navigator.PlayerMover.MoveTowards(context.Location); MovementManager.Jump(); return(true); } if (ScriptHelper.IsTodoChecked(0)) { if (MovementManager.IsMoving) { await CommonTasks.StopMoving(); return(true); } } return(await ScriptHelper.ObjectInteraction(context)); return(false); }
/// <summary> /// Repairs current gearset via self-repair. /// </summary> private async Task DoSelfRepair() { Logger.LogInformation(Translations.LOG_REPAIR_SELF); if (!HaveRepairMaterials(InventoryManager.EquippedItems.Where(s => s.IsFilled))) { // TODO: Buy dark matter from NPC, or fail if unable (can't travel, dungeon, low gil, etc) } if (!Repair.IsOpen) { ActionManager.ToggleRepairWindow(); await Coroutine.Sleep(250); } // Only clicks the button, Yes/No is separate Repair.RepairAll(); await Coroutine.Wait(1000, () => SelectYesno.IsOpen); SelectYesno.ClickYes(); await Coroutine.Sleep(2500); Repair.Close(); }
private static SwitchArgument <RepairState> GetRepairStep(RepairContext context) { var closeAction = new Action(r => { Repair.Close(); context.State = BotManager.Current.Name != "Fate Bot" ? RepairState.MovingBack : RepairState.None; Logger.AgilMessage("Ended repair step, now on: {0}", context.State); }); var close = new Decorator(req => Equipment.GetCondition() >= context.MinimumDurability && Repair.IsOpen, closeAction); var dismount = new Decorator(req => Core.Me.IsMounted, new Action(r => Actionmanager.Dismount())); var selectYes = new Decorator(req => SelectYesno.IsOpen, new Action(r => SelectYesno.ClickYes())); var move = Movement.SprintMove(r => context.Location); var repairAll = new RepairAll(); var selectRepair = new SetIconString(2); var setTarget = new SetTarget(() => context.NpcId); var interact = new Decorator(req => !Repair.IsOpen && !SelectIconString.IsOpen && !SelectYesno.IsOpen, new Interact()); var repairStep = new PrioritySelector(move, dismount, close, selectYes, repairAll, selectRepair, setTarget, interact, new Action(r => RunStatus.Success)); return(new SwitchArgument <RepairState>(repairStep, RepairState.Repairing)); }
public static async Task <bool> SelectYesNo(bool choice = true) { int ticks = 0; while (SelectYesno.IsOpen && ticks < 20) { if (choice) { SelectYesno.ClickYes(); } else { SelectYesno.ClickNo(); } await Coroutine.Sleep(500); ticks++; } if (ticks < 20) { return(true); } return(false); }
public static async Task <bool> DeSelectRetainer() { if (!RetainerTasks.IsOpen) { return(true); } RetainerTasks.CloseTasks(); await Coroutine.Wait(3000, () => DialogOpen || SelectYesno.IsOpen); if (SelectYesno.IsOpen) { SelectYesno.Yes(); await Coroutine.Wait(3000, () => DialogOpen || RetainerList.Instance.IsOpen); } while (!RetainerList.Instance.IsOpen) { if (DialogOpen) { Next(); await Coroutine.Sleep(100); } await Coroutine.Wait(3000, () => DialogOpen || RetainerList.Instance.IsOpen); } return(RetainerList.Instance.IsOpen); }
protected override Composite CreateBehavior() { return(new PrioritySelector( new Decorator(ret => !doneEmote && !string.IsNullOrWhiteSpace(Emote), new Action(r => { GameObjectManager.GetObjectByNPCId((uint)NpcId).Target(); ChatManager.SendChat("/" + Emote); doneEmote = true; }) ), new Decorator(ret => SelectYesno.IsOpen, new Action(r => { SelectYesno.ClickYes(); }) ), new Decorator(ret => SelectString.IsOpen, new Action(r => { SelectString.ClickSlot((uint)DialogOption); }) ), base.CreateBehavior() )); }
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 Composite CreateBehavior() { return(new PrioritySelector( new Decorator(ret => Talk.DialogOpen, new Action(ret => Talk.Next())), new Decorator(ret => SelectYesno.IsOpen, new Action(ret => SelectYesno.ClickYes())), CommonBehaviors.HandleLoading, new Decorator(ret => QuestLogManager.InCutscene, new ActionAlwaysSucceed()), new Decorator(ret => DutyManager.InInstance && Core.Player.IsVisible, new PrioritySelector( //r=> GuardianNPC, //new Decorator(ret => !initialized,new Action(ret => init())), // //new Decorator(r => NeedToMove && ((r as BattleCharacter) == null || !(r as BattleCharacter).IsValid || (r as BattleCharacter).Location.Distance2D(Core.Player.Location) <= 5), new Action(r => NeedToMove = false)), //new Decorator(r => NeedToMove, CommonBehaviors.MoveAndStop(r => (r as BattleCharacter).Location, 5f, true, "Moving back into guardian npc range")), //new Decorator(r => (r as BattleCharacter) != null && ((r as BattleCharacter).Location.DistanceSqr(Core.Player.Location) > LeashSquared), new ActionAlwaysFail()), new ActionRunCoroutine(r => DoControlLogic()), new Decorator(r => CombatTargeting.Instance.FirstUnit == null, new HookExecutor("HotspotPoi")), new HookExecutor("SetCombatPoi"), new ActionAlwaysSucceed() ) ), new Decorator(r => Chocobo.Summoned, new ActionRunCoroutine(r => Chocobo.DismissChocobo())), CommonBehaviors.MoveAndStop(r => XYZ, InteractDistance, true), CreateUseObject(), new ActionAlwaysSucceed() )); }
private async Task RunEquip() { if (_isDone) { await Coroutine.Yield(); return; } IEnumerable <GearSet> groupedGearSets = GearsetManager .GearSets .Where(g => g.InUse) .OrderByDescending(GetGearSetiLvl) .GroupBy(g => g.Class) .Select(g => g.FirstOrDefault()); await Coroutine.Sleep(4000); foreach (var gearSet in groupedGearSets) { GearsetManager.ChangeGearset(gearSet.Index); if (await Coroutine.Wait(1200, () => SelectYesno.IsOpen)) { SelectYesno.ClickYes(); await Coroutine.Sleep(800); } await InventoryEquipBest(useRecommendEquip : UseRecommendEquip); await Coroutine.Sleep(400); } _isDone = true; }
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); } }
public async Task <bool> PurchaseItem(uint index, uint qty, byte attempts, ushort interval = 200) { var result = SendActionResult.None; var purchaseAttempts = 0; while (result != SendActionResult.Success && !SelectYesno.IsOpen && purchaseAttempts++ < attempts && Behaviors.ShouldContinue) { // result = PurchaseItem(index); result = PurchaseItem(index, qty); await Behaviors.Wait(interval, () => SelectYesno.IsOpen); } if (purchaseAttempts > attempts) { return(false); } // Wait an extra second in case interval is really short. await Coroutine.Wait(1000, () => SelectYesno.IsOpen); purchaseAttempts = 0; while (SelectYesno.IsOpen && purchaseAttempts++ < attempts && Behaviors.ShouldContinue) { SelectYesno.ClickYes(); await Behaviors.Wait(interval, () => !SelectYesno.IsOpen); } return(!SelectYesno.IsOpen); }
public static async Task Plant(BagSlot seeds, BagSlot soil) { var result = Core.Memory.CallInjected64 <IntPtr>(Offsets.PlantFunction, new object[3] { AgentHousingPlant.Instance.Pointer, (uint)soil.BagId, (ushort)soil.Slot }); result = Core.Memory.CallInjected64 <IntPtr>(Offsets.PlantFunction, new object[3] { AgentHousingPlant.Instance.Pointer, (uint)seeds.BagId, (ushort)seeds.Slot }); await Coroutine.Wait(5000, () => SeedStruct.ItemId == seeds.RawItemId && SoilStruct.ItemId == soil.RawItemId); HousingGardening.Confirm(); await Coroutine.Wait(5000, () => SelectYesno.IsOpen); if (SelectYesno.IsOpen) { SelectYesno.Yes(); } await Coroutine.Wait(5000, () => !SelectYesno.IsOpen); }
public async Task <bool> Run() { if (RaptureAtkUnitManager.GetWindowByName("DeepDungeonResult") != null) { GameStatsManager.Died(); Logger.Warn($"We have died..."); RaptureAtkUnitManager.GetWindowByName("DeepDungeonResult").SendAction(1, 3, uint.MaxValue); await Coroutine.Sleep(250); return(true); } if (NotificationRevive.IsOpen) { NotificationRevive.Click(); await Coroutine.Wait(250, () => SelectYesno.IsOpen); SelectYesno.ClickYes(); return(true); } if (ClientGameUiRevive.ReviveState == ReviveState.Dead && SelectYesno.IsOpen) { SelectYesno.ClickYes(); return(true); } if (Core.Me.IsDead) { TreeRoot.StatusText = "I am dead. No window to use..."; await Coroutine.Sleep(250); return(true); } return(false); }
protected override Composite CreateBehavior() { return(new PrioritySelector( CommonBehaviors.HandleLoading, new Decorator(ret => QuestId == 65888 && SelectYesno.IsOpen, new Action(r => { SelectYesno.ClickYes(); }) ), new Decorator(ret => QuestId == 65889 && SelectString.IsOpen, new Action(r => { SelectString.ClickSlot(0); }) ), new Decorator(ret => QuestId == 67137 && SelectString.IsOpen, new Action(r => { SelectString.ClickSlot(0); }) ), new Decorator(ret => QuestId == 68612 && SelectYesno.IsOpen, new Action(r => { SelectYesno.ClickYes(); }) ), base.CreateBehavior() )); }
public async Task <bool> Run() { if (WorldManager.ZoneId != 570) { return(false); } TreeRoot.StatusText = "Lobby Room"; if (_target == null || !_target.IsValid) { Logger.Warn($"Unable to find Lobby Target"); return(false); } if (!Navigator.InPosition(_target.Location, Core.Me.Location, 3)) { if (!await CommonTasks.MoveAndStop(new MoveToParameters(_target.Location, "Moving to Lobby Exit"), 3)) { Logger.Warn("Failed to move toward the exit?"); } return(true); } _target.Interact(); await Coroutine.Wait(250, () => SelectYesno.IsOpen); SelectYesno.ClickYes(); return(true); }
/// <summary> /// Sends a reset command to a window /// </summary> internal static async Task ClickReset(uint number) { if (number >= 2) { throw new ArgumentOutOfRangeException(); } if (IsOpen && !SD.Reset) { await Close(); } if (DeepDungeonMenu.IsOpen) { await DeepDungeonMenu.OpenResetMenu(); } Logger.Info("Clicking Reset slot {0} // {1}", number + 1, SD.Reset); await Coroutine.Wait(5000, () => IsOpen); var window = RaptureAtkUnitManager.GetWindowByName(WindowNames.DDsave); window.SendAction(2, 3, number, 3, 2); await Coroutine.Wait(500, () => SelectYesno.IsOpen); //confirm that we want to delete this data. if (SelectYesno.IsOpen) { SelectYesno.ClickYes(); } }
private async Task LLUseObjectTask(uint NpcId) { var gameobj = GameObjectManager.GetObjectByNPCId(NpcId); if (gameobj == default(GameObject)) { _isDone = true; return; } await Navigation.FlightorMove(gameobj.Location); if (gameobj.IsWithinInteractRange) { gameobj.Interact(); await Coroutine.Wait(20000, () => !gameobj.IsVisible || SelectYesno.IsOpen); if (SelectYesno.IsOpen) { SelectYesno.Yes(); await Coroutine.Wait(20000, () => !SelectYesno.IsOpen); } } _isDone = true; }
protected override Composite CreateBehavior() { return(new PrioritySelector( new Decorator(ret => SelectYesno.IsOpen, new Action(r => { SelectYesno.ClickYes(); }) ), new Decorator(ret => SelectString.IsOpen, new Action(r => { if (selectStringIndex.Count > 0) { SelectString.ClickSlot((uint)selectStringIndex.Dequeue()); } else { SelectString.ClickSlot(0); } }) ), base.CreateBehavior() )); }
private async Task BuyItem(int itemId, int npcId, int selectString) { var unit = GameObjectManager.GetObjectsByNPCId <Character>((uint)npcId).OrderBy(r => r.Distance()).FirstOrDefault(); if (unit == null) { _isDone = true; return; } if (!FreeShop.Instance.IsOpen && unit.Location.Distance(Core.Me.Location) > 4f) { await Navigation.OffMeshMove(unit.Location); await Coroutine.Sleep(500); } unit.Interact(); await Coroutine.Wait(5000, () => Conversation.IsOpen); if (Conversation.IsOpen) { Conversation.SelectLine((uint)selectString); await Coroutine.Wait(5000, () => DialogOpen || FreeShop.Instance.IsOpen); if (DialogOpen) { Next(); } await Coroutine.Wait(5000, () => FreeShop.Instance.IsOpen); if (FreeShop.Instance.IsOpen) { //Log("Opened"); await FreeShop.Instance.BuyItem((uint)itemId); } await Coroutine.Wait(2000, () => SelectYesno.IsOpen); if (SelectYesno.IsOpen) { SelectYesno.Yes(); await Coroutine.Wait(2000, () => !SelectYesno.IsOpen); await Coroutine.Sleep(500); } if (FreeShop.Instance.IsOpen) { FreeShop.Instance.Close(); } } _isDone = true; }
private async Task <bool> HandOver() { var masterpieceSupply = new MasterPieceSupply(); if (!masterpieceSupply.IsValid && !await masterpieceSupply.Refresh(5000)) { return(false); } if (item == null || item.Item == null) { SelectYesno.ClickNo(); await masterpieceSupply.CloseInstanceGently(15); return(false); } StatusText = Localization.Localization.ExTurnInCollectable_TurnIn; var itemName = item.Item.CurrentLocaleName; if (!await masterpieceSupply.TurnInAndHandOver(index, item)) { Logger.Error(Localization.Localization.ExTurnInCollectable_TurnInError); Blacklist.Add( (uint)item.Pointer.ToInt64(), BlacklistFlags.Loot, TimeSpan.FromMinutes(3), Localization.Localization.ExTurnInCollectable_TurnInBlackList); item = null; index = 0; if (SelectYesno.IsOpen) { SelectYesno.ClickNo(); await Coroutine.Sleep(200); } if (Request.IsOpen) { Request.Cancel(); await Coroutine.Sleep(200); } return(true); } Logger.Info(Localization.Localization.ExTurnInCollectable_TurnInSuccessful, itemName, WorldManager.EorzaTime); turnedItemsIn = true; index = 0; if (!await Coroutine.Wait(1000, () => item == null)) { item = null; } return(true); }
protected async Task <bool> InitiateLeve() { // if (Core.Player.IsMounted) // { // ActionManager.Dismount(); // await Coroutine.Wait(20000, () => !Core.Player.IsMounted); // await Coroutine.Sleep(500); // } var patternFinder = new GreyMagic.PatternFinder(Core.Memory); IntPtr SearchResult = patternFinder.Find("48 8D 05 ? ? ? ? 48 89 54 24 ? 48 89 03 Add 3 TraceRelative"); int agent = AgentModule.FindAgentIdByVtable(SearchResult); AgentModule.ToggleAgentInterfaceById(agent); await Coroutine.Sleep(500); AtkAddonControl windowByName = RaptureAtkUnitManager.GetWindowByName("JournalDetail"); while (windowByName == null) { await Coroutine.Sleep(500); windowByName = RaptureAtkUnitManager.GetWindowByName("JournalDetail"); } if (windowByName != null) { var leves = LeveManager.Leves; if (leves.Length > 0) { foreach (ff14bot.Managers.LeveWork leve in leves) { if (leve.GlobalId == LeveId && leve.Step == 1) { ulong globalId = (ulong)leve.GlobalId; windowByName.SendAction(3, 3, 0xC, 3, globalId, 3, 2); //Set Quest await Coroutine.Sleep(200); windowByName.SendAction(2, 3, 4, 4, globalId); //Initiate if (await Coroutine.Wait(10000, () => SelectYesno.IsOpen)) { SelectYesno.ClickYes(); } await Coroutine.Sleep(2000); RaptureAtkUnitManager.GetWindowByName("GuildLeveDifficulty").SendAction(1, 3, 0); await Coroutine.Sleep(3000); break; } } } windowByName = RaptureAtkUnitManager.GetWindowByName("JournalDetail"); if (windowByName != null) { AgentModule.ToggleAgentInterfaceById(agent); } } return(_done = true); }
private async Task <bool> BuyItems() { var currentItems = Shop.Items; dialogwasopen = true; foreach (var itemid in ItemIds) { uint totalPurchased = 0; int loop = 1; var amountwanted = itemcountQueue.Dequeue(); if (currentItems.Any(r => r.ItemId == itemid)) { var currentItem = currentItems.First(r => r.ItemId == itemid); Purhcase: var purchased = Shop.Purchase((uint)itemid, (uint)amountwanted); await Coroutine.Wait(2000, () => SelectYesno.IsOpen); if (!SelectYesno.IsOpen) { goto Purhcase; } await Coroutine.Sleep(500); if (purchased != amountwanted) { Log("Purchasing {0} {1} from {2} for {3} gil ({4})", purchased, currentItem.product_name, vendorName, purchased * currentItem.Cost, loop); } else { Log(@"Purchasing {0} {1} from {2} for {3} gil", purchased, currentItem.product_name, vendorName, purchased * currentItem.Cost); } SelectYesno.ClickYes(); await Coroutine.Sleep(500); totalPurchased += purchased; if (totalPurchased < amountwanted) { loop++; goto Purhcase; } } else { LogError(" {0} does not have itemid:{1}", vendorName, itemid); } } await Coroutine.Sleep(500); Shop.Close(); await Coroutine.Sleep(500); return(true); }
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 async Task <bool> BuyItem(uint itemId) { if (!ShopExchangeCurrency.Open && VendorNpc == null) { await GetToVendorNpc(); } if (!ShopExchangeCurrency.Open && VendorNpc.Location.Distance(Core.Me.Location) > 6f) { var _target = VendorNpc.Location; Navigator.PlayerMover.MoveTowards(_target); while (_target.Distance2D(Core.Me.Location) >= 6) { Navigator.PlayerMover.MoveTowards(_target); await Coroutine.Sleep(100); } Navigator.PlayerMover.MoveStop(); await Coroutine.Sleep(1000); } if (!ShopExchangeCurrency.Open) { VendorNpc.Interact(); await Coroutine.Wait(5000, () => ShopExchangeCurrency.Open || Talk.DialogOpen); } if (ShopExchangeCurrency.Open) { var items = SpecialShopManager.Items; var specialShopItem = items?.Cast <SpecialShopItem?>().FirstOrDefault(i => i.HasValue && i.Value.ItemIds.Contains(itemId)); if (!specialShopItem.HasValue) { return(false); } var count = CanAffordScrip(specialShopItem.Value); if (count > 0) { Purchase(itemId, count); } await Coroutine.Wait(5000, () => SelectYesno.IsOpen); SelectYesno.ClickYes(); await Coroutine.Sleep(1000); ShopExchangeCurrency.Close(); return(true); } return(false); }
public async Task <bool> BuyItem(uint itemId, int SelectStringLine = 0) { if ((!ShopExchangeCurrency.Open && VendorNpc == null) || VendorNpc.Location.Distance(Core.Me.Location) > 5f) { await Navigation.GetTo(886, new Vector3(36.33978f, -16f, 145.3877f)); } if (!ShopExchangeCurrency.Open && VendorNpc.Location.Distance(Core.Me.Location) > 4f) { await Navigation.OffMeshMove(VendorNpc.Location); await Coroutine.Sleep(500); } if (!ShopExchangeCurrency.Open) { VendorNpc.Interact(); await Coroutine.Wait(5000, () => ShopExchangeCurrency.Open || Talk.DialogOpen || Conversation.IsOpen); if (Conversation.IsOpen) { Conversation.SelectLine((uint)SelectStringLine); await Coroutine.Wait(5000, () => ShopExchangeCurrency.Open); } } if (ShopExchangeCurrency.Open) { var items = SpecialShopManager.Items; var specialShopItem = items?.Cast <SpecialShopItem?>().FirstOrDefault(i => i.HasValue && i.Value.ItemIds.Contains(itemId)); if (!specialShopItem.HasValue) { return(false); } var count = CanAffordScrip(specialShopItem.Value); if (count > 0) { Purchase(itemId, count); } await Coroutine.Wait(5000, () => SelectYesno.IsOpen); SelectYesno.ClickYes(); await Coroutine.Sleep(1000); ShopExchangeCurrency.Close(); return(true); } return(false); }