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

Halfop statistics by crazycat.

Morten Brix Pedersen 24 лет назад
Родитель
Сommit
a58c914542
6 измененных файлов с 120 добавлено и 2 удалено
  1. 2 1
      docs/Changelog
  2. 36 0
      docs/pisg-doc.sgml
  3. 16 0
      lang.txt
  4. 1 0
      modules/Pisg.pm
  5. 60 0
      modules/Pisg/HTMLGenerator.pm
  6. 5 1
      modules/Pisg/Parser/Logfile.pm

+ 2 - 1
docs/Changelog

@@ -4,7 +4,8 @@ pisg (x.xx)
    * RacBot logfile support added (thanks, Hanno Hecker)
    * RacBot logfile support added (thanks, Hanno Hecker)
    * kvirc logfile support added (thanks, wwp)
    * kvirc logfile support added (thanks, wwp)
    * Correct pircbot.pm to work with !channel, &channel and +channel in 
    * Correct pircbot.pm to work with !channel, &channel and +channel in 
-     addition to #channel (Hanno Hecker)
+     addition to #channel (thanks, Hanno Hecker)
+   * Half-op statistics (+h), enabled by ShowHalfops. (thanks, crazycat)
 
 
 pisg (0.39) - Tue May, 14th 2002
 pisg (0.39) - Tue May, 14th 2002
    * ShowFoulLine option added (thanks, Adam Spiers <adam@spiers.net>).
    * ShowFoulLine option added (thanks, Adam Spiers <adam@spiers.net>).

+ 36 - 0
docs/pisg-doc.sgml

@@ -1610,6 +1610,42 @@
     </refsect1>
     </refsect1>
     </refentry>
     </refentry>
 
 
+    <!-- *** SHOWVOICES *** -->
+    <refentry id="ShowHalfops">
+
+    <refmeta> <refentrytitle>ShowHalfops</refentrytitle> </refmeta>
+
+    <refnamediv>
+    <refname>ShowHalfops</refname>
+    <refpurpose>enable or disable halfop statistics</refpurpose>
+    </refnamediv>
+
+    <refsynopsisdiv><programlisting>
+      <![CDATA[
+        <channel="#channel">
+         Logfile = "channel.log"
+         Format = "xchat"
+         ShowHalfops = "0"
+        </channel>
+
+        <set ShowHalfops="1">
+      ]]>
+    </programlisting></refsynopsisdiv>
+
+    <refsect1>
+    <title>Description</title>
+    <para>
+    By default, pisg doesn't have halfop statistics (+h on some servers)
+    like it has op statistics. Enabling this option will add a section to
+    the "Most interesting numbers" displaying who gave most half-ops.
+    </para>
+    </refsect1>
+    <refsect1>
+    <title>Default</title>
+    <para> 0 (disabled) </para>
+    </refsect1>
+    </refentry>
+
     <!-- *** SHOWMOSTNICKS *** -->
     <!-- *** SHOWMOSTNICKS *** -->
     <refentry id="ShowMostNicks">
     <refentry id="ShowMostNicks">
 
 

+ 16 - 0
lang.txt

@@ -46,6 +46,14 @@ mostdevoice1 = "<b>[:nick]</b> likes taking voice from people, [:devoices] devoi
 mostdevoice2 = "<b>[:nick]</b> was close to the same, devoiced [:devoices] users."
 mostdevoice2 = "<b>[:nick]</b> was close to the same, devoiced [:devoices] users."
 mostdevoice3 = "No voices was taken on [:channel]!"
 mostdevoice3 = "No voices was taken on [:channel]!"
 
 
