<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-gb">
	<link rel="self" type="application/atom+xml" href="https://forum.eggheads.org/app.php/feed/topic/17629" />

	<title>egghelp/eggheads community</title>
	<subtitle>Discussion of eggdrop bots, shell accounts and tcl scripts.</subtitle>
	<link href="https://forum.eggheads.org/index.php" />
	<updated>2010-07-25T11:19:00-04:00</updated>

	<author><name><![CDATA[egghelp/eggheads community]]></name></author>
	<id>https://forum.eggheads.org/app.php/feed/topic/17629</id>

		<entry>
		<author><name><![CDATA[JEAH]]></name></author>
		<updated>2010-07-25T11:19:00-04:00</updated>

		<published>2010-07-25T11:19:00-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=93665#p93665</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=93665#p93665"/>
		<title type="html"><![CDATA[Pisg Stats - by Morten Brix Pedersen]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=93665#p93665"><![CDATA[
I think your best bet for this kind of help is going to be on the PISG developer/user mailing list.<br><br>Check out <a href="https://lists.sourceforge.net/lists/listinfo/pisg-general" class="postlink">https://lists.sourceforge.net/lists/lis ... sg-general</a><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=11291">JEAH</a> — Sun Jul 25, 2010 11:19 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Football]]></name></author>
		<updated>2010-03-02T15:10:38-04:00</updated>

		<published>2010-03-02T15:10:38-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=92336#p92336</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=92336#p92336"/>
		<title type="html"><![CDATA[Pisg Stats - by Morten Brix Pedersen]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=92336#p92336"><![CDATA[
Hey, I`ve modified and trying to modify even more the Pisg Stats.<br>I`m trying to alter the 'Most Active Gender' to 'Most Active Supporters'<br>As can be seen in this link:<br><br><a href="http://www.eplonline.co.uk/chanstats/stats.html" class="postlink">http://www.eplonline.co.uk/chanstats/stats.html</a><br><br>I don't know how to add further 'genders' or in this case 'teams', and could use some help<br><br>You should notice that in this code, everywhere that was written "Male" I replaced it with "Man Utd"; "Female" was replaced with "Chelsea" and "Bots" were replaced with "Liverpool", please help me add another option, let's call it "Tottenham", and I could continue adding others from there..<br><br>The file I configured is HTMLgenerator.pm;<br><br><br>package Pisg::HTMLGenerator;<br><br># $Id: HTMLGenerator.pm,v 1.189 2007/09/07 23:17:23 df7cb Exp $<br>#<br># Copyright and license, as well as documentation(POD) for this module is<br># found at the end of the file.<br><br>use strict;<br>$^W = 1;<br><br># test for Text::Iconv<br>my $have_iconv = 1;<br>eval 'use Text::Iconv';<br>$have_iconv = 0 if $@;<br><br>sub new<br>{<br>    my $type = shift;<br>    my %args = @_;<br>    my $self = {<br>        cfg =&gt; $args{cfg},<br>        stats =&gt; $args{stats},<br>        users =&gt; $args{users},<br>        tmps =&gt; $args{tmps},<br>        topactive =&gt; {},<br>    };<br><br>    # Import common functions in Pisg::Common<br>    require Pisg::Common;<br>    Pisg::Common-&gt;import();<br><br>    bless($self, $type);<br>    return $self;<br>}<br><br>sub create_output<br>{<br>    # This subroutine calls all the subroutines which create their<br>    # individual stats. The name of the functions is somewhat saying - if<br>    # you don't understand it, most subs have a better explanation in the<br>    # sub itself.<br><br>    my $self = shift;<br>    $self-&gt;{cfg}-&gt;{lang} = shift;<br><br>    # save table width as multiplie files would just increase tablewidth<br>    my $tablewidth_original = $self-&gt;{cfg}-&gt;{tablewidth};<br>    <br>    # remove old iconv if it exist as it could mess up recode.<br>    delete $self-&gt;{iconv} if $self-&gt;{iconv};<br><br>    my $lang_charset = $self-&gt;{tmps}-&gt;{$self-&gt;{cfg}-&gt;{lang}}{lang_charset};<br>    if($lang_charset and $lang_charset ne $self-&gt;{cfg}-&gt;{charset}) {<br>        if($have_iconv) {<br>            # convert from template charset to our<br>            $self-&gt;{iconv} = Text::Iconv-&gt;new($lang_charset, $self-&gt;{cfg}-&gt;{charset});<br>        } else {<br>            print "Text::Iconv is not installed, skipping charset conversion of language templates\n"<br>                unless ($self-&gt;{cfg}-&gt;{silent});<br>        }<br>    }<br><br>    $self-&gt;_topactive();<br><br>    if($self-&gt;{cfg}-&gt;{bignumbersthreshold} =~ /^sqrt/) {<br>        $self-&gt;{cfg}-&gt;{bignumbersthreshold} = int(sqrt($self-&gt;{stats}-&gt;{topactive_lines}));<br>    }<br><br>    my $fname = $self-&gt;{cfg}-&gt;{outputfile};<br>    $fname =~ s/\%t/$self-&gt;{cfg}-&gt;{outputtag}/g;<br>    $fname =~ s/\%l/$self-&gt;{cfg}-&gt;{lang}/g;<br>    print "Now generating HTML ($self-&gt;{cfg}-&gt;{lang}) in $fname...\n"<br>        unless ($self-&gt;{cfg}-&gt;{silent});<br><br>    open (OUTPUT, "&gt; $fname") or<br>        die("$0: Unable to open outputfile($fname): $!\n");<br><br>    if ($self-&gt;{cfg}-&gt;{showlines}) {<br>        $self-&gt;{cfg}-&gt;{tablewidth} += 40;<br>    }<br>    if ($self-&gt;{cfg}-&gt;{showtime}) {<br>        $self-&gt;{cfg}-&gt;{tablewidth} += 40;<br>    }<br>    if ($self-&gt;{cfg}-&gt;{showlinetime}) {<br>        $self-&gt;{cfg}-&gt;{tablewidth} += 100;<br>    }<br>    if ($self-&gt;{cfg}-&gt;{showwordtime}) {<br>        $self-&gt;{cfg}-&gt;{tablewidth} += 100;<br>    }<br>    if ($self-&gt;{cfg}-&gt;{showwords}) {<br>        $self-&gt;{cfg}-&gt;{tablewidth} += 40;<br>    }<br>    if ($self-&gt;{cfg}-&gt;{showwpl}) {<br>        $self-&gt;{cfg}-&gt;{tablewidth} += 40;<br>    }<br>    if ($self-&gt;{cfg}-&gt;{showcpl}) {<br>        $self-&gt;{cfg}-&gt;{tablewidth} += 40;<br>    }<br>    if ($self-&gt;{cfg}-&gt;{userpics}) {<br>        $self-&gt;{cfg}-&gt;{tablewidth} += $self-&gt;{cfg}-&gt;{userpics} * ($self-&gt;{cfg}-&gt;{picwidth} || 60);<br>    }<br>    $self-&gt;{cfg}-&gt;{headwidth} = $self-&gt;{cfg}-&gt;{tablewidth} - 4;<br>    $self-&gt;_htmlheader();<br>    $self-&gt;_pageheader()<br>        if ($self-&gt;{cfg}-&gt;{pagehead} ne 'none');<br><br>    if ($self-&gt;{cfg}-&gt;{dailyactivity}) {<br>        $self-&gt;_activedays();<br>    }<br><br>    if ($self-&gt;{cfg}-&gt;{showactivetimes}) {<br>        $self-&gt;_activetimes();<br>    }<br><br>    if ($self-&gt;{cfg}-&gt;{showactivenicks}) {<br>        $self-&gt;_activenicks();<br>    }<br><br>    if ($self-&gt;{cfg}-&gt;{showmostactivebyhour}) {<br>        $self-&gt;_mostactivebyhour();<br>    }<br><br>    if ($self-&gt;{cfg}-&gt;{showbignumbers}) {<br>        $self-&gt;_headline($self-&gt;_template_text('bignumtopic'));<br>        _html("&lt;table width=\"$self-&gt;{cfg}-&gt;{tablewidth}\"&gt;"); # Needed for sections<br>        $self-&gt;_questions();<br>        $self-&gt;_shoutpeople();<br>        $self-&gt;_capspeople();<br>        $self-&gt;_violent();<br>        $self-&gt;_mostsmiles();<br>        $self-&gt;_mostsad();<br>        $self-&gt;_linelengths();<br>        $self-&gt;_mostwords();<br>        $self-&gt;_mostwordsperline();<br>        _html("&lt;/table&gt;"); # Needed for sections<br>    }<br><br>    if ($self-&gt;{cfg}-&gt;{showmostnicks}) {<br>        $self-&gt;_mostnicks();<br>    }<br><br>    if ($self-&gt;{cfg}-&gt;{showactivegenders}) {<br>        $self-&gt;_activegenders();<br>    }<br><br>    if ($self-&gt;{cfg}-&gt;{showmuw}) {<br>        $self-&gt;_mostusedword();<br>    }<br><br>    if ($self-&gt;{cfg}-&gt;{showmrn}) {<br>        $self-&gt;_mostreferencednicks();<br>    }<br><br>    if ($self-&gt;{cfg}-&gt;{showsmileys}) {<br>        $self-&gt;_smileys();<br>    }<br><br>    if ($self-&gt;{cfg}-&gt;{showkarma}) {<br>        $self-&gt;_karma();<br>    }<br><br>    if ($self-&gt;{cfg}-&gt;{showmru}) {<br>        $self-&gt;_mosturls();<br>    }<br><br>    if ($self-&gt;{cfg}-&gt;{showcharts}) {<br>        $self-&gt;_charts();<br>    }<br><br>    if ($self-&gt;{cfg}-&gt;{showbignumbers}) {<br>        $self-&gt;_headline($self-&gt;_template_text('othernumtopic'));<br>        _html("&lt;table width=\"$self-&gt;{cfg}-&gt;{tablewidth}\"&gt;"); # Needed for sections<br>        $self-&gt;_gotkicks();<br>        $self-&gt;_mostkicks();<br>        $self-&gt;_mostop() if $self-&gt;{cfg}-&gt;{showops};<br>        $self-&gt;_mosthalfop() if $self-&gt;{cfg}-&gt;{showhalfops};<br>        $self-&gt;_mostvoice() if $self-&gt;{cfg}-&gt;{showvoices};<br>        $self-&gt;_mostactions();<br>        $self-&gt;_mostmonologues();<br>        $self-&gt;_mostjoins();<br>        $self-&gt;_mostfoul();<br>        _html("&lt;/table&gt;"); # Needed for sections<br>    }<br><br>    if ($self-&gt;{cfg}-&gt;{showtopics}) {<br>        $self-&gt;_headline($self-&gt;_template_text('latesttopic'));<br>        _html("&lt;table width=\"$self-&gt;{cfg}-&gt;{tablewidth}\"&gt;"); # Needed for sections<br><br>        $self-&gt;_lasttopics();<br><br>        _html("&lt;/table&gt;"); # Needed for sections<br>    }<br><br>    my %hash = ( lines =&gt; $self-&gt;{stats}-&gt;{parsedlines} );<br>    _html($self-&gt;_template_text('totallines', %hash) . "&lt;br /&gt;&lt;br /&gt;");<br><br>    $self-&gt;_pagefooter()<br>        if ($self-&gt;{cfg}-&gt;{pagefoot} ne 'none');<br><br>    $self-&gt;_htmlfooter();<br><br>    close(OUTPUT);<br><br>    # restore tablewidth<br>    $self-&gt;{cfg}-&gt;{tablewidth} = $tablewidth_original;<br>}<br><br>sub _htmlheader<br>{<br>    my $self = shift;<br>    my %hash = (<br>        network    =&gt; $self-&gt;{cfg}-&gt;{network},<br>        maintainer =&gt; $self-&gt;{cfg}-&gt;{maintainer},<br>        days       =&gt; $self-&gt;{stats}-&gt;{days},<br>        nicks      =&gt; scalar keys %{ $self-&gt;{stats}-&gt;{lines} }<br>    );<br><br>    my $CSS;<br>    if($self-&gt;{cfg}-&gt;{colorscheme} =~ /([^\/.]+)\.[^\/]+$/) { # use external CSS file<br>        $CSS = "&lt;link rel=\"stylesheet\" type=\"text/css\" title=\"$1\" href=\"$self-&gt;{cfg}-&gt;{colorscheme}\" /&gt;";<br>    } elsif($self-&gt;{cfg}-&gt;{colorscheme} ne "none") { # read the chosen CSS file<br>        my $css_file = $self-&gt;{cfg}-&gt;{cssdir} . $self-&gt;{cfg}-&gt;{colorscheme} . ".css";<br>        open(FILE, $css_file) or open (FILE, $self-&gt;{cfg}-&gt;{search_path} . "/$css_file") or die("$0: Unable to open stylesheet $css_file: $!\n");<br>        {<br>            local $/; # enable "slurp" mode<br>            $CSS = "&lt;style type=\"text/css\" title=\"$self-&gt;{cfg}-&gt;{colorscheme}\"&gt;\n". &lt;FILE&gt;. "&lt;/style&gt;";<br>$CSS =~ s/\/\*/\/\* &lt;!--/g;<br>$CSS =~ s/\*\//--&gt; \*\//g;<br>        }<br>        close FILE;<br>    }<br><br>    # use alternate CSS file<br>    if($self-&gt;{cfg}-&gt;{altcolorscheme} ne "none" and $self-&gt;{cfg}-&gt;{altcolorscheme} =~ /[^\w]/) {<br>        foreach (split /\s+/, $self-&gt;{cfg}-&gt;{altcolorscheme}) {<br>            /([^\/.]+)\.[^\/]+$/;<br>            $CSS .= "\n&lt;link rel=\"alternate stylesheet\" type=\"text/css\" title=\"$1\" href=\"$_\" /&gt;";<br>        }<br>    }<br><br>    my $title = $self-&gt;_template_text('pagetitle1', %hash);<br>    if($self-&gt;{cfg}-&gt;{colorscheme} ne "none") {<br>        _html( &lt;&lt;HTML );<br>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "<a href="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" class="postlink">http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd</a>"&gt;<br>&lt;html&gt;<br>&lt;head&gt;<br>&lt;meta http-equiv="Content-Type" content="text/html; charset=$self-&gt;{cfg}-&gt;{charset}" /&gt;<br>&lt;title&gt;$title&lt;/title&gt;<br>$CSS<br>&lt;/head&gt;<br>&lt;body&gt;<br>&lt;div align="center"&gt;<br>HTML<br>    }<br>    _html("&lt;span class=\"title\"&gt;$title&lt;/span&gt;&lt;br /&gt;");<br>    _html("&lt;br /&gt;");<br>    _html($self-&gt;_template_text('pagetitle2', %hash) . " " . $self-&gt;get_time());<br><br>    _html("&lt;br /&gt;" . $self-&gt;_template_text('pagetitle3', %hash) . "&lt;br /&gt;&lt;br /&gt;");<br><br>}<br><br>sub get_time<br>{<br>    my $self = shift;<br>    my ($tday, %hash);<br><br>    my $month = $self-&gt;_template_text('month', %hash);<br>    my $day = $self-&gt;_template_text('day', %hash);<br><br>    my @month = split(" ", $month);<br>    my @day = split(" ", $day);<br><br>    # Get the Date from the users computer<br>    my $timezone = $self-&gt;{cfg}-&gt;{timeoffset} * 3600;<br>    my ($sec,$min,$hour,$mday,$mon,$year,$wday) = localtime(time+$timezone);<br><br>    $year += 1900;                    # Y2K Patch<br><br>    $min =~ s/^(.)$/0$1/;             # Fixes the display of mins/secs below<br>    $sec =~ s/^(.)$/0$1/;             # it displays 03 instead of 3<br><br>    if ($hour &gt; '23') {               # Checks to see if it Midnight<br>        $hour = 12;                   # Makes it display the hour 12<br>        $tday = "AM";                 # Display AM<br>    } elsif($hour &gt; '12') {           # Get rid of the Military time and<br>        $hour -= 12;                  # put it into normal time<br>        $tday = "PM";                 # If past Noon and before Midnight set<br>    } else {<br>        $tday = "AM";                 # If it's past Midnight and before Noon<br>    }                                 # set the time as AM<br><br>    # Use 24 hours pr. day<br>    if ($tday eq "PM" &amp;&amp; $hour &lt; '12') {<br>        $hour += 12;<br>    }<br><br>    return "$day[$wday] $mday $month[$mon] $year - $hour:$min:$sec";<br>}<br><br><br>sub _htmlfooter<br>{<br>    my $self = shift;<br><br>    my %hash;<br><br>    my $pisg_hp = $self-&gt;_template_text('pisghomepage');<br>    $hash{pisg_url} = "&lt;a href=\"<a href="http://pisg.sourceforge.net/" class="postlink">http://pisg.sourceforge.net/</a>\" title=\"$pisg_hp\" class=\"background\"&gt;pisg&lt;/a&gt;";<br><br>    my $author_hp = $self-&gt;_template_text('authorhomepage');<br>    $hash{author_url} = "&lt;a href=\"<a href="http://mbrix.dk/" class="postlink">http://mbrix.dk/</a>\" title=\"$author_hp\" class=\"background\"&gt;Morten Brix Pedersen&lt;/a&gt;";<br><br>    $hash{version} = $self-&gt;{cfg}-&gt;{version};<br><br>    my $hours = $self-&gt;_template_text('hours');<br>    my $mins = $self-&gt;_template_text('minutes');<br>    my $secs = $self-&gt;_template_text('seconds');<br>    my $and = $self-&gt;_template_text('and');<br><br>    my $h = $self-&gt;{stats}-&gt;{processtime}{hours};<br>    my $m = $self-&gt;{stats}-&gt;{processtime}{mins};<br>    my $s = $self-&gt;{stats}-&gt;{processtime}{secs};<br>    $hash{time} = "$h $hours $m $mins $and $s $secs";<br><br>    my $stats_gen = $self-&gt;_template_text('stats_gen_by', %hash);<br>    my $author_text = $self-&gt;_template_text('author', %hash);<br>    my $stats_text = $self-&gt;_template_text('stats_gen_in', %hash);<br><br>    _html( &lt;&lt;HTML );<br>&lt;span class="small"&gt;<br>$stats_gen&lt;br /&gt;<br>$author_text&lt;br /&gt;<br>$stats_text<br>&lt;/span&gt;<br>HTML<br><br>    _html( sprintf( qq(&lt;!-- NFiles = "%s"; Format = "%s"; Lang = "%s"; LangFile = "%s"; Charset = "%s"; LogCharset = "%s"; LogCharsetFallback = "%s"; LogPrefix = "%s"; LogSuffix = "%s"; NickTracking = "%s"; TimeOffset = "%s" --&gt;),<br>        $self-&gt;{cfg}-&gt;{nfiles},<br>        $self-&gt;{cfg}-&gt;{format},<br>        $self-&gt;{cfg}-&gt;{lang},<br>        $self-&gt;{cfg}-&gt;{langfile},<br>        $self-&gt;{cfg}-&gt;{charset},<br>        $self-&gt;{cfg}-&gt;{logcharset},<br>        $self-&gt;{cfg}-&gt;{logcharsetfallback},<br>        $self-&gt;{cfg}-&gt;{logprefix},<br>        $self-&gt;{cfg}-&gt;{logsuffix},<br>        $self-&gt;{cfg}-&gt;{nicktracking},<br>        $self-&gt;{cfg}-&gt;{timeoffset}<br>    ));<br>    <br>    if($self-&gt;{cfg}-&gt;{colorscheme} ne "none") {<br>        _html( &lt;&lt;HTML );<br>&lt;/div&gt;<br>&lt;/body&gt;<br>&lt;/html&gt;<br>HTML<br>    }<br>}<br><br>sub _headline<br>{<br>    my $self = shift;<br>    my ($title) = (@_);<br>    _html( &lt;&lt;HTML );<br>   &lt;br /&gt;<br>   &lt;table width="$self-&gt;{cfg}-&gt;{headwidth}" cellpadding="1" cellspacing="0" border="0"&gt;<br>    &lt;tr&gt;<br>     &lt;td class="headlinebg"&gt;<br>      &lt;table width="100%" cellpadding="2" cellspacing="0" border="0"&gt;<br>       &lt;tr&gt;<br>        &lt;td class="headtext"&gt;$title&lt;/td&gt;<br>       &lt;/tr&gt;<br>      &lt;/table&gt;<br>     &lt;/td&gt;<br>    &lt;/tr&gt;<br>   &lt;/table&gt;<br>HTML<br>}<br><br>sub _pageheader<br>{<br>    my $self = shift;<br>    unless(open(PAGEHEAD, $self-&gt;{cfg}-&gt;{pagehead})) {<br>        warn("$0: Unable to open $self-&gt;{cfg}-&gt;{pagehead} for reading: $!\n");<br>        return;<br>    }<br>    while (&lt;PAGEHEAD&gt;) {<br>        chomp;<br>        _html($_);<br>    }<br>    close(PAGEHEAD);<br>}<br><br>sub _pagefooter<br>{<br>    my $self = shift;<br>    unless(open(PAGEFOOT, $self-&gt;{cfg}-&gt;{pagefoot})) {<br>        warn("$0: Unable to open $self-&gt;{cfg}-&gt;{pagefoot} for reading: $!\n");<br>        return;<br>    }<br>    while (&lt;PAGEFOOT&gt;) {<br>        chomp;<br>        _html($_);<br>    }<br>    close(PAGEFOOT);<br>}<br><br>sub _activedays<br>{<br>    # The most actives days on the channel<br>    my $self = shift;<br>    my $days = $self-&gt;{stats}-&gt;{days};<br>    my $ndays = $self-&gt;{cfg}-&gt;{dailyactivity};<br><br>    my $highest_value = 1;<br>    for (my $day = $days; $day &gt; $days - $ndays ; $day--) {<br>        if (defined($self-&gt;{stats}-&gt;{day_lines}-&gt;[$day])) {<br>            if ($self-&gt;{stats}-&gt;{day_lines}-&gt;[$day] &gt; $highest_value) {<br>                $highest_value = $self-&gt;{stats}-&gt;{day_lines}-&gt;[$day];<br>            }<br>        } else {<br>            #there are only $days - $day days <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><br>            $ndays = $days - $day;<br>            last;<br>        }<br>    }<br><br>    my %hash = (<br>        n =&gt; $ndays<br>    );<br>    $self-&gt;_headline($self-&gt;_template_text('dailyactivitytopic', %hash));<br><br>    _html("&lt;table border=\"0\"&gt;&lt;tr&gt;");<br><br>    for (my $day = $days - $ndays + 1; $day &lt;= $days ; $day++) {<br>        my $lines = $self-&gt;{stats}-&gt;{day_lines}[$day];<br>        _html("&lt;td align=\"center\" valign=\"bottom\" class=\"asmall\"&gt;$lines&lt;br /&gt;");<br>        for (my $time = 4; $time &gt;= 0; $time--) {<br>            if (defined($self-&gt;{stats}-&gt;{day_times}[$day][$time])) {<br>                my $size = int(($self-&gt;{stats}-&gt;{day_times}[$day][$time] / $highest_value) * 100);<br><br>                my $image = "pic_v_".$time*6;<br>                $image = $self-&gt;{cfg}-&gt;{$image};<br>                _html("&lt;img src=\"$self-&gt;{cfg}-&gt;{piclocation}/$image\" width=\"15\" height=\"$size\" alt=\"$size\" title=\"$size\" /&gt;&lt;br /&gt;") if $size;<br><br>            }<br>        }<br>        _html("&lt;/td&gt;");<br>    }<br><br>    _html("&lt;/tr&gt;&lt;tr&gt;");<br><br>    for (my $day = $ndays - 1; $day &gt;= 0 ; $day--) {<br>        _html("&lt;td class=\"rankc10center\" align=\"center\"&gt;$day&lt;/td&gt;");<br>    }<br><br>    _html("&lt;/tr&gt;&lt;/table&gt;");<br><br>    if($self-&gt;{cfg}-&gt;{showlegend} == 1) {<br>        $self-&gt;_legend();<br>    }<br>}<br><br>sub _activetimes<br>{<br>    # The most actives times on the channel<br>    my $self = shift;<br><br>    my (%output);<br><br>    $self-&gt;_headline($self-&gt;_template_text('activetimestopic'));<br><br>    my @toptime = sort { $self-&gt;{stats}-&gt;{times}{$b} &lt;=&gt; $self-&gt;{stats}-&gt;{times}{$a} } keys %{ $self-&gt;{stats}-&gt;{times} };<br><br>    my $highest_value = $self-&gt;{stats}-&gt;{times}{$toptime[0]};<br><br>    for my $hour (sort keys %{ $self-&gt;{stats}-&gt;{times} }) {<br><br>        my $size = int(($self-&gt;{stats}-&gt;{times}{$hour} / $highest_value) * 100);<br>        my $percent = sprintf("%.1f", ($self-&gt;{stats}-&gt;{times}{$hour} / $self-&gt;{stats}-&gt;{parsedlines}) * 100);<br>        my $lines_per_hour = $self-&gt;{stats}-&gt;{times}{$hour};<br><br>        my $image = "pic_v_".(int($hour/6)*6);<br>        $image = $self-&gt;{cfg}-&gt;{$image};<br><br>        $output{$hour} = "&lt;td align=\"center\" valign=\"bottom\" class=\"asmall\"&gt;$percent%&lt;br /&gt;&lt;img src=\"$self-&gt;{cfg}-&gt;{piclocation}/$image\" width=\"15\" height=\"$size\" alt=\"$lines_per_hour\" title=\"$lines_per_hour\"/&gt;&lt;/td&gt;" if $size;<br>    }<br><br>    _html("&lt;table border=\"0\"&gt;&lt;tr&gt;");<br><br>    for ($b = 0; $b &lt; 24; $b++) {<br>        $a = sprintf("%02d", $b);<br><br>        if (!defined($output{$a})) {<br>            _html("&lt;td align=\"center\" valign=\"bottom\" class=\"asmall\"&gt;0%&lt;/td&gt;");<br>        } else {<br>            _html($output{$a});<br>        }<br>    }<br><br>    _html("&lt;/tr&gt;&lt;tr&gt;");<br><br>    # Remove leading zero<br>    $toptime[0] =~ s/^0//;<br><br>    for ($b = 0; $b &lt; 24; $b++) {<br>        # Highlight the top time<br>        my $class = $toptime[0] == $b ? 'hirankc10center' : 'rankc10center';<br>        _html("&lt;td class=\"$class\" align=\"center\"&gt;$b&lt;/td&gt;");<br>    }<br><br>    _html("&lt;/tr&gt;&lt;/table&gt;");<br><br>    if($self-&gt;{cfg}-&gt;{showlegend} == 1) {<br>        $self-&gt;_legend();<br>    }<br>}<br><br>sub _activenicks<br>{<br>    # The most active nicks (those who wrote most lines)<br>    my $self = shift;<br><br>    $self-&gt;_headline($self-&gt;_template_text('activenickstopic'));<br><br>    my $output = "";<br>    $output .= "&lt;table border=\"0\" width=\"$self-&gt;{cfg}-&gt;{tablewidth}\"&gt;&lt;tr&gt;";<br>    $output .= "&lt;td&gt; &lt;/td&gt;";<br>    $output .= "&lt;td class=\"tdtop\"&gt;&lt;b&gt;" . $self-&gt;_template_text('nick') . "&lt;/b&gt;&lt;/td&gt;";<br><br>    $output .= "&lt;td class=\"tdtop\"&gt;&lt;b&gt;" . $self-&gt;_template_text('numberlines') . "&lt;/b&gt;&lt;/td&gt;"   if ($self-&gt;{cfg}-&gt;{showlines});<br>    $output .= "&lt;td class=\"tdtop\"&gt;&lt;b&gt;" . $self-&gt;_template_text('show_time') . "&lt;/b&gt;&lt;/td&gt;"     if ($self-&gt;{cfg}-&gt;{showtime});<br>    $output .= "&lt;td class=\"tdtop\"&gt;&lt;b&gt;" . $self-&gt;_template_text('show_words') . "&lt;/b&gt;&lt;/td&gt;"    if ($self-&gt;{cfg}-&gt;{showwords});<br>    $output .= "&lt;td class=\"tdtop\"&gt;&lt;b&gt;" . $self-&gt;_template_text('show_wpl') . "&lt;/b&gt;&lt;/td&gt;"      if ($self-&gt;{cfg}-&gt;{showwpl});<br>    $output .= "&lt;td class=\"tdtop\"&gt;&lt;b&gt;" . $self-&gt;_template_text('show_cpl') . "&lt;/b&gt;&lt;/td&gt;"      if ($self-&gt;{cfg}-&gt;{showcpl});<br>    $output .= "&lt;td class=\"tdtop\"&gt;&lt;b&gt;" . $self-&gt;_template_text('show_lastseen') . "&lt;/b&gt;&lt;/td&gt;" if ($self-&gt;{cfg}-&gt;{showlastseen});<br>    $output .= "&lt;td class=\"tdtop\"&gt;&lt;b&gt;" . $self-&gt;_template_text('randquote') . "&lt;/b&gt;&lt;/td&gt;"     if ($self-&gt;{cfg}-&gt;{showrandquote});<br>    <br>    $output .= "\n";<br><br>    my @active;<br>    my $nicks;<br>    if ($self-&gt;{cfg}-&gt;{sortbywords}) {<br>        @active = sort { $self-&gt;{stats}-&gt;{words}{$b} &lt;=&gt; $self-&gt;{stats}-&gt;{words}{$a} } keys %{ $self-&gt;{stats}-&gt;{words} };<br>        $nicks = scalar keys %{ $self-&gt;{stats}-&gt;{words} };<br>    } else {<br>        @active = sort { $self-&gt;{stats}-&gt;{lines}{$b} &lt;=&gt; $self-&gt;{stats}-&gt;{lines}{$a} } keys %{ $self-&gt;{stats}-&gt;{lines} };<br>        $nicks = scalar keys %{ $self-&gt;{stats}-&gt;{lines} };<br>    }<br><br>    if ($self-&gt;{cfg}-&gt;{activenicks} &gt; $nicks) { $self-&gt;{cfg}-&gt;{activenicks} = $nicks; }<br><br>    for (my $c = 0; $c &lt; $self-&gt;{cfg}-&gt;{activenicks}; $c++) {<br>        last unless $self-&gt;{cfg}-&gt;{userpics};<br>        my $nick = $active[$c];<br>        if ($self-&gt;{users}-&gt;{userpics}{$nick} or $self-&gt;{cfg}-&gt;{defaultpic}) {<br>            $output .= "&lt;td class=\"tdtop\"";<br>            $output .= " colspan=\"$self-&gt;{cfg}-&gt;{userpics}\""  if ($self-&gt;{cfg}-&gt;{userpics} &gt; 1);<br>            $output .= "&gt;&lt;b&gt;" . $self-&gt;_template_text('userpic') ."&lt;/b&gt;&lt;/td&gt;";<br>            last;<br>        }<br>    }<br><br>    $output .= "\n&lt;/tr&gt;";<br>    _html($output);<br>    undef $output;<br><br>    for (my $i = 0; $i &lt; $self-&gt;{cfg}-&gt;{activenicks}; $i++) {<br>        my $c = $i + 1;<br>        my $nick = $active[$i];<br>        my $visiblenick;<br><br>        my $randomline;<br>        if (not defined $self-&gt;{stats}-&gt;{sayings}{$nick}) {<br>            if ($self-&gt;{stats}-&gt;{actions}{$nick}) {<br>                $randomline = $self-&gt;{stats}-&gt;{actionlines}{$nick};<br>            } else {<br>                $randomline = "";<br>            }<br>        } else {<br>            $randomline = $self-&gt;{stats}-&gt;{sayings}{$nick};<br>        }<br><br>        if ($randomline) {<br>            $randomline = $self-&gt;_format_line($randomline);<br>        }<br><br>        # Add a link to the nick if there is any and quote nick<br>        if ($self-&gt;{users}-&gt;{userlinks}{$nick}) {<br>            $visiblenick = $self-&gt;_format_word($self-&gt;{users}-&gt;{userlinks}{$nick}, $nick);<br>        } else {<br>            $visiblenick = $self-&gt;_format_word($nick);<br>        }<br><br>        my $style = $self-&gt;generate_colors($c);<br><br>        my $class = 'rankc';<br>        if ($c == 1) {<br>            $class = 'hirankc';<br>        }<br><br>        my $lastseen;<br><br>        if ($self-&gt;{cfg}-&gt;{showlastseen}) {<br>            $lastseen = $self-&gt;{stats}-&gt;{days} - $self-&gt;{stats}-&gt;{lastvisited}{$nick};<br>            my %hash = ( days =&gt; $lastseen );<br>            if ($lastseen == 0) {<br>                $lastseen = $self-&gt;_template_text('today');<br>            } elsif ($lastseen == 1) {<br>                $lastseen = $self-&gt;_template_text('lastseen1', %hash);<br>            } else {<br>                $lastseen = $self-&gt;_template_text('lastseen2', %hash);<br>            }<br>        }<br><br>        _html("&lt;tr&gt;&lt;td class=\"$class\" align=\"left\"&gt;$c&lt;/td&gt;");<br><br>        my $line = $self-&gt;{stats}-&gt;{lines}{$nick};<br>        my $w = $self-&gt;{stats}-&gt;{words}{$nick} ? $self-&gt;{stats}-&gt;{words}{$nick} : 0;<br>        my $ch   = $self-&gt;{stats}-&gt;{lengths}{$nick};<br>        my $sex = $self-&gt;{users}-&gt;{sex}{$nick};<br>        <br>        my $output = "";<br>        $output .= "&lt;td $style&gt;";<br><br>        # Hilight nick with gendercolors<br>        if ($sex and $sex eq 'm') {<br>            $output .= "&lt;span class=\"Chelsea\"&gt;";<br>        } elsif ($sex and $sex eq 'f') {<br>            $output .= "&lt;span class=\"Man Utd\"&gt;";<br>        } elsif ($sex and $sex eq 'b') {<br>            $output .= "&lt;span class=\"Liverpool\"&gt;";<br>        } else {<br>            $output .= "&lt;span&gt;";<br>        }<br>        $output .= $visiblenick;<br>        $output .= "&lt;/span&gt;&lt;/td&gt;";<br><br>        if ($self-&gt;{cfg}-&gt;{showlines}) {<br>            if ($self-&gt;{cfg}-&gt;{showlinetime}) {<br>                $output .= "&lt;td $style nowrap=\"nowrap\"&gt;" . $self-&gt;_user_linetimes($nick,$active[0]) . "&lt;/td&gt;";<br>            } else {<br>                $output .= "&lt;td $style&gt;$line&lt;/td&gt;";<br>            }<br>        }<br><br>        $output .= "&lt;td $style&gt;" . $self-&gt;_user_times($nick) . "&lt;/td&gt;" if ($self-&gt;{cfg}-&gt;{showtime});<br><br>        if ($self-&gt;{cfg}-&gt;{showwords}) {<br>            if ($self-&gt;{cfg}-&gt;{showwordtime}) {<br>                $output .= "&lt;td $style nowrap=\"nowrap\"&gt;" . $self-&gt;_user_wordtimes($nick,$active[0]) . "&lt;/td&gt;";<br>            } else {<br>                $output .= "&lt;td $style&gt;$w&lt;/td&gt;";<br>            }<br>        }<br>        <br>        $output .= "&lt;td $style&gt;" . sprintf("%.1f", $w/$line) . "&lt;/td&gt;"  if ($self-&gt;{cfg}-&gt;{showwpl});<br>        $output .= "&lt;td $style&gt;" . sprintf("%.1f", $ch/$line) . "&lt;/td&gt;" if ($self-&gt;{cfg}-&gt;{showcpl});<br>        $output .= "&lt;td $style&gt;$lastseen&lt;/td&gt;"                          if ($self-&gt;{cfg}-&gt;{showlastseen});<br>        $output .= "&lt;td $style&gt;\"$randomline\"&lt;/td&gt;"                    if ($self-&gt;{cfg}-&gt;{showrandquote});<br><br>        _html($output);<br>        undef $output;<br><br><br>        if ($self-&gt;{cfg}-&gt;{userpics} &amp;&amp; $i % $self-&gt;{cfg}-&gt;{userpics} == 0) {<br>            for my $ii (0 .. $self-&gt;{cfg}-&gt;{userpics} - 1) {<br>                last if $i + $ii &gt;= $self-&gt;{cfg}-&gt;{activenicks};<br>                $self-&gt;_user_pic($active[$i + $ii], $style);<br>            }<br>        }<br>        _html("&lt;/tr&gt;");<br>    }<br><br>    _html("&lt;/table&gt;&lt;br /&gt;");<br><br>    # Almost as active nicks ('These didn't make it to the top..')<br><br>    my $toshow = $self-&gt;{cfg}-&gt;{activenicks2} - $self-&gt;{cfg}-&gt;{activenicks};<br>    my $remain = $self-&gt;{cfg}-&gt;{activenicks} + $toshow;<br><br>    unless ($toshow &gt; $nicks) {<br>        $remain = $self-&gt;{cfg}-&gt;{activenicks} + $self-&gt;{cfg}-&gt;{activenicks2};<br>        if ($remain &gt; $nicks) {<br>            $remain = $nicks;<br>        }<br><br>        if ($self-&gt;{cfg}-&gt;{activenicks} &lt;  $remain) {<br>            _html("&lt;br /&gt;&lt;b&gt;&lt;i&gt;" . $self-&gt;_template_text('nottop') . "&lt;/i&gt;&lt;/b&gt;&lt;table&gt;&lt;tr&gt;");<br>            for (my $i = $self-&gt;{cfg}-&gt;{activenicks}; $i &lt; $remain; $i++) {<br>                my $visiblenick;<br>                my $nick = $active[$i];<br>                if ($i != $self-&gt;{cfg}-&gt;{activenicks} and ($i - $self-&gt;{cfg}-&gt;{activenicks}) % 5 == 0) {<br>                    _html("&lt;/tr&gt;&lt;tr&gt;");<br>                }<br>                my $items;<br>                if ($self-&gt;{users}-&gt;{userlinks}{$nick}) {<br>                    $visiblenick = $self-&gt;_format_word($self-&gt;{users}-&gt;{userlinks}{$nick}, $nick);<br>                } else {<br>                    $visiblenick = $self-&gt;_format_word($nick);<br>                }<br>                if ($self-&gt;{cfg}-&gt;{sortbywords}) {<br>                    $items = $self-&gt;{stats}-&gt;{words}{$active[$i]};<br>                } else {<br>                    $items = $self-&gt;{stats}-&gt;{lines}{$active[$i]};<br>                }<br>                my $sex = $self-&gt;{users}-&gt;{sex}{$active[$i]};<br><br>                my $output = "";<br>                $output .= "&lt;td class=\"rankc10\"&gt;";<br><br>                if ($sex and $sex eq 'm') {<br>                    $output .= "&lt;span class=\"Chelsea\"&gt;";<br>                } elsif ($sex and $sex eq 'f') {<br>                    $output .= "&lt;span class=\"Man Utd\"&gt;";<br>                } elsif ($sex and $sex eq 'b') {<br>                    $output .= "&lt;span class=\"Liverpool\"&gt;";<br>                } else {<br>                    $output .= "&lt;span&gt;";<br>                }<br>                $output .= "$visiblenick ($items)";<br>                $output .= "&lt;/span&gt;&lt;/td&gt;";<br><br>                _html($output);<br>                undef $output;<br><br>            }<br>            _html("&lt;/tr&gt;&lt;/table&gt;");<br>        }<br>    }<br><br>    my %hash;<br>    $hash{totalnicks} = $nicks - $remain;<br>    if ($hash{totalnicks} &gt; 0) {<br>        _html("&lt;br /&gt;&lt;b&gt;" . $self-&gt;_template_text('totalnicks', %hash) . "&lt;/b&gt;&lt;br /&gt;");<br>    }<br>}<br><br>sub generate_colors<br>{<br>    my $self = shift;<br>    my $c = shift;<br><br>    # if hicell or hicell2 is "", do not print the class as it could mess up the gendercode<br>    return "" if not (length $self-&gt;{cfg}-&gt;{hicell} and length $self-&gt;{cfg}-&gt;{hicell2});<br><br>    my $h = $self-&gt;{cfg}-&gt;{hicell} or return "class=\"hicell\"";<br>    $h =~ s/^#//;<br>    $h = hex $h;<br>    my $h2 = $self-&gt;{cfg}-&gt;{hicell2} or return "class=\"hicell\"";<br>    $h2 =~ s/^#//;<br>    $h2 = hex $h2;<br>    my $f_b = $h &amp; 0xff;<br>    my $f_g = ($h &amp; 0xff00) &gt;&gt; 8;<br>    my $f_r = ($h &amp; 0xff0000) &gt;&gt; 16;<br>    my $t_b = $h2 &amp; 0xff;<br>    my $t_g = ($h2 &amp; 0xff00) &gt;&gt; 8;<br>    my $t_r = ($h2 &amp; 0xff0000) &gt;&gt; 16;<br>    my $blue  = sprintf "%0.2x", abs int(((($t_b - $f_b) / $self-&gt;{cfg}-&gt;{activenicks}) * +$c) + $f_b);<br>    my $green  = sprintf "%0.2x", abs int(((($t_g - $f_g) / $self-&gt;{cfg}-&gt;{activenicks}) * +$c) + $f_g);<br>    my $red  = sprintf "%0.2x", abs int(((($t_r - $f_r) / $self-&gt;{cfg}-&gt;{activenicks}) * +$c) + $f_r);<br><br>    return "style=\"background-color: #$red$green$blue\"";<br>}<br><br>sub _html<br>{<br>    my $html = shift;<br>    print OUTPUT "$html\n" or die "Could not write to disk: $!\n";<br>}<br><br>sub _questions<br>{<br>    # Persons who asked the most questions<br>    my $self = shift;<br><br>    my %qpercent;<br><br>    foreach my $nick (sort keys %{ $self-&gt;{stats}-&gt;{questions} }) {<br>        if ($self-&gt;{topactive}{$nick} || !$self-&gt;{cfg}-&gt;{showonlytop}) {<br>          if ($self-&gt;{stats}-&gt;{lines}{$nick} &gt; $self-&gt;{cfg}-&gt;{bignumbersthreshold}) {<br>              $qpercent{$nick} = sprintf("%.1f", ($self-&gt;{stats}-&gt;{questions}{$nick} / $self-&gt;{stats}-&gt;{lines}{$nick}) * 100);<br>          }<br>        }<br>    }<br><br>    my @question = sort { $qpercent{$b} &lt;=&gt; $qpercent{$a} } keys %qpercent;<br><br>    if (@question) {<br>        my %hash = (<br>            nick =&gt; $question[0],<br>            per  =&gt; $qpercent{$question[0]}<br>        );<br><br>        my $text = $self-&gt;_template_text('question1', %hash);<br>        _html("&lt;tr&gt;&lt;td class=\"hicell\"&gt;$text");<br>        if (@question &gt;= 2) {<br>            my %hash = (<br>                nick =&gt; $question[1],<br>                per =&gt; $qpercent{$question[1]}<br>            );<br><br>            my $text = $self-&gt;_template_text('question2', %hash);<br>            _html("&lt;br /&gt;&lt;span class=\"small\"&gt;$text&lt;/span&gt;");<br>        }<br>        _html("&lt;/td&gt;&lt;/tr&gt;");<br><br>    } else {<br>        _html("&lt;tr&gt;&lt;td class=\"hicell\"&gt;" . $self-&gt;_template_text('question3') . "&lt;/td&gt;&lt;/tr&gt;");<br>    }<br>}<br><br>sub _shoutpeople<br>{<br>    # The ones who speak with exclamation marks!<br>    my $self = shift;<br><br>    my %spercent;<br><br>    foreach my $nick (sort keys %{ $self-&gt;{stats}-&gt;{shouts} }) {<br>        if ($self-&gt;{topactive}{$nick} || !$self-&gt;{cfg}-&gt;{showonlytop}) {<br>          if ($self-&gt;{stats}-&gt;{lines}{$nick} &gt; $self-&gt;{cfg}-&gt;{bignumbersthreshold}) {<br>              $spercent{$nick} = sprintf("%.1f", ($self-&gt;{stats}-&gt;{shouts}{$nick} / $self-&gt;{stats}-&gt;{lines}{$nick}) * 100);<br>          }<br>        }<br>    }<br><br>    my @shout = sort { $spercent{$b} &lt;=&gt; $spercent{$a} } keys %spercent;<br><br>    if (@shout) {<br>        my %hash = (<br>            nick =&gt; $shout[0],<br>            per  =&gt; $spercent{$shout[0]}<br>        );<br><br>        my $text = $self-&gt;_template_text('shout1', %hash);<br>        _html("&lt;tr&gt;&lt;td class=\"hicell\"&gt;$text");<br>        if (@shout &gt;= 2) {<br>            my %hash = (<br>                nick =&gt; $shout[1],<br>                per  =&gt; $spercent{$shout[1]}<br>            );<br><br>            my $text = $self-&gt;_template_text('shout2', %hash);<br>            _html("&lt;br /&gt;&lt;span class=\"small\"&gt;$text&lt;/span&gt;");<br>        }<br>        _html("&lt;/td&gt;&lt;/tr&gt;");<br><br>    } else {<br>        my $text = $self-&gt;_template_text('shout3');<br>        _html("&lt;tr&gt;&lt;td class=\"hicell\"&gt;$text&lt;/td&gt;&lt;/tr&gt;");<br>    }<br><br>}<br><br>sub _capspeople<br>{<br>    # The ones who speak ALL CAPS.<br>    my $self = shift;<br><br>    my %cpercent;<br><br>    foreach my $nick (sort keys %{ $self-&gt;{stats}-&gt;{allcaps} }) {<br>        if ($self-&gt;{topactive}{$nick} || !$self-&gt;{cfg}-&gt;{showonlytop}) {<br>          if ($self-&gt;{stats}-&gt;{lines}{$nick} &gt; $self-&gt;{cfg}-&gt;{bignumbersthreshold}) {<br>              $cpercent{$nick} = sprintf("%.1f", $self-&gt;{stats}-&gt;{allcaps}{$nick} / $self-&gt;{stats}-&gt;{lines}{$nick} * 100);<br>          }<br>        }<br>    }<br><br>    my @caps = sort { $cpercent{$b} &lt;=&gt; $cpercent{$a} } keys %cpercent;<br><br>    if (@caps) {<br>        my %hash = (<br>            nick =&gt; $caps[0],<br>            per  =&gt; $cpercent{$caps[0]},<br>            line =&gt; $self-&gt;_format_line($self-&gt;{stats}-&gt;{allcaplines}{$caps[0]})<br>        );<br><br>        my $text = $self-&gt;_template_text('allcaps1', %hash);<br>        if($self-&gt;{cfg}-&gt;{showshoutline}) {<br>            my $exttext = $self-&gt;_template_text('allcapstext', %hash);<br>            _html("&lt;tr&gt;&lt;td class=\"hicell\"&gt;$text&lt;br /&gt;&lt;span class=\"small\"&gt;$exttext&lt;/span&gt;");<br>        } else {<br>            _html("&lt;tr&gt;&lt;td class=\"hicell\"&gt;$text");<br>        }<br>        if (@caps &gt;= 2) {<br>            my %hash = (<br>                nick =&gt; $caps[1],<br>                per  =&gt; $cpercent{$caps[1]}<br>            );<br><br>            my $text = $self-&gt;_template_text('allcaps2', %hash);<br>            _html("&lt;br /&gt;&lt;span class=\"small\"&gt;$text&lt;/span&gt;");<br>        }<br>        _html("&lt;/td&gt;&lt;/tr&gt;");<br><br>    } else {<br>        my $text = $self-&gt;_template_text('allcaps3');<br>        _html("&lt;tr&gt;&lt;td class=\"hicell\"&gt;$text&lt;/td&gt;&lt;/tr&gt;");<br>    }<br>}<br><br>sub _violent<br>{<br>    # They attacked others (words defined by $self-&gt;{cfg}-&gt;{violent})<br>    my $self = shift;<br><br>    my @aggressors = sort { $self-&gt;{stats}-&gt;{violence}{$b} &lt;=&gt; $self-&gt;{stats}-&gt;{violence}{$a} }<br>                         keys %{ $self-&gt;{stats}-&gt;{violence} };<br><br>    @aggressors = $self-&gt;_istoponly(@aggressors);<br><br>    if(@aggressors) {<br>        my %hash = (<br>            nick    =&gt; $aggressors[0],<br>            attacks =&gt; $self-&gt;{stats}-&gt;{violence}{$aggressors[0]},<br>            line    =&gt; $self-&gt;_format_line($self-&gt;{stats}-&gt;{violencelines}{$aggressors[0]})<br>        );<br>        my $text = $self-&gt;_template_text('violent1', %hash);<br>        if($self-&gt;{cfg}-&gt;{showviolentlines}) {<br>            my $exttext = $self-&gt;_template_text('violenttext', %hash);<br>            _html("&lt;tr&gt;&lt;td class=\"hicell\"&gt;$text&lt;br /&gt;&lt;span class=\"small\"&gt;$exttext&lt;/span&gt;");<br>        } else {<br>            _html("&lt;tr&gt;&lt;td class=\"hicell\"&gt;$text");<br>        }<br>        if (@aggressors &gt;= 2) {<br>            my %hash = (<br>                nick    =&gt; $aggressors[1],<br>                attacks =&gt; $self-&gt;{stats}-&gt;{violence}{$aggressors[1]}<br>            );<br><br>            my $text = $self-&gt;_template_text('violent2', %hash);<br>            _html("&lt;br /&gt;&lt;span class=\"small\"&gt;$text&lt;/span&gt;");<br>        }<br>        _html("&lt;/td&gt;&lt;/tr&gt;");<br>    } else {<br>        my $text = $self-&gt;_template_text('violent3');<br>        _html("&lt;tr&gt;&lt;td class=\"hicell\"&gt;$text&lt;/td&gt;&lt;/tr&gt;");<br>    }<br><br><br>    # They got attacked<br>    my @victims = sort { $self-&gt;{stats}-&gt;{attacked}{$b} &lt;=&gt; $self-&gt;{stats}-&gt;{attacked}{$a} }<br>                    keys %{ $self-&gt;{stats}-&gt;{attacked} };<br><br>    @victims = $self-&gt;_istoponly(@victims);<br><br>    if(@victims) {<br>        my %hash = (<br>            nick    =&gt; $victims[0],<br>            attacks =&gt; $self-&gt;{stats}-&gt;{attacked}{$victims[0]},<br>            line    =&gt; $self-&gt;_format_line($self-&gt;{stats}-&gt;{attackedlines}{$victims[0]})<br>        );<br>        my $text = $self-&gt;_template_text('attacked1', %hash);<br>        if($self-&gt;{cfg}-&gt;{showviolentlines}) {<br>            my $exttext = $self-&gt;_template_text('attackedtext', %hash);<br>            _html("&lt;tr&gt;&lt;td class=\"hicell\"&gt;$text&lt;br /&gt;&lt;span class=\"small\"&gt;$exttext&lt;/span&gt;");<br>        } else {<br>            _html("&lt;tr&gt;&lt;td class=\"hicell\"&gt;$text");<br>        }<br>        if (@victims &gt;= 2) {<br>            my %hash = (<br>                nick    =&gt; $victims[1],<br>                attacks =&gt; $self-&gt;{stats}-&gt;{attacked}{$victims[1]}<br>            );<br><br>            my $text = $self-&gt;_template_text('attacked2', %hash);<br>            _html("&lt;br /&gt;&lt;span class=\"small\"&gt;$text&lt;/span&gt;");<br>        }<br>        _html("&lt;/td&gt;&lt;/tr&gt;");<br>    }<br>}<br><br>sub _gotkicks<br>{<br>    # The persons who got kicked the most<br>    my $self = shift;<br><br>    my @gotkick = sort { $self-&gt;{stats}-&gt;{gotkicked}{$b} &lt;=&gt; $self-&gt;{stats}-&gt;{gotkicked}{$a} }<br>                       keys %{ $self-&gt;{stats}-&gt;{gotkicked} };<br><br>    @gotkick = $self-&gt;_istoponly(@gotkick);<br><br>    if (@gotkick) {<br>        my %hash = (<br>            nick  =&gt; $gotkick[0],<br>            kicks =&gt; $self-&gt;{stats}-&gt;{gotkicked}{$gotkick[0]},<br>            line  =&gt; $self-&gt;_format_line($self-&gt;{stats}-&gt;{kicklines}{$gotkick[0]})<br>        );<br><br>        my $text = $self-&gt;_template_text('gotkick1', %hash);<br><br>        if ($self-&gt;{cfg}-&gt;{showkickline}) {<br>            my $exttext = $self-&gt;_template_text('kicktext', %hash);<br>            _html("&lt;tr&gt;&lt;td class=\"hicell\"&gt;$text&lt;br /&gt;&lt;span class=\"small\"&gt;$exttext&lt;/span&gt;");<br>        } else {<br>            _html("&lt;tr&gt;&lt;td class=\"hicell\"&gt;$text");<br>        }<br><br>        if (@gotkick &gt;= 2) {<br>            my %hash = (<br>                nick  =&gt; $gotkick[1],<br>                kicks =&gt; $self-&gt;{stats}-&gt;{gotkicked}{$gotkick[1]}<br>            );<br><br>            my $text = $self-&gt;_template_text('gotkick2', %hash);<br>            _html("&lt;br /&gt;&lt;span class=\"small\"&gt;$text&lt;/span&gt;");<br>        }<br>        _html("&lt;/td&gt;&lt;/tr&gt;");<br>    }<br>}<br><br>sub _mostjoins<br>{<br>    my $self = shift;<br><br>    my @joins = sort { $self-&gt;{stats}-&gt;{joins}{$b} &lt;=&gt; $self-&gt;{stats}-&gt;{joins}{$a} }<br>                     keys %{ $self-&gt;{stats}-&gt;{joins} };<br><br>    @joins = $self-&gt;_istoponly(@joins);<br><br>    if (@joins) {<br>        my %hash = (<br>            nick  =&gt; $joins[0],<br>            joins =&gt; $self-&gt;{stats}-&gt;{joins}{$joins[0]}<br>        );<br><br>        my $text = $self-&gt;_template_text('joins', %hash);<br><br>        _html("&lt;tr&gt;&lt;td class=\"hicell\"&gt;$text&lt;/td&gt;&lt;/tr&gt;");<br>    }<br>}<br><br>sub _mostwords<br>{<br>    # The person who got words the most<br>    my $self = shift;<br><br>    my @words = sort { $self-&gt;{stats}-&gt;{words}{$b} &lt;=&gt; $self-&gt;{stats}-&gt;{words}{$a} }<br>                      keys %{ $self-&gt;{stats}-&gt;{words} };<br><br>    @words = $self-&gt;_istoponly(@words);<br><br>    if (@words) {<br>        my %hash = (<br>            nick  =&gt; $words[0],<br>            words =&gt; $self-&gt;{stats}-&gt;{words}{$words[0]}<br>        );<br><br>        my $text = $self-&gt;_template_text('words1', %hash);<br>        _html("&lt;tr&gt;&lt;td class=\"hicell\"&gt;$text");<br><br>        if (@words &gt;= 2) {<br>            my %hash = (<br>                oldnick =&gt; $words[0],<br>                nick    =&gt; $words[1],<br>                words   =&gt; $self-&gt;{stats}-&gt;{words}{$words[1]}<br>            );<br><br>            my $text = $self-&gt;_template_text('words2', %hash);<br>            _html("&lt;br /&gt;&lt;span class=\"small\"&gt;$text&lt;/span&gt;");<br>        }<br>        _html("&lt;/td&gt;&lt;/tr&gt;");<br>    } else {<br>        my $text = $self-&gt;_template_text('words3');<br>        _html("&lt;tr&gt;&lt;td class=\"hicell\"&gt;$text&lt;/td&gt;&lt;/tr&gt;");<br>    }<br>}<br><br>sub _mostkicks<br>{<br>    # The person who kicked the most<br>    my $self = shift;<br><br>    my @kicked = sort { $self-&gt;{stats}-&gt;{kicked}{$b} &lt;=&gt; $self-&gt;{stats}-&gt;{kicked}{$a} }<br>                        keys %{ $self-&gt;{stats}-&gt;{kicked} };<br><br>    @kicked = $self-&gt;_istoponly(@kicked);<br><br>    if (@kicked) {<br>        my %hash = (<br>            nick   =&gt; $kicked[0],<br>            kicked =&gt; $self-&gt;{stats}-&gt;{kicked}{$kicked[0]}<br>        );<br><br>        my $text = $self-&gt;_template_text('kick1', %hash);<br>        _html("&lt;tr&gt;&lt;td class=\"hicell\"&gt;$text");<br><br>        if (@kicked &gt;= 2) {<br>            my %hash = (<br>                oldnick =&gt; $kicked[0],<br>                nick    =&gt; $kicked[1],<br>                kicked  =&gt; $self-&gt;{stats}-&gt;{kicked}{$kicked[1]}<br>            );<br><br>            my $text = $self-&gt;_template_text('kick2', %hash);<br>            _html("&lt;br /&gt;&lt;span class=\"small\"&gt;$text&lt;/span&gt;");<br>        }<br>        _html("&lt;/td&gt;&lt;/tr&gt;");<br>    } else {<br>        my $text = $self-&gt;_template_text('kick3');<br>        _html("&lt;tr&gt;&lt;td class=\"hicell\"&gt;$text&lt;/td&gt;&lt;/tr&gt;");<br>    }<br>}<br><br>sub _mostmonologues<br>{<br>    # The person who had the most monologues (speaking to himself)<br>    my $self = shift;<br><br>    my @monologue = sort { $self-&gt;{stats}-&gt;{monologues}{$b} &lt;=&gt; $self-&gt;{stats}-&gt;{monologues}{$a} } <br>                           keys %{ $self-&gt;{stats}-&gt;{monologues} };<br><br>    @monologue = $self-&gt;_istoponly(@monologue);<br><br>    if (@monologue) {<br>        my %hash = (<br>            nick  =&gt; $monologue[0],<br>            monos =&gt; $self-&gt;{stats}-&gt;{monologues}{$monologue[0]}<br>        );<br><br>        my $text = $self-&gt;_template_text('mono1', %hash);<br><br>        _html("&lt;tr&gt;&lt;td class=\"hicell\"&gt;$text");<br>        if (@monologue &gt;= 2) {<br>            my %hash = (<br>                nick  =&gt; $monologue[1],<br>                monos =&gt; $self-&gt;{stats}-&gt;{monologues}{$monologue[1]}<br>            );<br><br>            my $text = $self-&gt;_template_text('mono2', %hash);<br>            _html("&lt;br /&gt;&lt;span class=\"small\"&gt;$text&lt;/span&gt;");<br>        }<br>        _html("&lt;/td&gt;&lt;/tr&gt;");<br>    }<br>}<br><br>sub _linelengths<br>{<br>    # The person(s) who wrote the longest lines<br>    my $self = shift;<br><br>    my %len;<br><br>    foreach my $nick (sort keys %{ $self-&gt;{stats}-&gt;{lengths} }) {<br>        if ($self-&gt;{topactive}{$nick} || !$self-&gt;{cfg}-&gt;{showonlytop}) {<br>          if ($self-&gt;{stats}-&gt;{lines}{$nick} &gt; $self-&gt;{cfg}-&gt;{bignumbersthreshold}) {<br>              $len{$nick} = sprintf("%.1f", $self-&gt;{stats}-&gt;{lengths}{$nick} / $self-&gt;{stats}-&gt;{lines}{$nick});<br>          }<br>        }<br>    }<br><br>    my @len = sort { $len{$b} &lt;=&gt; $len{$a} } keys %len;<br><br>    my $all_lines = 0;<br>    my $totallength;<br>    foreach my $nick (keys %{ $self-&gt;{stats}-&gt;{lines} }) {<br>        $all_lines   += $self-&gt;{stats}-&gt;{lines}{$nick};<br>        $totallength += $self-&gt;{stats}-&gt;{lengths}{$nick};<br>    }<br><br>    my $totalaverage;<br><br>    if ($all_lines &gt; 0) {<br>        $totalaverage = sprintf("%.1f", $totallength / $all_lines);<br>    }<br><br>    if (@len) {<br>        my %hash = (<br>            nick    =&gt; $len[0],<br>            letters =&gt; $len{$len[0]}<br>        );<br><br>        my $text = $self-&gt;_template_text('long1', %hash);<br>        _html("&lt;tr&gt;&lt;td class=\"hicell\"&gt;$text&lt;br /&gt;");<br><br>        if (@len &gt;= 2) {<br>            %hash = (<br>                avg =&gt; $totalaverage<br>            );<br><br>            $text = $self-&gt;_template_text('long2', %hash);<br>            _html("&lt;span class=\"small\"&gt;$text&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;");<br>        } else {<br>            _html("&lt;/td&gt;&lt;/tr&gt;");<br>        }<br>    }<br><br>    # The person(s) who wrote the shortest lines<br><br>    if (@len) {<br>        my %hash = (<br>            nick =&gt; $len[$#len],<br>            letters =&gt; $len{$len[$#len]}<br>        );<br><br>        my $text = $self-&gt;_template_text('short1', %hash);<br>        _html("&lt;tr&gt;&lt;td class=\"hicell\"&gt;$text&lt;br /&gt;");<br><br>        if (@len &gt;= 2) {<br>            %hash = (<br>                nick =&gt; $len[$#len - 1],<br>                letters =&gt; $len{$len[$#len - 1]}<br>            );<br><br>            $text = $self-&gt;_template_text('short2', %hash);<br>            _html("&lt;span class=\"small\"&gt;$text&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;");<br>        } else {<br>            _html("&lt;/td&gt;&lt;/tr&gt;");<br>        }<br>    }<br>}<br><br>sub _mostfoul<br>{<br>    my $self = shift;<br><br>    my %spercent;<br><br>    foreach my $nick (sort keys %{ $self-&gt;{stats}-&gt;{foul} }) {<br>        if ($self-&gt;{topactive}{$nick} || !$self-&gt;{cfg}-&gt;{showonlytop}) {<br>          if ($self-&gt;{stats}-&gt;{lines}{$nick} &gt; 15) {<br>              my $dec = $self-&gt;{cfg}-&gt;{showfouldecimals};<br>              $dec = 1 if($dec &lt; 0); # default to 1<br>              $spercent{$nick} = sprintf("%.${dec}f", $self-&gt;{stats}-&gt;{foul}{$nick} / $self-&gt;{stats}-&gt;{words}{$nick} * 100);<br>          }<br>        }<br>    }<br><br>    my @foul = sort { $spercent{$b} &lt;=&gt; $spercent{$a} } keys %spercent;<br><br>    if (@foul) {<br><br>        my %hash = (<br>            nick =&gt; $foul[0],<br>            per  =&gt; $spercent{$foul[0]},<br>            line =&gt; $self-&gt;_format_line($self-&gt;{stats}{foullines}{$foul[0]}),<br>        );<br><br>        my $text = $self-&gt;_template_text('foul1', %hash);<br><br>        if($self-&gt;{cfg}-&gt;{showfoulline}) {<br>            my $exttext = $self-&gt;_template_text('foultext', %hash);<br>            _html("&lt;tr&gt;&lt;td class=\"hicell\"&gt;$text&lt;br /&gt;&lt;span class=\"small\"&gt;$exttext&lt;/span&gt;");<br>        } else {<br>            _html("&lt;tr&gt;&lt;td class=\"hicell\"&gt;$text");<br>        }<br><br>        if (@foul &gt;= 2) {<br>            my %hash = (<br>                nick =&gt; $foul[1],<br>                per  =&gt; $spercent{$foul[1]}<br>            );<br><br>            my $text = $self-&gt;_template_text('foul2', %hash);<br>            _html("&lt;br /&gt;&lt;span class=\"small\"&gt;$text&lt;/span&gt;");<br>        }<br><br>        _html("&lt;/td&gt;&lt;/tr&gt;");<br>    } else {<br>        my $text = $self-&gt;_template_text('foul3');<br><br>        _html("&lt;tr&gt;&lt;td class=\"hicell\"&gt;$text&lt;/td&gt;&lt;/tr&gt;");<br>    }<br>}<br><br><br>sub _mostsad<br>{<br>    my $self = shift;<br><br>    my %spercent;<br><br>    foreach my $nick (sort keys %{ $self-&gt;{stats}-&gt;{frowns} }) {<br>        if ($self-&gt;{topactive}{$nick} || !$self-&gt;{cfg}-&gt;{showonlytop}) {<br>          if ($self-&gt;{stats}-&gt;{lines}{$nick} &gt; $self-&gt;{cfg}-&gt;{bignumbersthreshold}) {<br>              $spercent{$nick} = sprintf("%.1f", $self-&gt;{stats}-&gt;{frowns}{$nick} / $self-&gt;{stats}-&gt;{lines}{$nick} * 100);<br>          }<br>        }<br>    }<br><br>    my @sadface = sort { $spercent{$b} &lt;=&gt; $spercent{$a} } keys %spercent;<br><br><br>    if (@sadface) {<br>        my %hash = (<br>            nick =&gt; $sadface[0],<br>            per  =&gt; $spercent{$sadface[0]}<br>        );<br><br>        my $text = $self-&gt;_template_text('sad1', %hash);<br>        _html("&lt;tr&gt;&lt;td class=\"hicell\"&gt;$text");<br><br>        if (@sadface &gt;= 2) {<br>            my %hash = (<br>                nick =&gt; $sadface[1],<br>                per  =&gt; $spercent{$sadface[1]}<br>            );<br><br>            my $text = $self-&gt;_template_text('sad2', %hash);<br><br>            _html("&lt;br /&gt;&lt;span class=\"small\"&gt;$text&lt;/span&gt;");<br>        }<br>        _html("&lt;/td&gt;&lt;/tr&gt;");<br>    } else {<br>        my $text = $self-&gt;_template_text('sad3');<br>        _html("&lt;tr&gt;&lt;td class=\"hicell\"&gt;$text&lt;/td&gt;&lt;/tr&gt;");<br>    }<br>}<br><br><br>sub _mostop<br>{<br>    my $self = shift;<br><br>    my @ops   = sort { $self-&gt;{stats}-&gt;{gaveops}{$b} &lt;=&gt; $self-&gt;{stats}-&gt;{gaveops}{$a} }<br>                     keys %{ $self-&gt;{stats}-&gt;{gaveops} };<br><br>    @ops = $self-&gt;_istoponly(@ops);<br><br>    my @deops = sort { $self-&gt;{stats}-&gt;{tookops}{$b} &lt;=&gt; $self-&gt;{stats}-&gt;{tookops}{$a} }<br>                     keys %{ $self-&gt;{stats}-&gt;{tookops} };<br><br>    @deops = $self-&gt;_istoponly(@deops);<br><br>    if (@ops) {<br>        my %hash = (<br>            nick =&gt; $ops[0],<br>            ops  =&gt; $self-&gt;{stats}-&gt;{gaveops}{$ops[0]}<br>        );<br><br>        my $text = $self-&gt;_template_text('mostop1', %hash);<br><br>        _html("&lt;tr&gt;&lt;td class=\"hicell\"&gt;$text");<br><br>        if (@ops &gt;= 2) {<br>            my %hash = (<br>                nick =&gt; $ops[1],<br>                ops  =&gt; $self-&gt;{stats}-&gt;{gaveops}{$ops[1]}<br>            );<br><br>            my $text = $self-&gt;_template_text('mostop2', %hash);<br>            _html("&lt;br /&gt;&lt;span class=\"small\"&gt;$text&lt;/span&gt;");<br>        }<br>        _html("&lt;/td&gt;&lt;/tr&gt;");<br>    } else {<br>        my $text = $self-&gt;_template_text('mostop3');<br>        _html("&lt;tr&gt;&lt;td class=\"hicell\"&gt;$text&lt;/td&gt;&lt;/tr&gt;");<br>    }<br><br>    if (@deops) {<br>        my %hash = (<br>            nick  =&gt; $deops[0],<br>            deops =&gt; $self-&gt;{stats}-&gt;{tookops}{$deops[0]}<br>        );<br>        my $text = $self-&gt;_template_text('mostdeop1', %hash);<br><br>        _html("&lt;tr&gt;&lt;td class=\"hicell\"&gt;$text");<br><br>        if (@deops &gt;= 2) {<br>            my %hash = (<br>                nick  =&gt; $deops[1],<br>                deops =&gt; $self-&gt;{stats}-&gt;{tookops}{$deops[1]}<br>            );<br>            my $text = $self-&gt;_template_text('mostdeop2', %hash);<br><br>            _html("&lt;br /&gt;&lt;span class=\"small\"&gt;$text&lt;/span&gt;");<br>        }<br>        _html("&lt;/td&gt;&lt;/tr&gt;");<br>    } else {<br>        my $text = $self-&gt;_template_text('mostdeop3');<br>        _html("&lt;tr&gt;&lt;td class=\"hicell\"&gt;$text&lt;/td&gt;&lt;/tr&gt;");<br>    }<br>}<br><br>sub _mostvoice<br>{<br>    my $self = shift;<br><br>    my @voice   = sort { $self-&gt;{stats}-&gt;{gavevoice}{$b} &lt;=&gt; $self-&gt;{stats}-&gt;{gavevoice}{$a} }<br>                     keys %{ $self-&gt;{stats}-&gt;{gavevoice} };<br><br>    @voice = $self-&gt;_istoponly(@voice);<br><br>    my @devoice = sort { $self-&gt;{stats}-&gt;{tookvoice}{$b} &lt;=&gt; $self-&gt;{stats}-&gt;{tookvoice}{$a} }<br>                     keys %{ $self-&gt;{stats}-&gt;{tookvoice} };<br><br>    @devoice = $self-&gt;_istoponly(@devoice);<br><br>    if (@voice) {<br>        my %hash = (<br>            nick =&gt; $voice[0],<br>            voices  =&gt; $self-&gt;{stats}-&gt;{gavevoice}{$voice[0]}<br>        );<br><br>        my $text = $self-&gt;_template_text('mostvoice1', %hash);<br><br>        _html("&lt;tr&gt;&lt;td class=\"hicell\"&gt;$text");<br><br>        if (@voice &gt;= 2) {<br>            my %hash = (<br>                nick =&gt; $voice[1],<br>                voices  =&gt; $self-&gt;{stats}-&gt;{gavevoice}{$voice[1]}<br>            );<br><br>            my $text = $self-&gt;_template_text('mostvoice2', %hash);<br>            _html("&lt;br /&gt;&lt;span class=\"small\"&gt;$text&lt;/span&gt;");<br>        }<br>        _html("&lt;/td&gt;&lt;/tr&gt;");<br>    } else {<br>        my $text = $self-&gt;_template_text('mostvoice3');<br>        _html("&lt;tr&gt;&lt;td class=\"hicell\"&gt;$text&lt;/td&gt;&lt;/tr&gt;");<br>    }<br><br>    if (@devoice) {<br>        my %hash = (<br>            nick  =&gt; $devoice[0],<br>            devoices =&gt; $self-&gt;{stats}-&gt;{tookvoice}{$devoice[0]}<br>        );<br>        my $text = $self-&gt;_template_text('mostdevoice1', %hash);<br><br>        _html("&lt;tr&gt;&lt;td class=\"hicell\"&gt;$text");<br><br>        if (@devoice &gt;= 2) {<br>            my %hash = (<br>                nick  =&gt; $devoice[1],<br>                devoices =&gt; $self-&gt;{stats}-&gt;{tookvoice}{$devoice[1]}<br>            );<br>            my $text = $self-&gt;_template_text('mostdevoice2', %hash);<br><br>            _html("&lt;br /&gt;&lt;span class=\"small\"&gt;$text&lt;/span&gt;");<br>        }<br>        _html("&lt;/td&gt;&lt;/tr&gt;");<br>    } else {<br>        my $text = $self-&gt;_template_text('mostdevoice3');<br>        _html("&lt;tr&gt;&lt;td class=\"hicell\"&gt;$text&lt;/td&gt;&lt;/tr&gt;");<br>    }<br><br>}<br><br>sub _mosthalfop<br>{<br>    my $self = shift;<br><br>    my @halfops   = sort { $self-&gt;{stats}-&gt;{gavehalfops}{$b} &lt;=&gt; $self-&gt;{stats}-&gt;{gavehalfops}{$a} }<br>                     keys %{ $self-&gt;{stats}-&gt;{gavehalfops} };<br><br>    @halfops = $self-&gt;_istoponly(@halfops);<br><br>    my @dehalfops = sort { $self-&gt;{stats}-&gt;{tookhalfops}{$b} &lt;=&gt; $self-&gt;{stats}-&gt;{tookhalfops}{$a} }<br>                     keys %{ $self-&gt;{stats}-&gt;{tookhalfops} };<br><br>    @dehalfops = $self-&gt;_istoponly(@dehalfops);<br><br>    if (@halfops) {<br>        my %hash = (<br>            nick =&gt; $halfops[0],<br>            halfops  =&gt; $self-&gt;{stats}-&gt;{gavehalfops}{$halfops[0]}<br>        );<br><br>        my $text = $self-&gt;_template_text('mosthalfop1', %hash);<br><br>        _html("&lt;tr&gt;&lt;td class=\"hicell\"&gt;$text");<br><br>        if (@halfops &gt;= 2) {<br>            my %hash = (<br>                nick =&gt; $halfops[1],<br>                halfops  =&gt; $self-&gt;{stats}-&gt;{gavehalfops}{$halfops[1]}<br>            );<br><br>            my $text = $self-&gt;_template_text('mosthalfop2', %hash);<br>            _html("&lt;br /&gt;&lt;span class=\"small\"&gt;$text&lt;/span&gt;");<br>        }<br>        _html("&lt;/td&gt;&lt;/tr&gt;");<br>    } else {<br>        my $text = $self-&gt;_template_text('mosthalfop3');<br>        _html("&lt;tr&gt;&lt;td class=\"hicell\"&gt;$text&lt;/td&gt;&lt;/tr&gt;");<br>    }<br><br>    if (@dehalfops) {<br>        my %hash = (<br>            nick  =&gt; $dehalfops[0],<br>            dehalfops =&gt; $self-&gt;{stats}-&gt;{tookhalfops}{$dehalfops[0]}<br>        );<br>        my $text = $self-&gt;_template_text('mostdehalfop1', %hash);<br><br>        _html("&lt;tr&gt;&lt;td class=\"hicell\"&gt;$text");<br><br>        if (@dehalfops &gt;= 2) {<br>            my %hash = (<br>                nick  =&gt; $dehalfops[1],<br>                dehalfops =&gt; $self-&gt;{stats}-&gt;{tookhalfops}{$dehalfops[1]}<br>            );<br>            my $text = $self-&gt;_template_text('mostdehalfop2', %hash);<br><br>            _html("&lt;br /&gt;&lt;span class=\"small\"&gt;$text&lt;/span&gt;");<br>        }<br>        _html("&lt;/td&gt;&lt;/tr&gt;");<br>    } else {<br>        my $text = $self-&gt;_template_text('mostdehalfop3');<br>        _html("&lt;tr&gt;&lt;td class=\"hicell\"&gt;$text&lt;/td&gt;&lt;/tr&gt;");<br>    }<br>}<br><br>sub _mostactions<br>{<br>    # The person who did the most /me's<br>    my $self = shift;<br><br>    my @actions = sort { $self-&gt;{stats}-&gt;{actions}{$b} &lt;=&gt; $self-&gt;{stats}-&gt;{actions}{$a} }<br>                        keys %{ $self-&gt;{stats}-&gt;{actions} };<br><br>    @actions = $self-&gt;_istoponly(@actions);<br><br>    if (@actions) {<br>        my %linehash =<br>        my %hash = (<br>            nick    =&gt; $actions[0],<br>            actions =&gt; $self-&gt;{stats}-&gt;{actions}{$actions[0]},<br>            line    =&gt; $self-&gt;_format_line($self-&gt;{stats}-&gt;{actionlines}{$actions[0]})<br>        );<br>        my $text = $self-&gt;_template_text('action1', %hash);<br>        if($self-&gt;{cfg}-&gt;{showactionline}) {<br>            my $exttext = $self-&gt;_template_text('actiontext', %hash);<br>            _html("&lt;tr&gt;&lt;td class=\"hicell\"&gt;$text&lt;br /&gt;&lt;span class=\"small\"&gt;$exttext&lt;/span&gt;");<br>        } else {<br>            _html("&lt;tr&gt;&lt;td class=\"hicell\"&gt;$text");<br>        }<br><br>        if (@actions &gt;= 2) {<br>            my %hash = (<br>                nick    =&gt; $actions[1],<br>                actions =&gt; $self-&gt;{stats}-&gt;{actions}{$actions[1]}<br>            );<br><br>            my $text = $self-&gt;_template_text('action2', %hash);<br>            _html("&lt;br /&gt;&lt;span class=\"small\"&gt;$text&lt;/span&gt;");<br>        }<br>        _html("&lt;/td&gt;&lt;/tr&gt;");<br>    } else {<br>        my $text = $self-&gt;_template_text('action3');<br>        _html("&lt;tr&gt;&lt;td class=\"hicell\"&gt;$text&lt;/td&gt;&lt;/tr&gt;");<br>    }<br>}<br><br><br>sub _mostsmiles<br>{<br>    # The person(s) who smiled the most <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":-)" title="Smile"><br>    my $self = shift;<br><br>    my %spercent;<br><br>    foreach my $nick (sort keys %{ $self-&gt;{stats}-&gt;{smiles} }) {<br>        if ($self-&gt;{topactive}{$nick} || !$self-&gt;{cfg}-&gt;{showonlytop}) {<br>          if ($self-&gt;{stats}-&gt;{lines}{$nick} &gt; $self-&gt;{cfg}-&gt;{bignumbersthreshold}) {<br>              $spercent{$nick} = sprintf("%.1f", $self-&gt;{stats}-&gt;{smiles}{$nick} / $self-&gt;{stats}-&gt;{lines}{$nick} * 100);<br>          }<br>        }<br>    }<br><br>    my @smiles = sort { $spercent{$b} &lt;=&gt; $spercent{$a} } keys %spercent;<br><br><br>    if (@smiles) {<br>        my %hash = (<br>            nick =&gt; $smiles[0],<br>            per  =&gt; $spercent{$smiles[0]}<br>        );<br><br>        my $text = $self-&gt;_template_text('smiles1', %hash);<br><br>        _html("&lt;tr&gt;&lt;td class=\"hicell\"&gt;$text");<br>        if (@smiles &gt;= 2) {<br>            my %hash = (<br>                nick =&gt; $smiles[1],<br>                per  =&gt; $spercent{$smiles[1]}<br>            );<br><br>            my $text = $self-&gt;_template_text('smiles2', %hash);<br>            _html("&lt;br /&gt;&lt;span class=\"small\"&gt;$text&lt;/span&gt;");<br>        }<br>        _html("&lt;/td&gt;&lt;/tr&gt;");<br><br>    } else {<br><br>        my $text = $self-&gt;_template_text('smiles3');<br>        _html("&lt;tr&gt;&lt;td class=\"hicell\"&gt;$text&lt;/td&gt;&lt;/tr&gt;");<br>    }<br>}<br><br>sub _lasttopics<br>{<br>    my $self = shift;<br><br>    if ($self-&gt;{stats}-&gt;{topics}) {<br><br>        my %topic_seen;<br><br>        my %hash = (<br>            total =&gt; scalar @{ $self-&gt;{stats}-&gt;{topics} }<br>        );<br><br>        my $ltopic = $#{ $self-&gt;{stats}-&gt;{topics} };<br>        my $tlimit = 0;<br><br>        $self-&gt;{cfg}-&gt;{topichistory} -= 1;<br><br>        if ($ltopic &gt; $self-&gt;{cfg}-&gt;{topichistory}) {<br>            $tlimit = $ltopic - $self-&gt;{cfg}-&gt;{topichistory};<br>        }<br><br>        for (my $i = $ltopic; $i &gt;= $tlimit; $i--) {<br>            my $topic = $self-&gt;{stats}-&gt;{topics}[$i]{topic};<br>            # This code makes sure that we don't see the same topic twice<br>            next if ($topic_seen{$topic});<br>            $topic_seen{$topic} = 1;<br><br>            # Strip off the quotes (')<br>            $topic =~ s/^\'(.*)\'$/$1/;<br><br>            my $nick = $self-&gt;{stats}-&gt;{topics}[$i]{nick};<br>            my $hour = $self-&gt;{stats}-&gt;{topics}[$i]{hour};<br>            my $min  = $self-&gt;{stats}-&gt;{topics}[$i]{min};<br><br>            $hash{nick} = $nick;<br>            $hash{time} = "$hour:$min";<br>            $hash{days} = $self-&gt;{stats}-&gt;{days} - $self-&gt;{stats}-&gt;{topics}[$i]{days};<br>            if ($hash{days} == 0) {<br>                $hash{date} = $self-&gt;_template_text('today');<br>            } elsif ($hash{days} == 1) {<br>                $hash{date} = $self-&gt;_template_text('lastseen1', %hash);<br>            } else {<br>                $hash{date} = $self-&gt;_template_text('lastseen2', %hash);<br>            }<br><br>            _html('&lt;tr&gt;&lt;td class="hicell"&gt;&lt;i&gt;' . $self-&gt;_format_line($topic) . '&lt;/i&gt;&lt;/td&gt;');<br>            _html('&lt;td class="hicell"&gt;&lt;b&gt;' . $self-&gt;_template_text('bylinetopic', %hash) . '&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;');<br>        }<br>        _html("&lt;tr&gt;&lt;td align=\"center\" colspan=\"2\" class=\"asmall\"&gt;" . $self-&gt;_template_text('totaltopic', %hash) . "&lt;/td&gt;&lt;/tr&gt;");<br>    } else {<br>        _html("&lt;tr&gt;&lt;td class=\"hicell\"&gt;" . $self-&gt;_template_text('notopic') ."&lt;/td&gt;&lt;/tr&gt;");<br>    }<br>}<br><br>sub _template_text<br>{<br>    # This function is for the homemade template system. It receives a name<br>    # of a template and a hash with the fields in the template to update to<br>    # its corresponding value<br>    my $self = shift;<br>    my $template = shift;<br>    my %hash = @_;<br><br>    my $text;<br><br>    unless ($text = $self-&gt;{tmps}-&gt;{$self-&gt;{cfg}-&gt;{lang}}{$template}) {<br>        # Fall back to English if the language template doesn't exist<br><br>        if ($text = $self-&gt;{tmps}-&gt;{EN}{$template}) {<br>            print "Note: No translation in '$self-&gt;{cfg}-&gt;{lang}' for '$template' - falling back to English.\n"<br>                unless ($self-&gt;{cfg}-&gt;{silent});<br>        } else {<br>            die("No template for '$template' in language file.\n");<br>        }<br>    }<br>    if($self-&gt;{iconv}) {<br>        $text = $self-&gt;{iconv}-&gt;convert($text);<br>        die("Could not convert charset for template '$template'.\n") unless $text;<br>    }<br><br>    $hash{channel} = $self-&gt;{cfg}-&gt;{channel};<br>    # the nick is sanitized here, everything else outside of _template_text<br>    $hash{nick} = $self-&gt;_format_word($hash{nick}) if $hash{nick};<br><br>    foreach my $key (sort keys %hash) {<br>        $text =~ s/\[:$key\]/$hash{$key}/;<br>    }<br><br>    if ($text =~ /\[:[^:]*?:[^:]*?:[^:]*?:\<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10393">Football</a> — Tue Mar 02, 2010 3:10 pm</p><hr />
]]></content>
	</entry>
	</feed>
