示例#1
0
        public async Task <bool> Run()
        {
            //we are inside POTD
            if (Constants.InDeepDungeon || Constants.InExitLevel)
            {
                return(false);
            }

            if (WorldManager.ZoneId != Constants.EntranceZoneId ||
                GameObjectManager.GetObjectByNPCId(Constants.EntranceNpcId) == null ||
                GameObjectManager.GetObjectByNPCId(Constants.EntranceNpcId).Distance2D(Core.Me.Location) > 110)
            {
                if (Core.Me.IsCasting)
                {
                    await Coroutine.Sleep(1000);

                    return(true);
                }

                if (!ConditionParser.HasAetheryte(Constants.EntranceZone.Id))
                {
                    Logger.Error($"We can't get to {Constants.EntranceZone.CurrentLocaleAethernetName}. You don't have that Aetheryte so do something about it...");
                    TreeRoot.Stop();
                    return(false);
                }

                if (!WorldManager.TeleportById(Constants.EntranceZone.Id))
                {
                    Logger.Error($"We can't get to {Constants.EntranceZone.CurrentLocaleAethernetName}. something is very wrong...");
                    TreeRoot.Stop();
                    return(false);
                }

                await Coroutine.Sleep(5000);

                return(true);
            }

            if (GameObjectManager.GetObjectByNPCId(Constants.EntranceNpcId) != null &&
                !(Constants.EntranceNpcPosition.Distance2D(Core.Me.Location) > 5f))
            {
                return(false);
            }
            Logger.Verbose("at Move");

            if (GameObjectManager.GetObjectByNPCId(Constants.EntranceNpcId) != null)
            {
                return(await CommonTasks.MoveAndStop(
                           new MoveToParameters(GameObjectManager.GetObjectByNPCId(Constants.EntranceNpcId).Location,
                                                "Moving toward NPC"), 5f, true));
            }

            return(await CommonTasks.MoveAndStop(
                       new MoveToParameters(Constants.EntranceNpcPosition, "Moving toward NPC"), 5f, true));
        }
示例#2
0
        private async Task <bool> Run()
        {
            Navigator.PlayerMover        = new SlideMover();
            Navigator.NavigationProvider = new ServiceNavigationProvider();

            var output = new List <string>();

            if (ConditionParser.HasAetheryte(2))
            {
                output.AddRange(await GetLavenderPlots());
            }

            if (ConditionParser.HasAetheryte(9))
            {
                output.AddRange(await GetGobletPlots());
            }

            if (ConditionParser.HasAetheryte(111))
            {
                output.AddRange(await GetShiroganePlots());
            }

            if (ConditionParser.HasAetheryte(8))
            {
                output.AddRange(await GetMistsPlots());
            }

            if (!output.Any())
            {
                Log1($"No Housing Plots For Sale");
            }

            foreach (var line in output)
            {
                if (line.Contains("Small"))
                {
                    Log($"{line}");
                }
                else if (line.Contains("Medium"))
                {
                    Log1($"{line}");
                }
                else if (line.Contains("Large"))
                {
                    Log1($"{line}");
                }
                else
                {
                    Log($"{line}");
                }
            }

            TreeRoot.Stop("Stop Requested");
            return(true);
        }
