Right now, I have do some crazy stuff to get a place’s icon, and this isn’t even in ROBLOX:
var placeId = 1818;
var PlaceNameUrlEncoded = "Crossroads";
HttpWebRequest req = HttpWebRequest.CreateHttp("http://www.roblox.com/games/moreresultscached?StartRows=0&MaxRows=85&Keyword=" + PlaceNameUrlEncoded);
try
{
WebResponse resp = req.GetResponse();
string body = new StreamReader(resp.GetResponseStream()).ReadToEnd();
var m = Regex.Match(body, @"<a href=""(.*?)"" class=""game-item"">");
var m2 = Regex.Match(body, @"src=""(.*?)""");
while (m.Success)
{
var href = m.Groups[1].Value;
var img = m2.Groups[1].Value;
if (href.Contains(placeId.ToString()))
{
Console.WriteLine(img);
break;
}
m = m.NextMatch();
m2 = m2.NextMatch();
}
}
catch(Exception e){Console.WriteLine(e);}
Unfortunately, depending on how common the name of the place is, this could take quite a while depending on how popular the place is. That’s why I propose an API to easily allow getting the icon of a place. This way, my code could be simplified into something simple like this:
var PlaceId = 1818;
HttpWebRequest req = HttpWebRequest.CreateHttp("<url to get place icon>?PlaceId="+1818);
try
{
WebResponse resp = req.GetResponse();
string iconURL = new StreamReader(resp.GetResponseStream()).ReadToEnd();
Console.WriteLine(iconURL);
// Or, if the API redirects to the asset or simply returns it, I could just punch the url to get the icon into where it's needed.
}
catch (Exception e)
{
Console.WriteLine(e);
}
Of course, the API would be best if it also worked in-game, but I don’t see many use cases for it in-game. On the other hand, using icons in other places (e.g. websites) is a good idea as icons usually uniquely identify the place and their ability to scale well makes them suitable for notifications and other places where small icons are suitable