WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   nameplate classificationIndicator; (https://www.wowinterface.com/forums/showthread.php?t=58920)

rulezyx 09-07-21 04:02 AM

nameplate classificationIndicator;
 
Hello,

usually the elite/rare icon indicator will show up on the left side for the default blizzard nameplates.

I want it to show up to the right which is working fine but when I select the nameplate (scales up) then the icon will make a small jump at the wrong direction(left).

Found this part that does prevent the icon scaling but nothing related to it's position.

Heres what I've tried:

Code:

hooksecurefunc("DefaultCompactNamePlateFrameSetupInternal", function(frame)
    frame.classificationIndicator:ClearAllPoints();
    frame.classificationIndicator:SetPoint("RIGHT", 100, 0)
end)

Blizzard Code here and here.

Example (default) here

Example issue with my code here.

As always I really appreciate any help :)

rulezyx 09-17-21 06:06 PM

Seems that not only the classification indicator but targetmarkers and similar symbols that are part of the nameplate textures are in correlation with the default anchor at the left side which will always move the icons to the left when the nameplate scales up/is selected.

I still couldn't find any solution for this issue yet.

SDPhantom 09-18-21 04:06 AM

You're setting the right-side anchor to the right point on the nameplate, then applying an offset. When you scale up, naturally, the texture will start overlapping the nameplate again. What you need to do is set the left anchor of the texture instead to the right point on the nameplate.

I would also hook NamePlateDriverFrame at the point when it creates the unitframes. Less chance of affecting other parts of the UI.

Lua Code:
  1. hooksecurefunc(NamePlateDriverFrame,"AcquireUnitFrame",function(base)
  2.     if base:IsForbidden() then return; end--    Prevent modding forbidden frames (accessing these throws errors)
  3.  
  4.     local unitframe=base.UnitFrame;--   Set by original function
  5.     unitframe.ClassificationFrame:ClearAllPoints();
  6.     unitframe.ClassificationFrame:SetPoint("LEFT",unitframe.healthBar,"RIGHT");
  7. end);

rulezyx 09-18-21 06:13 AM

Thank you so much for your code and the good explanation.

Code:

hooksecurefunc(NamePlateDriverFrame,"AcquireUnitFrame",function(base)
    if base:IsForbidden() then return; end--    Prevent modding forbidden frames (accessing these throws errors)
 
    local unitframe=base.UnitFrame;--  Set by original function
    unitframe.ClassificationFrame:ClearAllPoints();
    unitframe.ClassificationFrame:SetPoint("LEFT",unitframe.healthBar,"RIGHT");
    unitframe.RaidTargetFrame:ClearAllPoints();
    unitframe.RaidTargetFrame:SetPoint("LEFT",unitframe.healthBar,"RIGHT", 14, 0);
end);

Did the same thing with the targetmarkers and its working without any issues.


All times are GMT -6. The time now is 03:04 AM.

vBulletin © 2021, Jelsoft Enterprises Ltd
© 2004 - 2021 MMOUI