From 8c8b3cea1ae305a40e36c629d8cc0257b049c45d Mon Sep 17 00:00:00 2001 From: p3lim Date: Tue, 28 Dec 2010 02:21:49 +0100 Subject: [PATCH] Just do the reward price highlighting here, no need to use the same even twice --- Automate.lua | 12 ++++++++++++ Rewards.lua | 18 ------------------ 2 files changed, 12 insertions(+), 18 deletions(-) delete mode 100644 Rewards.lua diff --git a/Automate.lua b/Automate.lua index 75ca9ad..5f6c73c 100644 --- a/Automate.lua +++ b/Automate.lua @@ -46,6 +46,18 @@ end) addon:Register('QUEST_COMPLETE', function(...) if(GetNumQuestChoices() <= 1) then GetQuestReward(QuestFrameRewardPanel.itemChoice) + elseif(GetNumQuestChoices() > 1) then + local bestValue, bestIndex = 0 + + for index = 1, GetNumQuestChoices() do + local item, _, _, _, _, _, _, _, _, _, value = GetItemInfo(GetQuestItemLink('choice', index)) + + if(value > bestValue) then + bestValue, bestIndex = value, index + end + end + + QuestInfoItem_OnClick(_G['QuestInfoItem' .. bestIndex]) end end) diff --git a/Rewards.lua b/Rewards.lua deleted file mode 100644 index e39e70e..0000000 --- a/Rewards.lua +++ /dev/null @@ -1,18 +0,0 @@ -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