public override async Task PerformAction() { lastLoot = playerReader.LastLootTime; await stopMoving.Stop(); combatUtil.Update(); await input.TapLastTargetKey($"{GetType().Name}: No corpse name found - check last dead target exists"); await wait.Update(1); if (playerReader.HasTarget) { if (playerReader.Bits.TargetIsDead) { await input.TapInteractKey($"{GetType().Name}: Found last dead target"); await wait.Update(1); (bool foundTarget, bool moved) = await combatUtil.FoundTargetWhileMoved(); if (foundTarget) { Log("Goal interrupted!"); return; } if (moved) { await input.TapInteractKey($"{GetType().Name}: Last dead target double"); } } else { await input.TapClearTarget($"{GetType().Name}: Don't attack the target!"); } } await GoalExit(); }
public override async Task PerformAction() { WowPoint lastPosition = playerReader.PlayerLocation; Log("Search for corpse"); npcNameFinder.ChangeNpcType(NpcNameFinder.NPCType.Corpse); await stopMoving.Stop(); await npcNameFinder.WaitForNUpdate(1); bool lootSuccess = await npcNameFinder.FindByCursorType(Cursor.CursorClassification.Loot); if (lootSuccess) { Log("Found corpse - interact with it"); await playerReader.WaitForNUpdate(1); if (classConfiguration.Skin) { var targetSkinnable = !playerReader.Unskinnable; AddEffect(GoapKey.shouldskin, targetSkinnable); Log($"Should skin ? {targetSkinnable}"); SendActionEvent(new ActionEventArgs(GoapKey.shouldskin, targetSkinnable)); } bool hadToMove = false; if (IsPlayerMoving(lastPosition)) { hadToMove = true; Log("Goto corpse - Wait till player become stil!"); } while (IsPlayerMoving(lastPosition)) { lastPosition = playerReader.PlayerLocation; if (!await Wait(100, DiDEnteredCombat())) { await AquireTarget(); return; } } // TODO: damn spell batching // arriving to the corpse min distance to interact location // and says you are too far away // so have to wait and retry the action // at this point the player have a target // might be a good idea to check the last error message :shrug: if (hadToMove) { if (!await Wait(200, DiDEnteredCombat())) { await AquireTarget(); return; } } await input.TapInteractKey("Approach corpse"); // TODO: find a better way to get notified about the successful loot // challlange: // - the mob might have no loot at all so cant check inventory change // - loot window could be checked /* * if (!await Wait(400, DiDEnteredCombat())) * { * await AquireTarget(); * return; * } */ Log("Loot Successfull"); await GoalExit(); } else { Log($"No corpse found - Npc Count: {npcNameFinder.NpcCount}"); await input.TapLastTargetKey("loot second attempt by last target"); await playerReader.WaitForNUpdate(1); if (playerReader.HasTarget) { if (playerReader.PlayerBitValues.TargetIsDead) { await input.TapInteractKey("loot dead corpse by last target"); } else { await input.TapClearTarget("dont attack"); } } if (!await Wait(100, DiDEnteredCombat())) { await AquireTarget(); } else { await GoalExit(); } } }
public override async Task PerformAction() { await input.TapLastTargetKey(this.ToString()); }
public override async Task PerformAction() { lastPlayerLocation = playerReader.PlayerLocation; await wait.Update(1); if (!playerReader.Bits.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={playerReader.Bits.PlayerInCombat}, Is Target targetting me={playerReader.Bits.TargetOfTargetIsPlayer}"); await stopMoving.Stop(); await input.TapClearTarget(); await wait.Update(1); if (playerReader.PetHasTarget) { await input.TapTargetPet(); await input.TapTargetOfTarget(); await wait.Update(1); } } playerWasInCombat = true; } if (input.ClassConfig.Approach.GetCooldownRemaining() == 0) { await input.TapApproachKey(""); } lastPlayerDistance = WowPoint.DistanceTo(lastPlayerLocation, playerReader.PlayerLocation); if (lastPlayerDistance < 0.05 && playerReader.LastUIErrorMessage == UI_ERROR.ERR_AUTOFOLLOW_TOO_FAR) { playerReader.LastUIErrorMessage = UI_ERROR.NONE; input.SetKeyState(ConsoleKey.UpArrow, true, false, $"{GetType().Name}: Too far, start moving forward!"); await wait.Update(1); } if (SecondsSinceApproachStarted > 1 && lastPlayerDistance < 0.05 && !playerReader.Bits.PlayerInCombat) { await input.TapClearTarget(""); await wait.Update(1); await input.KeyPress(random.Next(2) == 0?ConsoleKey.LeftArrow : ConsoleKey.RightArrow, 1000, $"Seems stuck! Clear Target. Turn away. d: {lastPlayerDistance}"); approachStart = DateTime.Now; } if (SecondsSinceApproachStarted > 15 && !playerReader.Bits.PlayerInCombat) { await input.TapClearTarget(""); await wait.Update(1); await input.KeyPress(random.Next(2) == 0?ConsoleKey.LeftArrow : ConsoleKey.RightArrow, 1000, "Too long time. Clear Target. Turn away."); approachStart = DateTime.Now; } if (playerReader.TargetGuid == initialTargetGuid) { var initialTargetMinRange = playerReader.MinRange; if (!playerReader.Bits.PlayerInCombat) { await input.TapNearestTarget("Try to find closer target..."); await wait.Update(1); } if (playerReader.TargetGuid != initialTargetGuid) { if (playerReader.HasTarget) // blacklist { if (playerReader.MinRange < initialTargetMinRange) { Log($"Found a closer target! {playerReader.MinRange} < {initialTargetMinRange}"); initialMinRange = playerReader.MinRange; } else { initialTargetGuid = -1; await input.TapLastTargetKey($"Stick to initial target!"); await wait.Update(1); } } else { Log($"Lost the target due blacklist!"); } } } if (initialMinRange < playerReader.MinRange && !playerReader.Bits.PlayerInCombat) { Log($"We are going away from the target! {initialMinRange} < {playerReader.MinRange}"); await input.TapClearTarget(); await wait.Update(1); approachStart = DateTime.Now; } await RandomJump(); }
public override async Task PerformAction() { lastLoot = playerReader.LastLootTime; await stopMoving.Stop(); combatUtil.Update(); await npcNameTargeting.WaitForNUpdate(2); bool foundCursor = await npcNameTargeting.FindBy(CursorType.Loot); if (foundCursor) { Log("Found corpse - clicked"); (bool notFoundTarget, double elapsedMs) = await wait.InterruptTask(200, () => playerReader.TargetId != 0); if (!notFoundTarget) { Log($"Found target after {elapsedMs}ms"); } CheckForSkinning(); (bool foundTarget, bool moved) = await combatUtil.FoundTargetWhileMoved(); if (foundTarget) { Log("Interrupted!"); return; } if (moved) { await input.TapInteractKey($"{GetType().Name}: Had to move so interact again"); await wait.Update(1); } } else { await input.TapLastTargetKey($"{GetType().Name}: No corpse name found - check last dead target exists"); await wait.Update(1); if (playerReader.HasTarget) { if (playerReader.Bits.TargetIsDead) { CheckForSkinning(); await input.TapInteractKey($"{GetType().Name}: Found last dead target"); await wait.Update(1); (bool foundTarget, bool moved) = await combatUtil.FoundTargetWhileMoved(); if (foundTarget) { Log("Goal interrupted!"); return; } if (moved) { await input.TapInteractKey($"{GetType().Name}: Last dead target double"); } } else { await input.TapClearTarget($"{GetType().Name}: Don't attack the target!"); } } } await GoalExit(); }