From 5d93c708b2f68be8fefe99927582e983b5e59475 Mon Sep 17 00:00:00 2001 From: totalllyswede Date: Sun, 14 Jun 2026 12:54:15 -0700 Subject: [PATCH] Add files via upload --- LockpickTooltip.lua | 51 ++++++++++++++++++++++++++++++++++----------- 1 file changed, 39 insertions(+), 12 deletions(-) diff --git a/LockpickTooltip.lua b/LockpickTooltip.lua index 5ef91b0..64463f9 100644 --- a/LockpickTooltip.lua +++ b/LockpickTooltip.lua @@ -56,12 +56,8 @@ local LOCKBOX_ITEMS = { -- In 1.12.1 we can check GameTooltip target via mouseover; object names are -- the most reliable hook available since object IDs aren't directly exposed -- in the 1.12 API the same way item IDs are. -local LOCKABLE_OBJECTS = { - -- ===== Rogue training objects ===== - ["Buccaneer's Strongbox"] = 0, -- Horde rogue quest, ship near Ratchet in The Barrens - ["Practice Lockbox"] = 0, -- Alliance rogue quest, Alther's Mill in Redridge - - -- ===== Doors ===== +-- Doors always use simple green/red colouring regardless of colour mode setting +local LOCKABLE_DOORS = { ["Ironclad Cove Gate"] = 150, -- Deadmines ["Water Gate"] = 150, -- Deadmines ["Gnomeregan Door"] = 150, -- Gnomeregan backdoor @@ -78,6 +74,12 @@ local LOCKABLE_OBJECTS = { ["Scholomance Door"] = 280, -- Scholomance main entrance ["Service Entrance Door"] = 300, -- Stratholme servant's entrance ["Stratholme Gate"] = 300, -- Stratholme (alternate name) +} + +local LOCKABLE_OBJECTS = { + -- ===== Rogue training objects ===== + ["Buccaneer's Strongbox"] = 0, -- Horde rogue quest, ship near Ratchet in The Barrens + ["Practice Lockbox"] = 0, -- Alliance rogue quest, Alther's Mill in Redridge -- ===== Silverpine Forest ===== ["Decrepit Chest"] = 1, @@ -208,7 +210,10 @@ local orig_SetHyperlink = GameTooltip.SetHyperlink -- Returns the colour code to use for a tooltip line. -- "simple" mode: green if pickable, red if not. --- "match" mode: copy the r,g,b from the game's own "Locked" text line. +-- "match" mode: copy the r,g,b from the game's own "Locked" text line, +-- but only if a Locked line is actually present and skill-gated +-- (i.e. its colour is not just default white/grey descriptive text). +-- Falls back to simple if no usable Locked line is found. local function GetLineColor(pickable) if LockpickTooltipDB.colorMode == "match" then for i = 1, 30 do @@ -217,14 +222,23 @@ local function GetLineColor(pickable) local t = left:GetText() if t and string.find(t, "Locked") then local r, g, b = left:GetTextColor() - r = math.floor((r or 0) * 255) - g = math.floor((g or 0) * 255) - b = math.floor((b or 0) * 255) - return string.format("|cff%02x%02x%02x", r, g, b) + r = r or 0 + g = g or 0 + b = b or 0 + -- Only use this colour if it looks like a skill-gated line: + -- skill-gated Locked lines are red, orange, yellow, green, or grey + -- but NOT plain white (r~1, g~1, b~1) which is just descriptive text + local isWhite = r > 0.9 and g > 0.9 and b > 0.9 + if not isWhite then + local ri = math.floor(r * 255) + local gi = math.floor(g * 255) + local bi = math.floor(b * 255) + return string.format("|cff%02x%02x%02x", ri, gi, bi) + end end end end - -- simple mode fallback + -- simple mode or no usable Locked line found if pickable then return "|cff00ff00" else @@ -319,6 +333,19 @@ end -- Append lockpick line for a known object name local function AppendObjectLockLine(name) if not name then return end + + -- Doors: always use simple green/red, no colour matching + local doorReq = LOCKABLE_DOORS[name] + if doorReq then + if CanPickLock(doorReq) then + GameTooltip:AddLine("|cff00ff00Pickable (" .. doorReq .. ")|r") + else + GameTooltip:AddLine("|cffff2020Skill Level Too Low (" .. doorReq .. ")|r") + end + GameTooltip:Show() + return + end + if not IsTooltipLocked() then return end local zone = GetRealZoneText()