{"action":"created","issue":{"url":"https://api.github.com/repos/Bungie-net/api/issues/735","repository_url":"https://api.github.com/repos/Bungie-net/api","labels_url":"https://api.github.com/repos/Bungie-net/api/issues/735/labels{/name}","comments_url":"https://api.github.com/repos/Bungie-net/api/issues/735/comments","events_url":"https://api.github.com/repos/Bungie-net/api/issues/735/events","html_url":"https://github.com/Bungie-net/api/issues/735","id":372114517,"node_id":"MDU6SXNzdWUzNzIxMTQ1MTc=","number":735,"title":"Plugs are kind of a nightmare","user":{"login":"xxbiohazrdxx","id":24279336,"node_id":"MDQ6VXNlcjI0Mjc5MzM2","avatar_url":"https://avatars1.githubusercontent.com/u/24279336?v=4","gravatar_id":"","url":"https://api.github.com/users/xxbiohazrdxx","html_url":"https://github.com/xxbiohazrdxx","followers_url":"https://api.github.com/users/xxbiohazrdxx/followers","following_url":"https://api.github.com/users/xxbiohazrdxx/following{/other_user}","gists_url":"https://api.github.com/users/xxbiohazrdxx/gists{/gist_id}","starred_url":"https://api.github.com/users/xxbiohazrdxx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xxbiohazrdxx/subscriptions","organizations_url":"https://api.github.com/users/xxbiohazrdxx/orgs","repos_url":"https://api.github.com/users/xxbiohazrdxx/repos","events_url":"https://api.github.com/users/xxbiohazrdxx/events{/privacy}","received_events_url":"https://api.github.com/users/xxbiohazrdxx/received_events","type":"User","site_admin":false},"labels":[{"id":671956752,"node_id":"MDU6TGFiZWw2NzE5NTY3NTI=","url":"https://api.github.com/repos/Bungie-net/api/labels/question","name":"question","color":"cc317c","default":true}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":8,"created_at":"2018-10-19T21:00:47Z","updated_at":"2018-10-20T02:43:58Z","closed_at":null,"author_association":"NONE","body":"This is gonna be a long one, so bear with me please.\r\n\r\nLet's say I want to parse all of the plugs for a particular instance of an item. Specifically, I would like to find the Weapon Mods for that item. Let's take a look at a table of the Weapon Mods in the manifest.\r\n\r\n**displayProperties.name**|**itemTypeDisplayName**|**hash**|**plug.plugCategoryIdentifier**|**plug.plugCategoryHash**|**itemType**|**itemSubType**\r\n:-----:|:-----:|:-----:|:-----:|:-----:|:-----:|:-----:\r\nKinetic Damage Mod|Weapon Mod|4160547565|v300.weapon.damage\\_type.kinetic|405287501|19|0\r\nTargeting Adjuster|Weapon Mod|3228611386|v400.weapon.mod\\_guns|510594033|19|0\r\nRadar Tuner|Weapon Mod|371216963|v400.weapon.mod\\_guns|510594033|19|0\r\nFreehand Grip|Weapon Mod|736000386|v400.weapon.mod\\_guns|510594033|19|0\r\nIcarus Grip|Weapon Mod|941997506|v400.weapon.mod\\_guns|510594033|19|0\r\nCounterbalance Stock|Weapon Mod|1588595445|v400.weapon.mod\\_guns|510594033|19|0\r\nWeapon Attack Mod|Weapon Mod|4207478320|v300.weapon.damage\\_type.attack|674045876|19|0\r\nBoss Spec|Weapon Mod|2788909693|v400.weapon.mod\\_damage|974142739|19|0\r\nMinor Spec|Weapon Mod|4091000557|v400.weapon.mod\\_damage|974142739|19|0\r\nMajor Spec|Weapon Mod|984527513|v400.weapon.mod\\_damage|974142739|19|0\r\nTaken Spec|Weapon Mod|1513326571|v400.weapon.mod\\_damage|974142739|19|0\r\nSolar Damage Mod|Weapon Mod|2273483223|v300.weapon.damage\\_type.energy|1466776700|19|0\r\nRandom Damage Type|Weapon Mod|2510923716|v300.weapon.damage\\_type.energy|1466776700|20|0\r\nVoid Damage Mod|Weapon Mod|3728733956|v300.weapon.damage\\_type.energy|1466776700|19|0\r\nArc Damage Mod|Weapon Mod|3994397859|v300.weapon.damage\\_type.energy|1466776700|19|0\r\nArc Damage Mod|Weapon Mod|4126105782|v300.weapon.damage\\_type.energy|1466776700|19|0\r\nSolar Damage Mod|Weapon Mod|344032858|v300.weapon.damage\\_type.energy|1466776700|19|0\r\nVoid Damage Mod|Weapon Mod|1837294881|v300.weapon.damage\\_type.energy|1466776700|19|0\r\nEmpty Mod Socket|Weapon Mod|2323986101|v400.weapon.mod\\_empty|3945646995|19|0\r\nBackup Mag|Weapon Mod|3336648220|v400.weapon.mod\\_magazine|4087004818|19|0\r\n\r\nHow would I do that? At first glance it looks like the itemType and itemSubType might work, but the combination of\r\n\r\n`itemType == 19 and itemSubType == 0`\r\n\r\nis actually valid for many, many other plugs and not just Weapon Mods (not to mention there's a single 20 in there for itemType).\r\n\r\nI can't use the `plug.plugCategoryHash` even though it looks promising. Pre 4.x/Forsaken mods have a value of `1466776700`....except when they don't. Kinetic Damage Mod and Weapon Attack Mod are different. Post 4.x/Forsaken mods have a `plug.plugCategoryHash` of either `510594033` or `974142739` unless there is no mod, in which case it is `3945646995`.\r\n\r\nIt looks like the easiest way to get only Weapon Mods is `itemTypeDisplayName == \"Weapon Mod\"`. That's not ideal, but it works.\r\n\r\nHowever, this doesn't carry over to other categories. Let's take Armor Mods (Note that I have significantly truncated this and the proceeding tables because we don't need to see every plug to get the point)\r\n\r\n**displayProperties.name**|**itemTypeDisplayName**|**hash**|**plug.plugCategoryIdentifier**|**plug.plugCategoryHash**|**itemType**|**itemSubType**\r\n:-----:|:-----:|:-----:|:-----:|:-----:|:-----:|:-----:\r\nImpact Absorption Mod|Arms Armor Mod|2361721165|enhancements.arms|640682011|19|0\r\nSolar Ordnance Mod|Arms Armor Mod|2499197808|enhancements.arms|640682011|19|0\r\nVoid Ordnance Mod|Arms Armor Mod|3014957206|enhancements.arms|640682011|19|0\r\nKinetic Counterbalance Mod|Chest Armor Mod|2565377288|enhancements.chest|383756333|19|0\r\nArc Paragon Mod|Chest Armor Mod|2782922115|enhancements.chest|383756333|19|0\r\nKinetic Counterbalance Mod|Chest Armor Mod|2855491837|enhancements.chest|383756333|19|0\r\nEmperor's Blaze|Class Item Mod|3018857481|enhancements.class|1955304674|19|0\r\nEmperor's Balance|Class Item Mod|3511308612|enhancements.class|1955304674|19|0\r\nEmperor's Shock|Class Item Mod|2044767186|enhancements.class|1955304674|19|0\r\nKinetic Counterbalance Mod|Hunter Cloak Mod|2352344841|enhancements.class\\_hunter|1425760675|19|0\r\nSolar Impact Mod|Hunter Cloak Mod|2407848812|enhancements.class\\_hunter|1425760675|19|0\r\nAcceleration Mod|Hunter Cloak Mod|3076431036|enhancements.class\\_hunter|1425760675|19|0\r\nSolar Ordnance Mod|Titan Mark Mod|2291847593|enhancements.class\\_titan|397607061|19|0\r\nPower Munition Loader|Titan Mark Mod|3131975519|enhancements.class\\_titan|397607061|19|0\r\nKinetic Munition Loader|Titan Mark Mod|3217779897|enhancements.class\\_titan|397607061|19|0\r\nEnergy Bracket Mod|Warlock Bond Mod|2575146041|enhancements.class\\_warlock|1216445120|19|0\r\nArc Impact Mod|Warlock Bond Mod|3094848290|enhancements.class\\_warlock|1216445120|19|0\r\nVoid Ordnance Mod|Warlock Bond Mod|3145634685|enhancements.class\\_warlock|1216445120|19|0\r\nSolar Paragon Mod|Helmet Armor Mod|2365108107|enhancements.head|744326128|19|0\r\nSolar Ordnance Mod|Helmet Armor Mod|2450367421|enhancements.head|744326128|19|0\r\nImpact Absorption Mod|Helmet Armor Mod|2451142299|enhancements.head|744326128|19|0\r\nEnergized|Leg Armor Mod|2426323900|enhancements.legs|1175552225|19|0\r\nVoid Impact Mod|Leg Armor Mod|2988871238|enhancements.legs|1175552225|19|0\r\nSelf-Repairing Mod|Leg Armor Mod|3034612620|enhancements.legs|1175552225|19|0\r\nEmpty Mod Socket|Armor Mod|2600899007|enhancements.universal|3347429529|19|0\r\nTranscendent Blessing|Armor Mod|3255036626|enhancements.universal|3347429529|19|0\r\nRiven's Curse|Armor Mod|3300281544|enhancements.universal|3347429529|19|0\r\nParagon Mod|Armor Mod|3649276740|enhancements.universal|3347429529|19|0\r\nResilience Mod|Armor Mod|3790655795|enhancements.universal|3347429529|19|0\r\nEmpty Mod Socket|Armor Mod|3851138800|enhancements.universal|3347429529|19|0\r\nRecovery Mod|Armor Mod|126924337|enhancements.universal|3347429529|19|0\r\nMobility Mod|Armor Mod|275671171|enhancements.universal|3347429529|19|0\r\nSuper Mod|Armor Mod|444600262|enhancements.universal|3347429529|19|0\r\nOrdnance Mod|Armor Mod|817770433|enhancements.universal|3347429529|19|0\r\nImpact Mod|Armor Mod|1512056643|enhancements.universal|3347429529|19|0\r\n  | |4072982370|enhancements.universal|3347429529|19|0\r\nEmpty Mod Socket| |1835369552|enhancements.universal|3347429529|19|0\r\n\r\nThe hashes are a bit better here, 3.x Armor Mods have a `plug.plugCategoryHash` that definitively mark this Plug as being an Armor Mod and for a particular item/bucket. This isn't super helpful if we want to find all armor mods for all slots, for that we can instead do a `itemTypeDisplayName.contains(\"Armor Mod\")` or perhaps `plug.plugCategoryIdentifier.startsWith(\"enhancements\")`.\r\n\r\nMasterworks?\r\n\r\n**displayProperties.name**|**itemTypeDisplayName**|**hash**|**plug.plugCategoryIdentifier**|**plug.plugCategoryHash**|**itemType**|**itemSubType**\r\n:-----:|:-----:|:-----:|:-----:|:-----:|:-----:|:-----:\r\nSturm Catalyst| |1824496860|v300\\_new\\_hand\\_cannon0\\_masterwork|746309217|19|0\r\nSunshot Catalyst| |3617228241|v300\\_new\\_hand\\_cannon1\\_masterwork|4249350918|20|0\r\nUpgrade Masterwork| |223776600|v300\\_new\\_hand\\_cannon1\\_masterwork|4249350918|19|0\r\nSunshot Catalyst| |354293076|v300\\_new\\_hand\\_cannon1\\_masterwork|4249350918|20|0\r\nSunshot Catalyst| |1824496861|v300\\_new\\_hand\\_cannon1\\_masterwork|4249350918|19|0\r\nUpgrade Masterwork| |3547298846|v300\\_new\\_pulse\\_rifle0\\_masterwork|520351532|19|0\r\nVigilance Wing Catalyst| |615063267|v300\\_new\\_pulse\\_rifle0\\_masterwork|520351532|19|0\r\nVigilance Wing Catalyst| |1620506138|v300\\_new\\_pulse\\_rifle0\\_masterwork|520351532|20|0\r\nVigilance Wing Catalyst| |1772168355|v300\\_new\\_pulse\\_rifle0\\_masterwork|520351532|20|0\r\nTier 4 Armor| |2572873168|v400.plugs.armor.masterworks.stat.resistance\\_1|1514141502|19|0\r\nMasterwork| |2572873169|v400.plugs.armor.masterworks.stat.resistance\\_1|1514141502|19|0\r\nTier 1 Armor| |2572873173|v400.plugs.armor.masterworks.stat.resistance\\_1|1514141502|19|0\r\nTier 2 Armor| |2572873174|v400.plugs.armor.masterworks.stat.resistance\\_1|1514141502|19|0\r\nTier 3 Armor| |2572873175|v400.plugs.armor.masterworks.stat.resistance\\_1|1514141502|19|0\r\nTier 1 Armor| |3130025792|v400.plugs.armor.masterworks.stat.resistance\\_2|1514141501|19|0\r\nTier 3 Armor| |3130025794|v400.plugs.armor.masterworks.stat.resistance\\_2|1514141501|19|0\r\nTier 2 Armor| |3130025795|v400.plugs.armor.masterworks.stat.resistance\\_2|1514141501|19|0\r\nTier 2 Weapon| |2203506851|v400.plugs.weapons.masterworks.stat.draw\\_time|482070447|19|0\r\nTier 5 Weapon| |2203506852|v400.plugs.weapons.masterworks.stat.draw\\_time|482070447|19|0\r\nTier 4 Weapon| |2203506853|v400.plugs.weapons.masterworks.stat.draw\\_time|482070447|19|0\r\nTier 7 Weapon| |2203506854|v400.plugs.weapons.masterworks.stat.draw\\_time|482070447|19|0\r\nTier 6 Weapon| |2203506855|v400.plugs.weapons.masterworks.stat.draw\\_time|482070447|19|0\r\nTier 9 Weapon| |2203506856|v400.plugs.weapons.masterworks.stat.draw\\_time|482070447|19|0\r\nTier 8 Weapon| |2203506857|v400.plugs.weapons.masterworks.stat.draw\\_time|482070447|19|0\r\nMasterwork| |3689550782|v400.plugs.weapons.masterworks.stat.draw\\_time|482070447|19|0\r\nMasterwork| |1639384016|v400.plugs.weapons.masterworks.stat.draw\\_time|482070447|19|0\r\nMasterwork| |2357520979|v400.plugs.weapons.masterworks.stat.handling|199786516|19|0\r\nMasterwork| |186337601|v400.plugs.weapons.masterworks.stat.handling|199786516|19|0\r\nTier 8 Weapon| |518224738|v400.plugs.weapons.masterworks.stat.handling|199786516|19|0\r\nTier 9 Weapon| |518224739|v400.plugs.weapons.masterworks.stat.handling|199786516|19|0\r\nTier 2 Weapon| |518224744|v400.plugs.weapons.masterworks.stat.handling|199786516|19|0\r\nTier 3 Weapon| |518224745|v400.plugs.weapons.masterworks.stat.handling|199786516|19|0\r\n\r\nCheck and see if `plug.plugCategoryIdentifier.contains(\"masterwork\")` then also see if `plug.plugCategoryIdentifier.startsWith(\"v4\")` so I know to query the manifest for `investmentStats[0].statTypeHash` to get the localized name of the Masterwork stat.\r\n\r\nHow about Shaders?\r\n\r\n**displayProperties.name**|**itemTypeDisplayName**|**hash**|**plug.plugCategoryIdentifier**|**plug.plugCategoryHash**|**itemType**|**itemSubType**\r\n:-----:|:-----:|:-----:|:-----:|:-----:|:-----:|:-----:\r\nDefault Shader|Restore Defaults|4248210736|shader|2973005342|19|20\r\nWar Cult Scheme|Shader|2296172971|shader|2973005342|19|20\r\nSUROS Tone|Shader|2307426896|shader|2973005342|19|20\r\nSUROS Modular|Shader|2307426898|shader|2973005342|19|20\r\nCrucible Triumph|Shader|2361935691|shader|2973005342|19|20\r\nMetallic Sunrise|Shader|2395477994|shader|2973005342|19|20\r\nPrecursor Vex Chrome|Shader|2395477996|shader|2973005342|19|20\r\nDesert of Gold|Shader|2395477997|shader|2973005342|19|20\r\nDescendant Vex Chrome|Shader|2395477998|shader|2973005342|19|20\r\nMercury Vex Chrome|Shader|2395477999|shader|2973005342|19|20\r\nRusted Iron|Shader|2448092902|shader|2973005342|19|20\r\nPraetorian Visage|Shader|2543722796|shader|2973005342|19|20\r\nCalus's Shadow|Shader|2543722797|shader|2973005342|19|20\r\nCrucible Solemnity|Shader|2588739576|shader|2973005342|19|20\r\n\r\nThis one is easy! Every shader in the game has a `plug.plugCategoryHash` of `2973005342`! I wish all the plugs were like this!\r\n\r\nI realize that the actual data that the API is retrieving may very well may be beyond your control, but if there was some kind of massaging that could be done before it is returned would make Plugs a lot easier to use. An enumerator for the types of Plugs and honestly just some consistency of which field I should be looking at to determine exactly what the Plug is."},"comment":{"url":"https://api.github.com/repos/Bungie-net/api/issues/comments/431542375","html_url":"https://github.com/Bungie-net/api/issues/735#issuecomment-431542375","issue_url":"https://api.github.com/repos/Bungie-net/api/issues/735","id":431542375,"node_id":"MDEyOklzc3VlQ29tbWVudDQzMTU0MjM3NQ==","user":{"login":"vthornheart-bng","id":31020340,"node_id":"MDQ6VXNlcjMxMDIwMzQw","avatar_url":"https://avatars1.githubusercontent.com/u/31020340?v=4","gravatar_id":"","url":"https://api.github.com/users/vthornheart-bng","html_url":"https://github.com/vthornheart-bng","followers_url":"https://api.github.com/users/vthornheart-bng/followers","following_url":"https://api.github.com/users/vthornheart-bng/following{/other_user}","gists_url":"https://api.github.com/users/vthornheart-bng/gists{/gist_id}","starred_url":"https://api.github.com/users/vthornheart-bng/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vthornheart-bng/subscriptions","organizations_url":"https://api.github.com/users/vthornheart-bng/orgs","repos_url":"https://api.github.com/users/vthornheart-bng/repos","events_url":"https://api.github.com/users/vthornheart-bng/events{/privacy}","received_events_url":"https://api.github.com/users/vthornheart-bng/received_events","type":"User","site_admin":false},"created_at":"2018-10-20T02:43:58Z","updated_at":"2018-10-20T02:43:58Z","author_association":"CONTRIBUTOR","body":"Thank you, good questions as well!"}}
{"actor":{"display_login":"vthornheart-bng"}}