fCraft.ChatCommands.RollHandler C# (CSharp) Method

RollHandler() private static method

private static RollHandler ( Player player, Command cmd ) : void
player Player
cmd Command
return void
        private static void RollHandler( Player player, Command cmd )
        {
            if ( player.Info.IsMuted ) {
                player.MessageMuted();
                return;
            }

            if ( player.DetectChatSpam() )
                return;

            Random rand = new Random();
            int n1;
            int min, max;
            if ( cmd.NextInt( out n1 ) ) {
                int n2;
                if ( !cmd.NextInt( out n2 ) ) {
                    n2 = 1;
                }
                min = Math.Min( n1, n2 );
                max = Math.Max( n1, n2 );
            } else {
                min = 1;
                max = 100;
            }

            int num = rand.Next( min, max + 1 );
            Server.Message( player,
                            "{0}{1} rolled {2} ({3}...{4})",
                            player.ClassyName, Color.Silver, num, min, max );
            player.Message( "{0}You rolled {1} ({2}...{3})",
                            Color.Silver, num, min, max );
        }