public async Task <string> Execute() { var gameModeStats = await SeasonHelper.GetCurrentSeasonStatsForPlayer(this._playerName, PubgRegion.PCNorthAmerica, this._perspective, this._teamSize); if (gameModeStats == null) { return("error - no stats for active season"); } var statResult = StatHelper.GetStats(this._stat, gameModeStats); var message = string.Format(StatHelper.StatTypeFormatMap[this._stat], this._playerName, statResult); if (this._perspective.HasValue || this._teamSize.HasValue) { message += " in "; message += this._perspective.HasValue ? TypeHelper.PerspectiveToString(this._perspective) + " " : ""; message += this._teamSize.HasValue ? TypeHelper.TeamSizeToString(this._teamSize): ""; } return(message.Trim() + " this sesason"); }
public async Task <string> Execute() { var message = string.Format("Let's see how {0} and {1} compare:\n\n", this._player1, this._player2); var player1Stats = await SeasonHelper.GetCurrentSeasonStatsForPlayer(this._player1, PubgRegion.PCNorthAmerica, this._perspective, this._teamSize); var player2Stats = await SeasonHelper.GetCurrentSeasonStatsForPlayer(this._player2, PubgRegion.PCNorthAmerica, this._perspective, this._teamSize); foreach (StatType statType in Enum.GetValues(typeof(StatType))) { var player1statResult = StatHelper.GetStats(statType, player1Stats); var player1message = string.Format(StatHelper.StatTypeFormatMap[statType], this._player1, player1statResult); var player2statResult = StatHelper.GetStats(statType, player2Stats); var player2message = string.Format(StatHelper.StatTypeFormatMap[statType], this._player2, player2statResult); message += string.Format("{0}: {1} and {2}\n", statType.ToString(), player1message, player2message); } return(message); }