changeset 33:a4197a854e79

Using pretty numbers on output
author Dominic Cleal <dominic@computerkb.co.uk>
date Sun, 25 Jan 2009 18:02:01 +0000
parents 583e4c324c24 (diff) 5c28a9d5fae7 (current diff)
children 2709fae95b1e 7d9abc345081
files reproctool.cgi
diffstat 1 files changed, 10 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/reproctool.cgi	Sun Jan 25 17:54:26 2009 +0000
+++ b/reproctool.cgi	Sun Jan 25 18:02:01 2009 +0000
@@ -1,4 +1,11 @@
 #!/usr/bin/perl -T
+#
+# CGI script for assessing reprocessing value of items in EVE-Online based
+# on mineral prices.
+#
+# Released under the revised BSD licence
+# Copyright (c) 2009 Dominic Cleal
+# Portions copyright (c) 2009 Bjorn Hamels
 
 use warnings;
 use strict;
@@ -202,24 +209,13 @@
 while ($pre_reprocess->fetch())
 {
     my $item = {};
-    my $isk = sprintf("%d", ($trit * $ttrit) + ($pyer * $tpyer) + ($mexa * $tmexa) +
+    my $isk = ($trit * $ttrit) + ($pyer * $tpyer) + ($mexa * $tmexa) +
                 ($isog * $tisog) + ($nocx * $tnocx) + ($zydr * $tzydr) +
-                ($mega * $tmega) + ($morp * $tmorp) );;
+                ($mega * $tmega) + ($morp * $tmorp);
     my $repDetails = sprintf( "Trit=%d Py=%d Mex=%d Iso=%d Nocx=%d Zyd=%d Mega=%d Morp=%d",
                               $ttrit, $tpyer, $tmexa, $tisog, $tnocx, $tzydr, $tmega, $tmorp );
     
     $meta = 0 unless defined $meta;
-    
-    # Creative adding of 000 seperation for readability.
-    if ( length($isk)>3 )
-    {
-        substr($isk, -3, 0) = ',';
-    }
-    if ( length($isk)>7 )
-    {
-        substr($isk, -7, 0) = ',';
-    }
-    
     $item = { id => $tid, name => $tname, meta => $meta, icon => $icon,
               price => $basePrice, reprocessIsk => $isk, reprocessDetails => $repDetails };
     
@@ -295,7 +291,7 @@
         }
         else
         {
-            $text = $item->{reprocessIsk};
+            $text = pretty_numbers($item->{reprocessIsk});
         }
     }
     else