Thread Tools Display Modes
11-28-14, 07:23 AM   #1
DerBob
A Murloc Raider
Join Date: Aug 2007
Posts: 5
PlayerFrame bugs after /reload

I'm using a modified version of whoaunitframes. All seems to work fine until I do a /reload. After that /reload the PlayerFrameHealthBar is not updating anymore. It is just full all the time. The text value on it still updates correctly though.

This is the responsible function:
Code:
function whoa_playerFrame()
    if not UnitHasVehicleUI("player") then
        PlayerName:SetWidth(0.01)
        PlayerFrameGroupIndicatorText:ClearAllPoints()
        PlayerFrameGroupIndicatorText:SetPoint("BOTTOMLEFT", PlayerFrame, "TOP", 0, -20)
        PlayerFrameGroupIndicatorLeft:Hide()
        PlayerFrameGroupIndicatorMiddle:Hide()
        PlayerFrameGroupIndicatorRight:Hide()
		PlayerFrameGroupIndicator.Show = function() return end
        PlayerFrameHealthBar:ClearAllPoints()
        PlayerFrameHealthBar:SetPoint("TOPLEFT", 106, -24)
        PlayerFrameHealthBar:SetHeight(26)
        if classcolor and config.classColorPlayer then
            PlayerFrameHealthBar:SetStatusBarColor(classcolor.r, classcolor.g, classcolor.b)
            PlayerFrameHealthBar.lockColor = true
        else
            color = FACTION_BAR_COLORS[8] -- 8 is exalted
            if color then
                PlayerFrameHealthBar:SetStatusBarColor(color.r, color.g, color.b)
                PlayerFrameHealthBar.lockColor = true
            end
        end
        PlayerFrameHealthBarText:ClearAllPoints()
        PlayerFrameHealthBarText:SetPoint("CENTER", PlayerFrameHealthBar, "CENTER", 0, 0)
        PlayerFrameManaBar:ClearAllPoints()
        PlayerFrameManaBar:SetPoint("TOPLEFT", 106, -52)
        PlayerFrameManaBar:SetHeight(13)
        PlayerFrameManaBarText:ClearAllPoints()
        PlayerFrameManaBarText:SetPoint("CENTER", PlayerFrameManaBar, "CENTER", 0, 0)
		-- Disable healing/damage spam over player & pet unit frame
		PlayerHitIndicator:SetText(nil)
		PlayerHitIndicator.SetText = function() end
		PetHitIndicator:SetText(nil)
		PetHitIndicator.SetText = function() end
    else
        if config.classColorPlayer then
            color = FACTION_BAR_COLORS[8] -- 8 is exalted
            if color then
                PlayerFrameHealthBar:SetStatusBarColor(color.r, color.g, color.b)
                PlayerFrameHealthBar.lockColor = true
            end
        end
        PlayerFrameHealthBar:SetHeight(12)
        PlayerFrameManaBar:SetHeight(12)
    end
	PlayerPVPIcon:SetAlpha(0)
end
hooksecurefunc("PlayerFrame_UpdateArt", whoa_playerFrame)
hooksecurefunc("PlayerFrame_SequenceFinished", whoa_playerFrame)

local w = CreateFrame("Frame")
w:RegisterEvent("PLAYER_ENTERING_WORLD")
w:RegisterEvent("PLAYER_REGEN_ENABLED")
w:RegisterEvent("PLAYER_TARGET_CHANGED")
w:RegisterEvent("PLAYER_FOCUS_CHANGED")
w:RegisterEvent("PLAYER_ALIVE")
w:RegisterEvent("PLAYER_UNGHOST")
w:RegisterEvent("CVAR_UPDATE")
w:RegisterEvent("GROUP_ROSTER_UPDATE")
w:RegisterEvent("UNIT_FACTION")
w:RegisterEvent("UNIT_HEALTH")
w:RegisterEvent("UNIT_POWER")
if config.classColorParty then
    w:RegisterEvent("PARTY_MEMBERS_CHANGED")
end
function w:OnEvent(event, ...)
    if event == "PLAYER_ENTERING_WORLD" then
        SlashCmdList['RELOAD'] = function() ReloadUI() end
        SLASH_RELOAD1 = '/rl'
        whoa_playerFrame()
        whoa_targetFrame()
        whoa_focusFrame()
        whoa_totFrame()
        whoa_cvarUpdate()
        whoa_unitText("player")
    elseif event == "PLAYER_REGEN_ENABLED" then
        whoa_playerFrame()
	elseif event == "PLAYER_UNGHOST" or event == "PLAYER_ALIVE" then
		whoa_unitText("player")
    elseif event == "PLAYER_TARGET_CHANGED" then
        whoa_targetChanged()
        whoa_unitText("target")
    elseif event == "PLAYER_FOCUS_CHANGED" then
        whoa_focusChanged()
        whoa_unitText("focus")
	elseif event == "UNIT_FACTION" then
		if arg1 == "focus" then
			whoa_focusChanged()
		end
	elseif event == "GROUP_ROSTER_UPDATE" then
		whoa_focusChanged()
    elseif event == "UNIT_HEALTH" or event == "UNIT_POWER" then
        local unit = ...
        whoa_unitText(unit)
    elseif event == "CVAR_UPDATE" then
        whoa_cvarUpdate()
    elseif event == "PARTY_MEMBERS_CHANGED" then
        whoa_partyMembersChanged()
	end
end
w:SetScript("OnEvent", w.OnEvent)
After the reload it also seems to jump into the else condition of "if not UnitHasVehicleUI("player") then" because the then static healthbar has a height of 12.

Oh, and it does not give me any errors.

Last edited by DerBob : 11-28-14 at 07:28 AM.
  Reply With Quote

WoWInterface » AddOns, Compilations, Macros » AddOn Help/Support » PlayerFrame bugs after /reload


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off