private static void WhoIsHandler( Player player, Command cmd )
{
string Name = cmd.Next();
if ( string.IsNullOrEmpty( Name ) ) {
CdWhoIs.PrintUsage( player );
return;
}
Name = Color.StripColors( Name.ToLower() );
PlayerInfo[] Names = PlayerDB.PlayerInfoList.Where( p => p.DisplayedName != null &&
Color.StripColors( p.DisplayedName.ToLower() ).Contains( Name ) )
.ToArray();
Array.Sort( Names, new PlayerInfoComparer( player ) );
if ( Names.Length < 1 ) {
player.Message( "&WNo results found with that DisplayedName" );
return;
}
if ( Names.Length == 1 ) {
player.Message( "One player found with that DisplayedName: {0}", Names[0].Rank.Color + Names[0].Name );
return;
}
if ( Names.Length <= 15 ) {
MessageManyMatches( player, Names );
} else {
int offset;
if ( !cmd.NextInt( out offset ) )
offset = 0;
if ( offset >= Names.Length )
offset = Math.Max( 0, Names.Length - 15 );
PlayerInfo[] Part = Names.Skip( offset ).Take( 15 ).ToArray();
MessageManyMatches( player, Part );
if ( offset + Part.Length < Names.Length ) {
player.Message( "Showing {0}-{1} (out of {2}). Next: &H/Whois {3} {4}",
offset + 1, offset + Part.Length, Names.Length,
Name, offset + Part.Length );
} else {
player.Message( "Showing matches {0}-{1} (out of {2}).",
offset + 1, offset + Part.Length, Names.Length );
}
}
}