Quantcast itemSellPrice differs from actual ingame selling price - WoWInterface
Thread Tools Display Modes
05-04-20, 09:43 AM   #1
zZeroFJ
A Defias Bandit
Join Date: May 2020
Posts: 2
itemSellPrice differs from actual ingame selling price

Hey, I just got into scripting in Lua today. I want to create a small WeakAura, that displays an icon next to the Quest Reward with the highest vendor selling price.

I got as far as icons only showing with the QuestFrameRewardPanel open, and calling itemSellPrice on various items by its IDs. While experimenting with itemSellPrice, I realized that the selling price from the database is often different to the actual ingame selling price. I suppose that's due to quest rewards scaling with the level of the player, and with it the vendor selling prices.

Is there a way to call GetItemInfo() directly on the items shown in the QuestFrameRewardPanel? I found GetQuestLogChoiceInfo(i) to be perfect for extracting the name of the item rewards, but found no way to call GetItemInfo() directly on the items shown in the Rewards Panel. Is there a way to access the itemSellPrice of the QuestLogChoices?


Edit: I realized by now, that GetQuestLogChoiceInfo() only works if you selected the quest in your quest log. GetNumQuestChoices() and GetQuestChoiceInfo()[?] were the methods I was looking for. However, GetQuestChoiceInfo() does not work the same way GetQuestLogChoiceInfo() does, so I'm not even able to access the names of the rewarded items. I don't know whether that is due to WeakAuras not being able to run C code, or me using the methods wrong.

Is there a way to access the names/IDs of the items from the QuestRewardPanel?

Lua Code:
  1. GetRewardMoney - Returns the amount of money awarded when completing a quest
  2. GetRewardSpell - Returns information about a spell awarded when completing a quest
  3. GetRewardTalents - Returns the talent points awarded when completing a quest
  4. GetRewardText - Returns questgiver dialog to be displayed when completing a quest
  5. GetRewardTitle - Returns the title awarded when completing a quest
  6. GetRewardXP

These are all methods that access some part of the reward interaction initiated by the QUEST_COMPLETE and finished by the QUEST_FINISHED events. But I didn't find a method to access any of the information about the items, only the amount by calling GetNumQuestChoices().

Last edited by zZeroFJ : 05-04-20 at 02:27 PM.
  Reply With Quote
05-04-20, 11:25 PM   #2
tinyu
A Molten Giant
 
tinyu's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 838
QuestInfoRewardsFrameQuestInfoItem
__________________
"There's no such thing as too many addons."
Lothaer
Titan Dev Team Member.
  Reply With Quote
05-05-20, 05:49 AM   #3
zZeroFJ
A Defias Bandit
Join Date: May 2020
Posts: 2
Thank you very much. I was able to get it to work now. I'll paste the custom code I'm using to trigger and display the different icons on top of the items, if anyone is interested.

Lua Code:
  1. function(trigger)
  2.    
  3.     if QuestFrameRewardPanel and QuestFrameRewardPanel:IsShown() then        
  4.        
  5.         local index = 1;
  6.         local highestPrice, newPrice = 0;
  7.        
  8.         for i = 1, GetNumQuestChoices() do
  9.             newPrice = select(11, GetItemInfo(GetQuestItemLink('choice', i)))
  10.             if newPrice > highestPrice then
  11.                 index = i;
  12.                 highestPrice = newPrice;
  13.             end
  14.         end
  15.        
  16.         if index == 1 then    
  17.             return trigger;
  18.         end
  19.     end
  20. end
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » itemSellPrice differs from actual ingame selling price

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off