Mercurial > hg > reproctool-df
comparison reproctool.cgi @ 46:30bbda81f13b
Quick statatistic adding and some small text changes.
author | df |
---|---|
date | Mon, 26 Jan 2009 21:27:52 +0000 |
parents | bb8e080b25da |
children | 9c55ad1214ee |
comparison
equal
deleted
inserted
replaced
45:bb8e080b25da | 46:30bbda81f13b |
---|---|
222 GROUP BY types.typeID | 222 GROUP BY types.typeID |
223 ORDER BY typeName ASC | 223 ORDER BY typeName ASC |
224 END | 224 END |
225 my $pre_reprocess = $db->prepare($sql_reprocess); | 225 my $pre_reprocess = $db->prepare($sql_reprocess); |
226 | 226 |
227 # Global statistical vars | |
228 my ($totalTrit, $totalPyer, $totalMexa, $totalIsog, $totalNocx, $totalZydr, | |
229 $totalMega, $totalMorp, $totalIsk, $meta0, $meta1, $meta2, $meta3, $meta4, | |
230 $meta5, $meta6Plus ); | |
231 | |
227 # Execute, bring back one row per item | 232 # Execute, bring back one row per item |
228 my ($tid, $tname, $gname, $meta, $basePrice, $icon, | 233 my ($tid, $tname, $gname, $meta, $basePrice, $icon, |
229 $ttrit, $tpyer, $tmexa, $tisog, $tnocx, $tzydr, $tmega, $tmorp); | 234 $ttrit, $tpyer, $tmexa, $tisog, $tnocx, $tzydr, $tmega, $tmorp); |
230 | 235 |
231 $pre_reprocess->execute(@item_names) or die("Can't lookup items: $DBI::errstr"); | 236 $pre_reprocess->execute(@item_names) or die("Can't lookup items: $DBI::errstr"); |
241 my $isk = ($trit * $ttrit) + ($pyer * $tpyer) + ($mexa * $tmexa) + | 246 my $isk = ($trit * $ttrit) + ($pyer * $tpyer) + ($mexa * $tmexa) + |
242 ($isog * $tisog) + ($nocx * $tnocx) + ($zydr * $tzydr) + | 247 ($isog * $tisog) + ($nocx * $tnocx) + ($zydr * $tzydr) + |
243 ($mega * $tmega) + ($morp * $tmorp); | 248 ($mega * $tmega) + ($morp * $tmorp); |
244 my $repDetails = sprintf( "Trit=%d Py=%d Mex=%d Iso=%d Nocx=%d Zyd=%d Mega=%d Morp=%d", | 249 my $repDetails = sprintf( "Trit=%d Py=%d Mex=%d Iso=%d Nocx=%d Zyd=%d Mega=%d Morp=%d", |
245 $ttrit, $tpyer, $tmexa, $tisog, $tnocx, $tzydr, $tmega, $tmorp ); | 250 $ttrit, $tpyer, $tmexa, $tisog, $tnocx, $tzydr, $tmega, $tmorp ); |
251 | |
252 # End statistics. | |
253 $totalTrit += $ttrit; $totalPyer += $tpyer; $totalMexa += $tmexa; | |
254 $totalIsog += $tisog; $totalNocx += $tnocx; $totalZydr += $tzydr; | |
255 $totalMega += $tmega; $totalMorp += $tmorp; $totalIsk += $isk; | |
246 | 256 |
247 $meta = 0 unless defined $meta; | 257 $meta = 0 unless defined $meta; |
248 $item = { id => $tid, name => $tname, meta => $meta, icon => $icon, | 258 $item = { id => $tid, name => $tname, meta => $meta, icon => $icon, |
249 price => $basePrice, reprocessIsk => $isk, reprocessDetails => $repDetails }; | 259 price => $basePrice, reprocessIsk => $isk, reprocessDetails => $repDetails }; |
250 $item_lookup->{$tname} = $item; | 260 $item_lookup->{$tname} = $item; |
268 } | 278 } |
269 </style> | 279 </style> |
270 </head> | 280 </head> |
271 | 281 |
272 <body> | 282 <body> |
273 Welcome to the sell, reprocess or keep tool. :) | 283 <h1>Results</h1> |
274 <p /> | |
275 Here is how it works, the colour coding: | 284 Here is how it works, the colour coding: |
276 <ul> | 285 <ul> |
277 <li>Items in <font color='#666600'>dark yellow</font> are meta 0.</li> | 286 <li>Items in <font color='#666600'>dark yellow</font> are meta 0.</li> |
278 <li>Items in grey to white are meta 1, 2 or 3.</li> | 287 <li>Items in grey to white are meta 1, 2 or 3.</li> |
279 <li>Items in <font color='#4444FF'>blue</font> are meta 4.</li> | 288 <li>Items in <font color='#4444FF'>blue</font> are meta 4.</li> |
297 is not the same as clicking 'Show info' on the real item. (For example: the | 306 is not the same as clicking 'Show info' on the real item. (For example: the |
298 real item might be damaged.)<br /> | 307 real item might be damaged.)<br /> |
299 <a href="http://rammsrdi.com">Ramm's RDI</a>. | 308 <a href="http://rammsrdi.com">Ramm's RDI</a>. |
300 <p /> | 309 <p /> |
301 <hr> | 310 <hr> |
311 <p /> | |
302 <table> | 312 <table> |
303 END | 313 END |
304 | 314 |
305 sub pretty_numbers | 315 sub pretty_numbers |
306 { | 316 { |
336 $img = "$img_http_path/icons/icons_items_png/64_64/icon$item->{icon}.png"; | 346 $img = "$img_http_path/icons/icons_items_png/64_64/icon$item->{icon}.png"; |
337 } | 347 } |
338 | 348 |
339 switch ($item->{meta}) | 349 switch ($item->{meta}) |
340 { | 350 { |
341 case 0 { $colour = "#666600"; } | 351 case 0 { $colour = "#666600"; $meta0 += 1; } |
342 case 1 { $colour = "#777777"; } | 352 case 1 { $colour = "#777777"; $meta1 += 1; } |
343 case 2 { $colour = "#BBBBBB"; } | 353 case 2 { $colour = "#BBBBBB"; $meta2 += 1; } |
344 case 3 { $colour = "#FFFFFF"; } | 354 case 3 { $colour = "#FFFFFF"; $meta3 += 1; } |
345 case 4 { $colour = "#4444FF"; } | 355 case 4 { $colour = "#4444FF"; $meta4 += 1; } |
346 case 5 { $colour = "#FF0000"; } | 356 case 5 { $colour = "#FF0000"; $meta5 += 1; } |
347 case [6..30]{ $colour = "#00FF00"; } | 357 case [6..30]{ $colour = "#00FF00"; $meta6Plus += 1; } |
348 } | 358 } |
349 | 359 |
350 if ($item->{meta} >= 4) | 360 if ($item->{meta} >= 4) |
351 { | 361 { |
352 $text = $item->{name}; | 362 $text = $item->{name}; |
379 } | 389 } |
380 | 390 |
381 print<<END; | 391 print<<END; |
382 </tr> | 392 </tr> |
383 </table> | 393 </table> |
394 <hr> | |
395 <p /> | |
396 <h1>Totals</h1> | |
397 END | |
398 # TODO: df wonders if there is a std::map :) | |
399 print "Total ISK baseprice: " . pretty_numbers( $totalIsk ) . "<p />\n"; | |
400 print "<br />Trit: " . pretty_numbers( $totalTrit ) if ($totalTrit>0); | |
401 print "<br />Py: " . pretty_numbers( $totalPyer ) if ($totalPyer>0); | |
402 print "<br />Mex: " . pretty_numbers( $totalMexa ) if ($totalMexa>0); | |
403 print "<br />Iso: " . pretty_numbers( $totalIsog ) if ($totalIsog>0); | |
404 print "<br />Nox: " . pretty_numbers( $totalNocx ) if ($totalNocx>0); | |
405 print "<br />Zyd: " . pretty_numbers( $totalZydr ) if ($totalZydr>0); | |
406 print "<br />Mega: " . pretty_numbers( $totalMega ) if ($totalMega>0); | |
407 print "<br />Morp: " . pretty_numbers( $totalMorp ) if ($totalMorp>0); | |
408 print "<br />\n"; | |
409 print "<br /><font color='#666600'>Meta 0: " . pretty_numbers( $meta0 ) . "</font>" if ($meta0>0); | |
410 print "<br /><font color='#777777'>Meta 1: " . pretty_numbers( $meta1 ) . "</font>" if ($meta1>0); | |
411 print "<br /><font color='#BBBBBB'>Meta 2: " . pretty_numbers( $meta2 ) . "</font>" if ($meta2>0); | |
412 print "<br /><font color='#FFFFFF'>Meta 3: " . pretty_numbers( $meta3 ) . "</font>" if ($meta3>0); | |
413 print "<br /><font color='#4444FF'>Meta 4: " . pretty_numbers( $meta4 ) . "</font>" if ($meta4>0); | |
414 print "<br /><font color='#FF0000'>Meta 5: " . pretty_numbers( $meta5 ) . " (T2)</font>" if ($meta5>0); | |
415 print "<br /><font color='#00FF00'>Meta 6+: " . pretty_numbers( $meta6Plus ) . "</font>" if ($meta6Plus>0); | |
416 | |
417 print<<END; | |
418 <hr> | |
419 <p /> | |
420 <h1>Credits</h1> | |
421 By an idea of <a href="showinfo:1383//1374652644">hfo ohforf</a>, coded by | |
422 <a href="showinfo:1384//689057791">hfo Omnix</a>. From | |
423 <a href="showinfo:2//1176688893">Ramm's RDI</a>.<br /> | |
424 How about you donate 0.1% of your total (which got calucalted at | |
425 END | |
426 # TODO: Weird things happen when you use the pretty numbers function here :( (replace int) | |
427 print int( $totalIsk /1000 ); | |
428 print<<END | |
429 ISK) to <a href="showinfo:1386//532549592">hfo</a> which will distribute it towards the | |
430 creators and corperation of this tool that you are using now :). Thanks! | |
384 </body> | 431 </body> |
385 </html> | 432 </html> |
386 END | 433 END |
387 | 434 |