From e0af01125cfc9377ad2bfd1936e7ade3b7a9c086 Mon Sep 17 00:00:00 2001 From: totalllyswede Date: Fri, 5 Jun 2026 22:41:20 -0700 Subject: [PATCH] Add files via upload --- LockpickTooltip.lua | 82 ++++++++++++++++++++++++++++++++++++--------- LockpickTooltip.toc | 2 +- README.md | 19 +++++++---- 3 files changed, 80 insertions(+), 23 deletions(-) diff --git a/LockpickTooltip.lua b/LockpickTooltip.lua index 75a5e20..5ef91b0 100644 --- a/LockpickTooltip.lua +++ b/LockpickTooltip.lua @@ -9,6 +9,14 @@ local function GetItemIDFromLink(link) return tonumber(idStr) end +------------------------------------------------------------------------------- +-- SETTINGS +-- LockpickTooltipDB is a SavedVariable persisted across sessions. +-- colorMode: "simple" = green (pickable) / red (too low) +-- "match" = copy the colour of the game's own "Locked" text +------------------------------------------------------------------------------- +LockpickTooltipDB = LockpickTooltipDB or { colorMode = "simple" } + ------------------------------------------------------------------------------- -- LOCKPICKING SKILL REQUIREMENTS -- @@ -198,15 +206,43 @@ local orig_SetQuestItem = GameTooltip.SetQuestItem local orig_SetQuestLogItem = GameTooltip.SetQuestLogItem 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. +local function GetLineColor(pickable) + if LockpickTooltipDB.colorMode == "match" then + for i = 1, 30 do + local left = getglobal("GameTooltipTextLeft" .. i) + if not left then break end + 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) + end + end + end + -- simple mode fallback + if pickable then + return "|cff00ff00" + else + return "|cffff2020" + end +end + -- Append lockpick line for a known item ID local function AppendItemLockLine(itemID) if not itemID then return end local req = LOCKBOX_ITEMS[itemID] if req then - if CanPickLock(req) then - GameTooltip:AddLine("|cff00ff00Pickable (" .. req .. ")|r") + local pickable = CanPickLock(req) + local color = GetLineColor(pickable) + if pickable then + GameTooltip:AddLine(color .. "Pickable (" .. req .. ")|r") else - GameTooltip:AddLine("|cffff2020Skill Level Too Low (" .. req .. ")|r") + GameTooltip:AddLine(color .. "Skill Level Too Low (" .. req .. ")|r") end GameTooltip:Show() end @@ -248,10 +284,12 @@ local function AddMultiLevelLine(levels) -- Single level: straightforward if table.getn(levels) == 1 then local req = levels[1] - if CanPickLock(req) then - GameTooltip:AddLine("|cff00ff00Pickable (" .. req .. ")|r") + local pickable = CanPickLock(req) + local color = GetLineColor(pickable) + if pickable then + GameTooltip:AddLine(color .. "Pickable (" .. req .. ")|r") else - GameTooltip:AddLine("|cffff2020Skill Level Too Low (" .. req .. ")|r") + GameTooltip:AddLine(color .. "Skill Level Too Low (" .. req .. ")|r") end GameTooltip:Show() return @@ -264,13 +302,16 @@ local function AddMultiLevelLine(levels) if lockedColor == "red" and CanPickLock(low) then -- Locked is red but player can pick the low variant - must be the higher one - GameTooltip:AddLine("|cffff2020Skill Level Too Low (" .. high .. ")|r") + local color = GetLineColor(false) + GameTooltip:AddLine(color .. "Skill Level Too Low (" .. high .. ")|r") elseif lockedColor == "red" then -- Locked is red and player can't pick either - too low for even the lowest - GameTooltip:AddLine("|cffff2020Skill Level Too Low (" .. low .. ")|r") + local color = GetLineColor(false) + GameTooltip:AddLine(color .. "Skill Level Too Low (" .. low .. ")|r") else -- Locked is not red (orange/yellow/green/grey) - player can pick it - GameTooltip:AddLine("|cff00ff00Pickable (" .. low .. ")|r") + local color = GetLineColor(true) + GameTooltip:AddLine(color .. "Pickable (" .. low .. ")|r") end GameTooltip:Show() end @@ -349,10 +390,12 @@ local function AppendObjectLockLine(name) -- ----------------------------------------------------------------------- local req = LOCKABLE_OBJECTS[name] if req then - if CanPickLock(req) then - GameTooltip:AddLine("|cff00ff00Pickable (" .. req .. ")|r") + local pickable = CanPickLock(req) + local color = GetLineColor(pickable) + if pickable then + GameTooltip:AddLine(color .. "Pickable (" .. req .. ")|r") else - GameTooltip:AddLine("|cffff2020Skill Level Too Low (" .. req .. ")|r") + GameTooltip:AddLine(color .. "Skill Level Too Low (" .. req .. ")|r") end GameTooltip:Show() end @@ -496,13 +539,22 @@ SlashCmdList["LOCKPICKTIP"] = function(msg) for name, req in pairs(LOCKABLE_OBJECTS) do DEFAULT_CHAT_FRAME:AddMessage(" |cffaaddff" .. name .. "|r - Requires: " .. req) end + elseif arg == "color" or arg == "colour" then + if LockpickTooltipDB.colorMode == "simple" then + LockpickTooltipDB.colorMode = "match" + DEFAULT_CHAT_FRAME:AddMessage("|cffffff00LockpickTooltip|r: Color mode set to |cffaaddffMatch|r - tooltip text will match the game's Locked color.") + else + LockpickTooltipDB.colorMode = "simple" + DEFAULT_CHAT_FRAME:AddMessage("|cffffff00LockpickTooltip|r: Color mode set to |cffaaddffSimple|r - |cff00ff00green|r = pickable, |cffff2020red|r = too low.") + end else - DEFAULT_CHAT_FRAME:AddMessage("|cffffff00LockpickTooltip v1.0|r - Tooltip skill hints for rogues") + DEFAULT_CHAT_FRAME:AddMessage("|cffffff00LockpickTooltip|r (1.2.0) - Tooltip skill hints for rogues") DEFAULT_CHAT_FRAME:AddMessage("Commands:") DEFAULT_CHAT_FRAME:AddMessage(" |cffaaddff/lpt items|r - list known lockboxes") DEFAULT_CHAT_FRAME:AddMessage(" |cffaaddff/lpt objects|r - list known lockable objects") - DEFAULT_CHAT_FRAME:AddMessage("Tooltip colors: |cff00ff00Green|r = can pick, |cffffff00Yellow|r = within 25 skill, |cffff4444Red|r = too low") + DEFAULT_CHAT_FRAME:AddMessage(" |cffaaddff/lpt color|r - toggle color mode (currently: " .. LockpickTooltipDB.colorMode .. ")") + DEFAULT_CHAT_FRAME:AddMessage("Color modes: |cffaaddffSimple|r = green/red | |cffaaddffMatch|r = mirrors game Locked color") end end -DEFAULT_CHAT_FRAME:AddMessage("|cffffff00LockpickTooltip v1.2.0|r loaded. Type |cffaaddff/lpt|r for help.") +DEFAULT_CHAT_FRAME:AddMessage("|cffffff00LockpickTooltip|r (1.2.0) loaded. Type |cffaaddff/lpt|r for help.") diff --git a/LockpickTooltip.toc b/LockpickTooltip.toc index e04b202..aff20e6 100644 --- a/LockpickTooltip.toc +++ b/LockpickTooltip.toc @@ -3,6 +3,6 @@ ## Notes: Shows required lockpicking skill on item/object tooltips ## Author: Olzon ## Version: 1.2.0 -## SavedVariables: +## SavedVariables: LockpickTooltipDB LockpickTooltip.lua diff --git a/README.md b/README.md index c189bbf..3789989 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # LockpickTooltip ### World of Warcraft 1.12.1 (Vanilla) Addon — v1.2.0 Stable -Adds a line to item and world-object tooltips showing the required Lockpicking skill, colour-coded green if you can pick it or red if your skill is too low. +Adds a line to item and world-object tooltips showing the required Lockpicking skill, colour-coded based on whether you can pick it or not. --- @@ -10,10 +10,13 @@ Adds a line to item and world-object tooltips showing the required Lockpicking s - Works on **bag items** (lockboxes, junkboxes) - Works on **world objects** (chests, doors, footlockers) - Works in **loot windows**, **merchant windows**, **chat item links**, and **quest windows** -- Colour-coded tooltip line: - - Green **Pickable (175)** — your skill meets the requirement - - Red **Skill Level Too Low (225)** — your skill is too low -- Slash command `/lpt` or `/lockpick` for help and item lists +- Only shows on locked objects — unlocked chests are ignored +- Zone-aware skill requirements for footlockers with multiple variants (Battered, Waterlogged, Mossy, Dented) +- Uses the game's own "Locked" text colour to determine which variant a footlocker is when multiple exist in a zone +- Two colour modes selectable via `/lpt color`: + - **Simple** (default): Green = Pickable, Red = Skill Level Too Low + - **Match**: mirrors the colour of the game's own "Locked" text (red, orange, yellow, green, or grey) +- Setting is saved between sessions --- @@ -34,6 +37,7 @@ Adds a line to item and world-object tooltips showing the required Lockpicking s | `/lpt` | Show help | | `/lpt items` | List all known lockbox items and their requirements | | `/lpt objects` | List all known lockable world objects and their requirements | +| `/lpt color` | Toggle between Simple and Match colour modes | --- @@ -46,15 +50,16 @@ Adds a line to item and world-object tooltips showing the required Lockpicking s **World Objects** - Rogue training boxes: Buccaneer's Strongbox, Practice Lockbox +- Footlockers with zone-aware requirements: Battered, Waterlogged, Mossy, Dented, Scarlet - Outdoor chests across all Classic zones - Dungeon chests: Shadowfang Keep, Gnomeregan, Scarlet Monastery, Uldaman, Zul'Farrak, Maraudon, Sunken Temple, Blackrock Depths, Blackrock Spire, Dire Maul, Scholomance, Stratholme -- Lockable doors: SM Cathedral, Gnomeregan, Scholomance, Stratholme Service Entrance +- Lockable doors: Deadmines, Gnomeregan, SM Armory, SM Cathedral, Searing Gorge Gate, Blackrock Depths, Dire Maul (Crescent Door, Gordok Inner Door, Hidden Reach Door), Scholomance, Stratholme Service Entrance --- ## Version History -**1.2.0** — Stable. Full zone-aware footlocker coverage from spreadsheet data (Battered, Waterlogged, Mossy, Dented). Multi-variant footlockers now use the game's own "Locked" text colour to determine which variant is present, showing a single accurate line instead of multiple. Added Scarlet Footlocker (Eastern Plaguelands, 250). All dungeon door skill requirements corrected. Added Deadmines and Dire Maul doors. +**1.2.0** — Stable. Full zone-aware footlocker coverage (Battered, Waterlogged, Mossy, Dented, Scarlet). Multi-variant footlockers use the game's Locked text colour to identify which variant is present. Added colour mode toggle (/lpt color) saved between sessions. All dungeon door requirements corrected. Added Deadmines and Dire Maul doors. **1.1.0** — Zone-aware skill requirements for Battered Footlocker. Corrected all item IDs against wowhead.com/classic. Tooltip now shows Pickable/Skill Level Too Low in green/red.