mirror of
https://github.com/parnic/breakables.git
synced 2025-06-16 17:40:13 -05:00
Add option to hide during pet battles, by request
This commit is contained in:
@ -245,6 +245,7 @@ function Breakables:OnInitialize()
|
||||
hideEqManagerItems = true,
|
||||
hide = false,
|
||||
hideInCombat = false,
|
||||
hideInPetBattle = true,
|
||||
buttonScale = 1,
|
||||
fontSize = 11,
|
||||
growDirection = 2,
|
||||
@ -390,6 +391,11 @@ function Breakables:RegisterEvents()
|
||||
if CanPickLock then
|
||||
self:RegisterEvent("CHAT_MSG_OPENING", "OnBagItemLockPicked")
|
||||
end
|
||||
|
||||
if UnitCanPetBattle then
|
||||
self:RegisterEvent("PET_BATTLE_OPENING_START", "PetBattleStarted")
|
||||
self:RegisterEvent("PET_BATTLE_OVER", "PetBattleEnded")
|
||||
end
|
||||
end
|
||||
|
||||
function Breakables:OnModifierChanged()
|
||||
@ -458,6 +464,16 @@ function Breakables:OnBagItemLockPicked()
|
||||
self:FindBreakables()
|
||||
end
|
||||
|
||||
function Breakables:PetBattleStarted()
|
||||
if self.settings.hideInPetBattle then
|
||||
self:ToggleButtonFrameVisibility(false)
|
||||
end
|
||||
end
|
||||
|
||||
function Breakables:PetBattleEnded()
|
||||
self:ToggleButtonFrameVisibility(true)
|
||||
end
|
||||
|
||||
function Breakables:FindLevelOfProfessionIndex(idx)
|
||||
if idx ~= nil then
|
||||
local name, texture, rank, maxRank, numSpells, spelloffset, skillLine = GetProfessionInfo(idx)
|
||||
@ -761,6 +777,24 @@ function Breakables:GetOptions()
|
||||
end
|
||||
end
|
||||
|
||||
if UnitCanPetBattle then
|
||||
opts.args.hideInPetBattle = {
|
||||
type = "toggle",
|
||||
name = L["Hide during pet battles"],
|
||||
desc = L["Whether or not to hide the breakables bar when you enter a pet battle."],
|
||||
get = function(info)
|
||||
return self.settings.hideInPetBattle
|
||||
end,
|
||||
set = function(info, v)
|
||||
self.settings.hideInPetBattle = v
|
||||
if info.uiType == "cmd" then
|
||||
print("|cff33ff99Breakables|r: set |cffffff78hideInPetBattle|r to " .. tostring(self.settings.hideInPetBattle))
|
||||
end
|
||||
end,
|
||||
order = 3.5,
|
||||
}
|
||||
end
|
||||
|
||||
return opts
|
||||
end
|
||||
|
||||
|
Reference in New Issue
Block a user