コード例 #1
0
        public async Task <bool> Shop()
        {
            var npcId = GameObjectManager.GetObjectByNPCId(1012301);

            if (!npcId.IsWithinInteractRange)
            {
                var _target = npcId.Location;
                Navigator.PlayerMover.MoveTowards(_target);
                while (_target.Distance2D(Core.Me.Location) >= 4)
                {
                    Navigator.PlayerMover.MoveTowards(_target);
                    await Coroutine.Sleep(100);
                }

                Navigator.PlayerMover.MoveStop();
            }

            npcId.Interact();

            await Coroutine.Wait(5000, () => SelectIconString.IsOpen);

            SelectIconString.ClickSlot(0);

            await Coroutine.Wait(5000, () => SelectString.IsOpen);

            SelectString.ClickSlot(5);

            await Coroutine.Sleep(700);

            var windowName = "ShopExchangeCurrency";
            await Coroutine.Wait(5000, () => RaptureAtkUnitManager.GetWindowByName(windowName) != null);

            var windowByName = RaptureAtkUnitManager.GetWindowByName(windowName);

            if (windowByName == null)
            {
                return(false);
            }

            while (SpecialCurrencyManager.GetCurrencyCount(SpecialCurrency.YellowCraftersScrips) > 50 && InventoryManager.FreeSlots > 1)
            {
                if (windowByName != null)
                {
                    windowByName.SendAction(4, 3, 0, 3, 0x19, 3, 1, 0, 0);
                }

                await Coroutine.Wait(5000, () => SelectYesno.IsOpen);

                if (SelectYesno.IsOpen)
                {
                    SelectYesno.Yes();
                }

                await Coroutine.Sleep(700);
            }

            windowByName.SendAction(1, 3uL, 4294967295uL);

            await Coroutine.Wait(5000, () => SelectString.IsOpen);

            SelectString.ClickSlot((uint)(SelectString.LineCount - 1));

            await Coroutine.Sleep(700);

            return(true);
        }
コード例 #2
0
 public TWindow Refresh()
 {
     updateWindows();
     control = RaptureAtkUnitManager.GetWindowByName(Name);
     return((TWindow)this);
 }
コード例 #3
0
 public static bool IsInventoryOpen()
 {
     return(RaptureAtkUnitManager.GetWindowByName("InventoryRetainer") != null ||
            RaptureAtkUnitManager.GetWindowByName("InventoryRetainerLarge") != null);
 }
