package Commods;
use IO::File;
+use IO::Pipe;
use HTTP::Request::Common ();
use POSIX;
use LWP::UserAgent;
&pipethrough_run_gzip &http_useragent &version_core
&http_useragent_string_map
&cgipostform &yarrgpostform &cgi_get_caller
- &set_ctype_utf8 $masterinfoversion);
+ &set_ctype_utf8 $masterinfoversion
+ &source_tarball);
%EXPORT_TAGS = ( );
@EXPORT_OK = qw();
}
-our $masterinfoversion= 2; # version we understand
+our $masterinfoversion= 2; # version we understand.
+#
+# To extend the source-info.txt format:
+#
+# * Commods.pm:parse_info1
+# add code to parse new version
+#
+# * source-info.txt
+# add new information
+#
+# If new data should NOT be in master-info.txt too:
+#
+# * update-master-info:process_some_info
+# check that code for converting source-info to master-info
+# removes the extra info; add code to remove it if necessary
+#
+# * db-idempotent-populate
+# if database schema is extended, add code to copy data
+#
+# If new data DOES need to be in master-info.txt too:
+#
+# * Commods.pm:$masterinfoversion
+# increment
+#
+# * update-master-info:process_some_info
+# add code to convert new version to old, by removing
+# extra info conditionally depending on version
our %oceans; # eg $oceans{'Midnight'}{'Ruby'}{'Eta Island'}= $sources;
our %clients; # eg $clients{'ypp-sc-tools'}= [ qw(last-page) ];
return $ua;
}
+sub source_tarball ($$) {
+ my ($sourcebasedir,$spitoutfn) = @_;
+
+ my $pipe= new IO::Pipe or die $!;
+ my $pid= fork(); defined $pid or die $!;
+ if (!$pid) {
+ $ENV{'YPPSC_YARRG_SRCBASE'}= $sourcebasedir;
+ $pipe->writer();
+ exec '/bin/sh','-c','
+ cd -P "$YPPSC_YARRG_SRCBASE"
+ (
+ git-ls-files -z;
+ git-ls-files -z --others --exclude-from=.gitignore;
+ if test -d .git; then find .git -print0; fi
+ ) | (
+ cpio -Hustar -o --quiet -0 -R 1000:1000 || \
+ cpio -Hustar -o --quiet -0
+ ) | gzip
+ ';
+ die $!;
+ }
+ $pipe->reader();
+
+ my ($d, $l);
+ while ($l= read $pipe, $d, 65536) {
+ $spitoutfn->($d);
+ }
+ waitpid $pid,0;
+ defined $l or die "read pipe $!";
+ $pipe->error and die "pipe error $!";
+ close $pipe;
+ # deliberately ignore errors
+}
+
1;
-
# This is part of ypp-sc-tools, a set of third-party tools for assisting
# players of Yohoho Puzzle Pirates.
#
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
+# The parts of the code used for the website (including the web/
+# directory and the rs*.[ch] which make up the routesearch program)
+# are released instead under the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
CFLAGS += $(WARNINGS) $(WERROR) $(OPTIMISE) $(DEBUG)
-TARGETS= yarrg
+TARGETS_CLIENT= yarrg
+TARGETS_SERVER= routesearch
+TARGETS= $(TARGETS_CLIENT) $(TARGETS_SERVER)
-default: clean-other-directory $(TARGETS)
-all: default routesearch
+default: clean-other-directory client
+client: $(TARGETS_CLIENT)
+server: $(TARGETS_SERVER)
+all: client server
CONVERT_OBJS= convert.o ocr.o pages.o structure.o rgbimage.o resolve.o
COMMON_OBJS= common.o
This program is free software: you can redistribute it and/or modify
it under the terms of
- (a) for the website code, the GNU Affero General Public License and
+ (a) for the website code including the route searcher,
+ the GNU Affero General Public License and
(b) for the rest of the code, GNU General Public License
as published by the Free Software Foundation, either version 3 of
each applicable the License, or (at your option) any later version.
return if @v <= $c;
my ($price,$qty) = @v[$c..$c+1];
return if !length($price) && !length($qty);
+ die "$price ?" unless $price =~ m/^\d/;
die "$_ ?" unless length($price) && length($qty);
$commod{$commod}{$bs}{$stall}= {
Stall => $stall,
chomp;
@v= split /\t/;
#print STDERR "[".join("|",@v)."]\n";
+ foreach (@v[2..$#v]) {
+ s/\,//g;
+ die "$_ ?" if m/.\D/;
+ }
($commod,$stall) = @v;
bs_read(Buy, 2);
bs_read(Sell, 4);
}
}
-sub write_tsv ($) {
- my ($f) = @_;
+sub write_tsv ($$) {
+ my ($f,$showhold) = @_;
foreach $commod (sort keys %commod) {
$current= $commod{$commod};
my %stalls;
printf($f "%s\t%s", $commod, $stall) or die $!;
bs_p_tsv($f, Buy);
bs_p_tsv($f, Sell);
+ if ($showhold && $commod{$commod}{Hold}) {
+ printf($f "\t%s", $commod{$commod}{Hold}) or die $!;
+ }
print($f "\n") or die $!;
}
}
}
sub main__tsv () {
- write_tsv(\*STDOUT);
+ write_tsv(\*STDOUT,1);
}
$o{'timestamp'}= $ENV{'YPPSC_DATA_TIMESTAMP'} or die;
my $tf= pipethrough_prep();
- write_tsv($tf);
+ write_tsv($tf,0);
my $oz= pipethrough_run_gzip($tf);
$o{'data'}= [ undef, 'deduped.tsv.gz',
Content_Type => 'application/octet-stream',
# This script is invoked when the yarrg client uploads to
# the chiark database.
-# This is part of ypp-sc-tools, a set of third-party tools for assisting
-# players of Yohoho Puzzle Pirates.
+# This is part of the YARRG website. YARRG is a tool and website
+# for assisting players of Yohoho Puzzle Pirates.
#
# Copyright (C) 2009 Ian Jackson <ijackson@chiark.greenend.org.uk>
#
# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
+# GNU Affero General Public License for more details.
#
-# You should have received a copy of the GNU General Public License
+# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# Yohoho and Puzzle Pirates are probably trademarks of Three Rings and
my $re_any= "^(.*)\$";
-parse_info_serverside();
-
sub fail ($) {
my ($msg) = @_;
addlog("failing $msg");
my %o;
+if (param('get_source')) {
+ header('application/octet-stream');
+ source_tarball('..', sub { print $_[0] or die $!; });
+ exit 0;
+}
+
+parse_info_serverside();
+
my $midtmp= "_mid-pid$$.hold";
open MIDTMP, ">$midtmp" or die "$midtmp $!";
stat MIDTMP or die $!;
#
# usage: ./db-idempotent-populate <Oceanname>
# creates or updates OCEAN-Oceanname.db
-# from master-master.txt
+# from source-info.txt
-# This is part of ypp-sc-tools, a set of third-party tools for assisting
-# players of Yohoho Puzzle Pirates.
+# This is part of the YARRG website. YARRG is a tool and website
+# for assisting players of Yohoho Puzzle Pirates.
#
# Copyright (C) 2009 Ian Jackson <ijackson@chiark.greenend.org.uk>
#
# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
+# GNU Affero General Public License for more details.
#
-# You should have received a copy of the GNU General Public License
+# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# Yohoho and Puzzle Pirates are probably trademarks of Three Rings and
# This script is invoked when the yarrg wants to send an update to the
# dictionary server. See README.privacy.
-# This is part of ypp-sc-tools, a set of third-party tools for assisting
-# players of Yohoho Puzzle Pirates.
+# This is part of the YARRG website. YARRG is a tool and website
+# for assisting players of Yohoho Puzzle Pirates.
#
# Copyright (C) 2009 Ian Jackson <ijackson@chiark.greenend.org.uk>
#
# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
+# GNU Affero General Public License for more details.
#
-# You should have received a copy of the GNU General Public License
+# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# Yohoho and Puzzle Pirates are probably trademarks of Three Rings and
# are used without permission. This program is not endorsed or
# sponsored by Three Rings.
-
# upload testing runes:
#
# YPPSC_YARRG_DICT_UPDATE=./ YPPSC_YARRG_DICT_SUBMIT=./ ./yarrg --ocean midnight --pirate aristarchus --find-island --same --raw-tsv >raw.tsv
use Commods;
+if (param('get_source')) {
+ header('application/octet-stream');
+ source_tarball('..', sub { print $_[0] or die $!; });
+ exit 0;
+}
+
my $aadepth=2;
#---------- pixmaps ----------
+++ /dev/null
-use glpk's standalone solver with cplex input, see
- glpk refman.ps.gz p84 for example
-don't use it own modelling language which is very complex
-
-Math::LP would be nice but depends on Math::LP::Solve which is not in
- Debian.
-
#!/usr/bin/perl -w
+# This is part of the YARRG website. YARRG is a tool and website
+# for assisting players of Yohoho Puzzle Pirates.
+#
+# Copyright (C) 2009 Ian Jackson <ijackson@chiark.greenend.org.uk>
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+# Yohoho and Puzzle Pirates are probably trademarks of Three Rings and
+# are used without permission. This program is not endorsed or
+# sponsored by Three Rings.
+
use strict (qw(vars));
use CommodsDatabase;
+/*
+ * Route searcher - common definitions
+ */
+/*
+ * This is part of the YARRG website, a tool for assisting
+ * players of Yohoho Puzzle Pirates.
+ *
+ * Copyright (C) 2009 Ian Jackson <ijackson@chiark.greenend.org.uk>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Yohoho and Puzzle Pirates are probably trademarks of Three Rings and
+ * are used without permission. This program is not endorsed or
+ * sponsored by Three Rings.
+ */
+
#ifndef RSCOMMON_H
#define RSCOMMON_H
-/**/
+/*
+ * Route searcher - command line parsing and result printing
+ */
+/*
+ * This is part of the YARRG website, a tool for assisting
+ * players of Yohoho Puzzle Pirates.
+ *
+ * Copyright (C) 2009 Ian Jackson <ijackson@chiark.greenend.org.uk>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Yohoho and Puzzle Pirates are probably trademarks of Three Rings and
+ * are used without permission. This program is not endorsed or
+ * sponsored by Three Rings.
+ */
#include "rscommon.h"
-/**/
+/*
+ * Route searcher - recursive iteration over all routes
+ */
+/*
+ * This is part of the YARRG website, a tool for assisting
+ * players of Yohoho Puzzle Pirates.
+ *
+ * Copyright (C) 2009 Ian Jackson <ijackson@chiark.greenend.org.uk>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Yohoho and Puzzle Pirates are probably trademarks of Three Rings and
+ * are used without permission. This program is not endorsed or
+ * sponsored by Three Rings.
+ */
#include "rscommon.h"
+/*
+ * Route searcher - database helper functions
+ */
+/*
+ * This is part of the YARRG website, a tool for assisting
+ * players of Yohoho Puzzle Pirates.
+ *
+ * Copyright (C) 2009 Ian Jackson <ijackson@chiark.greenend.org.uk>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Yohoho and Puzzle Pirates are probably trademarks of Three Rings and
+ * are used without permission. This program is not endorsed or
+ * sponsored by Three Rings.
+ */
#include "rscommon.h"
-/**/
+/*
+ * Route searcher - route evaluation
+ */
+/*
+ * This is part of the YARRG website, a tool for assisting
+ * players of Yohoho Puzzle Pirates.
+ *
+ * Copyright (C) 2009 Ian Jackson <ijackson@chiark.greenend.org.uk>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Yohoho and Puzzle Pirates are probably trademarks of Three Rings and
+ * are used without permission. This program is not endorsed or
+ * sponsored by Three Rings.
+ */
#include <glpk.h>
Fixpt alpha_mean= fixpt_mul(alpha_total, one_third);
Fixpt thresh= dbl2fixpt(1.5/AAMAXVAL);
- Fixpt alpha_min= alpha_mean - thresh*2;
- Fixpt alpha_max= alpha_mean + thresh*2;
-
- for (i=0; i<3; i++)
- MUST( alpha_min <= alpha[i] && alpha[i] <= alpha_max,
- MP(p);
- MRGB(here);MRGB(aa_background);MRGB(aa_foreground);
- MFP(aa_alpha_mean_max);MFP(thresh);MFP(alpha_mean);
- MFP(alpha_min);MI(i);MFP(alpha[i]);MFP(alpha_max) );
MUST( -thresh <= alpha_mean && alpha_mean <= aa_alpha_mean_max + thresh,
MP(p);
# ./update-master-info -b -d ~ftp/users/ijackson/yarrg/ -a
# ./update-master-info -b -d ~ftp/users/ijackson/yarrg/ -O ...
-# This is part of ypp-sc-tools, a set of third-party tools for assisting
-# players of Yohoho Puzzle Pirates.
+# This is part of the YARRG website. YARRG is a tool and website
+# for assisting players of Yohoho Puzzle Pirates.
#
# Copyright (C) 2009 Ian Jackson <ijackson@chiark.greenend.org.uk>
#
# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
+# GNU Affero General Public License for more details.
#
-# You should have received a copy of the GNU General Public License
+# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# Yohoho and Puzzle Pirates are probably trademarks of Three Rings and
elsif (s/^( $fqtyrex ) \s* t \s+ //xo) { $def->(0, $1 * 1000.0 ); }
elsif (s/^( $fqtyrex ) \s* l \s+ //xo) { $def->(1, $1 ); }
elsif (s/^( $fqtyrex ) \s* kl \s+ //xo) { $def->(1, $1 * 1000.0 ); }
- elsif (s/^( $iqtyrex ) \s* ([a-z ]+) \s+ //xo) {
+ elsif (s/^( $iqtyrex ) \s* ([a-z ]+) \s+ //ixo) {
my ($qty,$spec) = ($1,$2);
$debugf->("VALUE COMMOD $qty '$spec'");
expected_error("Capacity specification must start with".
$_ *= $pct / 100.0;
}
push @canon, sprintf "%g%%", $pct;
- } elsif (!m/[^a-z]/) {
+ } elsif (!m/[^a-z]/i) {
$debugf->("TERM NAME");
expected_error("Name (should be unit or commodity) \`$_'".
" without preceding quantity")
dbw_lookup_string($_,$sth,1,1,2,
"Ship name `$_' not understood.",
"Too many matching ship types.",
- sub { "Ambiguous - could be $_[0]" });
+ sub { "Ambiguous - could be $_[1]" });
expected_error($emsg) if defined $emsg;
$debugf->("TERM NAME SHIP '$ship' @smv");
$show_answer= 1;
$first_term= 0;
};
-while ($string =~ s/^(.*?)(\bminus\b|-|\bplus\b|\+)//) {
+while ($string =~ s/^(.*?)(\bminus\b|-|\bplus\b|\+)//i) {
my ($lhs)= ($1);
my @nextsign= $2 =~ m/^p|^\+/ ? (+1,'+') : (-1,'-');
$show_answer= 1;
</%doc>
<html lang="en"><head>
<title>YARRG (Yet Another Revenue Research Gatherer)</title>
+<link rel="stylesheet" type="text/css" href="style.css">
</head><body>
+<div class="navoptbar">
<a href="lookup">YARRG</a> -
Yet Another Revenue Research Gatherer
|
<a href="docs">documentation</a>
|
<b>development</b>
+</div>
+<div class="docs">
<h1>YARRG development, contribution and troubleshooting</h1>
YARRG is Free Software - you may share and modify it. See the
licences for details. Not only the client but also the website code
-is Free. The yarrg client, support files, and so forth are under
-the GNU GPL (v3 or later); the website is under the GNU Affero GPL (v3
-or later).
+is Free. The yarrg client, support files, and so forth are under the
+GNU GPL (v3 or later); the website and database backend is under the
+GNU Affero GPL (v3 or later).
<p>
an up-to-date of its actually-running source code. So this link
gives you the source code for the pages you are now looking at.
-<h3>YARRG lookup website instances</h3>
+<h3>YARRG website code instances</h3>
+
+<h4>Lookup website</h4>
<ul>
- <li><a href="http://yarrg.chiark.net/">Main released site</a>
- <li><a href="http://yarrg.chiark.net/test/data">Released code; testing database instance (updated with yarrg --test-servers)</a>
- <li><a href="http://yarrg.chiark.net/test/code">Testing version of the site code</a>
- <li><a href="http://yarrg.chiark.net/test/both">Testing code running against the testing database instance</a>
+ <li><a href="http://yarrg.chiark.net/">Main released site</a>,
+ with <a href="http://yarrg.chiark.net/source.tar.gz">source code</a>
+ <li><a href="http://yarrg.chiark.net/test/data">Released code; testing database instance (updated with yarrg --test-servers)</a> (source code as above)
+ <li><a href="http://yarrg.chiark.net/test/code">Testing version of the site code</a>,
+ with <a href="http://yarrg.chiark.net/test/source.tar.gz">source code</a>
+ <li><a href="http://yarrg.chiark.net/test/both">Testing code running against the testing database instance</a> (source code as above)
</ul>
-Each of these allows you to download its own source code so you
-can get both the testing and the main version of the website.
-
<p>
You can add the form parameter <kbd>?debug=1</kbd> to each of the
-above to get a version of the site with debugging output enabled.
+website URLs above to get a version of the site with debugging output enabled.
+
+<h4>Database and dictionary update receiver</h4>
+
+On the live system there are different trees, potentially with
+different versions, for receiving updates and managing the database,
+to the ones for displaying the website. The database management trees
+are normally accessed only via the upload client but you may also
+download their source directly:
+
+ <ul>
+ <li><a href="http://upload.yarrg.chiark.net/commod-update-receiver?get_source=1">Main production instance</a>
+ <li><a href="http://upload.yarrg.chiark.net/test/commod-update-receiver?get_source=1">Testing database instance</a>
+ </ul>
<h3>Data</h3>
any Fleet Officer or above of the crew Special Circumstances on the
Midnight Ocean.
+</div>
<& footer, isdevel => 1 &>
</%doc>
<html lang="en"><head><title>Website documentation - YARRG</title>
+<link rel="stylesheet" type="text/css" href="style.css">
</head><body>
+<div class="navoptbar">
<a href="lookup">YARRG</a> -
Yet Another Revenue Research Gatherer
|
<b>documentation</b>
|
<a href="devel">development</a>
+</div>
+<div class="docs">
<h1>Looking up data in YARRG</h1>
sail them to C to sell for 20 PoE each even if such a trade would in
fact be possible. In practice this is unlikely to be a problem!
+</div>
<& footer &>
$qa => undef
</%args>
% if (!$qa || $qa->{'debug'}) {
-<table frame=box rules=all>
+<table class="data" frame=box rules=all>
<tr>
% foreach my $field (@$cols) {
<th><% $field |h %>
</%doc>
<html lang="en"><head>
<title>YARRG (Yet Another Revenue Research Gatherer)</title>
+<link rel="stylesheet" type="text/css" href="style.css">
</head><body>
+<div class="navoptbar">
<a href="lookup">YARRG</a> -
Yet Another Revenue Research Gatherer
|
<a href="docs">documentation</a>
|
<a href="devel">development</a>
-
+</div>
+<div class="docs">
<h1>Introduction to YARRG</h1>
YARRG (Yet Another Revenue Research Gatherer) is a third-party tool
<h2>Uploading from Linux</h2>
-The YARRG upload client uploads both to YARRG and to the
-<a href="http://pctb.ilk.org/">PCTB testing server</a>.
+The YARRG upload client uploads both to YARRG and
+<a href="http://pctb.crabdance.com/">PCTB</a>.
<p>
any Fleet Officer or above of the crew Special Circumstances on the
Midnight Ocean.
+</div>
<& footer &>
<html lang="en"><head><title><% ucfirst $ahtml{Query} %> - YARRG</title>
<style type="text/css">
-body {
- color: #000000;
- background: #ffffff;
-}
-tr.datarow0 { background: #e3e3e3; }
-tr.datarow1 { background: #ffffff; }
+<& style.css &>
+ body { color: #000000; background: #c5c7ae; }
+ div.query { background: #d7d8b3; padding: 1em; }
+ div.results { padding: 1em; }
+ table.data { background: #b5b686; }
+ tr.datarow0 { background: #e3e3e3; }
+ tr.datarow1 { background: #ffffff; }
</style>
<&| script &>
function register_onload(f) {
</head><body>
% if (!printable($m)) {
+<div class="navoptbar">
<a href="<% $m->current_comp()->name() |u %>">YARRG</a> -
Yet Another Revenue Research Gatherer
|
</%args>
% if (!printable($m)) {
+</div>
<hr>
% }
<& "query_$styles{Query}", %baseqf, %queryqf, %styles,
- quri => $quri, dbh => $dbh, queryqf => \%queryqf, allargs => \%ARGS,
+ quri => $quri, dbh => $dbh,
+ baseqf => \%baseqf, queryqf => \%queryqf, allargs => \%ARGS,
prselector => $prselector,
someresults => $someresults,
emsgokorprint => sub {
}
&>
-<p>
-
%#---------- debugging and epilogue ----------
% if ($debug) {
-<p>
+<div class="results">
<pre id="debug_log">
Debug log:
</pre>
+</div>
% }
<&| script &>
$sth->execute();
</%perl>
+<div class="results">
<& SELF:pageload &>
<%method pageload>
$now
$fetchrow
</%args>
-<table id="ts_table">
+<table class="data" id="ts_table" rules="groups">
<tr>
<th>Archipelago
<th>Island
<th>Age
-</tr>
% my $row;
% my %da_ages;
% my %ts_sortkeys;
<& "lookup:formhidden", ours => sub { 0; } &>
</form>
+</div>
<%init>
use POSIX;
use CommodsWeb;
my $qa= \%ARGS;
</%perl>
+<div class="query">
<h1>Commodity enquiry</h1>
% $prselector->('BuySell');
</form>
%#========== results ==========
+</div>
+<div class="results">
<%perl>
$emsgokorprint->($emsg) or $cmid=undef;
-return unless defined $cmid;
+print("</div>"), return
+ unless defined $cmid;
$someresults->();
#---------- actually compute the results and print them ----------
% my $rowix= 0;
% while ($island= $islands->fetchrow_hashref) {
% if (!$rowix) {
-<table id="<% $bs %>_table" rules=groups>
+<table class="data" id="<% $bs %>_table" rules=groups>
<colgroup span=2>
<colgroup span=1>
<colgroup span=2>
<%perl>
}
</%perl>
+</div>
my $qa= \%ARGS;
</%perl>
+<div class="query">
<h1>Prices for commodity at location(s)</h1>
% $prselector->('BuySell');
<& "lookup:formhidden", ours => $ours &>
</form>
+</div>
+<div class="results">
%#========== results ==========
<%perl>
$emsgokorprint->($emsg) or $cmid=undef;
-return unless defined $cmid and @islandids;
+print("</div>"), return
+ unless defined $cmid and @islandids;
foreach my $wf (@warningfs) { $wf->(); }
</%perl>
% while ($row= $sth->fetchrow_arrayref) {
% if (!$rowix) {
-<table id="<% $bs %>_table" rules=groups>
+<table class="data" id="<% $bs %>_table" rules=groups>
<colgroup span=2>
<colgroup span=3>
<colgroup span=1>
pointlessly overload our server. Instead, see our
<a href="devel">information for developers</a>
to find out how to get testing data or a real-time feed.)
+
+</div>
</%perl>
-<h1>Specify route</h1>
-
% # Sadly we need to do this rather hacky thing to make it be a POST
% # form if the user has already selected some thing(s)
% if (!$qa->{Dropdowns}) {
% } (0..$qa->{Dropdowns}-1));
% }
+<div class="query">
+
+<h1>Specify route</h1>
+
% $prselector->('ShowStalls');
<& enter_route, qa => $qa, dbh => $dbh, emsg_r => \$emsg,
% };
<& "lookup:formhidden", ours => $ours &>
+</div>
+<div class="results">
<%perl>
#========== results ==========
routeparams => $routeparams
&>
% }
+</div>
</form>
<%args>
$quri
$dbh
+$baseqf
$queryqf
$islandstring => '';
$capacitystring => '';
</%perl>
+<div class="query">
<h1>Find most profitable routes and trades</h1>
% if ($qa->{Dropdowns}) {
% }
</form>
+</div>
+<div class="results">
<%perl>
if (!$emsg && $maxdist > $maxmaxdist) {
" supported, sorry.";
}
-$emsgokorprint->($emsg) or return;
-@islandids or return;
-$allargs->{'submit'} or return;
-defined $routeparams->{MaxMass} or defined $routeparams->{MaxVolume} or return;
+print("</div>"), return
+ unless $emsgokorprint->($emsg)
+ and @islandids
+ and $allargs->{'submit'}
+ and (defined $routeparams->{MaxMass} or
+ defined $routeparams->{MaxVolume});
#---------- prepare island names ----------
for ($i=1; $i < @i-1; $i++) {
push @{ $item->{Vias} }, $i[$i];
}
- my %linkqf= %$queryqf;
+ my %linkqf= (%$baseqf, %$queryqf);
delete $linkqf{'query'};
$linkqf{'routestring'}= join ', ', @fi;
$item->{Url}= $quri->(%linkqf);
% } else {
<h2>Best routes for profit per league</h2>
% }
-<table rules=groups id="ap<% $ap %>_table">
+<table class="data" rules=groups id="ap<% $ap %>_table">
<colgroup span=2>
<colgroup span=1>
<colgroup span=1>
<th>Start
<th>Via
<th>Finish
-<tr>
<tr id="ap<% $ap %>_sortrow"><th><th><th><th><th><th><th>
% my $datarow=0;
% my %sortkeys;
to be sailed. All profit figures are somewhat approximate; get a
complete trading plan for a route for accurate information.
-<%perl>
-
-
-</%perl>
+</div>
%
<h2><a name="plan">Voyage trading plan</a></h2>
-<table rules=groups <% printable($m) ? 'width=100%' : '' %> >
+<table class="data" rules=groups <% printable($m) ? 'width=100%' : '' %> >
% my $tbody= sub {
% if (!printable($m)) { return '<tbody>'; }
%# return "<tr><td colspan=7><hr>";
% my $cdspan= $qa->{ShowStalls} ? ' colspan=2' : '';
% my $cdstall= $qa->{ShowStalls} ? '<th>Stall</th>' : '';
<h2><a name="trades">Relevant trades</a></h2>
-<table id="trades" rules=groups>
+<table class="data" id="trades" rules=groups>
<colgroup span=1>
<colgroup span=2>
<% $qa->{ShowStalls} ? '<colgroup span=2>' : '' %>
throw => 'trades_sort', tbrow => 'trades_total' &>
ts_sortkeys= <% to_json_protecttags(\%ts_sortkeys) %>;
</&tabsort>
-
+<p>
<input type=submit name=update value="Update">
% } # !printable
</%doc><%flags>
inherit => undef
</%flags><%perl>
-use IO::Pipe;
use CommodsWeb;
+use Commods;
$r->content_type('application/octet-stream');
$m->flush_buffer();
-$ENV{'YPPSC_YARRG_SRCBASE'}= sourcebasedir();
-my $pipe= new IO::Pipe or die $!;
-my $pid= fork(); defined $pid or die $!;
-if (!$pid) {
- $pipe->writer();
- exec '/bin/sh','-c','
- cd -P "$YPPSC_YARRG_SRCBASE"
- (
- git-ls-files -z;
- git-ls-files -z --others --exclude-from=.gitignore;
- if test -d .git; then find .git -print0; fi
- ) | (
- cpio -Hustar -o --quiet -0 -R 1000:1000 || \
- cpio -Hustar -o --quiet -0
- ) | gzip
- ';
- die $!;
-}
-$pipe->reader();
-
-my ($d, $l);
-while ($l= read $pipe, $d, 65536) {
- print $d;
+source_tarball(sourcebasedir(), sub {
+ print $_[0];
$m->flush_buffer();
-}
-waitpid $pid,0;
-defined $l or die "read pipe $!";
-$pipe->error and die "pipe error $!";
-close $pipe;
-# deliberately ignore errors
+})
</%perl>
--- /dev/null
+<%doc>
+
+ This is part of the YARRG website. YARRG is a tool and website
+ for assisting players of Yohoho Puzzle Pirates.
+
+ Copyright (C) 2009 Ian Jackson <ijackson@chiark.greenend.org.uk>
+ Copyright (C) 2009 Clare Boothby
+
+ YARRG's client code etc. is covered by the ordinary GNU GPL (v3 or later).
+ The YARRG website is covered by the GNU Affero GPL v3 or later, which
+ basically means that every installation of the website will let you
+ download the source.
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as
+ published by the Free Software Foundation, either version 3 of the
+ License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+ Yohoho and Puzzle Pirates are probably trademarks of Three Rings and
+ are used without permission. This program is not endorsed or
+ sponsored by Three Rings.
+
+
+ This Mason component generates the top-level stylesheet which applies
+ to everything including lookups and documentation.
+
+</%doc>
+<%flags>
+inherit => undef
+</%flags>
+<%init>
+$r->content_type('text/css')
+ if $m->callers(-1) == $m->callers(0);
+</%init>
+
+ body { margin: 0; }
+ div.navoptbar { padding: 1em; background: #e0e0ff; }
+ address { background: #d7d8b3; padding: 1em; }
+ div.docs { padding: 1em; }
+ hr { display: none; }
# helper program for getting information from yppedia
-# This is part of ypp-sc-tools, a set of third-party tools for assisting
-# players of Yohoho Puzzle Pirates.
+# This is part of the YARRG website. YARRG is a tool and website
+# for assisting players of Yohoho Puzzle Pirates.
#
# Copyright (C) 2009 Ian Jackson <ijackson@chiark.greenend.org.uk>
#
# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
+# GNU Affero General Public License for more details.
#
-# You should have received a copy of the GNU General Public License
+# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# Yohoho and Puzzle Pirates are probably trademarks of Three Rings and