comparison reproctool.cgi @ 40:20870c5d9b45

Using name sorting, handling unknowns
author Dominic Cleal <dominic@computerkb.co.uk>
date Sun, 25 Jan 2009 20:40:36 +0000
parents b231022614aa
children e6bb8593c1e8 e9429d4a7942
comparison
equal deleted inserted replaced
39:b231022614aa 40:20870c5d9b45
218 INNER JOIN typeActivityMaterials m1 ON types.typeID = m1.typeID 218 INNER JOIN typeActivityMaterials m1 ON types.typeID = m1.typeID
219 INNER JOIN invGroups groups ON types.groupID = groups.groupID 219 INNER JOIN invGroups groups ON types.groupID = groups.groupID
220 INNER JOIN eveGraphics graphics ON types.graphicID = graphics.graphicID 220 INNER JOIN eveGraphics graphics ON types.graphicID = graphics.graphicID
221 WHERE $sql_typenames 221 WHERE $sql_typenames
222 GROUP BY types.typeID 222 GROUP BY types.typeID
223 ORDER BY groups.categoryID DESC, groupName ASC, 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 # Execute, bring back one row per item 227 # Execute, bring back one row per item
228 my ($tid, $tname, $gname, $meta, $basePrice, $icon, 228 my ($tid, $tname, $gname, $meta, $basePrice, $icon,
231 $pre_reprocess->execute(@item_names) or die("Can't lookup items: $DBI::errstr"); 231 $pre_reprocess->execute(@item_names) or die("Can't lookup items: $DBI::errstr");
232 $pre_reprocess->bind_columns(undef, \$tid, \$tname, \$gname, \$meta, \$basePrice, 232 $pre_reprocess->bind_columns(undef, \$tid, \$tname, \$gname, \$meta, \$basePrice,
233 \$icon, \$ttrit, \$tpyer, \$tmexa, \$tisog, 233 \$icon, \$ttrit, \$tpyer, \$tmexa, \$tisog,
234 \$tnocx, \$tzydr, \$tmega, \$tmorp); 234 \$tnocx, \$tzydr, \$tmega, \$tmorp);
235 235
236 my $item_lookup = {};
236 my @output = (); 237 my @output = ();
237 while ($pre_reprocess->fetch()) 238 while ($pre_reprocess->fetch())
238 { 239 {
239 my $item = {}; 240 my $item = {};
240 my $isk = ($trit * $ttrit) + ($pyer * $tpyer) + ($mexa * $tmexa) + 241 my $isk = ($trit * $ttrit) + ($pyer * $tpyer) + ($mexa * $tmexa) +
244 $ttrit, $tpyer, $tmexa, $tisog, $tnocx, $tzydr, $tmega, $tmorp ); 245 $ttrit, $tpyer, $tmexa, $tisog, $tnocx, $tzydr, $tmega, $tmorp );
245 246
246 $meta = 0 unless defined $meta; 247 $meta = 0 unless defined $meta;
247 $item = { id => $tid, name => $tname, meta => $meta, icon => $icon, 248 $item = { id => $tid, name => $tname, meta => $meta, icon => $icon,
248 price => $basePrice, reprocessIsk => $isk, reprocessDetails => $repDetails }; 249 price => $basePrice, reprocessIsk => $isk, reprocessDetails => $repDetails };
249 250 $item_lookup->{$tname} = $item;
250 # If this item exists multiple times in the input, then they weren't stacked 251 }
251 # so output it multiple times 252
252 my @matching_in = grep({ $_ eq $tname } @item_names); 253 # Now match up the item lookups to the input list
253 push @output, $item foreach (0..$#matching_in); 254 foreach (sort @item_names)
255 {
256 push @output, (exists $item_lookup->{$_} ? $item_lookup->{$_}
257 : { name => $_ } );
254 } 258 }
255 259
256 my $col = 0; 260 my $col = 0;
257 print<<END; 261 print<<END;
258 <html> 262 <html>
280 The number below the item represents the item's value if you would reprocess 284 The number below the item represents the item's value if you would reprocess
281 and sell the minerals on the market. Basically, if you have the option of 285 and sell the minerals on the market. Basically, if you have the option of
282 selling that item for a price below that number, its better to keep the item 286 selling that item for a price below that number, its better to keep the item
283 and reprocess it. 287 and reprocess it.
284 <p /> 288 <p />
285 As you might see, the items are listed just like your inventory in EVE. The 289 As you might see, the items are listed similarly to your inventory in EVE.
286 sorting is the same as when you sort by type. If you have this browser 290 You will need to sort your EVE window by name to match. If you have this browser
287 window next to your inventory window, matching the columns(!), it is very 291 window next to your inventory window, matching the columns(!), it is very
288 easy to pick out those valuable items. 292 easy to pick out those valuable items.
289 <p /> 293 <p />
290 Tip: Because this can be a huge page to load in EVE, resizing might freeze the 294 Tip: Because this can be a huge page to load in EVE, resizing might freeze the
291 game a bit.<br /> 295 game a bit.<br />