--- t2stats/t2stats 2003/09/25 18:54:17 32 +++ t2stats/t2stats 2003/10/27 00:37:04 33 @@ -40,6 +40,7 @@ $gm = "$game: $mission"; $players = 0 if ($players < 0); $maxplayers = 0 if ($maxplayers < 0); + $grand_total += $players; # all time stats @@ -64,6 +65,24 @@ } } + # last 100 days + next unless ($now - 100 * 24 * 60 * 60 < $time); + + $grand_total100 += $players; + + if ($players != 0) { + if (exists $map100{$gmm}) { + $map100{$gmm} += $players; + } else { + $map100{$gmm} = $players; + } + if (exists $game100{$gm}) { + $game100{$gm} += $players; + } else { + $game100{$gm} = $players; + } + } + # last 7 days next unless ($now - 7 * 24 * 60 * 60 < $time); @@ -141,9 +160,9 @@ ################################################################################ -open PLOTA1, "|$ploticus_chron xinc='30 days' stubfmt='Mmmdd' -o images/players_full.png"; -open PLOTA2, "|$ploticus_chron xinc='30 days' stubfmt='Mmmdd' -o images/capacity_full.png"; -open PLOTA3, "|$ploticus_chron xinc='30 days' stubfmt='Mmmdd' -o images/usage_full.png"; +open PLOTA1, "|$ploticus_chron xinc='60 days' stubfmt='Mmmdd' -o images/players_full.png"; +open PLOTA2, "|$ploticus_chron xinc='60 days' stubfmt='Mmmdd' -o images/capacity_full.png"; +open PLOTA3, "|$ploticus_chron xinc='60 days' stubfmt='Mmmdd' -o images/usage_full.png"; foreach $date (sort keys %players_day) { $meanplayer = $players_day{$date} / (6.0 * 24.0); @@ -221,8 +240,8 @@ $game_types = keys %game; $key = <First value all available data, -second value last 7 days. +

First value last 7 days, +second value last 100 days. $game_types game types. END @@ -230,20 +249,20 @@ print GAMES '

Game type popularity

', $menu, $key, "

"; $i = 0; -foreach $gm (sort { $game{$b} <=> $game{$a} } keys %game) { - $players = $game{$gm}; - $players7 = exists $game7{$gm} ? $game7{$gm} : 0; - $propn = $players / $grand_total; +foreach $gm (sort { $game7{$b} <=> $game7{$a} } keys %game7) { + $players100 = $game100{$gm}; + $players7 = $game7{$gm}; + $propn100 = $players100 / $grand_total100; $propn7 = $players7 / $grand_total7; - $max = $propn if $i == 0; - $width = int($propn / $max * $bar_width); + $max = $propn7 if $i == 0; + $width100 = int($propn100 / $max * $bar_width); $width7 = int($propn7 / $max * $bar_width); - $pct = sprintf "%.3g", $propn * 100; + $pct100 = sprintf "%.3g", $propn100 * 100; $pct7 = sprintf "%.3g", $propn7 * 100; $class = $i % 2; $line = <$gm
$pct%
- $pct7%

+

$gm
$pct7%
+ $pct100%

END print INDEX $line if $i < 10; print GAMES $line; @@ -255,8 +274,8 @@ $maps = keys %map; $key = <First value all available data, -second value last 7 days. +

First value last 7 days, +second value last 100 days. $maps maps. Follow the link to search for a map on Tribes2Maps. END @@ -265,24 +284,27 @@ print MAPS '

Map popularity

', $menu, $key, "

"; $i = 0; -foreach $gmm (sort { $map{$b} <=> $map{$a} } keys %map) { - $players = $map{$gmm}; - $players7 = exists $map7{$gmm} ? $map7{$gmm} : 0; - $propn = $players / $grand_total; +foreach $gmm (sort { $map7{$b} <=> $map7{$a} } keys %map7) { + $players100 = $map100{$gmm}; + $players7 = $map7{$gmm}; + $propn100 = $players100 / $grand_total100; $propn7 = $players7 / $grand_total7; - $max = $propn if $i == 0; - $width = int($propn / $max * $bar_width); + $max = $propn7 if $i == 0; + $width100 = int($propn100 / $max * $bar_width); $width7 = int($propn7 / $max * $bar_width); - $pct = sprintf "%.3g", $propn * 100; + $pct100 = sprintf "%.3g", $propn100 * 100; $pct7 = sprintf "%.3g", $propn7 * 100; $class = $i % 2; $search = $gmm; - $search =~ s/([^\w()'*~!.-])/sprintf '%%%02x', ord $1/eg; $search =~ s/^Euro2_//; + $search =~ s/^TL_//; + $search =~ s/ \(x2\)$//; + $search =~ s/^Cluster_//; + $search =~ s/([^\w()'*~!.-])/sprintf '%%%02x', ord $1/eg; $line = <$gmm
- $pct%
- $pct7%

+ $pct7%
+ $pct100%

END print INDEX $line if $i < 10; print MAPS $line;