Originally Posted by SDPhantom
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:
local highlight=QuestInfoItemHighlight:GetRegions(); local selectbutton=QuestInfoItem_OnClick; hooksecurefunc("QuestInfoItem_OnClick",function(self) highlight:SetVertexColor(1,1,1); end); QuestFrame:HookScript("OnEvent",function(self,event,...) if event=="QUEST_COMPLETE" or event=="QUEST_ITEM_UPDATE" then local numchoices=GetNumQuestChoices(); local maxid,maxval=0,-1; for i=1,numchoices do local link=GetQuestItemLink("choice",i); if not link then return; end local price=select(11,GetItemInfo(link))*select(3,GetQuestItemInfo("choice",i)); if price>maxval then maxid,maxval=i,price; end end if maxid>0 then selectbutton(_G["QuestInfoItem"..maxid]); highlight:SetVertexColor(0,1,0); QuestInfoFrame.itemChoice=0;-- Hack to deselect choice end end 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.