From d8cf9616c0674f45cd9e83e49bd247e2f22d9b7b Mon Sep 17 00:00:00 2001 From: Liza Carvelli Date: Tue, 13 Aug 2024 23:24:47 +0200 Subject: [PATCH] Combat: Pathfind to enemies outside of nameplate render range (for overworld enemies) --- Questionable/Controller/CombatController.cs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/Questionable/Controller/CombatController.cs b/Questionable/Controller/CombatController.cs index 533cc8167..0da45098a 100644 --- a/Questionable/Controller/CombatController.cs +++ b/Questionable/Controller/CombatController.cs @@ -169,10 +169,12 @@ internal sealed class CombatController : IDisposable } } - if (QuestWorkUtils.HasCompletionFlags(condition.CompletionQuestVariablesFlags) && _currentFight.Data.ElementId is QuestId questId) + if (QuestWorkUtils.HasCompletionFlags(condition.CompletionQuestVariablesFlags) && + _currentFight.Data.ElementId is QuestId questId) { var questWork = _questFunctions.GetQuestProgressInfo(questId); - if (questWork != null && QuestWorkUtils.MatchesQuestWork(condition.CompletionQuestVariablesFlags, questWork)) + if (questWork != null && + QuestWorkUtils.MatchesQuestWork(condition.CompletionQuestVariablesFlags, questWork)) { _logger.LogInformation("Complex combat condition fulfilled: QuestWork matches"); _currentFight.Data.CompletedComplexDatas.Add(i); @@ -248,10 +250,15 @@ internal sealed class CombatController : IDisposable if (battleNpc.StatusFlags.HasFlag(StatusFlags.InCombat)) return 20; } - else + else if (enemyData != null) { if (gameObjectStruct->NamePlateIconId != 0) return 30; + + // for enemies that are very far away, their nameplate doesn't render but they're in the object table + if (_currentFight?.Data.SpawnType == EEnemySpawnType.OverworldEnemies && + Vector3.Distance(_clientState.LocalPlayer?.Position ?? Vector3.Zero, battleNpc.Position) > 50) + return 25; } }