oUF

97.2k Downloads

Blizzard stuff showing when creating personal resource display

LybrialsGit opened this issue ยท 11 comments

commented

Im using version 9.3.1 of oUF and im creating a personal resource display with it.

test

On this picture you can see four bars:

  1. The player health I created
  2. The player class power I created
  3. The blizzard default mana bar (ClassNameplateManaBarFrame)
  4. The blizzard default class power (DeathknightResourceOverlayFrame.Rune1 ... Rune6)

For 3. and 4. I have no idea where they are coming from and how to hide them.
Code is simple:

OUF:RegisterStyle(ADDON_NAME, function(frame, unit)
    LybrialNamePlates:Style(frame, unit);
end);
OUF:SetActiveStyle(ADDON_NAME);

function LybrialNamePlates:Style(nameplate, unit)
    if (unit) then
        nameplate:ClearAllPoints();
        nameplate:SetScaledPoint("CENTER");

        nameplate.Health = self:Health_Create(nameplate);
        nameplate.ClassPower = self:ClassPower_Create(nameplate);
    end
end

function LybrialNamePlates:Health_Create(nameplate)
    local health = FRAMES:CreateFrame("StatusBar", nameplate:GetDebugName() .. "_Health", nameplate);

    health:SetFrameStrata(nameplate:GetFrameStrata());
    health:SetFrameLevel(nameplate:GetFrameLevel() + 1);
    health:SetStatusBarTexture(LSM:Fetch("statusbar", CORE.VALUES.StatusBar.Texture.Default));
    health:CreateTemplateBackdrop();

    health.frequentUpdates = true;
    health.considerSelectionInCombatHostile = true;
    health.UpdateColor = LybrialNamePlates.Health_UpdateColor;

    return health;
end

function LybrialNamePlates:ClassPower_Create(nameplate)
    local classPower = FRAMES:CreateFrame("Frame", nameplate:GetDebugName() .. "_ClassPower", nameplate);

    classPower:SetFrameStrata(nameplate:GetFrameStrata());
    classPower:SetFrameLevel(5);
    classPower:CreateTemplateBackdrop();

    local max = MATH:Max(VALUES.ClassPower[PLAYER.info.class] or 0, _G.MAX_COMBO_POINTS);
    local texture = LSM:Fetch("statusbar", VALUES.StatusBar.Texture.Default);

    for i = 1, max do
        classPower[i] = FRAMES:CreateFrame("StatusBar", nameplate:GetDebugName() .. "_ClassPower_" .. i, classPower);
        classPower[i]:SetFrameStrata(nameplate:GetFrameStrata());
        classPower[i]:SetFrameLevel(6);
        classPower[i]:SetStatusBarTexture(texture);
        classPower[i]:CreateTemplateBackdrop();
    end

    classPower.UpdateColor = LybrialNamePlates.ClassPower_UpdateColor;
    classPower.PostUpdate = LybrialNamePlates.ClassPower_PostUpdate;

    return classPower;
end
commented

You can simply create a new player frame, and make it looks like a player resource bar, which is much more easier.

commented

I'll have to agree with @siweia on this one, use one or the other, not both at the same time (oUF as a replacement to the player resources, or the blizzard one).

commented

Since I can't make this out from the code you posted, I assume you are using ElvUI (https://www.wowinterface.com/downloads/fileinfo.php?id=24889). If so, please ask for help of their forums.

Other than that partial code leads at best to partial guesses. Making your repo publicly accessible would help reproducing your case. Posting snippets here is probably a waste of time.

commented

This is the core addon: https://github.com/LybrialsGit/Lybrial_UI
And this is the nameplates addon: https://github.com/LybrialsGit/Lybrial_NamePlates

Everything under development and not released.

And no, im not using ElvUI.

I deleted Interface and WTF folder and only added those two addons I posted above. Getting the described behavior.

commented

Isn't that the personal resource display?
image

commented

Yes. And when I disable the personal resource display the oUF personal resource display is also no longer showing. And when enabled, the oUF personal resource display is showing + the power and class power of the blizzard default personal player resource.

commented

Could we see the whole code? Why are oUF and Frame in all caps?

commented

Sure, if it helps:

init.lua

-- ------------------------------------------------------------------------
-- > Lybrial UI (Lybrial @ Blackhand EU) <
-- ------------------------------------------------------------------------
-- 
-- NamePlates
--
-- ------------------------------------------------------------------------

-- Lybrial Libraries
local ADDON_NAME = ...;

local LybrialUI = LybrialUI
local Colors = Colors;

LybrialNamePlates = LybrialUI:NewModule(ADDON_NAME, "AceEvent-3.0");

local LybrialNamePlates = LybrialNamePlates;

local CORE, LIBS = LybrialUI:GetCore();

local COLORS = CORE.COLORS;
local PLAYER = CORE.PLAYER;
local UNITS = CORE.UNITS;
local VALUES = CORE.VALUES;

local OUF = LIBS.OUF;

LybrialNamePlates.ADDON_NAME = ADDON_NAME;
LybrialNamePlates.GUIDs = {};
LybrialNamePlates.PLAYER = "_Player";
LybrialNamePlates.PLAYER_ENEMY = "_Player_Enemy";
LybrialNamePlates.PLAYER_FRIEND = "_Player_Friend";
LybrialNamePlates.NPC_ENEMY = "_NPC_Enemy";
LybrialNamePlates.NPC_FRIEND = "_NPC_Friend";
LybrialNamePlates.TARGET = "_Target";

-- ------------------------------------------------------------------------
-- External Upvalues
-- ------------------------------------------------------------------------

-- Lua Functions
local _G = _G;

-- WOW API
local CombatLogGetCurrentEventInfo = CombatLogGetCurrentEventInfo;
local GetPlayerInfoByGUID = GetPlayerInfoByGUID;

-- WOW Locales
local INTERRUPTED = INTERRUPTED;

-- ------------------------------------------------------------------------
-- NamePlates Functions
-- ------------------------------------------------------------------------

local defaults = {
    profile = {
        enabled = true,
    }
};

-- Initialize Addon
function LybrialNamePlates:OnInitialize()
    self.db = LybrialUI.db:RegisterNamespace(ADDON_NAME, defaults);

    self:InitializeNamePlates();

    self:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED");
end

-- Enable Addon
function LybrialNamePlates:OnEnable()
    -- Lybrial_NamePlates_Options\init.lua
    if (self.SetupOptions) then
        self:SetupOptions();
    end

    self:OnUpdate();
end

-- Update Addon
function LybrialNamePlates:OnUpdate()
    for _, module in self:IterateModules() do
        module:OnUpdate();
    end

    self:ClassPower_Added(_G.Lybrial_NamePlates_Player_ClassPower);

    if (PLAYER.info.class == VALUES.ClassNames.DeathKnight) then
        self:Runes_Added(_G.Lybrial_NamePlates_Player_ClassPower);
    end

    if (PLAYER.info.class == VALUES.ClassNames.Monk) then
        self:Stagger_Added(_G.Lybrial_NamePlates_Player_ClassPower);
    end
end

-- Disable Addon
function LybrialNamePlates:OnDisable()
end

-- ------------------------------------------------------------------------
-- Setup NamePlates
-- ------------------------------------------------------------------------

local FRAMES = CORE.FRAMES;

function LybrialNamePlates:InitializeNamePlates()
    OUF:RegisterStyle(ADDON_NAME, function(frame, unit)
        LybrialNamePlates:Style(frame, unit);
    end);
    OUF:SetActiveStyle(ADDON_NAME);

    OUF:Spawn("player", ADDON_NAME .. "_Player_ClassPower");

    _G.Lybrial_NamePlates_Player_ClassPower.type = self.TARGET;
    _G.Lybrial_NamePlates_Player_ClassPower:SetScaledSize(1, 1);
    _G.Lybrial_NamePlates_Player_ClassPower:ClearAllPoints();
    _G.Lybrial_NamePlates_Player_ClassPower:SetScaledPoint("TOP", FRAMES.UIParent, "BOTTOM", 0, -1000);

    OUF:SpawnNamePlates(ADDON_NAME .. "_", function(nameplate, event, unit)
        LybrialNamePlates:NamePlateCallBack(nameplate, event, unit);
    end);
