public static int HitCount(this IPlayerResult player) { Contract.Requires <ArgumentNullException>(player != null); if (player.HitTimes == null) { return(0); } return(player.HitTimes.Count()); }
public static int Dora(this IPlayerResult player) { Contract.Requires <ArgumentNullException>(player != null); if (player.KillTimes == null || player.DieTimes == null) { return(0); } return(player.KillTimes.Count() - player.DieTimes.Count()); }
public static double HitRate(this IPlayerResult player) { Contract.Requires <ArgumentNullException>(player != null); if (player.HitTimes == null || player.ShotTimes == null) { return(0); } return(Math.Round(((double)player.HitTimes.Count() / (double)player.ShotTimes.Count() * 100), 1)); }
public static string RawName(this IPlayerResult player) { Contract.Requires <ArgumentNullException>(player != null); Contract.Ensures(Contract.Result <string>() != null); if (player.Name == null) { return(""); } string name = player.Name; var match = rawNameRegex.Match(name); if (match.Success) { name = match.Groups[1].ToString(); } return(name); }