WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   PTR UI Bugs (https://www.wowinterface.com/forums/forumdisplay.php?f=176)
-   -   [7.1.5] GetQuestItemInfo returns incomplete data (https://www.wowinterface.com/forums/showthread.php?t=55135)

MunkDev 02-13-17 01:24 PM

[7.1.5] GetQuestItemInfo returns incomplete data
 
2 Attachment(s)
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.

lightspark 02-13-17 10:53 PM

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 :confused:

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 :D

MunkDev 02-14-17 04:10 AM

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.

Lombra 02-14-17 07:22 AM

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.

MunkDev 02-14-17 11:54 AM

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.


All times are GMT -6. The time now is 04:33 AM.

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