comparison reproctool.cgi @ 20:877806fb69a3

Fixed double use of var, and added reprocessing details in ALT
author df
date Sun, 25 Jan 2009 16:12:18 +0000
parents 67f13a371c18
children 5ae40a1161e6
comparison
equal deleted inserted replaced
19:704c878812a3 20:877806fb69a3
82 82
83 exit; 83 exit;
84 } 84 }
85 85
86 # Inputs 86 # Inputs
87 my $str_items = $cgi->param('items') or user_error('Items missing');
88 my $cols = $cgi->param('cols') || 4; 87 my $cols = $cgi->param('cols') || 4;
89 88
90 # Load mineral prices 89 # Load mineral prices
91 my $trit = $cgi->param('trit') || user_error('No tritanium price'); 90 my $trit = $cgi->param('trit') || user_error('No tritanium price');
92 my $pyer = $cgi->param('pyer') || user_error('No pyerite price'); 91 my $pyer = $cgi->param('pyer') || user_error('No pyerite price');
158 { 157 {
159 my $item = {}; 158 my $item = {};
160 my $isk = ($trit * $ttrit) + ($pyer * $tpyer) + ($mexa * $tmexa) + 159 my $isk = ($trit * $ttrit) + ($pyer * $tpyer) + ($mexa * $tmexa) +
161 ($isog * $tisog) + ($nocx * $tnocx) + ($zydr * $tzydr) + 160 ($isog * $tisog) + ($nocx * $tnocx) + ($zydr * $tzydr) +
162 ($mega * $tmega) + ($morp * $tmorp); 161 ($mega * $tmega) + ($morp * $tmorp);
162 my $repDetails = sprintf( "Trit=%d Py=%d Mex=%d Iso=%d Nocx=%d Zyd=%d Mega=%d Morp=%d",
163 $ttrit, $tpyer, $tmexa, $tisog, $tnocx, $tzydr, $tmega, $tmorp );
163 164
164 $meta = 0 unless defined $meta; 165 $meta = 0 unless defined $meta;
165 $item = { id => $tid, name => $tname, meta => $meta, icon => $icon, 166 $item = { id => $tid, name => $tname, meta => $meta, icon => $icon,
166 price => $basePrice, reprocess => $isk }; 167 price => $basePrice, reprocessIsk => $isk, reprocessDetails => $repDetails };
167 168
168 # If this item exists multiple times in the input, then they weren't stacked 169 # If this item exists multiple times in the input, then they weren't stacked
169 # so output it multiple times 170 # so output it multiple times
170 my @matching_in = grep({ $_ eq $tname } @item_names); 171 my @matching_in = grep({ $_ eq $tname } @item_names);
171 push @output, $item foreach (0..$#matching_in); 172 push @output, $item foreach (0..$#matching_in);
221 $text = $item->{name}; 222 $text = $item->{name};
222 $colour = "#FF0000"; 223 $colour = "#FF0000";
223 } 224 }
224 else 225 else
225 { 226 {
226 $text = $item->{reprocess}; 227 $text = $item->{reprocessIsk};
227 } 228 }
228 } 229 }
229 else 230 else
230 { 231 {
231 $text = 'Unknown item'; 232 $text = 'Unknown item';
233 } 234 }
234 235
235 print "<td width='64' class='item'>"; 236 print "<td width='64' class='item'>";
236 print "<a href='$link'>" if defined $link; 237 print "<a href='$link'>" if defined $link;
237 print "<img src='$img' width='64' height='64' border='1' "; 238 print "<img src='$img' width='64' height='64' border='1' ";
238 print "title=\"$item->{name}\" alt=\"$item->{name}\" />"; 239 print "title=\"$item->{name}\" alt=\"$item->{name} ($item->{reprocessDetails})\" />";
239 print "</a>" if defined $link; 240 print "</a>" if defined $link;
240 print "<br />"; 241 print "<br />";
241 print "<font color='$colour'>" if defined $colour; 242 print "<font color='$colour'>" if defined $colour;
242 print $text; 243 print $text;
243 print "</font>" if defined $colour; 244 print "</font>" if defined $colour;