end

function LybrialNamePlates:NamePlateCallBack(nameplate, event, unit)
    if (event == "NAME_PLATE_UNIT_ADDED") then
        self:NamePlateAdded(nameplate, unit);
    elseif (event == "NAME_PLATE_UNIT_REMOVED") then
        self:NamePlateRemoved(nameplate, unit);
    elseif (event == "PLAYER_TARGET_CHANGED") then
        self:NamePlateTargetChanged(nameplate);
    end
end

function LybrialNamePlates:NamePlateAdded(nameplate, unit)
    self:Inflate(nameplate, unit);

    local db = LybrialNamePlates:GetDbForType(nameplate.type);

    if (db) then
        if (db.size) then
            nameplate:SetSizeFromDb(db.size);
        end

        if (db.backdrop) then
            if (not nameplate.backdrop) then
                nameplate:CreateTemplateBackdrop();
            end

            nameplate.backdrop:SetTemplateFromDb(db.backdrop);
        end
    end

    self:Buffs_Added(nameplate);
    self:CastBar_Added(nameplate);
    self:Classification_Added(nameplate);
    self:ClassPower_Added(nameplate);
    self:Debuffs_Added(nameplate);
    self:Health_Added(nameplate);
    self:HealthPrediction_Added(nameplate);
    self:Power_Added(nameplate);
    self:Quest_Added(nameplate);
    self:RaidTarget_Added(nameplate);
    self:Role_Added(nameplate);

    if (PLAYER.info.class == VALUES.ClassNames.DeathKnight) then
        self:Runes_Added(nameplate);
    end

    self:Specialization_Added(nameplate);

    if (PLAYER.info.class == VALUES.ClassNames.Monk) then
        self:Stagger_Added(nameplate);
    end

    self:Target_Added(nameplate);
    self:Text_Added(nameplate);
    self:Threat_Added(nameplate);

    if (nameplate) then
        nameplate.isTarget = nameplate.unit and UNITS:UnitIsUnit(nameplate.unit, "target") or nil;

        if (nameplate.isTarget == true) then
            LybrialNamePlates:TargetAdded(nameplate);
        end
    end
end

function LybrialNamePlates:NamePlateRemoved(nameplate, unit)
    self:Deflate(nameplate, unit);
end

function LybrialNamePlates:NamePlateTargetChanged(nameplate)
    if (nameplate) then
        nameplate.isTarget = nameplate.unit and UNITS:UnitIsUnit(nameplate.unit, "target") or nil;
    end

    LybrialNamePlates:TargetAdded(nameplate);
end

function LybrialNamePlates:TargetAdded(nameplate)
    local db = LybrialNamePlates:GetDbForType(LybrialNamePlates.TARGET);

    if (db and db.classPower and db.classPower.enabled) then
        local player = _G.Lybrial_NamePlates_Player_ClassPower;
        local parent = nameplate or player;

        if (player.ClassPower) then
            player.ClassPower:SetParent(parent);
            player.ClassPower:SetPositionFromDb(db.classPower.position, parent);
        end

        if (player.Runes) then
            player.Runes:SetParent(parent);
            player.Runes:SetPositionFromDb(db.classPower.position, parent);
        end

        if (player.Stagger) then
            player.Stagger:SetParent(parent);
            player.Stagger:SetPositionFromDb(db.classPower.position, parent);
        end
    end
end

function LybrialNamePlates:Inflate(nameplate, unit)
    unit = unit or nameplate.unit;

    nameplate.type = self:GetTypeForUnit(unit);
    nameplate.isPlayer = UNITS:UnitIsPlayer(unit);
    nameplate.classification = UNITS:UnitClassification(unit);
    nameplate.reaction = UNITS:UnitReaction("player", unit);
    nameplate.unitGUID = UNITS:UnitGUID(unit);

    self.GUIDs[nameplate.unitGUID] = nameplate;
end

function LybrialNamePlates:Deflate(nameplate, unit)
    self.GUIDs[nameplate.unitGUID] = nil;
end

-- ------------------------------------------------------------------------
-- Setup NamePlates Styles
-- ------------------------------------------------------------------------

