Files
notforever-ship-it 082da1c0f0 Release 1.6.1: move the addon to the repo root for addon launchers
Launchers that install straight from a GitHub address expect the .toc
at the top level; the PokeHuntLog subfolder made the install fail.
tools/ is now export-ignored so release zips stay clean, and they keep
a PokeHuntLog/ prefix for manual installs.
2026-09-17 10:00:34 +01:00

46 lines
1.4 KiB
Lua

-- PokeHuntLog: adds a line to a beast's tooltip saying whether you've caught its skin yet.
local HPL = PokeHuntLog
local busy = false
local function SkinLine()
if not HPL.db or not HPL.db.settings.tooltip or not HPL.IsHunter() then return nil end
if not UnitExists("mouseover") then return nil end
if UnitIsPlayer("mouseover") or UnitPlayerControlled("mouseover") then return nil end
local family = UnitCreatureFamily("mouseover")
if not family then return nil end
local name = UnitName("mouseover")
local ids = HPL.NpcIdsFromGuid(HPL.UnitGuid("mouseover"))
local skinId = HPL.ResolveSkin(family, name, ids)
if not skinId then
return "PokeHuntLog: " .. family .. ", skin not in the list", 0.6, 0.6, 0.6
end
local def = HPL.skinsById[skinId]
if HPL.caught[skinId] then
local c = HPL.caught[skinId]
return "PokeHuntLog: " .. def.name .. " - caught (best " .. (c.maxLevel or 0) .. ")", 0.6, 0.6, 0.6
end
return "PokeHuntLog: " .. def.name .. " - NEW skin!", 0.25, 1, 0.25
end
local function AddSkinLine()
if busy then return end
busy = true
local ok, line, r, g, b = pcall(SkinLine)
if ok and line then
GameTooltip:AddLine(line, r, g, b)
GameTooltip:Show()
end
busy = false
end
function HPL.InitTooltip()
local original = GameTooltip:GetScript("OnShow")
GameTooltip:SetScript("OnShow", function()
if original then original() end
AddSkinLine()
end)
end