static void HandleTime(string userNick, string name)
{
if (name == null)
{
IRC.SendChannelMessage("Server has been up for: " + Bold + DateTime.UtcNow.Subtract(Server.StartTime).ToMiniString());
return;
}
PlayerInfo info = PlayerDB.FindPlayerInfoExact(name);
if (info == null)
{
IRC.SendChannelMessage("No player found with name \"" + Bold + name + Reset + "\"");
return;
}
if (info.IsOnline)
{
TimeSpan idle = info.PlayerObject.IdleTime;
IRC.SendChannelMessage("Player " + Bold + "{0}" + Reset + " has spent a total of: " + Bold + "{1:F1}" + Reset +
" hours (" + Bold + "{2:F1}" + Reset + " hours this session{3}",
info.ClassyName, (info.TotalTime + info.TimeSinceLastLogin).TotalHours,
info.TimeSinceLastLogin.TotalHours,
idle > TimeSpan.FromMinutes(1) ? ", been idle for " + Bold +
string.Format("{0:F2}", idle.TotalMinutes) + Reset + " minutes)" : ")");
}
else
{
IRC.SendChannelMessage("Player " + Bold + "{0}" + Reset + " has spent a total of: "
+ Bold + "{1:F1}" + Reset + " hours",
info.ClassyName, info.TotalTime.TotalHours);
}
}