Пример #1
0
        public async Task <bool> RetainerCheck(RetainerInfo retainer)
        {
            if (RetainerSettings.Instance.ReassignVentures && retainer.Active && retainer.Job != ClassJobType.Adventurer)
            {
                if (retainer.VentureTask != 0)
                {
                    var now      = (int)DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalSeconds;
                    var timeLeft = retainer.VentureEndTimestamp - now;

                    if (timeLeft <= 0 && SpecialCurrencyManager.GetCurrencyCount(SpecialCurrency.Venture) > 2)
                    {
                        await RetainerHandleVentures();
                    }
                    else
                    {
                        Log($"Venture will be done at {RetainerInfo.UnixTimeStampToDateTime(retainer.VentureEndTimestamp)}");
                    }
                }
            }

            if (RetainerSettings.Instance.DepositFromPlayer)
            {
                await RetainerRoutine.DumpItems();
            }

            if (RetainerSettings.Instance.GetGil)
            {
                GetRetainerGil();
            }

            return(true);
        }
Пример #2
0
        private static uint CanAffordScrip(SpecialShopItem item)
        {
            var scrips = SpecialCurrencyManager.GetCurrencyCount((SpecialCurrency)28063);

            if (scrips == 0)
            {
                return(0u);
            }
            return(scrips / item.CurrencyCosts[0]);
        }
Пример #3
0
        public static async Task <bool> RetainerCheckOnlyVenture(RetainerInfo retainer)
        {
            if (retainer.VentureTask != 0)
            {
                var now      = (int)DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalSeconds;
                var timeLeft = retainer.VentureEndTimestamp - now;

                if (timeLeft <= 0 && SpecialCurrencyManager.GetCurrencyCount(SpecialCurrency.Venture) > 2)
                {
                    await RetainerHandleVentures();
                }
                else
                {
                    Log($"Venture will be done at {RetainerInfo.UnixTimeStampToDateTime(retainer.VentureEndTimestamp)}");
                }
            }

            return(true);
        }
Пример #4
0
        public async Task RetainerRun()
        {
            var bell = await GoToSummoningBell();

            if (bell == false)
            {
                LogCritical("No summoning bell near by");
                TreeRoot.Stop("Done playing with retainers");
                return;
            }

            await RetainerRoutine.ReadRetainers(RetainerCheck);

            await Coroutine.Sleep(1000);

            if (!RetainerSettings.Instance.Loop || !RetainerSettings.Instance.ReassignVentures)
            {
                LogCritical($"Loop Setting {RetainerSettings.Instance.Loop} ReassignVentures {RetainerSettings.Instance.ReassignVentures}");
                TreeRoot.Stop("Done playing with retainers");
            }

            if (RetainerSettings.Instance.Loop && InventoryManager.FreeSlots < 2)
            {
                LogCritical($"I am overburdened....free up some space you hoarder");
                TreeRoot.Stop("Done playing with retainers");
            }

            var count = await GetNumberOfRetainers();

            var rets = Core.Memory.ReadArray <RetainerInfo>(Offsets.RetainerData, count);

            if (!rets.Any(i => i.VentureTask != 0 && i.Active))
            {
                LogCritical($"No ventures assigned or completed");
                TreeRoot.Stop("Done playing with retainers");
            }

            var nextVenture = rets.Where(i => i.VentureTask != 0 && i.Active).OrderBy(i => i.VentureEndTimestamp).First();

            if (nextVenture.VentureEndTimestamp == 0)
            {
                LogCritical($"No ventures running");
                TreeRoot.Stop("Done playing with retainers");
            }

            if (SpecialCurrencyManager.GetCurrencyCount(SpecialCurrency.Venture) <= 2)
            {
                LogCritical($"Get more venture tokens...bum");
                TreeRoot.Stop("Done playing with retainers");
            }

            var now      = (int)DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalSeconds;
            var timeLeft = nextVenture.VentureEndTimestamp - now;

            Log($"Waiting till {RetainerInfo.UnixTimeStampToDateTime(nextVenture.VentureEndTimestamp)}");
            await Coroutine.Sleep(timeLeft * 1000);

            await Coroutine.Sleep(30000);

            Log($"{nextVenture.Name} Venture should be done");
        }
