Any updates soon?

Aug 13, 2012 at 3:17 PM

Hi,

first, i really want to thank you for the work, you've already put in this project.

I just wanted to ask, if you have any plans in updating this so we can use it with real data from Diablo 3. The reason for asking is, that this API just fits perfect with my plans in learning and using the Windows Presentation Foundation.

 

Would really like it if you could give any information on these. Greets,

Atrion.

Aug 14, 2012 at 2:51 AM

Hi Atrion, 

I've been very busy getting ready for my fast approaching Freshman Year of College! 

I've been so busy in fact, that I wasn't aware of the release of the official API! (How could I have missed that) I just tried it, and found some problems. This was due to a request format change on Blizzard's end, with the final release version of their API. It's an easy fix and I will upload it as a completely new version for the official Blizzard API release.

Thanks,

Promedeus

Aug 16, 2012 at 4:47 PM

Hi Promedius,

thank you for the latest update. I really like it but i think i'm doing something totally wrong. I can remember that i've downloaded the version before your last update and there it was some different when im not wrong. Everything i got was full typed for example like this:

..

hero as new hero

hero = gethero

hero.name etc.

I know its probably not exactly how it was but i hope you get what i want to say. There were real objects(Hero, item, idk.). But now i can just use the object wich i get from your library and go the way you describe in the documentation.

For what i've tested, it's working. But i'm normally programming with Option Strict On so it feels some dirty to go that way. Can you tell me if i am doing something wrong? If not and thats exactly how you thought about using this, i sadly think that i have to write my own library.

 

I would really like to get an answer from you,

Atrion.

Aug 17, 2012 at 1:35 AM

Hi Atrion,

D3API.Net has and always will return dynamic objects. I assure this is for a good reason though, allow me to explain.

The dynamic type allows an incredibly flexible approach to data retrieval and storage. For one, if the data returned ever changes, nothing will have to be changed in the library to accommodate for it. As for the case of a strongly typed object, this would not be the case. The class would have to be completely rewritten to accommodate for any change. 

I'm not sure I see the point in having a fully typed object to begin with. Theoretically, from a user perspective, the only thing that changes is how intellisense deals with them. Other than that, the end result of the two are literally the same - in fact a dynamic object mimics every aspect of what is returned by the web API, while a strongly typed object would only match the data returned (if something is added to the api, the strongly typed object will no longer match the data returned, and will simply discard what is not defined). Besides, intellisense is a purely aesthetic part of programming. C# is one of the only languages to have intellisense. Before C#, C++ and C didn't have this luxury. 

So, in response to your question, no, D3API.Net does not return strongly typed data, but it still returns the exact same data as if it were strongly typed. But I think it would be very silly to rewrite a library to add intellisense support, after all, that's what Blizzard's documentation is for. ;)

 

Here's a little example:

D3API d3api = new D3API(HostName.en_US);
var hero = d3api.getHeroProfile("Battletag#0000", 0);
string heroName = hero.name;

If you are having trouble figuring out a specific identifier, you can download the test tools. The test tools allow you to visually navigate through a dynamic object and find the correct identifier for the correct field. It's like the visual version of intellisense!

Hope this helps,

Promedeus

Aug 17, 2012 at 5:51 AM

Thanks for the answer. I get your arguments. It is a lot of work to write the full typed objects and translate the json to those. Also it could obviously be a lot of work to implement changes blizzard will make. Thats totally right.

Maybe it's just me but it doesn't feel right for me. I think i will just write the objects i need in my application and hope it's working a long time until i have to modify them. Who knows, maybe i'll change my mind during this process and just use it as you provide it.

Again thanks for your help and work, i just tried your D3MediaLib and it's awesome aswell,

Atrion.

Aug 17, 2012 at 8:58 AM
Edited Aug 17, 2012 at 9:06 AM

Hi there,

With the dynamic objects I've been running into this issue.

},
"Damage_Delta#Physical" : {
"min" : 23.0,
"max" : 23.0
},

How do I retrieve these values as they have the "#" char in it.

hero.items.offhand.attributesRaw.Damage_Delta#Physical obviously doesn't work.

Jien

Edit: Seems I figured it out. By retrieved the attributes raw as a var, it converts the # into underscores.

Aug 19, 2012 at 12:10 AM
Edited Sep 17, 2012 at 9:18 PM

Hey Jien!

This was one of the first problems I ran into when writing D3API.Net. Since the first version I have implemented a feature that converts all invalid characters to an underscore. Long before the official API was released I pleaded to Blizzard (Straton mainly) to "fix" or change these issues. Although, in the end this didn't happen, I think converting them to underscores is an appropriate fix.

 

From the beginning this has been documented on the main page under "Know Caveats":

Know Caveats

If you are familiar with Blizzard's Diablo 3 Web API documentation, you may wonder how to access some of the members that are identified by invalid characters.

Since this issue exists there is an implementation that checks all identifiers and replaces all invalid characters with an underscore ( _ ).

For example, if you were to attempt to access "last-updated", which is a Field of a Hero in the Career Profile, you would not be able to because there is a dash ( - ) in the identifier. So to access this Field, you must substitute the dash for an underscore. In result, the new identifier would be "last_updated".

 

Hope you enjoy D3API.Net,

Promedeus

Aug 31, 2012 at 9:55 AM

Hey Promedeus,

Had some time recently to work further with the API and I came across the following issue.

The dynamic "class" property cannot be retrieved cause the "class" is an existing keyword.

Greets,

Jien

Sep 1, 2012 at 9:15 PM
Edited Sep 20, 2012 at 11:05 PM

If you use the "@" operator in front of any member it forces the literal.

For example:

D3API d3api = new D3API(HostName.en_US);
var hero = d3api.getHeroProfile("Battletag#0000", 0);
string heroClass = hero.@class;

Hope this helps,

Promedeus