示例#3
0
        public static async Task CheckHousing()
        {
            Navigator.PlayerMover        = new SlideMover();
            Navigator.NavigationProvider = new ServiceNavigationProvider();

            var  output      = new List <string>();
            bool medium      = false;
            bool large       = false;
            var  outputMed   = new List <string>();
            var  outputLarge = new List <string>();

            if (ConditionParser.HasAetheryte(2))
            {
                output.AddRange(await GetLavenderPlots());
            }

            foreach (var line in output)
            {
                if (line.Contains("Medium"))
                {
                    medium = true;
                    outputMed.Add(line);
                }
                else if (line.Contains("Large"))
                {
                    large = true;
                    outputLarge.Add(line);
                }
            }

            if (large)
            {
                string message = string.Join("\n", outputLarge);
                string title   = "Large";
                MessageBox.Show(message, title);
            }

            if (ConditionParser.HasAetheryte(8))
            {
                output.AddRange(await GetMistsPlots());
            }

            foreach (var line in output)
            {
                if (line.Contains("Medium"))
                {
                    medium = true;
                    outputMed.Add(line);
                }
                else if (line.Contains("Large"))
                {
                    large = true;
                    outputLarge.Add(line);
                }
            }


            if (large)
            {
                string message = string.Join("\n", outputLarge);
                string title   = "Large";
                MessageBox.Show(message, title);
            }

            if (ConditionParser.HasAetheryte(9))
            {
                output.AddRange(await GetGobletPlots());
            }

            foreach (var line in output)
            {
                if (line.Contains("Medium"))
                {
                    medium = true;
                    outputMed.Add(line);
                }
                else if (line.Contains("Large"))
                {
                    large = true;
                    outputLarge.Add(line);
                }
            }


            if (large)
            {
                string message = string.Join("\n", outputLarge);
                string title   = "Large";
                MessageBox.Show(message, title);
            }

            if (ConditionParser.HasAetheryte(111))
            {
                output.AddRange(await GetShiroganePlots());
            }

            if (!output.Any())
            {
                Log1($"No Housing Plots For Sale");
            }

            foreach (var line in output)
            {
                if (line.Contains("Small"))
                {
                    Log($"{line}");
                }
                else if (line.Contains("Medium"))
                {
                    Log1($"{line}");
                    medium = true;
                    outputMed.Add(line);
                }
                else if (line.Contains("Large"))
                {
                    Log1($"{line}");
                    large = true;
                    outputLarge.Add(line);
                }
                else
                {
                    Log($"{line}");
                }
            }

            if (medium)
            {
                string message = string.Join("\n", outputMed);
                string title   = "Medium";
                MessageBox.Show(message, title);
            }

            if (large)
            {
                string message = string.Join("\n", outputLarge);
                string title   = "Large";
                MessageBox.Show(message, title);
            }
        }
示例#4
0
        private static async Task GetToResidential(uint aetheryteId)
        {
            if (!ConditionParser.HasAetheryte(aetheryteId))
            {
                return;
            }

            if (!WorldManager.TeleportById(aetheryteId))
            {
                return;
            }

            do
            {
                await Coroutine.Sleep(2000);
            } while (Core.Me.IsCasting);
            await Coroutine.Sleep(2000);

            if (CommonBehaviors.IsLoading)
            {
                await Coroutine.Wait(-1, () => !CommonBehaviors.IsLoading);
            }

            await Coroutine.Wait(10000, () => GameObjectManager.GetObjectByNPCId(aetheryteId) != null);

            await Coroutine.Sleep(2000);

            var unit = GameObjectManager.GetObjectByNPCId(aetheryteId);

            if (!unit.IsWithinInteractRange)
            {
                Log($"Not in range {unit.Distance2D()}");
                var target = unit.Location;
                if (WorldManager.RawZoneId == 129)
                {
                    target = new Vector3(-89.30112f, 18.80033f, -2.019181f);
                }
                else if (WorldManager.RawZoneId == 628)
                {
                    target = new Vector3(48.03579f, 4.549999f, -31.83851f);
                }
                //await CommonTasks.MoveAndStop(new MoveToParameters(target.FanOutRandom(2f), unit.Name), 2f, true);
                await Navigation.GetTo(WorldManager.ZoneId, target);

/*                Navigator.PlayerMover.MoveTowards(target);
 *              while (!unit.IsWithinInteractRange)
 *              {
 *                  Navigator.PlayerMover.MoveTowards(target);
 *                  await Coroutine.Sleep(100);
 *              }
 *
 *              Navigator.PlayerMover.MoveStop();*/
            }
            else
            {
                Log($"In range {unit.Distance2D()}");
            }

            unit.Target();
            unit.Interact();

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

            if (SelectString.IsOpen)
            {
                if (Translator.Language == Language.Chn)
                {
                    SelectString.ClickLineContains("冒险者住宅区传送");
                }
                else
                {
                    SelectString.ClickLineContains("Residential");
                }
            }

            await Coroutine.Sleep(500);

            await Coroutine.Wait(5000, () => SelectString.IsOpen);
        }
