The bar hides now in pet combat
Mikeprod [11-24-16 - 11:54]
The bar hides now in pet combat
diff --git a/XIV_Databar.toc b/XIV_Databar.toc
index 5223226..9d936ab 100644
--- a/XIV_Databar.toc
+++ b/XIV_Databar.toc
@@ -1,7 +1,7 @@
## Interface: 70100
## Title: XIV_Databar
## Author: |cffbbbbbbMille|cff990000XIV|r
-## Version: 2.0.13
+## Version: 2.0.13.1
## Notes: Adds a bottombar by the request of |cffffffffu/sammojo|r on Reddit, Icons made by |cffffffffu/sammojo|r. Previously maintained by |cff00FF99Saxitoxin|r.
## SavedVariables: TEST_CONFIG, XIVBarDB
## X-Issues: https://github.com/MilleXIV/XIV_Databar/issues
diff --git a/core.lua b/core.lua
index 3a8986c..6a5c1e7 100644
--- a/core.lua
+++ b/core.lua
@@ -202,11 +202,24 @@ end
function XIVBar:HideBarEvent()
local bar = self:GetFrame("bar")
+ bar:UnregisterAllEvents()
+ bar.OnEvent = nil
+ bar:RegisterEvent("PET_BATTLE_OPENING_START")
+ bar:RegisterEvent("PET_BATTLE_CLOSE")
+ bar:SetScript("OnEvent", function(_, event, ...)
+ if event=="PET_BATTLE_OPENING_START" and XIV_Databar:IsVisible() then
+ XIV_Databar:Hide()
+ end
+ if event=="PET_BATTLE_CLOSE" and not XIV_Databar:IsVisible() then
+ XIV_Databar:Show()
+ end
+ end)
+
if self.db.profile.general.barCombatHide then
bar:RegisterEvent("PLAYER_REGEN_ENABLED")
bar:RegisterEvent("PLAYER_REGEN_DISABLED")
- bar:SetScript("OnEvent", function(_, event, ...)
+ bar:HookScript("OnEvent", function(_, event, ...)
if event=="PLAYER_REGEN_DISABLED" and XIV_Databar:IsVisible() then
XIV_Databar:Hide()
end
@@ -215,9 +228,11 @@ function XIVBar:HideBarEvent()
end
end)
else
- bar:UnregisterEvent("PLAYER_REGEN_ENABLED")
- bar:UnregisterEvent("PLAYER_REGEN_DISABLED")
- bar.OnEvent = nil
+ if bar:IsEventRegistered("PLAYER_REGEN_ENABLED") then
+ bar:UnregisterEvent("PLAYER_REGEN_ENABLED")
+ elseif bar:IsEventRegistered("PLAYER_REGEN_DISABLED") then
+ bar:UnregisterEvent("PLAYER_REGEN_DISABLED")
+ end
end
end