Mercurial > wow > wowdb-profiler
comparison Main.lua @ 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 |
comparison
equal
deleted
inserted
replaced
| 2:d563ea0ec911 | 3:a9b84f0d8235 |
|---|---|
| 369 end | 369 end |
| 370 local _, class_token = _G.UnitClass("target") | 370 local _, class_token = _G.UnitClass("target") |
| 371 npc.class = class_token | 371 npc.class = class_token |
| 372 -- TODO: Add faction here | 372 -- TODO: Add faction here |
| 373 npc.gender = GENDER_NAMES[_G.UnitSex("target")] or "UNDEFINED" | 373 npc.gender = GENDER_NAMES[_G.UnitSex("target")] or "UNDEFINED" |
| 374 npc.is_pvp = _G.UnitIsPVP("target") and true or false | 374 npc.is_pvp = _G.UnitIsPVP("target") and true or nil |
| 375 npc.reaction = ("%s:%s:%s"):format(_G.UnitLevel("player"), _G.UnitFactionGroup("player"), REACTION_NAMES[_G.UnitReaction("player", "target")]) | 375 npc.reaction = ("%s:%s:%s"):format(_G.UnitLevel("player"), _G.UnitFactionGroup("player"), REACTION_NAMES[_G.UnitReaction("player", "target")]) |
| 376 npc.stats = npc.stats or {} | 376 npc.stats = npc.stats or {} |
| 377 | 377 |
| 378 local npc_level = ("level_%d"):format(_G.UnitLevel("target")) | 378 local npc_level = ("level_%d"):format(_G.UnitLevel("target")) |
| 379 | 379 |
| 380 if not npc.stats[npc_level] then | 380 if not npc.stats[npc_level] then |
| 381 local power_type = _G.UnitPowerType("target") | |
| 382 | |
| 383 npc.stats[npc_level] = { | 381 npc.stats[npc_level] = { |
| 384 max_health = _G.UnitHealthMax("target"), | 382 max_health = _G.UnitHealthMax("target"), |
| 385 max_power = _G.UnitManaMax("target"), | |
| 386 power_type = POWER_TYPE_NAMES[_G.tostring(power_type)] or power_type, | |
| 387 } | 383 } |
| 384 | |
| 385 local max_power = _G.UnitManaMax("target") | |
| 386 | |
| 387 if max_power > 0 then | |
| 388 local power_type = _G.UnitPowerType("target") | |
| 389 npc.stats[npc_level].power = ("%s:%d"):format(POWER_TYPE_NAMES[_G.tostring(power_type)] or power_type, max_power) | |
| 390 end | |
| 388 end | 391 end |
| 389 end | 392 end |
| 390 | 393 |
| 391 | 394 |
| 392 function WDP:UNIT_SPELLCAST_SENT(event_name, unit_id, spell_name, spell_rank, target_name, spell_line) | 395 function WDP:UNIT_SPELLCAST_SENT(event_name, unit_id, spell_name, spell_rank, target_name, spell_line) |
