public ChannelState CalculateChannelState()
{
// Just in case this gets called
if (this.ShuttingDown)
return ChannelState.Maintenance;
var current = this.World.CountPlayers();
var max = this.Conf.Channel.MaxUsers;
if (max == 0)
{
Log.Warning("Max user count was zero, falling back to Normal.");
// Fallback value
return ChannelState.Normal;
}
double stress = (current / max) * 100;
if (stress >= 40 && stress <= 70)
return ChannelState.Busy;
if (stress > 70 && stress <= 95)
return ChannelState.Full;
if (stress > 95)
return ChannelState.Bursting;
return ChannelState.Normal;
}