frenado05

Untitled

May 11th, 2026
38
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.77 KB | None | 0 0
  1. local function nameplateHealthText(unit, healthBar)
  2. if not healthBar then return false end
  3. if not healthBar.text and UnitIsEnemy("player", unit) then
  4. healthBar.text = healthBar:CreateFontString(nil, "ARTWORK", nil)
  5. healthBar.text:SetPoint("CENTER")
  6. healthBar.text:SetFont("Fonts\\2002b.TTF", 11, "OUTLINE, THICKOUTLINE")
  7. end
  8. if UnitIsEnemy("player", unit) then
  9. local _, maxHealth = healthBar:GetMinMaxValues()
  10. local currentHealth = healthBar:GetValue()
  11. if(healthBar.text) then
  12. healthBar.text:SetText(string.format(math.floor ((currentHealth / maxHealth) * 100)) .. "%")
  13. end
  14.  
  15. if healthBar and not healthBar.lockValues then
  16. local cur=healthBar:GetValue()
  17. local _, max = healthBar:GetMinMaxValues()
  18. local r, g, b=1, 0, 0
  19.  
  20. if cur/max>0.30 then r,g,b=1,1,1 end
  21.  
  22. if healthBar.text then
  23. healthBar.text:SetTextColor(r,g,b)
  24. end
  25. end
  26. else
  27. if(healthBar.text) then
  28. healthBar.text:SetText("")
  29. end
  30. end
  31. end
  32.  
  33. local function nameplateHealthTextFrame(self)
  34. local inInstance, instanceType = IsInInstance()
  35. if inInstance and not (instanceType == 'arena' or instanceType =='pvp') then
  36. if self:IsForbidden() then return end
  37. end
  38.  
  39. if self.unit and self.unit:find('nameplate%d') then
  40. if self.healthBar and self.unit then
  41. if UnitName("player") ~= UnitName(self.unit) then
  42. local unit = self.unit
  43. local healthBar = self.healthBar
  44. nameplateHealthText(unit, healthBar)
  45. end
  46. end
  47. end
  48. end
  49.  
  50.  
  51.  
  52. local function nameplatePlayerName(self)
  53. if ShouldShowName(self) then
  54. if self.optionTable.colorNameBySelection then
  55. local inInstance, instanceType = IsInInstance()
  56. if inInstance and not (instanceType == 'arena' or instanceType =='pvp') then
  57. if self:IsForbidden() then return end
  58. end
  59. -- Classcolor Playername
  60. --if self.unit then
  61. -- local _, class = UnitClass(self.unit)
  62. -- local color = RAID_CLASS_COLORS[class]
  63. -- -- if UnitIsPlayer(self.unit) and UnitIsEnemy("player", self.unit) and self.name then
  64. -- -- if UnitIsPlayer(self.unit) and self.name then
  65. -- self.name:SetVertexColor(color.r, color.g, color.b)
  66. -- end
  67. --end
  68.  
  69. -- -- Hide Servername
  70. -- if db.server then
  71. -- if self.name and self.unit then
  72. -- if UnitIsPlayer(self.unit) then
  73. -- local name, server = UnitName(self.unit)
  74. -- self.name:SetText(name)
  75. -- end
  76. -- end
  77. -- end
  78.  
  79. -- Font Size Function
  80. local function SetFont(obj, optSize)
  81. local fontName = obj:GetFont()
  82. obj:SetFont(fontName, optSize, "OUTLINE")
  83. end
  84.  
  85. -- Set Font Size for Nameplate Names
  86. SetFont(SystemFont_LargeNamePlate, 15)
  87. SetFont(SystemFont_NamePlate, 15)
  88. SetFont(SystemFont_LargeNamePlateFixed, 15)
  89. SetFont(SystemFont_NamePlateFixed, 15)
  90. end
  91. end
  92. end
  93.  
  94.  
  95.  
  96. -- Set Nameplate Health Percentage
  97. hooksecurefunc("CompactUnitFrame_UpdateHealthColor", nameplateHealthTextFrame)
  98. hooksecurefunc("CompactUnitFrame_UpdateHealth", nameplateHealthTextFrame)
  99. hooksecurefunc("CompactUnitFrame_UpdateStatusText", nameplateHealthTextFrame)
  100.  
  101. -- Set Nameplate Name Color
  102. hooksecurefunc("CompactUnitFrame_UpdateName", nameplatePlayerName)
Advertisement
Add Comment
Please, Sign In to add comment