IW4M-Admin/Plugins/SimpleStats/Models/EFClientStatistics.cs
RaidMax 9db8ad80ef fixed bug with lifetime hit ratio causing erroneous ban
ip lookup on profile shows error if failed
truncate chat messages over 50 characters
removed html raw on client messages :c
show client rank colors on server overview if authorized
break long messages on profile page
prevent masked status showing up to non privileged users in webfront
2018-03-28 22:01:09 -05:00

65 lines
1.9 KiB
C#

using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SharedLibrary.Database.Models;
namespace StatsPlugin.Models
{
public class EFClientStatistics : SharedEntity
{
[Key, Column(Order = 0)]
public int ClientId { get; set; }
[ForeignKey("ClientId")]
public virtual EFClient Client { get; set; }
[Key, Column(Order = 1)]
public int ServerId { get; set; }
[ForeignKey("ServerId")]
public virtual EFServer Server { get; set; }
[Required]
public int Kills { get; set; }
[Required]
public int Deaths { get; set; }
public virtual ICollection<EFHitLocationCount> HitLocations { get; set; }
[NotMapped]
public double KDR
{
get => Deaths == 0 ? Kills : Math.Round(Kills / (double)Deaths, 2);
}
[Required]
public double SPM { get; set; }
[Required]
public double Skill { get; set; }
[Required]
public int TimePlayed { get; set; }
[NotMapped]
public float AverageHitOffset
{
get => (float)Math.Round(HitLocations.Sum(c => c.HitOffsetAverage) / Math.Max(1, HitLocations.Where(c => c.HitOffsetAverage > 0).Count()), 4);
}
[NotMapped]
public int SessionKills { get; set; }
[NotMapped]
public int SessionDeaths { get; set; }
[NotMapped]
public int KillStreak { get; set; }
[NotMapped]
public int DeathStreak { get; set; }
[NotMapped]
public DateTime LastStatCalculation { get; set; }
[NotMapped]
public int LastScore { get; set; }
[NotMapped]
public DateTime LastActive { get; set; }
[NotMapped]
public int SessionScore { get; set; }
}
}