From c68e48111de8552d719891ef413783924a70fdc6 Mon Sep 17 00:00:00 2001 From: Brues <5278969+brues-code@users.noreply.github.com> Date: Sun, 12 Jul 2026 14:01:25 -0500 Subject: [PATCH] Remove libtooltip --- init/libs.xml | 1 - libs/libtooltip.lua | 59 --------------------------------------------- modules/tooltip.lua | 12 ++++----- 3 files changed, 6 insertions(+), 66 deletions(-) delete mode 100644 libs/libtooltip.lua diff --git a/init/libs.xml b/init/libs.xml index 6c57da01..826a0c87 100644 --- a/init/libs.xml +++ b/init/libs.xml @@ -4,7 +4,6 @@ - diff --git a/libs/libtooltip.lua b/libs/libtooltip.lua deleted file mode 100644 index 86dec833..00000000 --- a/libs/libtooltip.lua +++ /dev/null @@ -1,59 +0,0 @@ --- load pfUI environment -setfenv(1, pfUI:GetEnvironment()) - ---[[ libtooltip ]]-- --- A pfUI library that provides additional GameTooltip information. --- --- libtooltip:GetItemID() --- returns the itemID of the current GameTooltip --- `nil` when no item is displayed --- --- libtooltip:GetItemLink() --- returns the itemLink of the current GameTooltip --- `nil` when no item is displayed --- --- libtooltip:GetItemCount() --- returns the item count (bags) of the current GameTooltip --- `nil` when no item is displayed - --- return instantly when another libtooltip is already active -if pfUI.api.libtooltip then return end - -local libtooltip = CreateFrame("Frame" , "pfLibTooltip", GameTooltip) - -libtooltip:SetScript("OnShow", function() - if this:GetParent():HasItem() then - libtooltip.itemName, libtooltip.itemLink, libtooltip.itemID = this:GetParent():GetItem() - end -end) - -libtooltip:SetScript("OnHide", function() - this.itemID = nil - this.itemLink = nil - this.itemCount = nil - this.itemName = nil -end) - --- core functions -libtooltip.GetItemID = function(self) - if not libtooltip.itemLink then return end - if not libtooltip.itemID then - libtooltip.itemID = C_Item.GetItemInfoInstant(libtooltip.itemLink) - end - - return libtooltip.itemID -end - -libtooltip.GetItemLink = function(self) - return libtooltip.itemLink -end - -libtooltip.GetItemCount = function(self) - return libtooltip.itemCount -end - -pfUI.api.libtooltip = libtooltip - -hooksecurefunc(GameTooltip, "SetBagItem", function(self, container, slot) - _, libtooltip.itemCount = GetContainerItemInfo(container, slot) -end) diff --git a/modules/tooltip.lua b/modules/tooltip.lua index 622bb93a..8a697512 100644 --- a/modules/tooltip.lua +++ b/modules/tooltip.lua @@ -3,8 +3,7 @@ pfUI:RegisterModule("tooltip", function () pfUI.tooltip = CreateFrame('Frame', "pfTooltip", GameTooltip) pfUI.tooltip.anchorframe = CreateFrame('Frame', "pfTooltipAnchor", UIParent) - pfUI.tooltip.anchorframe:SetWidth(128) - pfUI.tooltip.anchorframe:SetHeight(72) + pfUI.tooltip.anchorframe:SetSize(128, 72) pfUI.tooltip.anchorframe:SetPoint("TOP", UIParent, "TOP", 0, -50) pfUI.tooltip.anchorframe:Hide() UpdateMovable(pfUI.tooltip.anchorframe) @@ -30,8 +29,8 @@ pfUI:RegisterModule("tooltip", function () -- create mouse follow frame if not tooltip.cursor then tooltip.cursor = CreateFrame("Frame", nil, UIParent) - tooltip.cursor:SetWidth(tonumber(C.tooltip.cursoroffset) * 2) - tooltip.cursor:SetHeight(tonumber(C.tooltip.cursoroffset) * 2) + local size = tonumber(C.tooltip.cursoroffset) * 2 + tooltip.cursor:SetSize(size, size) tooltip.cursor:SetScript("OnUpdate", function() -- throttle - cursor following doesn't need to be every frame if (this.tick or 0) > GetTime() then return end @@ -172,8 +171,9 @@ pfUI:RegisterModule("tooltip", function () local unit = pfUI.tooltip:GetUnit() if unit == "none" then -- process item tooltips - if C.tooltip.itemid == "1" and libtooltip:GetItemID() then - GameTooltip:AddLine(T["ItemID"] .. ": " .. libtooltip:GetItemID(), .25,.5,1) + if C.tooltip.itemid == "1" and GameTooltip:HasItem() then + local _, _, itemID = GameTooltip:GetItem() + GameTooltip:AddLine(T["ItemID"] .. ": " .. itemID, .25,.5,1) GameTooltip:Show() end