public async Task PassLoot() { //if (!NeedGreed.Instance.IsOpen) var window = RaptureAtkUnitManager.GetWindowByName("_Notification"); if (!NeedGreed.Instance.IsOpen && window != null) { window.SendAction(3, 3, 0, 3, 2, 6, 0x375B30E7); await Coroutine.Wait(5000, () => NeedGreed.Instance.IsOpen); } if (NeedGreed.Instance.IsOpen) { for (int i = 0; i < NeedGreed.Instance.NumberOfItems; i++) { NeedGreed.Instance.PassItem(i); await Coroutine.Sleep(500); await Coroutine.Wait(5000, () => SelectYesno.IsOpen); if (SelectYesno.IsOpen) { SelectYesno.Yes(); } } } if (NeedGreed.Instance.IsOpen) { NeedGreed.Instance.Close(); } }
protected override async Task <bool> RunAsync() { AtkAddonControl window = RaptureAtkUnitManager.GetWindowByName(_windowName); if (window == null) { PatternFinder patternFinder = new PatternFinder(Core.Memory); IntPtr agentVtable = patternFinder.Find(_agentOffset); int agentId = AgentModule.FindAgentIdByVtable(agentVtable); AgentModule.GetAgentInterfaceById(agentId).Toggle(); await Coroutine.Wait(5000, () => RaptureAtkUnitManager.GetWindowByName(_windowName) != null); window = RaptureAtkUnitManager.GetWindowByName(_windowName); } if (window != null) { // Choose Dungeon window.SendAction(2, 3, 15, 4, (ulong)Dungeon - 1); await Coroutine.Sleep(250); // Register for Duty window.SendAction(1, 3, 14); } return(false); }
public static int GetDoubleDownReward() { var RewardRegex = new Regex(@".*Current payout: .*[^\d](\d+)[^\d].* MGP", RegexOptions.Compiled); //Regex TimeRegex = new Regex(@"Time Remaining: (\d):(\d+).*", RegexOptions.Compiled); var offset0 = 458; var offset2 = 352; var count = 0; var sec = 0; var windowByName = RaptureAtkUnitManager.GetWindowByName("SelectYesno"); if (windowByName != null) { var elementCount = Core.Memory.Read <ushort>(windowByName.Pointer + offset0); var addr = Core.Memory.Read <IntPtr>(windowByName.Pointer + offset2); var elements = Core.Memory.ReadArray <TwoInt>(addr, elementCount); var data = Core.Memory.ReadString((IntPtr)elements[0].Data, Encoding.UTF8); foreach (var line in data.Split('\n').Skip(2)) { if (RewardRegex.IsMatch(line)) { count = int.Parse(RewardRegex.Match(line).Groups[1].Value.Trim()); } } } return(count); }
public static bool WaitUntil(Func <bool> condition, int frequency = 25, int timeout = -1, bool checkWindows = false) { var t = Task.Run(async delegate { var waitTask = Task.Run(async() => { while (!condition()) { if (checkWindows) { RaptureAtkUnitManager.Update(); } await Task.Delay(frequency); await Task.Yield(); } }); if (waitTask != await Task.WhenAny(waitTask, Task.Delay(timeout))) { throw new TimeoutException(); } return(condition()); }); try { t.Wait(); } catch (AggregateException ae) { } return(condition()); }
/// <summary> /// Sends a reset command to a window /// </summary> internal static async Task ClickReset(uint number) { if (number >= 2) { throw new ArgumentOutOfRangeException(); } if (IsOpen && !SD.Reset) { await Close(); } if (DeepDungeonMenu.IsOpen) { await DeepDungeonMenu.OpenResetMenu(); } Logger.Info("Clicking Reset slot {0} // {1}", number + 1, SD.Reset); await Coroutine.Wait(5000, () => IsOpen); var window = RaptureAtkUnitManager.GetWindowByName(WindowNames.DDsave); window.SendAction(2, 3, number, 3, 2); await Coroutine.Wait(500, () => SelectYesno.IsOpen); //confirm that we want to delete this data. if (SelectYesno.IsOpen) { SelectYesno.ClickYes(); } }
public async Task <bool> Run() { if (RaptureAtkUnitManager.GetWindowByName("DeepDungeonResult") != null) { GameStatsManager.Died(); Logger.Warn($"We have died..."); RaptureAtkUnitManager.GetWindowByName("DeepDungeonResult").SendAction(1, 3, uint.MaxValue); await Coroutine.Sleep(250); return(true); } if (NotificationRevive.IsOpen) { NotificationRevive.Click(); await Coroutine.Wait(250, () => SelectYesno.IsOpen); SelectYesno.ClickYes(); return(true); } if (ClientGameUiRevive.ReviveState == ReviveState.Dead && SelectYesno.IsOpen) { SelectYesno.ClickYes(); return(true); } if (Core.Me.IsDead) { TreeRoot.StatusText = "I am dead. No window to use..."; await Coroutine.Sleep(250); return(true); } return(false); }
/// <summary> /// clicks a save slot. number should be greater than 0 /// </summary> /// <param name="number"></param> internal static async Task ClickSaveSlot(uint number) { if (number >= 2) { throw new ArgumentOutOfRangeException(); } if (IsOpen && SD.Reset) { await Close(); } if (DeepDungeonMenu.IsOpen) { await DeepDungeonMenu.OpenSaveMenu(); } Logger.Info("Clicking Save slot {0} // {1}", number + 1, SD.Reset); await Coroutine.Wait(5000, () => IsOpen); var window = RaptureAtkUnitManager.GetWindowByName(WindowNames.DDsave); window.SendAction(1, 3, number); await Coroutine.Yield(); }
/* Can Also do this: Will pull the same offsets Mastahg stores in RB * var off = typeof(Core).GetProperty("Offsets", BindingFlags.NonPublic | BindingFlags.Static); * var struct158 = off.PropertyType.GetFields()[72]; * var offset0 = (int)struct158.FieldType.GetFields()[0].GetValue(struct158.GetValue(off.GetValue(null))); * var offset2 = (int)struct158.FieldType.GetFields()[2].GetValue(struct158.GetValue(off.GetValue(null))); */ public static int GetAgentInterfaceId() { AtkAddonControl windowByName = RaptureAtkUnitManager.GetWindowByName(WindowName); if (windowByName == null) { return(0); } var test = windowByName.TryFindAgentInterface(); if (test == null) { return(0); } for (int i = 0; i < AgentModule.AgentPointers.Count; i++) { if (test.Pointer.ToInt64() == AgentModule.AgentPointers.ToArray()[i].ToInt64()) { return(i); } } return(0); }
protected async Task <bool> InitiateLeve() { // if (Core.Player.IsMounted) // { // ActionManager.Dismount(); // await Coroutine.Wait(20000, () => !Core.Player.IsMounted); // await Coroutine.Sleep(500); // } var patternFinder = new GreyMagic.PatternFinder(Core.Memory); IntPtr SearchResult = patternFinder.Find("48 8D 05 ? ? ? ? 48 89 54 24 ? 48 89 03 Add 3 TraceRelative"); int agent = AgentModule.FindAgentIdByVtable(SearchResult); AgentModule.ToggleAgentInterfaceById(agent); await Coroutine.Sleep(500); AtkAddonControl windowByName = RaptureAtkUnitManager.GetWindowByName("JournalDetail"); while (windowByName == null) { await Coroutine.Sleep(500); windowByName = RaptureAtkUnitManager.GetWindowByName("JournalDetail"); } if (windowByName != null) { var leves = LeveManager.Leves; if (leves.Length > 0) { foreach (ff14bot.Managers.LeveWork leve in leves) { if (leve.GlobalId == LeveId && leve.Step == 1) { ulong globalId = (ulong)leve.GlobalId; windowByName.SendAction(3, 3, 0xC, 3, globalId, 3, 2); //Set Quest await Coroutine.Sleep(200); windowByName.SendAction(2, 3, 4, 4, globalId); //Initiate if (await Coroutine.Wait(10000, () => SelectYesno.IsOpen)) { SelectYesno.ClickYes(); } await Coroutine.Sleep(2000); RaptureAtkUnitManager.GetWindowByName("GuildLeveDifficulty").SendAction(1, 3, 0); await Coroutine.Sleep(3000); break; } } } windowByName = RaptureAtkUnitManager.GetWindowByName("JournalDetail"); if (windowByName != null) { AgentModule.ToggleAgentInterfaceById(agent); } } return(_done = true); }
public static void AcceptLeve(uint leve) { // Value Pairs: {3, 0xB}, {3, 1}, {3, 0x236} // Pair 1 is unknown // Pair 2 is unknown // Pair 3 is the leve number RaptureAtkUnitManager.GetWindowByName("GuildLeve").SendAction(2, 3, 3, 4, leve); }
public static async Task <bool> SelectTeleport() { await Coroutine.Sleep(1000); RaptureAtkUnitManager.GetWindowByName("SelectYesnoCount").SendAction(1, 3, 0); await Coroutine.Sleep(5000); return(true); }
/// <summary> /// close the window /// </summary> public static async Task Close() { if (IsOpen) { RaptureAtkUnitManager.GetWindowByName(WindowNames.DDsave).SendAction(1, 3, uint.MaxValue); } //await Coroutine.Sleep(1000); //these windows take a second await Coroutine.Wait(1500, () => DeepDungeonMenu.IsOpen); }
public static void Close() { // Value Pairs: {3, 0xFFFFFFFF} // Pair 1 is unknown if (IsOpen) { RaptureAtkUnitManager.GetWindowByName("GuildLeve").SendAction(1, 3, 0xFFFFFFFF); } }
public static async Task DesynthItem(BagSlot slot) { var agentSalvageInterface = AgentInterface <AgentSalvage> .Instance; var agentSalvage = Offsets.SalvageAgent; Log($"Desynthesize Item - Name: {slot.Item.CurrentLocaleName}{(slot.Item.IsHighQuality ? " HQ" : string.Empty)}"); var itemId = slot.RawItemId; while (slot.IsValid && slot.IsFilled && slot.RawItemId == itemId) { lock (Core.Memory.Executor.AssemblyLock) { Core.Memory.CallInjected64 <int>(agentSalvage, agentSalvageInterface.Pointer, slot.Pointer, 14, 0); } await Coroutine.Sleep(200); // Log($"Waiting for SalvageDialog."); await Coroutine.Wait(5000, () => SalvageDialog.IsOpen); if (SalvageDialog.IsOpen) { // Log($"Sending Desynth action."); RaptureAtkUnitManager.GetWindowByName("SalvageDialog").SendAction(1, 3, 0); await Coroutine.Sleep(500); } // Log($"Wait for DesynthLock byte 1."); await Coroutine.Wait(5000, () => Core.Memory.NoCacheRead <uint>(Offsets.Conditions + Offsets.DesynthLock) != 0); // Log($"Wait for DesynthLock byte 0"); await Coroutine.Wait(6000, () => Core.Memory.NoCacheRead <uint>(Offsets.Conditions + Offsets.DesynthLock) == 0); await Coroutine.Sleep(100); await Coroutine.Wait(6000, () => SalvageResult.IsOpen || SalvageAutoDialog.Instance.IsOpen); if (SalvageAutoDialog.Instance.IsOpen) { await Coroutine.Wait(-1, () => !slot.IsValid || !slot.IsFilled || Core.Memory.NoCacheRead <uint>(Offsets.Conditions + Offsets.DesynthLock) == 0); await Coroutine.Sleep(300); SalvageAutoDialog.Instance.Close(); await Coroutine.Wait(5000, () => !SalvageAutoDialog.Instance.IsOpen); continue; } if (IsBusy) { break; } } }
public static void Close() { var windowByName = RaptureAtkUnitManager.GetWindowByName(windowName); if (windowByName == null) { return; } RaptureAtkUnitManager.GetWindowByName(windowName).SendAction(1, 3UL, (ulong)uint.MaxValue); }
public static string GetErrorReason(this RetainerTaskAsk retainerTaskAsk) { var WindowByName = RaptureAtkUnitManager.GetWindowByName("RetainerTaskAsk"); if (WindowByName == null || WindowByName.FindLabel(39) == null) { return(""); } return(WindowByName.FindLabel(39).Text); }
public static ushort ElementCount(string name) { AtkAddonControl windowByName = RaptureAtkUnitManager.GetWindowByName(name); if (windowByName != null) { return(Core.Memory.Read <ushort>(windowByName.Pointer + offset0)); } return(0); }
internal static async Task OpenResetMenu() { var wind = RaptureAtkUnitManager.GetWindowByName(WindowNames.DDmenu); if (wind == null) { throw new Exception("Open Reset Menu Failed. POTD Menu is not open. (The bot will attempt to correct this issue)"); } wind.SendAction(1, 3, 1); await Coroutine.Wait(3000, () => DeepDungeonSaveData.IsOpen); }
public static bool CanAssign(this RetainerTaskAsk retainerTaskAsk) { var WindowByName = RaptureAtkUnitManager.GetWindowByName("RetainerTaskAsk"); if (WindowByName == null) { return(false); } var remoteButton = WindowByName.FindButton(40); return(remoteButton != null && remoteButton.Clickable); }
private bool ExecuteAutoQTE() { var qte = RaptureAtkUnitManager.GetWindowByName("QTE"); if (qte != null) { qte.SendAction(2, 3, 1, 4, 1); return(true); } return(false); }
public static TwoInt[] ___Elements(string name) { AtkAddonControl windowByName = RaptureAtkUnitManager.GetWindowByName(name); if (windowByName != null) { ushort elementCount = ElementCount(name); IntPtr addr = Core.Memory.Read <IntPtr>(windowByName.Pointer + offset2); return(Core.Memory.ReadArray <TwoInt>(addr, elementCount)); } return(null); }
private async Task DesynthItems(int[] itemId) { var itemsToDesynth = InventoryManager.FilledSlots.Where(bs => bs.IsDesynthesizable && itemId.Contains((int)bs.RawItemId)); var agentSalvageInterface = AgentInterface <AgentSalvage> .Instance; var agentSalvage = Offsets.SalvageAgent; //Log($"{itemsToDesynth.Count()}"); foreach (var item in itemsToDesynth) { Log($"Desynthesize Item - Name: {item.Item.CurrentLocaleName}"); lock (Core.Memory.Executor.AssemblyLock) { Core.Memory.CallInjected64 <int>(agentSalvage, agentSalvageInterface.Pointer, item.Pointer, 14); } // await Coroutine.Sleep(500); await Coroutine.Wait(5000, () => SalvageDialog.IsOpen); if (SalvageDialog.IsOpen) { RaptureAtkUnitManager.GetWindowByName("SalvageDialog").SendAction(1, 3, 0); //await Coroutine.Sleep(500); await Coroutine.Wait(10000, () => SalvageResult.IsOpen); if (SalvageResult.IsOpen) { SalvageResult.Close(); //await Coroutine.Sleep(500); await Coroutine.Wait(5000, () => !SalvageResult.IsOpen); } else { Log("Result didn't open"); break; } } else { Log("SalvageDialog didn't open"); break; } } _isDone = true; }
public static async Task <bool> Join() { if (!IsOpen) { return(false); } RaptureAtkUnitManager.GetWindowByName("ContentsFinder").SendAction(1, 1, 3); if (await Coroutine.Wait(5000, () => !IsOpen)) { return(true); } return(false); }
public async Task EnableAction(int index) { SelectAction(index); await Coroutine.Wait(5000, () => RaptureAtkUnitManager.GetWindowByName("ContextMenu") != null); if (RaptureAtkUnitManager.GetWindowByName("ContextMenu") != null) { SelectEnable(); await Coroutine.Wait(5000, () => SelectYesno.IsOpen); if (SelectYesno.IsOpen) { SelectYesno.Yes(); } } }
private void button1_Click(object sender, EventArgs e) { RaptureAtkUnitManager.Update(); listBox1.Items.Clear(); listBox2.Items.Clear(); //listBox1.Items.Add($"RaptureAtkUnitManager Updated"); LlamaUI.Log("RaptureAtkUnitManager Updated"); foreach (var window in RaptureAtkUnitManager.Controls) { listBox1.Items.Add($"{window.Name}"); } button2.Enabled = true; }
internal static uint Purchase(uint itemId, uint itemCount) { var windowByName = RaptureAtkUnitManager.GetWindowByName("ShopExchangeCurrency"); if (windowByName == null) { return(0u); } var items = SpecialShopManager.Items; var specialShopItem = items?.Cast <SpecialShopItem?>().FirstOrDefault(i => i.HasValue && i.Value.ItemIds.Contains(itemId)); if (!specialShopItem.HasValue) { return(0u); } if (itemCount > specialShopItem.Value.Item0.StackSize) { itemCount = specialShopItem.Value.Item0.StackSize; } var count = CanAffordScrip(specialShopItem.Value); if (itemCount > count) { itemCount = count; } var index = items.IndexOf(specialShopItem.Value); var obj = new ulong[8] { 3uL, 0uL, 3uL, 0uL, 3uL, 0uL, 0uL, 0uL }; obj[3] = (uint)index; obj[5] = itemCount; windowByName.SendAction(4, obj); return(itemCount); }
internal static async Task <bool> VerifiedRetainerData2() { if (Core.Memory.Read <uint>(Offsets.RetainerData) != 0) { return(true); } AgentContentsInfo.Instance.Toggle(); await Coroutine.Wait(5000, () => RaptureAtkUnitManager.GetWindowByName("ContentsInfo") != null); await Coroutine.Sleep(500); await Coroutine.Wait(3000, () => Core.Memory.Read <uint>(Offsets.RetainerData) != 0); //AgentContentsInfo.Instance.Toggle(); RaptureAtkUnitManager.GetWindowByName("ContentsInfo").SendAction(1, 3uL, 4294967295uL); return(Core.Memory.Read <uint>(Offsets.RetainerData) != 0); }
internal static async Task OpenSaveMenu() { var menu = RaptureAtkUnitManager.GetWindowByName(WindowNames.DDmenu); if (menu == null) { return; } try { menu.SendAction(1, 3, 0); await Coroutine.Wait(3000, () => DeepDungeonSaveData.IsOpen); } catch (Exception ex) { Logger.Verbose("{0}", ex); } }
private static async Task <bool> WindowEscapeSpam(string windowName) { for (var i = 0; i < 5 && RaptureAtkUnitManager.GetWindowByName(windowName) != null; i++) { RaptureAtkUnitManager.Update(); if (RaptureAtkUnitManager.GetWindowByName(windowName) != null) { RaptureAtkUnitManager.GetWindowByName(windowName).SendAction(1, 3UL, (ulong)uint.MaxValue); } await Coroutine.Wait(300, () => RaptureAtkUnitManager.GetWindowByName(windowName) == null); await Coroutine.Wait(300, () => RaptureAtkUnitManager.GetWindowByName(windowName) != null); await Coroutine.Yield(); } return(RaptureAtkUnitManager.GetWindowByName(windowName) == null); }
public static bool CloseInventory() { if (!IsInventoryOpen()) { return(true); } if (RaptureAtkUnitManager.GetWindowByName("InventoryRetainer") != null) { RaptureAtkUnitManager.GetWindowByName("InventoryRetainer").SendAction(1, 3, (ulong)uint.MaxValue); return(true); } if (RaptureAtkUnitManager.GetWindowByName("InventoryRetainerLarge") != null) { RaptureAtkUnitManager.GetWindowByName("InventoryRetainerLarge").SendAction(1, 3, (ulong)uint.MaxValue); return(true); } return(false); }