コード例 #4
0
        public async Task <uint> Purchase(uint itemId, uint itemCount = 1)
        {
            if (!IsOpen)
            {
                return(0u);
            }

            var items = SpecialShopManager.Items;

            var specialShopItem = items?.Cast <SpecialShopItem?>().FirstOrDefault(i => i.HasValue && i.Value.ItemIds.Contains(itemId));

            //Logging.Write(Colors.Fuchsia, $"[ShopExchangeItem] Buying {specialShopItem}");
            if (!specialShopItem.HasValue)
            {
                return(0u);
            }

            if (itemCount > specialShopItem.Value.Item0.StackSize)
            {
                itemCount = specialShopItem.Value.Item0.StackSize;
            }

            if (!CanAfford(specialShopItem.Value))
            {
                return(0);
            }
            // Logging.Write(Colors.Fuchsia, $"[Purchase] Can afford {CanAfford(specialShopItem.Value)}");
            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;
            SendAction(4, obj);
            // Logging.Write(Colors.Fuchsia, $"[Purchase] Sent Action");
            await Coroutine.Wait(5000, () => RaptureAtkUnitManager.GetWindowByName("ShopExchangeItemDialog") != null);

            if (RaptureAtkUnitManager.GetWindowByName("ShopExchangeItemDialog") != null)
            {
                //Logging.Write(Colors.Fuchsia, $"[Purchase] ShopExchangeItemDialog Open");
                RaptureAtkUnitManager.GetWindowByName("ShopExchangeItemDialog").SendAction(1, 3, 0);
                await Coroutine.Wait(5000, () => RaptureAtkUnitManager.GetWindowByName("ShopExchangeItemDialog") == null);

                await Coroutine.Wait(2000, () => SelectYesno.IsOpen || Request.IsOpen);

                if (SelectYesno.IsOpen)
                {
                    //Logging.Write(Colors.Fuchsia, $"[Purchase] Yes/no");
                    SelectYesno.Yes();
                    await Coroutine.Wait(2000, () => !SelectYesno.IsOpen);

                    await Coroutine.Wait(3000, () => Request.IsOpen);
                }

                if (Request.IsOpen)
                {
                    // Logging.Write(Colors.Fuchsia, $"[Purchase] Request");
                    for (int i = 0; i < 3; i++)
                    {
                        BagSlot item;
                        if (specialShopItem.Value.HqCurrencies[i])
                        {
                            item = InventoryManager.FilledInventoryAndArmory.FirstOrDefault(j => j.RawItemId == specialShopItem.Value.CurrencyTypes[i] && j.Count >= specialShopItem.Value.CurrencyCosts[i] && j.IsHighQuality == specialShopItem.Value.HqCurrencies[i]);
                        }
                        else
                        {
                            item = InventoryManager.FilledInventoryAndArmory.FirstOrDefault(j => j.RawItemId == specialShopItem.Value.CurrencyTypes[i] && j.Count >= specialShopItem.Value.CurrencyCosts[i]);
                        }
                        // Logging.Write(Colors.Fuchsia, $"[Purchase] Request item {item}");
                        if (item != null)
                        {
                            item.Handover();
                            await Coroutine.Sleep(500);
                        }
                    }

                    if (Request.HandOverButtonClickable)
                    {
                        Request.HandOver();
                    }

                    await Coroutine.Sleep(1000);
                }
                else
                {
                    //Logging.Write(Colors.Fuchsia, $"[Purchase] Request Not open");
                }

                if (QuestLogManager.InCutscene && AgentInterface <AgentCutScene> .Instance.CanSkip && !SelectString.IsOpen)
                {
                    AgentInterface <AgentCutScene> .Instance.PromptSkip();

                    await Coroutine.Wait(6000, () => SelectString.IsOpen);

                    SelectString.ClickSlot(0);
                    await CommonTasks.HandleLoading();

                    await Coroutine.Wait(6000, () => !QuestLogManager.InCutscene);

                    await CommonTasks.HandleLoading();

                    await Coroutine.Sleep(500);
                }
            }


            return(itemCount);
        }
コード例 #5
0
ファイル: JoinDuty.cs プロジェクト: uk959595/LlamaLibrary
        private async Task JoinDutyTask(int DutyId, bool Trial)
        {
            Logging.WriteDiagnostic("Queuing for Dungeon");
            GameSettingsManager.JoinWithUndersizedParty = true;
            DutyManager.Queue(DataManager.InstanceContentResults[(uint)DutyId]);
            await Coroutine.Wait(5000, () => (DutyManager.QueueState == QueueState.InQueue || DutyManager.QueueState == QueueState.JoiningInstance));

            Logging.WriteDiagnostic("Queued for Dungeon");

            await Coroutine.Wait(10000, () => (DutyManager.QueueState == QueueState.JoiningInstance));

            await Coroutine.Wait(10000, () => (RaptureAtkUnitManager.GetWindowByName("ContentsFinderConfirm") != null));

            Logging.WriteDiagnostic("Commencing");
            DutyManager.Commence();
            Logging.WriteDiagnostic("Waiting for Loading");
            await Coroutine.Wait(10000, () => CommonBehaviors.IsLoading || QuestLogManager.InCutscene);

            if (CommonBehaviors.IsLoading)
            {
                await Coroutine.Wait(-1, () => !CommonBehaviors.IsLoading);
            }

            if (QuestLogManager.InCutscene)
            {
                TreeRoot.StatusText = "InCutscene";
                if (ff14bot.RemoteAgents.AgentCutScene.Instance != null)
                {
                    ff14bot.RemoteAgents.AgentCutScene.Instance.PromptSkip();
                    await Coroutine.Wait(250, () => SelectString.IsOpen);

                    if (SelectString.IsOpen)
                    {
                        SelectString.ClickSlot(0);
                    }
                }
            }

            Logging.WriteDiagnostic("Should be in duty");

            var director = ((ff14bot.Directors.InstanceContentDirector)DirectorManager.ActiveDirector);

            if (director != null)
            {
                if (Trial)
                {
                    if (director.TimeLeftInDungeon >= new TimeSpan(0, 60, 0))
                    {
                        Logging.WriteDiagnostic("Barrier up");
                        await Coroutine.Wait(30000, () => director.TimeLeftInDungeon < new TimeSpan(0, 59, 58));
                    }
                }
                else
                {
                    if (director.TimeLeftInDungeon >= new TimeSpan(1, 30, 0))
                    {
                        Logging.WriteDiagnostic("Barrier up");
                        await Coroutine.Wait(30000, () => director.TimeLeftInDungeon < new TimeSpan(1, 29, 58));
                    }
                }
            }
            else
            {
                Logging.WriteDiagnostic("Director is null");
            }

            Logging.WriteDiagnostic("Should be ready");

            _isDone = true;
        }
