From 57664b818861ce04c4237d8f69af3bd47e815090 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Fri, 25 Dec 2009 18:58:57 +0000 Subject: [PATCH 1/1] WIP gem limit: commodity flags in database --- yarrg/Commods.pm | 3 +++ yarrg/db-idempotent-populate | 5 ++++- yarrg/source-info.txt | 18 +++++++++--------- 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/yarrg/Commods.pm b/yarrg/Commods.pm index 9178112..af03a64 100644 --- a/yarrg/Commods.pm +++ b/yarrg/Commods.pm @@ -207,6 +207,7 @@ sub parse_info1 ($$$) { $commods{$ucname}{Srcs} .= $ss; my $c= $commods{$ucname}; $c->{Volume}= 1000; + $c->{Flags}= ''; my ($ordval, $ordclassval); foreach my $prop (defined $props ? split /\s+/, $props : ()) { if ($prop =~ m/^([1-9]\d*)(k?)g$/) { @@ -220,6 +221,8 @@ sub parse_info1 ($$$) { } elsif ($prop =~ m/^\@(\d+\+?)$/) { $ordval= $1; $ordval =~ s/^(\d+)\+$/ $1 + $lnoix * 10 /e; + } elsif ($prop =~ m/^\!([a-z]+)$/) { + $c->{Flags} .= $prop; } else { die "unknown property $prop for $ucname"; } diff --git a/yarrg/db-idempotent-populate b/yarrg/db-idempotent-populate index bb0448c..eb1a30b 100755 --- a/yarrg/db-idempotent-populate +++ b/yarrg/db-idempotent-populate @@ -229,6 +229,7 @@ table_maycompact('commods', 'commodid', commodclassid INTEGER NOT NULL ordval INTEGER NOT NULL posinclass INTEGER NOT NULL + flags TEXT NOT NULL END table_maycompact('islands', 'islandid', @@ -343,6 +344,7 @@ END commodclassid ordval posinclass + flags ); my $insert= $dbh->prepare(" INSERT OR IGNORE INTO $table{commods} @@ -370,7 +372,8 @@ END $c->{Volume}, $clid, commodsortkey($commod), - $posincl{$commod} + $posincl{$commod}, + $c->{Flags} ); $insert->execute($commod, @valuevalues); $update->execute(@valuevalues, $commod); diff --git a/yarrg/source-info.txt b/yarrg/source-info.txt index effc221..d591ac0 100644 --- a/yarrg/source-info.txt +++ b/yarrg/source-info.txt @@ -120,15 +120,15 @@ commods persimmon @200000+ commods - %g gems 10kg *forageables @0 - diamonds 10kg *forageables @200000+ - emeralds 10kg *forageables @200000+ - moonstones 10kg *forageables @200000+ - opals 10kg *forageables @200000+ - pearls 10kg *forageables @200000+ - rubies 10kg *forageables @200000+ - sapphires 10kg *forageables @200000+ - topazes 10kg *forageables @200000+ + %g gems 10kg !g *forageables @0 + diamonds 10kg !g *forageables @200000+ + emeralds 10kg !g *forageables @200000+ + moonstones 10kg !g *forageables @200000+ + opals 10kg !g *forageables @200000+ + pearls 10kg !g *forageables @200000+ + rubies 10kg !g *forageables @200000+ + sapphires 10kg !g *forageables @200000+ + topazes 10kg !g *forageables @200000+ %g amber @200000+ -- 2.30.2