Thread Tools Display Modes
10-03-20, 07:49 AM   #1
cokedrivers
A Rage Talon Dragon Guard
 
cokedrivers's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2009
Posts: 325
Boss Frame Error

Eveytime im in a instance i get this error when ever a boss is engaged.
Code:
15x [ADDON_ACTION_BLOCKED] AddOn 'BasicUI' tried to call the protected function 'Boss2TargetFrame:Hide()'.
[string "@!BugGrabber\BugGrabber.lua"]:519: in function <!BugGrabber\BugGrabber.lua:519>
[string "=[C]"]: in function `Hide'
[string "@FrameXML\TargetFrame.lua"]:112: in function `TargetFrame_Update'
[string "@FrameXML\TargetFrame.lua"]:178: in function `OnEvent'
[string "@FrameXML\UnitFrame.lua"]:917: in function <FrameXML\UnitFrame.lua:915>
I have done a ccouple of things to the frame but its just apperance changes here is the code.
Code:
	--[[ Unit Font Style ]]--
	----------------------------------------------------------
	local shorts = {
		{ 1e10, 1e9, "%.0fB" }, --  10b+ as  12B
		{  1e9, 1e9, "%.1fB" }, --   1b+ as 8.3B
		{  1e7, 1e6, "%.0fM" }, --  10m+ as  14M
		{  1e6, 1e6, "%.1fM" }, --   1m+ as 7.4M
		{  1e5, 1e3, "%.0fK" }, -- 100k+ as 840K
		{  1e3, 1e3, "%.1fK" }, --   1k+ as 2.5K
		{    0,   1,    "%d" }, -- < 1k  as  974
	}
	for i = 1, #shorts do
		shorts[i][4] = shorts[i][3] .. " (%.0f%%)"
	end

	hooksecurefunc("TextStatusBar_UpdateTextStringWithValues", function(statusBar, textString, value, valueMin, valueMax)
		if value == 0 then
			return textString:SetText("")
		end

		local style = GetCVar("statusTextDisplay")
		if style == "PERCENT" then
			return textString:SetFormattedText("%.0f%%", value / valueMax * 100)
		end
		for i = 1, #shorts do
			local t = shorts[i]
			if value >= t[1] then
				if style == "BOTH" then
					return textString:SetFormattedText(t[4], value / t[2], value / valueMax * 100)
				else
					if value < valueMax then
						for j = 1, #shorts do
							local v = shorts[j]
							if valueMax >= v[1] then
								return textString:SetFormattedText(t[3] .. " / " .. v[3], value / t[2], valueMax / v[2])
							end
						end
					end
					return textString:SetFormattedText(t[3], value / t[2])
				end
			end
		end
	end)
	----------------------------------------------------------

	--[[ Unit Font Color ]]--
	----------------------------------------------------------

	hooksecurefunc("UnitFrame_Update", function(self, isParty)
		if not self.name or not self:IsShown() then return end

		local PET_COLOR = { r = 157/255, g = 197/255, b = 255/255 }
		local unit, color = self.unit
		if UnitPlayerControlled(unit) then
			if UnitIsPlayer(unit) then
				color = RAID_CLASS_COLORS[select(2, UnitClass(unit))]
			else
				color = PET_COLOR
			end
		elseif UnitIsDeadOrGhost(unit) then
			color = GRAY_FONT_COLOR
		else
			color = FACTION_BAR_COLORS[UnitIsEnemy(unit, "player") and 1 or UnitReaction(unit, "player") or 5]
		end

		if not color then
			color = (CUSTOM_CLASS_COLORS or RAID_CLASS_COLORS)["PRIEST"]
		end

		self.name:SetTextColor(color.r, color.g, color.b)
		if isParty then
			self.name:SetText(GetUnitName(self.overrideName or unit))
		end
	end)
	----------------------------------------------------------


	--[[ Unit Name Background Color ]]--
	----------------------------------------------------------
	for _, region in pairs({
		TargetFrameNameBackground,
		FocusFrameNameBackground,
		Boss1TargetFrameNameBackground, 
		Boss2TargetFrameNameBackground, 
		Boss3TargetFrameNameBackground, 
		Boss4TargetFrameNameBackground,
		Boss5TargetFrameNameBackground, 
		
	}) do
		region:SetColorTexture(0, 0, 0, 0.5)
	end
	----------------------------------------------------------


	--[[ Unit Name Font Size ]]--
	----------------------------------------------------------
	for _, names in pairs({
		PlayerName,
		TargetFrameTextureFrameName,
		FocusFrameTextureFrameName,
	}) do
		names:SetFont(db.UnitframeFont, 16)

	end
	----------------------------------------------------------


	--[[ Unit Level Text Centering ]]--
	----------------------------------------------------------
	-- PlayerFrame
	hooksecurefunc("PlayerFrame_UpdateLevelTextAnchor", function(level)
	  if ( level >= 100 ) then
		PlayerLevelText:SetPoint("CENTER", PlayerFrameTexture, "CENTER", -61, -16);
	  else
		PlayerLevelText:SetPoint("CENTER", PlayerFrameTexture, "CENTER", -62, -16);
	  end
	end)

	-- TargetFrame
	hooksecurefunc("TargetFrame_UpdateLevelTextAnchor",  function(self, targetLevel)
	  if ( targetLevel >= 100 ) then
		self.levelText:SetPoint("CENTER", 62, -16);
	  else
		self.levelText:SetPoint("CENTER", 62, -16);
	  end
	end)



	--[[ Castbar Scaling ]]--
	----------------------------------------------------------
	-- Player Castbar
	CastingBarFrame:SetScale(db.UnitScale)
	--CastingBarFrame:ClearAllPoints()
	--CastingBarFrame:SetPoint("CENTER", UIParent, "CENTER", 0, 0)

	-- Target Castbar
	Target_Spellbar_AdjustPosition = function() end
	TargetFrameSpellBar:SetParent(UIParent)
	TargetFrameSpellBar:ClearAllPoints()
	TargetFrameSpellBar:SetPoint("CENTER", UIParent, "CENTER", 0, 40)
	TargetFrameSpellBar:SetScale(2)
	TargetFrameSpellBar:SetScript("OnShow", nil)

	----------------------------------------------------------


	--[[ Main Unit Frames Scaling ]]--
	----------------------------------------------------------
	for _, frames in pairs({
		PlayerFrame,
		TargetFrame,
		FocusFrame,
	}) do
		frames:SetScale(db.UnitScale)
	end
	----------------------------------------------------------


	--[[ Party Member Frame Scaling ]]--
	----------------------------------------------------------
	for i = 1, MAX_PARTY_MEMBERS do
		_G["PartyMemberFrame"..i]:SetScale(db.UnitScale)
	end
	----------------------------------------------------------


	--[[ Arena Frames Scaling ]]--
	----------------------------------------------------------
	--local function ScaleArenaFrames()
		--for i = 1, MAX_ARENA_ENEMIES do
			--_G["ArenaPrepFrame"..i]:SetScale(db.UnitScale)
			--_G["ArenaEnemyFrame"..i]:SetScale(db.UnitScale)
		--end
	--end

	--if IsAddOnLoaded("Blizzard_ArenaUI") then
		--ScaleArenaFrames()
	--else
		--local f = CreateFrame("Frame")
		--f:RegisterEvent("ADDON_LOADED")
		--f:SetScript("OnEvent", function(self, event, addon)
			--if addon == "Blizzard_ArenaUI" then
				--self:UnregisterEvent(event)
				--ScaleArenaFrames()
			--end
		--end)
	--end
	----------------------------------------------------------


	--[[ Boss Frames Scaling ]]--
	----------------------------------------------------------
	for i = 1, MAX_BOSS_FRAMES do
		_G["Boss"..i.."TargetFrame"]:SetScale(db.UnitScale)
	end
	----------------------------------------------------------
end
I am not showing nor am i hiding the frame why do i keep getting this error?
Could it be do to the MAX_BOSS_FRAMES?
If so what would be a better call?

Thanks in advance for any help.
  Reply With Quote
10-03-20, 10:33 AM   #2
Kanegasi
A Molten Giant
 
Kanegasi's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2007
Posts: 666
The secure part of the UI is very sensitive. If you do anything that involves or even touches any part that is clickable, such as moving and sizing, it taints the entire thing. Even messing with the aura icons taint the boss frames, since the auras are in the chain of anchored frames around the minimap.
  Reply With Quote
10-03-20, 05:44 PM   #3
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,313
When it comes to the buff frames spreading taint, that's likely through the UIParent's Frame Position Manager. It's secure code in charge of shuffling frames around based on what's shown, including ActionBars too. However, I don't think that's the angle this taint error is coming from.

My suspicion is pointing at the replacement of Target_Spellbar_AdjustPosition(). I don't see anywhere in the execution path to suggest it, but in my experience, the taint system itself is horribly bugged and that's the only line I see that would even generate taint.
__________________
WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)
  Reply With Quote
10-04-20, 09:04 AM   #4
cokedrivers
A Rage Talon Dragon Guard
 
cokedrivers's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2009
Posts: 325
Originally Posted by SDPhantom View Post
When it comes to the buff frames spreading taint, that's likely through the UIParent's Frame Position Manager. It's secure code in charge of shuffling frames around based on what's shown, including ActionBars too. However, I don't think that's the angle this taint error is coming from.

My suspicion is pointing at the replacement of Target_Spellbar_AdjustPosition(). I don't see anywhere in the execution path to suggest it, but in my experience, the taint system itself is horribly bugged and that's the only line I see that would even generate taint.
Did some investigating and found this in the TargetFrame.lua..
Lua Code:
  1. function Target_Spellbar_AdjustPosition(self)
  2.     local parentFrame = self:GetParent();
  3.     if ( self.boss ) then
  4.         self:SetPoint("TOPLEFT", parentFrame, "BOTTOMLEFT", 25, 10 );
  5.     elseif ( parentFrame.haveToT ) then
  6.         if ( parentFrame.buffsOnTop or parentFrame.auraRows <= 1 ) then
  7.             self:SetPoint("TOPLEFT", parentFrame, "BOTTOMLEFT", 25, -21 );
  8.         else
  9.             self:SetPoint("TOPLEFT", parentFrame.spellbarAnchor, "BOTTOMLEFT", 20, -15);
  10.         end
  11.     elseif ( parentFrame.haveElite ) then
  12.         if ( parentFrame.buffsOnTop or parentFrame.auraRows <= 1 ) then
  13.             self:SetPoint("TOPLEFT", parentFrame, "BOTTOMLEFT", 25, -5 );
  14.         else
  15.             self:SetPoint("TOPLEFT", parentFrame.spellbarAnchor, "BOTTOMLEFT", 20, -15);
  16.         end
  17.     else
  18.         if ( (not parentFrame.buffsOnTop) and parentFrame.auraRows > 0 ) then
  19.             self:SetPoint("TOPLEFT", parentFrame.spellbarAnchor, "BOTTOMLEFT", 20, -15);
  20.         else
  21.             self:SetPoint("TOPLEFT", parentFrame, "BOTTOMLEFT", 25, 7 );
  22.         end
  23.     end
  24. end

I noticed this Target_Spellbar_AdjustPosition(self) and mine was Target_Spellbar_AdjustPosition() so i added the self and now I'm going to see if this stops the taint.

Thanks for the suggestion.

EDIT: No go still got the taint so i guess its something ill have to just ignore.

Last edited by cokedrivers : 10-04-20 at 09:29 AM.
  Reply With Quote
10-04-20, 01:54 PM   #5
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,313
The arguments the new function takes is irrelevant to the taint system. It's merely the fact you're replacing the old one.

Instead of overwriting the function, I would secure hook it.
Lua Code:
  1. hooksecurefunc("Target_Spellbar_AdjustPosition", function(self)
  2.     if self == TargetFrameSpellBar then
  3.         self:ClearAllPoints()
  4.         self:SetPoint("CENTER", UIParent, "CENTER", 0, 40)
  5.     end
  6. end)
This should cause the TargetFrameSpellBar to snap back to the position you set whenever the function runs, without causing taint.
__________________
WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)
  Reply With Quote
10-05-20, 02:38 PM   #6
gmarco
An Onyxian Warder
 
gmarco's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2009
Posts: 362
Hi,

I have tried the SDPhantom code to fix an issue I got since long time very similar to the one is having cokedrivers.

I had this code in my addon:

Lua Code:
  1. TargetFrameSpellBar:ClearAllPoints()
  2. TargetFrameSpellBar:SetPoint("CENTER", UIParent, "CENTER",0,-30)
  3. TargetFrameSpellBar.SetPoint = function() end
  4. TargetFrameSpellBar:SetScale(2.0)
  5. TargetFrameSpellBar.Icon:SetAlpha(0)
  6. TargetFrameSpellBar.BorderShield:SetAlpha(0)

The position of the target casting bar is correct but I got one error often when I start a (multi)boss .

If I remove this code and I use this:

Lua Code:
  1. hooksecurefunc("Target_Spellbar_AdjustPosition", function(self)
  2.             if self == TargetFrameSpellBar then
  3.                 self:ClearAllPoints()
  4.                 self:SetPoint("CENTER", UIParent, "CENTER", 0, -30)
  5.                 -- self.SetPoint = function() end
  6.                 self:SetScale(2.0)
  7.                 self.Icon:SetAlpha(0)
  8.                 self.BorderShield:SetAlpha(0)              
  9.             end
  10.         end)

When castbar appear for the first time it is in the wrong place but in the middle of the cast it goes in center position as I wanted.
The next castbars are put in the right position always.

If I use this:

Lua Code:
  1. self.SetPoint = function() end

No castbar appears (probably because wow doesn't show any un-anchored frame).

Here is a demo:

https://streamable.com/2vi6su

Any idea ?

Thanks for any help.
__________________
This is Unix-Land. In quiet nights, you can hear the Windows machines reboot.
  Reply With Quote
10-05-20, 03:31 PM   #7
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,313
Looks like it's also running from the OnShow handler on the template. You'll have to update the pointer after you hook the function. Since the hook is made to only apply to that one castbar, you only need to update the function pointer on that one.
Code:
TargetFrameSpellBar:SetScript("OnShow",Target_Spellbar_AdjustPosition);
Note: The original function only repositions the anchor. Race conditions may happen if you start putting other modifications in there.
__________________
WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)

Last edited by SDPhantom : 10-05-20 at 03:39 PM.
  Reply With Quote
10-05-20, 03:46 PM   #8
gmarco
An Onyxian Warder
 
gmarco's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2009
Posts: 362
Hi SDPhantom,

thanks so much for your help.

It seems that it works nicely.
I have also moved the code out of the reposition function as you suggest.


Lua Code:
  1. -- CastBars
  2. hooksecurefunc("Target_Spellbar_AdjustPosition", function(self)
  3.     if self == TargetFrameSpellBar then
  4.         self:ClearAllPoints()
  5.         self:SetPoint("CENTER", UIParent, "CENTER", 0, -30)    
  6.     end
  7. end)       
  8.  
  9. TargetFrameSpellBar:SetScale(2.0)
  10. TargetFrameSpellBar.Icon:SetAlpha(0)
  11. TargetFrameSpellBar.BorderShield:SetAlpha(0)       
  12. TargetFrameSpellBar:SetScript("OnShow",Target_Spellbar_AdjustPosition)

Thanks again so much ...
__________________
This is Unix-Land. In quiet nights, you can hear the Windows machines reboot.
  Reply With Quote
10-06-20, 06:30 AM   #9
cokedrivers
A Rage Talon Dragon Guard
 
cokedrivers's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2009
Posts: 325
Originally Posted by SDPhantom View Post
The arguments the new function takes is irrelevant to the taint system. It's merely the fact you're replacing the old one.

Instead of overwriting the function, I would secure hook it.
Lua Code:
  1. hooksecurefunc("Target_Spellbar_AdjustPosition", function(self)
  2.     if self == TargetFrameSpellBar then
  3.         self:ClearAllPoints()
  4.         self:SetPoint("CENTER", UIParent, "CENTER", 0, 40)
  5.     end
  6. end)
This should cause the TargetFrameSpellBar to snap back to the position you set whenever the function runs, without causing taint.
Thank You no more errors when a boss frame shows.

Here is the code that works for me:
Lua Code:
  1. -- Target Castbar  
  2.     hooksecurefunc("Target_Spellbar_AdjustPosition", function(self)
  3.         if self == TargetFrameSpellBar then
  4.             self:ClearAllPoints()
  5.             self:SetPoint("CENTER", UIParent, "CENTER", 0, 40)
  6.         end
  7.     end)
  8.     TargetFrameSpellBar:SetScript("OnShow", Target_Spellbar_AdjustPosition)
  9.     TargetFrameSpellBar:SetScale(2)
  Reply With Quote
10-11-20, 04:17 AM   #10
gmarco
An Onyxian Warder
 
gmarco's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2009
Posts: 362
Hi all,

today I go in a m+ and suddendly I got this error:

Lua Code:
  1. 2x [ADDON_ACTION_BLOCKED] AddOn 'gmUnitframes' tried to call the protected function 'Boss2TargetFrame:Hide()'.
  2. [string "@!BugGrabber\BugGrabber.lua"]:519: in function <!BugGrabber\BugGrabber.lua:519>
  3. [string "=[C]"]: in function `Hide'
  4. [string "@FrameXML\TargetFrame.lua"]:112: in function `TargetFrame_Update'
  5. [string "@FrameXML\TargetFrame.lua"]:178: in function `OnEvent'
  6. [string "@FrameXML\UnitFrame.lua"]:917: in function <FrameXML\UnitFrame.lua:915>

The only part of the code where I touch the BossX settings is this:

Lua Code:
  1. for i = 1, 5 do
  2.             local f = _G["Boss"..i.."TargetFrame"]
  3.             f:SetParent(UIParent)
  4.         end
  5.        
  6.         for i = 2, 5 do
  7.             _G["Boss"..i.."TargetFrame"]:SetPoint("TOPLEFT", _G["Boss"..(i-1).."TargetFrame"], "BOTTOMLEFT", 0, 0)
  8.         end

But it should not taint I think.

Any idea ?

I attach the whole addon code (core.lua) to help.

Thanks.
Attached Files
File Type: lua core.lua (10.8 KB, 185 views)
__________________
This is Unix-Land. In quiet nights, you can hear the Windows machines reboot.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Boss Frame Error

Thread Tools
Display Modes

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