View Single Post
09-29-11, 08:31 AM   #16
Grim077
A Deviate Faerie Dragon
 
Grim077's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2010
Posts: 15
Originally Posted by SDPhantom View Post
This is code that I wrote for this exact purpose. I changed it from actually selecting the item to showing the highest vendor price with a colored border. This was because I've continually made the mistake of getting into the habit of clicking "Continue" before changing the selection to an item I actually needed.

lua Code:
  1. local highlight=QuestInfoItemHighlight:GetRegions();
  2. local selectbutton=QuestInfoItem_OnClick;
  3. hooksecurefunc("QuestInfoItem_OnClick",function(self) highlight:SetVertexColor(1,1,1); end);
  4. QuestFrame:HookScript("OnEvent",function(self,event,...)
  5.     if event=="QUEST_COMPLETE" or event=="QUEST_ITEM_UPDATE" then
  6.         local numchoices=GetNumQuestChoices();
  7.         local maxid,maxval=0,-1;
  8.         for i=1,numchoices do
  9.             local link=GetQuestItemLink("choice",i);
  10.             if not link then return; end
  11.  
  12.             local price=select(11,GetItemInfo(link))*select(3,GetQuestItemInfo("choice",i));
  13.             if price>maxval then
  14.                 maxid,maxval=i,price;
  15.             end
  16.         end
  17.         if maxid>0 then
  18.             selectbutton(_G["QuestInfoItem"..maxid]);
  19.             highlight:SetVertexColor(0,1,0);
  20.             QuestInfoFrame.itemChoice=0;--  Hack to deselect choice
  21.         end
  22.     end
  23. end);

This works perfectly for what i want thanks, but is there anyway you could make it also tell you theres an item that you may be able to use.
__________________
I see you, But you can't see me!
  Reply With Quote