/[james]/t2stats/t2stats
ViewVC logotype

Diff of /t2stats/t2stats

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 32 by james, Sun Apr 13 10:57:37 2003 UTC revision 33 by james, Mon Oct 27 00:37:04 2003 UTC
# Line 40  while ($line = <>) { Line 40  while ($line = <>) {
40          $gm = "$game: $mission";          $gm = "$game: $mission";
41          $players = 0 if ($players < 0);          $players = 0 if ($players < 0);
42          $maxplayers = 0 if ($maxplayers < 0);          $maxplayers = 0 if ($maxplayers < 0);
43    
44          $grand_total += $players;          $grand_total += $players;
45    
46          # all time stats          # all time stats
# Line 64  while ($line = <>) { Line 65  while ($line = <>) {
65                  }                  }
66          }          }
67    
68            # last 100 days
69            next unless ($now - 100 * 24 * 60 * 60 < $time);
70    
71            $grand_total100 += $players;
72    
73            if ($players != 0) {
74                    if (exists $map100{$gmm}) {
75                            $map100{$gmm} += $players;
76                    } else {
77                            $map100{$gmm} = $players;
78                    }
79                    if (exists $game100{$gm}) {
80                            $game100{$gm} += $players;
81                    } else {
82                            $game100{$gm} = $players;
83                    }
84            }
85    
86          # last 7 days          # last 7 days
87          next unless ($now - 7 * 24 * 60 * 60 < $time);          next unless ($now - 7 * 24 * 60 * 60 < $time);
88    
# Line 141  END Line 160  END
160    
161  ################################################################################  ################################################################################
162    
163  open PLOTA1, "|$ploticus_chron xinc='30 days' stubfmt='Mmmdd' -o images/players_full.png";  open PLOTA1, "|$ploticus_chron xinc='60 days' stubfmt='Mmmdd' -o images/players_full.png";
164  open PLOTA2, "|$ploticus_chron xinc='30 days' stubfmt='Mmmdd' -o images/capacity_full.png";  open PLOTA2, "|$ploticus_chron xinc='60 days' stubfmt='Mmmdd' -o images/capacity_full.png";
165  open PLOTA3, "|$ploticus_chron xinc='30 days' stubfmt='Mmmdd' -o images/usage_full.png";  open PLOTA3, "|$ploticus_chron xinc='60 days' stubfmt='Mmmdd' -o images/usage_full.png";
166    
167  foreach $date (sort keys %players_day) {  foreach $date (sort keys %players_day) {
168          $meanplayer = $players_day{$date} / (6.0 * 24.0);          $meanplayer = $players_day{$date} / (6.0 * 24.0);
# Line 221  END Line 240  END
240  $game_types = keys %game;  $game_types = keys %game;
241    
242  $key = <<END;  $key = <<END;
243  <p><img src='images/bar.png' width='10' height='10' alt='First value' />&nbsp;all available data,  <p><img src='images/bar.png' width='10' height='10' alt='First value' />&nbsp;last 7 days,
244  <img src='images/bar7.png' width='10' height='10' alt='second value' />&nbsp;last 7 days.  <img src='images/bar7.png' width='10' height='10' alt='second value' />&nbsp;last 100 days.
245  $game_types game types.  $game_types game types.
246  END  END
247    
# Line 230  print INDEX '<h2>Top 10 game types</h2>' Line 249  print INDEX '<h2>Top 10 game types</h2>'
249  print GAMES '<h1>Game type popularity</h1>', $menu, $key, "</p>";  print GAMES '<h1>Game type popularity</h1>', $menu, $key, "</p>";
250    
251  $i = 0;  $i = 0;
252  foreach $gm (sort { $game{$b} <=> $game{$a} } keys %game) {  foreach $gm (sort { $game7{$b} <=> $game7{$a} } keys %game7) {
253          $players = $game{$gm};          $players100 = $game100{$gm};
254          $players7 = exists $game7{$gm} ? $game7{$gm} : 0;          $players7 = $game7{$gm};
255          $propn = $players / $grand_total;          $propn100 = $players100 / $grand_total100;
256          $propn7 = $players7 / $grand_total7;          $propn7 = $players7 / $grand_total7;
257          $max = $propn if $i == 0;          $max = $propn7 if $i == 0;
258          $width = int($propn / $max * $bar_width);          $width100 = int($propn100 / $max * $bar_width);
259          $width7 = int($propn7 / $max * $bar_width);          $width7 = int($propn7 / $max * $bar_width);
260          $pct = sprintf "%.3g", $propn * 100;          $pct100 = sprintf "%.3g", $propn100 * 100;
261          $pct7 = sprintf "%.3g", $propn7 * 100;          $pct7 = sprintf "%.3g", $propn7 * 100;
262          $class = $i % 2;          $class = $i % 2;
263          $line = <<END;          $line = <<END;
264  <p class='bar$class'>$gm<br><img src='images/bar.png' width='$width' height='10' alt=''> $pct%<br>  <p class='bar$class'>$gm<br><img src='images/bar.png' width='$width7' height='10' alt=''> $pct7%<br>
265  <img src='images/bar7.png' width='$width7' height='10' alt=''> $pct7%</p>  <img src='images/bar7.png' width='$width100' height='10' alt=''> $pct100%</p>
266  END  END
267          print INDEX $line if $i < 10;          print INDEX $line if $i < 10;
268          print GAMES $line;          print GAMES $line;
# Line 255  END Line 274  END
274  $maps = keys %map;  $maps = keys %map;
275    
276  $key = <<END;  $key = <<END;
277  <p><img src='images/bar.png' width='10' height='10' alt='First value' />&nbsp;all available data,  <p><img src='images/bar.png' width='10' height='10' alt='First value' />&nbsp;last 7 days,
278  <img src='images/bar7.png' width='10' height='10' alt='second value' />&nbsp;last 7 days.  <img src='images/bar7.png' width='10' height='10' alt='second value' />&nbsp;last 100 days.
279  $maps maps.  $maps maps.
280  Follow the link to search for a map on <a href='http://www.tribes2maps.com/'>Tribes2Maps</a>.  Follow the link to search for a map on <a href='http://www.tribes2maps.com/'>Tribes2Maps</a>.
281  END  END
# Line 265  print INDEX '<h2>Top 10 maps</h2>', $key Line 284  print INDEX '<h2>Top 10 maps</h2>', $key
284  print MAPS '<h1>Map popularity</h1>', $menu, $key, "</p>";  print MAPS '<h1>Map popularity</h1>', $menu, $key, "</p>";
285    
286  $i = 0;  $i = 0;
287  foreach $gmm (sort { $map{$b} <=> $map{$a} } keys %map) {  foreach $gmm (sort { $map7{$b} <=> $map7{$a} } keys %map7) {
288          $players = $map{$gmm};          $players100 = $map100{$gmm};
289          $players7 = exists $map7{$gmm} ? $map7{$gmm} : 0;          $players7 = $map7{$gmm};
290          $propn = $players / $grand_total;          $propn100 = $players100 / $grand_total100;
291          $propn7 = $players7 / $grand_total7;          $propn7 = $players7 / $grand_total7;
292          $max = $propn if $i == 0;          $max = $propn7 if $i == 0;
293          $width = int($propn / $max * $bar_width);          $width100 = int($propn100 / $max * $bar_width);
294          $width7 = int($propn7 / $max * $bar_width);          $width7 = int($propn7 / $max * $bar_width);
295          $pct = sprintf "%.3g", $propn * 100;          $pct100 = sprintf "%.3g", $propn100 * 100;
296          $pct7 = sprintf "%.3g", $propn7 * 100;          $pct7 = sprintf "%.3g", $propn7 * 100;
297          $class = $i % 2;          $class = $i % 2;
298          $search = $gmm;          $search = $gmm;
         $search =~ s/([^\w()'*~!.-])/sprintf '%%%02x', ord $1/eg;  
299          $search =~ s/^Euro2_//;          $search =~ s/^Euro2_//;
300            $search =~ s/^TL_//;
301            $search =~ s/ \(x2\)$//;
302            $search =~ s/^Cluster_//;
303            $search =~ s/([^\w()'*~!.-])/sprintf '%%%02x', ord $1/eg;
304          $line = <<END;          $line = <<END;
305  <p class='bar$class'><a href="http://www.tribes2maps.com/cgi-bin/map_search.cgi?names_only=1;search=$search">$gmm</a><br>  <p class='bar$class'><a href="http://www.tribes2maps.com/cgi-bin/map_search.cgi?names_only=1;search=$search">$gmm</a><br>
306  <img src='images/bar.png' width='$width' height='10' alt=''> $pct%<br>  <img src='images/bar.png' width='$width7' height='10' alt=''> $pct7%<br>
307  <img src='images/bar7.png' width='$width7' height='10' alt=''> $pct7%</p>  <img src='images/bar7.png' width='$width100' height='10' alt=''> $pct100%</p>
308  END  END
309          print INDEX $line if $i < 10;          print INDEX $line if $i < 10;
310          print MAPS $line;          print MAPS $line;

Legend:
Removed from v.32  
changed lines
  Added in v.33

  ViewVC Help
Powered by ViewVC 1.1.26