public async Task <bool> AulusMalAsinaHandler(BattleCharacter c)
        {
            if (c.IsCasting && (c.CastingSpellId == 8954 || c.CastingSpellId == 8270))
            {
                _mindJackPos = Core.Me.Location;

                //we can't do combat while he is casting MindJack.
                return(true);
            }

            if (Core.Me.HasAura(779))
            {
                if (_mindJackPos != Vector3.Zero)
                {
                    await CommonTasks.MoveTo(_mindJackPos);
                }
                else
                {
                    Logger.Warning("We don't know where our body is");
                    _mindJackPos = GameObjectManager.GetObjectsByNPCId(6666).OrderByDescending(i => i.Distance2D()).First().Location;
                    await CommonTasks.MoveTo(_mindJackPos);
                }
                return(true); //can't do combat here
            }

            return(false);
        }
Beispiel #2
0
        protected override async Task <bool> RunAsync()
        {
            IOrderedEnumerable <Treasure> nearbyChests = GameObjectManager.GetObjectsOfType <Treasure>()
                                                         .Where(c => !c.IsOpen && c.Distance() < MaxDistance && _chestNames.Contains(c.Name, StringComparer.OrdinalIgnoreCase))
                                                         .OrderBy(c => c.Distance());

            foreach (Treasure chest in nearbyChests)
            {
                while (Core.Me.Distance(chest.Location) > 1f)
                {
                    await CommonTasks.MoveTo(chest.Location);

                    await Coroutine.Yield();
                }

                Navigator.PlayerMover.MoveStop();

                while (!chest.IsOpen)
                {
                    chest.Interact();
                    await Coroutine.Sleep(1000);
                }
            }

            return(false);
        }
Beispiel #3
0
        /// <summary>
        ///     Made by Zzi - Borrowed from DungeonMaster
        /// </summary>
        /// <param name="obj"></param>
        /// <param name="interactRange"></param>
        /// <param name="canInteract">Return False if we should not interact with the object</param>
        /// <returns></returns>
        private static async Task <bool> ObjectInteraction(GameObject obj, float interactRange, Func <bool> canInteract)
        {
            if (!canInteract())
            {
                return(false);
            }

            if (!obj.IsValid || !obj.IsVisible)
            {
                return(false);
            }

            if (Core.Me.IsCasting)
            {
                return(true);
            }

            if (obj.Distance2D() > interactRange)
            {
                var mr = await CommonTasks.MoveTo(new MoveToParameters(obj.Location));

                if (mr == MoveResult.PathGenerationFailed && obj.InLineOfSight())
                {
                    Navigator.PlayerMover.MoveTowards(obj.Location);
                    return(true);
                }

                if (mr == MoveResult.PathGenerationFailed)
                {
                    Logger.Error($"Unable to move toward {obj.Name} [{obj.NpcId}] (It appears to be out of line of sight and off the mesh)");
                }

                return(mr.IsSuccessful());
            }

            if (MovementManager.IsMoving)
            {
                await CommonTasks.StopMoving();

                return(true);
            }

            if (Core.Target == null || Core.Target.ObjectId != obj.ObjectId)
            {
                obj.Target();
                return(true);
            }

            obj.Interact();
            await Coroutine.Sleep(500);

            return(true);
        }
Beispiel #4
0
        public static async Task <bool> Follow(this BattleCharacter bc, float followDistance = 0.3f, int msWait = 100, bool useMesh = false)
        {
            float curDistance = Core.Me.Location.Distance(bc.Location);

            if (bc == null)
            {
                return(true);
            }

            if (curDistance < followDistance)
            {
                return(true);
            }

            while (!Core.Me.IsDead)
            {
                curDistance = Core.Me.Location.Distance(bc.Location);

                if (curDistance < followDistance)
                {
                    break;
                }

                if (Core.Me.IsDead)
                {
                    return(false);
                }

                if (Core.Me.IsCasting)
                {
                    ActionManager.StopCasting();
                }
#if RB_CN
                Logging.Write(Colors.Aquamarine, $"跟随 队友 {bc.Name} [距离: {Core.Me.Distance(bc.Location)}]");
#else
                Logging.Write(Colors.Aquamarine, $"Following {bc.Name} [Distance: {curDistance}]");
#endif
                if (useMesh)
                {
                    await CommonTasks.MoveTo(bc.Location);
                }
                else
                {
                    Navigator.PlayerMover.MoveTowards(bc.Location);
                }

                await Coroutine.Sleep(msWait);
            }

            return(await StopMoving());
        }
