Talk:Items by autosell price (1-25 Meat): Difference between revisions
From A KoL Wiki
imported>Dehstil |
imported>Dehstil m move comment |
||
Line 49: | Line 49: | ||
</table> | </table> | ||
--[[User:Club|Club]] 13:09, 23 June 2006 (CDT) | --[[User:Club|Club]] 13:09, 23 June 2006 (CDT) | ||
Here's what I used to create this: | |||
#!/usr/bin/perl -w | |||
# Benjamin Elijah Griffin "Club (#66669)" 17 Aug 2006 | |||
use strict; | |||
use vars qw( $urifile $pricesfile $outfile_f $tables_f $tablee_f | |||
%uris %items %prices %lc | |||
@pricesort @valuesort @ranges @links | |||
$p $item $file $uri $price $num $range $low $high $last | |||
$star $bar $name $outfile ); | |||
# | |||
# This file looks like: | |||
# %27Villa%27_document (tab) 'Villa'_document.html | |||
# 1.21_jigawatts (tab) 1_21_jigawatts.html | |||
# 100-Watt_bulb (tab) 100-Watt_bulb.html | |||
# The first column has the page name on the wiki, the second column is | |||
# the page name in my local stash. | |||
$urifile = "URIs"; | |||
# | |||
# This file looks like: | |||
# 100-Watt_bulb.html <tab> 75 | |||
# 1337_7r0uZ0RZ.html <tab> 130 | |||
# 1_21_jigawatts.html <tab> 75 | |||
# The first column has the page name in my local stash, the second column | |||
# has the price in meat. | |||
$pricesfile = "PRICES"; | |||
# | |||
$outfile_f = "Items_by_autosell_price_(%d-%d_Meat)"; | |||
$tables_f = "<table border=1 width='90%%' cellpadding=3 cellspacing=0><tr><th>%d Meat</th></tr><tr><td>\n"; | |||
$tablee_f = "</td></tr></table><br />\n\n"; | |||
# | |||
@ranges = ( | |||
[1, 25], | |||
[26, 50], | |||
[51, 75], | |||
[76, 100], | |||
[101, 150], | |||
[151, 50000], | |||
); | |||
# | |||
for $range (@ranges) { | |||
($low, $high) = @$range; | |||
$uri = sprintf($outfile_f, $low, $high); | |||
push(@links, $uri); | |||
} # for range @range | |||
# | |||
# | |||
if(!open(U,$urifile)) { | |||
die "Can't open $urifile -- $!\n"; | |||
} | |||
while(<U>) { | |||
chomp; | |||
($uri, $file) = split(/\t/); | |||
$uris{$file} = $uri; | |||
} # while U | |||
close U; | |||
# | |||
if(!open(P,$pricesfile)) { | |||
die "Can't open $pricesfile -- $!\n"; | |||
} | |||
while(<P>) { | |||
chomp; | |||
($file, $price) = split(/\t/); | |||
$uri = $uris{$file}; | |||
die "No uri for $file\n" unless defined($uri); | |||
$items{$uri} = $price; | |||
$lc{$uri} = lc($uri); | |||
} # while P | |||
close P; | |||
# | |||
@pricesort = sort { | |||
$p = $items{$a} <=> $items{$b}; | |||
if($p == 0) { | |||
$p = $lc{$a} cmp $lc{$b}; | |||
} | |||
$p | |||
} keys (%items); | |||
# | |||
# for $item (@pricesort) { | |||
# $price = $items{$item}; | |||
# $prices{$price} ++; | |||
# } # for item @pricesort | |||
# | |||
# @valuesort = sort { $a <=> $b } keys %prices; | |||
# | |||
for $range (@ranges) { | |||
$last = undef; | |||
($low, $high) = @$range; | |||
$outfile = sprintf($outfile_f, $low, $high); | |||
# | |||
if(!open(OUT, "> $outfile")) { | |||
die "Can't open outfile $outfile: $!\n"; | |||
} | |||
# | |||
print OUT "==$low - $high==\n\n"; | |||
# | |||
$star = ""; | |||
for $item (@pricesort) { | |||
$price = $items{$item}; | |||
$name = $item; | |||
$name =~ s/_/ /g; | |||
$name =~ s/%(..)/pack('C',hex($1))/eg; | |||
# | |||
if (($price < $low) or ($price > $high)) { | |||
next; | |||
} | |||
# | |||
if(defined($last) and $last != $price) { | |||
printf OUT $tablee_f; | |||
printf OUT $tables_f, $price; | |||
$star = ""; | |||
} | |||
# | |||
if(!defined($last)) { | |||
printf OUT $tables_f, $price; | |||
} | |||
# | |||
print OUT "${star}[[$item|$name]]\n"; | |||
# | |||
$star = "&#42; "; | |||
$last = $price; | |||
} # for item @pricesort | |||
# | |||
printf OUT $tablee_f; | |||
# | |||
printf OUT "<table><tr><th>Items by autosell price</th></tr><tr>\n<td>"; | |||
$bar = ""; | |||
for $uri (@links) { | |||
if($uri eq $outfile) { | |||
print OUT "$bar $low - $high "; | |||
} else { | |||
$uri =~ m,(\d+)-(\d+)_,; | |||
print OUT "$bar [[Sandbox/$uri|$1 - $2]] "; | |||
} | |||
$bar = "|"; | |||
} # for uri @links | |||
print OUT "</td>\n</tr></table>\n\n"; | |||
# | |||
close OUT; | |||
# | |||
} # for range @range | |||
# | |||
--[[User:Club|Club]] 16:59, 17 August 2006 (CDT) |
Revision as of 01:30, 30 August 2006
Would a long-arse table be better?, worse?, or just distracting? --JRSiebz (☎|§|‡) 20:47, 22 June 2006 (CDT)
Item | Value |
---|---|
big rock | 1 |
disco ball | |
disco mask | |
dry noodles | |
helmet turtle | |
mariachi pants | |
etc... | |
... | ... |
bag of airline peanuts | 5 |
bar skin | |
calle de miel with a fly in it | |
clown hammer | |
crusty L-shaped piece of metal | |
etc... | |
... | ... |
- I don't like that at all. One table per value might work, I know I can code it up in html, but not wiki-ml.
--Club 13:09, 23 June 2006 (CDT)
Here's what I used to create this:
#!/usr/bin/perl -w # Benjamin Elijah Griffin "Club (#66669)" 17 Aug 2006 use strict; use vars qw( $urifile $pricesfile $outfile_f $tables_f $tablee_f %uris %items %prices %lc @pricesort @valuesort @ranges @links $p $item $file $uri $price $num $range $low $high $last $star $bar $name $outfile ); # # This file looks like: # %27Villa%27_document (tab) 'Villa'_document.html # 1.21_jigawatts (tab) 1_21_jigawatts.html # 100-Watt_bulb (tab) 100-Watt_bulb.html # The first column has the page name on the wiki, the second column is # the page name in my local stash. $urifile = "URIs"; # # This file looks like: # 100-Watt_bulb.html <tab> 75 # 1337_7r0uZ0RZ.html <tab> 130 # 1_21_jigawatts.html <tab> 75 # The first column has the page name in my local stash, the second column # has the price in meat. $pricesfile = "PRICES"; # $outfile_f = "Items_by_autosell_price_(%d-%d_Meat)"; $tables_f = "<table border=1 width='90%%' cellpadding=3 cellspacing=0><tr><th>%d Meat</th></tr><tr><td>\n"; $tablee_f = "</td></tr></table><br />\n\n"; # @ranges = ( [1, 25], [26, 50], [51, 75], [76, 100], [101, 150], [151, 50000], ); # for $range (@ranges) { ($low, $high) = @$range; $uri = sprintf($outfile_f, $low, $high); push(@links, $uri); } # for range @range # # if(!open(U,$urifile)) { die "Can't open $urifile -- $!\n"; } while(<U>) { chomp; ($uri, $file) = split(/\t/); $uris{$file} = $uri; } # while U close U; # if(!open(P,$pricesfile)) { die "Can't open $pricesfile -- $!\n"; } while(<P>) { chomp; ($file, $price) = split(/\t/); $uri = $uris{$file}; die "No uri for $file\n" unless defined($uri); $items{$uri} = $price; $lc{$uri} = lc($uri); } # while P close P; # @pricesort = sort { $p = $items{$a} <=> $items{$b}; if($p == 0) { $p = $lc{$a} cmp $lc{$b}; } $p } keys (%items); # # for $item (@pricesort) { # $price = $items{$item}; # $prices{$price} ++; # } # for item @pricesort # # @valuesort = sort { $a <=> $b } keys %prices; # for $range (@ranges) { $last = undef; ($low, $high) = @$range; $outfile = sprintf($outfile_f, $low, $high); # if(!open(OUT, "> $outfile")) { die "Can't open outfile $outfile: $!\n"; } # print OUT "==$low - $high==\n\n"; # $star = ""; for $item (@pricesort) { $price = $items{$item}; $name = $item; $name =~ s/_/ /g; $name =~ s/%(..)/pack('C',hex($1))/eg; # if (($price < $low) or ($price > $high)) { next; } # if(defined($last) and $last != $price) { printf OUT $tablee_f; printf OUT $tables_f, $price; $star = ""; } # if(!defined($last)) { printf OUT $tables_f, $price; } # print OUT "${star}[[$item|$name]]\n"; # $star = "* "; $last = $price; } # for item @pricesort # printf OUT $tablee_f; # printf OUT "<table><tr><th>Items by autosell price</th></tr><tr>\n<td>"; $bar = ""; for $uri (@links) { if($uri eq $outfile) { print OUT "$bar $low - $high "; } else { $uri =~ m,(\d+)-(\d+)_,; print OUT "$bar [[Sandbox/$uri|$1 - $2]] "; } $bar = "|"; } # for uri @links print OUT "</td>\n</tr></table>\n\n"; # close OUT; # } # for range @range #
--Club 16:59, 17 August 2006 (CDT)