示例#5
0
        public async Task <bool> GetToGatherNpc()
        {
            if (WorldManager.ZoneId != ZoneId && WorldManager.ZoneId != 886)
            {
                while (Core.Me.IsCasting)
                {
                    await Coroutine.Sleep(1000);
                }

                if (!ConditionParser.HasAetheryte(AetheryteId))
                {
                    //Logger.Error($"We can't get to {Constants.EntranceZone.CurrentLocaleAethernetName}. You don't have that Aetheryte so do something about it...");
                    //TreeRoot.Stop();
                    return(false);
                }

                if (!WorldManager.TeleportById(AetheryteId))
                {
                    //Logger.Error($"We can't get to {Constants.EntranceZone.CurrentLocaleAethernetName}. something is very wrong...");
                    //TreeRoot.Stop();
                    return(false);
                }

                while (Core.Me.IsCasting)
                {
                    await Coroutine.Sleep(1000);
                }

                if (CommonBehaviors.IsLoading)
                {
                    await Coroutine.Wait(-1, () => !CommonBehaviors.IsLoading);
                }

                await Coroutine.Wait(10000, () => WorldManager.ZoneId == FoundationZoneId);

                await Coroutine.Sleep(3000);

                await Coroutine.Wait(10000, () => GameObjectManager.GetObjectByNPCId(70) != null);

                await Coroutine.Sleep(3000);

                var unit = GameObjectManager.GetObjectByNPCId(70);

                if (!unit.IsWithinInteractRange)
                {
                    var _target = unit.Location;
                    Navigator.PlayerMover.MoveTowards(_target);
                    while (!unit.IsWithinInteractRange)
                    {
                        Navigator.PlayerMover.MoveTowards(_target);
                        await Coroutine.Sleep(100);
                    }

                    Navigator.PlayerMover.MoveStop();
                }

                unit.Target();
                unit.Interact();
                await Coroutine.Sleep(1000);

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

                await Coroutine.Sleep(500);

                if (SelectString.IsOpen)
                {
                    SelectString.ClickSlot(1);
                }

                await Coroutine.Sleep(5000);

                if (CommonBehaviors.IsLoading)
                {
                    await Coroutine.Wait(-1, () => !CommonBehaviors.IsLoading);
                }

                await Coroutine.Sleep(3000);
            }

            //await CommonTasks.MoveTo(Npc.Location, "Moving To HandinVendor");


            if (GatherNpc.Location.Distance(Core.Me.Location) > 5f)
            {
                var _target = new Vector3(-21.62485f, -16f, 141.3661f);
                Navigator.PlayerMover.MoveTowards(_target);
                while (_target.Distance2D(Core.Me.Location) >= 4)
                {
                    Navigator.PlayerMover.MoveTowards(_target);
                    await Coroutine.Sleep(100);
                }

                Navigator.PlayerMover.MoveStop();

                _target = GatherNpc.Location;
                Navigator.PlayerMover.MoveTowards(_target);
                while (_target.Distance2D(Core.Me.Location) >= 4)
                {
                    Navigator.PlayerMover.MoveTowards(_target);
                    await Coroutine.Sleep(100);
                }

                Navigator.PlayerMover.MoveStop();
            }

            return(Npc.Location.Distance(Core.Me.Location) <= 5f);
        }
示例#6
0
        public async Task <bool> GetToVendorNpc()
        {
            if (WorldManager.ZoneId != ZoneId && WorldManager.ZoneId != 886)
            {
                while (Core.Me.IsCasting)
                {
                    await Coroutine.Sleep(1000);
                }

                if (!ConditionParser.HasAetheryte(AetheryteId))
                {
                    Logger.LogCritical("We can't get to Foundation. You don't have that Aetheryte so do something about it...");
                    TreeRoot.Stop();
                    return(false);
                }

                if (!WorldManager.TeleportById(AetheryteId))
                {
                    Logger.LogCritical($"We can't get to {AetheryteId}. something is very wrong...");
                    TreeRoot.Stop();
                    return(false);
                }

                while (Core.Me.IsCasting)
                {
                    await Coroutine.Sleep(1000);
                }

                if (CommonBehaviors.IsLoading)
                {
                    await Coroutine.Wait(-1, () => !CommonBehaviors.IsLoading);
                }

                await Coroutine.Wait(10000, () => WorldManager.ZoneId == FoundationZoneId);

                await Coroutine.Sleep(3000);

                await Coroutine.Wait(10000, () => GameObjectManager.GetObjectByNPCId(70) != null);

                await Coroutine.Sleep(3000);

                var unit = GameObjectManager.GetObjectByNPCId(70);

                if (!unit.IsWithinInteractRange)
                {
                    var _target = unit.Location;
                    Navigator.PlayerMover.MoveTowards(_target);
                    while (!unit.IsWithinInteractRange)
                    {
                        Navigator.PlayerMover.MoveTowards(_target);
                        await Coroutine.Sleep(100);
                    }

                    Navigator.PlayerMover.MoveStop();
                }

                unit.Target();
                unit.Interact();
                await Coroutine.Sleep(1000);

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

                await Coroutine.Sleep(500);

                if (SelectString.IsOpen)
                {
                    SelectString.ClickSlot(1);
                }

                await Coroutine.Sleep(5000);

                if (CommonBehaviors.IsLoading)
                {
                    await Coroutine.Wait(-1, () => !CommonBehaviors.IsLoading);
                }

                await Coroutine.Sleep(3000);
            }

            if (!(VendorNpc.Location.Distance(Core.Me.Location) > 5f))
            {
                return(Npc.Location.Distance(Core.Me.Location) <= 5f);
            }

            var target = new Vector3(10.58188f, -15.96282f, 163.8702f);

            Navigator.PlayerMover.MoveTowards(target);
            while (target.Distance2D(Core.Me.Location) >= 4)
            {
                Navigator.PlayerMover.MoveTowards(target);
                await Coroutine.Sleep(100);
            }

            Navigator.PlayerMover.MoveStop();


            target = VendorNpc.Location;
            Navigator.PlayerMover.MoveTowards(target);
            while (target.Distance2D(Core.Me.Location) >= 4)
            {
                Navigator.PlayerMover.MoveTowards(target);
                await Coroutine.Sleep(100);
            }

            //await CommonTasks.MoveTo(VendorNpc.Location, "Moving To HandinVendor");

            // await CommonTasks.MoveAndStop(
            //      new MoveToParameters(VendorNpc.Location, "Moving To HandinVendor"), 2f);

            Navigator.PlayerMover.MoveStop();

            return(Npc.Location.Distance(Core.Me.Location) <= 5f);
        }
