From bd480d6789306563b2eca79f322e1c533a544fb6 Mon Sep 17 00:00:00 2001 From: Ade <923+ade@noreply.octowow.st> Date: Wed, 14 Oct 2026 11:48:45 +0000 Subject: [PATCH] =?UTF-8?q?=D0=97=D0=B0=D0=B3=D1=80=D1=83=D0=B7=D0=B8?= =?UTF-8?q?=D1=82=D1=8C=20=D1=84=D0=B0=D0=B9=D0=BB=D1=8B=20=D0=B2=20=C2=AB?= =?UTF-8?q?/=C2=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ui_layout.lua | 7 +++--- ui_profs.lua | 62 +++++++++++++++++++++++++++++++++++++++++++++------ ui_show.lua | 38 ++++++++++++++++++++++++++----- 3 files changed, 92 insertions(+), 15 deletions(-) diff --git a/ui_layout.lua b/ui_layout.lua index 53a3174..92a2492 100644 --- a/ui_layout.lua +++ b/ui_layout.lua @@ -60,14 +60,15 @@ function AA.Layout() AA.PR:SetHeight(bh) AA.PR:ClearAllPoints() AA.PR:SetPoint("TOPLEFT", AA.P, "TOPLEFT", 12 + psw, -84) - AA.RROWS = math.max(1, math.floor((bh - 34) / AA.RROWH)) + AA.RROWS = math.max(1, math.floor((bh - 56) / AA.RROWH)) while table.getn(AA.recRows) < AA.RROWS do AA.MakeRecRow() end for i, r in ipairs(AA.recRows) do r:Hide() r:SetWidth(prw - 36) - r.text:SetWidth(prw - 40) + r.src:SetWidth(math.floor((prw - 36) * 0.38)) + r.text:SetWidth(prw - 36 - 40 - math.floor((prw - 36) * 0.38)) r:ClearAllPoints() - r:SetPoint("TOPLEFT", AA.PR, "TOPLEFT", 10, -28 - (i - 1) * AA.RROWH) + r:SetPoint("TOPLEFT", AA.PR, "TOPLEFT", 10, -50 - (i - 1) * AA.RROWH) end -- search results diff --git a/ui_profs.lua b/ui_profs.lua index d5fcadb..8bdf69b 100644 --- a/ui_profs.lua +++ b/ui_profs.lua @@ -56,9 +56,34 @@ AA.PR.empty:SetPoint("CENTER", AA.PR, "CENTER", 0, 0) AA.PR.empty:SetWidth(240) AA.PR.empty:Hide() +-- mode / sort buttons (second header row) +local function MakeRecBtn(label, field, value, x, w) + local b = CreateFrame("Button", nil, AA.PR, "UIPanelButtonTemplate") + b:SetWidth(w) + b:SetHeight(18) + b:SetPoint("TOPLEFT", AA.PR, "TOPLEFT", x, -26) + b:SetText(label) + b.field, b.value = field, value + b:SetScript("OnClick", function() + AA.db[this.field] = this.value + AA.ResetScroll(AA.PR.sf) + AA.RefreshManager() + end) + return b +end +AA.PR.btns = { + MakeRecBtn("Known", "recMode", "known", 10, 60), + MakeRecBtn("Missing", "recMode", "missing", 74, 64), + MakeRecBtn("Level", "recSort", "level", 160, 54), + MakeRecBtn("Name", "recSort", "name", 218, 54), +} +AA.PR.sortLabel = AA.PR:CreateFontString(nil, "OVERLAY", "GameFontDisableSmall") +AA.PR.sortLabel:SetPoint("RIGHT", AA.PR.btns[3], "LEFT", -4, 0) +AA.PR.sortLabel:SetText("Sort:") + AA.recList, AA.recRows = {}, {} AA.PR.sf = CreateFrame("ScrollFrame", "AdeAltsRecipeScroll", AA.PR, "FauxScrollFrameTemplate") -AA.PR.sf:SetPoint("TOPLEFT", AA.PR, "TOPLEFT", 0, -26) +AA.PR.sf:SetPoint("TOPLEFT", AA.PR, "TOPLEFT", 0, -48) AA.PR.sf:SetPoint("BOTTOMRIGHT", AA.PR, "BOTTOMRIGHT", -26, 4) AA.PR.sf:SetScript("OnVerticalScroll", function() FauxScrollFrame_OnVerticalScroll(AA.RROWH, AA.UpdateRecipes) end) AA.PR:EnableMouseWheel(true) @@ -67,11 +92,21 @@ AA.PR:SetScript("OnMouseWheel", function() AA.ScrollWheel(AA.PR.sf, AA.RROWH) en function AA.MakeRecRow() local r = CreateFrame("Button", nil, AA.PR) r:SetHeight(AA.RROWH - 2) + r.lvl = r:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall") + r.lvl:SetPoint("LEFT", r, "LEFT", 2, 0) + r.lvl:SetWidth(34) + r.lvl:SetJustifyH("LEFT") + r.src = r:CreateFontString(nil, "OVERLAY", "GameFontDisableSmall") + r.src:SetPoint("RIGHT", r, "RIGHT", -2, 0) + r.src:SetJustifyH("RIGHT") r.text = r:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall") - r.text:SetPoint("LEFT", r, "LEFT", 2, 0) + r.text:SetPoint("LEFT", r.lvl, "RIGHT", 2, 0) r.text:SetJustifyH("LEFT") + r:SetHighlightTexture("Interface\\QuestFrame\\UI-QuestTitleHighlight") r:EnableMouseWheel(true) r:SetScript("OnMouseWheel", function() AA.ScrollWheel(AA.PR.sf, AA.RROWH) end) + r:SetScript("OnEnter", function() AA.RecipeTip(this) end) + r:SetScript("OnLeave", function() GameTooltip:Hide() end) r:Hide() table.insert(AA.recRows, r) end @@ -79,16 +114,29 @@ end AA.UpdateRecipes = function() FauxScrollFrame_Update(AA.PR.sf, table.getn(AA.recList), AA.RROWS, AA.RROWH) local off = FauxScrollFrame_GetOffset(AA.PR.sf) + local missing = AA.db and AA.db.recMode == "missing" + local rank = AA.recRank or 0 for i = 1, table.getn(AA.recRows) do local r = AA.recRows[i] - local name = nil - if i <= AA.RROWS then name = AA.recList[off + i] end - if name then - r.text:SetText(name) + local e = nil + if i <= AA.RROWS then e = AA.recList[off + i] end + if e then + r.entry = e + if e.skill > 0 then + r.lvl:SetText(AA.RecipeColor(e, rank) .. e.skill .. "|r") + else + r.lvl:SetText("|cff808080?|r") + end + r.text:SetText(e.name) + if missing and e.cr then + r.src:SetText(AA.CraftSource(e.cr)) + else + r.src:SetText("") + end r:Show() else + r.entry = nil r:Hide() end end end - diff --git a/ui_show.lua b/ui_show.lua index e517ace..d836e53 100644 --- a/ui_show.lua +++ b/ui_show.lua @@ -172,7 +172,12 @@ local function ShowProfs(c) if AA.NORECIPES[name] then r.sub:SetText("") elseif pr.rec and table.getn(pr.rec) > 0 then - r.sub:SetText(table.getn(pr.rec) .. " recipes known") + local kn, ms = AA.RecipeCounts(c, name) + if ms then + r.sub:SetText(kn .. " known, |cffff8040" .. ms .. " missing|r") + else + r.sub:SetText(kn .. " recipes known") + end else r.sub:SetText("recipes not scanned yet") end @@ -183,15 +188,38 @@ local function ShowProfs(c) end end local pr = AA.profSel and c.prof and c.prof[AA.profSel] - AA.recList = (pr and pr.rec) or {} - if AA.profSel then AA.PR.title:SetText("Known recipes: " .. AA.profSel) else AA.PR.title:SetText("Known recipes") end + local mode = (AA.db.recMode == "missing") and "missing" or "known" + local sort = (AA.db.recSort == "name") and "name" or "level" + AA.recRank = (pr and pr.r) or 0 + AA.recList = {} + for _, bt in ipairs(AA.PR.btns) do + local cur = (bt.field == "recMode" and mode) or sort + if bt.value == cur then bt:Disable() else bt:Enable() end + end + if AA.profSel then + AA.PR.title:SetText((mode == "missing" and "Missing recipes: " or "Known recipes: ") .. AA.profSel) + else + AA.PR.title:SetText("Recipes") + end if AA.profSel and AA.NORECIPES[AA.profSel] then AA.PR.note:SetText("") AA.PR.empty:SetText("|cff808080" .. AA.profSel .. " has no recipes to track.|r") AA.PR.empty:Show() elseif pr and pr.rts and pr.rts > 0 then - AA.PR.note:SetText(table.getn(AA.recList) .. " known, updated " .. AA.Ago(pr.rts)) - AA.PR.empty:Hide() + AA.recList = AA.RecipeList(c, AA.profSel, mode, sort) + if mode == "missing" and not AA.RDATA[AA.profSel] then + AA.PR.note:SetText("") + AA.PR.empty:SetText("|cff808080No recipe database for " .. AA.profSel .. ".|r") + AA.PR.empty:Show() + else + AA.PR.note:SetText(table.getn(AA.recList) .. (mode == "missing" and " missing" or " known") .. ", updated " .. AA.Ago(pr.rts)) + if table.getn(AA.recList) == 0 then + AA.PR.empty:SetText(mode == "missing" and "|cff40ff40Nothing missing!|r" or "") + AA.PR.empty:Show() + else + AA.PR.empty:Hide() + end + end else AA.PR.note:SetText("") if AA.profSel then