Пример #5
0
        public static async Task CheckVentureTask()
        {
            var verified = await VerifiedRetainerData();

            if (!verified)
            {
                return;
            }

            var count = await HelperFunctions.GetNumberOfRetainers();

            var rets = Core.Memory.ReadArray <RetainerInfo>(Offsets.RetainerData, count);
            var now  = (int)DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalSeconds;

            if (rets.Any(i => i.Active && i.VentureTask != 0 && (i.VentureEndTimestamp - now) <= 0 && SpecialCurrencyManager.GetCurrencyCount(SpecialCurrency.Venture) > 2))
            {
                await GeneralFunctions.StopBusy(dismount : false);

                if (DutyManager.InInstance || CraftingLog.IsOpen || FishingManager.State != FishingState.None || MovementManager.IsOccupied || CraftingManager.IsCrafting)
                {
                    Log("Something went wrong");
                    return;
                }

                var bell = await GoToSummoningBell();

                if (bell == false)
                {
                    LogCritical("No summoning bell near by");
                    return;
                }
                await RetainerRoutine.ReadRetainers(RetainerCheckOnlyVenture);
            }
            else
            {
                Log("No Ventures Complete");
            }
        }
Пример #6
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);
        }
Пример #7
0
 public static int GetSkybuilderScrips()
 {
     return((int)SpecialCurrencyManager.GetCurrencyCount((SpecialCurrency)28063));
 }
Пример #8
0
        public static async Task CheckVentureTask()
        {
            var verified = await VerifiedRetainerData();

            if (!verified)
            {
                return;
            }

            var count = await HelperFunctions.GetNumberOfRetainers();

            var rets = Core.Memory.ReadArray <RetainerInfo>(Offsets.RetainerData, count);
            var now  = (int)DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalSeconds;

            if (rets.Any(i => i.Active && i.VentureTask != 0 && (i.VentureEndTimestamp - now) <= 0 && SpecialCurrencyManager.GetCurrencyCount(SpecialCurrency.Venture) > 2))
            {
                if (FishingManager.State != FishingState.None)
                {
                    var quit = ActionManager.CurrentActions.Values.FirstOrDefault(i => i.Id == 299);
                    if (quit != default(SpellData))
                    {
                        Log($"Exiting Fishing");
                        if (ActionManager.CanCast(quit, Core.Me))
                        {
                            ActionManager.DoAction(quit, Core.Me);
                            await Coroutine.Wait(6000, () => FishingManager.State == FishingState.None);
                        }
                    }
                }

                if (CraftingLog.IsOpen)
                {
                    Log($"Closing Crafting Window");
                    await Lisbeth.ExitCrafting();

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

                    await Coroutine.Wait(6000, () => !CraftingManager.IsCrafting && !MovementManager.IsOccupied);
                }

                if (DutyManager.InInstance)
                {
                    Log($"Leaving Diadem");
                    DutyManager.LeaveActiveDuty();

                    if (await Coroutine.Wait(30000, () => CommonBehaviors.IsLoading))
                    {
                        await Coroutine.Yield();

                        await Coroutine.Wait(Timeout.Infinite, () => !CommonBehaviors.IsLoading);

                        await Coroutine.Sleep(5000);
                    }
                }

                if (DutyManager.InInstance || CraftingLog.IsOpen || FishingManager.State != FishingState.None || MovementManager.IsOccupied || CraftingManager.IsCrafting)
                {
                    Log("Something went wrong");
                    return;
                }

                var bell = await GoToSummoningBell();

                if (bell == false)
                {
                    LogCritical("No summoning bell near by");
                    return;
                }
                await RetainerRoutine.ReadRetainers(RetainerCheckOnlyVenture);
            }
            else
            {
                Log("No Ventures Complete");
            }
        }