WoWInterface SVN TipTop

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /branches/2.0
    from Rev 47 to Rev 48
    Reverse comparison

Rev 47 → Rev 48

tiptop.lua
39,6 → 39,8
local tt = GameTooltip
local ttSBar = GameTooltipStatusBar
local ttSBarBG = CreateFrame("Frame", nil, ttSBar)
local ttHealth = ttSBar:CreateFontString("ttHealth", "OVERLAY")
ttHealth:SetPoint("CENTER")
local BGPosition, color
local qualColors = ITEM_QUALITY_COLORS
local tooltips = { GameTooltip,
73,7 → 75,12
TipTop:SetBackdropBorderColor(db.borderColor.r, db.borderColor.g, db.borderColor.b, db.borderColor.a)
end
 
local function SBarConfig()
local function SetFonts()
font = LSM:Fetch("font", db.font)
ttHealth:SetFont(font, 12, "OUTLINE")
end
 
local function SBarCustom()
ttSBar:SetStatusBarTexture(LSM:Fetch("statusbar", db.healthBar))
ttSBar:SetStatusBarColor(db.sbarcolor.r, db.sbarcolor.g, db.sbarcolor.b, db.sbarcolor.a)
ttSBarBG:SetAllPoints()
86,8 → 93,8
ttSBar:ClearAllPoints()
if db.insideBar then
if db.topBar then
ttSBar:SetPoint("TOPRIGHT", tt, "TOPRIGHT", -7, 1)
ttSBar:SetPoint("TOPLEFT", tt, "TOPLEFT", 10, 1)
ttSBar:SetPoint("TOPRIGHT", tt, "TOPRIGHT", -7, 5)
ttSBar:SetPoint("TOPLEFT", tt, "TOPLEFT", 10, 5)
BGPosition = function()
if ttSBar:IsShown() then
TipTop:ClearAllPoints()
99,13 → 106,13
end
end
else
ttSBar:SetPoint("BOTTOMRIGHT", tt, "BOTTOMRIGHT", -7, -1)
ttSBar:SetPoint("BOTTOMLEFT", tt, "BOTTOMLEFT", 10, -1)
ttSBar:SetPoint("BOTTOMRIGHT", tt, "BOTTOMRIGHT", -7, -5)
ttSBar:SetPoint("BOTTOMLEFT", tt, "BOTTOMLEFT", 10, -5)
BGPosition = function()
if ttSBar:IsShown() then
TipTop:ClearAllPoints()
TipTop:SetPoint("TOPRIGHT", tt, "TOPRIGHT")
TipTop:SetPoint("BOTTOMLEFT", ttSBar, "BOTTOMLEFT", -7, -5)
TipTop:SetPoint("BOTTOMLEFT", ttSBar, "BOTTOMLEFT", -7, -7)
else
TipTop:ClearAllPoints()
TipTop:SetAllPoints(tt)
114,11 → 121,11
end
else
if db.topBar then
ttSBar:SetPoint("BOTTOMLEFT", tt, "TOPLEFT", 0, 2)
ttSBar:SetPoint("BOTTOMRIGHT", tt, "TOPRIGHT", 0, 2)
ttSBar:SetPoint("BOTTOMLEFT", tt, "TOPLEFT", 0, 4)
ttSBar:SetPoint("BOTTOMRIGHT", tt, "TOPRIGHT", 0, 4)
else
ttSBar:SetPoint("TOPLEFT", tt, "BOTTOMLEFT", 0, -2)
ttSBar:SetPoint("TOPRIGHT", tt, "BOTTOMRIGHT", 0, -2)
ttSBar:SetPoint("TOPLEFT", tt, "BOTTOMLEFT", 0, -4)
ttSBar:SetPoint("TOPRIGHT", tt, "BOTTOMRIGHT", 0, -4)
end
BGPosition = function() end
TipTop:ClearAllPoints()
138,29 → 145,48
end
end
 
local function MouseoverTargetUpdate()
local borderColor = db.borderColor
TipTop:SetBackdropBorderColor(borderColor.r, borderColor.g, borderColor.b, borderColor.a)
BorderClassColor()
end
 
local function ItemQualityBorder(tip)
if db.itemColor then
local _,item = tip:GetItem()
if item then
local _,_,quality = GetItemInfo(item)
if quality then
local color = qualColors[quality]
if tip == tt then
TipTop:SetBackdropBorderColor(color.r - .2, color.g - .2, color.b - .2, db.borderColor.a)
else
tip:SetBackdropBorderColor(color.r - .2, color.g - .2, color.b - .2, db.borderColor.a)
end
end
local _,_,quality = GetItemInfo(item)
local color = qualColors[quality]
if tip == tt then
TipTop:SetBackdropBorderColor(color.r - .2, color.g - .2, color.b - .2, db.borderColor.a)
else
tip:SetBackdropBorderColor(color.r - .2, color.g - .2, color.b - .2, db.borderColor.a)
end
end
end
 
local function CalcHealth()
local hp = UnitHealth("mouseover")
local maxhp = UnitHealthMax("mouseover")
local per = (hp/maxhp) * 100
if db.textformat == "100/100" then
ttHealth:SetFormattedText("%d / %d", hp, maxhp)
elseif db.textformat == "100%" then
if per >= 0 then --gives funny negative numbers when tooltip fades
ttHealth:SetFormattedText("%d%%", per)
end
elseif db.textformat == "100/100 (100%)" then
if per >= 0 then
ttHealth:SetFormattedText("%d / %d (%d%%)", hp, maxhp, per)
end
end
end
 
local function MouseoverTargetUpdate()
-- local borderColor = db.borderColor
-- TipTop:SetBackdropBorderColor(borderColor.r, borderColor.g, borderColor.b, borderColor.a)
if tt:GetWidth() < 175 then
tt:SetWidth(175)
end
BorderClassColor()
if db.healthText then
CalcHealth()
end
end
 
local function TipShow()
if not tt:GetUnit() and not tt:GetItem() then
local borderColor = db.borderColor
172,7 → 198,8
local function PlayerLogin()
SetBackgrounds()
SBarPosition()
SBarConfig()
SBarCustom()
SetFonts()
 
color = CUSTOM_CLASS_COLORS or RAID_CLASS_COLORS
 
182,6 → 209,9
for i=1,#tooltips do
tooltips[i]:HookScript("OnTooltipSetItem", ItemQualityBorder)
end
if db.healthText then
ttSBar:HookScript("OnValueChanged", CalcHealth)
end
end