Пример #1
0
        public static async Task <bool> Sprint(int timeout = 500)
        {
            if (ActionManager.IsSprintReady && !Core.Player.IsCasting && !Core.Player.IsMounted && Core.Player.CurrentTP == 1000 &&
                MovementManager.IsMoving)
            {
                ActionManager.Sprint();

                // Maybe use MovementManager speed.
                await Coroutine.Wait(500, () => !ActionManager.IsSprintReady);
            }

            return(true);
        }
Пример #2
0
		protected async Task<bool> TurnIn()
		{
			foreach (var slot in InventoryManager.FilledSlots)
			{
				// Adamantite
				// Chysahl Green
				// Thunderbolt Eel
				// Eventide Jade
				// Periwinkle
				// Tiny Axolotl
				if ((slot.RawItemId == 12538 && slot.Collectability >= 380 && ItemIds.Contains(12538)) ||
				(slot.RawItemId == 12900 && slot.Collectability >= 380 && ItemIds.Contains(12900)) ||
				(slot.RawItemId == 12828 && slot.Collectability >= 579 && ItemIds.Contains(12828)) ||
				(slot.RawItemId == 13760 && slot.Collectability >= 450 && ItemIds.Contains(13760)) ||
				(slot.RawItemId == 13762 && slot.Collectability >= 450 && ItemIds.Contains(13762)) ||
				(slot.RawItemId == 12774 && slot.Collectability >= 321 && ItemIds.Contains(12774)))
				{
					_haveItem = true;
				}
			}
			if (_haveItem)
			{
				Log("Start");
				if (GatheringManager.WindowOpen)
				{
					Log("Waiting for gathering window to close");
					Thread.Sleep(2000);
				}
				if (FishingManager.State != FishingState.None)
				{
					Log("Stop fishing");
					ActionManager.DoAction("Quit", Core.Me);
					await Coroutine.Wait(5000, () => FishingManager.State == FishingState.None);
				}
				if (WorldManager.ZoneId != 478)
				{
					await TeleportTo(478, 75);
				}
				var destination = new Vector3(-18.48964f, 206.4994f, 53.98175f);
				if (Core.Me.Distance(destination) > CharacterSettings.Instance.MountDistance && !Core.Me.IsMounted)
				{
					while (!Core.Me.IsMounted)
					{
						await CommonTasks.MountUp();
					}
				}
				while (Core.Me.Distance(destination) > 1f)
				{
					var sprintDistance = Math.Min(20.0f, CharacterSettings.Instance.MountDistance);
					Navigator.MoveTo(destination);
					await Coroutine.Yield();
					if (Core.Me.Distance(destination) > sprintDistance && !Core.Me.IsMounted)
					{
						ActionManager.Sprint();
						await Coroutine.Sleep(500);
					}
				}
				if (Core.Me.Distance(destination) <= 1f)
				{
					await CommonTasks.StopAndDismount();
				}
				GameObjectManager.GetObjectByNPCId(1012229).Interact();
				await Coroutine.Wait(5000, () => SelectIconString.IsOpen);
				SelectIconString.ClickSlot(0);
				await Coroutine.Sleep(2000);
				foreach (var item in InventoryManager.FilledSlots)
				{
					// Adamantite
					if (item.RawItemId == 12538 && item.Collectability >= 380 && ItemIds.Contains(12538))
					{
						int tick = 0;
						while (item.IsFilled && tick < 3)
						{
							Log("Attempting to Turn In Adamantite Ore");
							RaptureAtkUnitManager.GetWindowByName("ShopExchangeItem").SendAction(2, 0, 0, 1, 16);
							await Coroutine.Sleep(1000);
							RaptureAtkUnitManager.GetWindowByName("ShopExchangeItemDialog").SendAction(1, 0, 0);
							await Coroutine.Wait(1000, () => Request.IsOpen);
							item.Handover();
							await Coroutine.Wait(1000, () => Request.HandOverButtonClickable);
							Request.HandOver();
							await Coroutine.Sleep(2000);
							tick++;
						}
					}
					// Chysahl Green
					if (item.RawItemId == 12900 && item.Collectability >= 380 && ItemIds.Contains(12900))
					{
						int tick = 0;
						while (item.IsFilled && tick < 3)
						{
							Log("Attempting to Turn In Chysahl Green");
							RaptureAtkUnitManager.GetWindowByName("ShopExchangeItem").SendAction(2, 0, 0, 1, 17);
							await Coroutine.Sleep(1000);
							RaptureAtkUnitManager.GetWindowByName("ShopExchangeItemDialog").SendAction(1, 0, 0);
							await Coroutine.Wait(1000, () => Request.IsOpen);
							item.Handover();
							await Coroutine.Wait(1000, () => Request.HandOverButtonClickable);
							Request.HandOver();
							await Coroutine.Sleep(2000);
							tick++;
						}
					}
					// Thunderbolt Eel
					if (item.RawItemId == 12828 && item.Collectability >= 579 && ItemIds.Contains(12828))
					{
						int tick = 0;
						while (item.IsFilled && tick < 3)
						{
							Log("Attempting to Turn In Thunderbolt Eel");
							RaptureAtkUnitManager.GetWindowByName("ShopExchangeItem").SendAction(2, 0, 0, 1, 18);
							await Coroutine.Sleep(1000);
							RaptureAtkUnitManager.GetWindowByName("ShopExchangeItemDialog").SendAction(1, 0, 0);
							await Coroutine.Wait(1000, () => Request.IsOpen);
							item.Handover();
							await Coroutine.Wait(1000, () => Request.HandOverButtonClickable);
							Request.HandOver();
							await Coroutine.Sleep(2000);
							tick++;
						}
					}
					// Eventide Jade
					if (item.RawItemId == 13760 && item.Collectability >= 450 && ItemIds.Contains(13760))
					{
						int tick = 0;
						while (item.IsFilled && tick < 3)
						{
							Log("Attempting to Turn In Eventide Jade");
							RaptureAtkUnitManager.GetWindowByName("ShopExchangeItem").SendAction(2, 0, 0, 1, 19);
							await Coroutine.Sleep(1000);
							RaptureAtkUnitManager.GetWindowByName("ShopExchangeItemDialog").SendAction(1, 0, 0);
							await Coroutine.Wait(1000, () => Request.IsOpen);
							item.Handover();
							await Coroutine.Wait(1000, () => Request.HandOverButtonClickable);
							Request.HandOver();
							await Coroutine.Sleep(2000);
							tick++;
						}
					}
					// Periwinkle
					if (item.RawItemId == 13762 && item.Collectability >= 450 && ItemIds.Contains(13762))
					{
						int tick = 0;
						while (item.IsFilled && tick < 3)
						{
							Log("Attempting to Turn In Periwinkle");
							RaptureAtkUnitManager.GetWindowByName("ShopExchangeItem").SendAction(2, 0, 0, 1, 20);
							await Coroutine.Sleep(1000);
							RaptureAtkUnitManager.GetWindowByName("ShopExchangeItemDialog").SendAction(1, 0, 0);
							await Coroutine.Wait(1000, () => Request.IsOpen);
							item.Handover();
							await Coroutine.Wait(1000, () => Request.HandOverButtonClickable);
							Request.HandOver();
							await Coroutine.Sleep(2000);
							tick++;
						}
					}
					// Tiny Axolotl
					if (item.RawItemId == 12774 && item.Collectability >= 321)
					{
						int tick = 0;
						while (item.IsFilled && tick < 3)
						{
							Log("Attempting to Turn In Tiny Axolotl");
							RaptureAtkUnitManager.GetWindowByName("ShopExchangeItem").SendAction(2, 0, 0, 1, 21);
							await Coroutine.Sleep(1000);
							RaptureAtkUnitManager.GetWindowByName("ShopExchangeItemDialog").SendAction(1, 0, 0);
							await Coroutine.Wait(1000, () => Request.IsOpen);
							item.Handover();
							await Coroutine.Wait(1000, () => Request.HandOverButtonClickable);
							Request.HandOver();
							await Coroutine.Sleep(2000);
							tick++;
						}
					}
				}
				RaptureAtkUnitManager.GetWindowByName("ShopExchangeItem").SendAction(1, 3, uint.MaxValue);
				_haveItem = false;
				await Coroutine.Sleep(500);
				Log("Done");
			}
			else
			{
				Log("Nothing to Turn In");
			}
			return _done = true;
		}
