@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) ];
-
# 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.
+unticking trades doesn't work?!
+
+
UPLOADER
--------
#
# 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.
+++ /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.
-
+/*
+ * 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>
</%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>
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
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>
% }
}
&>
-<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>
</%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 ----------
% } 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
--- /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; }