diff Main.lua @ 583:4a51fdc1e2e4

Began the process of updating for Midnight's changes.
author MMOSimca
date Sun, 05 Oct 2025 22:48:07 -0400
parents 78e9cbbf3d58
children be7931f9225c
line wrap: on
line diff
--- a/Main.lua	Tue Aug 20 09:44:11 2024 -0400
+++ b/Main.lua	Sun Oct 05 22:48:07 2025 -0400
@@ -19,6 +19,9 @@
 local C_Spell = _G.C_Spell
 local GetCurrencyInfo = _G.GetCurrencyInfo
 
+local ICL = InCombatLockdown
+local III = IsInInstance
+
 
 -- ADDON NAMESPACE ----------------------------------------------------
 
@@ -1219,15 +1222,19 @@
         level_data = {}
         encounter_data[npc_level] = level_data
     end
-    level_data.max_health = level_data.max_health or _G.UnitHealthMax("target")
-
-    -- May not capture as much data as it could, since the API changed in Legion to report multiple types of power
-    if not level_data.power then
-        local max_power = _G.UnitPowerMax("target")
-
-        if max_power > 0 then
-            local power_type = _G.UnitPowerType("target")
-            level_data.power = ("%s:%d"):format(private.POWER_TYPE_NAMES[tostring(power_type)] or power_type, max_power)
+    
+    -- Can't do this in instances now
+    if not III() then
+        level_data.max_health = level_data.max_health or _G.UnitHealthMax("target")
+
+        -- May not capture as much data as it could, since the API changed in Legion to report multiple types of power
+        if not level_data.power then
+            local max_power = _G.UnitPowerMax("target")
+
+            if max_power > 0 then
+                local power_type = _G.UnitPowerType("target")
+                level_data.power = ("%s:%d"):format(private.POWER_TYPE_NAMES[tostring(power_type)] or power_type, max_power)
+            end
         end
     end
     name_to_id_map[_G.UnitName("target")] = unit_idnum