Skip to content

Commit 9062cee

Browse files
matthewhillierReidWeb
authored andcommitted
#19 Adding in variables for Scholar, Red Mage and Samurai and updating the parse order to match the Lodestone update
1 parent 4abf99a commit 9062cee

File tree

1 file changed

+101
-25
lines changed

1 file changed

+101
-25
lines changed

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

Lines changed: 101 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,12 @@
33
import com.mashape.unirest.http.HttpResponse;
44
import com.mashape.unirest.http.JsonNode;
55
import com.mashape.unirest.http.Unirest;
6-
import com.mashape.unirest.http.exceptions.UnirestException;
76
import org.jsoup.Jsoup;
87
import org.jsoup.nodes.Document;
98
import org.jsoup.nodes.Element;
109
import org.jsoup.select.Elements;
1110

1211
import java.io.IOException;
13-
import java.net.MalformedURLException;
1412
import java.text.DateFormat;
1513
import java.text.ParseException;
1614
import java.text.SimpleDateFormat;
@@ -57,6 +55,9 @@ public class Player {
5755
private int lvlDarkKnight;
5856
private int lvlMachinist;
5957
private int lvlAstrologian;
58+
private int lvlScholar;
59+
private int lvlRedMage;
60+
private int lvlSamurai;
6061
private int lvlCarpenter;
6162
private int lvlBlacksmith;
6263
private int lvlArmorer;
@@ -532,6 +533,60 @@ public void setLvlAstrologian(int lvlAstrologian) {
532533
this.lvlAstrologian = lvlAstrologian;
533534
}
534535

536+
/**
537+
* Get the player's scholar level.
538+
*
539+
* @return the player's scholar level
540+
*/
541+
public int getLvlScholar() {
542+
return lvlScholar;
543+
}
544+
545+
/**
546+
* Sets the player's scholar level.
547+
*
548+
* @param lvlScholar the player's scholar level
549+
*/
550+
public void setLvlScholar(int lvlScholar) {
551+
this.lvlScholar = lvlScholar;
552+
}
553+
554+
/**
555+
* Get the player's red mage level.
556+
*
557+
* @return the player's red mage level.
558+
*/
559+
public int getLvlRedMage() {
560+
return lvlRedMage;
561+
}
562+
563+
/**
564+
* Sets the player's red mage level.
565+
*
566+
* @param lvlRedMage the player's red mage level.
567+
*/
568+
public void setLvlRedMage(int lvlRedMage) {
569+
this.lvlRedMage = lvlRedMage;
570+
}
571+
572+
/**
573+
* Gets the player's samurai level.
574+
*
575+
* @return the player's samurai level.
576+
*/
577+
public int getLvlSamurai() {
578+
return lvlSamurai;
579+
}
580+
581+
/**
582+
* Sets the player's samurai level.
583+
*
584+
* @param lvlSamurai the player's samurai level.
585+
*/
586+
public void setLvlSamurai(int lvlSamurai) {
587+
this.lvlSamurai = lvlSamurai;
588+
}
589+
535590
/**
536591
* Get the player's carpenter level.
537592
*
@@ -1764,33 +1819,53 @@ public String getMountsString(){
17641819

17651820
/**
17661821
* Set player class levels.
1822+
*
1823+
* As of 4.0, this is now parsed in the order:
1824+
* - Gladiator
1825+
* - Marauder
1826+
* - Dark Knight
1827+
* - Monk
1828+
* - Dragoon
1829+
* - Ninja
1830+
* - Samurai
1831+
* - White Mage
1832+
* - Scholar
1833+
* - Astrologian
1834+
* - Bard
1835+
* - Machinist
1836+
* - Black Mage
1837+
* - Summoner
1838+
* - Red Mage
17671839
*
17681840
* @param arrLevels integer array of classes in order displayed on lodestone.
17691841
*/
17701842
public void setLevels(int[] arrLevels) {
17711843
this.setLvlGladiator(arrLevels[0]);
1772-
this.setLvlPugilist(arrLevels[1]);
1773-
this.setLvlMarauder(arrLevels[2]);
1774-
this.setLvlLancer(arrLevels[3]);
1775-
this.setLvlArcher(arrLevels[4]);
1844+
this.setLvlMarauder(arrLevels[1]);
1845+
this.setLvlDarkKnight(arrLevels[2]);
1846+
this.setLvlPugilist(arrLevels[3]);
1847+
this.setLvlLancer(arrLevels[4]);
17761848
this.setLvlRogue(arrLevels[5]);
1777-
this.setLvlConjurer(arrLevels[6]);
1778-
this.setLvlThaumaturge(arrLevels[7]);
1779-
this.setLvlArcanist(arrLevels[8]);
1780-
this.setLvlDarkKnight(arrLevels[9]);
1781-
this.setLvlMachinist(arrLevels[10]);
1782-
this.setLvlAstrologian(arrLevels[11]);
1783-
this.setLvlCarpenter(arrLevels[12]);
1784-
this.setLvlBlacksmith(arrLevels[13]);
1785-
this.setLvlArmorer(arrLevels[14]);
1786-
this.setLvlGoldsmith(arrLevels[15]);
1787-
this.setLvlLeatherworker(arrLevels[16]);
1788-
this.setLvlWeaver(arrLevels[17]);
1789-
this.setLvlAlchemist(arrLevels[18]);
1790-
this.setLvlCulinarian(arrLevels[19]);
1791-
this.setLvlMiner(arrLevels[20]);
1792-
this.setLvlBotanist(arrLevels[21]);
1793-
this.setLvlFisher(arrLevels[22]);
1849+
this.setLvlSamurai(arrLevels[6]);
1850+
this.setLvlConjurer(arrLevels[7]);
1851+
this.setLvlScholar(arrLevels[8]);
1852+
this.setLvlAstrologian(arrLevels[9]);
1853+
this.setLvlArcher(arrLevels[10]);
1854+
this.setLvlMachinist(arrLevels[11]);
1855+
this.setLvlThaumaturge(arrLevels[12]);
1856+
this.setLvlArcanist(arrLevels[13]);
1857+
this.setLvlRedMage(arrLevels[14]);
1858+
this.setLvlCarpenter(arrLevels[15]);
1859+
this.setLvlBlacksmith(arrLevels[16]);
1860+
this.setLvlArmorer(arrLevels[17]);
1861+
this.setLvlGoldsmith(arrLevels[18]);
1862+
this.setLvlLeatherworker(arrLevels[19]);
1863+
this.setLvlWeaver(arrLevels[20]);
1864+
this.setLvlAlchemist(arrLevels[21]);
1865+
this.setLvlCulinarian(arrLevels[22]);
1866+
this.setLvlMiner(arrLevels[23]);
1867+
this.setLvlBotanist(arrLevels[24]);
1868+
this.setLvlFisher(arrLevels[25]);
17941869
}
17951870

17961871
/**
@@ -2092,8 +2167,9 @@ private static int[] getLevelsFromPage(Document doc) throws Exception {
20922167
}
20932168

20942169
//Check if levels array is larger than this system is programmed for
2095-
if (arrLevels.length > 23) {
2096-
throw new Exception("Error: More class levels found than anticipated (23). The class definitions need to be updated.");
2170+
// As of 4.0, this is now 26 - SCH and SMN are 2 jobs, + SAM & RDM
2171+
if (arrLevels.length > 26) {
2172+
throw new Exception("Error: More class levels found (" + arrLevels.length + ") than anticipated (26). The class definitions need to be updated.");
20972173
}
20982174

20992175
return arrLevels;

0 commit comments

Comments
 (0)