function LybrialNamePlates:Style(nameplate, unit)
    if (unit) then
        nameplate:ClearAllPoints();
        nameplate:SetScaledPoint("CENTER");
        nameplate:SetScale(LybrialUI.db.global.ui.scale);

        nameplate.RaisedElement = self:RaisedElement_Create(nameplate);

        nameplate.Buffs = self:Buffs_Create(nameplate.RaisedElement);
        nameplate.Castbar = self:CastBar_Create(nameplate);
        nameplate.Classification = self:Classification_Create(nameplate.RaisedElement);
        nameplate.ClassPower = self:ClassPower_Create(nameplate);
        nameplate.Debuffs = self:Debuffs_Create(nameplate.RaisedElement);
        nameplate.Health = self:Health_Create(nameplate);
        nameplate.Health.Text = self:Text_Create(nameplate.RaisedElement);
        nameplate.HealthPrediction = self:HealthPrediction_Create(nameplate);
        nameplate.Level = self:Text_Create(nameplate.RaisedElement);
        nameplate.Name = self:Text_Create(nameplate.RaisedElement);
        nameplate.Power = self:Power_Create(nameplate);
        nameplate.Power.Text = self:Text_Create(nameplate.RaisedElement);
        nameplate.Quest = self:Quest_Create(nameplate.RaisedElement);
        nameplate.RaidTargetIndicator = self:RaidTarget_Create(nameplate.RaisedElement);
        nameplate.Role = self:Role_Create(nameplate.RaisedElement);

        if (PLAYER.info.class == VALUES.ClassNames.DeathKnight) then
            nameplate.Runes = self:Runes_Create(nameplate);
        end

        nameplate.Specialization = self:Specialization_Create(nameplate.RaisedElement);

        if (PLAYER.info.class == VALUES.ClassNames.Monk) then
            nameplate.Stagger = self:Stagger_Create(nameplate);
        end

        nameplate.Target = self:Target_Create(nameplate.RaisedElement);
        nameplate.ThreatIndicator = self:Threat_Create(nameplate.RaisedElement);
        nameplate.Title = self:Text_Create(nameplate.RaisedElement);
    end
end

-- ------------------------------------------------------------------------
-- Getters
-- -----------------------------------------------------------------------

function LybrialNamePlates:GetTypeForUnit(unit)
    if (UNITS:UnitIsUnit(unit, "player")) then
        return self.PLAYER;
    elseif (UNITS:UnitIsPVPSanctuary(unit) or (UNITS:UnitIsPlayer(unit) and UNITS:UnitIsFriend("player", unit) and (UNITS:UnitReaction("player", unit) >= 5))) then
        return self.PLAYER_FRIEND;
    elseif ((not UNITS:UnitIsPlayer(unit)) and ((UNITS:UnitReaction("player", unit) >= 5) or (UNITS:UnitFactionGroup(unit) == "Neutral"))) then
        return self.NPC_FRIEND;
    elseif ((not UNITS:UnitIsPlayer(unit)) and (UNITS:UnitReaction("player", unit) <= 4)) then
        return self.NPC_ENEMY;
    else
        return self.PLAYER_ENEMY;
    end
end

function LybrialNamePlates:GetDbForType(type)
    return LybrialNamePlates:GetModule(ADDON_NAME .. type).db.profile;
end

function LybrialNamePlates:GetDbForUnit(unit)
    local type = self:GetTypeForUnit(unit);

    return self:GetDbForType(type);
end

-- ------------------------------------------------------------------------
-- Events
-- ------------------------------------------------------------------------

function LybrialNamePlates:COMBAT_LOG_EVENT_UNFILTERED()
    local _, event, _, sourceGUID, sourceName, _, _, targetGUID = CombatLogGetCurrentEventInfo();

    if ((event == "SPELL_INTERRUPT") and targetGUID and (sourceName and sourceName ~= "")) then
        local nameplate = self.GUIDs[targetGUID];

        if (nameplate and nameplate.Castbar) then
            local db = self:GetDbForType(nameplate.type);

            if (db and db.castBar and db.castBar.enabled and db.castBar.general.timeToHold > 0) then
                local _, sourceClass = GetPlayerInfoByGUID(sourceGUID);
                local sourceClassColor;

                if (sourceClass) then
                    sourceClassColor = Colors:GetColorForClass(sourceClass);
                end

                if (sourceClassColor) then
                    nameplate.Castbar.Text:SetText(INTERRUPTED .. " " .. COLORS:CreateColorString(sourceClassColor, sourceName));
                else
                    nameplate.Castbar.Text:SetText(INTERRUPTED .. " " .. sourceName);
                end
            end
        end
    end
