Skip to content

Commit

Permalink
Update SQLite Data file to handle Resource Upgrades
Browse files Browse the repository at this point in the history
  • Loading branch information
rrgeorge committed Nov 30, 2017
1 parent 2e141bc commit 9a68242
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 73 deletions.
80 changes: 8 additions & 72 deletions android/app/src/main/assets/data.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Data version="2017-11-29@03-20">
<Data version="2017-11-29@03-29">
<ShipClassDetails>
<ShipClassDetail>
<Name>Galaxy Class</Name>
Expand Down Expand Up @@ -29340,36 +29340,12 @@ Switch the Primary Weapon Value and Agility Value of the target ship until the e
<Ability>This card can only be assigned to a ship that has a Captain with a printed Captain Skill of 5 or higher. ACTIVATION PHASE: Once per game round, after this ship executes a Non-Red Maneuver: Remove a [DISABLED] Token from 1 of the cards equipped to this ship.</Ability>
<Unique>Y</Unique>
<MirrorUniverseUnique>N</MirrorUniverseUnique>
<Type>Crew</Type>
<Faction>Independent</Faction>
<Cost>3</Cost>
<Id>captains_chair_c_72936r</Id>
<Set>72936r</Set>
<Special>Add_Crew_1</Special>
</Upgrade>
<Upgrade>
<Title>Captain's Chair</Title>
<Ability>This card can only be assigned to a ship that has a Captain with a printed Captain Skill of 5 or higher. ACTIVATION PHASE: Once per game round, after this ship executes a Non-Red Maneuver: Remove a [DISABLED] Token from 1 of the cards equipped to this ship.</Ability>
<Unique>Y</Unique>
<MirrorUniverseUnique>N</MirrorUniverseUnique>
<Type>Tech</Type>
<Faction>Independent</Faction>
<Cost>3</Cost>
<Id>captains_chair_t_72936r</Id>
<Set>72936r</Set>
<Special>addonetechslot</Special>
</Upgrade>
<Upgrade>
<Title>Captain's Chair</Title>
<Ability>This card can only be assigned to a ship that has a Captain with a printed Captain Skill of 5 or higher. ACTIVATION PHASE: Once per game round, after this ship executes a Non-Red Maneuver: Remove a [DISABLED] Token from 1 of the cards equipped to this ship.</Ability>
<Unique>Y</Unique>
<MirrorUniverseUnique>N</MirrorUniverseUnique>
<Type>Weapon</Type>
<Type>Resource</Type>
<Faction>Independent</Faction>
<Cost>3</Cost>
<Id>captains_chair_w_72936r</Id>
<Id>captains_chair_r_72936r</Id>
<Set>72936r</Set>
<Special>addoneweaponslot</Special>
<Special></Special>
</Upgrade>
<Upgrade>
<Title>Tal Shiar Sub-Commander</Title>
Expand Down Expand Up @@ -29509,56 +29485,16 @@ This ship gains the following:

2) Add an additional [TECH] to this ship's Upgrade Bar.

3)Increase the Captain Skill of the Captain assigned to this ship by +1.</Ability>
<Unique>Y</Unique>
<MirrorUniverseUnique>N</MirrorUniverseUnique>
<Type>Crew</Type>
<Faction>Independent</Faction>
<Cost>5</Cost>
<Id>front-line_retrofit_c_72941r</Id>
<Set>72941r</Set>
<Special>Add_Crew_1</Special>
</Upgrade>
<Upgrade>
<Title>Front-Line Retrofit</Title>
<Ability>This card can only be assigned to a ship that has a printed Hull Value of 3 or less.

This ship gains the following:

1) Increase this ship's Shield Value by +1.

2) Add an additional [TECH] to this ship's Upgrade Bar.

3)Increase the Captain Skill of the Captain assigned to this ship by +1.</Ability>
3) Increase the Captain Skill of the Captain assigned to this ship by +1.</Ability>
<Unique>Y</Unique>
<MirrorUniverseUnique>N</MirrorUniverseUnique>
<Type>Tech</Type>
<Type>Resource</Type>
<Faction>Independent</Faction>
<Cost>5</Cost>
<Id>front-line_retrofit_t_72941r</Id>
<Id>front-line_retrofit_r_72941r</Id>
<Set>72941r</Set>
<Special>addonetechslot</Special>
</Upgrade>
<Upgrade>
<Title>Front-Line Retrofit</Title>
<Ability>This card can only be assigned to a ship that has a printed Hull Value of 3 or less.

This ship gains the following:

1) Increase this ship's Shield Value by +1.

2) Add an additional [TECH] to this ship's Upgrade Bar.