コード例 #6
0
ファイル: Form1.cs プロジェクト: nt153133/UIChecker
        private void button2_Click(object sender, EventArgs e)
        {
            listBox2.Items.Clear();
            listBox3.Items.Clear();
            //ActionManager.DoAction(11385, GameObjectManager.GetObjectByNPCId(1026934));
            richTextBox1.Text = "";
            var windowName = ((string)listBox1.SelectedItem).Trim();

            //AtkAddonControl windowByName = RaptureAtkUnitManager.GetWindowByName(windowName);
            //string windowName = windowByName.Name;
            //ff14bot.Managers.AgentModule.AgentPointers[310]
            //listBox1.Items.Add($"{AgentModule.AgentPointers[310].ToInt64():X}");

            LlamaUI.Log($"{windowName} Selected");
            var elements = LlamaUI.___Elements(windowName);

            using (var outputFile = new StreamWriter($"{windowName}.cvs", false))
            {
                for (var j = 0; j < elements.Length; j++)
                {
                    var    i = elements[j];
                    string data;
                    //Log(i+ " " );
                    if (i.Type == 6 || i.Type == 8 || i.Type == 38)
                    {
                        //byte[] source = Core.Memory.ReadBytes((IntPtr)i.Data, 16);
                        //byte[] bytes = Encoding.Convert(Encoding.UTF8, Encoding.Unicode, source.ToArray());
                        //string @string = Encoding.Unicode.GetString(bytes);
                        data = Core.Memory.ReadString((IntPtr)i.Data, Encoding.UTF8);
                    }

                    //listBox3.Items.Add($"[{j}:{i.Type}] ({tstring})");
                    else if (i.Type == 4)
                    {
                        data = $"{i.TrimmedData}";
                    }
                    //listBox3.Items.Add($"[{j}:{i.Type}] {i.TrimmedData}");
                    else
                    {
                        data = $"{i.Data}({i.TrimmedData})";
                    }

                    listBox2.Items.Add($"[{j}:{i.Type}] {data}");
                    IntPtr ptr = (IntPtr)i.Data;
                    outputFile.WriteLine($"{j},{i.Type},{i.Data},{i.TrimmedData},{data},{ptr.ToInt64():X}");
                    LlamaUI.Log($"{windowName}.cvs Written");
                }
            }

            AtkAddonControl windowByName = RaptureAtkUnitManager.GetWindowByName(windowName);

            if (windowByName != null)
            {
//                Core.Memory.GetRelative()

                AgentInterface test;
                try
                {
                    test = windowByName.TryFindAgentInterface();
                    richTextBox1.Text += $"Agent ID is: {test.Id}\n";
                    richTextBox1.Text += $"Pointer: {test.Pointer.ToInt64():X} \nAgent Vtable: {test.VTable.ToInt64():X} \nVtableOffset {Core.Memory.GetRelative(test.VTable).ToInt64():X}\n";
                }
                catch
                {
                }


                richTextBox1.Text += $"Window Pointer: {windowByName.Pointer.ToInt64():X} \nWindow Vtable: {windowByName.VTable.ToInt64():X} \nVtableOffset {Core.Memory.GetRelative(windowByName.VTable).ToInt64():X}\n";

                //var test = AgentModule.GetAgentInterfaceById(99);
                //  test.Toggle();
                // var testbyte = Core.Memory.Read<byte>(test.Pointer + 0x10);
                //  richTextBox1.Text += $"{testbyte}";
                //richTextBox1.Text += $"Size is: {sizeof(ResultLayout)}\n";
            }

            button2.Enabled = false;
            button3.Enabled = true;
        }
コード例 #7
0
 public void SelectEnable()
 {
     RaptureAtkUnitManager.GetWindowByName("ContextMenu").SendAction(4, 3, 0, 3, 0, 4, 0, 0, 0);
 }
