Fix threat updating on focus/focustarget units.
This commit is contained in:
@@ -41,8 +41,6 @@ LSM:Register("sound", "Short Circuit", [[Sound\Spells\SimonGame_Visual_BadPress.
|
|||||||
LSM:Register("sound", "Fel Portal", [[Sound\Spells\Sunwell_Fel_PortalStand.wav]])
|
LSM:Register("sound", "Fel Portal", [[Sound\Spells\Sunwell_Fel_PortalStand.wav]])
|
||||||
LSM:Register("sound", "Fel Nova", [[Sound\Spells\SeepingGaseous_Fel_Nova.wav]])
|
LSM:Register("sound", "Fel Nova", [[Sound\Spells\SeepingGaseous_Fel_Nova.wav]])
|
||||||
LSM:Register("sound", "You Will Die!", [[Sound\Creature\CThun\CThunYouWillDIe.wav]])
|
LSM:Register("sound", "You Will Die!", [[Sound\Creature\CThun\CThunYouWillDIe.wav]])
|
||||||
LSM:Register("background", "Blizzard Parchment", [[Interface\AchievementFrame\UI-Achievement-Parchment-Horizontal]])
|
|
||||||
LSM:Register("background", "Blizzard Parchment 2", [[Interface\AchievementFrame\UI-Achievement-Parchment]])
|
|
||||||
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
@@ -517,6 +515,9 @@ function Omen:OnEnable()
|
|||||||
self:RegisterEvent("PLAYER_REGEN_DISABLED", "UpdateVisible")
|
self:RegisterEvent("PLAYER_REGEN_DISABLED", "UpdateVisible")
|
||||||
self:RegisterEvent("PLAYER_REGEN_ENABLED", "UpdateVisible")
|
self:RegisterEvent("PLAYER_REGEN_ENABLED", "UpdateVisible")
|
||||||
end
|
end
|
||||||
|
if db.UseFocus then
|
||||||
|
self:RegisterEvent("UNIT_TARGET")
|
||||||
|
end
|
||||||
|
|
||||||
self:PARTY_MEMBERS_CHANGED()
|
self:PARTY_MEMBERS_CHANGED()
|
||||||
self:PLAYER_TARGET_CHANGED()
|
self:PLAYER_TARGET_CHANGED()
|
||||||
@@ -986,9 +987,8 @@ end
|
|||||||
-- Fired when a mob has its threat list updated. The mob that
|
-- Fired when a mob has its threat list updated. The mob that
|
||||||
-- had its list updated is the first parameter of the event.
|
-- had its list updated is the first parameter of the event.
|
||||||
function Omen:UNIT_THREAT_LIST_UPDATE(event, unitID)
|
function Omen:UNIT_THREAT_LIST_UPDATE(event, unitID)
|
||||||
if unitID == "target" then
|
-- It appears that unitID can only be "target" or "focus"
|
||||||
self:UpdateBars()
|
self:UpdateBars()
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Fired when a unit's threat situation changes. The unit that
|
-- Fired when a unit's threat situation changes. The unit that
|
||||||
@@ -1008,6 +1008,12 @@ function Omen:PLAYER_TARGET_CHANGED()
|
|||||||
self:UpdateBars()
|
self:UpdateBars()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function Omen:UNIT_TARGET(event, unitID)
|
||||||
|
if unitID == "focus" and db.UseFocus and self.unitID == "focustarget" then
|
||||||
|
self:UpdateBars()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
local lastPartyUpdateTime = GetTime()
|
local lastPartyUpdateTime = GetTime()
|
||||||
|
|
||||||
function Omen:PARTY_MEMBERS_CHANGED()
|
function Omen:PARTY_MEMBERS_CHANGED()
|
||||||
@@ -1146,11 +1152,13 @@ function Omen:FindThreatMob()
|
|||||||
if not name then name = name2 end
|
if not name then name = name2 end
|
||||||
if not UnitIsPlayer(mob) and not UnitPlayerControlled(mob) and UnitCanAttack("player", mob) and UnitHealth(mob) > 0 then
|
if not UnitIsPlayer(mob) and not UnitPlayerControlled(mob) and UnitCanAttack("player", mob) and UnitHealth(mob) > 0 then
|
||||||
self.TitleText:SetText(name2)
|
self.TitleText:SetText(name2)
|
||||||
|
self.unitID = mob
|
||||||
return mob
|
return mob
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
self.TitleText:SetText(name)
|
self.TitleText:SetText(name)
|
||||||
|
self.unitID = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
function Omen:UpdateBars()
|
function Omen:UpdateBars()
|
||||||
@@ -1218,6 +1226,8 @@ function Omen:UpdateBars()
|
|||||||
updatethreat("target", mob)
|
updatethreat("target", mob)
|
||||||
updatethreat("pettarget", mob)
|
updatethreat("pettarget", mob)
|
||||||
end
|
end
|
||||||
|
updatethreat("target", mob)
|
||||||
|
updatethreat("targettarget", mob)
|
||||||
updatethreat("focus", mob)
|
updatethreat("focus", mob)
|
||||||
updatethreat("focustarget", mob)
|
updatethreat("focustarget", mob)
|
||||||
updatethreat(mobTarget, mob)
|
updatethreat(mobTarget, mob)
|
||||||
@@ -1439,6 +1449,11 @@ do
|
|||||||
info.text = "Use Focus Target"
|
info.text = "Use Focus Target"
|
||||||
info.func = function()
|
info.func = function()
|
||||||
db.UseFocus = not db.UseFocus
|
db.UseFocus = not db.UseFocus
|
||||||
|
if db.UseFocus then
|
||||||
|
Omen:RegisterEvent("UNIT_TARGET")
|
||||||
|
else
|
||||||
|
Omen:UnregisterEvent("UNIT_TARGET")
|
||||||
|
end
|
||||||
Omen:UpdateBars()
|
Omen:UpdateBars()
|
||||||
end
|
end
|
||||||
info.checked = db.UseFocus
|
info.checked = db.UseFocus
|
||||||
|
|||||||
Reference in New Issue
Block a user