Skip to content

Commit c2dc07a

Browse files
authored
Merge pull request #7 from Pricetx/master
Added check for 3.3 completion (Wind-up Aymeric)
2 parents 94993b1 + 0c1f00e commit c2dc07a

4 files changed

Lines changed: 87 additions & 49 deletions

File tree

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,9 @@ The database table ```tblplayers``` has the following structure:
170170
|sahagin |bit |Mount - Cavalry Elbst |
171171
|amaljaa |bit |Mount - Cavalry Drake |
172172
|sylph |bit |Mount - Laurel Goobbue |
173-
|hw_complete |bit |Mount - Midgardsormr |
173+
|hw_complete |bit |Mount - Midgardsormr |
174174
|hw_31_complete |bit |Minion - Wind-up Haurchefant |
175+
|hw_33_complete |bit |Minion - Wind-up Aymeric |
175176
|legacy_player |bit |Mount - Legacy Chocobo |
176177
|*mounts* |*text* |*N/A* |
177178
|*minions* |*text* |*N/A* |

src/main/java/com/ffxivcensus/gatherer/GathererController.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ private void createTable(String tableName) {
336336
sbSQL.append("soundtrack BIT,saweternalbond BIT,sightseeing BIT,comm50 BIT,moogleplush BIT,");
337337
sbSQL.append("hildibrand BIT, dideternalbond BIT, arrcollector BIT,");
338338
sbSQL.append("kobold BIT, sahagin BIT, amaljaa BIT, sylph BIT,");
339-
sbSQL.append("arr_25_complete BIT,hw_complete BIT, hw_31_complete BIT, legacy_player BIT");
339+
sbSQL.append("arr_25_complete BIT,hw_complete BIT, hw_31_complete BIT, hw_33_complete BIT, legacy_player BIT");
340340
}
341341
if (this.storeMounts) {
342342
sbSQL.append(",mounts TEXT");
@@ -486,12 +486,13 @@ protected String writeToDB(Player player) {
486486
+ player.getBitHasMooglePlush() + ",");
487487

488488
sbFields.append("hildibrand, ps4collectors, dideternalbond, arrcollector, kobold, sahagin, amaljaa, "
489-
+ "sylph, hw_complete, hw_31_complete, legacy_player");
489+
+ "sylph, hw_complete, hw_31_complete, hw_33_complete, legacy_player");
490490
sbValues.append(player.getBitHasCompletedHildibrand() + "," + player.getBitHasPS4Collectors() + ","
491491
+ player.getBitHasEternalBond() + "," + player.getBitHasARRCollectors() + ","
492492
+ player.getBitHasKobold() + "," + player.getBitHasSahagin() + "," + player.getBitHasAmaljaa()
493493
+ "," + player.getBitHasSylph() + "," + player.getBitHasCompletedHW() + ","
494-
+ player.getBitHasCompleted3pt1() + "," + player.getBitIsLegacyPlayer());
494+
+ player.getBitHasCompleted3pt1() + "," + player.getBitHasCompleted3pt3() + ","
495+
+ player.getBitIsLegacyPlayer());
495496

496497
}
497498

