Ejemplo n.º 1
0
        private async Task <bool> Run()
        {
            if (!GCExpertSettings.Instance.AcceptedRisk)
            {
                LogBold("**************************Attention*********************************");
                LogBold("Please go to settings");
                LogBold("This botbase will turn in any gear that's in your inventory to the GC expert delivery npc");
                LogBold("You need to set Accepted to true to show you understand the risk");
                TreeRoot.Stop("Stop Requested");
                return(true);
            }

            await GeneralFunctions.StopBusy();

            Log("Turning in current items:");

            await HandInExpert();

            if (GCExpertSettings.Instance.Craft)
            {
                Log("Crafting set to true");
                Log($"{Core.Me.MaxGCSeals()} - {GCExpertSettings.Instance.SealReward} < {Core.Me.GCSeals()}");
                while (Core.Me.GCSeals() < Core.Me.MaxGCSeals() - GCExpertSettings.Instance.SealReward)
                {
                    Log("Generating Lisbeth order");
                    var currentSeals = Core.Me.GCSeals();
                    var neededSeals  = (Core.Me.MaxGCSeals() - currentSeals) - (GCExpertSettings.Instance.SealReward * ConditionParser.ItemCount((uint)GCExpertSettings.Instance.ItemId));
                    var qty          = (int)((neededSeals) / GCExpertSettings.Instance.SealReward);
                    Log($"Need {qty}");
                    var freeSlots  = InventoryManager.FreeSlots;
                    var couldCraft = Math.Min((freeSlots - 10), qty);
                    Log($"Order Would be for {couldCraft}");

                    var outList = new List <LisbethOrder>
                    {
                        new LisbethOrder(0, 1, (int)GCExpertSettings.Instance.ItemId, (int)couldCraft, ((ClassJobType)DataManager.GetItem((uint)GCExpertSettings.Instance.ItemId).RepairClass).ToString(), true)
                    };


                    var order = JsonConvert.SerializeObject(outList, Formatting.None);

                    await GeneralFunctions.StopBusy();

                    Log($"Calling Lisbeth with {order}");
                    try
                    {
                        await Lisbeth.ExecuteOrders(order);
                    }
                    catch (Exception e)
                    {
                        Log($"{e}");
                    }
                    await GeneralFunctions.StopBusy();
                    await HandInExpert();
                }
            }

            TreeRoot.Stop("Stop Requested");
            return(true);
        }
Ejemplo n.º 2
0
        public async static Task DoResplendentCrafting()
        {
            string lisbethOrder = await GetLisbethResplendentOrder();

            if (lisbethOrder == "")
            {
                Log("Not Calling lisbeth.");
            }
            else
            {
                Log("Calling lisbeth");
                if (!await Lisbeth.ExecuteOrders(lisbethOrder))
                {
                    Log("Lisbeth order failed, Dumping order to GCSupply.json");
                    using (StreamWriter outputFile = new StreamWriter("GCSupply.json", false))
                    {
                        await outputFile.WriteAsync(lisbethOrder);
                    }
                }
                else
                {
                    Log("Lisbeth order should be done");
                }
            }
        }
Ejemplo n.º 3
0
        private async Task LisbethEquipBest()
        {
            if (_isDone)
            {
                await Coroutine.Yield();

                return;
            }
            await GeneralFunctions.StopBusy(leaveDuty : false, dismount : false);

            await Lisbeth.EquipOptimalGear();

            _isDone = true;
        }
Ejemplo n.º 4
0
 internal static async Task <bool> FlyTo(Vector3 loc)
 {
     return(await Lisbeth.TravelTo("The Diadem", loc));
 }