コード例 #8
0
ファイル: AutoTrade.cs プロジェクト: Sykel/LlamaLibrary
        private static async Task TradeItems(Queue <QueuedTradeItem> tradeQueue, BattleCharacter target)
        {
            FailedTradeCount = 0;
            int gilToTrade = AutoTradeSettings.GilToTrade;

            if (gilToTrade > 0)
            {
                LogSuccess($"We want to trade a total of {gilToTrade:N0} gil.");
            }
            LogSuccess("---Starting Trades---");
            while ((TradeQueue.Any() || gilToTrade > 0) && FailedTradeCount < 3)
            {
                if (!target.IsWithinInteractRange)
                {
                    LogCritical("Our trading partner ran away from us!");
                    break;
                }

                int result = target.OpenTradeWindow();

                if (result != 0)
                {
                    FailedTradeCount++;
                    LogCritical("Couldn't open trade window. Pausing to retry...");
                    await Coroutine.Sleep(3000);

                    continue;
                }


                await Coroutine.Wait(5000, () => Trade.IsOpen);

                if (!Trade.IsOpen)
                {
                    FailedTradeCount++;
                    LogCritical("Trade window never opened. Pausing to retry...");
                    await Coroutine.Sleep(3000);

                    continue;
                }

                LogSuccess("Trading window opened.");

                int gilAmount  = 0;
                int currentGil = AutoTradeSettings.CurrentGil;

                if (gilToTrade > 0)
                {
                    gilAmount = Math.Min(gilToTrade, 1000000);
                    LogSuccess($"Adding {gilAmount:N0} gil.");
                    RaptureAtkUnitManager.GetWindowByName("Trade").SendAction(1, 3, 2);
                    await WaitForInputNumeric((uint)gilAmount);

                    await Coroutine.Sleep(250);
                }

                if (tradeQueue.Any())
                {
                    WatchedBagSlots.Clear();
                    List <MarkedBagSlot> markedBagSlots = AutoTradeSettings.MainBagsFilledSlots
                                                          .Where(x => x.CanTrade() && AutoTradeSettings.ItemsToTrade.Any(y => y.TrueItemId == x.TrueItemId))
                                                          .Select(x => new MarkedBagSlot(x))
                                                          .ToList();

                    for (int i = 0; i < 5 && tradeQueue.Any(); i++)
                    {
                        QueuedTradeItem itemToTrade = tradeQueue.Dequeue();

                        MarkedBagSlot itemSlot = markedBagSlots
                                                 .Where(x => x.BagSlot.TrueItemId == itemToTrade.TrueItemId && !x.BeingTraded)
                                                 .OrderByDescending(x => x.BagSlot.Count)
                                                 .FirstOrDefault();
                        if (itemSlot?.BagSlot == null || !itemSlot.BagSlot.IsFilled)
                        {
                            LogCritical($"Couldn't find any ID: {itemToTrade.TrueItemId} in our inventory.");
                            i--;
                            continue;
                        }

                        itemSlot.BeingTraded = true;
                        WatchedBagSlots.Add(new WatchedBagSlot(itemSlot.BagSlot));
                        LogSuccess($"Adding x{itemToTrade.QtyToTrade} {itemToTrade.ItemName} to Slot {i+1}.");
                        itemSlot.BagSlot.TradeItem();
                        if (itemToTrade.QtyToTrade > 1 && itemToTrade.StackSize > 1)
                        {
                            await WaitForInputNumeric(itemToTrade.QtyToTrade);
                        }

                        await Coroutine.Sleep(250);
                    }
                }

                RaptureAtkUnitManager.GetWindowByName("Trade").SendAction(1, 3uL, 0);
                await Coroutine.Wait(30000, () => Trade.TradeStage == 5);

                if (Trade.TradeStage != 5)
                {
                    LogCritical("Our target still hasn't accepted the trade... aborting.");
                    break;
                }
                await Coroutine.Wait(5000, () => SelectYesno.IsOpen);

                if (SelectYesno.IsOpen)
                {
                    SelectYesno.Yes();
                }
                await Coroutine.Wait(5000, () => !SelectYesno.IsOpen);

                await Coroutine.Wait(30000, () => Trade.TradeStage == 1);

                if (Trade.TradeStage == 6)
                {
                    LogCritical("Our target still hasn't accepted the trade... aborting.");
                    break;
                }

                LogSuccess("Trade completed.");

                // Arbitrary wait to let values update after trade is complete.
                await Coroutine.Sleep(1500);

                if (gilToTrade > 0 && currentGil == AutoTradeSettings.CurrentGil)
                {
                    LogCritical("Trading gil didn't go through.");
                    FailedTradeCount++;
                    continue;
                }
                gilToTrade -= gilAmount;
                if (WatchedSlotsUnchanged(WatchedBagSlots))
                {
                    LogCritical("Some items were unchanged, even though they should have been traded.");
                    FailedTradeCount++;
                    continue;
                }
            }
        }
