Skip to content

Commit

Permalink
- use new hero asset url from epicsevendb v2 API
Browse files Browse the repository at this point in the history
  • Loading branch information
Zarroc2762 committed Apr 26, 2020
1 parent 9806bf0 commit 41b4fee
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
6 changes: 3 additions & 3 deletions E7 Gear Optimizer/Hero.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public Hero(string ID, string name, List<Item> gear, Item artifact, int lvl, int
}
};
SkillWithSoulburn = Skills.FirstOrDefault(s => s.HasSoulburn) ?? new Skill();
Portrait = getPortrait(name);
Portrait = getPortrait(name, json);
PortraitSmall = Util.ResizeImage(Portrait, 60, 60);
stars = getStars(lvl, awakening);
currentStats = calcStats();
Expand All @@ -94,7 +94,7 @@ public int Awakening
public Dictionary<Stats, float> CurrentStats { get => currentStats; }

//Fetch the portrait of the hero from EpicSevenDB
private Image getPortrait(string name)
private Image getPortrait(string name, string json)
{
Bitmap portrait;
try
Expand All @@ -110,7 +110,7 @@ private Image getPortrait(string name)
}
else
{
portrait = new Bitmap(Util.client.OpenRead(Util.AssetUrl + "/hero/" + Util.toAPIUrl(Name) + "/icon.png"));
portrait = new Bitmap(Util.client.OpenRead(JObject.Parse(json)["results"][0]["assets"]["icon"].ToString()));
if (Properties.Settings.Default.UseCache)
{
portrait.Save(cacheFileName, ImageFormat.Png);
Expand Down
1 change: 0 additions & 1 deletion E7 Gear Optimizer/Util.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ public enum HeroClass
public static class Util
{
public static string ApiUrl = System.Configuration.ConfigurationManager.AppSettings["ApiUrl"].Replace("epicsevendb-apiserver.herokuapp.com/api", "api.epicsevendb.com");
public static string AssetUrl = System.Configuration.ConfigurationManager.AppSettings["AssetUrl"];
public static string GitHubUrl = System.Configuration.ConfigurationManager.AppSettings["GitHubUrl"];
public static string GitHubApiUrl = System.Configuration.ConfigurationManager.AppSettings["GitHubApiUrl"];
public static string ver = System.Configuration.ConfigurationManager.AppSettings["Version"];
Expand Down

0 comments on commit 41b4fee

Please sign in to comment.