Quantcast

add ilvl support

rawoil [06-16-21 - 08:24]
add ilvl support
Filename
rTooltip/core.lua
diff --git a/rTooltip/core.lua b/rTooltip/core.lua
index f3be851..8fdbeb5 100644
--- a/rTooltip/core.lua
+++ b/rTooltip/core.lua
@@ -32,6 +32,7 @@ cfg.guildColor = {1,0,1}
 cfg.afkColor = {0,1,1}
 cfg.scale = 0.95
 cfg.fontFamily = STANDARD_TEXT_FONT
+cfg.alwaysCompare = true
 cfg.backdrop = {
   bgFile = "Interface\\Buttons\\WHITE8x8",
   bgColor = {0.08,0.08,0.1,0.92},
@@ -161,6 +162,19 @@ local function OnTooltipSetUnit(self)
   end
 end

+local function OnTooltipSetItem(self)
+  local _, link = self:GetItem()
+
+  if link then
+    local id = "|cFFCA3C3CID|r "..link:match(":(%w+)")
+    local level = GetDetailedItemLevelInfo(link) or 1
+    local text = "|cFFCA3C3C"..ITEM_LEVEL_ABBR.."|r "..level
+
+    self:AddLine(" ")
+    self:AddDoubleLine(id, text)
+  end
+end
+
 local function SetBackdropStyle(self,style)
   if self.TopOverlay then self.TopOverlay:Hide() end
   if self.BottomOverlay then self.BottomOverlay:Hide() end
@@ -244,13 +258,18 @@ GameTooltipStatusBar.bg:SetColorTexture(1,1,1)
 GameTooltipStatusBar.bg:SetVertexColor(0,0,0,0.5)

 --GameTooltipStatusBar:SetStatusBarColor()
-hooksecurefunc(GameTooltipStatusBar,"SetStatusBarColor", SetStatusBarColor)
+hooksecurefunc(GameTooltipStatusBar, "SetStatusBarColor", SetStatusBarColor)
 --GameTooltip_SetDefaultAnchor()
 if cfg.pos then hooksecurefunc("GameTooltip_SetDefaultAnchor", SetDefaultAnchor) end
 --GameTooltip_SetBackdropStyle
 hooksecurefunc("GameTooltip_SetBackdropStyle", SetBackdropStyle)
+--SharedTooltip_SetBackdropStyle
+hooksecurefunc("SharedTooltip_SetBackdropStyle", SetBackdropStyle)
+
 --OnTooltipSetUnit
 GameTooltip:HookScript("OnTooltipSetUnit", OnTooltipSetUnit)
+--OnTooltipSetItem
+GameTooltip:HookScript("OnTooltipSetItem", OnTooltipSetItem)

 --loop over tooltips
 local tooltips = { GameTooltip,ShoppingTooltip1,ShoppingTooltip2,ItemRefTooltip,ItemRefShoppingTooltip1,ItemRefShoppingTooltip2,WorldMapTooltip,
@@ -271,6 +290,13 @@ for i, menu in next, menues do
   menu:SetScale(cfg.scale)
 end

+-- compare items
+if cfg.alwaysCompare then
+  SetCVar("alwaysCompareItems", 1)
+else
+  SetCVar("alwaysCompareItems", 0)
+end
+
 --spellid line

 --func TooltipAddSpellID