Beispiel #5
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;
            }))
                       ));
        }
Beispiel #6
0
        public async Task <bool> TheOldOneHandler(BattleCharacter c)
        {
            if (Core.Me.HasAura(1448))
            {
                var subservientId = GameObjectManager.GetObjectByNPCId(6909);

                if (Core.Me.Location.Distance(subservientId.Location) > 3f)
                {
                    var subservientPos = GameObjectManager.GetObjectsByNPCId(6909).OrderByDescending(i => i.Distance2D()).First().Location;

                    await CommonTasks.MoveTo(subservientPos);

                    ActionManager.DoAction(9823, subservientId);
                    return(true);
                }
            }

            return(false);
        }
Beispiel #7
0
        private async Task OpenChestTask()
        {
            while (GameObjectManager.GetObjectsOfType <Treasure>().Any(r => r.Distance() < 50 && (r.Name == "宝箱" || r.Name == "Treasure Coffer" || r.Name == "treasure coffer")))
            {
                var _chest = GameObjectManager.GetObjectsOfType <Treasure>().FirstOrDefault(r => r.Distance() < 50 && (r.Name == "宝箱" || r.Name == "Treasure Coffer" || r.Name == "treasure coffer"));
                while (Core.Me.Distance(_chest.Location) > 1)
                {
                    await CommonTasks.MoveTo(_chest.Location);

                    await Coroutine.Yield();
                }

                Navigator.PlayerMover.MoveStop();
                await Coroutine.Sleep(1000);

                _chest.Interact();
                await Coroutine.Sleep(3000);
            }

            _isDone = true;
        }
        public async Task <bool> IvonCoeurlfistHandler(BattleCharacter c)
        {
            var spiritOrbId = GameObjectManager.GetObjectByNPCId(6665);

            // Require tanks/healers to ignore Spirit Orbs
            // if (!isTank && !isHealer && spiritOrbId != null && spiritOrbId.IsVisible)
            if (spiritOrbId != null && spiritOrbId.IsVisible)
            {
                if (Core.Me.Distance2D(spiritOrbId.Location) > 2f)
                {
                    var spiritOrbPos = GameObjectManager.GetObjectsByNPCId(6665).OrderByDescending(i => i.Distance2D()).First().Location;

                    await CommonTasks.MoveTo(spiritOrbPos);

                    return(true);
                }
                return(true);
            }

            return(false);
        }
