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);
        }
        private async Task <bool> MoveToShopNpc()
        {
            var masterPieceSupply = new MasterPieceSupply();

            if (await masterPieceSupply.Refresh(2000))
            {
                await masterPieceSupply.CloseInstanceGently();
            }

            if (ExProfileBehavior.Me.Location.Distance(shopExchangeCurrencyNpc.Location) <= 4)
            {
                // we are already there, continue
                return(false);
            }

            await
            shopExchangeCurrencyNpc.Location.MoveTo(
                radius : 3.9f,
                name : Location + " ShopNpcId: " + shopExchangeCurrencyNpc.NpcId);

            Navigator.Stop();

            return(false);
        }
        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> 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> MoveToShopNpc()
		{
			var masterPieceSupply = new MasterPieceSupply();
			if (await masterPieceSupply.Refresh(2000))
			{
				await masterPieceSupply.CloseInstanceGently();
			}

			if (ExProfileBehavior.Me.Location.Distance(shopExchangeCurrencyNpc.Location) <= 4)
			{
				// we are already there, continue
				return false;
			}

			await
				shopExchangeCurrencyNpc.Location.MoveTo(
					radius: 3.9f,
					name: Location + " ShopNpcId: " + shopExchangeCurrencyNpc.NpcId);

			Navigator.Stop();

			return false;
		}
		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.ToInt32(),
					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;
		}
		private async Task<bool> HandOver()
		{
			var masterpieceSupply = new MasterPieceSupply();
			if (!masterpieceSupply.IsValid && !await masterpieceSupply.Refresh(2000))
			{
				return false;
			}

			if (item == null || item.Item == null)
			{
				SelectYesno.ClickNo();
				await masterpieceSupply.CloseInstanceGently(15);

				return false;
			}

			StatusText = "Turning in items";

			var itemName = item.Item.EnglishName;

			if (!await masterpieceSupply.TurnInAndHandOver(index, item))
			{
				Logger.Error("An error has occured while turning in the item");
				Blacklist.Add(
					(uint)item.Pointer.ToInt32(),
					BlacklistFlags.Loot,
					TimeSpan.FromMinutes(3),
					"Don't turn in this item for 3 minutes");
				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("Turned in {0} at {1} ET", itemName, WorldManager.EorzaTime);

			turnedItemsIn = true;

			index = 0;
			if (!await Coroutine.Wait(1000, () => item == null))
			{
				item = null;
			}

			return true;
		}
Example #8
0
        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);
        }
Example #9
0
        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);
        }