Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
109 changes: 56 additions & 53 deletions SMB3Explorer/Models/Exports/CareerBattingStatistic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,127 +10,130 @@ namespace SMB3Explorer.Models.Exports;

public class CareerBattingStatistic : CareerStatistic
{
[Name("primary_position"), Index(10)]
[Ignore]
public int PrimaryPositionNumber { get; set; }

[Name("primary_position_name"), Index(11)]
[Name("Position"), Index(7)]
// ReSharper disable once UnusedMember.Global
public string PrimaryPositionDescription => ((BaseballPlayerPosition) PrimaryPositionNumber).GetEnumDescription();

[Name("secondary_position"), Index(12)]
[Ignore]
public int? SecondaryPositionNumber { get; set; }

[Name("secondary_position_name"), Index(13)]
[Name("Secondary Position"), Index(8)]
// ReSharper disable once UnusedMember.Global
public string? SecondaryPositionDescription => SecondaryPositionNumber is null
? null
: ((BaseballPlayerPosition) SecondaryPositionNumber).GetEnumDescription();

[Name("pitcher_role"), Index(14)]
[Ignore]
public int? PitcherRole { get; set; }

[Name("pitcher_role_name"), Index(15)]
[Name("Pitcher Role"), Index(9)]
// ReSharper disable once UnusedMember.Global
public string? PitcherRoleDescription => PitcherRole is null
? null
: ((PitcherRole) PitcherRole).GetEnumDescription();

[Name("games_played"), Index(16)]
public int GamesPlayed { get; set; }

[Name("games_batting"), Index(17)]
[Name("Games Batting"), Index(10)]
public int GamesBatting { get; set; }

[Name("at_bats"), Index(18)]
[Name("Games Played"), Index(11)]
public int GamesPlayed { get; set; }

[Name("AB"), Index(12)]
public int AtBats { get; set; }

[Name("plate_appearances"), Index(19)]
[Name("PA"), Index(13)]
public int PlateAppearances => AtBats + Walks + SacrificeHits + SacrificeFlies + HitByPitch;

[Name("runs"), Index(20)]
[Name("R"), Index(14)]
public int Runs { get; set; }

[Name("hits"), Index(21)]
[Name("H"), Index(15)]
public int Hits { get; set; }

[Name("singles"), Index(22)]
[Name("BA"), Index(16)]
public double BattingAverage => Hits / (double) AtBats;

[Name("1B"), Index(17)]
public int Singles => Hits - Doubles - Triples - HomeRuns;

[Name("doubles"), Index(23)]
[Name("2B"), Index(18)]
public int Doubles { get; set; }

[Name("triples"), Index(24)]
[Name("3B"), Index(19)]
public int Triples { get; set; }

[Name("home_runs"), Index(25)]
[Name("HR"), Index(20)]
public int HomeRuns { get; set; }

[Name("rbi"), Index(26)]
[Name("RBI"), Index(21)]
public int RunsBattedIn { get; set; }

[Name("extra_base_hits"), Index(27)]
[Name("XBH"), Index(22)]
public int ExtraBaseHits => Doubles + Triples + HomeRuns;

[Name("total_bases"), Index(28)]
[Name("TB"), Index(23)]
public int TotalBases => Singles + (2 * Doubles) + (3 * Triples) + (4 * HomeRuns);

[Name("stolen_bases"), Index(29)]
[Name("SB"), Index(24)]
public int StolenBases { get; set; }

[Name("caught_stealing"), Index(30)]
[Name("CS"), Index(25)]
public int CaughtStealing { get; set; }

[Name("walks"), Index(31)]
[Name("BB"), Index(26)]
public int Walks { get; set; }

[Name("strikeouts"), Index(32)]
[Name("K"), Index(27)]
public int Strikeouts { get; set; }

[Name("hit_by_pitch"), Index(33)]
[Name("HBP"), Index(28)]
public int HitByPitch { get; set; }

[Name("sacrifice_hits"), Index(34)]
public int SacrificeHits { get; set; }

[Name("sacrifice_flies"), Index(35)]
public int SacrificeFlies { get; set; }

[Name("errors"), Index(36)]
public int Errors { get; set; }

[Name("passed_balls"), Index(37)]
public int PassedBalls { get; set; }

[Name("plate_appearances_per_game"), Index(38)]
public double PlateAppearancesPerGame => PlateAppearances / (double) GamesPlayed;

[Name("on_base_percentage"), Index(39)]
[Name("OBP"), Index(29)]
public double OnBasePercentage => (Hits + Walks + HitByPitch) /
(double) (AtBats + Walks + HitByPitch + SacrificeFlies);

[Name("slugging_percentage"), Index(40)]
[Name("SLG"), Index(30)]
public double SluggingPercentage => (Singles + (2 * Doubles) + (3 * Triples) +
(4 * HomeRuns)) / (double) AtBats;

[Name("on_base_plus_slugging"), Index(41)]
[Name("OPS"), Index(31)]
public double OnBasePlusSlugging => OnBasePercentage + SluggingPercentage;

[Name("batting_average"), Index(42)]
public double BattingAverage => Hits / (double) AtBats;

[Name("babip"), Index(43)]
[Name("ISO"), Index(32)]
public double IsolatedPower => SluggingPercentage - BattingAverage;
[Name("BABIP"), Index(33)]
public double BattingAverageOnBallsInPlay =>
(Hits - HomeRuns) / (double) (AtBats - Strikeouts - HomeRuns + SacrificeFlies);

[Name("at_bats_per_home_run"), Index(44)]
[Name("Sac Hits"), Index(34)]
public int SacrificeHits { get; set; }

[Name("Sac Flies"), Index(35)]
public int SacrificeFlies { get; set; }

[Name("Errors"), Index(36)]
public int Errors { get; set; }

[Name("Passed Balls"), Index(37)]
public int PassedBalls { get; set; }

[Name("PA/Game"), Index(38)]
public double PlateAppearancesPerGame => PlateAppearances / (double) GamesPlayed;

[Name("AB/HR"), Index(39)]
public double AtBatsPerHomeRun => AtBats / (double) HomeRuns;

[Name("strikeout_percentage"), Index(45)]
[Name("K%"), Index(40)]
public double StrikeoutPercentage => Strikeouts / (double) AtBats;

[Name("walk_percentage"), Index(46)]
[Name("BB%"), Index(41)]
public double WalkPercentage => Walks / (double) PlateAppearances;

[Name("extra_base_hit_percentage"), Index(47)]
[Name("XBH%"), Index(42)]
public double ExtraBaseHitPercentage => ExtraBaseHits / (double) Hits;
}
101 changes: 53 additions & 48 deletions SMB3Explorer/Models/Exports/CareerPitchingStatistic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,106 +9,111 @@ namespace SMB3Explorer.Models.Exports;

