public override async Task PerformAction() { if (playerReader.PlayerBitValues.IsMounted) { await input.Dismount(); } /* * if (HasPickedUpAnAdd) * { * logger.LogInformation($"Combat={this.playerReader.PlayerBitValues.PlayerInCombat}, Is Target targetting me={this.playerReader.PlayerBitValues.TargetOfTargetIsPlayerOrPet}"); * logger.LogInformation($"Add on combat"); * await this.stopMoving.Stop(); * await wowProcess.TapStopKey(); * await wowProcess.TapClearTarget(); * return; * } */ if ((DateTime.Now - lastActive).TotalSeconds > 5 && (DateTime.Now - lastPulled).TotalSeconds > 5) { logger.LogInformation("Interact and stop"); await input.TapInteractKey("CombatActionBase PerformAction"); //await this.castingHandler.PressKey(ConsoleKey.UpArrow, "", 57); } await stopMoving.Stop(); SendActionEvent(new ActionEventArgs(GoapKey.fighting, true)); await this.castingHandler.InteractOnUIError(); await Fight(); await KillCheck(); lastActive = DateTime.Now; }
public override async Task PerformAction() { if (this.Keys.Any(k => k.StopBeforeCast)) { await this.stopMoving.Stop(); if (playerReader.PlayerBitValues.IsMounted) { await input.Dismount(); } if (!await Wait(1000, () => playerReader.PlayerBitValues.PlayerInCombat)) { return; } } this.Keys.ForEach(async key => { var pressed = await this.castingHandler.CastIfReady(key); key.ResetCooldown(); key.SetClicked(); }); if (!await Wait(400, () => playerReader.PlayerBitValues.PlayerInCombat)) { return; } bool wasDrinkingOrEating = this.playerReader.Buffs.Drinking || this.playerReader.Buffs.Eating; int ticks = 0; this.logger.LogInformation($"Waiting for {Name}"); while ((this.playerReader.Buffs.Drinking || this.playerReader.Buffs.Eating || this.playerReader.IsCasting) && !this.playerReader.PlayerBitValues.PlayerInCombat) { if (!await Wait(100, () => playerReader.PlayerBitValues.PlayerInCombat)) { return; } ticks++; if (this.playerReader.Buffs.Drinking && this.playerReader.Buffs.Eating) { if (this.playerReader.ManaPercentage > 98 && this.playerReader.HealthPercent > 98) { break; } } else if (this.playerReader.Buffs.Drinking) { if (this.playerReader.ManaPercentage > 98) { break; } } else if (this.playerReader.Buffs.Eating) { if (this.playerReader.HealthPercent > 98) { break; } } if (ticks > 250) { this.logger.LogInformation($"Waited long enough for {Name}"); break; } } if (wasDrinkingOrEating) { await input.TapStandUpKey(); // stand up } }
public override async Task PerformAction() { await input.TapStopAttack(); this.playerReader.LastUIErrorMessage = UI_ERROR.NONE; if ((DateTime.Now - LastActive).TotalSeconds > 5) { PullStartTime = DateTime.Now; } LastActive = DateTime.Now; /* * if ((DateTime.Now - PullStartTime).TotalSeconds > 30) * { * //await wowProcess.KeyPress(ConsoleKey.F3, 50); // clear target * await wowProcess.TapClearTarget(); * await this.wowProcess.KeyPress(ConsoleKey.RightArrow, 1000, "Turn after pull timeout"); * return; * } */ SendActionEvent(new ActionEventArgs(GoapKey.fighting, true)); if (playerReader.PlayerBitValues.IsMounted) { logger.LogInformation($"Dismount"); await input.Dismount(); } if (ShouldStopBeforePull) { logger.LogInformation($"Stop approach"); await this.stopMoving.Stop(); await input.TapStopAttack(); await input.TapStopKey(); } bool pulled = await Pull(); if (!pulled) { if (HasPickedUpAnAdd) { logger.LogInformation($"Combat={this.playerReader.PlayerBitValues.PlayerInCombat}, Is Target targetting me={this.playerReader.PlayerBitValues.TargetOfTargetIsPlayer}"); logger.LogInformation($"Add on approach"); await this.stopMoving.Stop(); await input.TapStopKey(); //await wowProcess.KeyPress(ConsoleKey.F3, 50); // clear target //await wowProcess.TapClearTarget(); await input.TapNearestTarget(); if (this.playerReader.HasTarget && playerReader.PlayerBitValues.TargetInCombat) { if (this.playerReader.TargetTarget == TargetTargetEnum.TargetIsTargettingMe) { return; } } await input.TapClearTarget(); return; } if (!this.stuckDetector.IsMoving()) { await this.stuckDetector.Unstick(); } await Interact(); await this.playerReader.WaitForNUpdate(1); } else { this.SendActionEvent(new ActionEventArgs(GoapKey.pulled, true)); this.playerReader.LastUIErrorMessage = UI_ERROR.NONE; } }
public override async Task PerformAction() { if (playerReader.PlayerBitValues.IsMounted) { await input.Dismount(); } if (NeedsToReset) { this.stuckDetector.ResetStuckParameters(); } var location = playerReader.PlayerLocation; if (!playerReader.PlayerBitValues.PlayerInCombat) { playerWasInCombat = false; } else { // we are in combat if (!playerWasInCombat && HasPickedUpAnAdd) { logger.LogInformation("WARN Bodypull -- Looks like we have an add on approach"); logger.LogInformation($"Combat={this.playerReader.PlayerBitValues.PlayerInCombat}, Is Target targetting me={this.playerReader.PlayerBitValues.TargetOfTargetIsPlayer}"); await this.stopMoving.Stop(); await input.TapClearTarget(); await input.TapStopKey(); if (playerReader.PetHasTarget) { await this.input.TapTargetPet(); await this.input.TapTargetOfTarget(); } } playerWasInCombat = true; } await this.TapInteractKey("ApproachTargetAction 1"); await this.playerReader.WaitForNUpdate(1); var newLocation = playerReader.PlayerLocation; if ((location.X == newLocation.X && location.Y == newLocation.Y && SecondsSinceLastFighting > 5) || this.playerReader.LastUIErrorMessage == UI_ERROR.ERR_AUTOFOLLOW_TOO_FAR) { input.SetKeyState(ConsoleKey.UpArrow, true, false, "ApproachTargetAction"); await Wait(100, () => false); await input.TapJump(); this.playerReader.LastUIErrorMessage = UI_ERROR.NONE; } await RandomJump(); // int approachSeconds = (int)(this.stuckDetector.actionDurationSeconds); if (approachSeconds > 20) { await this.stuckDetector.Unstick(); await this.TapInteractKey("ApproachTargetAction unstick"); await Task.Delay(250); } if (playerReader.WithInCombatRange && ( playerReader.PlayerClass == PlayerClassEnum.Rogue || playerReader.PlayerClass == PlayerClassEnum.Warrior || playerReader.PlayerClass == PlayerClassEnum.Paladin)) { Log("WithInCombatRange -- Strictly melee -- Wait a moment"); await stopMoving.Stop(); await this.TapInteractKey("ApproachTargetAction engage"); await Task.Delay(200); } }