Ejemplo n.º 5
0
        protected override Composite CreateBehavior()
        {
            return(new PrioritySelector(
                       new Decorator(ret => ShouldStop(),
                                     new Action(r => OnDoneWhile())),
                       new Decorator(ret => DateTime.Now > saveNow + TimeSpan.FromSeconds(_timeout) && currentstep == 0,
                                     new Action(r => OnTimeout())),
                       // This one will run always kind of a pulse one
                       new Sequence(
                           new Action(r => CountDeath()),
                           new Action(r => IsFateStillActive()),
                           new Action(r => UpdateFateData()),
                           new ActionAlwaysFail() //always fail that the rest of the tree is traveresd
                           ),
                       //Start fighting Fate Mobs but only when we are in close range to the fate position.TBD enhance this filter

                       #region sync//level Sync

                       new Decorator(r => currentfate != null && FateManager.WithinFate && currentfate.MaxLevel < Core.Player.ClassLevel && !Core.Me.IsLevelSynced,
                                     new ActionRunCoroutine(async r =>
            {
                Logging.Write("Applying Level Sync.");

                ToDoList.LevelSync();

                await Coroutine.Sleep(500);

                return false;
            })
                                     ),

                       #endregion sync//level Sync

                       #region Movment

                       new Decorator(
                           ret => currentstep == 1 && Vector3.Distance(Core.Player.Location, Position) > (currentfate.Radius - 10),
                           UseFlight ? new ActionRunCoroutine(obj => Lisbeth.TravelToZones(WorldManager.ZoneId, Position)) : CommonBehaviors.MoveAndStop(ret => Position, Distance, stopInRange: true, destinationName: "Moving to Fates.")

                           ),

                       #region Handin

                       new Decorator(r => currentfate != null && FateManager.WithinFate && currentfate.Icon == FateIconType.KillHandIn && currentfate.TimeLeft.Minutes <= 8,
                                     new Sequence(
                                         new Action(r =>
            {
                Poi.Clear("Handing in items.");
                Logging.Write("Hand-in Fate");
                var npc = GameObjectManager
                          .GetObjectsOfType <BattleCharacter>()
                          .Where(
                    b => b.IsFate && !b.CanAttack && b.FateId == currentfate.Id);
                var q = from s in npc
                        group s by s into g
                        orderby g.Count() descending
                        select g.Key;
                if (q.LastOrDefault() == null)
                {
                    Logging.Write("Could not find handin NPC. Something is wrong.");
                    return;
                }
                tempProvider = CombatTargeting.Instance.Provider;
                CombatTargeting.Instance.Provider = new NullTargetingProvider();
                MoveTo(q.LastOrDefault().Location);
                GameObjectManager.GetObjectByNPCId(q.LastOrDefault().NpcId).Interact();
                Talk.Next();
                InventoryManager.GetBagByInventoryBagId(InventoryBagId.KeyItems).FilledSlots.LastOrDefault().Handover();
                Request.HandOver();
                CombatTargeting.Instance.Provider = tempProvider;
            }),
                                         new ActionAlwaysFail() //always fail that the rest of the tree is traveresd
                                         )),

                       new Decorator(ret => Talk.DialogOpen,
                                     new Action(r =>
            {
                Talk.Next();
            })),
                       new Decorator(ret => Request.IsOpen,
                                     new Action(r =>
            {
                GameObjectManager.GetObjectByNPCId(npc.NpcId).Interact();
                InventoryManager.GetBagByInventoryBagId(InventoryBagId.KeyItems).FilledSlots.LastOrDefault().Handover();
                Request.HandOver();
            })),

                       //Find fates

                       #endregion Handin

                       #endregion Movment

                       #region escort

                       new Decorator(r => currentfate != null && fateid != 0 && Poi.Current.Type != PoiType.Kill,
                                     new ActionRunCoroutine(async r => MoveToFocusedFate())

                                     ),

                       #endregion escort

                       new Decorator(ret => currentfate == null && currentstep == 0,
                                     new Sequence(
                                         new Action(r =>
            {
                getFates();
                if (currentfate != null)
                {
                    GoFate();
                }
                else
                {
                    GoHunting();
                }
            }
                                                    )
                                         )),
                       new ActionAlwaysSucceed()
                       ));
        }
