Quantcast [7.1.5] GetQuestItemInfo returns incomplete data - WoWInterface
Thread Tools Display Modes
02-13-17, 01:24 PM   #1
MunkDev
A Scalebane Royal Guard
 
MunkDev's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2015
Posts: 424
[7.1.5] GetQuestItemInfo returns incomplete data

GetQuestItemInfo occasionally returns wrong or incomplete data in response to QUEST_DETAIL/QUEST_COMPLETE.

The readout in chat comes from this print probe:
Lua Code:
  1. print(i, questItem.type, GetQuestItemInfo(questItem.type, i))
  2. -- where i=1 to GetNumQuestRewards() and questItem.type == 'reward'

With the data:
Lua Code:
  1. ------------------
  2. -- 1st attempt
  3. ------------------
  4. nil, -- name
  5. 134830, -- texture
  6. 2, -- numItems
  7. 0, -- quality
  8. true, -- isUsable
  9.  
  10. ------------------
  11. -- 2nd attempt
  12. ------------------
  13. "Lesser Healing Potion", -- name
  14. 134830, -- texture
  15. 2, -- numItems
  16. 1, -- quality
  17. true, -- isUsable

If there's something I'm missing here, such as a requirement to scrub the data before you call these functions or something to that effect, feel free to respond to this thread.
Attached Thumbnails
Click image for larger version

Name:	1.jpg
Views:	115
Size:	762.6 KB
ID:	8914  Click image for larger version

Name:	2.jpg
Views:	105
Size:	774.6 KB
ID:	8915  
__________________
  Reply With Quote
02-13-17, 10:53 PM   #2
lightspark
A Rage Talon Dragon Guard
 
lightspark's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2012
Posts: 326
Isn't it normal behaviour for any Get*Info function? I don't think GetQuestItemInfo is different from GetItemInfo. If item isn't cached yet, you'll get either incomplete data or a bunch of nils.

When you request info on not yet cached item, you need to register for GET_ITEM_INFO_RECEIVED event, after this event fires you need to request info again, but I'm not sure if GET_ITEM_INFO_RECEIVED fires after GetQuestItemInfo calls

Alternatively you may try to call stuff recursively w/ some delay if info is missing:

Lua Code:
  1. local function test_func(itemID)
  2.     local _, link = GetItemInfo(itemID)
  3.  
  4.     if not link then
  5.         return C_Timer.After(0.25, function() test_func(itemID) end)
  6.     end
  7.  
  8.     -- do everything else here
  9. end

Some checks to avoid infinite loops may be quite useful too
__________________
  Reply With Quote
02-14-17, 04:10 AM   #3
MunkDev
A Scalebane Royal Guard
 
MunkDev's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2015
Posts: 424
From what I can tell reading the source code, this data should already be available once the event for the quest data fires. I've added a hacky solution for now, but this really seems to be something that's wrong internally. Notice how both the texture reference and the item count get populated properly in both cases, but the name and quality do not.
__________________
  Reply With Quote
02-14-17, 07:22 AM   #4
Lombra
A Molten Giant
 
Lombra's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 554
Item name and quality are both properties that aren't always immediately available, so it should indeed be a cache issue. I don't know if those are screenshots from the default UI, but in that case it seems like they're just missing a suitable callback for when the item has been cached. And no, from my experience GET_ITEM_INFO_RECEIVED is not triggered by functions other than GetItemInfo, even though other functions can be used to request cache info.
__________________
Grab your sword and fight the Horde!
  Reply With Quote
02-14-17, 11:54 AM   #5
MunkDev
A Scalebane Royal Guard
 
MunkDev's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2015
Posts: 424
These screenshots are of an addon, but it's irrelevant. The print output is from the function used by the default UI, called with the same arguments in response to the same event. The frames show what the problem is, but the main thing to look at is the chat output.

The code that runs this is highly optimized in comparison to the quest frame / quest templates, which might account for a few milliseconds. That's the only reason I can think of why it would fail this way. The default UI does not have any callbacks and do not postpone the item updates.

It seems in the default UI that they assume the item data exists on QUEST_DETAIL and/or QUEST_COMPLETE.
__________________
  Reply With Quote

WoWInterface » PTR » PTR UI Bugs » [7.1.5] GetQuestItemInfo returns incomplete data

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