WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   itemSellPrice differs from actual ingame selling price (https://www.wowinterface.com/forums/showthread.php?t=57978)

zZeroFJ 05-04-20 09:43 AM

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().

tinyu 05-04-20 11:25 PM

QuestInfoRewardsFrameQuestInfoItem

zZeroFJ 05-05-20 05:49 AM

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


All times are GMT -6. The time now is 10:55 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI