Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Help with getting armor perks #839

Open
kjverble opened this issue Dec 27, 2018 · 17 comments
Open

Help with getting armor perks #839

kjverble opened this issue Dec 27, 2018 · 17 comments

Comments

@kjverble
Copy link

Hello,

I've been working with the API now for a number of hours. I'm finding it difficult to slog through all the api calls, hashes, manifest lookups, etc, to do what I'm trying to do. I wanted to see if I could get some guidance to narrow it down some to what I need to look at.

What I want to do it list each armor piece on a character, equipped and unequipped. I want to list the various perks, like what reserves or scavenger options, if it charges your super faster when you get fusion rifle kills, what burn defense it has, etc.

The goal is to list all these things in one view so when someone gets a new armor piece, they can easily compare that new piece to what they already have and make a quick decision whether it is worth keeping.

What I have done so far is the SearchDestinyPlayer call, a GetProfile call for CharacterEquipment, then a GetProfile call for ItemPerks, then fetching the manifest and getting the DestinySandboxPerkDefinitions. I was then trying to match up the perkHash to the items in the sandbox perk table. I'm now somewhat lost and I feel I may be going down the wrong path for this. Any guidance at this point would be helpful.

Thanks for any help,
Kevin

@vthornheart-bng
Copy link
Contributor

vthornheart-bng commented Dec 27, 2018

Greetings! Aye, unfortunately the data you want is in what's become one of the most complicated and unintuitive parts of the data, which is the Socket information.

Sockets and their inserted plugs represent what you see when you look at an item's detail screen in the game: all of the circles that you can activate are plugs that you activate on sockets. Other properties, like the "intrinsic" properties of the weapon, its' masterwork/element defense level, and even what shader it has are all plugs on sockets.

It sounds like you're doing the right thing all the way up through the GetProfile call - and indeed, the perk information is good to look through and show users, as it has both information about perks provided by the item's sockets and information about "intrinsic" perks that are on the item itself. The complicating factor is that not all sockets provide "perks," but they do modify the weapon's attributes and qualities. For instance, there's no perk that represents a piece of armor's elemental defense level, but there is a plug inserted into one of its sockets that represents it. To get a full picture of the item's qualities, you'll want to grab and show information about both Perks and the inserted plugs in the item's sockets. (you may also want to show the item's stats potentially, though I don't know if you personally care as much about that data for this application)

Sockets are, unfortunately, a complex topic. I have an ask in the Winter Wishlist to do a further write-up on them (as they sorely need additional documentation), but for now this should give you a good entry point:

Socket Definitions

Socket "Live" data

Request the ItemSockets component and check out what it gives back, along with the documentation above - and let me know if this is of help!

@vthornheart-bng
Copy link
Contributor

Also, for a more direct link to what I'm planning to write about when I find the time to do so... this outline itself can be a good overview for the types of data you'll find in Sockets, and then you can decide for yourself how much of it you'll choose to care about/not care about for your app!

#735 (comment)

@kjverble
Copy link
Author

Thanks for the information. I've been looking further. I was actually fairly close to what I needed with what I had. The perk list shows me the things I want to see. The problem is it only shows the active perks. For example, I see Fusion Rifle Reserves on an armor piece because it's active. I also want to see it's counterpart that isn't active, Rocket Launcher Reserves (or whatever it may be). Do I still need to resort to the socket/plug things you mention above? I've been looking at it and it is complicated.
Thanks.

@vthornheart-bng
Copy link
Contributor

Ah, good stuff! So if you want the potential perks, you're going to have to do a bit of a descent into the "reusablePlugItems" in the socket definitions. Those will give you the hash identifiers for other DestinyInventoryItemDefinitions - and the perks on those will be the perks that the item inherits when that plug is inserted!

(note that it becomes even more complicated if you care about plugs that aren't reusable, like "Mods": but I'd recommend discounting those, as they're generally applicable to many if not all weapons/armor anyways)

@kjverble
Copy link
Author

Sorry to keep bothering you. Just tell me when you've had enough. I'm somewhat stumped again. I have code that gets the DestinyInventoryItemDefinitions for the reusablePlugItems as you mention above, but I'm not seeing what I expect.

If you can make sense out of what I have below, I'm looking at my currently equipped helmet. The first 5 perks are the active perks from doing a GetItem with the ItemPerks option. After that I'm getting the DestinyInventoryItemDefinition for that equipped item and then getting the item definition for the resuablePlugItems in socketEntries. It's showing me the two armor perks for choosing between resilience and health but not the other two sets, Then it drops into the masterwork and shader which I don't really care about. Do you know why I'm not getting the missing two sets of armor perk options?

Helmet

Perk Survivalist Hunter Armor
Perk Ordnance Mod
Perk Arc Damage Resistance
Perk Hands-On
Perk Fusion Rifle Reserves
Item Tangled Web Mask
Plug Survivalist Hunter Armor-Improved recovery.
Perk Survivalist Hunter Armor
Plug Plasteel Reinforcement Mod-Increased Resilience.
Plug Restorative Mod-Increased Health Recovery.
Plug Tier 1 Armor-Base-level armor. Increase the tier to forge a Masterwork item.
Plug Tier 2 Armor-Slightly improved resistance. Increase the tier to forge a Masterwork item.
Plug Tier 3 Armor-Moderately improved resistance. Increase the tier to forge a Masterwork item.
Plug Tier 4 Armor-Remarkably improved resistance. Increase the tier to forge a Masterwork item.
Plug Masterwork-Maximized resistance.
Plug Tier 1 Armor-Base-level armor. Increase the tier to forge a Masterwork item.
Perk Arc Damage Resistance
Plug Tier 2 Armor-Slightly improved resistance. Increase the tier to forge a Masterwork item.
Perk Arc Damage Resistance
Plug Tier 3 Armor-Moderately improved resistance. Increase the tier to forge a Masterwork item.
Perk Arc Damage Resistance
Plug Tier 4 Armor-Remarkably improved resistance. Increase the tier to forge a Masterwork item.
Perk Arc Damage Resistance
Plug Masterwork-Maximized resistance.
Perk Arc Damage Resistance
Plug Tier 1 Armor-Base-level armor. Increase the tier to forge a Masterwork item.
Perk Solar Damage Resistance
Plug Tier 2 Armor-Slightly improved resistance. Increase the tier to forge a Masterwork item.
Perk Solar Damage Resistance
Plug Tier 3 Armor-Moderately improved resistance. Increase the tier to forge a Masterwork item.
Perk Solar Damage Resistance
Plug Tier 4 Armor-Remarkably improved resistance. Increase the tier to forge a Masterwork item.
Perk Solar Damage Resistance
Plug Masterwork-Maximized resistance.
Perk Solar Damage Resistance
Plug Tier 1 Armor-Base-level armor. Increase the tier to forge a Masterwork item.
Perk Void Damage Resistance
Plug Tier 2 Armor-Slightly improved resistance. Increase the tier to forge a Masterwork item.
Perk Void Damage Resistance
Plug Tier 3 Armor-Moderately improved resistance. Increase the tier to forge a Masterwork item.
Perk Void Damage Resistance
Plug Tier 4 Armor-Remarkably improved resistance. Increase the tier to forge a Masterwork item.
Perk Void Damage Resistance
Plug Masterwork-Maximized resistance.
Perk Void Damage Resistance
Plug Default Shader-Restores your gear to its default colors.

@vthornheart-bng
Copy link
Contributor

Ah, I think the problem is that I left out some of the information about sockets unintentionally - I forgot to mention that, when a socket has a "known set" of possible plugs, it can have either "reusablePlugItems" or "randomizedPlugItems". The former is the full set that you can always choose from for that socket: the latter is a (potentially huge, unfortunately) set of plugs, only some of which will be possible to be chosen for any given item.

If you're grabbing instance information for these items anyways, you can grab the "ItemSockets" component which will give you a DestinyItemSocketState for every socket on the item. From there, you can look at the "reusablePlugs" property to see which plugs are active - be they "randomized" or "reusable"!

I'm hoping to cover this subject in more detail when I finally get around to this plugs article that I intend to write, but in the meantime that should hopefully give you something to work with!

@vthornheart-bng
Copy link
Contributor

Also, don't be afraid to keep the questions coming when you run into them! I'm glad to answer them - though sometimes there'll be a lag time depending on how busy I am, but I try to loop back when I can!

Answering questions helps me to better realize where there's pain points in the API, so it's useful for everyone when folks ask questions!

@kjverble
Copy link
Author

Yes, thanks. ItemSockets looks to get me what I need.

@vthornheart-bng
Copy link
Contributor

Sweet, excellent!

@andyschott
Copy link

I'm struggling with this right now as well. Maybe something I've found will help you, and help me to get unstuck too.

If I get the ItemSockets from the item instance, that seems to get me all available perks for year 2 items. So far so good.

However I happened to have a year 1 exotic I pulled from Collections equipped (arm slot, if that matters), and ItemSockets only contained the exotic perk, the stats of the item (resilience and recovery in this case), and the mods. The remaining perks were missing.

I think that I need to get socket information from the DestinyInventoryItemDefinition, and then somehow combine that with the ItemSockets, but I'm not sure how to correlate the two.

ItemSockets also seems to not return the perks on a ghost shell. It looks like that returns all of the projections I've unlocked, and not much else.

@vthornheart-bng
Copy link
Contributor

Oh, that's interesting - what item was it specifically that you're not getting back socket information for? And is it missing the socket info, the perk info, or both? It sounds like that might be a bug potentially!

@andyschott
Copy link

andyschott commented Dec 28, 2018

The item is Doom Fang Pauldron. When I look at the same item in both the official app and Ishtar Commander, all the perks show up correctly. Hence my assumption that I've done something wrong. :)

What's interesting is if I load the sockets only from the DestinyInventoryItemDefinition, then they are all correct.

In case it helps, I've attached the JSON that is returned for calling GetItem() with ItemSockets for the Doom Fang Pauldron, and a screenshot of my app (which loaded the plugs from the manifest database).
Doom Fang Pauldron ItemSocket JSON.txt
doom fang pauldron sockets

It looks like all that's missing are the two perks "Momentum Transfer" and "Special Ammo Finder".

@vthornheart-bng
Copy link
Contributor

Hmm - aye, be sure to check out the logic you have that's parsing the sockets.data.sockets[].reusablePlugs properties in those response objects. When I take a look at that .txt file you sent over and look up the definitions for the plug items in each socket's properties, I see:

4248210736 -> "Default Shader"

1155472387 -> "Horns of Doom"

3530997750 -> "Plasteel Reinforcement Mod"
2032054360 -> "Restorative Mod"

2600899007 -> "Empty Mod Socket"

702981643 -> "Default Ornament"

320680844 -> "Momentum Transfer"

2620835322 -> "Special Ammo Finder"

@andyschott
Copy link

Ok, that's probably the issue then. I'll debug the code that works through the plugs and see if I can find what I'm missing.

@vthornheart-bng
Copy link
Contributor

Sweet - yeah, let us know if you find out what it is, perhaps it'll be useful to others!

@andyschott
Copy link

I figured out the problem. I was only using the reusablePlugs to read in the plugs in a socket. For the mod socket, Momentum Transfer, and Special Ammo Finder reusablePlugs was null. For those, if I read the plug hash from the socket directly (the PlugHash member) then those mods are shown.

As for the ghost shell I was having problems with, I think it's working now too. If I understand it correctly, all of my projections are shown because they are all in the reusablePlugs array for the projection slot. I can probably manually filter those out so they aren't included.

Thanks for the help!

@vthornheart-bng
Copy link
Contributor

Ahhh, good deal! Yeah, those sockets have fixed entries - good find!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants