local _, F = ... F.Config = { -- Display Options showAtMaxLevel = false, showIncompleteQuestBar = true, questTrackingEnabled = true, showTicks = true, tickOpacity = 0.35, anchorPoint = "TOP", offsetX = 0, offsetY = 100, -- Master visibility toggle (can be flipped with /nxp toggle) enabled = true, -- Bar Size barWidth = 600, barHeight = 24, -- Textures barTextureMain = "Interface\\Buttons\\WHITE8x8", barTextureRested = "Interface\\Buttons\\WHITE8x8", barTextureQuest = "Interface\\Buttons\\WHITE8x8", barTextureQuestComplete = "Interface\\Buttons\\WHITE8x8", -- Font fontPath = "Fonts\\FRIZQT__.TTF", -- Bar Colors (RGBA) colorMain = { r = 0.76, g = 0.38, b = 1, a = 1 }, colorRested = { r = 0.34, g = 0.61, b = 0.99, a = 0.8 }, colorQuest = { r = 1, g = 0.64, b = 0.0078, a = 0.25 }, colorQuestComplete = { r = 1, g = 0.64, b = 0.0078, a = 0.8 }, -- Text Toggles showLevelText = true, showXPText = true, showPercentText = true, showLevelTimeText = true, showSessionTimeText = true, showXPHourText = true, showLevelingText = true, showQuestRestedText = true, showIncompleteQuestXPText = true, showCompletedQuestXPText = true, showRestedXPText = true, -- Logic Settings resetOnReload = true, hideBlizzardXPBar = true, trackedOnly = true, } function F.InitDB() if not NXP_DB then NXP_DB = {} end for k, v in pairs(F.Config) do if NXP_DB[k] == nil then NXP_DB[k] = v end end F.DB = NXP_DB -- Apply the current DB state immediately so visibility is correct on load. if F.UpdateUI then F.UpdateUI() end end -- Slash command to toggle addon visibility. Usage: /nxp toggle | /nxp show | /nxp hide SLASH_NIXXNUXXPBAR1 = SLASH_NIXXNUXXPBAR1 or "/nxp" SlashCmdList = SlashCmdList or {} SlashCmdList["NIXXNUXXPBAR"] = function(msg) msg = msg or "" local cmd, arg1 = msg:match("^(%S+)%s*(.-)$") cmd = cmd and cmd:lower() or "" arg1 = arg1 and arg1:lower() or "" local function showHelp() print("NixxnuxXPBar: Commands:") print(" /nxp help") print(" /nxp options") print(" /nxp toggle | /nxp show | /nxp hide") print(" /nxp toggle level | xp | percent | quest | leveling") print(" /nxp toggle incomplete | completed | rested") print(" /nxp tracked (toggle tracked-only quests)") end local function toggleLabel(flagKey, label) if F.InitDB then F.InitDB() end F.DB[flagKey] = not F.DB[flagKey] local state = F.DB[flagKey] and "On" or "Off" print("NixxnuxXPBar: " .. label .. " " .. state) if F.UpdateUI then F.UpdateUI() end end if cmd == "toggle" and arg1 == "" then if F.InitDB then F.InitDB() end F.DB.enabled = not F.DB.enabled if F.DB.enabled then print("NixxnuxXPBar: Visible") if F.UpdateUI then F.UpdateUI() end else print("NixxnuxXPBar: Hidden") if F.Frame and F.Frame.Hide then F.Frame:Hide() end end return end if cmd == "toggle" then local map = { level = { key = "showLevelText", label = "Level Text" }, xp = { key = "showXPText", label = "XP Text" }, percent = { key = "showPercentText", label = "Percent Text" }, quest = { key = "showQuestRestedText", label = "Quest/Rested Percent Text" }, leveling = { key = "showLevelingText", label = "Leveling Text" }, incomplete = { key = "showIncompleteQuestXPText", label = "Uncompleted Quest XP Text" }, completed = { key = "showCompletedQuestXPText", label = "Completed Quest XP Text" }, rested = { key = "showRestedXPText", label = "Rested XP Text" }, } local entry = map[arg1] if entry then toggleLabel(entry.key, entry.label) else showHelp() end return end if cmd == "show" then if F.InitDB then F.InitDB() end F.DB.enabled = true print("NixxnuxXPBar: Visible") if F.UpdateUI then F.UpdateUI() end return end if cmd == "options" then if F.Options and F.Options.Open then F.Options.Open() else print("NixxnuxXPBar: Options not available yet") end return end if cmd == "tracked" then if F.InitDB then F.InitDB() end F.DB.trackedOnly = not F.DB.trackedOnly local state = F.DB.trackedOnly and "On" or "Off" print("NixxnuxXPBar: Tracked-only " .. state) if F.UpdateUI then F.UpdateUI() end return end if cmd == "hide" then if F.InitDB then F.InitDB() end F.DB.enabled = false print("NixxnuxXPBar: Hidden") if F.Frame and F.Frame.Hide then F.Frame:Hide() end return end showHelp() end