Bungie-net / api

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

Small Clan Icon not returning from API #293

Closed mattybeard closed 6 years ago

mattybeard commented 6 years ago

I can see the clan banner stuff is coming through the GroupV2 endpoint in the ClanBanner object but the smaller square decals don't appear to return at all.

The clan_banner sql content has the "SquareDecals" tables but I it doesn't appear to return anywhere?

image

xlxCLUxlx commented 6 years ago

You need to actually build your clan banner from the returned data and then size it accordingly. You can can refer to this issue 125 where I have outlined how to build your clan banner or refer directly to the Wiki I created which also has some code as an example. Building Your Clan Banner: How To

Hope this hepls you out! Regards.

mattybeard commented 6 years ago

Yeah, I understand that for the main banner itself (I love your code by the way) BUT what about the smaller icon?

If I look at the source of my clan on Bungie, I see the smaller icon made up of: /common/destiny2_content/icons/cb_decal_square_53468fe0799b424f995509d03be6bfa8.png /common/destiny2_content/icons/cb_decal_square_c0ecd484a44c9aa934f9fb67e1ac1108.png

which are stored in the SquareDecals table which I don't see returned from the API?

image

xlxCLUxlx commented 6 years ago

Ah, sorry! I see what you are going for now.

Ok, yeah s once you query your clan and get this which it sounds like you have already done

{
  "clanBannerData": {
    "decalId": 4142223384,
    "decalColorId": 3379387794,
    "decalBackgroundColorId": 3535193483,
    "gonfalonId": 1473910866,
    "gonfalonColorId": 2124081031,
    "gonfalonDetailId": 1647698443,
    "gonfalonDetailColorId": 4078567643
  }
}

You will go to the clanbanner_sql_content database and execute a query like so

SELECT json 
FROM SquareDecals
WHERE CASE WHEN (id < 0) THEN (id + 4294967296) ELSE id END = 4142223384;

where 4142223384 is the decalId from clanBannerData You will get back the following:

{
  "imageHash": 4142223384,
  "foregroundImagePath": "/common/destiny2_content/icons/cb_decal_square_c0ecd484a44c9aa934f9fb67e1ac1108.png",
  "backgroundImagePath": "/common/destiny2_content/icons/cb_decal_square_53468fe0799b424f995509d03be6bfa8.png"
}

You can see foregroundImagePath and backgroundImagePath reference the png images you were calling out up above.

mattybeard commented 6 years ago

Oh I see, I assumned decalID would be unique to the clan banner and the square stuff would be in it's own part and be entirely unlinked. I see what you mean now and will close the comment.

I'm using your project as inspiration so will use it to draw the square parts too.

Thanks for your help!