-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathQuestLogPlus.lua
More file actions
47 lines (40 loc) · 1.62 KB
/
QuestLogPlus.lua
File metadata and controls
47 lines (40 loc) · 1.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
-- Declare addon name and namespace
local addOnName, ns = ...
-- Create the main frame for the addon
local QuestLogPlus = CreateFrame("FRAME")
QuestLogPlus:RegisterEvent("ADDON_LOADED")
-- Event handler for ADDON_LOADED event
function QuestLogPlus:ADDON_LOADED(loadedAddOnName)
if loadedAddOnName == addOnName then
-- Hook into the QuestLog_Update function to customize quest display
hooksecurefunc("QuestLog_Update", function()
QuestLogPlus:QuestLog_Update()
end)
end
end
-- Function to update the quest log display
function QuestLogPlus:QuestLog_Update()
local numEntries = GetNumQuestLogEntries()
local scrollOffset = HybridScrollFrame_GetOffset(QuestLogListScrollFrame)
local buttons = QuestLogListScrollFrame.buttons
for i = 1, #buttons do
local questIndex = i + scrollOffset
local questLogTitle = buttons[i]
if questIndex <= numEntries then
local _, level = GetQuestLogTitle(questIndex)
local questText = questLogTitle:GetText()
-- Check if the level is greater than 0 and if both level and quest text are available
if level and level > 0 and questText then
local questTextFormatted = format("[%d] %s", level, questText)
questLogTitle:SetText(questTextFormatted)
questLogTitle.normalText:SetWidth(265 - questLogTitle.tag:GetStringWidth())
end
end
end
end
-- Set the script for the main frame to handle events
QuestLogPlus:SetScript("OnEvent", function(self, event, ...)
if self[event] then
return self[event](self, ...)
end
end)