nPlates 2.0

nPlates 2.0

147k Downloads

Player resource bar corruption

clicketz opened this issue ยท 3 comments

commented

In core.lua 412-414:

frame.healthBar:SetPoint("BOTTOMLEFT", frame.castBar, "TOPLEFT", 0, 4.2)
frame.healthBar:SetPoint("BOTTOMRIGHT", frame.castBar, "TOPRIGHT", 0, 4.2)
frame.healthBar:SetHeight(12)

This causes corruption by trying to attach to a castbar that does not exist with the player resource bar.

This causes many things to fail: Tooltips, buff stack text, health amount text.

nPlates

Here is some quick-n-dirty code that fixes this. This replaces the hook on line 406, though you may know of a more effective option.

hooksecurefunc("DefaultCompactNamePlateFrameAnchorInternal", function(frame, setupOptions)
    if ( frame:IsForbidden() ) then return end
    if ( not frame.isNameplate ) then return end

    -- Healthbar

    local pframe = C_NamePlate.GetNamePlateForUnit("player", issecure())

    if pframe then
        if frame.BuffFrame.unit ~= pframe.namePlateUnitToken then
            frame.healthBar:SetPoint("BOTTOMLEFT", frame.castBar, "TOPLEFT", 0, 4.2)
            frame.healthBar:SetPoint("BOTTOMRIGHT", frame.castBar, "TOPRIGHT", 0, 4.2)
        end
    else
        frame.healthBar:SetPoint("BOTTOMLEFT", frame.castBar, "TOPLEFT", 0, 4.2)
        frame.healthBar:SetPoint("BOTTOMRIGHT", frame.castBar, "TOPRIGHT", 0, 4.2)
    end

    frame.healthBar:SetHeight(12)

        -- Castbar

    frame.castBar.Icon:SetSize(24, 24)
    frame.castBar.Icon:SetTexCoord(0.1, 0.9, 0.1, 0.9)
    frame.castBar.Icon:ClearAllPoints()
    frame.castBar.Icon:SetPoint("BOTTOMLEFT", frame.castBar, "BOTTOMRIGHT", 4.9, 0)

        -- Hide Border Shield

    frame.castBar.BorderShield:ClearAllPoints()
end)

Cheers.

commented

Thanks for the heads up it should be fixed now. I checked into the Blizzard code and found that they use two different functions for anchoring the health bar. One for normal friendly and enemy nameplates and another for the personal resource frame so I just moved that bit of code into the first function and left the personal frame to Blizzard.

commented

@Grimsbain With your new changes, although it did fix the player resource issue, the castbar on nameplates is not being reanchored correctly now. I was having the same issue myself.

nPlates

commented

I just pushed out another update that should fix this.