end

-- ------------------------------------------------------------------------
-- oUF/private.lua
-- ------------------------------------------------------------------------

local selectionTypes = {
    [0] = 0,
    [1] = 1,
    [2] = 2,
    [3] = 3,
    [4] = 4,
    [5] = 5,
    [6] = 6,
    [7] = 7,
    [8] = 8,
    [9] = 9,
    -- [10] = 10, -- unavailable to players
    -- [11] = 11, -- unavailable to players
    -- [12] = 12, -- inconsistent due to bugs and its reliance on cvars
    [13] = 13,
}

function LybrialNamePlates:UnitSelectionType(unit, considerHostile)
    if (considerHostile and UNITS:UnitThreatSituation("player", unit)) then
        return 0;
    else
        return selectionTypes[UNITS:UnitSelectionType(unit, true)];
    end
end

health.lua

-- ------------------------------------------------------------------------
-- > Lybrial UI (Lybrial @ Blackhand EU) <
-- ------------------------------------------------------------------------
--
-- NamePlates Health
--
-- ------------------------------------------------------------------------

local LybrialUI = LybrialUI;
local Colors = Colors;
local LybrialNamePlates = LybrialNamePlates;

local CORE, LIBS = LybrialUI:GetCore();

local FRAMES = CORE.FRAMES;
local UNITS = CORE.UNITS;

local LSM = LIBS.LSM;

-- ------------------------------------------------------------------------
-- External Upvalues
-- ------------------------------------------------------------------------

-- Lua Functions

-- WOW API

-- ------------------------------------------------------------------------
-- NamePlates Health Functions
-- ------------------------------------------------------------------------

function LybrialNamePlates:Health_Create(nameplate)
    local health = FRAMES:CreateFrame("StatusBar", nameplate:GetDebugName() .. "_Health", nameplate);

    health:SetFrameStrata(nameplate:GetFrameStrata());
    health:SetFrameLevel(nameplate:GetFrameLevel() + 1);
    health:SetStatusBarTexture(LSM:Fetch("statusbar", CORE.VALUES.StatusBar.Texture.Default));
    health:CreateTemplateBackdrop();

    health.frequentUpdates = true;
    health.considerSelectionInCombatHostile = true;
    health.UpdateColor = LybrialNamePlates.Health_UpdateColor;

    return health;
end

function LybrialNamePlates:Health_Added(nameplate)
    local db = LybrialNamePlates:GetDbForType(nameplate.type);

    if (db and db.health and db.health.enabled) then
        if (not nameplate:IsElementEnabled("Health")) then
            nameplate:EnableElement("Health");
        end

        nameplate.Health.colorTapping = db.health.colors.colorTapping;
        nameplate.Health.colorThreat = db.health.colors.colorThreat;
        nameplate.Health.colorClass = db.health.colors.colorClass;
        nameplate.Health.colorClassNPC = db.health.colors.colorClass;
        nameplate.Health.colorClassPet = db.health.colors.colorClass;
        nameplate.Health.colorSelection = db.health.colors.colorSelection;
        nameplate.Health.colorReaction = db.health.colors.colorReaction;

        nameplate.Health:SetPositionFromDb(db.health.position, nameplate);
        nameplate.Health:SetSizeFromDb(db.health.size);
        nameplate.Health.backdrop:SetTemplateFromDb(db.health.backdrop);
        nameplate.Health:SetStatusFromDb(db.health.status);
    else
        if (nameplate:IsElementEnabled("Health")) then
            nameplate:DisableElement("Health");
        end
    end
end

