public async ValueTask WaitForNUpdate(int n) { await npcNameFinder.WaitForNUpdate(n); }
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}"); if (!await Wait(100, DiDEnteredCombat())) { await AquireTarget(); } else { await GoalExit(); } } }
public override async Task PerformAction() { Log("Try to find Corpse"); npcNameFinder.ChangeNpcType(NpcNameFinder.NPCType.Corpse); await stopMoving.Stop(); // TODO: have to wait for the cursor to switch from loot -> skinning // sometimes takes a lot of time await npcNameFinder.WaitForNUpdate(1); if (await DiDEnteredCombat()) { await AquireTarget(); return; } Log("Found corpses: " + npcNameFinder.NpcCount); WowPoint lastPosition = playerReader.PlayerLocation; bool skinSuccess = await npcNameFinder.FindByCursorType(Cursor.CursorClassification.Skin); if (skinSuccess) { await Wait(100, () => false); if (IsPlayerMoving(lastPosition)) { Log("Goto corpse - Wait till the player become stil!"); } while (IsPlayerMoving(lastPosition)) { lastPosition = playerReader.PlayerLocation; if (!await Wait(100, DiDEnteredCombat())) { await AquireTarget(); return; } } await input.TapInteractKey("Skinning Attempt..."); do { await playerReader.WaitForNUpdate(1); if (await DiDEnteredCombat()) { await AquireTarget(); return; } } while (playerReader.IsCasting); // Wait for to update the LastUIErrorMessage await playerReader.WaitForNUpdate(1); var lastError = this.playerReader.LastUIErrorMessage; if (lastError != UI_ERROR.ERR_SPELL_FAILED_S) { this.playerReader.LastUIErrorMessage = UI_ERROR.NONE; logger.LogDebug("Skinning Successful!"); await GoalExit(); } else { logger.LogDebug("Skinning Failed! Retry..."); } } else { logger.LogDebug($"Target is not skinnable - NPC Count: {npcNameFinder.NpcCount}"); await GoalExit(); } }