No replies
Korjo's picture
Offline
Guild MemberGuild OfficerWebsite Moderator
Joined: 11/07/2009

This probably won't matter much to anyone in the guild and won't matter when trade skills are shown on the Armory (coming with Cataclysm). I just wanted to post this somewhere for anyone working with Blizzard’s TradeSkillLink recipe list. While Wowwiki has quite a bit of information on TradeSkillLinks, it leaves a lot of questions unanswered. I will probably clean up the Wowwiki page sometime.

The TradeSkillLink recipe lists are Base64 and can be decoded easily. Below I have a C# function that returns a BitArray.

Once you have the bit array, you can look it up in a bit map table. Example of decoding a recipe list: AgAA is decoded into 000000000001000000000000. This is then matched up to a trade skills bit map to see what recipes are known. These trade skill tables can potentially change with every patch. I’ve saved the tables for patch 3.3.2 here: patch3-3-2-tradeskilllink.txt. The [bracketed] numbers represent a table of spell IDs for trade skills. Example: [2550] is cooking. "2538, -- [2]" is Charred Wolf Meat at the 2nd position in the cooking trade skill array. Also, First Aid is different from the other trade skills. It does not follow the same pattern and shouldn’t be used.

  private static int[] base64Values =
  {
	-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
	-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
	-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, -1, 63, 
	52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, -1, -1, -1,
	-1, 00, 01, 02, 03, 04, 05, 06, 07, 08, 09, 10, 11, 12, 13, 14, 
	15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1, 
	-1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
	41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, -1, -1, -1
  };

  private static byte getBase64Value(char c)
  {
	byte b = Convert.ToByte(c);

	if (b < 0 || b > 127)
	    throw new ArgumentOutOfRangeException();

	return (byte)base64Values[b];
  }

  private static BitArray decodeTradeSkillLink(string tradeSkillLink)
  {
	BitArray decodedTradeSkills = new BitArray(tradeSkillLink.Length * 6);

	for (int i = 0; i < tradeSkillLink.Length; i++)
	{
	    byte b = getBase64Value(tradeSkillLink[i]);

	    for (int j = 0; j < 6; j++)
		  if ((b & (byte)Math.Pow(2, j)) == 0)
			decodedTradeSkills[i*6+j] = false;
		  else
			decodedTradeSkills[i*6+j] = true;
	}

	return decodedTradeSkills;
  }


Resources for more information:

http://www.wowwiki.com/TradeSkillLink

Gnomish Yellow Pages (used to find trade skill bit map table)


I hope this is helpful to anyone trying to write a WoW trade skill web app. Also, stay tuned for a really cool guild trade skill directory that Lucral and I are working on.