Exemple #1
0
        private async Task <bool> HandleCollectable()
        {
            var required = CollectabilityValue;
            var itemName = string.Empty;

            if (!string.IsNullOrWhiteSpace(Collectables.First().Name))
            {
                var item = SelectYesNoItem.Item;
                if (item == null ||
                    !Collectables.Any(c => string.Equals(c.Name, item.EnglishName, StringComparison.InvariantCultureIgnoreCase)))
                {
                    var ticks = 0;
                    while ((item == null
                            ||
                            !Collectables.Any(c => string.Equals(c.Name, item.EnglishName, StringComparison.InvariantCultureIgnoreCase))) &&
                           ticks++ < 60 && Behaviors.ShouldContinue)
                    {
                        item = SelectYesNoItem.Item;
                        await Coroutine.Yield();
                    }

                    if (ticks > 60)
                    {
                        required = (uint)Collectables.Select(c => c.Value).Max();
                    }
                }

                if (item != null)
                {
                    itemName = item.EnglishName;
                    var collectable = Collectables.FirstOrDefault(c => string.Equals(c.Name, item.EnglishName));

                    if (collectable != null)
                    {
                        required = (uint)collectable.Value;
                    }
                }
            }

            var value = SelectYesNoItem.CollectabilityValue;

            if (value >= required)
            {
                Logger.Info(Localization.ExFish_Collecting, itemName, value, required);
                SelectYesNoItem.Yes();
            }
            else
            {
                Logger.Info(Localization.ExFish_Declining, itemName, value, required);
                SelectYesNoItem.No();
            }

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

            return(true);
        }
Exemple #2
0
        public override async Task <bool> Gather(ExGatherTag tag)
        {
            tag.StatusText = "Gathering collectable items";

            var rarity = CurrentRarity;

            while (tag.Node.CanGather && GatheringManager.SwingsRemaining > tag.SwingsRemaining && rarity > 0 &&
                   Behaviors.ShouldContinue)
            {
                while (!SelectYesNoItem.IsOpen && tag.Node.CanGather && GatheringManager.SwingsRemaining > tag.SwingsRemaining &&
                       rarity > 0 && Behaviors.ShouldContinue)
                {
                    if (!GatheringMasterpiece.IsOpen)
                    {
                        await Coroutine.Wait(3000, () => GatheringMasterpiece.IsOpen);
                    }

                    if (GatheringMasterpiece.IsOpen)
                    {
                        GatheringMasterpiece.Collect();
                    }

                    await Coroutine.Sleep(500);
                }

                await Coroutine.Yield();

                var swingsRemaining = GatheringManager.SwingsRemaining - 1;

                while (SelectYesNoItem.IsOpen && rarity > 0 && Behaviors.ShouldContinue)
                {
                    tag.Logger.Info(
                        "Collected item: {0}, value: {1} at {2} ET",
                        tag.GatherItem.ItemData.EnglishName,
                        SelectYesNoItem.CollectabilityValue,
                        WorldManager.EorzaTime);

                    SelectYesNoItem.Yes();
                    await Coroutine.Wait(2000, () => !SelectYesNoItem.IsOpen);
                }

                var ticks = 0;
                while (swingsRemaining != GatheringManager.SwingsRemaining && ticks++ < 60 && Behaviors.ShouldContinue)
                {
                    await Coroutine.Yield();
                }
            }

            tag.StatusText = "Gathering collectable items complete";

            return(true);
        }
		public override async Task<bool> Gather(ExGatherTag tag)
		{
			tag.StatusText = "Gathering collectable items";

			var rarity = CurrentRarity;
			var selectYesNoItem = new SelectYesNoItem();
			while (tag.Node.CanGather && GatheringManager.SwingsRemaining > tag.SwingsRemaining && rarity > 0 && Behaviors.ShouldContinue)
			{

				while (!selectYesNoItem.IsValid && tag.Node.CanGather && GatheringManager.SwingsRemaining > tag.SwingsRemaining && rarity > 0
						&& Behaviors.ShouldContinue)
				{
					if (!MasterpieceWindow.IsValid)
					{
						await MasterpieceWindow.Refresh(3000);
					}

					if (MasterpieceWindow.IsValid)
					{
						MasterpieceWindow.Collect();
					}

					await selectYesNoItem.Refresh(500);
				}

				await Coroutine.Yield();
				var swingsRemaining = GatheringManager.SwingsRemaining - 1;

				while (selectYesNoItem.IsValid && rarity > 0 && Behaviors.ShouldContinue)
				{
					tag.Logger.Info(
						"Collected item: {0}, value: {1} at {2} ET",
						tag.GatherItem.ItemData.EnglishName,
						selectYesNoItem.CollectabilityValue,
						WorldManager.EorzaTime);

					selectYesNoItem.Yes();
					await selectYesNoItem.Refresh(2000, false);
				}

				var ticks = 0;
				while (swingsRemaining != GatheringManager.SwingsRemaining && ticks++ < 60 && Behaviors.ShouldContinue)
				{
					await Coroutine.Yield();
				}
			}

			tag.StatusText = "Gathering collectable items complete";

			return true;
		}
