Загрузить файлы в «/»

This commit is contained in:
Ade
2026-11-01 11:35:14 +00:00
parent ac5248f9b7
commit d8ecbb6694
5 changed files with 156 additions and 38 deletions
+1 -1
View File
@@ -2,7 +2,7 @@
## Title: Ade Alts
## Notes: Alt manager: cooldowns, inventory, bank, gear, professions and missing recipes of all your characters. /ade
## Author: Ade
## Version: 1.2.4
## Version: 1.2.5
## SavedVariables: AdeAltsDB, ProfCDTrackerDB
## OptionalDeps: pfUI, SuperWoW, nampower
core.lua
+4
View File
@@ -1,5 +1,9 @@
# Changelog
## 1.2.5
- Item tooltips now show how many of the item your other alts carry (bags / bank, per alt).
- Fixed: alt info could be added twice to a tooltip.
## 1.2.4
- Fixed: recipe items whose name differs from the crafted item (e.g. Pattern: Guardian Bracers -> Guardian Leather Bracers) showed no alt info. Recipes are now identified by item id.
+3 -1
View File
@@ -5,9 +5,10 @@ including those on **other accounts**, and shows it in one window.
- **Profession cooldowns** – Salt Shaker, Transmutes, Mooncloth; "ready" popup at login.
- **Alt list** – level, class icon, sorted by level or name.
- **Item tooltips** show how many of the item your other alts carry (bags / bank).
- **Inventory and bank** of every alt, with each bag and its used/total slots, plus **item search** across all of them.
- **Total gold** of all alts.
- **Professions** – skill levels, known and **missing recipes** with required level and source (trainer, vendor, drop, quest...), sortable, with tooltips. Recipe items also show which of your alts can learn them.
- **Professions** – skill levels, known and **missing recipes** with required level and source (trainer, vendor, drop, quest...), sortable, with tooltips. Recipe items also show which of your alts can learn them, and every item tooltip shows how many of it your other alts carry.
- **Equipped gear** of every alt.
- **Minimap button** – docks into pfUI's addon button panel automatically.
- **Settings** – window scale, width, height, background opacity, background colour, cooldown-window opacity.
@@ -56,6 +57,7 @@ Every alias works the same: `/ade`, `/adealts`, `/pcd`, `/profcd`, `/cdt`.
| `/ade reset` | Set all cooldowns of the current character to Ready |
| `/ade del <name>` | Remove a cached character and ignore it from now on, so chat / shared-file sync cannot bring it back (not the one you are logged in on) |
| `/ade unignore <name>` | Stop ignoring a character removed with `del` |
| `/ade counts` | Turn the "On alts: N" item amounts in item tooltips on / off |
| `/ade chat` | Turn guild / party / raid addon-message sync on or off (**off by default**; SuperWoW file sync is unaffected) |
## How data is shared
+1 -1
View File
@@ -7,7 +7,7 @@ local AA = AdeAlts
-- Command: /pcd Minimap button: auto-docked by pfUI's addon button panel.
AA.ADDON = "AdeAlts"
AA.VERSION = "1.2.4"
AA.VERSION = "1.2.5"
AA.PREFIX = "PCDT"
AA.DAY = 86400
AA.RDATA = {} -- recipe database, filled by the data_*.lua files
+147 -35
View File
@@ -31,44 +31,156 @@ local function FindHits(tt)
return nil
end
function AA.EnhanceTooltip(tt)
if not AA.db or not AA.RIndex or tt.adeDone then return end
local hits = FindHits(tt)
if not hits then return end
tt.adeDone = true
local added = false
for _, h in ipairs(hits) do
local key = string.lower(h.c[2])
for _, k in ipairs(AA.SortedAlts()) do
local ch = AA.db.chars[k]
local p = ch and ch.prof and ch.prof[h.prof]
if p then
if not added then
tt:AddLine(" ")
tt:AddLine("Ade Alts", 0.2, 1, 0.8)
added = true
end
local col = "|cff" .. AA.ClassHex(ch.class)
local label
if not p.rec then
label = "|cff808080" .. h.prof .. " recipes not scanned|r"
else
local has = false
for _, n in ipairs(p.rec) do
if string.lower(n) == key then has = true; break end
end
if has then
label = "|cff808080already known|r"
elseif h.c[3] > (p.r or 0) then
label = "|cffff6060needs " .. h.prof .. " " .. h.c[3] .. " (has " .. (p.r or 0) .. ")|r"
else
label = "|cff40ff40can learn now|r"
end
end
tt:AddDoubleLine(col .. ch.name .. "|r", label)
-- item id of the tooltip (from the item link, or an "ItemID: n" line added by another addon)
local function ItemId(tt)
if tt.adeLink then
local _, _, id = string.find(tt.adeLink, "item:(%d+)")
if id then return tonumber(id) end
end
local name = tt:GetName()
for i = 1, tt:NumLines() do
local fs = getglobal(name .. "TextLeft" .. i)
local txt = fs and fs:GetText()
local _, _, id = string.find(txt or "", "ItemID: (%d+)")
if id then return tonumber(id) end
end
return nil
end
-- how many of the item the other alts carry: total, {{name, class, bags, bank}, ...}
local function CountOnAlts(id)
local total, rows = 0, {}
for _, k in ipairs(AA.SortedAlts()) do
local c = AA.db.chars[k]
if c and k ~= AA.myKey then
local nb, nk = 0, 0
for _, e in ipairs(c.inv or {}) do if e[1] == id then nb = nb + e[2] end end
for _, e in ipairs(c.bank or {}) do if e[1] == id then nk = nk + e[2] end end
if nb + nk > 0 then
total = total + nb + nk
table.insert(rows, { c = c, bags = nb, bank = nk })
end
end
end
return total, rows
end
-- item id of the tooltip (item link, or an "ItemID: n" line some addons add)
local function TipItemId(tt)
if tt.adeLink then
local _, _, id = string.find(tt.adeLink, "item:(%d+)")
if id then return tonumber(id) end
end
local name = tt:GetName()
for i = 1, tt:NumLines() do
local fs = getglobal(name .. "TextLeft" .. i)
local txt = fs and fs:GetText()
if txt then
local _, _, id = string.find(txt, "ItemID: (%d+)")
if id then return tonumber(id) end
end
end
return nil
end
local function HasHeader(tt)
local name = tt:GetName()
for i = 1, tt:NumLines() do
local fs = getglobal(name .. "TextLeft" .. i)
if fs and fs:GetText() == "Ade Alts" then return true end
end
return false
end
local function CountIn(list, id)
if not list then return 0 end
for _, e in ipairs(list) do
if e[1] == id then return e[2] or 0 end
end
return 0
end
function AA.EnhanceTooltip(tt)
if not AA.db or not AA.RIndex or tt.adeDone then return end
if HasHeader(tt) then tt.adeDone = true; return end
local added = false
local function header()
if not added then
tt:AddLine(" ")
tt:AddLine("Ade Alts", 0.2, 1, 0.8)
added = true
end
end
-- 1) recipe items: which alts know / can learn the recipe
local hits = FindHits(tt)
if hits then
local done = {}
for _, h in ipairs(hits) do
local key = string.lower(h.c[2])
if not done[h.prof .. "|" .. key] then
done[h.prof .. "|" .. key] = true
for _, k in ipairs(AA.SortedAlts()) do
local ch = AA.db.chars[k]
local p = ch and ch.prof and ch.prof[h.prof]
if p then
header()
local col = "|cff" .. AA.ClassHex(ch.class)
local label
if not p.rec then
label = "|cff808080" .. h.prof .. " recipes not scanned|r"
else
local has = false
for _, n in ipairs(p.rec) do
if string.lower(n) == key then has = true; break end
end
if has then
label = "|cff808080already known|r"
elseif h.c[3] > (p.r or 0) then
label = "|cffff6060needs " .. h.prof .. " " .. h.c[3] .. " (has " .. (p.r or 0) .. ")|r"
else
label = "|cff40ff40can learn now|r"
end
end
tt:AddDoubleLine(col .. ch.name .. "|r", label)
end
end
end
end
end
-- 2) how many of the item the other alts carry (bags + bank)
local id = TipItemId(tt)
if id then
local rows, total = {}, 0
for _, k in ipairs(AA.SortedAlts()) do
if k ~= AA.myKey then
local ch = AA.db.chars[k]
local nb, nk = CountIn(ch.inv, id), CountIn(ch.bank, id)
if nb + nk > 0 then
table.insert(rows, { ch = ch, b = nb, k = nk })
total = total + nb + nk
end
end
end
if table.getn(rows) > 0 then
table.sort(rows, function(x, y) return (x.b + x.k) > (y.b + y.k) end)
header()
tt:AddDoubleLine("On alts:", "|cffffffff" .. total .. "|r")
for i, r in ipairs(rows) do
if i > 10 then
tt:AddLine(" ... and " .. (table.getn(rows) - 10) .. " more", 0.6, 0.6, 0.6)
break
end
local parts = {}
if r.b > 0 then table.insert(parts, "bags " .. r.b) end
if r.k > 0 then table.insert(parts, "bank " .. r.k) end
tt:AddDoubleLine(" |cff" .. AA.ClassHex(r.ch.class) .. r.ch.name .. "|r", "|cffc0c0c0" .. table.concat(parts, ", ") .. "|r")
end
end
end
tt.adeDone = true
if added then tt:Show() end
end