Пример #3
0
        protected async Task <bool> Sell()
        {
            if (GatheringManager.WindowOpen)
            {
                Log("Waiting for gathering window to close");
                Thread.Sleep(2000);
            }
            if (FishingManager.State != FishingState.None)
            {
                Log("Stop fishing");
                ActionManager.DoAction("Quit", Core.Me);
                await Coroutine.Wait(5000, () => FishingManager.State == FishingState.None);
            }
            IEnumerable <BagSlot> items;

            if (ItemIds != null)
            {
                items =
                    InventoryManager.FilledSlots.
                    Where(bs => Array.Exists(ItemIds, e => e == bs.RawItemId) && bs.IsSellable);
            }
            else
            {
                Log("You didn't specify anything to sell.");
                return(_done = true);
            }
            var bagSlots = items as BagSlot[] ?? items.ToArray();
            var numItems = bagSlots.Count();

            if (numItems == 0)
            {
                Log("None of the items you requested can be sold.");
                return(_done = true);
            }
            if (WorldManager.ZoneId != 129)
            {
                await TeleportTo(129, 8);
            }
            var destination = new Vector3(-129.1327f, 18.2f, 24.21809f);

            while (Core.Me.Distance(destination) > 1f)
            {
                var sprintDistance = Math.Min(20.0f, CharacterSettings.Instance.MountDistance);
                Navigator.MoveTo(destination);
                await Coroutine.Yield();

                if (Core.Me.Distance(destination) > sprintDistance && !Core.Me.IsMounted && !Core.Me.HasAura(50))
                {
                    ActionManager.Sprint();
                    await Coroutine.Sleep(500);
                }
            }
            GameObjectManager.GetObjectByNPCId(1001204).Interact();
            await Coroutine.Wait(5000, () => Shop.Open);

            if (Shop.Open)
            {
                var i = 1;
                foreach (var bagSlot in bagSlots)
                {
                    string name = bagSlot.Name;
                    Log("Attempting to sell item {0} (\"{1}\") of {2}.", i++, name, numItems);
                    var result = await CommonTasks.SellItem(bagSlot);

                    if (result != SellItemResult.Success)
                    {
                        Log("Unable to sell \"{0}\" due to {1}.", name, result);
                        continue;
                    }
                    await Coroutine.Wait(SellTimeout * 1000, () => !bagSlot.IsFilled || !bagSlot.Name.Equals(name));

                    if (bagSlot.IsFilled && bagSlot.Name.Equals(name))
                    {
                        Log("Timed out awaiting sale of \"{0}\" ({1} seconds).", name, SellTimeout);
                    }
                    else
                    {
                        Log("\"{0}\" sold.", name);
                    }
                    await Coroutine.Sleep(500);
                }
                Shop.Close();
                await Coroutine.Wait(2000, () => !Shop.Open);
            }
            return(_done = true);
        }