public class CareerPitchingStatistic : CareerStatistic
{
[Name("pitcher_role"), Index(10)]
[Ignore]
public int PitcherRole { get; set; }

[Name("pitcher_role_name"), Index(11)]
[Name("Pitcher Role"), Index(7)]
// ReSharper disable once UnusedMember.Global
public string PitcherRoleDescription => ((PitcherRole) PitcherRole).GetEnumDescription();

[Name("wins"), Index(12)]
[Name("W"), Index(8)]
public int Wins { get; set; }

[Name("losses"), Index(13)]
[Name("L"), Index(9)]
public int Losses { get; set; }

[Name("games_played"), Index(14)]
public int GamesPlayed { get; set; }

[Name("games_started"), Index(15)]
public int GamesStarted { get; set; }

[Name("total_pitches"), Index(16)]
public int TotalPitches { get; set; }

[Name("complete_games"), Index(17)]

[Name("CG"), Index(10)]
public int CompleteGames { get; set; }

[Name("shutouts"), Index(18)]
[Name("CGSO"), Index(11)]
public int Shutouts { get; set; }

[Name("saves"), Index(19)]
public int Saves { get; set; }

[Name("outs_pitched"), Index(20)]

[Ignore]
public int OutsPitched { get; set; }

[Name("hits_allowed"), Index(21)]
[Name("H"), Index(12)]
public int HitsAllowed { get; set; }

[Name("earned_runs"), Index(22)]
[Name("ER"), Index(13)]
public int EarnedRuns { get; set; }

[Name("home_runs_allowed"), Index(23)]
[Name("HR"), Index(14)]
public int HomeRunsAllowed { get; set; }

[Name("walks_allowed"), Index(24)]
[Name("BB"), Index(15)]
public int WalksAllowed { get; set; }

[Name("strikeouts"), Index(25)]
[Name("K"), Index(16)]
public int Strikeouts { get; set; }

[Name("hit_by_pitch"), Index(26)]
[Name("IP"), Index(17)]
public double InningsPitched => OutsPitched / 3.0;

[Name("ERA"), Index(18)]
public double EarnedRunAverage => EarnedRuns / InningsPitched;

[Name("TP"), Index(19)]
public int TotalPitches { get; set; }

[Name("SV"), Index(20)]
public int Saves { get; set; }

[Name("HBP"), Index(21)]
public int HitByPitch { get; set; }

[Name("batters_faced"), Index(27)]
[Name("Batters Faced"), Index(22)]
public int BattersFaced { get; set; }

[Name("games_finished"), Index(28)]
[Name("Games Played"), Index(23)]
public int GamesPlayed { get; set; }

[Name("Games Started"), Index(24)]
public int GamesStarted { get; set; }

[Name("Games Finished"), Index(25)]
public int GamesFinished { get; set; }

[Name("runs_allowed"), Index(29)]
[Name("Runs Allowed"), Index(26)]
public int RunsAllowed { get; set; }

[Name("wild_pitches"), Index(30)]
[Name("WP"), Index(27)]
public int WildPitches { get; set; }

[Name("innings_pitched"), Index(31)]
public double InningsPitched => OutsPitched / 3.0;

[Name("era"), Index(32)]
public double EarnedRunAverage => EarnedRuns / InningsPitched;

[Name("batting_average_against"), Index(33)]
[Name("BAA"), Index(28)]
public double BattingAverageAgainst => HitsAllowed / (double) BattersFaced;

[Name("FIP"), Index(29)]
public double FieldingIndependentPitching =>
(((13 * HomeRunsAllowed) + (3 * (WalksAllowed + HitByPitch)) -
(2 * Strikeouts)) / (double) OutsPitched) + 3.10;

[Name("whip"), Index(34)]
[Name("WHIP"), Index(30)]
public double WalksAndHitsPerInning => (WalksAllowed + HitsAllowed) / InningsPitched;

[Name("win_percentage"), Index(35)]
[Name("WPCT"), Index(31)]
public double WinPercentage => Wins / (double) (Wins + Losses);

[Name("opponent_on_base_percentage"), Index(36)]
[Name("Opp OBP"), Index(32)]
public double OpponentOnBasePercentage => (HitsAllowed + WalksAllowed + HitByPitch) / (double) BattersFaced;

[Name("strikeout_to_walk_ratio"), Index(37)]
[Name("K/BB"), Index(33)]
public double StrikeoutToWalkRatio => Strikeouts / (double) WalksAllowed;

[Name("strikeouts_per_nine_innings"), Index(38)]
[Name("K/9"), Index(34)]
public double StrikeoutsPerNineInnings => Strikeouts / (InningsPitched / 9.0);

[Name("walks_per_nine_innings"), Index(39)]
[Name("BB/9"), Index(35)]
public double WalksPerNineInnings => WalksAllowed / (InningsPitched / 9.0);

[Name("hits_per_nine_innings"), Index(40)]
[Name("H/9"), Index(36)]
public double HitsPerNineInnings => HitsAllowed / (InningsPitched / 9.0);

[Name("home_runs_per_nine_innings"), Index(41)]
[Name("HR/9"), Index(37)]
public double HomeRunsPerNineInnings => HomeRunsAllowed / (InningsPitched / 9.0);

[Name("pitches_per_inning"), Index(42)]
[Name("Pitches Per Inning"), Index(38)]
public double PitchesPerInning => TotalPitches / InningsPitched;

[Name("pitches_per_game"), Index(43)]
[Name("Pitches Per Game"), Index(39)]
public double PitchesPerGame => TotalPitches / (double) GamesPlayed;
}
30 changes: 15 additions & 15 deletions SMB3Explorer/Models/Exports/CareerStatistic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,33 +8,33 @@ namespace SMB3Explorer.Models.Exports;

