Exemplo n.º 1
0
        public static async Task <bool> Desynth()
        {
            if (IsBusy)
            {
                await GeneralFunctions.StopBusy(leaveDuty : false);

                if (IsBusy)
                {
                    Log("Can't desynth right now, we're busy.");
                    return(false);
                }
            }

            List <BagSlot> toDesynthList = InventoryManager.GetBagsByInventoryBagId(BagsToCheck())
                                           .SelectMany(bag => bag.FilledSlots
                                                       .FindAll(bs => bs.IsDesynthesizable && (ShouldDesynth(bs.Item.EnglishName) || ExtraCheck(bs)))).ToList();

            //if (MovementManager.IsOccupied) return false;
            //          if (!InventoryManager.GetBagsByInventoryBagId(BagsToCheck()).Any(bag => bag.FilledSlots.Any(bs => bs.IsDesynthesizable)))


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



            if (!toDesynthList.Any())
            {
                Log("No items to desynth.");
                return(false);
            }

            Log($"# of slots to Desynth: {toDesynthList.Count()}");

            foreach (var bagSlot in toDesynthList)
            {
                await DesynthItem(bagSlot);
            }

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

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

            return(true);
        }
Exemplo n.º 2
0
        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;
        }
Exemplo n.º 3
0
        public static async Task <bool> Desynth(IEnumerable <BagSlot> itemsToDesynth)
        {
            if (IsBusy)
            {
                await GeneralFunctions.StopBusy(leaveDuty : false);

                if (IsBusy)
                {
                    Log("Can't desynth right now, we're busy.");
                    return(false);
                }
            }

            List <BagSlot> toDesynthList = itemsToDesynth.ToList();

            if (!toDesynthList.Any())
            {
                Log("No items to desynth.");
                return(false);
            }

            Log($"# of slots to Desynth: {toDesynthList.Count()}");
            foreach (var bagSlot in toDesynthList)
            {
                bagSlot.Desynth();
                await Coroutine.Wait(20000, () => Core.Memory.Read <uint>(Offsets.Conditions + Offsets.DesynthLock) != 0);

                await Coroutine.Wait(20000, () => Core.Memory.Read <uint>(Offsets.Conditions + Offsets.DesynthLock) == 0);
            }

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

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

            return(true);
        }
Exemplo n.º 4
0
        private 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)))
            {
                Log($"None found");
                return(false);
            }

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

                item.Desynth();

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

                if (SalvageResult.IsOpen)
                {
                    SalvageResult.Close();
                    await Coroutine.Wait(5000, () => !SalvageResult.IsOpen);
                }
                else
                {
                    Log("Result didn't open");
                    break;
                }
            }

            return(true);
        }
Exemplo n.º 5
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);
        }
Exemplo n.º 6
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);
        }
Exemplo n.º 7
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);
        }