diff --git a/Modules/UnitTooltip/UnitTooltip.lua b/Modules/UnitTooltip/UnitTooltip.lua index 8bfc0b5..b5312ec 100644 --- a/Modules/UnitTooltip/UnitTooltip.lua +++ b/Modules/UnitTooltip/UnitTooltip.lua @@ -912,6 +912,14 @@ do StarTip.tooltipMain:SetCell(widget.y, widget.x, widget.buffer, widget.fontObj, justification, colSpan) end end + for i, v in ipairs(StarTip.trunk) do + if #v == 2 then + StarTip.tooltipMain:AddLine(v[1], v[2]) + else + StarTip.tooltipMain:AddLine(v[1]) + end + end + StarTip:TrunkClear() table.wipe(widgetsToDraw) end end @@ -1558,22 +1566,17 @@ function mod:SetUnit() for i = lastLine, GameTooltip:NumLines() do local left = self.leftLines[i] - local j = i - lastLine + 1 - linesToAdd[j] = left:GetText() - local r, g, b = left:GetTextColor() - linesToAddR[j] = r - linesToAddG[j] = g - linesToAddB[j] = b local right = self.rightLines[i] - if right:IsShown() then - linesToAddRight[j] = right:GetText() - local r, g, b = right:GetTextColor() - linesToAddRightR[j] = r - linesToAddRightG[j] = g - linesToAddRightB[j] = b - end + local txt1 = left:GetText() + local r1, g1, b1 = left:GetTextColor() + local txt2 + local r2, g2, b2 + if right:IsShown() then + txt2 = right:GetText() + r2, g2, b2 = right:GetTextColor() + end + StarTip:TrunkAdd(txt1, r1, g1, b1, txt2, r2, g2, b2) end - -- End lines() @@ -1581,13 +1584,9 @@ function mod:SetUnit() self.timer:Start() end -do return end - self:RefixEndLines() - - GameTooltip:Show() - end +--[[ function mod:RefixEndLines() -- Another part taken from CowTip for i, left in ipairs(linesToAdd) do @@ -1610,3 +1609,4 @@ function mod:RefixEndLines() wipe(linesToAddRightG) wipe(linesToAddRightB) end +]] diff --git a/StarTip.lua b/StarTip.lua index 932e6d0..f8d7cf1 100644 --- a/StarTip.lua +++ b/StarTip.lua @@ -319,7 +319,7 @@ do end t.__starref__ = true newCount = newCount + 1 - return t, newtbl + return t end function StarTip.del(...) local t = select(1, ...) @@ -500,6 +500,35 @@ StarTip.tooltipMain = LQT:Acquire("StarTipQTipMain", 2) StarTip.tooltipMain:SetParent(UIParent) _G["StarTipQTipMain"] = StarTip.tooltipMain +local trunk = {} +local trunkLines = 1 +local function trunkUpdate() + if GameTooltip:NumLines() > trunkLines then + for i = trunkLines, GameTooltip:NumLines() do + local r1, g1, b1 = StarTip.leftLines[i]:GetTextColor(); + local r2, g2, b2 = StarTip.rightLines[i]:GetTextColor(); + local txt1 = StarTip.leftLines[i]:GetText() + local txt2 = StarTip.rightLines[i]:GetText() + tinsert(trunk, {txt1, r1, g1, b1, txt2, r2, g2, b2}) + end + trunkLines = GameTooltip:NumLines() + end +end + +function StarTip:TrunkAdd(...) + tinsert(trunk, StarTip.new(...)) +end + +function StarTip:TrunkClear() + for i, v in ipairs(trunk) do + StarTip.del(v) + end + wipe(trunk) +end + +StarTip.trunk = trunk +StarTip.trunkTimer = LibTimer:New("Trunk Timer", 100, false, trunkUpdate) + function StarTip:OnEnable() if self.db.profile.minimap.hide then LibDBIcon:Hide("StarTipLDB") @@ -678,6 +707,9 @@ function StarTip.OnTooltipSetUnit(...) if not unit or StarTip.tooltipHidden then GameTooltip:Hide() return end + StarTip:TrunkClear() + trunkLines = GameTooltip:NumLines() + hideTimer = hideTimer or LibTimer:New("StarTip.Hide", 100, false, hideTooltip, nil, StarTip.db.profile.errorLevel) hideTimer:Start() @@ -704,6 +736,7 @@ function StarTip.OnTooltipSetUnit(...) StarTip.justSetUnit = nil --checkTooltipAlphaFrame:SetScript("OnUpdate", checkTooltipAlpha) StarTip.tooltipMain:Show() + StarTip.trunkTimer:Start() end function StarTip.OnTooltipSetItem(self, ...)