示例#7
0
        public async Task <bool> GetToNpc()
        {
            if (WorldManager.ZoneId != ZoneId && WorldManager.ZoneId != 886)
            {
                while (Core.Me.IsCasting)
                {
                    await Coroutine.Sleep(1000);
                }

                if (!ConditionParser.HasAetheryte(AetheryteId))
                {
                    //Logger.Error($"We can't get to {Constants.EntranceZone.CurrentLocaleAethernetName}. You don't have that Aetheryte so do something about it...");
                    //TreeRoot.Stop();
                    return(false);
                }

                if (!WorldManager.TeleportById(AetheryteId))
                {
                    //Logger.Error($"We can't get to {Constants.EntranceZone.CurrentLocaleAethernetName}. something is very wrong...");
                    //TreeRoot.Stop();
                    return(false);
                }

                while (Core.Me.IsCasting)
                {
                    await Coroutine.Sleep(1000);
                }

                if (CommonBehaviors.IsLoading)
                {
                    await Coroutine.Wait(-1, () => !CommonBehaviors.IsLoading);
                }

                await Coroutine.Wait(10000, () => WorldManager.ZoneId == FoundationZoneId);

                await Coroutine.Sleep(3000);


                await Coroutine.Sleep(3000);

                var unit = GameObjectManager.GetObjectByNPCId(70);
                unit.Interact();
                await Coroutine.Sleep(1000);

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

                await Coroutine.Sleep(500);

                if (SelectString.IsOpen)
                {
                    SelectString.ClickSlot(1);
                }

                await Coroutine.Sleep(5000);

                if (CommonBehaviors.IsLoading)
                {
                    await Coroutine.Wait(-1, () => !CommonBehaviors.IsLoading);
                }

                await Coroutine.Sleep(3000);
            }


/*            if (GameObjectManager.GetObjectByNPCId(NpcId) != null)
 *              await CommonTasks.MoveAndStop(
 *                  new MoveToParameters(GameObjectManager.GetObjectByNPCId(NpcId).Location,
 *                      "Moving toward NPC"), 5f, true);*/

            if (GameObjectManager.GetObjectByNPCId(NpcId).Location.Distance(Core.Me.Location) > 5f)
            {
                var _target = new Vector3(10.58188f, -15.96282f, 163.8702f);
                Navigator.PlayerMover.MoveTowards(_target);
                while (_target.Distance2D(Core.Me.Location) >= 4)
                {
                    Navigator.PlayerMover.MoveTowards(_target);
                    await Coroutine.Sleep(100);
                }

                //await Buddy.Coroutines.Coroutine.Sleep(1500); // (again, probably better to just wait until distance to destination is < 2.0f or something)
                Navigator.PlayerMover.MoveStop();

                _target = GameObjectManager.GetObjectByNPCId(NpcId).Location;
                Navigator.PlayerMover.MoveTowards(_target);
                while (_target.Distance2D(Core.Me.Location) >= 4)
                {
                    Navigator.PlayerMover.MoveTowards(_target);
                    await Coroutine.Sleep(100);
                }

                //await Buddy.Coroutines.Coroutine.Sleep(1500); // (again, probably better to just wait until distance to destination is < 2.0f or something)
                Navigator.PlayerMover.MoveStop();
            }

            return(GameObjectManager.GetObjectByNPCId(NpcId).Location.Distance(Core.Me.Location) <= 5f);
        }