Hello, I'm working on a simple little script to colour quest reward item names by their quality. This is what I have currently:
Lua Code:
-- colour quest reward names by quality -------------------------------------------------
local function ColourRewards(qinfo)
local isquestlog = QuestInfoFrame.questLog
local numQuestChoices = isquestlog and GetNumQuestLogChoices() or GetNumQuestChoices()
local _, quality
for i = 1, numQuestChoices, 1 do
qinfo.type = "choice"
if isquestlog then
_, _, _, quality = GetQuestLogChoiceInfo(i)
else
_, _, _, quality = GetQuestItemInfo(qinfo.type, i)
end
local colour = ITEM_QUALITY_COLORS[quality]
-- only colour item if it's uncommon +
if qinfo.Name and quality>=2 then
qinfo.Name:SetTextColor(colour.r, colour.g, colour.b)
else
qinfo.Name:SetTextColor(1, 1, 1)
end
end
end
hooksecurefunc("QuestInfo_GetRewardButton", function(rewardsFrame, index)
local q = rewardsFrame.RewardButtons[index]
ColourRewards(q)
end)
the issue is that whilst this works, it doesn't update properly. As far as I can tell it only updates if the level of quality of the reward increases. So a white reward will successfully change to a green one when I click through quests in my log, or a green will change to a blue, but a blue won't go back to being a green or white. Which leads to this:
(garrison resources are a white item)
any ideas what i'm doing wrong? am i hooking the wrong function or something?