I currently got some free time to play around with the Diablo 3 Web API. I got an idea last night and implemented it for Patrik's weapon comparison tool.


You can visit the enhanced version of Patrik's weapon comparison tool that uses the Web API here - http://www.bookstur.com/d3/calculator.html


The original version of Patrik's weapon comparison tool is available here -
http://d3.muri.se/comparison/


Instead of a user having to manually get their stats for their hero, they can simply enter their BattleTag and you can get the heroes stats (Str, Dex, Int / Crit Chance / Crit Damage) and auto fill the calculator form with the data for that hero. Diablo 3 Web API works great with Patrik's weapon comparison tool.


I added functionality to the calculator that allows you to input your BattleTag and then you can get a list of heroes to choose from. You choose a hero and from there I make 3 more ajax calls, one to get the primary stats for your hero, and then ajax to get the stats from your heroes main hand and off hand weapons. I deduct the primary stat bonus and crit damage bonus on your main hand and off hand weapon. After all this I then auto fill out the weapon calculator form with the given data for a chosen hero. I auto fill out Weapon A's stats based upon what 1H/2H weapon your hero currently has equipped. From here you can fill in the data for weapon B and calculate the difference.

I want to note one thing that may help future developers - I wasted 20 minutes trying to figure out why I couldn't get a JSON response using jQuery $.ajax If you encounter a cross origin policy problem with the Diablo 3 Web API it is because you need to request JSONP like this -


Code:
$.ajax({//Make the ajax call using GET
type: "GET", url: dataURL, dataType: "jsonp", // must use jsonp ...........
});


Please feel free to look at my JavaScript / jQuery code that is in an external JavaScript file named ajax-bnet.js


I would really appreciate any suggestions or comments.

I also posted a link to the new version of this app in the Community Platform API section on the official D3 forums - http://us.battle.net/d3/en/forum/topic/7004043854


Enjoy !


-Ross