feign death detection
This commit is contained in:
parent
f1652e2b42
commit
86bf851c64
@ -112,7 +112,9 @@ function EventListener:COMBAT_LOG_EVENT_UNFILTERED()
|
|||||||
end
|
end
|
||||||
-- death detection
|
-- death detection
|
||||||
if (Gladdy.buttons[destUnit] and eventType == "UNIT_DIED" or eventType == "PARTY_KILL" or eventType == "SPELL_INSTAKILL") then
|
if (Gladdy.buttons[destUnit] and eventType == "UNIT_DIED" or eventType == "PARTY_KILL" or eventType == "SPELL_INSTAKILL") then
|
||||||
Gladdy:SendMessage("UNIT_DEATH", destUnit)
|
if not Gladdy:isFeignDeath(destUnit) then
|
||||||
|
Gladdy:SendMessage("UNIT_DEATH", destUnit)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
-- spec detection
|
-- spec detection
|
||||||
if Gladdy.buttons[destUnit] and (not Gladdy.buttons[destUnit].class or not Gladdy.buttons[destUnit].race) then
|
if Gladdy.buttons[destUnit] and (not Gladdy.buttons[destUnit].class or not Gladdy.buttons[destUnit].race) then
|
||||||
|
@ -118,7 +118,7 @@ function Healthbar:CreateFrame(unit)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function Healthbar.OnEvent(self, event, unit)
|
function Healthbar.OnEvent(self, event, unit)
|
||||||
local isDead = UnitExists(unit) and UnitIsDeadOrGhost(unit)
|
local isDead = UnitExists(unit) and UnitIsDeadOrGhost(unit) and not Gladdy:isFeignDeath(unit)
|
||||||
if event == "UNIT_HEALTH_FREQUENT" or event == "UNIT_MAXHEALTH" then
|
if event == "UNIT_HEALTH_FREQUENT" or event == "UNIT_MAXHEALTH" then
|
||||||
if isDead then
|
if isDead then
|
||||||
Gladdy:SendMessage("UNIT_DEATH", unit)
|
Gladdy:SendMessage("UNIT_DEATH", unit)
|
||||||
@ -207,7 +207,7 @@ function Healthbar:SetHealthText(healthBar, health, healthMax)
|
|||||||
local healthText = ""
|
local healthText = ""
|
||||||
local healthPercentage = health and healthMax and floor(health * 100 / healthMax)
|
local healthPercentage = health and healthMax and floor(health * 100 / healthMax)
|
||||||
|
|
||||||
if health == 0 and UnitExists(healthBar.unit) and UnitIsDeadOrGhost(healthBar.unit) then
|
if health == 0 and UnitExists(healthBar.unit) and UnitIsDeadOrGhost(healthBar.unit) and not Gladdy:isFeignDeath(healthBar.unit) then
|
||||||
self:UNIT_DEATH(healthBar.unit)
|
self:UNIT_DEATH(healthBar.unit)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
7
Util.lua
7
Util.lua
@ -3,6 +3,8 @@ local floor = math.floor
|
|||||||
local str_find, str_gsub, str_sub, tinsert = string.find, string.gsub, string.sub, table.insert
|
local str_find, str_gsub, str_sub, tinsert = string.find, string.gsub, string.sub, table.insert
|
||||||
local Gladdy = LibStub("Gladdy")
|
local Gladdy = LibStub("Gladdy")
|
||||||
local L = Gladdy.L
|
local L = Gladdy.L
|
||||||
|
local AuraUtil = AuraUtil
|
||||||
|
local GetSpellInfo = GetSpellInfo
|
||||||
|
|
||||||
---------------------------
|
---------------------------
|
||||||
|
|
||||||
@ -151,3 +153,8 @@ function Gladdy:contains(entry, list)
|
|||||||
end
|
end
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local feignDeath = GetSpellInfo(5384)
|
||||||
|
function Gladdy:isFeignDeath(unit)
|
||||||
|
return AuraUtil.FindAuraByName(feignDeath, unit)
|
||||||
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user