Talk:Items by autosell price (1-25 Meat): Difference between revisions

From A KoL Wiki
imported>Dehstil
m move comment
imported>Club
remove version 1 script, add link to version 2 script
Line 52: Line 52:


Here's what I used to create this:
Here's what I used to create this:
 
''<nowiki>[</nowiki>version 1 script removed, no one cares and it stretches the page out (22:25, 12 October 2011 (CEST))<nowiki>]</nowiki>''
  #!/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 &lt;tab&gt; 75
  #  1337_7r0uZ0RZ.html &lt;tab&gt; 130
  #  1_21_jigawatts.html &lt;tab&gt; 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 = "&lt;table border=1 width='90%%' cellpadding=3 cellspacing=0&gt;&lt;tr&gt;&lt;th&gt;%d Meat&lt;/th&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;\n";
  $tablee_f = "&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;br /&gt;\n\n";
  #
  @ranges = (
    &#91;1, 25&#93;,
    &#91;26, 50&#93;,
    &#91;51, 75&#93;,
    &#91;76, 100&#93;,
    &#91;101, 150&#93;,
    &#91;151, 50000&#93;,
  );
  #
  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(&lt;U&gt;) {
    chomp;
    ($uri, $file) = split(/\t/);
    $uris{$file} = $uri;
  } # while U
  close U;
  #
  if(!open(P,$pricesfile)) {
    die "Can't open $pricesfile -- $!\n";
  }
  while(&lt;P&gt;) {
    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} &lt;=&gt; $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 &lt;=&gt; $b } keys %prices;
  #
  for $range (@ranges) {
    $last = undef;
    ($low, $high) = @$range;
    $outfile = sprintf($outfile_f, $low, $high);
    #
    if(!open(OUT, "&gt; $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 &lt; $low) or ($price &gt; $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}&#91;&#91;$item|$name&#93;&#93;\n";
      #
      $star = "&amp;#42; ";
      $last = $price;
    } # for item @pricesort
    #
    printf OUT $tablee_f;
    #
    printf OUT "&lt;table&gt;&lt;tr&gt;&lt;th&gt;Items by autosell price&lt;/th&gt;&lt;/tr&gt;&lt;tr&gt;\n&lt;td&gt;";
    $bar = "";
    for $uri (@links) {
      if($uri eq $outfile) {
        print OUT "$bar $low - $high ";
      } else {
        $uri =~ m,(\d+)-(\d+)_,;
        print OUT "$bar &#91;&#91;Sandbox/$uri|$1 - $2&#93;&#93; ";
      }
      $bar = "|";
    } # for uri @links
    print OUT "&lt;/td&gt;\n&lt;/tr&gt;&lt;/table&gt;\n\n";
    #
    close OUT;
    #
  } # for range @range
  #
 
--[[User:Club|Club]] 16:59, 17 August 2006 (CDT)
--[[User:Club|Club]] 16:59, 17 August 2006 (CDT)
*Here's the version 2 [http://www.panix.com/~eli/kol/AutosellPages.pl autosell page script]. No longer uses a strange file format I made up, but uses a KoL Mafia data file. --{{User:Club/sig}} 22:25, 12 October 2011 (CEST)

Revision as of 20:25, 12 October 2011

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.
1 Meat
big rock disco ball disco mask dry noodles
helmet turtle mariachi pants oriole-feather headdress pasta spoon
ravioli hat saucepan scroll of turtle summoning scrumptious reagent
seal tooth spices stolen accordion tortoise's blessing

--Club 13:09, 23 June 2006 (CDT)


Here's what I used to create this: [version 1 script removed, no one cares and it stretches the page out (22:25, 12 October 2011 (CEST))] --Club 16:59, 17 August 2006 (CDT)