IW4M-Admin/Admin/TrueSkill.cs
RaidMax c3bf5bf33a Been a while -- unstable 0.75
-added mask command
-added baninfo command
-added alias command and removed redundant output from `find`
-added rcon command
-added webfront (http://127.0.0.1:1624)
-true skill is officially implemented
-find now shows last connect time
-noise on pm (if gsc_enabled)
-force 8 line chat height (if gsc_enabled)
-tell admins the number of reports on join
-enhanced ban tracking
-ip wait timeout added
-remove report on ban
-can't report yourself
-remove reported players when banned
-fixed rare crash with toadmins backend
-fixed crash when finding player stats that don't exist
-fixed a bug that caused owner command to reactivate only `creator` rank player existed
-fixed a bug that caused certain notifications to be sent to all players
2015-04-09 23:02:12 -05:00

38 lines
1.1 KiB
C#

using System;
using System.Collections.Generic;
using System.Text;
using Moserware.Skills.TrueSkill;
using IW4MAdmin;
namespace Moserware
{
class TrueSkill
{
public TrueSkill()
{
calculator = new TwoPlayerTrueSkillCalculator();
gInfo = Skills.GameInfo.DefaultGameInfo;
}
public void updateNewSkill(Player P1, Player P2)
{
var player1 = new Skills.Player(P1.getDBID());
var player2 = new Skills.Player(P2.getDBID());
var team1 = new Skills.Team(player1, P1.stats.Rating);
var team2 = new Skills.Team(player2, P2.stats.Rating);
var newRatings = calculator.CalculateNewRatings(gInfo, Skills.Teams.Concat(team1, team2), 1, 2);
P1.stats.Rating = newRatings[player1];
P2.stats.Rating = newRatings[player2];
P1.stats.Skill = Math.Round(P1.stats.Rating.ConservativeRating, 3)*10;
P2.stats.Skill = Math.Round(P2.stats.Rating.ConservativeRating, 3)*10;
}
private Skills.SkillCalculator calculator;
public Skills.GameInfo gInfo;
}
}