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); } }
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); }
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 (!ShopExchangeCurrency.Open && 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, () => ShopExchangeCurrency.Open); if (ShopExchangeCurrency.Open) { //Log("Opened"); ShopExchangeCurrency.Purchase((uint)itemId, (uint)count); await Coroutine.Wait(2000, () => SelectYesno.IsOpen || Request.IsOpen); if (SelectYesno.IsOpen) { SelectYesno.Yes(); await Coroutine.Sleep(1000); } } await Coroutine.Wait(2000, () => ShopExchangeCurrency.Open); if (ShopExchangeCurrency.Open) { ShopExchangeCurrency.Close(); } } _isDone = true; }