コード例 #1
0
		private async Task<bool> Main()
		{
			if (Talk.DialogOpen)
			{
				Talk.Next();
				return true;
			}

			if (SelectYesno.IsOpen)
			{
				SelectYesno.ClickYes();
				return true;
			}

			if (JournalResult.IsOpen)
			{
				await Coroutine.Wait(1000, () => JournalResult.ButtonClickable);
				JournalResult.Complete();
				return true;
			}

			// Movement
			if (Me.Distance(NpcLocation) > 3.5)
			{
				StatusText = "Moving to Npc -> " + NpcId;

				await Behaviors.MoveTo(NpcLocation, radius: 3.4f, name: " NpcId: " + NpcId);
				return true;
			}

			if (!interactTimeout.IsRunning)
			{
				interactTimeout.Restart();
			}

			// Interact
			if (Core.Target == null && Me.Distance(NpcLocation) <= 3.5)
			{
				GameObjectManager.GetObjectByNPCId(NpcId).Interact();
				return true;
			}

			if (SelectString.IsOpen)
			{
				if (interactTimeout.Elapsed.TotalSeconds > Timeout || GuildLeve.HasLeves(Ids) || GuildLeve.Allowances == 0)
				{
					SelectString.ClickSlot(uint.MaxValue);
					isDone = true;
					return true;
				}

				SelectString.ClickLineContains(LeveType);
				return true;
			}

			var guildLeveWindow = new GuildLeve();
			if (guildLeveWindow.IsValid)
			{
				if (interactTimeout.Elapsed.TotalSeconds > Timeout || GuildLeve.HasLeves(Ids) || GuildLeve.Allowances == 0)
				{
					await guildLeveWindow.CloseInstance();
					return true;
				}

				foreach (var leveId in Ids.Where(id => !GuildLeve.HasLeve(id)))
				{
					if (GuildLeve.Allowances > 0)
					{
						StatusText = "Picking up Leve -> " + leveId;
						Logger.Info("Picking up Leve: " + leveId);

						await Coroutine.Sleep(1000);
						guildLeveWindow.AcceptLeve(leveId);
						await Coroutine.Yield(); // so our memory lock updates and level allowances change
					}
				}

				await Coroutine.Sleep(1000);

				return true;
			}

			// Interact if targetting but not null (if combat behaviors prevented the first one)
			if (Me.Distance(NpcLocation) <= 3.5)
			{
				GameObjectManager.GetObjectByNPCId(NpcId).Interact();
				return true;
			}

			return true;
		}
コード例 #2
0
		protected override async Task<bool> Main()
		{
			if (Talk.DialogOpen)
			{
				await HandleTalk();
				return true;
			}

			if (SelectYesno.IsOpen)
			{
				SelectYesno.ClickYes();
				await Coroutine.Yield();
				return true;
			}

			if (JournalResult.IsOpen)
			{
				await Coroutine.Wait(1000, () => JournalResult.ButtonClickable);
				JournalResult.Complete();
				await Coroutine.Yield();
				return true;
			}

			// Movement
			if (ExProfileBehavior.Me.Distance(Location) > 3.5)
			{
				StatusText = Localization.Localization.ExPickupGuildLeve_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)
			{
				await this.Interact();
				await Coroutine.Yield();
				return true;
			}

			if (SelectString.IsOpen)
			{
				if (interactTimeout.Elapsed.TotalSeconds > Timeout || GuildLeve.HasLeves(Ids) || GuildLeve.Allowances == 0)
				{
					SelectString.ClickSlot(uint.MaxValue);
					isDone = true;
					return true;
				}

				SelectString.ClickLineContains(LeveType);
				return true;
			}

			var guildLeveWindow = new GuildLeve();
			if (guildLeveWindow.IsValid)
			{
				if (interactTimeout.Elapsed.TotalSeconds > Timeout || GuildLeve.HasLeves(Ids) || GuildLeve.Allowances == 0)
				{
					await guildLeveWindow.CloseInstance();
					return true;
				}

				foreach (var leveId in Ids.Where(id => !GuildLeve.HasLeve(id)))
				{
					if (GuildLeve.Allowances > 0)
					{
						StatusText = Localization.Localization.ExPickupGuildLeve_Pickup + leveId;
						Logger.Info(Localization.Localization.ExPickupGuildLeve_Pickup2 + leveId);

						await Coroutine.Sleep(1000);
						guildLeveWindow.AcceptLeve(leveId);
						await Coroutine.Yield(); // so our memory lock updates and level allowances change
					}
				}

				await Coroutine.Sleep(1000);

				return true;
			}

			// Interact if targetting but not null (if combat behaviors prevented the first one)
			if (ExProfileBehavior.Me.Distance(Location) <= 3.5)
			{
				await this.Interact();
				return true;
			}

			return true;
		}
コード例 #3
0
        protected override async Task <bool> Main()
        {
            if (Talk.DialogOpen)
            {
                await HandleTalk();

                return(true);
            }

            if (SelectYesno.IsOpen)
            {
                SelectYesno.ClickYes();
                await Coroutine.Yield();

                return(true);
            }

            if (JournalResult.IsOpen)
            {
                await Coroutine.Wait(1000, () => JournalResult.ButtonClickable);

                JournalResult.Complete();
                await Coroutine.Yield();

                return(true);
            }

            // Movement
            if (ExProfileBehavior.Me.Distance(Location) > 3.5)
            {
                StatusText = Localization.Localization.ExPickupGuildLeve_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)
            {
                await this.Interact();

                await Coroutine.Yield();

                return(true);
            }

            if (SelectString.IsOpen)
            {
                if (interactTimeout.Elapsed.TotalSeconds > Timeout || GuildLeve.HasLeves(Ids) || GuildLeve.Allowances == 0)
                {
                    SelectString.ClickSlot(uint.MaxValue);
                    isDone = true;
                    return(true);
                }

                SelectString.ClickLineContains(LeveType);
                return(true);
            }

            var guildLeveWindow = new GuildLeve();

            if (guildLeveWindow.IsValid)
            {
                if (interactTimeout.Elapsed.TotalSeconds > Timeout || GuildLeve.HasLeves(Ids) || GuildLeve.Allowances == 0)
                {
                    await guildLeveWindow.CloseInstance();

                    return(true);
                }

                foreach (var leveId in Ids.Where(id => !GuildLeve.HasLeve(id)))
                {
                    if (GuildLeve.Allowances > 0)
                    {
                        StatusText = Localization.Localization.ExPickupGuildLeve_Pickup + leveId;
                        Logger.Info(Localization.Localization.ExPickupGuildLeve_Pickup2 + leveId);

                        await Coroutine.Sleep(1000);

                        guildLeveWindow.AcceptLeve(leveId);
                        await Coroutine.Yield(); // so our memory lock updates and level allowances change
                    }
                }

                await Coroutine.Sleep(1000);

                return(true);
            }

            // Interact if targetting but not null (if combat behaviors prevented the first one)
            if (ExProfileBehavior.Me.Distance(Location) <= 3.5)
            {
                await this.Interact();

                return(true);
            }

            return(true);
        }