Beispiel #9
0
        public static async Task <bool> Run()
        {
            // NOT TESTED

            #region Spell Filters

            HashSet <uint> Spells = new HashSet <uint>()
            {
                16333, 16334                                    //Temporary Current
                , 16337, 16335, 16336                           //Undersea Quake
                , 16338, 16339                                  //TidalWave (Preview and Execute)
                //,16328                //Drenching Pulse (Needs a way to avoid others) && Freak Wave
                //Needs Mechanic for Blue Circle with Red Squares over head to seperate
                , 16344                                         //Spinning Dive (Dive Bombs after Maelstrom)
                , 16376                                         //Surging Tsunami (Pushback Mechanic)
                //,16341				//Swirling Tsunami (Donut AOE) need way to detect if me or other player
                , 16332                                         //Killer Wave (Stacking Mechanic)
                //,16326			//Rip Current (Tank Buster to be coded later)
            };
            #endregion

            #region Custom Mechanics



            HashSet <uint> SurgingTsunami = new HashSet <uint>()
            {
                16376
            };
            if (SurgingTsunami.IsCasting() && Core.Me.CurrentHealthPercent > 0)
            {
                Logging.Write(Colors.Aquamarine, $"Dungeon Assist Eden Mechanic - Swirling Tsunami Handling - Triggered - To Center");

                Vector3 _loc = new Vector3(99, 0, 99);

                while (Core.Me.Distance(_loc) > 2f)
                {
                    await CommonTasks.MoveTo(_loc);

                    await Coroutine.Yield();
                }
                Logging.Write(Colors.Aquamarine, $"Dungeon Assist Eden Mechanic - Swirling Tsunami Handling - Sleeping");
                await Coroutine.Sleep(3000);

                if (ActionManager.IsSprintReady)
                {
                    ActionManager.Sprint();
                    await Coroutine.Wait(1000, () => !ActionManager.IsSprintReady);
                }
                Stopwatch sw = new Stopwatch();
                sw.Start();

                Logging.Write(Colors.Aquamarine, $"Dungeon Assist Eden Mechanic - Swirling Tsunami Handling - Sleeping 2");
                await Coroutine.Sleep(1000);

                await Coroutine.Yield();

                sw.Stop();

                Logging.Write(Colors.Aquamarine, $"Dungeon Assist Eden Mechanic - Swirling Tsunami Handling -  - Complete");
            }


            #endregion

            /// Default (缺省)
            if (Spells.IsCasting() && Core.Me.CurrentHealthPercent > 0)
            {
                Logging.Write(Colors.Aquamarine, $"Dungeon Assist Eden Mechanic - Generic Default Handling - Triggered");
                //Core.Me.ClearTarget();						//Clears Target

                await Coroutine.Sleep(700);

                while (Core.Me.Location.Distance2D(PartyManager.VisibleMembers.Where(x => !x.IsMe && x.BattleCharacter.IsAlive).FirstOrDefault().BattleCharacter.Location) > 1)
                {
                    if (ActionManager.IsSprintReady)
                    {
                        ActionManager.Sprint();
                        await Coroutine.Wait(1000, () => !ActionManager.IsSprintReady);
                    }
                    //if (AvoidanceManager.IsRunningOutOfAvoid)     //&& in that zone  (Mechanics file is loaded only for this zone
                    //{
                    AvoidanceManager.RemoveAllAvoids((info => true));
                    AvoidanceManager.ResetNavigation();
                    //}
                    MovementManager.SetFacing(PartyManager.VisibleMembers.Where(x => !x.IsMe && x.BattleCharacter.IsAlive).FirstOrDefault().BattleCharacter.Location);
                    Logging.Write(Colors.Aquamarine, $"Dungeon Assist Eden Mechanic - Generic Default Handling - Moving to Nearest Alive Party Character");
                    MovementManager.MoveForwardStart();
                    if (Core.Me.CurrentHealthPercent <= 0)
                    {
                        break;
                    }
                    Logging.Write(Colors.Aquamarine, $"Dungeon Assist Eden Mechanic - Generic Default Handling - Waiting");
                    await Coroutine.Sleep(100);

                    MovementManager.MoveStop();
                }
                Logging.Write(Colors.Aquamarine, $"Dungeon Assist Eden Mechanic - Generic Default Handling - Complete");
                //await Coroutine.Sleep(1000);
                await Coroutine.Yield();
            }
            return(false);
        }
