|
3 | 3 | import com.mashape.unirest.http.HttpResponse; |
4 | 4 | import com.mashape.unirest.http.JsonNode; |
5 | 5 | import com.mashape.unirest.http.Unirest; |
6 | | -import com.mashape.unirest.http.exceptions.UnirestException; |
7 | 6 | import org.jsoup.Jsoup; |
8 | 7 | import org.jsoup.nodes.Document; |
9 | 8 | import org.jsoup.nodes.Element; |
10 | 9 | import org.jsoup.select.Elements; |
11 | 10 |
|
12 | 11 | import java.io.IOException; |
13 | | -import java.net.MalformedURLException; |
14 | 12 | import java.text.DateFormat; |
15 | 13 | import java.text.ParseException; |
16 | 14 | import java.text.SimpleDateFormat; |
@@ -57,6 +55,9 @@ public class Player { |
57 | 55 | private int lvlDarkKnight; |
58 | 56 | private int lvlMachinist; |
59 | 57 | private int lvlAstrologian; |
| 58 | + private int lvlScholar; |
| 59 | + private int lvlRedMage; |
| 60 | + private int lvlSamurai; |
60 | 61 | private int lvlCarpenter; |
61 | 62 | private int lvlBlacksmith; |
62 | 63 | private int lvlArmorer; |
@@ -532,6 +533,60 @@ public void setLvlAstrologian(int lvlAstrologian) { |
532 | 533 | this.lvlAstrologian = lvlAstrologian; |
533 | 534 | } |
534 | 535 |
|
| 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 | + |
535 | 590 | /** |
536 | 591 | * Get the player's carpenter level. |
537 | 592 | * |
@@ -1764,33 +1819,53 @@ public String getMountsString(){ |
1764 | 1819 |
|
1765 | 1820 | /** |
1766 | 1821 | * 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 |
1767 | 1839 | * |
1768 | 1840 | * @param arrLevels integer array of classes in order displayed on lodestone. |
1769 | 1841 | */ |
1770 | 1842 | public void setLevels(int[] arrLevels) { |
1771 | 1843 | 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]); |
1776 | 1848 | 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]); |
1794 | 1869 | } |
1795 | 1870 |
|
1796 | 1871 | /** |
@@ -2092,8 +2167,9 @@ private static int[] getLevelsFromPage(Document doc) throws Exception { |
2092 | 2167 | } |
2093 | 2168 |
|
2094 | 2169 | //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."); |
2097 | 2173 | } |
2098 | 2174 |
|
2099 | 2175 | return arrLevels; |
|
0 commit comments