Здравствуйте! Я нашел гениальный аддон HealthyMuch (да, он на панды, но отлично работает на лк) который может так:
Собственно вот http://www.curse.com/addons/wow/healthymuch
И все бы здорово, но жаль что только так:
Что мне добавить/изменить в аддоне что бы он стал показывать не только хп таргета, но и хп игрока и по возможности фокуса в формате xx.x/xx.x (xx%)? Пробовал тыкать что-то, заменять, по аналогии делать, к резельтату не приводило а либо ломало аддон либо ничего не происходило...
Заранее спасибо!
Вот само тело аддона healthymuch.lua для ленивых:
--Allows numbers to be rounded off and condensed, m for million, k for thousand
local function round(num, places)
return tonumber(string.format("%."..(places or 0).."f",num))
end
local function short(num)
if num > 10000000 then
return round(num/1000000, 1).."m"
elseif num > 10000 then
return round(num/1000, 1).."k"
else
return num
end
end
TFUtils = CreateFrame("Frame")
--force target frame health text to show current amount, max and percentage
local tftfhbt = TargetFrameTextureFrameHealthBarText
local tfh = tftfhbt.Hide
local tfs = tftfhbt.Show
local tfs2 = function(self) self:SetAlpha(1) tfs(self) end
local tfh2 = function(self) self:SetAlpha(1) tfs(self) end
local tfst = tftfhbt.SetText
function tftfhbt:SetText()
if UnitExists("target") then
local uh, uhm = UnitHealth("target"), UnitHealthMax("target")
local pct = round(uh/uhm*100, 1)
if pct ~= nil then
tfst(self, short(uh).."/"..short(uhm).." ("..pct.."%)")
else
tfst(self, "")
end
else
tfst(self, "")
end
end
local emptyfunc = function() end
--forces target frame power/mana to show current amount, max and percentage
local tftfmbt = TargetFrameTextureFrameManaBarText
local tfms = tftfmbt.Show
local tfms2 = function(self) self:SetAlpha(1) tfms(self) end
local tfmh2 = function(self) self:SetAlpha(1) tfms(self) end
local tfmst = tftfmbt.SetText
function tftfmbt:SetText()
if UnitExists("target") and UnitPowerMax("target")>0 then
local up, upm = UnitPower("target"), UnitPowerMax("target")
local pct = round(up/upm*100, 1)
tfmst(self, short(up).."/"..short(upm).." ("..pct.."%)")
else
tfmst(self, "")
end
end
TFUtils:SetScript("OnEvent", function()
--[[tftfhbt.Hide = UnitCanAttack("player", "target") and tfh2 or tfh
tftfhbt.Show = UnitCanAttack("player", "target") and tfs2 or tfs--]]
tftfhbt.Hide = tfh2
tftfhbt.Show = tfs2
--tftfhbt[(UnitCanAttack("player", "target") or tftfhbt:GetParent():IsMouseOver()) and "Show" or "Hide"](tftfhbt)
tftfhbt:Show()
if not UnitCanAttack("player", "target") then
tftfhbt:SetAlpha(1)
end
if not tftfhbt:GetParent():IsMouseOver() then
tftfhbt:Hide()
end
tftfmbt.Hide = tfmh2
tftfmbt.Show = tfms2
tftfmbt[(UnitCanAttack("player", "target") or tftfmbt:GetParent():IsMouseOver()) and "Show" or "Hide"](tftfmbt)
tftfmbt:Show()
if not UnitCanAttack("player", "target") then
tftfmbt:SetAlpha(1)
end
if not tftfmbt:GetParent():IsMouseOver() then
tftfmbt:Hide()
end
end)
TFUtils:RegisterEvent("UNIT_FACTION")
TFUtils:RegisterEvent("PLAYER_TARGET_CHANGED")
--show type, health and power/mana in the tooltip frame
local a = CreateFrame("Frame")
local pt = {[0] = "Mana", [1] = "Rage", [2] = "Focus", [3] = "Energy", [4] = "Happiness", [5] = "Runes", [6] = "Runic Power", [7] = "Soul Shards", [8] = "Eclipse", [9] = "Holy Power"}
local uset = {[1] = "", [2] = " Male", [3] = " Female"}
a:SetScript("OnEvent", function()
if not UnitExists("mouseover") then return end
--look up unit health and power
local uh, uhm = UnitHealth("mouseover"), UnitHealthMax("mouseover")
local up, upm, upt = UnitPower("mouseover"), UnitPowerMax("mouseover"), UnitPowerType("mouseover")
--look up friend/foe, faction, player/npc
local upctl, uie, uif = UnitPlayerControlled("mouseover"), UnitIsEnemy("mouseover", "player"), UnitIsFriend("mouseover", "player")
local ufge, ufgl = UnitFactionGroup("mouseover")
local ufgep, ufglp = UnitFactionGroup("player")
local usex = UnitSex("mouseover")
tagcolr, tagcolg, tagcolb = 1, 1, 0
tagstat, tagfact, tagplr = "Neutral", "", "NPC"
--Add friendly, faction, player/npc tooltip
if uie ~= nil then
tagcolr, tagcolg, tagcolb, tagstat = 1, 0, 0, "Enemy"
end
if uif ~= nil then
tagcolr, tagcolg, tagcolb, tagstat = 0, 1, 0, "Friendly"
end
if uie==nil and uif==nil then
tagcolr, tagcolg, tagcolb, tagstat = 1, 1, 0, "Neutral"
end
if ufge~= nil then
tagfact = ufge
else
tagfact = ""
end
if upctl ~= nil then
tagplr = "Player"
end
--Add friendly/faction/sex/player tooltip
if tagfact == "" then
GameTooltip:AddLine(tagstat..uset[usex].." "..tagplr, tagcolr, tagcolg, tagcolb)
else
GameTooltip:AddLine(tagstat.." "..tagfact..uset[usex].." "..tagplr, tagcolr, tagcolg, tagcolb)
end
--Add health tooltip
GameTooltip:AddDoubleLine("Health", short(uh).."/"..short(uhm).." ("..round(uh/uhm*100,1).."%)", 1,0.82,0, 1,1,1)
--Add power/mana tooltip
if upm ~= nil and upm > 0 then
GameTooltip:AddDoubleLine(pt[upt], short(up).."/"..short(upm).." ("..round(up/upm*100,1).."%)", 0.5,0.5,1, 1,1,1)
end
GameTooltip:Show()
end)
a:RegisterEvent("UPDATE_MOUSEOVER_UNIT")