public override async Task PerformAction() { await wowProcess.KeyPress(ConsoleKey.F9, 100); // stand await stopMoving.Stop(); var targetResult = await AmIBeingTargetted(); if (targetResult == TargetResult.InCombat) { return; } var healthAtStartOfLooting = playerReader.HealthPercent; bool searchForMobs = playerReader.PlayerBitValues.PlayerInCombat; var lootAttempt = 0; while (lootAttempt < 10) { if (!this.classConfiguration.Loot && !playerReader.PlayerBitValues.PlayerInCombat) { return; } if (lootAttempt == 0 && targetResult == TargetResult.NoTarget && this.classConfiguration.Loot) { await this.TapTargetLastTargetKey("lootAttempt 0"); await this.TapInteractKey("lootAttempt 0"); await Task.Delay(1000); } if (await CheckIfEnterredCombat()) { return; } Log(searchForMobs ? "Searching for mobs" : $"Looting (attempt: {lootAttempt + 1}."); SendActionEvent(new ActionEventArgs(GoapKey.shouldloot, false)); var foundSomething = await lootWheel.Loot(searchForMobs); if (foundSomething && lootWheel.Classification == Cursor.CursorClassification.Kill) { await AquireTarget(); return; } if (this.playerReader.PlayerClass == PlayerClassEnum.Druid && this.playerReader.Druid_ShapeshiftForm != ShapeshiftForm.None) { var desiredFormKey = this.classConfiguration.ShapeshiftForm .Where(s => s.ShapeShiftFormEnum == ShapeshiftForm.None) .FirstOrDefault(); if (desiredFormKey != null) { await this.wowProcess.KeyPress(desiredFormKey.ConsoleKey, 500, "Cancel form to allow drinking"); } } if (!foundSomething && lootAttempt > 0)// && !searchForMobs) { lootAttempt = 10; } else { Log($"Found {lootWheel.Classification}"); if (searchForMobs) { searchForMobs = false; } else { if (lootWheel.Classification == Cursor.CursorClassification.Kill) { await this.TapInteractKey("LootAction"); Log($"Kill something !"); return; } else { if (healthAtStartOfLooting > playerReader.HealthPercent && playerReader.PlayerBitValues.PlayerInCombat) { Log($"Losing health and still in combat !"); return; } Log($"Looted {lootWheel.Classification}"); } } } lootAttempt++; } SendActionEvent(new ActionEventArgs(GoapKey.postloot, true)); }
public override async Task PerformAction() { await wowProcess.KeyPress(ConsoleKey.F9, 100); // stand await stopMoving.Stop(); if (await AmIBeingTargetted()) { return; } var healthAtStartOfLooting = playerReader.HealthPercent; var outOfCombat = !playerReader.PlayerBitValues.PlayerInCombat; bool searchForMobs = playerReader.PlayerBitValues.PlayerInCombat; var lootAttempt = 0; while (lootAttempt < 10) { if (await CheckIfEnterredCombat()) { return; } Log(searchForMobs ? "Searching for mobs" : $"Looting (attempt: {lootAttempt + 1}."); var foundSomething = await lootWheel.Loot(searchForMobs, doExtendedLootSearch || foundAddWhileLooting); if (foundSomething && lootWheel.Classification == Cursor.CursorClassification.Kill) { await AquireTarget(); return; } if (!foundSomething && !searchForMobs) { lootAttempt = 10; foundAddWhileLooting = false; doExtendedLootSearch = false; } else { doExtendedLootSearch = false; if (searchForMobs) { searchForMobs = false; } else { if (lootWheel.Classification == Cursor.CursorClassification.Kill) { foundAddWhileLooting = true; await this.TapInteractKey("LootAction"); Log($"Kill something !"); return; } else { if (healthAtStartOfLooting > playerReader.HealthPercent && playerReader.PlayerBitValues.PlayerInCombat) { Log($"Losing health and still in combat !"); return; } Log($"Looted {lootWheel.Classification}"); } } } lootAttempt++; } SendActionEvent(new ActionEventArgs(GoapKey.shouldloot, false)); SendActionEvent(new ActionEventArgs(GoapKey.postloot, true)); }