コード例 #9
0
        public static async Task <bool> Desynth()
        {
            if (IsBusy)
            {
                return(true);
            }
            //Desynthesis
            var agentSalvageInterface = AgentInterface <AgentSalvage> .Instance;
            var agentSalvage          = Offsets.SalvageAgent;

            //if (MovementManager.IsOccupied) return false;
            //          if (!InventoryManager.GetBagsByInventoryBagId(BagsToCheck()).Any(bag => bag.FilledSlots.Any(bs => bs.IsDesynthesizable)))
            if (!InventoryManager.GetBagsByInventoryBagId(BagsToCheck()).Any(bag => bag.FilledSlots.Any(bs => bs.IsDesynthesizable && (ShouldDesynth(bs.Item.EnglishName) || ExtraCheck(bs)))))
            {
                Log($"None found");
                return(false);
            }


            /*            var itemsToDesynth = InventoryManager.GetBagsByInventoryBagId(BagsToCheck())
             *              .SelectMany(bag => bag.FilledSlots
             *                  .FindAll(bs => bs.IsDesynthesizable && (ShouldDesynth(bs.Item.EnglishName) || ExtraCheck(bs))));*/

            var itemsToDesynth = InventoryManager.GetBagsByInventoryBagId(BagsToCheck())
                                 .SelectMany(bag => bag.FilledSlots
                                             .FindAll(bs => bs.IsDesynthesizable && (ShouldDesynth(bs.Item.EnglishName) || ExtraCheck(bs))));

            Log($"{itemsToDesynth.Count()}");
            foreach (var item in itemsToDesynth)
            {
                Log($"Desynthesize Item - Name: {item.Item.CurrentLocaleName}");

                while (item.IsFilled)
                {
                    lock (Core.Memory.Executor.AssemblyLock)
                    {
                        Core.Memory.CallInjected64 <int>(agentSalvage, agentSalvageInterface.Pointer, item.Pointer, 14, 0);
                    }

                    await Coroutine.Sleep(200);

                    // Log($"Wait Window");
                    await Coroutine.Wait(5000, () => SalvageDialog.IsOpen);

                    if (SalvageDialog.IsOpen)
                    {
                        //  Log($"Open Window");
                        RaptureAtkUnitManager.GetWindowByName("SalvageDialog").SendAction(1, 3, 0);
                        await Coroutine.Sleep(500);

                        //await Coroutine.Wait(10000, () => SalvageResult.IsOpen);
                    }

                    // Log($"Wait byte 1");
                    await Coroutine.Wait(5000, () => Core.Memory.NoCacheRead <uint>(Offsets.Conditions + Offsets.DesynthLock) != 0);

                    // Log($"Wait 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 || RaptureAtkUnitManager.GetWindowByName("SalvageAutoDialog") != null);


                    if (IsBusy)
                    {
                        break;
                    }
                }
                if (IsBusy)
                {
                    break;
                }
            }
            if (SalvageResult.IsOpen)
            {
                SalvageResult.Close();
                await Coroutine.Wait(5000, () => !SalvageResult.IsOpen);
            }

            if (RaptureAtkUnitManager.GetWindowByName("SalvageAutoDialog") != null)
            {
                RaptureAtkUnitManager.GetWindowByName("SalvageAutoDialog").SendAction(1, 3uL, 4294967295uL);
                await Coroutine.Wait(5000, () => RaptureAtkUnitManager.GetWindowByName("SalvageAutoDialog") == null);
            }

            return(true);
        }