+mosthalfop1 = "<b>[:nick]</b> donated [:halfops] halfops in the channel..."
+mosthalfop2 = "<b>[:nick]</b> was also very polite: [:halfops] halfops from [:him:her:]."
+mosthalfop3 = "Strange, no halfop was given on [:channel]!"
+
+mostdehalfop1 = "<b>[:nick]</b> is the channel sheriff with [:dehalfops] dehalfops."
+mostdehalfop2 = "<b>[:nick]</b> dehalfoped [:dehalfops] users."
+mostdehalfop3 = "Wow, no halfop was taken on [:channel]!"
+
 action1 = "<b>[:nick]</b> always lets us know what [:he:she:]'s doing: [:actions] actions!"
 action1 = "<b>[:nick]</b> always lets us know what [:he:she:]'s doing: [:actions] actions!"
 action2 = "Also, <b>[:nick]</b> tells us what's up with [:actions] actions."
 action2 = "Also, <b>[:nick]</b> tells us what's up with [:actions] actions."
 action3 = "No actions in [:channel]!"
 action3 = "No actions in [:channel]!"
@@ -469,6 +477,14 @@ mostdeop1 = "<b>[:nick]</b> est le sh
 mostdeop2 = "<b>[:nick]</b> a deopé [:deops] utilisateurs."
 mostdeop2 = "<b>[:nick]</b> a deopé [:deops] utilisateurs."
 mostdeop3 = "Wow, aucun op n'a été retiré sur [:channel]!"
 mostdeop3 = "Wow, aucun op n'a été retiré sur [:channel]!"
 
 
+mosthalfop1 = "<b>[:nick]</b> a donné [:halfops] halfops sur le canal..."
+mosthalfop2 = "<b>[:nick]</b> est aussi très poli : [:halfops] halfops de sa part."
+mosthalfop3 = "Etrange, aucun halfop n'a été donné sur [:channel]!"
+
+mostdehalfop1 = "<b>[:nick]</b> est le shériff du canal avec [:dehalfops] dehalfops..."
+mostdehalfop2 = "<b>[:nick]</b> a dehalfopé [:dehalfops] utilisateurs."
+mostdehalfop3 = "Wow, aucun halfop n'a été retiré sur [:channel]!"
+
 mostvoice1 = "<b>[:nick]</b> a donné [:voices] fois le +v sur le canal..."
 mostvoice1 = "<b>[:nick]</b> a donné [:voices] fois le +v sur le canal..."
 mostvoice2 = "<b>[:nick]</b> est aussi très poli: [:voices] +v de sa part."
 mostvoice2 = "<b>[:nick]</b> est aussi très poli: [:voices] +v de sa part."
 mostvoice3 = "C'est curieux, on n'a jamais donné un seul +v sur [:channel]!"
 mostvoice3 = "C'est curieux, on n'a jamais donné un seul +v sur [:channel]!"

+ 1 - 0
modules/Pisg.pm

@@ -153,6 +153,7 @@ sub get_default_config_settings
         showmrn => 1,
         showmrn => 1,
         showmru => 1,
         showmru => 1,
         showvoices => 0,
         showvoices => 0,
+        showhalfops => 0,
         showmostnicks => 0,
         showmostnicks => 0,
         showmostactivebyhour => 0,
         showmostactivebyhour => 0,
         showmostactivebyhourgraph => 0,
         showmostactivebyhourgraph => 0,

+ 60 - 0
modules/Pisg/HTMLGenerator.pm

@@ -109,6 +109,7 @@ sub create_html
         $self->_gotkicks();
         $self->_gotkicks();
         $self->_mostkicks();
         $self->_mostkicks();
         $self->_mostop();
         $self->_mostop();
+        $self->_mosthalfop() if $self->{cfg}->{showhalfops};
         $self->_mostvoice() if $self->{cfg}->{showvoices};
         $self->_mostvoice() if $self->{cfg}->{showvoices};
         $self->_mostactions();
         $self->_mostactions();
         $self->_mostmonologues();
         $self->_mostmonologues();
@@ -1201,6 +1202,65 @@ sub _mostvoice
 
 
 }
 }
 
 