Ejemplo n.º 6
0
        protected override Composite CreateBehavior()
        {
            return(new PrioritySelector(
                       CommonBehaviors.HandleLoading,
                       //GetTo
                       new Decorator(c => WorldManager.ZoneId != ZoneId || !Navigator.InPosition(Core.Me.Location, XYZ, 10), new ActionRunCoroutine(t => Lisbeth.TravelToZones((uint)ZoneId, (uint)SubZoneId, XYZ))),
                       //We have not dug yet.
                       new Decorator(r => Navigator.InPosition(Core.Me.Location, XYZ, 10) && !GameObjectManager.GameObjects.Any(i => i.Type == GameObjectType.Treasure),
                                     new ActionRunCoroutine(async s =>
            {
                ActionManager.DoAction(ActionType.General, 20, Core.Me);
                return await Coroutine.Wait(10000,
                                            () => GameObjectManager.GameObjects.Any(i => i.Type == GameObjectType.Treasure));
            })),
                       new Decorator(r => GameObjectManager.Attackers.Any() && Poi.Current.Type != PoiType.Kill, new ActionRunCoroutine(
                                         async s =>
            {
                Poi.Current = new Poi(GameObjectManager.Attackers.OrderBy(i => i.NpcId).First(), PoiType.Kill);
                return true;
            })),
                       new Decorator(s => !GameObjectManager.Attackers.Any() && GameObjectManager.GameObjects.Any(i => i.Type == GameObjectType.Treasure), new ActionRunCoroutine(
                                         async s =>
            {
                var coffer = GameObjectManager.GameObjects.First(i => i.Type == GameObjectType.Treasure);
                if (coffer.Distance2D() > 3)
                {
                    await CommonTasks.MoveTo(coffer.Location, "treasure");
                    return true;
                }

                await CommonTasks.StopAndDismount();
                coffer.Interact();
                await Coroutine.Wait(10000, () => GameObjectManager.Attackers.Any() || Core.Me.IsCasting || SelectYesno.IsOpen);
                if (SelectYesno.IsOpen)
                {
                    SelectYesno.ClickYes();
                }
                if (Core.Me.IsCasting && !GameObjectManager.Attackers.Any())
                {
                    await Coroutine.Wait(10000, () => GameObjectManager.Attackers.Any() || !Core.Me.IsCasting);
                }
                return true;
            }))
                       ));
        }
Ejemplo n.º 7
0
        public async static Task DoGCDailyTurnins()
        {
            Navigator.PlayerMover        = new SlideMover();
            Navigator.NavigationProvider = new ServiceNavigationProvider();

            var items = Core.Memory.ReadArray <GCTurninItem>(Offsets.GCTurnin, Offsets.GCTurninCount);

            /*
             * foreach (var item in items)
             * {
             *  Logging.Write(item.ItemID);
             * }*/

            if (!items.Any(i => i.CanHandin))
            {
                Log("All done.");
                return;
            }

            string lisbethOrder = await GetGCSupplyList();

            if (lisbethOrder == "")
            {
                Log("Not Calling lisbeth.");
            }
            else
            {
                //Log(lisbethOrder);
                Log("Calling lisbeth");
                if (!await Lisbeth.ExecuteOrders(lisbethOrder))
                {
                    Log("Lisbeth order failed, Dumping order to GCSupply.json");
                    using (StreamWriter outputFile = new StreamWriter("GCSupply.json", false))
                    {
                        await outputFile.WriteAsync(lisbethOrder);
                    }
                }
                else
                {
                    Log("Lisbeth order should be done");
                }
            }

            items = Core.Memory.ReadArray <GCTurninItem>(Offsets.GCTurnin, Offsets.GCTurninCount);

            if (!items.Any(i => i.CanHandin && InventoryManager.FilledSlots.Any(j => j.RawItemId == i.ItemID && !j.HasMateria() && j.Count >= i.ReqCount)))
            {
                Log("No items available to hand in");
                return;
            }

            if (!GrandCompanySupplyList.Instance.IsOpen)
            {
                await GrandCompanyHelper.InteractWithNpc(GCNpc.Personnel_Officer);

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

                if (!SelectString.IsOpen)
                {
                    Log("Window is not open...maybe it didn't get to npc?");
                    return;
                }

                SelectString.ClickSlot(0);
                await Coroutine.Wait(5000, () => GrandCompanySupplyList.Instance.IsOpen);

                if (!GrandCompanySupplyList.Instance.IsOpen)
                {
                    Log("Window is not open...maybe it didn't get to npc?");
                    return;
                }
            }

            if (GrandCompanySupplyList.Instance.IsOpen)
            {
                await GrandCompanySupplyList.Instance.SwitchToSupply();

                await HandleCurrentGCWindow();

                await GrandCompanySupplyList.Instance.SwitchToProvisioning();

                await HandleCurrentGCWindow();

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

                if (SelectString.IsOpen)
                {
                    SelectString.ClickSlot((uint)(SelectString.LineCount - 1));
                }
            }
        }
Ejemplo n.º 8
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);
                }
            }
        }
Ejemplo n.º 9
0
        protected override Composite CreateBehavior()
        {
            return(new PrioritySelector(
                       CommonBehaviors.HandleLoading,

                       //new Decorator(r => !_generatedNodes, new ActionRunCoroutine(r => GenerateNodes())),
                       //NavGraph.NavGraphConsumer(r => FinalizedPath)
                       new Decorator(r => !_generatedNodes, new ActionRunCoroutine(t => Lisbeth.TravelTo(ZoneId.ToString(), XYZ)))
                       ));
        }
Ejemplo n.º 10
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");
            }
        }