function LybrialNamePlates:Health_UpdateColor(unit)
    if (unit) then
        local r, g, b, t;

        if (self.colorTapping and (not UNITS:UnitPlayerControlled(unit)) and UNITS:UnitIsTapDenied(unit)) then
            t = Colors:GetDefault().disabled;
        elseif (self.colorThreat and (not UNITS:UnitPlayerControlled(unit)) and UNITS:UnitThreatSituation("player", unit)) then
            local threat = UNITS:UnitThreatSituation("player", unit);

            t = Colors:GetColorForThreat(threat);
        elseif (self.colorClass and UNITS:UnitIsPlayer(unit)) or (self.colorClassNPC and (not UNITS:UnitIsPlayer(unit))) or (self.colorClassPet and UNITS:UnitPlayerControlled(unit) and (not UNITS:UnitIsPlayer(unit))) then
            local _, class = UNITS:UnitClass(unit);

            t = Colors:GetColorForClass(class);
        elseif (self.colorSelection and LybrialNamePlates:UnitSelectionType(unit, self.considerSelectionInCombatHostile)) then
            local selection = LybrialNamePlates:UnitSelectionType(unit, self.considerSelectionInCombatHostile);

            t = Colors:GetColorForSelection(selection);
        elseif (self.colorReaction and UNITS:UnitReaction(unit, "player")) then
            local reaction = UNITS:UnitReaction(unit, "player");

            t = Colors:GetColorForReaction(reaction);
        elseif (self.colorHealth) then
            t = Colors:GetDefault().default;
        else
            local db = LybrialNamePlates:GetTypeForUnit(unit);

            if (db and db.health and db.health.enabled) then
                t = db.health.colors.default;
            end
        end

        if (t) then
            r, g, b = t[1] or t.r, t[2] or t.g, t[3] or t.b;
        end

        if (r or g or b) then
            self:SetStatusBarColor(r, g, b);
        end
    end
end