+sub _mosthalfop
+{
+    my $self = shift;
+
+    my @halfops   = sort { $self->{stats}->{gavehalfops}{$b} <=> $self->{stats}->{gavehalfops}{$a} }
+                     keys %{ $self->{stats}->{gavehalfops} };
+    my @dehalfops = sort { $self->{stats}->{tookhalfops}{$b} <=> $self->{stats}->{tookhalfops}{$a} }
+                     keys %{ $self->{stats}->{tookhalfops} };
+
+    if (@halfops) {
+        my %hash = (
+            nick => $halfops[0],
+            halfops  => $self->{stats}->{gavehalfops}{$halfops[0]}
+        );
+
+        my $text = $self->_template_text('mosthalfop1', %hash);
+
+        _html("<tr><td class=\"hicell\">$text");
+
+        if (@halfops >= 2) {
+            my %hash = (
+                nick => $halfops[1],
+                halfops  => $self->{stats}->{gavehalfops}{$halfops[1]}
+            );
+
+            my $text = $self->_template_text('mosthalfop2', %hash);
+            _html("<br /><span class=\"small\">$text</span>");
+        }
+        _html("</td></tr>");
+    } else {
+        my $text = $self->_template_text('mosthalfop3');
+        _html("<tr><td class=\"hicell\">$text</td></tr>");
+    }
+
+    if (@dehalfops) {
+        my %hash = (
+            nick  => $dehalfops[0],
+            dehalfops => $self->{stats}->{tookhalfops}{$dehalfops[0]}
+        );
+        my $text = $self->_template_text('mostdehalfop1', %hash);
+
+        _html("<tr><td class=\"hicell\">$text");
+
+        if (@dehalfops >= 2) {
+            my %hash = (
+                nick  => $dehalfops[1],
+                dehalfops => $self->{stats}->{tookhalfops}{$dehalfops[1]}
+            );
+            my $text = $self->_template_text('mostdehalfop2', %hash);
+
+            _html("<br /><span class=\"small\">$text</span>");
+        }
+        _html("</td></tr>");
+    } else {
+        my $text = $self->_template_text('mostdehalfop3');
+        _html("<tr><td class=\"hicell\">$text</td></tr>");
+    }
+}
+
 sub _mostactions
 sub _mostactions
 {
 {
     # The person who did the most /me's
     # The person who did the most /me's

+ 5 - 1
modules/Pisg/Parser/Logfile.pm

@@ -429,10 +429,12 @@ sub _modechanges
     my $newmode = shift;
     my $newmode = shift;
     my $nick = shift;
     my $nick = shift;
 
 
-    my (@voice, @ops, $plus);
+    my (@voice, @halfops, @ops, $plus);
     foreach (split(//, $newmode)) {
     foreach (split(//, $newmode)) {
         if ($_ eq "o") {
         if ($_ eq "o") {
             $ops[$plus]++;
             $ops[$plus]++;
+        } elsif ($_ eq "h") {
+            $halfops[$plus]++;
         } elsif ($_ eq "v") {
         } elsif ($_ eq "v") {
             $voice[$plus]++;
             $voice[$plus]++;
         } elsif ($_ eq "+") {
         } elsif ($_ eq "+") {
@@ -443,6 +445,8 @@ sub _modechanges
     }
     }
     $stats->{gaveops}{$nick} += $ops[0] if $ops[0];
     $stats->{gaveops}{$nick} += $ops[0] if $ops[0];
     $stats->{tookops}{$nick} += $ops[1] if $ops[1];
     $stats->{tookops}{$nick} += $ops[1] if $ops[1];
+    $stats->{gavehalfops}{$nick} += $halfops[0] if $halfops[0];
+    $stats->{tookhalfops}{$nick} += $halfops[1] if $halfops[1];
     $stats->{gavevoice}{$nick} += $voice[0] if $voice[0];
     $stats->{gavevoice}{$nick} += $voice[0] if $voice[0];
     $stats->{tookvoice}{$nick} += $voice[1] if $voice[1];
     $stats->{tookvoice}{$nick} += $voice[1] if $voice[1];
 }
 }