コード例 #10
0
        protected override async Task <bool> Main()
        {
            foreach (var unit in GameObjectManager.GameObjects.OrderBy(r => r.Distance()))
            {
                if (unit.Name == "传唤铃" || unit.NpcId == 2000401 || unit.NpcId == 2000441)
                {
                    unit.Interact();
                    break;
                }
            }
            if (!await Coroutine.Wait(3000, () => SelectString.IsOpen))
            {
                if (RaptureAtkUnitManager.GetWindowByName("RetainerList") == null)
                {
                    return(isDone = true);
                }

                const int Offset0           = 0x1CA;
                const int Offset2           = 0x160;
                var       elementCount      = Core.Memory.Read <ushort>(RaptureAtkUnitManager.GetWindowByName("RetainerList").Pointer + Offset0);
                var       addr              = Core.Memory.Read <IntPtr>(RaptureAtkUnitManager.GetWindowByName("RetainerList").Pointer + Offset2);
                TwoInt[]  elements          = Core.Memory.ReadArray <TwoInt>(addr, elementCount);
                int       NumberOfRetainers = elements[2].TrimmedData;
                for (var i = 0; i < NumberOfRetainers; i++)
                {
                    RaptureAtkUnitManager.GetWindowByName("RetainerList").SendAction(2, 3UL, 2UL, 3UL, (ulong)i);
                    await Coroutine.Sleep(300);

                    await Coroutine.Wait(9000, () => Talk.DialogOpen);

                    Talk.Next();

                    if (!await Coroutine.Wait(5000, () => SelectString.IsOpen))
                    {
                        return(isDone = true);
                    }
                    foreach (var retainer in SelectString.Lines())
                    {
                        if (retainer.EndsWith("[结束]") || retainer.EndsWith("[Tâche terminée]") || retainer.EndsWith("(Venture complete)"))
                        {
                            Log("探险结束!");
                            SelectString.ClickSlot(5);
                            if (!await Coroutine.Wait(5000, () => RetainerTaskResult.IsOpen))
                            {
                                continue;
                            }
                            RetainerTaskResult.Reassign();
                            if (!await Coroutine.Wait(5000, () => RetainerTaskAsk.IsOpen))
                            {
                                continue;
                            }
                            RetainerTaskAsk.Confirm();
                            if (!await Coroutine.Wait(5000, () => Talk.DialogOpen))
                            {
                                continue;
                            }
                            Talk.Next();
                            if (!await Coroutine.Wait(5000, () => SelectString.IsOpen))
                            {
                                continue;
                            }
                        }
                    }

                    SelectString.ClickSlot((uint)SelectString.LineCount - 1);
                    if (!await Coroutine.Wait(5000, () => Talk.DialogOpen))
                    {
                        continue;
                    }
                    Talk.Next();
                    await Coroutine.Sleep(3000);
                }
                RaptureAtkUnitManager.GetWindowByName("RetainerList").SendAction(1, 3uL, 4294967295uL);
            }
            return(isDone = true);
        }
コード例 #11
0
        public static async Task <bool> Desynth(IEnumerable <BagSlot> itemsToDesynth)
        {
            if (IsBusy)
            {
                return(true);
            }

            if (!itemsToDesynth.Any())
            {
                return(true);
            }

            var agentSalvageInterface = AgentInterface <AgentSalvage> .Instance;
            var agentSalvage          = Offsets.SalvageAgent;

            Log($"{itemsToDesynth.Count()}");
            foreach (var item in itemsToDesynth)
            {
                Log($"Desynthesize Item - Name: {item.Item.CurrentLocaleName}");
                var itemId = item.RawItemId;
                while (item.IsFilled && item.RawItemId == itemId)
                {
                    Log($"Call Desynth");
                    lock (Core.Memory.Executor.AssemblyLock)
                    {
                        Core.Memory.CallInjected64 <int>(agentSalvage, agentSalvageInterface.Pointer, item.Pointer, 14, 0);
                    }

                    await Coroutine.Sleep(200);

                    Log($"Wait Window");
                    await Coroutine.Wait(5000, () => SalvageDialog.IsOpen);

                    if (SalvageDialog.IsOpen)
                    {
                        Log($"Open Window");
                        RaptureAtkUnitManager.GetWindowByName("SalvageDialog").SendAction(1, 3, 0);
                        await Coroutine.Sleep(500);

                        //await Coroutine.Wait(10000, () => SalvageResult.IsOpen);
                    }

                    Log($"Wait byte 1 {Core.Memory.NoCacheRead<uint>(Offsets.Conditions + Offsets.DesynthLock)}");
                    await Coroutine.Wait(5000, () => Core.Memory.NoCacheRead <uint>(Offsets.Conditions + Offsets.DesynthLock) != 0);

                    Log($"Wait byte 0 {Core.Memory.NoCacheRead<uint>(Offsets.Conditions + Offsets.DesynthLock)}");
                    await Coroutine.Wait(6000, () => Core.Memory.NoCacheRead <uint>(Offsets.Conditions + Offsets.DesynthLock) == 0);

                    //await Coroutine.Sleep(100);

                    await Coroutine.Wait(6000, () => SalvageResult.IsOpen);

                    if (IsBusy)
                    {
                        break;
                    }
                }
                if (IsBusy)
                {
                    break;
                }
            }

            await Coroutine.Wait(10000, () => SalvageResult.IsOpen);

            if (SalvageResult.IsOpen)
            {
                SalvageResult.Close();
                await Coroutine.Wait(5000, () => !SalvageResult.IsOpen);
            }

            return(true);
        }