3)Increase the Captain Skill of the Captain assigned to this ship by +1.</Ability>
<Unique>Y</Unique>
<MirrorUniverseUnique>N</MirrorUniverseUnique>
<Type>Weapon</Type>
<Faction>Independent</Faction>
<Cost>5</Cost>
<Id>front-line_retrofit_w_72941r</Id>
<Set>72941r</Set>
<Special>addoneweaponslot</Special>
</Upgrade>
</Upgrades>
<Resources>
<Resource>
Expand Down Expand Up @@ -30260,7 +30196,7 @@ This ship gains the following:

2) Add an additional [TECH] to this ship's Upgrade Bar.

3)Increase the Captain Skill of the Captain assigned to this ship by +1.</Ability>
3) Increase the Captain Skill of the Captain assigned to this ship by +1.</Ability>
<Cost>5</Cost>
<Id>front-line_retrofit_72941r</Id>
<Set>72941r</Set>
Expand Down
8 changes: 7 additions & 1 deletion scripts/dataxml2sqlite.pl
Original file line number Diff line number Diff line change
Expand Up @@ -227,13 +227,16 @@ sub upgrades {
$sth->execute;
$sth = $dbh->prepare("CREATE TABLE IF NOT EXISTS Squadron (id text,title text,uniq integer not null,faction integer not null,faction2 integer not null,cost integer not null,special text,ability blob,primary key(id asc))");
$sth->execute;
$sth = $dbh->prepare("CREATE TABLE IF NOT EXISTS ResourceUpgrade (id text,title text,uniq integer not null,faction integer not null,faction2 integer not null,cost integer not null,special text,ability blob,primary key(id asc))");
$sth->execute;
$sth = $dbh->prepare("CREATE TABLE IF NOT EXISTS Weapon (id text,title text,uniq integer not null,faction integer not null,faction2 integer not null,cost integer not null,attack integer not null,range text,special text,ability blob,primary key(id asc))");
$sth->execute;
my $sthe = $dbh->prepare("INSERT OR REPLACE INTO Talent VALUES(?,?,?,?,?,?,?,?)");
my $sthc = $dbh->prepare("INSERT OR REPLACE INTO Crew VALUES(?,?,?,?,?,?,?,?)");
my $stht = $dbh->prepare("INSERT OR REPLACE INTO Tech VALUES(?,?,?,?,?,?,?,?)");
my $sthb = $dbh->prepare("INSERT OR REPLACE INTO Borg VALUES(?,?,?,?,?,?,?,?)");
my $sths = $dbh->prepare("INSERT OR REPLACE INTO Squadron VALUES(?,?,?,?,?,?,?,?)");
my $sthru = $dbh->prepare("INSERT OR REPLACE INTO ResourceUpgrade VALUES(?,?,?,?,?,?,?,?)");
my $sthw = $dbh->prepare("INSERT OR REPLACE INTO Weapon VALUES(?,?,?,?,?,?,?,?,?,?)");
foreach my $u (@{$upgrades->{"Upgrade"}}) {
#print "Upgrade Found: ".$u->{"Title"}."(".$u->{"Type"}.")\n";
Expand Down Expand Up @@ -274,6 +277,9 @@ sub upgrades {
$sthb->execute(($u->{"Id"} or 0),($u->{"Title"} or 0),$unique,$faction,$faction2,($u->{"Cost"} or 0),($u->{"Special"}),($u->{"Ability"}));
} elsif ($u->{"Type"} eq "Squadron") {
$sths->execute(($u->{"Id"} or 0),($u->{"Title"} or 0),$unique,$faction,$faction2,($u->{"Cost"} or 0),($u->{"Special"}),($u->{"Ability"}));
} elsif ($u->{"Type"} eq "Resource") {
$sthru->execute(($u->{"Id"} or 0),($u->{"Title"} or 0),$unique,$faction,$faction2,($u->{"Cost"} or 0),($u->{"Special"}),($u->{"Ability"}));

} else {
print STDERR "Unknown upgrade type: ".$u->{"Type"}."\n";
print STDERR "\t".$u->{"Id"}.": ".$u->{"Title"}."\n";
Expand All @@ -290,7 +296,7 @@ sub upgrades {
}
}
}
foreach my $upgtype ("Talent","Tech","Crew","Borg","Squadron") {
foreach my $upgtype ("Talent","Tech","Crew","Borg","Squadron","ResourceUpgrade") {
my $sth_dup = $dbh->prepare("SELECT id FROM $upgtype where id not in (SELECT min(id) from $upgtype GROUP BY title,uniq,faction,faction2,cost,special,ability)");
$sth_dup->execute();
my $dup_id;
Expand Down
Binary file modified src/data.db
Binary file not shown.

0 comments on commit 9a68242

Please sign in to comment.