Exemplo n.º 1
0
        public override async Task OnEnter()
        {
            await base.OnEnter();

            if (playerReader.Bits.IsMounted)
            {
                await input.TapDismount();
            }

            lastDirectionForTurnAround = playerReader.Direction;

            SendActionEvent(new ActionEventArgs(GoapKey.fighting, true));
        }
        public override async Task OnEnter()
        {
            await base.OnEnter();

            if (playerReader.Bits.IsMounted)
            {
                await input.TapDismount();
            }

            playerWasInCombat = playerReader.Bits.PlayerInCombat;

            initialTargetGuid = playerReader.TargetGuid;
            initialMinRange   = playerReader.MinRange;

            approachStart = DateTime.Now;
        }
        public override async Task OnEnter()
        {
            await base.OnEnter();

            if (playerReader.Bits.IsMounted)
            {
                await input.TapDismount();
            }

            await input.TapApproachKey($"{GetType().Name}: OnEnter - Face the target and stop");

            await stopMoving.Stop();

            await wait.Update(1);

            pullStart = DateTime.Now;
        }
        public override async Task PerformAction()
        {
            if (Keys.Any(k => k.StopBeforeCast))
            {
                await stopMoving.Stop();

                await wait.Update(1);

                if (playerReader.Bits.IsMounted)
                {
                    await input.TapDismount();

                    await wait.Update(1);

                    //if (!await Wait(1000, () => playerReader.PlayerBitValues.PlayerInCombat)) return; // vanilla after dismout GCD
                }
            }

            await AsyncExt.Loop(Keys, async (KeyAction key) =>
            {
                var pressed = await castingHandler.CastIfReady(key, key.DelayBeforeCast);
                key.ResetCooldown();
                key.SetClicked();
            });

            bool wasDrinkingOrEating = playerReader.Buffs.Drinking || playerReader.Buffs.Eating;

            logger.LogInformation($"Waiting for {Name}");

            DateTime startTime = DateTime.Now;

            while ((playerReader.Buffs.Drinking || playerReader.Buffs.Eating || playerReader.IsCasting) && !playerReader.Bits.PlayerInCombat)
            {
                await wait.Update(1);

                if (playerReader.Buffs.Drinking && playerReader.Buffs.Eating)
                {
                    if (playerReader.ManaPercentage > 98 && playerReader.HealthPercent > 98)
                    {
                        break;
                    }
                }
                else if (playerReader.Buffs.Drinking)
                {
                    if (playerReader.ManaPercentage > 98)
                    {
                        break;
                    }
                }
                else if (playerReader.Buffs.Eating)
                {
                    if (playerReader.HealthPercent > 98)
                    {
                        break;
                    }
                }

                if ((DateTime.Now - startTime).TotalSeconds >= 25)
                {
                    logger.LogInformation($"Waited (25s) long enough for {Name}");
                    break;
                }
            }

            if (wasDrinkingOrEating)
            {
                await input.TapStandUpKey();
            }
        }