X-Git-Url: https://ruin.nu/git/?p=ndwebbie.git;a=blobdiff_plain;f=scripts%2Fstats.pl;fp=scripts%2Fstats.pl;h=ee12e933e2a4af0968638762127ce1086c887529;hp=d69d42cb6189c534c3c1844b1e4ef0b97538899a;hb=7ec7b824749bb077086f6eeeabe3be6ffad39c66;hpb=3dc80cedd5deba53a4082992de317fbc3acf805c diff --git a/scripts/stats.pl b/scripts/stats.pl index d69d42c..ee12e93 100755 --- a/scripts/stats.pl +++ b/scripts/stats.pl @@ -24,6 +24,7 @@ use strict; use warnings; use DBI; use DBD::Pg qw(:pg_types); +use Data::Dumper; use LWP::Simple qw/get $ua/; $ua->agent("Stupid user agent check is stupid"); @@ -32,22 +33,28 @@ use FindBin; use lib "$FindBin::Bin/../lib"; use ND::DB; +use NDWeb::Stats; our $dbh = ND::DB::DB(); -my %classes = (Fighter => 'Fi', Corvette => 'Co', Frigate => 'Fr', Destroyer => 'De', Cruiser => 'Cr', Battleship => 'Bs'); - -my $file = get("http://game.planetarion.com/manual.pl?page=stats"); +my $file = get("http://game.planetarion.com/manual.pl?action=statsxml"); $dbh->begin_work; -my $st = $dbh->prepare(q{INSERT INTO ship_stats (ship,"class",t1,t2,t3,"type",init,guns,armor,damage,eres,metal,crystal,eonium,race) VALUES(?,?,NULLIF(?,'-'),NULLIF(?,'-'),NULLIF(?,'-'),?,?,?,?,?,?,?,?,?,?)}); -while ($file =~ /class="(\w+)">