Skip to content

Commit

Permalink
- fixed a bug where hero base stats where not updated when the hero l…
Browse files Browse the repository at this point in the history
…vl was changed in the heroes tab
  • Loading branch information
Zarroc2762 committed Jun 3, 2019
1 parent 0c5ec96 commit 96e7777
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
13 changes: 11 additions & 2 deletions E7 Gear Optimizer/Hero.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ public class Hero
private int awakening;
private Image stars;
public Image Stars { get => stars; }
public Dictionary<Stats, decimal> BaseStats { get; }

private Dictionary<Stats, decimal> baseStats;
public Dictionary<Stats, decimal> BaseStats { get => baseStats; }
private Dictionary<Stats, decimal> currentStats;
private Dictionary<Stats, decimal> AwakeningStats { get; set; }

Expand All @@ -47,7 +49,7 @@ public Hero(string ID, string name, List<Item> gear, Item artifact, int lvl, int
try
{
string json = Util.client.DownloadString(Util.ApiUrl + "/hero/" + Util.toAPIUrl(Name));
BaseStats = getBaseStats(json);
baseStats = getBaseStats(json);
Element = getElement(json);
Class = getClass(json);
AwakeningStats = getAwakeningStats(json);
Expand Down Expand Up @@ -129,6 +131,13 @@ private Dictionary<Stats,decimal> getBaseStats(string json)
return baseStats;
}

//Updates base stats from EpicSevenDB
public void updateBaseStats()
{
string json = Util.client.DownloadString(Util.ApiUrl + "/hero/" + Util.toAPIUrl(Name));
baseStats = getBaseStats(json);
}

//Parse JSON data from EpicSevenDB to get the stats of an awakened hero
private Dictionary<Stats,decimal> getAwakeningStats(string json)
{
Expand Down
1 change: 1 addition & 0 deletions E7 Gear Optimizer/Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -806,6 +806,7 @@ private void B_EditHero_Click(object sender, EventArgs e)

Item artifact = new Item("", ItemType.Artifact, Set.Attack, Grade.Epic, 0, 0, new Stat(), new Stat[] { new Stat(Stats.ATK, (decimal)nud_ArtifactAttack.Value), new Stat(Stats.HP, (decimal)nud_ArtifactHealth.Value) }, null, false);
hero.Artifact = artifact;
hero.updateBaseStats();
hero.calcAwakeningStats();
hero.calcStats();
}
Expand Down

0 comments on commit 96e7777

Please sign in to comment.