feign death detection
This commit is contained in:
		| @@ -112,8 +112,10 @@ function EventListener:COMBAT_LOG_EVENT_UNFILTERED() | ||||
|         end | ||||
|         -- death detection | ||||
|         if (Gladdy.buttons[destUnit] and eventType == "UNIT_DIED" or eventType == "PARTY_KILL" or eventType == "SPELL_INSTAKILL") then | ||||
|             if not Gladdy:isFeignDeath(destUnit) then | ||||
|                 Gladdy:SendMessage("UNIT_DEATH", destUnit) | ||||
|             end | ||||
|         end | ||||
|         -- spec detection | ||||
|         if Gladdy.buttons[destUnit] and (not Gladdy.buttons[destUnit].class or not Gladdy.buttons[destUnit].race) then | ||||
|             Gladdy:SpotEnemy(destUnit, true) | ||||
|   | ||||
| @@ -118,7 +118,7 @@ function Healthbar:CreateFrame(unit) | ||||
| end | ||||
|  | ||||
| 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 isDead then | ||||
|             Gladdy:SendMessage("UNIT_DEATH", unit) | ||||
| @@ -207,7 +207,7 @@ function Healthbar:SetHealthText(healthBar, health, healthMax) | ||||
|     local healthText = "" | ||||
|     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) | ||||
|         return | ||||
|     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 Gladdy = LibStub("Gladdy") | ||||
| local L = Gladdy.L | ||||
| local AuraUtil = AuraUtil | ||||
| local GetSpellInfo = GetSpellInfo | ||||
|  | ||||
| --------------------------- | ||||
|  | ||||
| @@ -151,3 +153,8 @@ function Gladdy:contains(entry, list) | ||||
|     end | ||||
|     return false | ||||
| end | ||||
|  | ||||
| local feignDeath = GetSpellInfo(5384) | ||||
| function Gladdy:isFeignDeath(unit) | ||||
|     return AuraUtil.FindAuraByName(feignDeath, unit) | ||||
| end | ||||
|   | ||||
		Reference in New Issue
	
	Block a user