mirror of
https://github.com/parnic/ice-hud.git
synced 2025-06-16 06:40:13 -05:00
Fix error on Classic with Hide Party
I neglected to test the new party-hide implementation on pre-10.0. It was not fully implemented. This implementation is from Pitbull4 and is more complicated than I need, but certainly does the job and allows for some future usage if needed. Fixes wowace ticket #330
This commit is contained in:
3
.pkgmeta
3
.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:
|
||||
|
@ -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
|
||||
|
52
IceHUD.lua
52
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
|
||||
|
@ -1,5 +1,9 @@
|
||||
# Changelog
|
||||
|
||||
v1.14.1:
|
||||
|
||||
- Fix Hide Party feature on pre-10.0 clients.
|
||||
|
||||
v1.14.0:
|
||||
|
||||
- 10.0 compatibility
|
||||
|
@ -11,6 +11,7 @@
|
||||
<Include file="libs\AceConsole-3.0\AceConsole-3.0.xml"/>
|
||||
<Include file="libs\AceAddon-3.0\AceAddon-3.0.xml"/>
|
||||
<Include file="libs\AceLocale-3.0\AceLocale-3.0.xml"/>
|
||||
<Include file="libs\AceHook-3.0\AceHook-3.0.xml"/>
|
||||
<Include file="libs\LibDogTag-3.0\lib.xml"/>
|
||||
<Include file="libs\LibDogTag-Unit-3.0\lib.xml"/>
|
||||
<Script file="libs\LibRangeCheck-2.0\LibRangeCheck-2.0.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
|
||||
|
@ -1,5 +1,9 @@
|
||||
# Changelog
|
||||
|
||||
v1.14.1:
|
||||
|
||||
- Fix Hide Party feature on pre-10.0 clients.
|
||||
|
||||
v1.14.0:
|
||||
|
||||
- 10.0 compatibility
|
||||
|
Reference in New Issue
Block a user