```lua

classPower.lua

-- ------------------------------------------------------------------------
-- > Lybrial UI (Lybrial @ Blackhand EU) <
-- ------------------------------------------------------------------------
--
-- NamePlates Classpower
--
-- ------------------------------------------------------------------------

local LybrialUI = LybrialUI;
local LybrialNamePlates = LybrialNamePlates;

local CORE, LIBS = LybrialUI:GetCore();

local FRAMES = CORE.FRAMES;
local MATH = CORE.MATH;
local PLAYER = CORE.PLAYER;
local VALUES = CORE.VALUES;

local LSM = LIBS.LSM;

-- ------------------------------------------------------------------------
-- External Upvalues
-- ------------------------------------------------------------------------

-- Lua Functions
local _G = _G;

-- WOW API

-- ------------------------------------------------------------------------
-- NamePlates Classpower Functions
-- ------------------------------------------------------------------------

function LybrialNamePlates:ClassPower_Create(nameplate)
    local classPower = FRAMES:CreateFrame("Frame", nameplate:GetDebugName() .. "_ClassPower", nameplate);

    classPower:SetFrameStrata(nameplate:GetFrameStrata());
    classPower:SetFrameLevel(5);
    classPower:CreateTemplateBackdrop();

    local max = MATH:Max(VALUES.ClassPower[PLAYER.info.class] or 0, _G.MAX_COMBO_POINTS);
    local texture = LSM:Fetch("statusbar", VALUES.StatusBar.Texture.Default);

    for i = 1, max do
        classPower[i] = FRAMES:CreateFrame("StatusBar", nameplate:GetDebugName() .. "_ClassPower_" .. i, classPower);
        classPower[i]:SetFrameStrata(nameplate:GetFrameStrata());
        classPower[i]:SetFrameLevel(6);
        classPower[i]:SetStatusBarTexture(texture);
        classPower[i]:CreateTemplateBackdrop();
    end

    classPower.UpdateColor = LybrialNamePlates.ClassPower_UpdateColor;
    classPower.PostUpdate = LybrialNamePlates.ClassPower_PostUpdate;

    return classPower;
end

function LybrialNamePlates:ClassPower_Added(nameplate)
    local db = LybrialNamePlates:GetDbForType(nameplate.type);

    if (((nameplate.type == LybrialNamePlates.PLAYER) or (nameplate.type == LybrialNamePlates.TARGET)) and (db and db.classPower and db.classPower.enabled)) then
        if (not nameplate:IsElementEnabled("ClassPower")) then
            nameplate:EnableElement("ClassPower");
        end

        nameplate.ClassPower:SetPositionFromDb(db.classPower.position, nameplate);
        nameplate.ClassPower:SetSizeFromDb(db.classPower.size);
        nameplate.ClassPower.backdrop:SetTemplateFromDb(db.classPower.backdrop);

        local max = nameplate.ClassPower.__max;
        local width = (max and (db.classPower.size.width / max)) or 0;

        for i = 1, #nameplate.ClassPower do
            nameplate.ClassPower[i]:Hide();
        end

        for i = 1, max do
            nameplate.ClassPower[i]:Show();
            nameplate.ClassPower[i]:ClearAllPoints();
            nameplate.ClassPower[i]:SetStatusFromDb(db.classPower.element.status);
            nameplate.ClassPower[i].backdrop:SetTemplateFromDb(db.classPower.element.backdrop);

            if (i == 1) then
                nameplate.ClassPower[i]:SetScaledSize(width - (max == 6 and 2 or 0), db.classPower.element.size.height)
                nameplate.ClassPower[i]:SetScaledPoint("LEFT", nameplate.ClassPower, "LEFT", 0, 0);
            else
                nameplate.ClassPower[i]:SetScaledSize(width - 1, db.classPower.element.size.height);
                nameplate.ClassPower[i]:SetScaledPoint("LEFT", nameplate.ClassPower[i - 1], "RIGHT", 1, 0);

                if (i == max) then
                    nameplate.ClassPower[i]:SetScaledPoint("RIGHT", nameplate.classPower);
                end
            end
        end
    else
        if (nameplate:IsElementEnabled("ClassPower")) then
            nameplate:DisableElement("ClassPower");
        end
    end
end

function LybrialNamePlates:ClassPower_UpdateColor(powerType)
    for i = 1, #self do
        self[i]:SetStatusBarColor(1, 1, 1);
    end
end

function LybrialNamePlates:ClassPower_PostUpdate(cur, _, needUpdate)
    if (cur and (cur > 0)) then
        self:Show();
    else
        self:Hide();
    end

    if (needUpdate) then
        LybrialNamePlates:ClassPower_Added(self.__owner);
    end
end

oUF is in caps because of my coding style:

From my core module

LybrialUI.OUF = NAMESPACE.oUF;

And FRAMES is my core frames API. Not important for this problem.

commented

Temporary fix:

local function temporaryBugFix()
    _G.ClassNameplateManaBarFrame.Show = _G.ClassNameplateManaBarFrame.Hide;
    _G.DeathKnightResourceOverlayFrame.Show = _G.DeathKnightResourceOverlayFrame.Hide;
end

But that leads to another strange error:

4x [ADDON_ACTION_BLOCKED] AddOn 'Lybrial_NamePlates' tried to call secure function 'SetTargetClampingInsets()'.
[string "@!BugGrabber\BugGrabber.lua"]:519: in function <!BugGrabber\BugGrabber.lua:519>
[string "=[C]"]: in function `SetTargetClampingInsets'
[string "@Blizzard_NamePlates\Blizzard_NamePlates.lua"]:274: in function `SetupClassNameplateBars'
[string "@Blizzard_NamePlates\Blizzard_NamePlates.lua"]:96: in function `OnNamePlateAdded'
[string "@Blizzard_NamePlates\Blizzard_NamePlates.lua"]:51: in function <...eBlizzard_NamePlates\Blizzard_NamePlates.lua:42>
[string "=[C]"]: ?

But I can live with that for now

commented

That is why we don't do it in oUF, those functions are also used by the friendly nameplates, and are thus protected. What you are seeing as a "strange error" is a taint, e.g. you're modifying secure code which when called by another piece of secure code will taint the whole process, blocking the addon.

commented

Oh ok. Thx for that clarification.

This will work then I guess (at least I do not get an error):

local function temporaryBugFix()
    hooksecurefunc(_G.ClassNameplateManaBarFrame, "Show", function(self) self:Hide() end);
    hooksecurefunc(_G.DeathKnightResourceOverlayFrame, "Show", function(self) self:Hide() end);
end