Bungie-net / api

Resources for the Bungie.net API
Other
1.21k stars 92 forks source link

Possible changes to Destiny2.GetHistoricalStats #303

Open dad2cl3 opened 6 years ago

dad2cl3 commented 6 years ago

I know the endpoint is still in beta so was curious if the following change might be coming to the endpoint. The current response from the endpoint for Iron Banner Control uses the key ironBannerControl as follows:

{"Response" : {"ironBannerControl": {stats}, "allPvE": {stats} ...

I can not find the key, as currently returned in the response, in the manifest. The corresponding key in the manifest is iron-banner-control. Fortunately, the integer mode in the Destiny.HistoricalStats.Definitions.DestinyActivityModeType is 43 and consistent with the manifest table.

A couple of other examples: pve (manifest) and allPvE (response), crucible (manifest) and allPvP (response)

So my question is whether or not work on that endpoint might include smoothing out the inconsistencies between the response from the endpoint and the manifest definitions? Possibly standardizing the keys? Utilizing the hash for the mode instead (consistent with aggregate activity stats)? Utilizing the integer game mode?

vthornheart-bng commented 6 years ago

Sweet, rock it! Good stuff!

joeydood commented 6 years ago

Thank you sir!

joeydood commented 6 years ago

I really need to re-read your character/player/membership/account sermon again really well because next i would like to do clan vs clan and infinite # of users and single-player char vs char vs char stats.

joeydood commented 6 years ago

Lord Vandor,

What does the stat 'remaining time after quit' defined as and what is its practical purpose?

Thanks

vthornheart-bng commented 6 years ago

Ah, that is how many seconds were remaining in the activity after someone quit - so say someone quits the activity right away, and then 10 minutes later the activity actually ends, then you'd see 600 seconds as the value for this field.

joeydood commented 6 years ago

That's what i thought, aka 'Rage Quitters' metric? Haha!

vthornheart-bng commented 6 years ago

Ha, perhaps! :D

joeydood commented 6 years ago

Haha! No comment no comment! Get that camera outta my face!

joeydood commented 6 years ago

Someone on reddit just asked me about it today and i said i would ask. May i quote you on 'Perhaps'? Love that answer!

floatingatoll commented 6 years ago

"Perhaps" is non-committal, and it would be really nice if Reddit did NOT swarm the issue tracker with thousands of angry comments due to a reply quoted out of context with humorous - but risky - intentions. Please consider carefully whether it'd be a good idea or not.

On Tue, Jan 30, 2018 at 4:08 PM, joeydood notifications@github.com wrote:

Someone on reddit just asked me about it today and i said i would ask. May i quote you on 'Perhaps'? Love that answer!

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/Bungie-net/api/issues/303#issuecomment-361778279, or mute the thread https://github.com/notifications/unsubscribe-auth/AAFqDFb-9aZpiTihzVgV0s_aSDfBM71Aks5tP670gaJpZM4QhEwB .

joeydood commented 6 years ago

Yeah, um, it was a joke dude.

joeydood commented 6 years ago

VPZED: I've read your excellent part 2 tutorial on the API and still cannot figure out the trick to just submitting someone's - let's say, ps4 user name - and getting the membershipid to lookup bungie stats for that bungie user and their character. Any help would be appreciated, sir.

What I am trying to accomplish is entering a user name and obtaining their stats per platform and each character and then aggregating that data.

e.g.: userid: reanman18 [ps4] vs reanman [destiny 2/bungie]

For reanman18, i get an empty response: {{ "Response": [], "ErrorCode": 1, "ThrottleSeconds": 0, "ErrorStatus": "Success", "Message": "Ok", "MessageData": {}}}

For reanman, i get a full-blown response, which includes his membership id's for other gaming platforms and i won't post all of that here for brevity's sake.

I'm testing with the following endpoints:

Is there somewhere this is laid out in a visual hierarchy where it makes sense, like in an object browser format, instead of having to try to comprehend different approaches to 'documenting' this? It should all be very straightforward however, it is not clear to me yet.

I know i'm just not getting something here and i'd really like to figure it out - and i'm sure it's explained in your docs somewhere, could you just point me in the right direction perhaps?

Many thanks!

vpzed commented 6 years ago

@joeydood

You would use

https://www.bungie.net/Platform/Destiny2/SearchDestinyPlayer/-1/reanman18/ 

to get the Destiny player information. In this case that returns:

membershipType: 2
membershipId: 4611686018429074676

Then you'd use one of the stats endpoints to retrieve the stats. For Account level stats you'd use:

https://www.bungie.net/Platform/Destiny2/2/Account/4611686018429074676/Stats/?groups=1,2,3

assuming you wanted all three StatGroupTypes.

To get Character level stats you'd need the characterIds and for that you'd use:

https://www.bungie.net/Platform/Destiny2/2/Profile/4611686018429074676/?components=100

which would return:

characterIds: 2305843009261560924, 2305843009261560926, 2305843009289698560

And then you'd use those in a Character level stats call like:

https://www.bungie.net/Platform/Destiny2/2/Account/4611686018429074676/Character/2305843009261560924/Stats/?periodType=2&groups=1,2&modes=2,3,4

for some PvE stats for a few ActivityTypeModes.

You'd obviously adjust the query parameters to meet your needs.

Only Destiny Accounts will have stats - so accounts of MembershipType 1, 2, and 4. Bungie accounts (MembershipType 254) will not have stats.

joeydood commented 6 years ago

Thank you sir, for answering my questions. I shall give this a try and will report back. It appears that thou rockest as unto the hurricane - Thanks!

joeydood commented 6 years ago

Works like a champ, my dude! You have now been immortalized in code: public class vpZed{...} 2 new classes have been created (thank gawd for auto class generation from data, right?) to hold the new infos.

Careful what i wish for eh? May it rain gummy bears on you (the good German kind)! May you code be free of nulls for a thousand days! May the fragrance of the one thousand Sweet Olive trees be in the wind for you!

Thank you very much! [kung fu bow]

image

joeydood commented 6 years ago

So, i've been a little busy body on this fun project -

New Additions and Fixes:

Thanks everyone for their input and assistance but I'm sure i'll have more questions as things progress. I'm really happy to have made this happen as it has been a desire of mine for quite some time to give back to the community in some way and well, i am addicted to coding.

Going forward, I will stop using github as the place to display fixes and such, as it is more appropriate to submit those things to the brutal, hyper-critical community of reddit. It was just mildly appropriate to do so this time, to let those who helped, know their advice is working.

Thanks everyone very much!

vthornheart-bng commented 6 years ago

I'm glad it worked out, good stuff! Swing on by if you ever run into any issues!

joeydood commented 6 years ago

Thank you, sir!

I'll be around ;)

joeydood commented 6 years ago

Just a brief clarification: isn't PGA = per game average?

Is it defined here? https://bungie-net.github.io/multi/schema_Destiny-HistoricalStats-Definitions-UnitType.html#schema_Destiny-HistoricalStats-Definitions-UnitType

vthornheart-bng commented 6 years ago

Oh, yes - if you're talking those pga values that we return alongside some stats, those are indeed per game averages for the time range requested, and are defined here:

https://bungie-net.github.io/multi/schema_Destiny-HistoricalStats-DestinyHistoricalStatsValue.html#schema_Destiny-HistoricalStats-DestinyHistoricalStatsValue

The PerGame UnitType enum you see there is used for theoretical stats where the stat itself is strictly per-game. I did a quick glance at the existing stats, and it doesn't look like any stats actually are just per game, so you won't see that UnitType being used right now. But theoretically in the future, we could start passing a stat that is purely for that purpose.

joeydood commented 6 years ago

That sounds great, thanks very much for the clarification.

When it comes to the 'time remaining after quit seconds' data point, i think the pga value is WAY more meaningful than the data point's value.

just imo.

Thanks!

joeydood commented 6 years ago

Ruh Roh!

?item.ErrorStatus.Root.ToString() Exception thrown: 'Microsoft.CSharp.RuntimeBinder.RuntimeBinderException' in Microsoft.CSharp.dll "{\r\n \"ErrorCode\": 5,\r\n \"ThrottleSeconds\": 0,\r\n \"ErrorStatus\": \"SystemDisabled\",\r\n \"Message\": \"This system is temporarily disabled for maintenance.\",\r\n \"MessageData\": {}\r\n}"

vthornheart-bng commented 6 years ago

Yes, this will happen on occasion - parts of our system can be disabled for a variety of reasons: the game itself may be undergoing maintenance, or Bungie.Net may be undergoing maintenance that required it to be offline, or sometimes for other reasons. Usually that will correspond with a message player support folks if you're watching their twitter feed or Bungie.Net.