コード例 #12
0
ファイル: MiniGameBot.cs プロジェクト: nt153133/FFXIVMiniGame
 public GameWindowBase Refresh()
 {
     RaptureAtkUnitManager.Update();
     control = RaptureAtkUnitManager.GetWindowByName(Name);
     return(this);
 }
コード例 #13
0
ファイル: Loot.cs プロジェクト: nt153133/DeepDive-Hoh
        /// <summary>
        ///     Handles opening treasure coffers or opening an exit portal
        /// </summary>
        /// <returns></returns>
        internal async Task <bool> TreasureOrExit()
        {
            int tries = 0;

/*            if (Target.Unit.IsValid && Target.Unit.NpcId == EntityNames.BossExit)
 *          {
 *
 *          }*/

            if (Target.Location.Distance2D(Core.Me.Location) >= 3)
            {
                await CommonTasks.MoveAndStop(new MoveToParameters(Target.Location, Target.Name), 2.5f, true);

                return(true);
            }

            while (!DeepDungeonHoH.StopPlz && tries < 3 && Target.Unit.IsValid)
            {
                //if we are a frog / lust we can't open a chest
                if (Constants.AuraTransformed)
                {
                    Logger.Warn("Unable to open chest. Waiting for aura to end...");
                    await CommonTasks.StopMoving("Waiting on aura to end");

                    await Coroutine.Wait(TimeSpan.FromSeconds(30),
                                         () => !Constants.AuraTransformed || Core.Me.InCombat || DeepDungeonHoH.StopPlz);

                    return(true);
                }

                await Coroutine.Yield();

                Logger.Verbose("Attempting to interact with: {0} ({1} / 3)", Target.Name, tries + 1);

                Target.Unit.Target();
                //if (!Settings.Instance.NotLeader || (Settings.Instance.NotLeader && Target.Unit != null && (Target.Unit.NpcId == EntityNames.FloorExit || Target.Unit.NpcId == EntityNames.LobbyExit || Target.Unit.NpcId == EntityNames.BossExit)))
                if (!PartyManager.IsInParty || PartyManager.IsPartyLeader ||
                    PartyManager.IsInParty && Constants.IsExitObject(Target.Unit))
                {
                    if (Constants.IsExitObject(Target.Unit))
                    {
                        Logger.Debug("At Exit");
                        await Coroutine.Sleep(500);
                    }


                    await CommonTasks.StopMoving("Leader Interacting");

                    Target.Unit.Interact();
                }
                else
                {
                    await CommonTasks.StopMoving("Waiting for leader to use chest");
                }

                await Coroutine.Sleep(500);

                tries++;

                if (!Target.Unit.IsValid)
                {
                    break;
                }

                if (!Target.Unit.IsTargetable)
                {
                    break;
                }

                if (SelectYesno.IsOpen)
                {
                    break;
                }
            }

            await Coroutine.Wait(1000, () => SelectYesno.IsOpen);

            //if this is an exit
            if (SelectYesno.IsOpen)
            {
                SelectYesno.ClickYes();
                await Coroutine.Sleep(1000);

                Logger.Debug("Is window open : {0}", RaptureAtkUnitManager.GetWindowByName("DeepDungeonResult"));
                if (RaptureAtkUnitManager.GetWindowByName("DeepDungeonResult") != null)
                {
                    Logger.Debug("Calling Close");
                    await Coroutine.Sleep(2000);

                    RaptureAtkUnitManager.GetWindowByName("DeepDungeonResult").SendAction(1, 3, uint.MaxValue);
                }
                await Coroutine.Wait(TimeSpan.MaxValue,
                                     () => DeepDungeonHoH.StopPlz || QuestLogManager.InCutscene || NowLoading.IsVisible);

                return(true);
            }

            Blacklist.Add(Target.Unit.ObjectId, TimeSpan.FromMinutes(1),
                          $"Tried to Interact with the Target {tries} times");
            Poi.Clear($"Tried to Interact with the Target {tries} times");

            return(false);
        }