Beispiel #10
0
        public static async Task <bool> Run()
        {
            // NOT TESTED

            #region Spell Filters
            /// 532, 1837, 2794, 5445, 7931, 9076, 9338, 9490,
            /// 9493, 10256, 10257, 11573, 11582, 12377, 12486,
            /// 12589, 12590, 12591, 12648, 12654, 12681, 12688,
            /// 12805, 12809, 12823, 12824, 12825, 13251, 13336,
            /// 13337, 13344, 13345, 13346, 15565, 18157                    :: Earthquake
            /// 15559, 15560                                                :: The Burning Sky
            /// 15561, 15562                                                :: The Falling Sky
            /// 15566                                                       :: Venomous Breath
            /// 15579, 15580, 15581, 15582, 15583, 15585, 16785, 16786      :: Deathly Ray
            /// 15586                                                       :: Misfortune
            /// 17996                                                       :: Starstorm
            HashSet <uint> Spells = new HashSet <uint>()
            {
                532, 1837, 2794, 5445, 7931, 9076, 9338, 9490, 9493, 10256, 10257, 11573,
                11582, 12377, 12486, 12589, 12590, 12591, 12648, 12654, 12681, 12688, 12805,
                12809, 12823, 12824, 12825, 13251, 13336, 13337, 13344, 13345, 13346, 15561,
                15559, 15560, 15562, 15565, 15566, 15579, 15580, 15581, 15582, 15583, 15585,
                15586, 16785, 16786, 18157, 17996
            };
            #endregion

            #region Custom Mechanics
            /// The First Beast (第一之兽)
            /// 15556, 15558                                 :: Meteor Rain
            HashSet <uint> MeteorRain = new HashSet <uint>()
            {
                15556, 15558
            };
            if (MeteorRain.IsCasting())
            {
                Vector3 _loc = new Vector3(-99.49644f, 748.2327f, 101.4963f);

                while (Core.Me.Distance(_loc) > 1f)
                {
                    await CommonTasks.MoveTo(_loc);

                    await Coroutine.Yield();
                }

                await Coroutine.Sleep(3000);

                if (ActionManager.IsSprintReady)
                {
                    ActionManager.Sprint();
                    await Coroutine.Wait(1000, () => !ActionManager.IsSprintReady);
                }

                Stopwatch sw = new Stopwatch();
                sw.Start();
                while (sw.ElapsedMilliseconds < 5000)
                {
                    await Helpers.GetClosestAlly.Follow();

                    await Coroutine.Yield();
                }
                sw.Stop();
            }

            /// Therion (至大灾兽)
            /// 15575, 15577                                 :: Apokalypsis
            HashSet <uint> Apokalypsis = new HashSet <uint>()
            {
                15575, 15577
            };
            if (Apokalypsis.IsCasting())
            {
                Stopwatch sw = new Stopwatch();
                sw.Start();
                while (sw.ElapsedMilliseconds < 10000)
                {
                    await Helpers.GetClosestAlly.Follow(useMesh : true);

                    await Coroutine.Yield();
                }
                sw.Stop();
            }

            /// Therion (至大灾兽)
            /// 15578                                        :: Therion Charge
            HashSet <uint> TherionCharge = new HashSet <uint>()
            {
                15578
            };
            if (TherionCharge.IsCasting())
            {
                Stopwatch sw = new Stopwatch();
                sw.Start();
                while (sw.ElapsedMilliseconds < 8000)
                {
                    await Helpers.GetClosestAlly.Follow(useMesh : true);

                    await Coroutine.Yield();
                }
                sw.Stop();
            }
            #endregion

            /// Default (缺省)
            if (Spells.IsCasting())
            {
                await Helpers.GetClosestAlly.Follow();
            }

            /// SideStep (回避)
            if (WorldManager.SubZoneId != 2996)
            {
                Helpers.BossIds.ToggleSideStep(new uint[] { 8210 });
            }
            else
            {
                Helpers.BossIds.ToggleSideStep();
            }

            return(false);
        }
