I've also tried something like this:
Lua Code:
------------------------------------------
-- Variable
------------------------------------------
local LSM = LibStub("LibSharedMedia-3.0");
local fontA = LSM:Fetch("font", "fontA");
local textureB = LSM:Fetch("statusbar", "textureB");
local UpdateMedia;
local CreateAuraFrame;
local CreateHealthText;
local OnEvent;
------------------------------------------
-- Function
------------------------------------------
function UpdateMedia(nameplate)
local unitFrame = nameplate.UnitFrame;
local name = unitFrame.name;
if (name) then
name:SetFont(fontA, 14, "OUTLINE");
end
local healthBar = unitFrame.healthBar;
if (healthBar) then
healthBar:SetStatusBarTexture(textureB);
end
local castBar = unitFrame.castBar;
if (castBar) then
castBar._SetStatusBarTexture = castBar.SetStatusBarTexture;
castBar:SetStatusBarTexture(textureB);
castBar.SetStatusBarTexture = function(...) end;
castBar.Text:SetFont(fontA, 12, "OUTLINE");
end
end
function OnEvent(self, event, ...)
if (event == "NAME_PLATE_CREATED") then
local nameplate = ...;
if (nameplate and nameplate.UnitFrame) then
UpdateMedia(nameplate);
-- CreateAuraFrame(nameplate);
-- CreateHealthText(nameplate);
end
end
end
local handler = CreateFrame("Frame");
handler:RegisterEvent("NAME_PLATE_CREATED");
handler:RegisterEvent("NAME_PLATE_UNIT_ADDED");
handler:RegisterEvent("NAME_PLATE_UNIT_REMOVED");
handler:SetScript("OnEvent", OnEvent);
So, on nameplate creation, the
SetStatusBarTexture is backed up with a name
_SetStatusBarTexture, call
SetStatusBarTexture then
SetStatusBarTexture is now set to empty function.
This worked fine when the player is not in the combat, but once the player is in the combat, it causes the following error.
Code:
1x [ADDON_ACTION_BLOCKED] AddOn 'LyakNameplate' tried to call the protected function 'SetTargetClampingInsets()'
Would there be any secure way to tweak the texture of nameplate's castbar...?