Thread Tools Display Modes
06-09-15, 04:37 PM   #1
bsmorgan
A Cobalt Mageweaver
AddOn Author - Click to view addons
Join Date: Mar 2005
Posts: 219
How to recover from bogus (incomplete) data from Blizzard

The following loop is supposed to return all the recipe and header data for a tradeskill (complete code is in the addon Skillet, SkilletData.lua):

Code:
numSkills = GetNumTradeSkills(); for i = 1, numSkills, 1 do skillName, skillType = GetTradeSkillInfo(i); end
Every tradeskill has skill types of "header" and most have "subheader"s. Sometimes (more often after a server restart or a clear of the local cache), Blizzard will return the correct number of skills, but the returned data will not have any headers (and the reagents for each skill will be missing). Skillet now recognizes that its about to process bogus data, so it prints out a message. If the player keeps trying, eventually Blizzard will return good data (it had to be fetched from the server). Once you have good data, it is cached locally.

Blizzard doesn't generate an event when the data becomes valid (i.e. the server has finished fetching) and delaying for some period of time and trying again doesn't seem to work. I'm guessing that I need another "click" from the player to allow progress.

If anyone has an idea as to how to solve this problem (without forcing the player to keep trying again), I'm all ears!

I believe I can recreate the problem by deleting World of Warcraft\Cache\*\enUS\*.* (I haven't tried to find the specific file) and then opening a tradeskill with Skillet installed.
  Reply With Quote
06-09-15, 06:44 PM   #2
Nimhfree
A Frostmaul Preserver
AddOn Author - Click to view addons
Join Date: Aug 2006
Posts: 267
Some data does not become valid until other things have happened on the system. Historically from my point of view it is somewhat trial and error. You try to access your data after different things have happened in the system (which you might be able to mimic using events). For example, you might want to wait until a ZONE_CHANGED_NEW_AREA happens before you know something is available. You can of course unregister from receiving that event again if you just want your setup to happen once. Basically look at what events are sent during login/reload ui/etc. to see when your data starts to be there. (For example, everyone knows you are no longer in combat when you receive PLAYER_REGEN_ENABLED.)
  Reply With Quote
06-09-15, 07:09 PM   #3
bsmorgan
A Cobalt Mageweaver
AddOn Author - Click to view addons
Join Date: Mar 2005
Posts: 219
Originally Posted by semlar View Post
Just so you know, you have to actually expand all of the headers and clear the filters to iterate over the complete tradeskill list.
Skillet (and I) do know that. The actual code has two loops like the one I posted above. The first expands everything and the second captures the needed recipe data. There's also code to clear the filters.
  Reply With Quote
06-09-15, 07:20 PM   #4
bsmorgan
A Cobalt Mageweaver
AddOn Author - Click to view addons
Join Date: Mar 2005
Posts: 219
Originally Posted by Nimhfree View Post
Some data does not become valid until other things have happened on the system. Historically from my point of view it is somewhat trial and error. You try to access your data after different things have happened in the system (which you might be able to mimic using events).
While trying to figure this out, I did an "/eventtrace" and then watched to see what events fired. I also added RegisterEvent(...) for anything that looked interesting. I was able to detect the error case, but I could not find an event to use for attempting to collect the data again.
  Reply With Quote
06-09-15, 07:27 PM   #5
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
You could just have Skillet try again without the user needing to click something.
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote
06-09-15, 07:35 PM   #6
bsmorgan
A Cobalt Mageweaver
AddOn Author - Click to view addons
Join Date: Mar 2005
Posts: 219
Originally Posted by Seerah View Post
You could just have Skillet try again without the user needing to click something.
I tried that and all I got for my troubles is an infinite loop. I could vary the delay between loops and tried everything from .5 seconds to 10 seconds. That's what got me to this point of asking for help!
  Reply With Quote
06-09-15, 08:32 PM   #7
Torhal
A Pyroguard Emberseer
 
Torhal's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2008
Posts: 1,196
The data should definitely be available during TRADE_SKILL_SHOW... what, exactly, are you trying to do with this data?
__________________
Whenever someone says "pls" because it's shorter than "please", I say "no" because it's shorter than "yes".

Author of NPCScan and many other AddOns.
  Reply With Quote
06-09-15, 09:17 PM   #8
bsmorgan
A Cobalt Mageweaver
AddOn Author - Click to view addons
Join Date: Mar 2005
Posts: 219
Originally Posted by Torhal View Post
The data should definitely be available during TRADE_SKILL_SHOW... what, exactly, are you trying to do with this data?
The keyword here is "should"!

Skillet is a Blizzard Tradeskill UI replacement. What it tries to do is replace all the functionality of the Blizzard Tradeskill UI plus added features (see the addon description). The project has been around since August 2008 and I've been the primary maintainer / author since March 2014.

I first noticed this "problem" while running Skillet on the 6.2 PTR but I (and others) have noticed it happening on live. As I was debugging on the PTR, I discovered that the "problem" would disappear if I kept trying (i.e. I'd add more debug code to figure it out and it would magically disappear).

This portion of the code has been working for quite some time but this "problem" is a recent change in behavior. It wouldn't be the first "race condition" I've found and fixed, but it is proving to be quite stubborn.

I believe I have a method to reliably cause the problem which involves using the [View All] on the Guild Roster Tab, View: Professions. Also, expanding a profession and clicking on the profession of an offline guild member exposed a bug (which has been fixed) which required using the TRADE_SKILL_NAME_UPDATE event to trigger the scan of the profession.

Unfortunately, the problem occurs with the professions known by the player most often after a server restart (and a clear of the client World of Warcraft\Cache folder). This is the case where I'd sure like to use an event to trigger the scan.

Last edited by bsmorgan : 06-09-15 at 09:22 PM.
  Reply With Quote
06-10-15, 07:32 PM   #9
Banknorris
A Chromatic Dragonspawn
 
Banknorris's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2014
Posts: 153
I will dare to guess what is happening is items caching problem. Try calling GetItemInfo(item_id) for everything related (recipes, reagents, materials) and for each item that returned nill watch for GET_ITEM_INFO_RECEIVED (item_id as arg1).
http://wow.gamepedia.com/Events/G#GE..._INFO_RECEIVED

This will force the information about the items (recipes) to be cached.
__________________
"In this world nothing can be said to be certain, except that fractional reserve banking is a Ponzi scheme and that you won't believe it." - Mandrill
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » How to recover from bogus (incomplete) data from Blizzard


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