src/main/java/com/ffxivcensus/gatherer/Player.java

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ public class Player {
8282
private boolean hasSylph;
8383
private boolean hasCompletedHW;
8484
private boolean hasCompleted3pt1;
85+
private boolean hasCompleted3pt3;
8586
private boolean isLegacyPlayer;
8687
private ArrayList minions;
8788
private ArrayList mounts;
@@ -152,6 +153,7 @@ public Player(int id) {
152153
setHasSylph(false);
153154
setHasCompletedHW(false);
154155
setHasCompleted3pt1(false);
156+
setHasCompleted3pt3(false);
155157
}
156158

157159
/**
@@ -1623,6 +1625,37 @@ public void setHasCompleted3pt1(boolean hasCompleted3pt1) {
16231625
this.hasCompleted3pt1 = hasCompleted3pt1;
16241626
}
16251627

1628+
/**
1629+
* Get whether the user has completed the 3.3 story.
1630+
*
1631+
* @return whether the user has completed the 3.3 story.
1632+
*/
1633+
public boolean isHasCompleted3pt3() {
1634+
return hasCompleted3pt3;
1635+
}
1636+
1637+
/**
1638+
* Get bit value whether the user has completed the 3.3 story.
1639+
*
1640+
* @return bit value
1641+
*/
1642+
public int getBitHasCompleted3pt3() {
1643+
if (hasCompleted3pt3) {
1644+
return 1;
1645+
} else {
1646+
return 0;
1647+
}
1648+
}
1649+
1650+
/**
1651+
* Set whether the user has completed the 3.3 story.
1652+
*
1653+
* @param hasCompleted3pt3 whether the user has completed the 3.3 story.
1654+
*/
1655+
public void setHasCompleted3pt3(boolean hasCompleted3pt3) {
1656+
this.hasCompleted3pt3 = hasCompleted3pt3;
1657+
}
1658+
16261659
/**
16271660
* Get whether the user played 1.0.
16281661
*
@@ -1823,6 +1856,7 @@ public static Player getPlayer(int playerID) throws Exception {
18231856
player.setHasCompletedHildibrand(player.doesPlayerHaveMinion("Wind-up Gentleman"));
18241857
player.setHasPS4Collectors(player.doesPlayerHaveMinion("Wind-up Moogle"));
18251858
player.setHasCompleted3pt1(player.doesPlayerHaveMinion("Wind-up Haurchefant"));
1859+
player.setHasCompleted3pt3(player.doesPlayerHaveMinion("Wind-up Aymeric"));
18261860
player.setHasEternalBond(player.doesPlayerHaveMount("Ceremony Chocobo"));
18271861
player.setHasARRCollectors(player.doesPlayerHaveMount("Coeurl"));
18281862
player.setHasKobold(player.doesPlayerHaveMount("Bomb Palanquin"));

src/test/java/com/ffxivcensus/gatherer/GathererControllerTest.java

Lines changed: 47 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
* @since v1.0
3131
*/
3232
public class GathererControllerTest {
33+
3334
/**
3435
* The JDBC URL of the database to modify
3536
*/
@@ -54,42 +55,10 @@ public class GathererControllerTest {
5455
private final ByteArrayOutputStream outContent = new ByteArrayOutputStream();
5556
private final ByteArrayOutputStream errContent = new ByteArrayOutputStream();
5657

57-
@org.junit.Before
58-
public void setUpStreams() {
59-
System.setOut(new PrintStream(outContent));
60-
System.setErr(new PrintStream(errContent));
61-
}
62-
63-
@org.junit.After
64-
public void cleanUpStreams() {
65-
System.setOut(null);
66-
System.setErr(null);
67-
}
68-
69-
/**
70-
* Before running drop the table.
71-
*/
7258
@BeforeClass
7359
public static void setUpBaseClass() {
7460
try {
7561
readConfig();
76-
StringBuilder sbSQL = new StringBuilder();
77-
//DROP existing test tables
78-
sbSQL.append("DROP TABLE tblplayers_test;");
79-
sbSQL.append("DROP TABLE tblplayers_test_two;");
80-
81-
for (String strRealm : GathererController.getRealms()) {
82-
sbSQL.append("DROP TABLE " + strRealm + ";");
83-
}
84-
85-
java.sql.Connection conn = openConnection();
86-
try {
87-
Statement stmt = conn.createStatement();
88-
stmt.executeUpdate(sbSQL.toString());
89-
} catch (SQLException e) {
90-
91-
}
92-
closeConnection(conn);
9362

9463
} catch (ParserConfigurationException e) {
9564
e.printStackTrace();
@@ -98,7 +67,38 @@ public static void setUpBaseClass() {
9867
} catch (SAXException e) {
9968
e.printStackTrace();
10069
}
70+
}
10171

72+
/**
73+
* Before running each test, drop tables and pipe output into buffer
74+
*/
75+
@org.junit.Before
76+
public void setUpDB() {
77+
System.setOut(new PrintStream(outContent));
78+
System.setErr(new PrintStream(errContent));
79+
StringBuilder sbSQL = new StringBuilder();
80+
//DROP existing test tables
81+
sbSQL.append("DROP TABLE tblplayers_test;");
82+
sbSQL.append("DROP TABLE tblplayers_test_two;");
83+
84+
for (String strRealm : GathererController.getRealms()) {
85+
sbSQL.append("DROP TABLE " + strRealm + ";");
86+
}
87+
88+
java.sql.Connection conn = openConnection();
89+
try {
90+
Statement stmt = conn.createStatement();
91+
stmt.executeUpdate(sbSQL.toString());
92+
} catch (SQLException e) {
93+
94+
}
95+
closeConnection(conn);
96+
}
97+
98+
@org.junit.After
99+
public void cleanUpStreams() {
100+
System.setOut(null);
101+
System.setErr(null);
102102
}
103103

104104
/**
@@ -113,7 +113,7 @@ public void testRunBasic() throws IOException, SAXException, ParserConfiguration
113113
int startId = 11886902;
114114
int endId = 11887010;
115115
GathererController gathererController = new GathererController(startId, endId);
116-
gathererController.setTableName("tblplayers_test");
116+
gathererController.setTableName("tblplayers_test_3");
117117
try {
118118
gathererController.run();
119119
} catch (Exception e) {
@@ -161,7 +161,8 @@ public void testRunBasicInvalidParams() {
161161
}
162162

163163
/**
164-
* Perform a test run of GathererController with values passed in via constructor.
164+
* Perform a test run of GathererController with values passed in via
165+
* constructor.
165166
*/
166167
@org.junit.Test
167168
public void testRunAdvancedOptions() {
@@ -196,7 +197,8 @@ public void testRunAdvancedOptions() {
196197
}
197198

198199
/**
199-
* Invoke a test run in which the single characters table is being split across several tables, one for each realm.
200+
* Invoke a test run in which the single characters table is being split
201+
* across several tables, one for each realm.
200202
*
201203
* Also testing non-verbose mode, debug output (print non-existant records).
202204
*/
@@ -205,7 +207,7 @@ public void testRunSplitTables() {
205207
int startId = 1557260;
206208
int endId = 1558260;
207209

208-
GathererController gathererController = new GathererController(startId, endId, false, true, false, true, false, dbHost, dbName, dbUser, dbPassword, 71, "_test", true);
210+
GathererController gathererController = new GathererController(startId, endId, false, true, false, false, false, dbHost, dbName, dbUser, dbPassword, 71, "_test", true);
209211
try {
210212
gathererController.run();
211213
} catch (Exception e) {
@@ -224,7 +226,6 @@ public void testRunSplitTables() {
224226
ArrayList addedIDsMoogle = getAdded(conn, strSQLMoogle);
225227
closeConnection(conn);
226228

227-
228229
//Test for IDs we know exist in cerberus (realm of startID char)
229230
assertTrue(addedIDsCerberus.contains(startId));
230231
assertTrue(addedIDsCerberus.contains(1557648));
@@ -294,7 +295,6 @@ public void testRunMisconfiguredTwo() {
294295
}
295296

296297
//Utility methods
297-
298298
/**
299299
* Open a connection to database.
300300
*
@@ -329,9 +329,10 @@ private static void closeConnection(java.sql.Connection conn) {
329329
/**
330330
* Read configuration from config.xml
331331
*
332-
* @throws ParserConfigurationException Indicates a serious configuration error.
333-
* @throws IOException Indicates an error reading the file specified.
334-
* @throws SAXException Indicates an error parsing XML.
332+
* @throws ParserConfigurationException Indicates a serious configuration
333+
* error.
334+
* @throws IOException Indicates an error reading the file specified.
335+
* @throws SAXException Indicates an error parsing XML.
335336
*/
336337
public static void readConfig() throws ParserConfigurationException, IOException, SAXException {
337338
//Set config file location
@@ -357,7 +358,7 @@ public static void readConfig() throws ParserConfigurationException, IOException
357358
/**
358359
* Execute a SQL query and return the results.
359360
*
360-
* @param conn the SQL connection to use.
361+
* @param conn the SQL connection to use.
361362
* @param strSQL the SQL statement to execute.
362363
* @return the result set of added rows.
363364
*/
@@ -376,9 +377,10 @@ public static ResultSet executeStatement(Connection conn, String strSQL) {
376377
}
377378

378379
/**
379-
* Get an array list containing the added IDs returned by executing a SQL statement.
380+
* Get an array list containing the added IDs returned by executing a SQL
381+
* statement.
380382
*
381-
* @param conn the SQL connection to use.
383+
* @param conn the SQL connection to use.
382384
* @param strSQL the SQL statement to execute
383385
* @return an array list of the IDs successfully added to DB.
384386
*/
@@ -396,4 +398,4 @@ public static ArrayList getAdded(Connection conn, String strSQL) {
396398
}
397399
return addedIDs;
398400
}
399-
}
401+
}

0 commit comments

Comments
 (0)