Exemple #1
0
        public async Task <bool> GetHuntOrderType(uint orderType)
        {
            if (GetNpc == null || !GetNpc.IsWithinInteractRange)
            {
                //Navigation.LogCritical("GoTo");
                await GetTo();
            }

            uint slot = 0;

            for (int i = 0; i < OrderTypes.Length; i++)
            {
                if (OrderTypes[i] != orderType)
                {
                    continue;
                }

                slot = (uint)i;
                break;
            }

            if (GetNpc == null || !GetNpc.IsWithinInteractRange)
            {
                return(false);
            }

            var unit = GetNpc;

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

            if (!SelectString.IsOpen)
            {
                return(false);
            }
            SelectString.ClickSlot(slot);
            await Coroutine.Wait(5000, () => Mobhunt.Instance.IsOpen);

            Navigation.LogCritical($"is open {Mobhunt.Instance.IsOpen}");
            Mobhunt.Instance.Accept();
            Navigation.LogCritical($"accepted");
            await Coroutine.Sleep(1000);

            return(HuntHelper.GetAcceptedHunts()[orderType]);
        }
Exemple #2
0
        public static List <(uint, HuntOrderStatus)> GetDailyStatus()
        {
            int[] dailyOrderTypes = new[] { 0, 1, 2, 3, 6, 7, 8, 10, 11, 12 };
            var   result          = new List <(uint, HuntOrderStatus)>();

            foreach (var orderType in dailyOrderTypes.Where((HuntHelper.OrderTypeUnlocked)))
            {
                bool accepted      = HuntHelper.GetAcceptedHunts()[orderType];
                var  orderTypeObj  = HuntHelper.GetMobHuntOrderType(orderType);
                var  dailies       = HuntHelper.GetCurrentDailyHunts(orderType);
                var  serverDailies = HuntHelper.GetServerDailyHunts(orderType);

                var oldDailies = dailies.Where((t, i) => t.NpcID != serverDailies[i].NpcID).Any();

                if (!accepted && dailies.Count == 0)
                {
                    result.Add(((uint, HuntOrderStatus))(orderType, HuntOrderStatus.NotAccepted));
                    continue;
                }


                //LogCritical($"oldDilies = {oldDailies} count server {serverDailies.Count}");

                if ((accepted && dailies.All(i => i.IsFinished)) || !accepted)
                {
                    if (accepted && dailies.All(i => i.IsFinished) && !oldDailies)
                    {
                        // Log($"{orderTypeObj.Item.CurrentLocaleName} - Only Fates left for today's dailies so done");
                        result.Add(((uint, HuntOrderStatus))(orderType, HuntOrderStatus.OnlyFatesLeft));
                    }
                    else if (accepted && dailies.All(i => i.IsFinished))
                    {
                        // Log($"{orderTypeObj.Item.CurrentLocaleName} - Only Fates left for old dailies so should yeet and get new ones");
                        result.Add(((uint, HuntOrderStatus))(orderType, HuntOrderStatus.OnlyFatesLeftOld));
                    }
                    else if (!accepted && dailies.All(i => i.IsFinished && i.CurrentKills > 0) && oldDailies)
                    {
                        // Log($"{orderTypeObj.Item.CurrentLocaleName} - Not Accepted and last accepted were old and we so should get new ones?");
                        result.Add(((uint, HuntOrderStatus))(orderType, HuntOrderStatus.NotAcceptedOld));
                    }
                    else if (!accepted && dailies.All(i => i.IsFinished && i.CurrentKills > 0) && !oldDailies)
                    {
                        //Log($"{orderTypeObj.Item.CurrentLocaleName} - Finished today's dailies");
                        result.Add(((uint, HuntOrderStatus))(orderType, HuntOrderStatus.Complete));
                    }
                    else
                    {
                        //Log($"{orderTypeObj.Item.CurrentLocaleName} - {dailies.All(i => i.IsFinished && i.CurrentKills > 0)} {dailies.All(i => i.IsFinished)} {oldDailies} Have not accepted today's hunts");
                        result.Add(((uint, HuntOrderStatus))(orderType, HuntOrderStatus.NotAccepted));
                    }

                    continue;
                }

                if (dailies.Any(i => !i.IsFinished) && oldDailies)
                {
                    // Log($"{orderTypeObj.Item.CurrentLocaleName} - Unfinished old dailies");
                    result.Add(((uint, HuntOrderStatus))(orderType, HuntOrderStatus.UnFinishedOld));
                }
                else if (dailies.Any(i => !i.IsFinished) && !oldDailies)
                {
                    // Log($"{orderTypeObj.Item.CurrentLocaleName} - Unfinished current dailies");
                    result.Add(((uint, HuntOrderStatus))(orderType, HuntOrderStatus.Unfinished));
                }
                else
                {
                    //  Log($"All possible {orderTypeObj.Item.CurrentLocaleName} dailies done {dailies.Count()}");
                    result.Add(((uint, HuntOrderStatus))(orderType, HuntOrderStatus.Complete));
                }
            }

            return(result);
        }