Exemple #4
0
        private async Task <bool> HandleCollectable()
        {
            if (Collectables == null)
            {
                //we are not collecting
                return(false);
            }

            if (FishingManager.State != FishingState.Waitin)
            {
                // we are not waitin yet!
                return(false);
            }

            if (!SelectYesNoItem.IsOpen)
            {
                //Wait a few seconds
                var opened = await Coroutine.Wait(5000, () => SelectYesNoItem.IsOpen);

                if (!opened)
                {
                    Logger.Info("SelectYesNoItem never appeared");
                    return(false);
                }
            }

            var required = CollectabilityValue;
            var itemName = string.Empty;

            if (!string.IsNullOrWhiteSpace(Collectables.First().Name))
            {
                var item = SelectYesNoItem.Item;
                if (item == null ||
                    !Collectables.Any(c => string.Equals(c.Name, item.EnglishName, StringComparison.InvariantCultureIgnoreCase)))
                {
                    var ticks = 0;
                    while ((item == null
                            ||
                            !Collectables.Any(c => string.Equals(c.Name, item.EnglishName, StringComparison.InvariantCultureIgnoreCase))) &&
                           ticks++ < 60 && Behaviors.ShouldContinue)
                    {
                        item = SelectYesNoItem.Item;
                        await Coroutine.Yield();
                    }

                    // handle timeout
                    if (ticks > 60)
                    {
                        required = (uint)Collectables.Select(c => c.Value).Max();
                    }
                }

                if (item != null)
                {
                    // handle normal
                    itemName = item.EnglishName;
                    var collectable = Collectables.FirstOrDefault(c => string.Equals(c.Name, item.EnglishName));

                    if (collectable != null)
                    {
                        required = (uint)collectable.Value;
                    }
                }
            }

            // handle

            var value = SelectYesNoItem.CollectabilityValue;

            if (value >= required)
            {
                Logger.Info(Localization.Localization.ExFish_Collecting, itemName, value, required);
                SelectYesNoItem.Yes();
            }
            else
            {
                Logger.Info(Localization.Localization.ExFish_Declining, itemName, value, required);
                SelectYesNoItem.No();
            }

            await Coroutine.Wait(3000, () => !SelectYesNoItem.IsOpen && FishingManager.State != FishingState.Waitin);

            return(true);
        }
Exemple #5
0
		private async Task<bool> HandleCollectable()
		{
			if (Collectables == null)
			{
				//we are not collecting
				return false;
			}

			if (FishingManager.State != FishingState.Waitin)
			{
				// we are not waitin yet!
				return false;
			}

			var selectYesNoItem = new SelectYesNoItem();
			if (!selectYesNoItem.IsValid || !await selectYesNoItem.Refresh(5000))
			{
				// window didn't open, continue.
				return false;
			}

			var required = CollectabilityValue;
			var itemName = string.Empty;
			if (!string.IsNullOrWhiteSpace(Collectables.First().Name))
			{
				var item = selectYesNoItem.Item;
				if (item == null
					|| !Collectables.Any(c => string.Equals(c.Name, item.EnglishName, StringComparison.InvariantCultureIgnoreCase)))
				{
					var ticks = 0;
					while ((item == null
							|| !Collectables.Any(c => string.Equals(c.Name, item.EnglishName, StringComparison.InvariantCultureIgnoreCase)))
							&& ticks++ < 60 && Behaviors.ShouldContinue)
					{
						item = selectYesNoItem.Item;
						await Coroutine.Yield();
					}

					// handle timeout
					if (ticks > 60)
					{
						required = (uint)Collectables.Select(c => c.Value).Max();
					}
				}

				if (item != null)
				{
					// handle normal
					itemName = item.EnglishName;
					var collectable = Collectables.FirstOrDefault(c => string.Equals(c.Name, item.EnglishName));

					if (collectable != null)
					{
						required = (uint)collectable.Value;
					}
				}
			}

			// handle

			var value = selectYesNoItem.CollectabilityValue;

			if (value >= required)
			{
				Logger.Info("Collecting {0} -> Value: {1}, Required: {2}", itemName, value, required);
				selectYesNoItem.Yes();
			}
			else
			{
				Logger.Info("Declining {0} -> Value: {1}, Required: {2}", itemName, value, required);
				selectYesNoItem.No();
			}

			await Coroutine.Wait(3000, () => !selectYesNoItem.IsValid && FishingManager.State != FishingState.Waitin);

			return true;
		}