Skip to content

Commit

Permalink
tweak formula
Browse files Browse the repository at this point in the history
  • Loading branch information
kidfearless committed Jan 1, 2021
1 parent af34b44 commit 85ab854
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 13 deletions.
1 change: 1 addition & 0 deletions Models/User.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ public async void GetProfileData()
this.Profile = await Steam.GetProfileDataAsync(url);
this.ProfileRetreived?.Invoke(this, this.Profile);
}
// sometimes it just fails for no reason. so we just try again.
catch
{
try
Expand Down
40 changes: 27 additions & 13 deletions Views/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -615,20 +615,32 @@ Color GetBackgroundColor(User user)
}
var difference = DateTime.Now - memberSince;

var memberThreat = 5 - (difference.TotalDays / 365);
threatLevel += (int)Math.Clamp(memberThreat, 0, 10);
var months = difference.TotalDays / 30;
var years = difference.TotalDays / 365;
double threat = 0;
if(years < 2)
{
threat = (24 - months) / 2.4;
}

user.UI.ThreatLevel.Text += $"age: {(int)threat} ";
threatLevel += (int)Math.Clamp(threat, 0, 10);
}
else
{
threatLevel += 2;
user.UI.ThreatLevel.Text += $"age: N/A ";

}

if (user.Profile.mostPlayedGames is not null && user.Profile.mostPlayedGames.mostPlayedGame is not null)
{
var game = user.Profile.mostPlayedGames.MostPlayedGames.FirstOrDefault(t => t.gameName == "Counter-Strike: Global Offensive");
if (game is not null)
{
var timeThreat = 10 - (Convert.ToDouble(game.hoursOnRecord) / 100);
var timeThreat = Math.Round(10 - (Convert.ToDouble(game.hoursOnRecord) / 100));
user.UI.ThreatLevel.Text += $"time: {(int)timeThreat} ";

threatLevel += (int)Math.Clamp(timeThreat, 0, 10);
}
}
Expand All @@ -641,6 +653,8 @@ Color GetBackgroundColor(User user)
// only shows 1, 0, or null
if (user.Profile.vacBanned == "1")
{
user.UI.ThreatLevel.Text += $"vac: 5 ";

threatLevel += 5;
}
}
Expand All @@ -654,24 +668,24 @@ Color GetBackgroundColor(User user)
return threatLevel switch
{
1 =>
Color.FromArgb(25, 100, 100, 225),
Color.FromArgb(20, 100, 100, 225),
2 =>
Color.FromArgb(25, 100, 100, 200),
Color.FromArgb(30, 100, 100, 200),
3 =>
Color.FromArgb(25, 100, 100, 175),
Color.FromArgb(40, 100, 100, 175),
4 =>
Color.FromArgb(25, 100, 100, 150),
Color.FromArgb(50, 100, 100, 150),
5 =>
Color.FromArgb(25, 100, 100, 125),
Color.FromArgb(60, 100, 100, 125),
6 =>
Color.FromArgb(25, 100, 100, 100),
Color.FromArgb(70, 100, 100, 100),
7 =>
Color.FromArgb(25, 100, 100, 75),
Color.FromArgb(80, 100, 100, 75),
8 =>
Color.FromArgb(25, 100, 100, 50),
Color.FromArgb(90, 100, 100, 50),
9 =>
Color.FromArgb(25, 100, 100, 25),
10 => Color.FromArgb(25, 0, 100, 255),
Color.FromArgb(100, 100, 100, 25),
10 => Color.FromArgb(100, 255, 255, 0),
_ => Color.FromArgb(0, 0, 0, 0),
};
}
Expand Down

0 comments on commit 85ab854

Please sign in to comment.