Beispiel #11
0
        public static async Task <bool> Run()
        {
            #region Spell Filters
            /// Spellcast Filter (法术过滤器)                 :: Fetters             :: 脚镣
            HashSet <uint> Fetters = new HashSet <uint>()
            {
                292, 504, 510, 667, 668, 770, 800, 822, 901,
                930, 990, 1010, 1055, 1153, 1258, 1391, 1399,
                1460, 1477, 1497, 1614, 1726, 1757, 1849, 1908
            };
            bool ChainsUp = GameObjectManager.GetObjectsOfType <BattleCharacter>(true, false).Where(obj => Fetters.Any(r => obj.HasAura(r))).Count() > 0;
            /// 15602, 15609                                 :: Heretic's Fork
            /// 15814, 16850                                 :: Thumbscrew
            /// 15815, 16852                                 :: Wooden Horse
            /// 15816, 16851                                 :: Gibbet Cage
            /// 15817, 15820                                 :: Brazen Bull
            /// 15818                                        :: Executioner's Sword
            /// 15819                                        :: Light Shot
            /// 15822, 15886, 17552                          :: Heretic's Fork
            /// 15834, 15835, 15836, 15837, 15838, 15839     :: Fierce Beating
            /// 15840, 15841                                 :: Cat o' Nine Tails
            /// 15843, 16765                                 :: Sickly Inferno
            /// 15845, 17232                                 :: Into the Light
            /// 15846                                        :: Right Knout
            /// 15847                                        :: Left Knout
            /// 15848, 15849                                 :: Aethersup
            /// 16779, 16780, 16781, 16782                   :: Land Rune
            HashSet <uint> Spells = new HashSet <uint>()
            {
                15602, 15609, 15814, 15815, 15816, 15817,
                15818, 15819, 15820, 15822, 15834, 15835,
                15836, 15837, 15838, 15839, 15840, 15841,
                15843, 15845, 15846, 15847, 15848, 15849,
                15886, 16765, 16779, 16780, 16781, 16782,
                16850, 16851, 16852, 17232, 17552
            };
            #endregion

            #region Custom Mechanics
            /// Tesleen, the Forgiven (得到宽恕的泰丝琳)
            /// 15826, 15827                                 :: Exorcise            :: 傩
            HashSet <uint> Exorcise = new HashSet <uint>()
            {
                15826, 15827
            };
            if (Exorcise.IsCasting())
            {
                Vector3 _loc = new Vector3("78.77, 0, -82.18");

                if (Core.Me.Distance(_loc) > 1f && Core.Me.IsCasting)
                {
                    ActionManager.StopCasting();
                }

                while (Core.Me.Distance(_loc) > 1f)
                {
                    await CommonTasks.MoveTo(_loc);

                    await Coroutine.Yield();
                }

                Navigator.PlayerMover.MoveStop();
                await Coroutine.Sleep(6000);

                Stopwatch sw = new Stopwatch();
                sw.Start();
                while (sw.ElapsedMilliseconds < 15000)
                {
                    await Helpers.GetClosestAlly.Follow(7f);

                    await Coroutine.Yield();
                }
                sw.Stop();
            }

            /// Philia (斐利亚)
            /// 15833, 16777, 16790                          :: Pendulum            :: 钟摆
            /// 15842, 16769                                 :: Taphephobia         :: 恐惧症
            HashSet <uint> Pendulum = new HashSet <uint>()
            {
                15833, 15842, 16769, 16777, 16790
            };
            if (Pendulum.IsCasting())
            {
                Vector3 _loc = new Vector3("117.1188,23,-474.0881");

                if (Core.Me.Distance(_loc) > 1 && Core.Me.IsCasting)
                {
                    ActionManager.StopCasting();
                }

                while (Core.Me.Distance(_loc) > 1f)
                {
                    await CommonTasks.MoveTo(_loc);

                    await Coroutine.Yield();
                }

                await CommonTasks.StopMoving();

                await Coroutine.Sleep(3000);
            }
            #endregion

            /// Default (缺省)
            if (Spells.IsCasting(!ChainsUp))
            {
                await Helpers.GetClosestAlly.Follow();
            }

            /// SideStep (回避)
            Helpers.BossIds.ToggleSideStep();

            return(false);
        }
