diff --git a/.pkgmeta b/.pkgmeta
index 4ee30f2..8f8323e 100644
--- a/.pkgmeta
+++ b/.pkgmeta
@@ -37,6 +37,9 @@ externals:
libs/AceLocale-3.0:
url: svn://svn.wowace.com/wow/ace3/mainline/trunk/AceLocale-3.0
tag: latest
+ libs/AceHook-3.0:
+ url: svn://svn.wowace.com/wow/ace3/mainline/trunk/AceHook-3.0
+ tag: latest
libs/LibRangeCheck-2.0:
url: https://github.com/WeakAuras/LibRangeCheck-2.0/
libs/LibSharedMedia-3.0:
diff --git a/IceCore.lua b/IceCore.lua
index e2d1de7..ec82c30 100644
--- a/IceCore.lua
+++ b/IceCore.lua
@@ -284,6 +284,8 @@ function IceCore.prototype:Enable(userToggle)
self.IceHUDFrame:RegisterEvent("ZONE_CHANGED")
end
self.IceHUDFrame:RegisterEvent("UNIT_AURA")
+ self.IceHUDFrame:RegisterEvent("PLAYER_REGEN_ENABLED", IceHUD.PLAYER_REGEN_ENABLED)
+ self.IceHUDFrame:RegisterEvent("PLAYER_REGEN_DISABLED", IceHUD.PLAYER_REGEN_DISABLED)
self.IceHUDFrame:SetScript("OnEvent", function(self, event, ...)
if (event == "PET_BATTLE_OPENING_START") then
if IceHUD.IceCore.settings.bHideDuringPetBattles then
diff --git a/IceHUD.lua b/IceHUD.lua
index 88843a1..8ceedcf 100644
--- a/IceHUD.lua
+++ b/IceHUD.lua
@@ -1,5 +1,5 @@
local L = LibStub("AceLocale-3.0"):GetLocale("IceHUD", false)
-IceHUD = LibStub("AceAddon-3.0"):NewAddon("IceHUD", "AceConsole-3.0")
+IceHUD = LibStub("AceAddon-3.0"):NewAddon("IceHUD", "AceConsole-3.0", "AceHook-3.0")
local IceHUD = IceHUD
@@ -963,3 +963,53 @@ UIDropDownMenu_Initialize(IceHUD_UnitFrame_DropDown, function()
UnitPopup_ShowMenu(IceHUD_UnitFrame_DropDown, menu, IceHUD.DropdownUnit, nil, id)
end
end, "MENU", nil)
+
+function IceHUD:OutOfCombatWrapper(func)
+ return function(...)
+ return IceHUD:RunOnLeaveCombat(func, ...)
+ end
+end
+
+do
+ local in_combat = false
+ local in_lockdown = false
+ local actions_to_perform = {}
+ local pool = setmetatable({}, {__mode='k'})
+ function IceHUD:PLAYER_REGEN_ENABLED()
+ in_combat = false
+ in_lockdown = false
+ for i, t in ipairs(actions_to_perform) do
+ t.f(unpack(t, 1, t.n))
+ actions_to_perform[i] = nil
+ wipe(t)
+ pool[t] = true
+ end
+ end
+ function IceHUD:PLAYER_REGEN_DISABLED()
+ in_combat = true
+ end
+ function IceHUD:RunOnLeaveCombat(func, ...)
+ if not in_combat then
+ -- out of combat, call right away and return
+ func(...)
+ return
+ end
+ if not in_lockdown then
+ in_lockdown = InCombatLockdown() -- still in PLAYER_REGEN_DISABLED
+ if not in_lockdown then
+ func(...)
+ return
+ end
+ end
+ local t = next(pool) or {}
+ pool[t] = nil
+
+ t.f = func
+ local n = select('#', ...)
+ t.n = n
+ for i = 1, n do
+ t[i] = select(i, ...)
+ end
+ actions_to_perform[#actions_to_perform+1] = t
+ end
+end
diff --git a/changelog.md b/changelog.md
index 495658d..8671ab4 100644
--- a/changelog.md
+++ b/changelog.md
@@ -1,5 +1,9 @@
# Changelog
+v1.14.1:
+
+- Fix Hide Party feature on pre-10.0 clients.
+
v1.14.0:
- 10.0 compatibility
diff --git a/embeds.xml b/embeds.xml
index 3dd90df..e86c65f 100644
--- a/embeds.xml
+++ b/embeds.xml
@@ -11,6 +11,7 @@
+
diff --git a/modules/PlayerHealth.lua b/modules/PlayerHealth.lua
index 59d7715..7a4f77f 100644
--- a/modules/PlayerHealth.lua
+++ b/modules/PlayerHealth.lua
@@ -1418,6 +1418,44 @@ function PlayerHealth.prototype:HideBlizz()
PlayerFrame:SetParent(self.PlayerFrameParent)
end
+local parents = {}
+local hide_frame = IceHUD:OutOfCombatWrapper(function(self) self:Hide() end)
+
+local function hook_frames(...)
+ for i = 1, select("#", ...) do
+ local frame = select(i, ...)
+ frame:UnregisterAllEvents()
+ if not IceHUD:IsHooked(frame, "OnShow") then
+ IceHUD:SecureHookScript(frame, "OnShow", hide_frame)
+ end
+ frame:Hide()
+ end
+end
+
+local function unhook_frame(frame)
+ if IceHUD:IsHooked(frame, "OnShow") then
+ IceHUD:Unhook(frame, "OnShow")
+ local parent = parents[frame]
+ if parent then
+ frame:SetParent(parent)
+ end
+ elseif IceHUD:IsHooked(frame, "Show") then
+ IceHUD:Unhook(frame, "Show")
+ IceHUD:Unhook(frame, "SetPoint")
+ end
+end
+
+local function unhook_frames(...)
+ for i = 1, select("#", ...) do
+ local frame = select(i, ...)
+ unhook_frame(frame)
+ local handler = frame:GetScript("OnLoad")
+ if handler then
+ handler(frame)
+ end
+ end
+end
+
function PlayerHealth.prototype:HideBlizzardParty()
if self.combat then
self.pendingBlizzardPartyHide = true
diff --git a/this_version.md b/this_version.md
index 33426cc..a9b9035 100644
--- a/this_version.md
+++ b/this_version.md
@@ -1,5 +1,9 @@
# Changelog
+v1.14.1:
+
+- Fix Hide Party feature on pre-10.0 clients.
+
v1.14.0:
- 10.0 compatibility