Add option to ignore player pets to display threat info on (Default: On). Yes, player pets have aggro tables too!

This commit is contained in:
Xinhuan
2008-11-01 04:07:02 +08:00
parent 90990c813d
commit e44f5c6f91
8 changed files with 88 additions and 5 deletions
+18 -5
View File
@@ -56,7 +56,7 @@ LSM:Register("sound", "Omen: Aoogah!", [[Interface\AddOns\Omen\aoogah.ogg]])
local floor, format = floor, format
local tinsert, tremove, next, sort, wipe = tinsert, tremove, next, sort, wipe
local UnitDetailedThreatSituation = UnitDetailedThreatSituation
local UnitExists, UnitGUID, UnitName, UnitClass = UnitExists, UnitGUID, UnitName, UnitClass
local UnitExists, UnitGUID, UnitName, UnitClass, UnitHealth = UnitExists, UnitGUID, UnitName, UnitClass, UnitHealth
local UnitIsPlayer, UnitPlayerControlled, UnitCanAttack = UnitIsPlayer, UnitPlayerControlled, UnitCanAttack
local GetNumRaidMembers, GetNumPartyMembers = GetNumRaidMembers, GetNumPartyMembers
@@ -78,6 +78,7 @@ local defaults = {
VGrip1 = 85,
VGrip2 = 115,
UseFocus = false,
IgnorePlayerPets = true,
Background = {
Texture = "Blizzard Parchment",
BorderTexture = "Blizzard Dialog",
@@ -1205,10 +1206,12 @@ function Omen:FindThreatMob()
name2 = UnitName(mob)
guidNameLookup[UnitGUID(mob)] = name2
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
if not UnitIsPlayer(mob) and UnitCanAttack("player", mob) and UnitHealth(mob) > 0 then
if not db.IgnorePlayerPets or not UnitPlayerControlled(mob) then
self.TitleText:SetText(name2)
self.unitID = mob
return mob
end
end
end
end
@@ -1721,6 +1724,16 @@ local options = {
if value then LDBIcon:Show("Omen") else LDBIcon:Hide("Omen") end
end,
},
IgnorePlayerPets = {
type = "toggle",
name = L["Ignore Player Pets"],
desc = L["IGNORE_PLAYER_PETS_DESC"],
order = 11,
set = function(info, value)
db.IgnorePlayerPets = value
Omen:UpdateBars()
end,
},
Autocollapse = {
type = "toggle",
name = L["Autocollapse"],