コード例 #14
0
 protected Window(string name)
 {
     Name    = name;
     control = RaptureAtkUnitManager.GetWindowByName(name);
 }
コード例 #15
0
 internal static AtkAddonControl Window()
 {
     return(RaptureAtkUnitManager.GetWindowByName(WindowNames.DDsave));
 }
コード例 #16
0
        public static async Task <bool> Desynth()
        {
            //Desynthesis
            var agentSalvageInterface = AgentInterface <AgentSalvage> .Instance;
            var agentSalvage          = Offsets.SalvageAgent;

            //if (MovementManager.IsOccupied) return false;
            //          if (!InventoryManager.GetBagsByInventoryBagId(BagsToCheck()).Any(bag => bag.FilledSlots.Any(bs => bs.IsDesynthesizable)))
            if (!InventoryManager.GetBagsByInventoryBagId(BagsToCheck()).Any(bag => bag.FilledSlots.Any(bs => ShouldDesynth(bs.Item.EnglishName))))
            {
                Log($"None found");
                return(false);
            }

/*            var itemsToDesynth = InventoryManager.GetBagsByInventoryBagId(BagsToCheck())
 *              .SelectMany(bag => bag.FilledSlots
 *                  .FindAll(bs => bs.IsDesynthesizable && (ShouldDesynth(bs.Item.EnglishName) || ExtraCheck(bs))));*/

            var itemsToDesynth = InventoryManager.GetBagsByInventoryBagId(BagsToCheck())
                                 .SelectMany(bag => bag.FilledSlots
                                             .FindAll(bs => (ShouldDesynth(bs.Item.EnglishName))));

            Log($"{itemsToDesynth.Count()}");
            foreach (var item in itemsToDesynth)
            {
                // Log($"Desynthesize Item - Name: {item.Item.CurrentLocaleName}");

                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;
                }
            }



            return(true);
        }
コード例 #17
0
        public async Task <bool> PrintMasterPieceList()
        {
            Dictionary <ClassJobType, int> Classes = new Dictionary <ClassJobType, int>
            {
                { ClassJobType.Carpenter, 0 },
                { ClassJobType.Blacksmith, 1 },
                { ClassJobType.Armorer, 2 },
                { ClassJobType.Goldsmith, 3 },
                { ClassJobType.Leatherworker, 4 },
                { ClassJobType.Weaver, 5 },
                { ClassJobType.Alchemist, 6 },
                { ClassJobType.Culinarian, 7 },
                { ClassJobType.Miner, 8 },
                { ClassJobType.Botanist, 9 },
                { ClassJobType.Fisher, 10 },
            };

            if (!MasterPieceSupply.Instance.IsOpen)
            {
                Logging.Write($"Trying to open window");

                AgentModule.ToggleAgentInterfaceById(95);
                await Coroutine.Wait(5000, () => RaptureAtkUnitManager.GetWindowByName("ContentsInfo") != null);

                await Coroutine.Sleep(500);

                if (RaptureAtkUnitManager.GetWindowByName("ContentsInfo") == null)
                {
                    Logging.Write($"Nope failed opening timer window");
                    return(false);
                }

                await Coroutine.Sleep(500);

                RaptureAtkUnitManager.GetWindowByName("ContentsInfo").SendAction(2, 3, 0xC, 3, 6);
                await Coroutine.Wait(5000, () => MasterPieceSupply.Instance.IsOpen);

                await Coroutine.Sleep(500);
            }

            if (!MasterPieceSupply.Instance.IsOpen)
            {
                Logging.Write($"Nope failed");
                return(false);
            }

            foreach (var job in Classes)
            {
                Logging.Write($"{job.Key}:");

                MasterPieceSupply.Instance.ClassSelected = job.Value;
                await Coroutine.Sleep(1000);

                //Can also use MasterPieceSupply.GetTurninItems() if you don't wanted starred info
                foreach (var item in MasterPieceSupply.Instance.GetTurninItemsStarred())
                {
                    Logging.Write($"{item.Key} Starred: {item.Value}");
                }
            }

            MasterPieceSupply.Instance.Close();

            return(true);
        }
コード例 #18
0
 private static bool CanGetName()
 {
     return(RaptureAtkUnitManager.GetWindowByName("InventoryRetainer") != null ||
            RaptureAtkUnitManager.GetWindowByName("InventoryRetainerLarge") != null || SelectString.IsOpen);
 }
コード例 #19
0
        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);
        }