ModernUO/Projects/UOContent/Misc/LoginStats.cs
Kamron Batman 525cda5413
Cleanup & Fixes for .NET 5 (#309)
- [X] Fixes several bugs
- [X] Updates more ordinal issues
- [X] Cleans up the code a bit
- [X] Turns classes static that should have been
- [X] Changes TcpServer.Instances to a HashSet

Bumps release version
2020-11-15 10:03:50 -08:00

32 lines
923 B
C#

using Server.Network;
namespace Server.Misc
{
public static class LoginStats
{
public static void Initialize()
{
// Register our event handler
EventSink.Login += EventSink_Login;
}
private static void EventSink_Login(Mobile m)
{
var userCount = TcpServer.Instances.Count;
var itemCount = World.Items.Count;
var mobileCount = World.Mobiles.Count;
m.SendMessage(
"Welcome, {0}! There {1} currently {2} user{3} online, with {4} item{5} and {6} mobile{7} in the world.",
m.Name,
userCount == 1 ? "is" : "are",
userCount,
userCount == 1 ? "" : "s",
itemCount,
itemCount == 1 ? "" : "s",
mobileCount,
mobileCount == 1 ? "" : "s"
);
}
}
}