tangled
alpha
login
or
join now
bdbch.com
/
nxp
0
fork
atom
A World of Warcraft Experience Bar addon
worldofwarcraft
wow
addon
midnight
0
fork
atom
overview
issues
pulls
pipelines
add label toggles and quest xp text
bdbch
1 month ago
ef6c37de
fd0cf0a9
+112
-14
2 changed files
expand all
collapse all
unified
split
Config.lua
UI.lua
+58
-7
Config.lua
reviewed
···
8
8
enabled = true,
9
9
10
10
-- Text Toggles
11
11
+
showLevelText = true,
12
12
+
showXPText = true,
13
13
+
showPercentText = true,
11
14
showLevelTimeText = true,
12
15
showSessionTimeText = true,
13
16
showXPHourText = true,
17
17
+
showLevelingText = true,
14
18
showQuestRestedText = true,
19
19
+
showIncompleteQuestXPText = true,
20
20
+
showCompletedQuestXPText = true,
21
21
+
showRestedXPText = true,
15
22
16
23
-- Logic Settings
17
24
resetOnReload = true,
···
38
45
SlashCmdList = SlashCmdList or {}
39
46
SlashCmdList["NIXXNUXXPBAR"] = function(msg)
40
47
msg = msg or ""
41
41
-
local cmd = msg:match("^(%S+)")
48
48
+
local cmd, arg1 = msg:match("^(%S+)%s*(.-)$")
42
49
cmd = cmd and cmd:lower() or ""
50
50
+
arg1 = arg1 and arg1:lower() or ""
43
51
44
44
-
if cmd == "toggle" then
45
45
-
-- Ensure DB is initialized, then flip the flag
52
52
+
local function showHelp()
53
53
+
print("NixxnuxXPBar: Commands:")
54
54
+
print(" /nxp help")
55
55
+
print(" /nxp toggle | /nxp show | /nxp hide")
56
56
+
print(" /nxp toggle level | xp | percent | quest | leveling")
57
57
+
print(" /nxp toggle incomplete | completed | rested")
58
58
+
end
59
59
+
60
60
+
local function toggleLabel(flagKey, label)
61
61
+
if F.InitDB then F.InitDB() end
62
62
+
F.DB[flagKey] = not F.DB[flagKey]
63
63
+
local state = F.DB[flagKey] and "On" or "Off"
64
64
+
print("NixxnuxXPBar: " .. label .. " " .. state)
65
65
+
if F.UpdateUI then F.UpdateUI() end
66
66
+
end
67
67
+
68
68
+
if cmd == "toggle" and arg1 == "" then
46
69
if F.InitDB then F.InitDB() end
47
70
F.DB.enabled = not F.DB.enabled
48
71
···
53
76
print("NixxnuxXPBar: Hidden")
54
77
if F.Frame and F.Frame.Hide then F.Frame:Hide() end
55
78
end
56
56
-
elseif cmd == "show" then
79
79
+
return
80
80
+
end
81
81
+
82
82
+
if cmd == "toggle" then
83
83
+
local map = {
84
84
+
level = { key = "showLevelText", label = "Level Text" },
85
85
+
xp = { key = "showXPText", label = "XP Text" },
86
86
+
percent = { key = "showPercentText", label = "Percent Text" },
87
87
+
quest = { key = "showQuestRestedText", label = "Quest/Rested Percent Text" },
88
88
+
leveling = { key = "showLevelingText", label = "Leveling Text" },
89
89
+
incomplete = { key = "showIncompleteQuestXPText", label = "Uncompleted Quest XP Text" },
90
90
+
completed = { key = "showCompletedQuestXPText", label = "Completed Quest XP Text" },
91
91
+
rested = { key = "showRestedXPText", label = "Rested XP Text" },
92
92
+
}
93
93
+
94
94
+
local entry = map[arg1]
95
95
+
if entry then
96
96
+
toggleLabel(entry.key, entry.label)
97
97
+
else
98
98
+
showHelp()
99
99
+
end
100
100
+
return
101
101
+
end
102
102
+
103
103
+
if cmd == "show" then
57
104
if F.InitDB then F.InitDB() end
58
105
F.DB.enabled = true
59
106
print("NixxnuxXPBar: Visible")
60
107
if F.UpdateUI then F.UpdateUI() end
61
61
-
elseif cmd == "hide" then
108
108
+
return
109
109
+
end
110
110
+
111
111
+
if cmd == "hide" then
62
112
if F.InitDB then F.InitDB() end
63
113
F.DB.enabled = false
64
114
print("NixxnuxXPBar: Hidden")
65
115
if F.Frame and F.Frame.Hide then F.Frame:Hide() end
66
66
-
else
67
67
-
print("NixxnuxXPBar: Commands: /nxp toggle | /nxp show | /nxp hide")
116
116
+
return
68
117
end
118
118
+
119
119
+
showHelp()
69
120
end
+54
-7
UI.lua
reviewed
···
165
165
F.InfoText:SetDrawLayer("OVERLAY", 2)
166
166
F.InfoText:SetTextColor(1, 1, 1, 1)
167
167
168
168
+
-- quest/rested XP amounts
169
169
+
F.QuestXPText = overlay:CreateFontString(nil, "OVERLAY")
170
170
+
F.QuestXPText:SetFont(CFG.font, CFG.fontSize - 2, "OUTLINE")
171
171
+
F.QuestXPText:SetPoint("TOP", overlay, "BOTTOM", 0, -22)
172
172
+
F.QuestXPText:SetJustifyH("CENTER")
173
173
+
F.QuestXPText:SetDrawLayer("OVERLAY", 2)
174
174
+
F.QuestXPText:SetTextColor(1, 1, 1, 1)
175
175
+
168
176
-- Leveling info
169
177
F.LevelingText = overlay:CreateFontString(nil, "OVERLAY")
170
178
F.LevelingText:SetFont(CFG.font, CFG.fontSize - 2, "OUTLINE")
···
260
268
local percentXP = (s.maxXP > 0) and (s.currentXP / s.maxXP * 100) or 0
261
269
local percentRested = (s.maxXP > 0) and (s.restedXP / s.maxXP * 100) or 0
262
270
263
263
-
F.LevelText:SetText("Level " .. s.level)
271
271
+
if db.showLevelText then
272
272
+
F.LevelText:SetText("Level " .. s.level)
273
273
+
F.LevelText:Show()
274
274
+
else
275
275
+
F.LevelText:SetText("")
276
276
+
F.LevelText:Hide()
277
277
+
end
264
278
265
265
-
if s.isMaxLevel then
266
266
-
F.TextCenter:SetText("Level " .. s.level .. " (Max)")
279
279
+
if db.showXPText then
280
280
+
if s.isMaxLevel then
281
281
+
F.TextCenter:SetText("Level " .. s.level .. " (Max)")
282
282
+
else
283
283
+
F.TextCenter:SetText(string.format("%s / %s", FormatLargeNumber(s.currentXP), FormatLargeNumber(s.maxXP)))
284
284
+
end
285
285
+
F.TextCenter:Show()
267
286
else
268
268
-
F.TextCenter:SetText(string.format("%s / %s", FormatLargeNumber(s.currentXP), FormatLargeNumber(s.maxXP)))
287
287
+
F.TextCenter:SetText("")
288
288
+
F.TextCenter:Hide()
269
289
end
270
290
271
291
local percentStr = ""
···
284
304
end
285
305
end
286
306
287
287
-
if percentStr ~= "" and s.maxXP > 0 then
307
307
+
if db.showPercentText and percentStr ~= "" and s.maxXP > 0 then
288
308
F.TextRight:SetText(percentStr)
309
309
+
F.TextRight:Show()
289
310
else
290
311
F.TextRight:SetText("")
312
312
+
F.TextRight:Hide()
291
313
end
292
314
293
315
do
···
309
331
levelingStr = string.format("Leveling in: %s (%s XP/Hr)", timerText, xpRateText)
310
332
end
311
333
312
312
-
if #infoParts > 0 then
334
334
+
if db.showQuestRestedText and #infoParts > 0 then
313
335
F.InfoText:SetText(table.concat(infoParts, " - "))
336
336
+
F.InfoText:Show()
314
337
else
315
338
F.InfoText:SetText("")
339
339
+
F.InfoText:Hide()
316
340
end
317
341
318
318
-
if levelingStr ~= "" then
342
342
+
if db.showLevelingText and levelingStr ~= "" then
319
343
F.LevelingText:SetText(levelingStr)
344
344
+
F.LevelingText:Show()
320
345
else
321
346
F.LevelingText:SetText("")
347
347
+
F.LevelingText:Hide()
348
348
+
end
349
349
+
end
350
350
+
351
351
+
do
352
352
+
local xpParts = {}
353
353
+
if db.showIncompleteQuestXPText and (s.incompleteXP or 0) > 0 then
354
354
+
table.insert(xpParts, string.format("Uncompleted Quest XP: %s", FormatLargeNumber(s.incompleteXP or 0)))
355
355
+
end
356
356
+
if db.showCompletedQuestXPText and (s.completeXP or 0) > 0 then
357
357
+
table.insert(xpParts, string.format("Completed Quest XP: %s", FormatLargeNumber(s.completeXP or 0)))
358
358
+
end
359
359
+
if db.showRestedXPText and (s.restedXP or 0) > 0 then
360
360
+
table.insert(xpParts, string.format("Rested XP: %s", FormatLargeNumber(s.restedXP or 0)))
361
361
+
end
362
362
+
363
363
+
if #xpParts > 0 then
364
364
+
F.QuestXPText:SetText(table.concat(xpParts, " - "))
365
365
+
F.QuestXPText:Show()
366
366
+
else
367
367
+
F.QuestXPText:SetText("")
368
368
+
F.QuestXPText:Hide()
322
369
end
323
370
end
324
371
end