diff --git a/Config.lua b/Config.lua index a5aefa8..adbef20 100644 --- a/Config.lua +++ b/Config.lua @@ -23,6 +23,7 @@ F.Config = { -- Logic Settings resetOnReload = true, hideBlizzardXPBar = true, + trackedOnly = true, } function F.InitDB() @@ -55,6 +56,7 @@ SlashCmdList["NIXXNUXXPBAR"] = function(msg) 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) @@ -108,6 +110,15 @@ SlashCmdList["NIXXNUXXPBAR"] = function(msg) 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 diff --git a/Core.lua b/Core.lua index 1ae67eb..434e441 100644 --- a/Core.lua +++ b/Core.lua @@ -6,6 +6,8 @@ F.Events:RegisterEvent("PLAYER_LEVEL_UP") F.Events:RegisterEvent("PLAYER_XP_UPDATE") F.Events:RegisterEvent("UPDATE_FACTION") F.Events:RegisterEvent("QUEST_LOG_UPDATE") +F.Events:RegisterEvent("QUEST_WATCH_LIST_CHANGED") +F.Events:RegisterEvent("QUEST_WATCH_UPDATE") F.Events:RegisterEvent("ADDON_LOADED") F.Events:SetScript("OnEvent", function(self, event, ...) @@ -42,7 +44,7 @@ F.Events:SetScript("OnEvent", function(self, event, ...) F.State.session.lastXP = currentXP F.State:UpdatePlayerXP() - elseif event == "QUEST_LOG_UPDATE" then + elseif event == "QUEST_LOG_UPDATE" or event == "QUEST_WATCH_LIST_CHANGED" or event == "QUEST_WATCH_UPDATE" then F.State:UpdateQuestXP() end diff --git a/README.md b/README.md new file mode 100644 index 0000000..c568f4c --- /dev/null +++ b/README.md @@ -0,0 +1,53 @@ +# NixxnuxXPBar + +NixxnuxXPBar is a World of Warcraft addon that replaces the default XP bar with a detailed bar showing XP progress, quest XP overlays (completed and uncompleted), and rested XP. It also provides leveling stats like XP/hour and time-to-level. + +## Features + +- Custom XP bar with quest and rested overlays +- Separate completed and uncompleted quest XP tracking +- Rested XP display +- Session XP rate and time-to-level +- Toggleable labels and modes via slash commands +- Optional tracked-only quest counting (pinned quests) + +## Installation + +1. Copy the `NixxnuxXPBar` folder into your WoW AddOns directory. +2. Reload the UI or restart the game. + +## Commands + +General: + +- `/nxp help` - Show all commands +- `/nxp toggle` - Toggle the addon visibility +- `/nxp show` - Show the addon +- `/nxp hide` - Hide the addon + +Quest mode: + +- `/nxp tracked` - Toggle counting only tracked (pinned) quests + +Label toggles: + +- `/nxp toggle level` - Level text +- `/nxp toggle xp` - Current XP text +- `/nxp toggle percent` - Percent text +- `/nxp toggle quest` - Quest/rested percent text +- `/nxp toggle leveling` - Leveling info text +- `/nxp toggle incomplete` - Uncompleted quest XP text +- `/nxp toggle completed` - Completed quest XP text +- `/nxp toggle rested` - Rested XP text + +## Usage + +- The bar updates automatically as you gain XP or complete quests. +- The quest overlays show completed quest XP and uncompleted quest XP stacked on top of your current XP. +- Use `/nxp tracked` to count only pinned quests, or toggle it off to include all quests in your log. +- Use label toggles to customize what text appears around the bar. + +## Notes + +- Drag the bar by holding Shift and left-clicking. +- If Blizzard XP/reputation bars are hidden, the addon manages that when enabled. diff --git a/State.lua b/State.lua index 9d842f8..a0a6d63 100644 --- a/State.lua +++ b/State.lua @@ -72,25 +72,33 @@ function F.State:UpdateQuestXP() local info = C_QuestLog.GetInfo(i) -- this skips the XP header for a category / campaign as they should not be respected if info and not info.isHeader and not info.isHidden and info.questID > 0 then - -- Use the quest log index when querying the reward XP - local rewardXP = GetQuestRewardXP(i, info.questID) - if rewardXP > 0 then - qXP = qXP + rewardXP - - local completeState = info.isComplete - if completeState == nil then - completeState = C_QuestLog.IsComplete(info.questID) - end - - local isComplete = completeState == 1 or completeState == true - if not isComplete then - isComplete = C_QuestLog.ReadyForTurnIn(info.questID) - end + local isTracked = true + if F.DB and F.DB.trackedOnly and C_QuestLog.GetQuestWatchType then + local watchType = C_QuestLog.GetQuestWatchType(info.questID) + isTracked = (watchType == 1) + end - if isComplete then - cXP = cXP + rewardXP - else - iXP = iXP + rewardXP + if isTracked then + -- Use the quest log index when querying the reward XP + local rewardXP = GetQuestRewardXP(i, info.questID) + if rewardXP > 0 then + qXP = qXP + rewardXP + + local completeState = info.isComplete + if completeState == nil then + completeState = C_QuestLog.IsComplete(info.questID) + end + + local isComplete = completeState == 1 or completeState == true + if not isComplete then + isComplete = C_QuestLog.ReadyForTurnIn(info.questID) + end + + if isComplete then + cXP = cXP + rewardXP + else + iXP = iXP + rewardXP + end end end end