local ADDON_NAME = "HailMaryGuildTools" local HMGT = _G[ADDON_NAME] if not HMGT then return end local L = HMGT.L or LibStub("AceLocale-3.0"):GetLocale(ADDON_NAME) function HMGT:EnsureVersionNoticeWindow() if self.versionNoticeWindow then return self.versionNoticeWindow end self.versionNoticeWindowStatus = self.versionNoticeWindowStatus or { width = 560, height = 240, } local window = self:CreateAceWindow("versionNotice", { title = L["VERSION_WINDOW_TITLE"] or "HMGT Version Check", statusText = "", statusTable = self.versionNoticeWindowStatus, width = self.versionNoticeWindowStatus.width or 560, height = self.versionNoticeWindowStatus.height or 240, backgroundTexture = "Interface\\AddOns\\HailMaryGuildTools\\Media\\HailMaryLogo.png", backgroundWidth = 220, backgroundHeight = 120, backgroundOffsetY = -8, backgroundAlpha = 0.12, strata = "FULLSCREEN_DIALOG", }) if not window then return nil end local content = window:GetContent() local messageText = content:CreateFontString(nil, "OVERLAY", "GameFontHighlightLarge") messageText:SetPoint("TOPLEFT", content, "TOPLEFT", 28, -28) messageText:SetPoint("TOPRIGHT", content, "TOPRIGHT", -28, -28) messageText:SetJustifyH("CENTER") messageText:SetJustifyV("MIDDLE") messageText:SetTextColor(1, 0.82, 0.1, 1) messageText:SetText(L["VERSION_WINDOW_MESSAGE"] or "A new version of Hail Mary Guild Tools is available.") window.messageText = messageText local detailText = content:CreateFontString(nil, "OVERLAY", "GameFontHighlight") detailText:SetPoint("TOPLEFT", messageText, "BOTTOMLEFT", 0, -18) detailText:SetPoint("TOPRIGHT", messageText, "BOTTOMRIGHT", 0, -18) detailText:SetJustifyH("CENTER") detailText:SetJustifyV("TOP") if detailText.SetSpacing then detailText:SetSpacing(2) end detailText:SetTextColor(0.9, 0.9, 0.9, 1) window.detailText = detailText self.versionNoticeWindow = window return window end function HMGT:ShowVersionMismatchPopup(playerName, detail, sourceTag, opts) opts = opts or {} if playerName or detail or sourceTag then self.latestVersionMismatch = { playerName = playerName, detail = detail, sourceTag = sourceTag, } end local info = self.latestVersionMismatch or {} local window = self:EnsureVersionNoticeWindow() if not window then return end local hasMismatch = info.playerName or info.detail window:SetTitle(L["VERSION_WINDOW_TITLE"] or "HMGT Version Check") if hasMismatch then window.messageText:SetText(L["VERSION_WINDOW_MESSAGE"] or "A new version of Hail Mary Guild Tools is available.") window.detailText:SetText(string.format( L["VERSION_WINDOW_DETAIL"] or "Detected via %s from %s.\n%s", tostring(info.sourceTag or "?"), tostring(info.playerName or UNKNOWN), tostring(info.detail or "") )) else window.messageText:SetText(L["VERSION_WINDOW_NO_MISMATCH"] or "No newer HMGT version has been detected in your current group.") window.detailText:SetText(string.format( L["VERSION_WINDOW_CURRENT"] or "Current version: %s | Protocol: %s", tostring(HMGT.ADDON_VERSION or "dev"), tostring(HMGT.PROTOCOL_VERSION or "?") )) end self:DevTrace("Version", hasMismatch and "window_show_mismatch" or "window_show_current", { player = info.playerName, source = info.sourceTag, detail = info.detail, }) window:Show() window:Raise() end