Skip to content

Commit

Permalink
Fixed export of characters to be their appropriate type
Browse files Browse the repository at this point in the history
  • Loading branch information
qkmaxware committed May 24, 2021
1 parent fd6021c commit 0c33698
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
11 changes: 9 additions & 2 deletions TrekSharp.AdventureTools/Shared/CharacterEditorPopoutTab.razor
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,15 @@

public async Task Export() {
if (HasCharacter) {
var character = this.Character;
await this.DownloadJson($"{character.Name}.character", character);
if (this.Character is PlayerCharacter pc) {
await this.DownloadJson<PlayerCharacter>($"{pc.Name}.character", pc);
} else if (this.Character is SupportCharacter sc) {
await this.DownloadJson<SupportCharacter>($"{sc.Name}.character", sc);
} else if (this.Character is NpcCharacter npc) {
await this.DownloadJson<NpcCharacter>($"{npc.Name}.character", npc);
} else {
await this.DownloadJson<Character>($"{Character.Name}.character", Character);
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion TrekSharp/src/Character.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public int Determination {
set => _det = (value < 0 ? 0 : value);
}

public override int BonusStress => Talents.Select(talent => talent?.StressModifier ?? 0).Sum();
public override int BonusStress => Talents == null ? 0 : Talents.Select(talent => talent?.StressModifier ?? 0).Sum();

}

Expand Down

0 comments on commit 0c33698

Please sign in to comment.