Просмотр исходного кода

New feature added: Most shouting people.
Stats about the ones who forgot to unraise theis caps-lock
so that they wrote UPPERCASE

doomshammer 25 лет назад
Родитель
Сommit
18fbddfe0e
1 измененных файлов с 44 добавлено и 1 удалено
  1. 44 1
      pisg.pl

+ 44 - 1
pisg.pl

@@ -101,7 +101,7 @@ $normalline, $actionline, $thirdline, @ignore, $line, $processtime, @topics,
 %smile, $nicks, %longlines, %mono, %times, %question, %loud, $totallength,
 %smile, $nicks, %longlines, %mono, %times, %question, %loud, $totallength,
 %gaveop, %tookop, %joins, %actions, %sayings, %wordcount, %lastused, %gotban,
 %gaveop, %tookop, %joins, %actions, %sayings, %wordcount, %lastused, %gotban,
 %setban, %foul, $days, $oldtime, $lastline, $actions, $normals, %userpics,
 %setban, %foul, $days, $oldtime, $lastline, $actions, $normals, %userpics,
-%userlinks, %T, $repeated, $lastnormal, $foulwords);
+%userlinks, %T, $repeated, $lastnormal, $foulwords, %shout, %spercent);
 
 
 sub main
 sub main
 {
 {
@@ -394,6 +394,9 @@ sub parse_file
                     $loud{$nick}++
                     $loud{$nick}++
                         if ($saying =~ /!/);
                         if ($saying =~ /!/);
 
 
+					$shout{$nick}++
+						if ($saying =~ /[A-Z]+/ and $saying !~ /[a-z0-9:]/);
+
                     $foul{$nick}++
                     $foul{$nick}++
                         if ($saying =~ /$foulwords/);
                         if ($saying =~ /$foulwords/);
 
 
@@ -909,6 +912,7 @@ sub create_html
     html("<table width=\"614\">\n"); # Needed for sections
     html("<table width=\"614\">\n"); # Needed for sections
     questions();
     questions();
     loudpeople();
     loudpeople();
+	shoutpeople();
     mostsmiles();
     mostsmiles();
     mostsad();
     mostsad();
     longlines();
     longlines();
@@ -1259,6 +1263,45 @@ sub loudpeople
 
 
 }
 }
 
 
+sub shoutpeople
+{
+    # The ones who speak SHOUTED!
+
+    foreach my $nick (sort keys %shout) {
+        if ($line{$nick} > 100) {
+            $spercent{$nick} = ($shout{$nick} / $line{$nick}) * 100;
+            $spercent{$nick} =~ s/(\.\d)\d+/$1/;
+        }
+    }
+
+    my @shout = sort { $spercent{$b} <=> $spercent{$a} } keys %spercent;
+
+    if (@shout) {
+        my %hash = (
+            nick => $shout[0],
+            per => $spercent{$shout[0]}
+        );
+
+        my $text = template_text('shout1', %hash);
+        html("<tr><td bgcolor=\"$conf->{hicell}\">$text");
+        if (@shout >= 2) {
+            my %hash = (
+                nick => $shout[1],
+                per => $spercent{$shout[1]}
+            );
+
+            my $text = template_text('shout2', %hash);
+            html("<br><span class=\"small\">$text</span>");
+        }
+        html("</td></tr>");
+
+    } else {
+        my $text = template_text('shout3');
+        html("<tr><td bgcolor=\"$conf->{hicell}\">$text</td></tr>");
+    }
+
+}
+
 sub gotkicks
 sub gotkicks
 {
 {
     # The persons who got kicked the most
     # The persons who got kicked the most