Beispiel #1
0
        public async Task <bool> GetHuntBills()
        {
            var statues = HuntHelper.GetDailyStatus();

            foreach ((var orderType, var huntOrderStatus) in statues)
            {
                var orderTypeObj = HuntHelper.GetMobHuntOrderType((int)orderType);

                switch (huntOrderStatus)
                {
                case HuntOrderStatus.OnlyFatesLeft:
                    Log($"{orderTypeObj.Item.CurrentLocaleName} - Only Fates left for today's dailies so done");
                    break;

                case HuntOrderStatus.OnlyFatesLeftOld:
                    Log($"{orderTypeObj.Item.CurrentLocaleName} - Only Fates left for old dailies so should yeet them and get new ones");
                    HuntHelper.DiscardMobHuntType(orderType);
                    await HuntHelper.GetHuntsByOrderType(orderType);

                    break;

                case HuntOrderStatus.NotAccepted:
                    Log($"{orderTypeObj.Item.CurrentLocaleName} - Have not accepted today's hunts");
                    await HuntHelper.GetHuntsByOrderType(orderType);

                    break;

                case HuntOrderStatus.NotAcceptedOld:
                    Log($"{orderTypeObj.Item.CurrentLocaleName} - Not Accepted and last accepted were old and so should get new ones");
                    await HuntHelper.GetHuntsByOrderType(orderType);

                    break;

                case HuntOrderStatus.Complete:
                    Log($"{orderTypeObj.Item.CurrentLocaleName} - Finished today's dailies");
                    break;

                case HuntOrderStatus.CompleteOld:
                    Log($"{orderTypeObj.Item.CurrentLocaleName} - Finished  old dailies");
                    await HuntHelper.GetHuntsByOrderType(orderType);

                    break;

                case HuntOrderStatus.Unfinished:
                    Log($"{orderTypeObj.Item.CurrentLocaleName} - Unfinished current dailies");
                    break;

                case HuntOrderStatus.UnFinishedOld:
                    Log($"{orderTypeObj.Item.CurrentLocaleName} - Unfinished old dailies");
                    break;

                default:
                    throw new ArgumentOutOfRangeException();
                }
            }

            return(statues.Any(i => i.Item2 == HuntOrderStatus.UnFinishedOld));
        }
