diff --git a/Omen.lua b/Omen.lua index 7648b3f..e4cf658 100644 --- a/Omen.lua +++ b/Omen.lua @@ -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 Nova", [[Sound\Spells\SeepingGaseous_Fel_Nova.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_ENABLED", "UpdateVisible") end + if db.UseFocus then + self:RegisterEvent("UNIT_TARGET") + end self:PARTY_MEMBERS_CHANGED() self:PLAYER_TARGET_CHANGED() @@ -986,9 +987,8 @@ end -- Fired when a mob has its threat list updated. The mob that -- had its list updated is the first parameter of the event. function Omen:UNIT_THREAT_LIST_UPDATE(event, unitID) - if unitID == "target" then - self:UpdateBars() - end + -- It appears that unitID can only be "target" or "focus" + self:UpdateBars() end -- Fired when a unit's threat situation changes. The unit that @@ -1008,6 +1008,12 @@ function Omen:PLAYER_TARGET_CHANGED() self:UpdateBars() 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() function Omen:PARTY_MEMBERS_CHANGED() @@ -1146,11 +1152,13 @@ function Omen:FindThreatMob() if not name then name = name2 end if not UnitIsPlayer(mob) and not UnitPlayerControlled(mob) and UnitCanAttack("player", mob) and UnitHealth(mob) > 0 then self.TitleText:SetText(name2) + self.unitID = mob return mob end end end self.TitleText:SetText(name) + self.unitID = nil end function Omen:UpdateBars() @@ -1218,6 +1226,8 @@ function Omen:UpdateBars() updatethreat("target", mob) updatethreat("pettarget", mob) end + updatethreat("target", mob) + updatethreat("targettarget", mob) updatethreat("focus", mob) updatethreat("focustarget", mob) updatethreat(mobTarget, mob) @@ -1439,6 +1449,11 @@ do info.text = "Use Focus Target" info.func = function() db.UseFocus = not db.UseFocus + if db.UseFocus then + Omen:RegisterEvent("UNIT_TARGET") + else + Omen:UnregisterEvent("UNIT_TARGET") + end Omen:UpdateBars() end info.checked = db.UseFocus