Quantcast

Add automatic reward highlight by vendor value

p3lim [12-25-10 - 02:49]
Add automatic reward highlight by vendor value
Filename
Monomyth.toc
Rewards.lua
diff --git a/Monomyth.toc b/Monomyth.toc
index fca4004..cc89810 100644
--- a/Monomyth.toc
+++ b/Monomyth.toc
@@ -5,3 +5,4 @@
 ## Notes: Questing enhancements

 Automate.lua
+Rewards.lua
diff --git a/Rewards.lua b/Rewards.lua
new file mode 100644
index 0000000..e39e70e
--- /dev/null
+++ b/Rewards.lua
@@ -0,0 +1,18 @@
+local addon = CreateFrame('Frame')
+addon:RegisterEvent('QUEST_COMPLETE')
+addon:SetScript('OnEvent', function()
+	local bestValue, bestIndex = 0
+
+	for index = 1, GetNumQuestChoices() do
+		local _, _, _, _, _, _, _, _, _, _, value = GetItemInfo(GetQuestItemLink('choice', index))
+		local _, _, quantity = GetQuestItemInfo('choice', index)
+
+		if(value and (value * (quantity or 1) > bestValue)) then
+			bestValue, bestIndex = value * (quantity or 1), index
+		end
+	end
+
+	if(bestIndex) then
+		QuestInfoItem_OnClick(_G['QuestInfoItem' .. bestIndex])
+	end
+end)