From b59dbaac214a9d6b5be586632188a62c74fbf9e0 Mon Sep 17 00:00:00 2001 From: p3lim Date: Sat, 25 Dec 2010 03:49:41 +0100 Subject: [PATCH] Add automatic reward highlight by vendor value --- Monomyth.toc | 1 + Rewards.lua | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 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) -- 1.7.9.5