From b87d8b521b77eaaa0950d2552a9d3a44ee9709b6 Mon Sep 17 00:00:00 2001 From: Wishmaster117 <140754794+Wishmaster117@users.noreply.github.com> Date: Sun, 29 Mar 2026 21:08:34 +0100 Subject: [PATCH] remove remaining legacy code --- TODO.md | 1 + UI/MultiBotGameObjectCopyFrame.lua | 26 +-- UI/MultiBotGameObjectResultsFrame.lua | 67 ++++--- UI/MultiBotQuestAllFrame.lua | 207 ++++++++++++--------- UI/MultiBotQuestCompletedFrame.lua | 162 ++++++++++------ UI/MultiBotQuestIncompleteFrame.lua | 163 ++++++++++------ UI/MultiBotQuestLogFrame.lua | 258 +++++++++++++++----------- UI/MultiBotQuestUIShared.lua | 94 ---------- docs/milestone8-followup-audit.md | 52 ++++++ 9 files changed, 572 insertions(+), 458 deletions(-) create mode 100644 docs/milestone8-followup-audit.md diff --git a/TODO.md b/TODO.md index 39aeb5f..47aa172 100644 --- a/TODO.md +++ b/TODO.md @@ -16,6 +16,7 @@ TODO * Voir si il y'a pas d'autres option que l'on peut ajouter à la frame options de multibot * Faire en sorte que le strata soit appliqué a vraiment toutes les frames de multibot * creer le multilangue pour le tooltip: setTooltip(self, "Show / Hide / Move Quick Shaman") des fichiers quickshaman et quickhunter +* Livres des sorts: faire en sorte que l'icone de regrise quand on le ferme avec la croix de la frame Ajouter la fonction unequipe à Multibit: diff --git a/UI/MultiBotGameObjectCopyFrame.lua b/UI/MultiBotGameObjectCopyFrame.lua index a9d4c32..354a071 100644 --- a/UI/MultiBotGameObjectCopyFrame.lua +++ b/UI/MultiBotGameObjectCopyFrame.lua @@ -4,6 +4,16 @@ local Shared = MultiBot.QuestUIShared or {} local CopyFrame = MultiBot.GameObjectCopyFrame or {} MultiBot.GameObjectCopyFrame = CopyFrame +local function focusAndSelect(editor) + local editBox = editor and editor.editBox + if editBox and editBox.SetFocus then + editBox:SetFocus() + end + if editBox and editBox.HighlightText then + editBox:HighlightText() + end +end + function MultiBot.ShowGameObjectCopyBox() local frame = MultiBot.InitializeGameObjectCopyFrame() if not frame then @@ -18,14 +28,7 @@ function MultiBot.ShowGameObjectCopyBox() local text = Shared.BuildGameObjectCopyText and Shared.BuildGameObjectCopyText(bots) or "" frame.editor:SetText(text) frame.window:Show() - - local editBox = frame.editor and frame.editor.editBox - if editBox and editBox.SetFocus then - editBox:SetFocus() - end - if editBox and editBox.HighlightText then - editBox:HighlightText() - end + focusAndSelect(frame.editor) end function MultiBot.InitializeGameObjectCopyFrame() @@ -49,6 +52,7 @@ function MultiBot.InitializeGameObjectCopyFrame() window:EnableResize(false) window:SetLayout("Fill") window.frame:SetFrameStrata("DIALOG") + if MultiBot.SetAceWindowCloseToHide then MultiBot.SetAceWindowCloseToHide(window) end if MultiBot.RegisterAceWindowEscapeClose then MultiBot.RegisterAceWindowEscapeClose(window, "GameObjCopy") end if MultiBot.BindAceWindowPosition then MultiBot.BindAceWindowPosition(window, "gameobject_copy") end @@ -65,14 +69,10 @@ function MultiBot.InitializeGameObjectCopyFrame() if editor.editBox and editor.editBox.SetTextInsets then editor.editBox:SetTextInsets(6, 6, 6, 6) end - if editor.scrollBG and Shared.ApplyPanelStyle then - Shared.ApplyPanelStyle(editor.scrollBG, 0.92) - elseif editor.frame and Shared.ApplyPanelStyle then - Shared.ApplyPanelStyle(editor.frame, 0.92) - end CopyFrame.window = window CopyFrame.editor = editor + CopyFrame.aceGUI = aceGUI MultiBot.GameObjCopyBox = CopyFrame return CopyFrame end \ No newline at end of file diff --git a/UI/MultiBotGameObjectResultsFrame.lua b/UI/MultiBotGameObjectResultsFrame.lua index 0c9ea8f..3008a0d 100644 --- a/UI/MultiBotGameObjectResultsFrame.lua +++ b/UI/MultiBotGameObjectResultsFrame.lua @@ -4,54 +4,52 @@ local Shared = MultiBot.QuestUIShared or {} local ResultsFrame = MultiBot.GameObjectResultsFrame or {} MultiBot.GameObjectResultsFrame = ResultsFrame -function MultiBot.ShowGameObjectPopup() - local frame = MultiBot.InitializeGameObjectResultsFrame() - if not frame then - return - end - - if frame.window:IsShown() then - frame.window:Hide() +local function clearResults(frame) + if frame and frame.scroll then + frame.scroll:ReleaseChildren() end +end - frame.scroll:ReleaseChildren() +local function addLabel(aceGUI, parent, text) + local label = aceGUI:Create("Label") + label:SetFullWidth(true) + label:SetText(text or "") + parent:AddChild(label) + return label +end - local aceGUI = MultiBot.ResolveAceGUI and MultiBot.ResolveAceGUI("AceGUI-3.0 is required for MB_GameObjPopup") or nil - if not aceGUI then - return - end +local function renderGameObjectResults(frame) + clearResults(frame) + local aceGUI = frame.aceGUI local bots = Shared.CollectSortedGameObjectBots and Shared.CollectSortedGameObjectBots() or {} + for _, bot in ipairs(bots) do - local botLabel = aceGUI:Create("Label") - botLabel:SetFullWidth(true) - botLabel:SetText("Bot: |cff80ff80" .. bot .. "|r") - frame.scroll:AddChild(botLabel) + addLabel(aceGUI, frame.scroll, "Bot: |cff80ff80" .. bot .. "|r") for _, textLine in ipairs(Shared.GetGameObjectEntries(bot) or {}) do - local line = aceGUI:Create("Label") - line:SetFullWidth(true) if Shared.IsDashedSectionHeader(textLine) then - line:SetText("|cffffff66" .. textLine .. "|r") + addLabel(aceGUI, frame.scroll, "|cffffff66" .. textLine .. "|r") else - line:SetText(" " .. textLine) + addLabel(aceGUI, frame.scroll, " " .. textLine) end - frame.scroll:AddChild(line) end - local spacer = aceGUI:Create("Label") - spacer:SetFullWidth(true) - spacer:SetText(" ") - frame.scroll:AddChild(spacer) + addLabel(aceGUI, frame.scroll, " ") end if #bots == 0 then - local noData = aceGUI:Create("Label") - noData:SetFullWidth(true) - noData:SetText(MultiBot.L("tips.quests.gobnosearchdata")) - frame.scroll:AddChild(noData) + addLabel(aceGUI, frame.scroll, MultiBot.L("tips.quests.gobnosearchdata") or "") end +end +function MultiBot.ShowGameObjectPopup() + local frame = MultiBot.InitializeGameObjectResultsFrame() + if not frame then + return + end + + renderGameObjectResults(frame) frame.window:Show() end @@ -74,8 +72,9 @@ function MultiBot.InitializeGameObjectResultsFrame() window:SetWidth(420) window:SetHeight(380) window:EnableResize(false) - window:SetLayout("Flow") + window:SetLayout("List") window.frame:SetFrameStrata("DIALOG") + if MultiBot.SetAceWindowCloseToHide then MultiBot.SetAceWindowCloseToHide(window) end if MultiBot.RegisterAceWindowEscapeClose then MultiBot.RegisterAceWindowEscapeClose(window, "GameObjPopup") end if MultiBot.BindAceWindowPosition then MultiBot.BindAceWindowPosition(window, "gameobject_popup") end @@ -86,11 +85,6 @@ function MultiBot.InitializeGameObjectResultsFrame() scroll:SetLayout("List") window:AddChild(scroll) - local buttonSpacer = aceGUI:Create("Label") - buttonSpacer:SetFullWidth(true) - buttonSpacer:SetText(" ") - window:AddChild(buttonSpacer) - local copyButton = aceGUI:Create("Button") copyButton:SetText(MultiBot.L("tips.quests.gobselectall")) copyButton:SetWidth(170) @@ -104,6 +98,7 @@ function MultiBot.InitializeGameObjectResultsFrame() ResultsFrame.window = window ResultsFrame.scroll = scroll ResultsFrame.copyButton = copyButton + ResultsFrame.aceGUI = aceGUI MultiBot.GameObjPopup = ResultsFrame return ResultsFrame end \ No newline at end of file diff --git a/UI/MultiBotQuestAllFrame.lua b/UI/MultiBotQuestAllFrame.lua index e47804c..3bda880 100644 --- a/UI/MultiBotQuestAllFrame.lua +++ b/UI/MultiBotQuestAllFrame.lua @@ -8,151 +8,184 @@ MultiBot.BotQuestsAll = MultiBot.BotQuestsAll or {} MultiBot.BotQuestsCompleted = MultiBot.BotQuestsCompleted or {} MultiBot.BotQuestsIncompleted = MultiBot.BotQuestsIncompleted or {} -local function clearContent(self) - Shared.ClearFrameChildren(self.content, true) - if self.content and self.content.text then - self.content.text:SetText("") +local function clearList(self) + if self.scroll then + self.scroll:ReleaseChildren() end end function MultiBot.ClearAllContent() local frame = MultiBot.InitializeQuestAllFrame() - clearContent(frame) + clearList(frame) end -local function createHeader(parent, text, yOffset) - local header = parent:CreateFontString(nil, "OVERLAY", "GameFontNormalLarge") - header:SetPoint("TOPLEFT", 0, yOffset) - header:SetText(text or "") - return header +local function createQuestLabel(self, questID, text) + local label = self.aceGUI:Create("InteractiveLabel") + label:SetWidth(340) + label:SetText(text) + + if questID then + label:SetCallback("OnEnter", function(widget) + GameTooltip:SetOwner(widget.frame, "ANCHOR_CURSOR") + GameTooltip:SetHyperlink("quest:" .. tostring(questID)) + GameTooltip:Show() + end) + end + + label:SetCallback("OnLeave", function() + GameTooltip_Hide() + end) + + return label end -local function renderQuestWithBots(parent, yOffset, entry) - local line = CreateFrame("Frame", nil, parent) - line:SetSize(360, 20) - line:SetPoint("TOPLEFT", 0, yOffset) - Shared.ApplyPanelStyle(line, 0.34) +local function createQuestRow(self, questID, text) + local row = self.aceGUI:Create("SimpleGroup") + row:SetFullWidth(true) + row:SetLayout("Flow") - local icon = line:CreateTexture(nil, "ARTWORK") - icon:SetTexture(Shared.ICON_BOT_QUEST) - icon:SetSize(12, 12) - icon:SetPoint("LEFT", 6, 0) + local icon = self.aceGUI:Create("Icon") + icon:SetImage(Shared.ICON_BOT_QUEST or "Interface\\Icons\\inv_misc_note_02") + icon:SetImageSize(12, 12) + icon:SetWidth(20) + row:AddChild(icon) - local html = Shared.CreateQuestHTML(line, 320, Shared.ROW_HEIGHT, Shared.BuildQuestLink(entry.id, entry.name)) - html:SetPoint("LEFT", icon, "RIGHT", 6, -6) - Shared.BindHyperlinkTooltip(html) + row:AddChild(createQuestLabel(self, questID, text)) + self.scroll:AddChild(row) +end - yOffset = yOffset - 24 +local function createQuestRowWithBots(self, entry) + createQuestRow(self, entry.id, Shared.BuildQuestLink(entry.id, entry.name)) - local botsLine = parent:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall") - botsLine:SetPoint("TOPLEFT", 28, yOffset) - botsLine:SetText(Shared.FormatBotsLabel(entry.bots)) + if entry.bots and #entry.bots > 0 then + local botsLine = self.aceGUI:Create("Label") + botsLine:SetFullWidth(true) + botsLine:SetText(" " .. Shared.FormatBotsLabel(entry.bots)) + self.scroll:AddChild(botsLine) + end +end - return yOffset - 18 +local function createSectionHeader(self, text) + local heading = self.aceGUI:Create("Heading") + heading:SetFullWidth(true) + heading:SetText(text or "") + self.scroll:AddChild(heading) end function MultiBot.BuildBotAllList(botName) local frame = MultiBot.InitializeQuestAllFrame() - clearContent(frame) + clearList(frame) - local yOffset = -4 for _, link in ipairs(MultiBot.BotQuestsAll[botName] or {}) do local questID = tonumber(link:match("|Hquest:(%d+):")) local localizedName = questID and Shared.GetLocalizedQuestName(questID, link) or link local displayLink = link:gsub("%[[^%]]+%]", "|cff00ff00[" .. localizedName .. "]|r") - local line = CreateFrame("Frame", nil, frame.content) - line:SetSize(360, 20) - line:SetPoint("TOPLEFT", 0, yOffset) - Shared.ApplyPanelStyle(line, 0.34) - - local icon = line:CreateTexture(nil, "ARTWORK") - icon:SetTexture(Shared.ICON_BOT_QUEST) - icon:SetSize(12, 12) - icon:SetPoint("LEFT", 6, 0) - - local html = Shared.CreateQuestHTML(line, 320, Shared.ROW_HEIGHT, displayLink) - html:SetPoint("LEFT", icon, "RIGHT", 6, -6) - Shared.BindHyperlinkTooltip(html) - - yOffset = yOffset - 24 + createQuestRow(frame, questID, displayLink) end - if frame.summaryLabel then - frame.summaryLabel:SetText(botName and ((MultiBot.L("tips.quests.alllist") or "All Quests") .. ": |cff80ff80" .. botName .. "|r") or (MultiBot.L("tips.quests.alllist") or "")) + if frame.summary then + frame.summary:SetText(botName and ((MultiBot.L("tips.quests.alllist") or "All Quests") .. ": |cff80ff80" .. botName .. "|r") or (MultiBot.L("tips.quests.alllist") or "")) end - - frame.content:SetHeight(math.max(-yOffset + 4, 1)) - frame.scrollFrame:SetVerticalScroll(0) end function MultiBot.BuildAggregatedAllList() local frame = MultiBot.InitializeQuestAllFrame() - clearContent(frame) + clearList(frame) - local yOffset = -4 local completeEntries = Shared.BuildAggregatedQuestEntries(MultiBot.BotQuestsCompleted) local incompleteEntries = Shared.BuildAggregatedQuestEntries(MultiBot.BotQuestsIncompleted) - createHeader(frame.content, MultiBot.L("tips.quests.compheader"), yOffset) - yOffset = yOffset - 30 + createSectionHeader(frame, MultiBot.L("tips.quests.compheader")) for _, entry in ipairs(completeEntries) do - yOffset = renderQuestWithBots(frame.content, yOffset, entry) + createQuestRowWithBots(frame, entry) end - yOffset = yOffset - 12 - createHeader(frame.content, MultiBot.L("tips.quests.incompheader"), yOffset) - yOffset = yOffset - 30 + createSectionHeader(frame, MultiBot.L("tips.quests.incompheader")) for _, entry in ipairs(incompleteEntries) do - yOffset = renderQuestWithBots(frame.content, yOffset, entry) + createQuestRowWithBots(frame, entry) end - if frame.summaryLabel then - frame.summaryLabel:SetText("") + if frame.summary then + frame.summary:SetText("") end - - frame.content:SetHeight(math.max(-yOffset + 4, 1)) - frame.scrollFrame:SetVerticalScroll(0) end function QuestAllFrame:SetLoading() - clearContent(self) - self.content.text = self.content.text or self.content:CreateFontString(nil, "OVERLAY", "GameFontNormal") - self.content.text:SetPoint("TOPLEFT", 8, -8) - self.content.text:SetText(LOADING) - self.content:SetHeight(40) - self.scrollFrame:SetVerticalScroll(0) + clearList(self) + + local loading = self.aceGUI:Create("Label") + loading:SetFullWidth(true) + loading:SetText(LOADING or "Loading...") + self.scroll:AddChild(loading) + + if self.summary then + self.summary:SetText("") + end end function QuestAllFrame:Show() - self.host:Show() + if self.window then + self.window:Show() + end end function MultiBot.InitializeQuestAllFrame() - if QuestAllFrame.host then + if QuestAllFrame.window then return QuestAllFrame end - local host = MultiBot.CreateAceQuestPopupHost and MultiBot.CreateAceQuestPopupHost(MultiBot.L("tips.quests.alllist"), 420, 460, "AceGUI-3.0 is required for MB_BotQuestAllPopup", "bot_quest_all_popup") or nil - assert(host, "AceGUI-3.0 is required for MB_BotQuestAllPopup") - - local panel, scrollFrame, content, summaryLabel = Shared.CreateStyledScrollArea(host, "MB_BotQuestAllScroll", { left = 10, right = -28, top = -34, bottom = 10 }) - Shared.CreateSectionTitle(panel, MultiBot.L("tips.quests.alllist")) - - QuestAllFrame.host = host - QuestAllFrame.panel = panel - QuestAllFrame.scrollFrame = scrollFrame - QuestAllFrame.content = content - QuestAllFrame.summaryLabel = summaryLabel - - host.content = content - host:SetScript("OnHide", function() + local aceGUI = MultiBot.ResolveAceGUI and MultiBot.ResolveAceGUI("AceGUI-3.0 is required for MB_BotQuestAllPopup") or nil + assert(aceGUI, "AceGUI-3.0 is required for MB_BotQuestAllPopup") + + local window = aceGUI:Create("Window") + assert(window, "AceGUI-3.0 is required for MB_BotQuestAllPopup") + + window:SetTitle(MultiBot.L("tips.quests.alllist")) + window:SetWidth(420) + window:SetHeight(460) + window:EnableResize(false) + window:SetLayout("Fill") + window.frame:SetFrameStrata("DIALOG") + + if MultiBot.SetAceWindowCloseToHide then MultiBot.SetAceWindowCloseToHide(window) end + if MultiBot.RegisterAceWindowEscapeClose then MultiBot.RegisterAceWindowEscapeClose(window, "BotQuestAll") end + if MultiBot.BindAceWindowPosition then MultiBot.BindAceWindowPosition(window, "bot_quest_all_popup") end + + local content = aceGUI:Create("SimpleGroup") + content:SetFullWidth(true) + content:SetFullHeight(true) + content:SetLayout("List") + window:AddChild(content) + + local heading = aceGUI:Create("Heading") + heading:SetFullWidth(true) + heading:SetText(MultiBot.L("tips.quests.alllist")) + content:AddChild(heading) + + local summary = aceGUI:Create("Label") + summary:SetFullWidth(true) + summary:SetText("") + content:AddChild(summary) + + local scroll = aceGUI:Create("ScrollFrame") + scroll:SetFullWidth(true) + scroll:SetFullHeight(true) + scroll:SetLayout("List") + content:AddChild(scroll) + + window.frame:HookScript("OnHide", function() MultiBot.BotQuestsAll = {} MultiBot.BotQuestsCompleted = {} MultiBot.BotQuestsIncompleted = {} - clearContent(QuestAllFrame) + clearList(QuestAllFrame) end) - MultiBot.tBotAllPopup = host + QuestAllFrame.window = window + QuestAllFrame.aceGUI = aceGUI + QuestAllFrame.scroll = scroll + QuestAllFrame.summary = summary + + MultiBot.tBotAllPopup = window return QuestAllFrame end \ No newline at end of file diff --git a/UI/MultiBotQuestCompletedFrame.lua b/UI/MultiBotQuestCompletedFrame.lua index 66cd4d4..615c62f 100644 --- a/UI/MultiBotQuestCompletedFrame.lua +++ b/UI/MultiBotQuestCompletedFrame.lua @@ -6,58 +6,72 @@ MultiBot.QuestCompletedFrame = QuestCompletedFrame MultiBot.BotQuestsCompleted = MultiBot.BotQuestsCompleted or {} -local function clearContent(self) - Shared.ClearFrameChildren(self.content) +local function clearList(self) + if self.scroll then + self.scroll:ReleaseChildren() + end +end + +local function createQuestEntryRow(self, entry) + local row = self.aceGUI:Create("SimpleGroup") + row:SetFullWidth(true) + row:SetLayout("Flow") + + local icon = self.aceGUI:Create("Icon") + icon:SetImage(Shared.ICON_BOT_QUEST or "Interface\\Icons\\inv_misc_note_02") + icon:SetImageSize(14, 14) + icon:SetWidth(20) + row:AddChild(icon) + + local label = self.aceGUI:Create("InteractiveLabel") + label:SetWidth(320) + label:SetText(Shared.BuildQuestLink(entry.id, entry.name)) + label:SetCallback("OnEnter", function(widget) + GameTooltip:SetOwner(widget.frame, "ANCHOR_CURSOR") + GameTooltip:SetHyperlink("quest:" .. tostring(entry.id)) + GameTooltip:Show() + end) + label:SetCallback("OnLeave", function() + GameTooltip_Hide() + end) + row:AddChild(label) + + self.scroll:AddChild(row) + + if entry.bots and #entry.bots > 0 then + local botsLabel = self.aceGUI:Create("Label") + botsLabel:SetFullWidth(true) + botsLabel:SetText(" " .. Shared.FormatBotsLabel(entry.bots)) + self.scroll:AddChild(botsLabel) + end end local function renderQuestList(self, entries, summaryText) - clearContent(self) - - local yOffset = -4 - for _, entry in ipairs(entries or {}) do - local line = CreateFrame("Frame", nil, self.content) - line:SetSize(320, Shared.ROW_HEIGHT) - line:SetPoint("TOPLEFT", 0, yOffset) - Shared.ApplyPanelStyle(line, 0.34) - - local icon = line:CreateTexture(nil, "ARTWORK") - icon:SetTexture(Shared.ICON_BOT_QUEST) - icon:SetSize(14, 14) - icon:SetPoint("LEFT", 6, 0) - - local html = Shared.CreateQuestHTML(line, 280, Shared.ROW_HEIGHT, Shared.BuildQuestLink(entry.id, entry.name)) - html:SetPoint("LEFT", icon, "RIGHT", 6, -5) - Shared.BindHyperlinkTooltip(html) - - yOffset = yOffset - Shared.ROW_HEIGHT - 4 - - if entry.bots and #entry.bots > 0 then - local botRow = CreateFrame("Frame", nil, self.content) - botRow:SetSize(320, Shared.DETAIL_ROW_HEIGHT) - botRow:SetPoint("TOPLEFT", 0, yOffset) - - local botsLine = botRow:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall") - botsLine:SetPoint("LEFT", 28, 0) - botsLine:SetJustifyH("LEFT") - botsLine:SetText(Shared.FormatBotsLabel(entry.bots)) - - yOffset = yOffset - Shared.DETAIL_ROW_HEIGHT - 2 - end + clearList(self) + + local questEntries = entries or {} + for _, entry in ipairs(questEntries) do + createQuestEntryRow(self, entry) end - if self.summaryLabel then - self.summaryLabel:SetText(summaryText or MultiBot.L("tips.quests.complist") or "") + if #questEntries == 0 then + local noData = self.aceGUI:Create("Label") + noData:SetFullWidth(true) + noData:SetText(MultiBot.L("tips.quests.gobnosearchdata") or "No quests") + self.scroll:AddChild(noData) + end + + if self.summary then + self.summary:SetText(summaryText or MultiBot.L("tips.quests.complist") or "") end - self.content:SetHeight(math.max(-yOffset + 4, 1)) - self.scrollFrame:SetVerticalScroll(0) end function MultiBot.BuildBotCompletedList(botName) local frame = MultiBot.InitializeQuestCompletedFrame() local entries = Shared.SortQuestEntries(MultiBot.BotQuestsCompleted[botName] or {}) + frame:Show() - --renderQuestList(frame, entries, botName and ((MultiBot.L("tips.quests.complist") or "Completed Quests") .. ": |cff80ff80" .. botName .. "|r") or nil) - renderQuestList(frame, entries, botName and ("|cff80ff80" .. botName .. "|r") or nil) + renderQuestList(frame, entries, botName and ("|cff80ff80" .. botName .. "|r") or nil) end function MultiBot.BuildAggregatedCompletedList() @@ -69,31 +83,65 @@ function MultiBot.BuildAggregatedCompletedList() end function QuestCompletedFrame:Show() - self.host:Show() + if self.window then + self.window:Show() + end end function MultiBot.InitializeQuestCompletedFrame() - if QuestCompletedFrame.host then + if QuestCompletedFrame.window then return QuestCompletedFrame end - local host = MultiBot.CreateAceQuestPopupHost and MultiBot.CreateAceQuestPopupHost(MultiBot.L("tips.quests.complist"), 380, 420, "AceGUI-3.0 is required for MB_BotQuestCompPopup", "bot_quest_comp_popup") or nil - assert(host, "AceGUI-3.0 is required for MB_BotQuestCompPopup") - - local panel, scrollFrame, content, summaryLabel = Shared.CreateStyledScrollArea(host, "MB_BotQuestCompScroll", { left = 10, right = -28, top = -34, bottom = 10 }) - Shared.CreateSectionTitle(panel, MultiBot.L("tips.quests.complist")) - - QuestCompletedFrame.host = host - QuestCompletedFrame.panel = panel - QuestCompletedFrame.scrollFrame = scrollFrame - QuestCompletedFrame.content = content - QuestCompletedFrame.summaryLabel = summaryLabel - - host:SetScript("OnHide", function() + local aceGUI = MultiBot.ResolveAceGUI and MultiBot.ResolveAceGUI("AceGUI-3.0 is required for MB_BotQuestCompPopup") or nil + assert(aceGUI, "AceGUI-3.0 is required for MB_BotQuestCompPopup") + + local window = aceGUI:Create("Window") + assert(window, "AceGUI-3.0 is required for MB_BotQuestCompPopup") + + window:SetTitle(MultiBot.L("tips.quests.complist")) + window:SetWidth(380) + window:SetHeight(420) + window:EnableResize(false) + window:SetLayout("Fill") + window.frame:SetFrameStrata("DIALOG") + + if MultiBot.SetAceWindowCloseToHide then MultiBot.SetAceWindowCloseToHide(window) end + if MultiBot.RegisterAceWindowEscapeClose then MultiBot.RegisterAceWindowEscapeClose(window, "BotQuestCompleted") end + if MultiBot.BindAceWindowPosition then MultiBot.BindAceWindowPosition(window, "bot_quest_comp_popup") end + + local content = aceGUI:Create("SimpleGroup") + content:SetFullWidth(true) + content:SetFullHeight(true) + content:SetLayout("List") + window:AddChild(content) + + local heading = aceGUI:Create("Heading") + heading:SetFullWidth(true) + heading:SetText(MultiBot.L("tips.quests.complist")) + content:AddChild(heading) + + local summary = aceGUI:Create("Label") + summary:SetFullWidth(true) + summary:SetText("") + content:AddChild(summary) + + local scroll = aceGUI:Create("ScrollFrame") + scroll:SetFullWidth(true) + scroll:SetFullHeight(true) + scroll:SetLayout("List") + content:AddChild(scroll) + + window.frame:HookScript("OnHide", function() MultiBot.BotQuestsCompleted = {} - clearContent(QuestCompletedFrame) + clearList(QuestCompletedFrame) end) - MultiBot.tBotCompPopup = host + QuestCompletedFrame.window = window + QuestCompletedFrame.aceGUI = aceGUI + QuestCompletedFrame.scroll = scroll + QuestCompletedFrame.summary = summary + + MultiBot.tBotCompPopup = window return QuestCompletedFrame end \ No newline at end of file diff --git a/UI/MultiBotQuestIncompleteFrame.lua b/UI/MultiBotQuestIncompleteFrame.lua index b86e24e..dd243c9 100644 --- a/UI/MultiBotQuestIncompleteFrame.lua +++ b/UI/MultiBotQuestIncompleteFrame.lua @@ -6,58 +6,72 @@ MultiBot.QuestIncompleteFrame = QuestIncompleteFrame MultiBot.BotQuestsIncompleted = MultiBot.BotQuestsIncompleted or {} -local function clearContent(self) - Shared.ClearFrameChildren(self.content) +local function clearList(self) + if self.scroll then + self.scroll:ReleaseChildren() + end +end + +local function createQuestEntryRow(self, entry) + local row = self.aceGUI:Create("SimpleGroup") + row:SetFullWidth(true) + row:SetLayout("Flow") + + local icon = self.aceGUI:Create("Icon") + icon:SetImage(Shared.ICON_BOT_QUEST or "Interface\\Icons\\inv_misc_note_02") + icon:SetImageSize(14, 14) + icon:SetWidth(20) + row:AddChild(icon) + + local label = self.aceGUI:Create("InteractiveLabel") + label:SetWidth(320) + label:SetText(Shared.BuildQuestLink(entry.id, entry.name)) + label:SetCallback("OnEnter", function(widget) + GameTooltip:SetOwner(widget.frame, "ANCHOR_CURSOR") + GameTooltip:SetHyperlink("quest:" .. tostring(entry.id)) + GameTooltip:Show() + end) + label:SetCallback("OnLeave", function() + GameTooltip_Hide() + end) + row:AddChild(label) + + self.scroll:AddChild(row) + + if entry.bots and #entry.bots > 0 then + local botsLabel = self.aceGUI:Create("Label") + botsLabel:SetFullWidth(true) + botsLabel:SetText(" " .. Shared.FormatBotsLabel(entry.bots)) + self.scroll:AddChild(botsLabel) + end end local function renderQuestList(self, entries, summaryText) - clearContent(self) - - local yOffset = -4 - for _, entry in ipairs(entries or {}) do - local line = CreateFrame("Frame", nil, self.content) - line:SetSize(320, Shared.ROW_HEIGHT) - line:SetPoint("TOPLEFT", 0, yOffset) - Shared.ApplyPanelStyle(line, 0.34) - - local icon = line:CreateTexture(nil, "ARTWORK") - icon:SetTexture(Shared.ICON_BOT_QUEST) - icon:SetSize(14, 14) - icon:SetPoint("LEFT", 6, 0) - - local html = Shared.CreateQuestHTML(line, 280, Shared.ROW_HEIGHT, Shared.BuildQuestLink(entry.id, entry.name)) - html:SetPoint("LEFT", icon, "RIGHT", 6, -5) - Shared.BindHyperlinkTooltip(html) - - yOffset = yOffset - Shared.ROW_HEIGHT - 4 - - if entry.bots and #entry.bots > 0 then - local botRow = CreateFrame("Frame", nil, self.content) - botRow:SetSize(320, Shared.DETAIL_ROW_HEIGHT) - botRow:SetPoint("TOPLEFT", 0, yOffset) - - local botsLine = botRow:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall") - botsLine:SetPoint("LEFT", 28, 0) - botsLine:SetJustifyH("LEFT") - botsLine:SetText(Shared.FormatBotsLabel(entry.bots)) - - yOffset = yOffset - Shared.DETAIL_ROW_HEIGHT - 2 - end + clearList(self) + + local questEntries = entries or {} + for _, entry in ipairs(questEntries) do + createQuestEntryRow(self, entry) end - if self.summaryLabel then - self.summaryLabel:SetText(summaryText or MultiBot.L("tips.quests.incomplist") or "") + if #questEntries == 0 then + local noData = self.aceGUI:Create("Label") + noData:SetFullWidth(true) + noData:SetText(MultiBot.L("tips.quests.gobnosearchdata") or "No quests") + self.scroll:AddChild(noData) + end + + if self.summary then + self.summary:SetText(summaryText or MultiBot.L("tips.quests.incomplist") or "") end - self.content:SetHeight(math.max(-yOffset + 4, 1)) - self.scrollFrame:SetVerticalScroll(0) end function MultiBot.BuildBotQuestList(botName) local frame = MultiBot.InitializeQuestIncompleteFrame() local entries = Shared.SortQuestEntries(MultiBot.BotQuestsIncompleted[botName] or {}) + frame:Show() - --renderQuestList(frame, entries, botName and ((MultiBot.L("tips.quests.incomplist") or "Current Quests") .. ": |cff80ff80" .. botName .. "|r") or nil) - renderQuestList(frame, entries, botName and ("|cff80ff80" .. botName .. "|r") or nil) + renderQuestList(frame, entries, botName and ("|cff80ff80" .. botName .. "|r") or nil) end function MultiBot.BuildAggregatedQuestList() @@ -65,36 +79,69 @@ function MultiBot.BuildAggregatedQuestList() local entries = Shared.BuildAggregatedQuestEntries(MultiBot.BotQuestsIncompleted) frame:Show() - --renderQuestList(frame, entries, MultiBot.L("tips.quests.incomplist") or "") renderQuestList(frame, entries, "") end function QuestIncompleteFrame:Show() - self.host:Show() + if self.window then + self.window:Show() + end end function MultiBot.InitializeQuestIncompleteFrame() - if QuestIncompleteFrame.host then + if QuestIncompleteFrame.window then return QuestIncompleteFrame end - local host = MultiBot.CreateAceQuestPopupHost and MultiBot.CreateAceQuestPopupHost(MultiBot.L("tips.quests.incomplist"), 380, 420, "AceGUI-3.0 is required for MB_BotQuestPopup", "bot_quest_popup") or nil - assert(host, "AceGUI-3.0 is required for MB_BotQuestPopup") - - local panel, scrollFrame, content, summaryLabel = Shared.CreateStyledScrollArea(host, "MB_BotQuestScroll", { left = 10, right = -28, top = -34, bottom = 10 }) - Shared.CreateSectionTitle(panel, MultiBot.L("tips.quests.incomplist")) - - QuestIncompleteFrame.host = host - QuestIncompleteFrame.panel = panel - QuestIncompleteFrame.scrollFrame = scrollFrame - QuestIncompleteFrame.content = content - QuestIncompleteFrame.summaryLabel = summaryLabel - - host:SetScript("OnHide", function() + local aceGUI = MultiBot.ResolveAceGUI and MultiBot.ResolveAceGUI("AceGUI-3.0 is required for MB_BotQuestPopup") or nil + assert(aceGUI, "AceGUI-3.0 is required for MB_BotQuestPopup") + + local window = aceGUI:Create("Window") + assert(window, "AceGUI-3.0 is required for MB_BotQuestPopup") + + window:SetTitle(MultiBot.L("tips.quests.incomplist")) + window:SetWidth(380) + window:SetHeight(420) + window:EnableResize(false) + window:SetLayout("Fill") + window.frame:SetFrameStrata("DIALOG") + + if MultiBot.SetAceWindowCloseToHide then MultiBot.SetAceWindowCloseToHide(window) end + if MultiBot.RegisterAceWindowEscapeClose then MultiBot.RegisterAceWindowEscapeClose(window, "BotQuestIncomplete") end + if MultiBot.BindAceWindowPosition then MultiBot.BindAceWindowPosition(window, "bot_quest_popup") end + + local content = aceGUI:Create("SimpleGroup") + content:SetFullWidth(true) + content:SetFullHeight(true) + content:SetLayout("List") + window:AddChild(content) + + local heading = aceGUI:Create("Heading") + heading:SetFullWidth(true) + heading:SetText(MultiBot.L("tips.quests.incomplist")) + content:AddChild(heading) + + local summary = aceGUI:Create("Label") + summary:SetFullWidth(true) + summary:SetText("") + content:AddChild(summary) + + local scroll = aceGUI:Create("ScrollFrame") + scroll:SetFullWidth(true) + scroll:SetFullHeight(true) + scroll:SetLayout("List") + content:AddChild(scroll) + + window.frame:HookScript("OnHide", function() MultiBot.BotQuestsIncompleted = {} - clearContent(QuestIncompleteFrame) + clearList(QuestIncompleteFrame) end) - MultiBot.tBotPopup = host + QuestIncompleteFrame.window = window + QuestIncompleteFrame.aceGUI = aceGUI + QuestIncompleteFrame.scroll = scroll + QuestIncompleteFrame.summary = summary + + MultiBot.tBotPopup = window return QuestIncompleteFrame end \ No newline at end of file diff --git a/UI/MultiBotQuestLogFrame.lua b/UI/MultiBotQuestLogFrame.lua index 5a96588..84bf739 100644 --- a/UI/MultiBotQuestLogFrame.lua +++ b/UI/MultiBotQuestLogFrame.lua @@ -4,32 +4,27 @@ local Shared = MultiBot.QuestUIShared or {} local QuestLogFrame = MultiBot.QuestLogFrame or {} MultiBot.QuestLogFrame = QuestLogFrame -local function clearContent(self) - Shared.ClearFrameChildren(self.content) -end - local function getMemberNamesOnQuest(questIndex) local names = {} + local function addUnit(unit) + if not UnitExists(unit) or not IsUnitOnQuest(questIndex, unit) then + return + end + + local name = UnitName(unit) + if name then + table.insert(names, name) + end + end + if GetNumRaidMembers() > 0 then for index = 1, 40 do - local unit = "raid" .. index - if UnitExists(unit) and IsUnitOnQuest(questIndex, unit) then - local name = UnitName(unit) - if name then - table.insert(names, name) - end - end + addUnit("raid" .. index) end elseif GetNumPartyMembers() > 0 then for index = 1, 4 do - local unit = "party" .. index - if UnitExists(unit) and IsUnitOnQuest(questIndex, unit) then - local name = UnitName(unit) - if name then - table.insert(names, name) - end - end + addUnit("party" .. index) end end @@ -37,139 +32,176 @@ local function getMemberNamesOnQuest(questIndex) return names end -local function attachQuestLogTooltip(html, questIndex) - html:SetScript("OnHyperlinkEnter", function(self, _, fullLink) - GameTooltip:SetOwner(self, "ANCHOR_CURSOR") - GameTooltip:SetHyperlink(fullLink) - - local objectiveCount = GetNumQuestLeaderBoards(questIndex) - if objectiveCount and objectiveCount > 0 then - for objectiveIndex = 1, objectiveCount do - local objectiveText, _, finished = GetQuestLogLeaderBoard(objectiveIndex, questIndex) - if objectiveText then - local tint = finished and 0.5 or 1 - GameTooltip:AddLine("• " .. objectiveText, tint, tint, tint) - end +local function showQuestTooltip(questIndex, questLink, owner) + if not questIndex or not questLink then + return + end + + GameTooltip:SetOwner(owner or UIParent, "ANCHOR_CURSOR") + GameTooltip:SetHyperlink(questLink) + + local objectiveCount = GetNumQuestLeaderBoards(questIndex) + if objectiveCount and objectiveCount > 0 then + for objectiveIndex = 1, objectiveCount do + local objectiveText, _, finished = GetQuestLogLeaderBoard(objectiveIndex, questIndex) + if objectiveText then + local tint = finished and 0.5 or 1 + GameTooltip:AddLine("• " .. objectiveText, tint, tint, tint) end end + end - local members = getMemberNamesOnQuest(questIndex) - if #members > 0 then - GameTooltip:AddLine(" ") - GameTooltip:AddLine("Groupe :", 0.8, 0.8, 0.8) - for _, name in ipairs(members) do - GameTooltip:AddLine("- " .. name) - end + local members = getMemberNamesOnQuest(questIndex) + if #members > 0 then + GameTooltip:AddLine(" ") + GameTooltip:AddLine("Groupe :", 0.8, 0.8, 0.8) + for _, name in ipairs(members) do + GameTooltip:AddLine("- " .. name) end + end - GameTooltip:Show() - end) - html:SetScript("OnHyperlinkLeave", GameTooltip_Hide) + GameTooltip:Show() end -local function attachQuestLogClick(html) - html:SetScript("OnHyperlinkClick", function(_, _, link, button) - if type(link) ~= "string" or not link:match("|Hquest:") then - return - end +local function handleQuestClick(questID, button) + if not questID then + return + end + + for questIndex = 1, GetNumQuestLogEntries() do + local questLink = GetQuestLink(questIndex) + local listedQuestID = tonumber(questLink and questLink:match("|Hquest:(%d+):")) + if listedQuestID == questID then + SelectQuestLogEntry(questIndex) + + if button == "RightButton" then + if GetNumRaidMembers() > 0 then + SendChatMessage("drop " .. questLink, "RAID") + elseif GetNumPartyMembers() > 0 then + SendChatMessage("drop " .. questLink, "PARTY") + end + SetAbandonQuest() + AbandonQuest() + else + QuestLogPushQuest() + end - local clickedQuestID = tonumber(link:match("|Hquest:(%d+):")) - if not clickedQuestID then return end + end +end - for questIndex = 1, GetNumQuestLogEntries() do - local questLink = GetQuestLink(questIndex) - local questID = tonumber(questLink and questLink:match("|Hquest:(%d+):")) - if questID == clickedQuestID then - SelectQuestLogEntry(questIndex) - if button == "RightButton" then - if GetNumRaidMembers() > 0 then - SendChatMessage("drop " .. questLink, "RAID") - elseif GetNumPartyMembers() > 0 then - SendChatMessage("drop " .. questLink, "PARTY") - end - SetAbandonQuest() - AbandonQuest() - else - QuestLogPushQuest() - end - break - end - end +local function createQuestRow(self, aceGUI, questIndex, questID, questLink) + local row = aceGUI:Create("SimpleGroup") + row:SetFullWidth(true) + row:SetLayout("Flow") + + local icon = aceGUI:Create("Icon") + icon:SetImage(Shared.ICON_QUEST or "Interface\\Icons\\inv_misc_note_01") + icon:SetImageSize(14, 14) + icon:SetWidth(20) + row:AddChild(icon) + + local label = aceGUI:Create("InteractiveLabel") + label:SetText(questLink:gsub("%[", "|cff00ff00["):gsub("%]", "]|r")) + label:SetWidth(320) + label:SetCallback("OnEnter", function(widget) + showQuestTooltip(questIndex, questLink, widget.frame) + end) + label:SetCallback("OnLeave", function() + GameTooltip_Hide() + end) + label:SetCallback("OnClick", function(_, _, button) + handleQuestClick(questID, button) end) + row:AddChild(label) + + self.scroll:AddChild(row) end function QuestLogFrame:Refresh() - clearContent(self) + if not self.scroll then + return + end - local entries = GetNumQuestLogEntries() - local rowOffset = -4 - local visibleCount = 0 + self.scroll:ReleaseChildren() - for questIndex = 1, entries do + local visibleCount = 0 + for questIndex = 1, GetNumQuestLogEntries() do local questLink = GetQuestLink(questIndex) local _, _, _, _, isCollapsed = GetQuestLogTitle(questIndex) + local questID = tonumber(questLink and questLink:match("|Hquest:(%d+):")) - if questLink and isCollapsed == nil then + if questLink and questID and isCollapsed == nil then visibleCount = visibleCount + 1 - local row = CreateFrame("Frame", nil, self.content) - row:SetSize(332, Shared.ROW_HEIGHT) - row:SetPoint("TOPLEFT", 0, rowOffset) - Shared.ApplyPanelStyle(row, 0.38) - - local icon = row:CreateTexture(nil, "ARTWORK") - icon:SetTexture(Shared.ICON_QUEST) - icon:SetSize(14, 14) - icon:SetPoint("LEFT", 6, 0) - - local html = Shared.CreateQuestHTML(row, 290, Shared.ROW_HEIGHT, questLink:gsub("%[", "|cff00ff00["):gsub("%]", "]|r")) - html:SetPoint("LEFT", icon, "RIGHT", 6, -5) - attachQuestLogTooltip(html, questIndex) - attachQuestLogClick(html) - - rowOffset = rowOffset - Shared.ROW_HEIGHT - 4 + createQuestRow(self, self.aceGUI, questIndex, questID, questLink) end end - --local emptyState = visibleCount == 0 and (MultiBot.L("tips.quests.gobnosearchdata") or NO_QUESTS_LABEL) or (QUESTS_LABEL or QUEST_LOG) - local emptyState = visibleCount == 0 and (MultiBot.L("tips.quests.gobnosearchdata") or NO_QUESTS_LABEL) or "" - if self.summaryLabel then - self.summaryLabel:SetText(emptyState) + if visibleCount == 0 then + local noData = self.aceGUI:Create("Label") + noData:SetFullWidth(true) + noData:SetText(MultiBot.L("tips.quests.gobnosearchdata") or "No quests") + self.scroll:AddChild(noData) end - - self.content:SetHeight(math.max(-rowOffset + 4, 1)) - self.scrollFrame:SetVerticalScroll(0) end function QuestLogFrame:Toggle() - if self.host:IsShown() then - self.host:Hide() + if not self.window then return end - self.host:Show() + if self.window:IsShown() then + self.window:Show() + return + end + + self.window:Show() self:Refresh() end function MultiBot.InitializeQuestLogFrame() - if QuestLogFrame.host then + if QuestLogFrame.window then return QuestLogFrame end - local host = MultiBot.CreateAceQuestPopupHost and MultiBot.CreateAceQuestPopupHost(QUEST_LOG, 390, 470, "AceGUI-3.0 is required for MB_QuestPopup", "quest_popup") or nil - assert(host, "AceGUI-3.0 is required for MB_QuestPopup") - - local panel, scrollFrame, content, summaryLabel = Shared.CreateStyledScrollArea(host, "MB_QuestScroll", { left = 10, right = -28, top = -34, bottom = 10 }) - Shared.CreateSectionTitle(panel, QUEST_LOG) - - QuestLogFrame.host = host - QuestLogFrame.panel = panel - QuestLogFrame.scrollFrame = scrollFrame - QuestLogFrame.content = content - QuestLogFrame.summaryLabel = summaryLabel - --QuestLogFrame.summaryLabel:SetText(QUESTS_LABEL or QUEST_LOG) - QuestLogFrame.summaryLabel:SetText("") + local aceGUI = MultiBot.ResolveAceGUI and MultiBot.ResolveAceGUI("AceGUI-3.0 is required for MB_QuestPopup") or nil + assert(aceGUI, "AceGUI-3.0 is required for MB_QuestPopup") + + local window = aceGUI:Create("Window") + assert(window, "AceGUI-3.0 is required for MB_QuestPopup") + + window:SetTitle(QUEST_LOG) + window:SetWidth(390) + window:SetHeight(470) + window:EnableResize(false) + window:SetLayout("Fill") + window.frame:SetFrameStrata("DIALOG") + + if MultiBot.SetAceWindowCloseToHide then MultiBot.SetAceWindowCloseToHide(window) end + if MultiBot.RegisterAceWindowEscapeClose then MultiBot.RegisterAceWindowEscapeClose(window, "QuestLog") end + if MultiBot.BindAceWindowPosition then MultiBot.BindAceWindowPosition(window, "quest_popup") end + + local content = aceGUI:Create("SimpleGroup") + content:SetFullWidth(true) + content:SetFullHeight(true) + content:SetLayout("List") + window:AddChild(content) + + local header = aceGUI:Create("Heading") + header:SetFullWidth(true) + header:SetText(QUEST_LOG) + content:AddChild(header) + + local scroll = aceGUI:Create("ScrollFrame") + scroll:SetFullWidth(true) + scroll:SetFullHeight(true) + scroll:SetLayout("List") + content:AddChild(scroll) + + QuestLogFrame.window = window + QuestLogFrame.scroll = scroll + QuestLogFrame.aceGUI = aceGUI return QuestLogFrame end \ No newline at end of file diff --git a/UI/MultiBotQuestUIShared.lua b/UI/MultiBotQuestUIShared.lua index de88be3..2bf93e5 100644 --- a/UI/MultiBotQuestUIShared.lua +++ b/UI/MultiBotQuestUIShared.lua @@ -60,100 +60,6 @@ function Shared.ApplyEditBoxStyle(widget) end end -function Shared.ClearFrameChildren(frame, clearRegions) - if not frame then - return - end - - if frame.GetNumChildren and frame.GetChildren then - for index = (frame:GetNumChildren() or 0), 1, -1 do - local child = select(index, frame:GetChildren()) - if child then - child:Hide() - child:SetParent(nil) - end - end - end - - if clearRegions and frame.GetRegions then - for _, region in ipairs({ frame:GetRegions() }) do - if region and region.Hide then - region:Hide() - end - if region and region.GetObjectType then - local regionType = region:GetObjectType() - if regionType == "FontString" and region.SetText then - region:SetText("") - elseif regionType == "Texture" and region.SetTexture then - region:SetTexture(nil) - end - end - end - end -end - -function Shared.CreateSectionTitle(parent, text) - local title = parent:CreateFontString(nil, "OVERLAY", "GameFontHighlight") - title:SetPoint("TOPLEFT", parent, "TOPLEFT", 10, -10) - title:SetJustifyH("LEFT") - title:SetText(text or "") - return title -end - -function Shared.CreateSummaryLabel(parent, anchor, xOffset, yOffset) - local label = parent:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall") - label:SetPoint(anchor or "TOPLEFT", parent, anchor or "TOPLEFT", xOffset or 10, yOffset or -30) - label:SetWidth(math.max((parent.GetWidth and parent:GetWidth() or 360) - 24, 120)) - label:SetJustifyH("LEFT") - label:SetJustifyV("TOP") - label:SetTextColor(0.85, 0.82, 0.72) - return label -end - -function Shared.CreateStyledScrollArea(parent, name, insets) - local padding = insets or { left = 10, right = -28, top = -48, bottom = 10 } - - local panel = CreateFrame("Frame", nil, parent) - panel:SetPoint("TOPLEFT", parent, "TOPLEFT", 8, -8) - panel:SetPoint("BOTTOMRIGHT", parent, "BOTTOMRIGHT", -8, 8) - Shared.ApplyPanelStyle(panel, Shared.SUBPANEL_ALPHA) - - local scrollFrame = CreateFrame("ScrollFrame", name, panel, "UIPanelScrollFrameTemplate") - scrollFrame:SetPoint("TOPLEFT", panel, "TOPLEFT", padding.left, padding.top) - scrollFrame:SetPoint("BOTTOMRIGHT", panel, "BOTTOMRIGHT", padding.right, padding.bottom) - - local content = CreateFrame("Frame", nil, scrollFrame) - content:SetWidth(1) - content:SetHeight(1) - scrollFrame:SetScrollChild(content) - - local summary = Shared.CreateSummaryLabel(panel, "TOPLEFT", 12, -30) - - return panel, scrollFrame, content, summary -end - -function Shared.CreateQuestHTML(parent, width, height, text) - local html = CreateFrame("SimpleHTML", nil, parent) - html:SetSize(width or 260, height or 20) - html:SetFontObject("GameFontNormal") - html:SetText(text or "") - html:SetHyperlinksEnabled(true) - return html -end - -function Shared.BindHyperlinkTooltip(html) - if not html then - return - end - - html:SetScript("OnHyperlinkEnter", function(self, _, link) - GameTooltip:SetOwner(self, "ANCHOR_CURSOR") - GameTooltip:SetHyperlink(link) - GameTooltip:Show() - end) - html:SetScript("OnHyperlinkLeave", GameTooltip_Hide) -end - function Shared.GetLocalizedQuestName(questID, fallback) if MultiBot.GetLocalizedQuestName then return MultiBot.GetLocalizedQuestName(questID) or fallback or tostring(questID) diff --git a/docs/milestone8-followup-audit.md b/docs/milestone8-followup-audit.md new file mode 100644 index 0000000..c6d97bb --- /dev/null +++ b/docs/milestone8-followup-audit.md @@ -0,0 +1,52 @@ +# Audit Milestone 8 Followup — migration Quests vers Ace3 + +Date d’audit: 2026-03-29 +Branche auditée: `work` (HEAD local) + +## Verdict (mis à jour) + +La migration Quests/GameObject est désormais **quasi complète côté popups** : + +- ✅ Frames Quests/GameObject extraites dans des fichiers dédiés `UI/`. +- ✅ Popups Quests (`Log`, `Incomplete`, `Completed`, `All`) rendus via widgets AceGUI. +- ✅ Popups GameObject (`Results`, `Copy`) en flux AceGUI nettoyé. +- ✅ Helpers legacy de construction de scroll/html supprimés de `UI/MultiBotQuestUIShared.lua`. +- ⚠️ Point restant principal: le **menu Quests** de la barre droite est encore sur le framework historique (`tRight.addFrame/addButton`) et pas sur un container AceGUI dédié. + +## Changements validés depuis l’audit initial + +### Popups migrés en rendu AceGUI +- `UI/MultiBotQuestLogFrame.lua` +- `UI/MultiBotQuestIncompleteFrame.lua` +- `UI/MultiBotQuestCompletedFrame.lua` +- `UI/MultiBotQuestAllFrame.lua` +- `UI/MultiBotGameObjectResultsFrame.lua` +- `UI/MultiBotGameObjectCopyFrame.lua` + +### Nettoyage de code legacy +- Suppression des anciens constructeurs UI legacy maintenant inutiles dans `UI/MultiBotQuestUIShared.lua`: + - `ClearFrameChildren` + - `CreateSectionTitle` + - `CreateSummaryLabel` + - `CreateStyledScrollArea` + - `CreateQuestHTML` + - `BindHyperlinkTooltip` + +## État fonctionnel + +### Conservé +- Logique métier de parsing/agrégation Quests/GameObject. +- Modes groupe/whisper et enchaînement des actions. +- Tooltips, loading, close/hide, ESC, persistance de position. + +### À finaliser +1. Migrer (ou assumer explicitement hors périmètre) `UI/MultiBotQuestsMenu.lua` vers un container AceGUI. +2. Faire une passe de validation in-game complète (parité visuelle + interactions). +3. Mettre à jour les trackers docs liés si nécessaire. + +## Conclusion opérationnelle + +Par rapport à l’objectif “on supprime la frame legacy et ses contours et on recode en Ace3”: + +- ✅ **Objectif atteint sur les popups Quests/GameObject**. +- ⚠️ **Reste le menu Quests de la barre principale** (structure historique non-AceGUI). \ No newline at end of file