Beispiel #2
0
        public async Task CompleteHunts()
        {
            int[]     dailyOrderTypes = { 0, 1, 2, 3, 6, 7, 8, 10, 11, 12 };
            const int flytoHunt       = 418;

            int[] umbra = { 107, 247 };
            var   hunts = new List <DailyHuntOrder>();

            foreach (var dailyOrderType in dailyOrderTypes)
            {
                hunts.AddRange(HuntHelper.GetAcceptedDailyHunts(dailyOrderType).Where(i => !i.IsFinished));
            }

            foreach (var hunt in hunts.OrderBy(i => i.MapId).ThenBy(j => j.Location.X))
            {
                Log($"{hunt}");
                while (Core.Me.InCombat)
                {
                    var target = GameObjectManager.Attackers.FirstOrDefault(i => i.InCombat && i.IsAlive);
                    if (target != default(BattleCharacter) && target.IsValid && target.IsAlive)
                    {
                        await Navigation.GetTo(WorldManager.ZoneId, target.Location);
                        await KillMob(target);
                    }
                }

                if (WorldManager.ZoneId == 401 && hunt.MapId == 401)
                {
                    var AE = WorldManager.AetheryteIdsForZone(hunt.MapId).OrderBy(i => i.Item2.DistanceSqr(hunt.Location)).First();
                    WorldManager.TeleportById(AE.Item1);
                    await Coroutine.Wait(20000, () => WorldManager.ZoneId == AE.Item1);

                    await Coroutine.Sleep(2000);
                }

                if (WorldManager.ZoneId == 402 && hunt.MapId == 402)
                {
                    var AE = WorldManager.AetheryteIdsForZone(hunt.MapId).OrderBy(i => i.Item2.DistanceSqr(hunt.Location)).First();
                    WorldManager.TeleportById(AE.Item1);
                    await Coroutine.Wait(20000, () => WorldManager.ZoneId == AE.Item1);

                    await Coroutine.Sleep(2000);
                }

                if (hunt.HuntTarget == flytoHunt)
                {
                    var AE = WorldManager.AetheryteIdsForZone(hunt.MapId).OrderBy(i => i.Item2.DistanceSqr(hunt.Location)).First();
                    WorldManager.TeleportById(AE.Item1);
                    await Coroutine.Wait(20000, () => WorldManager.ZoneId == AE.Item1);

                    await Coroutine.Sleep(2000);

                    await Navigation.FlightorMove(new Vector3(196.902f, -163.4457f, 113.3596f));

                    //
                    Navigator.PlayerMover.MoveTowards(new Vector3(208.712f, -165.4754f, 128.228f));

                    await Coroutine.Wait(10000, () => CommonBehaviors.IsLoading);

                    Navigator.Stop();
                    await Coroutine.Sleep(1000);

                    if (CommonBehaviors.IsLoading)
                    {
                        await Coroutine.Wait(-1, () => !CommonBehaviors.IsLoading);
                    }
                    while (!hunt.IsFinished)
                    {
                        if (await FindAndKillMob(hunt.NpcID))
                        {
                            Log("Killed one");
                            await Coroutine.Sleep(1000);

                            if (!Core.Me.InCombat)
                            {
                                await Coroutine.Sleep(3000);
                            }
                        }
                        else
                        {
                            Log("None found, sleeping 10 sec.");
                            await Coroutine.Sleep(10000);
                        }
                    }
                }
                else if (umbra.Contains(hunt.HuntTarget))
                {
                    await Navigation.GetToIslesOfUmbra();

                    if (await Navigation.GetTo(hunt.MapId, hunt.Location))
                    {
                        while (!hunt.IsFinished)
                        {
                            if (await FindAndKillMob(hunt.NpcID))
                            {
                                Log("Killed one");
                                await Coroutine.Sleep(1000);

                                if (!Core.Me.InCombat)
                                {
                                    await Coroutine.Sleep(3000);
                                }
                            }
                            else
                            {
                                Log("None found, sleeping 10 sec.");
                                await Coroutine.Sleep(10000);
                            }
                        }
                    }
                }
                else if (hunt.MapId == 401)
                {
                    if (await Lisbeth.TravelToZones(401, 0, hunt.Location))
                    {
                        while (!hunt.IsFinished)
                        {
                            if (await FindAndKillMob(hunt.NpcID))
                            {
                                Log("Killed one");
                                await Coroutine.Sleep(1000);

                                if (!Core.Me.InCombat)
                                {
                                    await Coroutine.Sleep(3000);
                                }
                            }
                            else
                            {
                                Log("None found, sleeping 10 sec.");
                                await Coroutine.Sleep(10000);
                            }
                        }
                    }
                }
                else if (await Navigation.GetTo(hunt.MapId, hunt.Location))
                {
                    while (!hunt.IsFinished)
                    {
                        if (await FindAndKillMob(hunt.NpcID))
                        {
                            Log("Killed one");
                            await Coroutine.Sleep(1000);

                            if (!Core.Me.InCombat)
                            {
                                await Coroutine.Sleep(3000);
                            }
                        }
                        else
                        {
                            Log("None found, sleeping max 10 sec.");
                            await Coroutine.Wait(10000, () => FindMob(hunt.NpcID));
                        }
                    }
                }

                Log($"Done: {hunt}");
                var newPlayerItems = InventoryManager.GetBagsByInventoryBagId(PlayerInventoryBagIds).Select(i => i.FilledSlots).SelectMany(x => x).AsParallel().ToList();
                var newitems       = newPlayerItems.Except(_playerItems, new BagSlotComparer());
                Log("New loot");
                Log($"{string.Join(",", newitems)}");
                Blacklist.Clear();
                await Coroutine.Sleep(1000);
            }

            /*foreach (var orderType in dailyOrderTypes)
             * {
             *  var dailies = HuntHelper.GetAcceptedDailyHunts(orderType).OrderBy(i=> i.MapId).ThenBy(j => j.Location.X);
             *  if (dailies.Any(i => !i.IsFinished))
             *  {
             *      foreach (var hunt in dailies.Where(i => !i.IsFinished))
             *      {
             *
             *  }
             * }*/

            while (Core.Me.InCombat)
            {
                var target = GameObjectManager.Attackers.FirstOrDefault(i => i.InCombat);
                if (target != default(BattleCharacter) && target.IsValid && target.IsAlive)
                {
                    await Navigation.GetTo(WorldManager.ZoneId, target.Location);
                    await KillMob(target);
                }
            }
        }