Require mobs to have a quest icon again
authorLiza Carvelli <liza@carvel.li>
Tue, 8 Apr 2025 07:32:37 +0000 (09:32 +0200)
committerLiza Carvelli <liza@carvel.li>
Tue, 8 Apr 2025 07:32:37 +0000 (09:32 +0200)
Questionable/Controller/CombatController.cs

index c54dce0..02bcc71 100644 (file)
@@ -26,6 +26,7 @@ namespace Questionable.Controller;
 internal sealed class CombatController : IDisposable
 {
     private const float MaxTargetRange = 55f;
+    private const float MaxNameplateRange = 50f;
 
     private readonly List<ICombatModule> _combatModules;
     private readonly MovementController _movementController;
@@ -303,6 +304,11 @@ internal sealed class CombatController : IDisposable
                 return (null, "Untargetable");
 
             var complexCombatData = _currentFight.Data.ComplexCombatDatas;
+            var gameObjectStruct = (GameObject*)gameObject.Address;
+
+            bool expectQuestMarker =
+                Vector3.Distance(_clientState.LocalPlayer?.Position ?? Vector3.Zero, battleNpc.Position) <
+                MaxNameplateRange;
             if (complexCombatData.Count > 0)
             {
                 for (int i = 0; i < complexCombatData.Count; ++i)
@@ -310,6 +316,11 @@ internal sealed class CombatController : IDisposable
                     if (_currentFight.Data.CompletedComplexDatas.Contains(i))
                         continue;
 
+                    if (expectQuestMarker &&
+                        !complexCombatData[i].IgnoreQuestMarker &&
+                        gameObjectStruct->NamePlateIconId == 0)
+                        continue;
+
                     if (complexCombatData[i].DataId == battleNpc.DataId &&
                         (complexCombatData[i].NameId == null || complexCombatData[i].NameId == battleNpc.NameId))
                         return (100, "CCD");
@@ -317,15 +328,14 @@ internal sealed class CombatController : IDisposable
             }
             else
             {
-                if (_currentFight.Data.KillEnemyDataIds.Contains(battleNpc.DataId))
+                if ((!expectQuestMarker || gameObjectStruct->NamePlateIconId != 0) &&
+                    _currentFight.Data.KillEnemyDataIds.Contains(battleNpc.DataId))
                     return (90, "KED");
             }
 
             // enemies that we have aggro on
             if (battleNpc.BattleNpcKind is BattleNpcSubKind.BattleNpcPart or BattleNpcSubKind.Enemy)
             {
-                var gameObjectStruct = (GameObject*)gameObject.Address;
-
                 // npc that starts a fate or does turn-ins; not sure why they're marked as hostile
                 if (gameObjectStruct->NamePlateIconId is 60093 or 60732)
                     return (null, "FATE NPC");