Beispiel #12
0
        public static async Task <bool> Run()
        {
            // NOT TESTED

            #region Spell Filters
            /// 532, 1837, 2794, 5445, 7931, 9076, 9338, 9490, 2441

            HashSet <uint> Spells = new HashSet <uint>()
            {
                //1st boss 100 tonze swing
                //10176 liquid capace (constant spewing attack, needs to run away)
                //2nd boss Reapders gale
                //10599. 10187 <45.62811, -26, -105.941> or Current XYZ: <50.26293, -26, -111.4103>
                11541, 10192                 //Hell of Water by Genbu
                , 10193, 10194               //Hell of Waste by Genbu
                //,10196,10197 //Sinister Tide (Arrow Mechanic)
            };
            #endregion

            #region Custom Mechanics



            HashSet <uint> HellOfWater = new HashSet <uint>()
            {
                11541, 10192
            };
            if (HellOfWater.IsCasting())
            {
                //Avoider(AvoiderType.Spell, 11541); //Sidestep should have this =\
                //Avoider(AvoiderType.Spell, 10192);

                //Vector3 _loc = new Vector3 GetRandomPointInCircle(55, -88, -461,3f);

//                while (Core.Me.Distance(_loc) > 1f)
//              {
                await CommonTasks.MoveTo(MathEx.GetRandomPointInCircle(Core.Me.Location, 3f));

                await Coroutine.Yield();

                //            }

                await Coroutine.Sleep(3000);

                if (ActionManager.IsSprintReady)
                {
                    ActionManager.Sprint();
                    await Coroutine.Wait(1000, () => !ActionManager.IsSprintReady);
                }
                Stopwatch sw = new Stopwatch();
                sw.Start();
                //Logging.Write(Colors.Aquamarine, $"Ancient Flare Handling");

                await Coroutine.Sleep(1000);

                await Coroutine.Yield();

                sw.Stop();
            }

            HashSet <uint> HellOfWaste2 = new HashSet <uint>()
            {
                10194, 10193
            };
            if (HellOfWaste2.IsCasting())
            {
                await CommonTasks.MoveTo(MathEx.GetRandomPointInCircle(Core.Me.Location, 3f));

                await Coroutine.Yield();


                await Coroutine.Sleep(3000);

                if (ActionManager.IsSprintReady)
                {
                    ActionManager.Sprint();
                    await Coroutine.Wait(1000, () => !ActionManager.IsSprintReady);
                }
                Stopwatch sw = new Stopwatch();
                sw.Start();
                //Logging.Write(Colors.Aquamarine, $"Ancient Flare Handling");

                await Coroutine.Sleep(1000);

                await Coroutine.Yield();

                sw.Stop();
            }


            #endregion

            /// Default (缺省)
            if (Spells.IsCasting())
            {
                Core.Me.ClearTarget();                                          //Logging.Write(Colors.Aquamarine, $"Default Spell Handling");
                while (Core.Me.Location.Distance2D(PartyManager.VisibleMembers.Where(x => !x.IsMe && x.BattleCharacter.IsAlive).FirstOrDefault().BattleCharacter.Location) > 0.5)
                {
                    MovementManager.SetFacing(PartyManager.VisibleMembers.Where(x => !x.IsMe && x.BattleCharacter.IsAlive).FirstOrDefault().BattleCharacter.Location);
                    MovementManager.MoveForwardStart();
                    await Coroutine.Sleep(100);

                    MovementManager.MoveStop();
                }
                //await Coroutine.Sleep(1000);
                await Coroutine.Yield();;
            }

            /// SideStep (回避)
            //if (WorldManager.SubZoneId != 2996) { Helpers.BossIds.ToggleSideStep(new uint[] { 8210 }); } else { Helpers.BossIds.ToggleSideStep(); }

            return(false);
        }