public static async Task <bool> MoveTo(Vector3 location) { bool goalReached = false; float distance = Core.Me.Location.Distance(location); if (distance < 3f) { return(true); } while (Core.Me.IsAlive && !goalReached) { Navigator.MoveTo(location); distance = Core.Me.Location.Distance(location); goalReached = distance < 3f; if (MovementManager.IsMoving && !Core.Me.IsMounted) { if (Actionmanager.IsSprintReady && WorldManager.InSanctuary) { Actionmanager.Sprint(); } else if (Actionmanager.IsSprintReady && !WorldManager.InSanctuary && Core.Me.InCombat) { Actionmanager.Sprint(); } } await Coroutine.Yield(); } return(true); }
public static Composite SprintMove(ValueRetriever <Vector3> location) { var move = CommonBehaviors.MoveAndStop(location, 1f, true); var sprint = new Decorator(req => CanSprint, new Action(r => { Actionmanager.Sprint(); return(RunStatus.Failure); })); return(new PrioritySelector(sprint, move)); }
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); }
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(-132.198f, 18.2f, 26.07081f); 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); }
protected async Task <bool> TurnIn() { foreach (var slot in InventoryManager.FilledSlots) { // Adamantite // Chysahl Green // Thunderbolt Eel // Eventite Jade // Periwinkle // Tiny Axolotl if ((slot.RawItemId == 12538 && slot.Collectability >= 530) || (slot.RawItemId == 12900 && slot.Collectability >= 530) || (slot.RawItemId == 12828 && slot.Collectability >= 834) || (slot.RawItemId == 13760 && slot.Collectability >= 515) || (slot.RawItemId == 13762 && slot.Collectability >= 515) || (slot.RawItemId == 12774 && slot.Collectability >= 326)) { _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 >= 530) { Log("Attempting to Turn In Adamantite Ore"); RaptureAtkUnitManager.GetWindowByName("ShopExchangeItem").SendAction(2, 0, 0, 1, 8); 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); } // Chysahl Green if (item.RawItemId == 12900 && item.Collectability >= 530) { Log("Attempting to Turn In Chysahl Green"); RaptureAtkUnitManager.GetWindowByName("ShopExchangeItem").SendAction(2, 0, 0, 1, 9); 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); } // Thunderbolt Eel if (item.RawItemId == 12828 && item.Collectability >= 834) { Log("Attempting to Turn In Thunderbolt Eel"); RaptureAtkUnitManager.GetWindowByName("ShopExchangeItem").SendAction(2, 0, 0, 1, 10); 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); } // Eventite Jade if (item.RawItemId == 13760 && item.Collectability >= 515) { Log("Attempting to Turn In Eventite 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); } // Periwinkle if (item.RawItemId == 13762 && item.Collectability >= 515) { 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); } // Tiny Axolotl if (item.RawItemId == 12774 && item.Collectability >= 326) { 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); } } 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); }