public class CareerStatistic
{
[Name("aggregator_id"), Index(0)]
[Ignore]
public int AggregatorId { get; set; }

[Name("stats_player_id"), Index(1)]
[Ignore]
public int StatsPlayerId { get; set; }

[Name("player_id"), Index(2)]
[Ignore]
public Guid? PlayerId { get; set; }

[Name("current_team"), Index(3)]
[Name("First Name"), Index(0)]
public string FirstName { get; set; } = string.Empty;

[Name("Last Name"), Index(1)]
public string LastName { get; set; } = string.Empty;

[Name("Team"), Index(2)]
public string? CurrentTeam { get; set; }

[Name("most_recent_team"), Index(4)]
[Name("Prev Team"), Index(3)]
public string? MostRecentTeam { get; set; }

[Name("second_most_recent_team"), Index(5)]
[Name("2nd Prev Team"), Index(4)]
public string? SecondMostRecentTeam { get; set; }

[Name("first_name"), Index(6)]
public string FirstName { get; set; } = string.Empty;

[Name("last_name"), Index(7)]
public string LastName { get; set; } = string.Empty;

[Name("retirement_season"), Index(8)]

[Name("Retirement Season"), Index(5)]
public int? RetirementSeason { get; set; }

[Name("age"), Index(9)]
[Name("Age"), Index(6)]
public int Age { get; set; }
}
Loading