Mercurial > wow > wowdb-profiler
diff Main.lua @ 257:834251607624
Only record data for NPCs if it is missing.
author | James D. Callahan III <jcallahan@curse.com> |
---|---|
date | Mon, 18 Mar 2013 12:26:54 -0500 |
parents | 1a6ef614a144 |
children | 3558ba83eacd |
line wrap: on
line diff
--- a/Main.lua Mon Mar 18 11:11:31 2013 -0500 +++ b/Main.lua Mon Mar 18 12:26:54 2013 -0500 @@ -940,21 +940,19 @@ local npc_level = ("level_%d"):format(_G.UnitLevel("target")) local level_data = encounter_data[npc_level] - Debug("Target npc_level is %s", npc_level) - if not level_data then level_data = {} encounter_data[npc_level] = level_data end - Debug("level_data is %s", _G.tostring(level_data)) - level_data.max_health = _G.UnitHealthMax("target") - Debug("max_health is %s", level_data and level_data.max_health or "nil") - - local max_power = _G.UnitManaMax("target") - - if max_power > 0 then - local power_type = _G.UnitPowerType("target") - level_data.power = ("%s:%d"):format(POWER_TYPE_NAMES[_G.tostring(power_type)] or power_type, max_power) + level_data.max_health = level_data.max_health or _G.UnitHealthMax("target") + + if not level_data.power then + local max_power = _G.UnitManaMax("target") + + if max_power > 0 then + local power_type = _G.UnitPowerType("target") + level_data.power = ("%s:%d"):format(POWER_TYPE_NAMES[_G.tostring(power_type)] or power_type, max_power) + end end name_to_id_map[_G.UnitName("target")] = unit_idnum return npc, unit_idnum