Mercurial > wow > wowdb-profiler
changeset 3:a9b84f0d8235
Only create an is_pvp entry for NPCs if UnitIsPVP() returns 1. Consolidate the NPC power entries into one colon-delimited field.
author | James D. Callahan III <jcallahan@curse.com> |
---|---|
date | Fri, 27 Apr 2012 14:03:17 -0500 |
parents | d563ea0ec911 |
children | 24a1d78e2e8c |
files | Main.lua |
diffstat | 1 files changed, 8 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/Main.lua Fri Apr 27 08:22:37 2012 -0500 +++ b/Main.lua Fri Apr 27 14:03:17 2012 -0500 @@ -371,20 +371,23 @@ npc.class = class_token -- TODO: Add faction here npc.gender = GENDER_NAMES[_G.UnitSex("target")] or "UNDEFINED" - npc.is_pvp = _G.UnitIsPVP("target") and true or false + npc.is_pvp = _G.UnitIsPVP("target") and true or nil npc.reaction = ("%s:%s:%s"):format(_G.UnitLevel("player"), _G.UnitFactionGroup("player"), REACTION_NAMES[_G.UnitReaction("player", "target")]) npc.stats = npc.stats or {} local npc_level = ("level_%d"):format(_G.UnitLevel("target")) if not npc.stats[npc_level] then - local power_type = _G.UnitPowerType("target") - npc.stats[npc_level] = { max_health = _G.UnitHealthMax("target"), - max_power = _G.UnitManaMax("target"), - power_type = POWER_TYPE_NAMES[_G.tostring(power_type)] or power_type, } + + local max_power = _G.UnitManaMax("target") + + if max_power > 0 then + local power_type = _G.UnitPowerType("target") + npc.stats[npc_level].power = ("%s:%d"):format(POWER_TYPE_NAMES[_G.tostring(power_type)] or power_type, max_power) + end end end