http-api: update for boss hiscores

This leaves Callisto and Cerberus commented out as they are currently
not being returned by the hiscores
This commit is contained in:
Adam
2019-12-06 16:08:30 -05:00
parent 3e19d45673
commit 9ae4e772a4
4 changed files with 305 additions and 51 deletions

View File

@@ -65,6 +65,49 @@ public class HiscoreResult
private Skill clueScrollElite;
private Skill clueScrollMaster;
private Skill lastManStanding;
private Skill abyssalSire;
private Skill alchemicalHydra;
private Skill barrowsChests;
private Skill bryophyta;
private Skill callisto;
private Skill cerberus;
private Skill chambersOfXeric;
private Skill chambersOfXericChallengeMode;
private Skill chaosElemental;
private Skill chaosFanatic;
private Skill commanderZilyana;
private Skill corporealBeast;
private Skill crazyArchaeologist;
private Skill dagannothPrime;
private Skill dagannothRex;
private Skill dagannothSupreme;
private Skill derangedArchaeologist;
private Skill generalGraardor;
private Skill giantMole;
private Skill grotesqueGuardians;
private Skill hespori;
private Skill kalphiteQueen;
private Skill kingBlackDragon;
private Skill kraken;
private Skill kreearra;
private Skill krilTsutsaroth;
private Skill mimic;
private Skill obor;
private Skill sarachnis;
private Skill scorpia;
private Skill skotizo;
private Skill gauntlet;
private Skill corruptedGauntlet;
private Skill theatreOfBlood;
private Skill thermonuclearSmokeDevil;
private Skill tzKalZuk;
private Skill tzTokJad;
private Skill venenatis;
private Skill vetion;
private Skill vorkath;
private Skill wintertodt;
private Skill zalcano;
private Skill zulrah;
public Skill getSkill(HiscoreSkill skill)
{
@@ -140,8 +183,94 @@ public class HiscoreResult
return getClueScrollMaster();
case LAST_MAN_STANDING:
return getLastManStanding();
case ABYSSAL_SIRE:
return abyssalSire;
case ALCHEMICAL_HYDRA:
return alchemicalHydra;
case BARROWS_CHESTS:
return barrowsChests;
case BRYOPHYTA:
return bryophyta;
case CALLISTO:
return callisto;
case CERBERUS:
return cerberus;
case CHAMBERS_OF_XERIC:
return chambersOfXeric;
case CHAMBERS_OF_XERIC_CHALLENGE_MODE:
return chambersOfXericChallengeMode;
case CHAOS_ELEMENTAL:
return chaosElemental;
case CHAOS_FANATIC:
return chaosFanatic;
case COMMMANDER_ZILYANA:
return commanderZilyana;
case CORPOREAL_BEAST:
return corporealBeast;
case CRAZY_ARCHAEOLOGIST:
return crazyArchaeologist;
case DAGANNOTH_PRIME:
return dagannothPrime;
case DAGANNOTH_REX:
return dagannothRex;
case DAGANNOTH_SUPREME:
return dagannothSupreme;
case DERANGED_ARCHAEOLOGIST:
return derangedArchaeologist;
case GENERAL_GRAARDOR:
return generalGraardor;
case GIANT_MOLE:
return giantMole;
case GROTESQUE_GUARDIANS:
return grotesqueGuardians;
case HESPORI:
return hespori;
case KALPHITE_QUEEN:
return kalphiteQueen;
case KING_BLACK_DRAGON:
return kingBlackDragon;
case KRAKEN:
return kraken;
case KREEARRA:
return kreearra;
case KRIL_TSUTSAROTH:
return krilTsutsaroth;
case MIMIC:
return mimic;
case OBOR:
return obor;
case SARACHNIS:
return sarachnis;
case SCORPIA:
return scorpia;
case SKOTIZO:
return skotizo;
case THE_GAUNTLET:
return gauntlet;
case THE_CORRUPTED_GAUNTLET:
return corruptedGauntlet;
case THEATRE_OF_BLOOD:
return theatreOfBlood;
case THERMONUCLEAR_SMOKE_DEVIL:
return thermonuclearSmokeDevil;
case TZKAL_ZUK:
return tzKalZuk;
case TZTOK_JAD:
return tzTokJad;
case VENENATIS:
return venenatis;
case VETION:
return vetion;
case VORKATH:
return vorkath;
case WINTERTODT:
return wintertodt;
case ZALCANO:
return zalcano;
case ZULRAH:
return zulrah;
default:
throw new IllegalArgumentException("Invalid hiscore skill");
}
throw new IllegalArgumentException("Invalid hiscore item");
}
}

View File

@@ -27,7 +27,7 @@ package net.runelite.http.api.hiscore;
import java.util.ArrayList;
import java.util.List;
public class HiscoreResultBuilder
class HiscoreResultBuilder
{
private String player;
private final List<Skill> skills = new ArrayList<>();
@@ -37,7 +37,7 @@ public class HiscoreResultBuilder
this.player = player;
}
public void setNextSkill(Skill skill)
void setNextSkill(Skill skill)
{
skills.add(skill);
}
@@ -51,41 +51,85 @@ public class HiscoreResultBuilder
{
HiscoreResult hiscoreResult = new HiscoreResult();
hiscoreResult.setPlayer(player);
hiscoreResult.setOverall(skills.get(0));
hiscoreResult.setAttack(skills.get(1));
hiscoreResult.setDefence(skills.get(2));
hiscoreResult.setStrength(skills.get(3));
hiscoreResult.setHitpoints(skills.get(4));
hiscoreResult.setRanged(skills.get(5));
hiscoreResult.setPrayer(skills.get(6));
hiscoreResult.setMagic(skills.get(7));
hiscoreResult.setCooking(skills.get(8));
hiscoreResult.setWoodcutting(skills.get(9));
hiscoreResult.setFletching(skills.get(10));
hiscoreResult.setFishing(skills.get(11));
hiscoreResult.setFiremaking(skills.get(12));
hiscoreResult.setCrafting(skills.get(13));
hiscoreResult.setSmithing(skills.get(14));
hiscoreResult.setMining(skills.get(15));
hiscoreResult.setHerblore(skills.get(16));
hiscoreResult.setAgility(skills.get(17));
hiscoreResult.setThieving(skills.get(18));
hiscoreResult.setSlayer(skills.get(19));
hiscoreResult.setFarming(skills.get(20));
hiscoreResult.setRunecraft(skills.get(21));
hiscoreResult.setHunter(skills.get(22));
hiscoreResult.setConstruction(skills.get(23));
hiscoreResult.setLeaguePoints(skills.get(24));
hiscoreResult.setBountyHunterHunter(skills.get(25));
hiscoreResult.setBountyHunterRogue(skills.get(26));
hiscoreResult.setClueScrollAll(skills.get(27));
hiscoreResult.setClueScrollBeginner(skills.get(28));
hiscoreResult.setClueScrollEasy(skills.get(29));
hiscoreResult.setClueScrollMedium(skills.get(30));
hiscoreResult.setClueScrollHard(skills.get(31));
hiscoreResult.setClueScrollElite(skills.get(32));
hiscoreResult.setClueScrollMaster(skills.get(33));
hiscoreResult.setLastManStanding(skills.get(34));
int index = 0;
hiscoreResult.setOverall(skills.get(index++));
hiscoreResult.setAttack(skills.get(index++));
hiscoreResult.setDefence(skills.get(index++));
hiscoreResult.setStrength(skills.get(index++));
hiscoreResult.setHitpoints(skills.get(index++));
hiscoreResult.setRanged(skills.get(index++));
hiscoreResult.setPrayer(skills.get(index++));
hiscoreResult.setMagic(skills.get(index++));
hiscoreResult.setCooking(skills.get(index++));
hiscoreResult.setWoodcutting(skills.get(index++));
hiscoreResult.setFletching(skills.get(index++));
hiscoreResult.setFishing(skills.get(index++));
hiscoreResult.setFiremaking(skills.get(index++));
hiscoreResult.setCrafting(skills.get(index++));
hiscoreResult.setSmithing(skills.get(index++));
hiscoreResult.setMining(skills.get(index++));
hiscoreResult.setHerblore(skills.get(index++));
hiscoreResult.setAgility(skills.get(index++));
hiscoreResult.setThieving(skills.get(index++));
hiscoreResult.setSlayer(skills.get(index++));
hiscoreResult.setFarming(skills.get(index++));
hiscoreResult.setRunecraft(skills.get(index++));
hiscoreResult.setHunter(skills.get(index++));
hiscoreResult.setConstruction(skills.get(index++));
hiscoreResult.setLeaguePoints(skills.get(index++));
hiscoreResult.setBountyHunterHunter(skills.get(index++));
hiscoreResult.setBountyHunterRogue(skills.get(index++));
hiscoreResult.setClueScrollAll(skills.get(index++));
hiscoreResult.setClueScrollBeginner(skills.get(index++));
hiscoreResult.setClueScrollEasy(skills.get(index++));
hiscoreResult.setClueScrollMedium(skills.get(index++));
hiscoreResult.setClueScrollHard(skills.get(index++));
hiscoreResult.setClueScrollElite(skills.get(index++));
hiscoreResult.setClueScrollMaster(skills.get(index++));
hiscoreResult.setLastManStanding(skills.get(index++));
hiscoreResult.setAbyssalSire(skills.get(index++));
hiscoreResult.setAlchemicalHydra(skills.get(index++));
hiscoreResult.setBarrowsChests(skills.get(index++));
hiscoreResult.setBryophyta(skills.get(index++));
// hiscoreResult.setCallisto(skills.get(index++));
// hiscoreResult.setCerberus(skills.get(index++));
hiscoreResult.setChambersOfXeric(skills.get(index++));
hiscoreResult.setChambersOfXericChallengeMode(skills.get(index++));
hiscoreResult.setChaosElemental(skills.get(index++));
hiscoreResult.setChaosFanatic(skills.get(index++));
hiscoreResult.setCommanderZilyana(skills.get(index++));
hiscoreResult.setCorporealBeast(skills.get(index++));
hiscoreResult.setCrazyArchaeologist(skills.get(index++));
hiscoreResult.setDagannothPrime(skills.get(index++));
hiscoreResult.setDagannothRex(skills.get(index++));
hiscoreResult.setDagannothSupreme(skills.get(index++));
hiscoreResult.setDerangedArchaeologist(skills.get(index++));
hiscoreResult.setGeneralGraardor(skills.get(index++));
hiscoreResult.setGiantMole(skills.get(index++));
hiscoreResult.setGrotesqueGuardians(skills.get(index++));
hiscoreResult.setHespori(skills.get(index++));
hiscoreResult.setKalphiteQueen(skills.get(index++));
hiscoreResult.setKingBlackDragon(skills.get(index++));
hiscoreResult.setKraken(skills.get(index++));
hiscoreResult.setKreearra(skills.get(index++));
hiscoreResult.setKrilTsutsaroth(skills.get(index++));
hiscoreResult.setMimic(skills.get(index++));
hiscoreResult.setObor(skills.get(index++));
hiscoreResult.setSarachnis(skills.get(index++));
hiscoreResult.setScorpia(skills.get(index++));
hiscoreResult.setSkotizo(skills.get(index++));
hiscoreResult.setGauntlet(skills.get(index++));
hiscoreResult.setCorruptedGauntlet(skills.get(index++));
hiscoreResult.setTheatreOfBlood(skills.get(index++));
hiscoreResult.setThermonuclearSmokeDevil(skills.get(index++));
hiscoreResult.setTzKalZuk(skills.get(index++));
hiscoreResult.setTzTokJad(skills.get(index++));
hiscoreResult.setVenenatis(skills.get(index++));
hiscoreResult.setVetion(skills.get(index++));
hiscoreResult.setVorkath(skills.get(index++));
hiscoreResult.setWintertodt(skills.get(index++));
hiscoreResult.setZalcano(skills.get(index++));
hiscoreResult.setZulrah(skills.get(index++));
return hiscoreResult;
}
}

View File

@@ -24,6 +24,11 @@
*/
package net.runelite.http.api.hiscore;
import lombok.AllArgsConstructor;
import lombok.Getter;
@AllArgsConstructor
@Getter
public enum HiscoreSkill
{
OVERALL("Overall"),
@@ -60,17 +65,50 @@ public enum HiscoreSkill
CLUE_SCROLL_HARD("Clue Scrolls (hard)"),
CLUE_SCROLL_ELITE("Clue Scrolls (elite)"),
CLUE_SCROLL_MASTER("Clue Scrolls (master)"),
LAST_MAN_STANDING("Last Man Standing");
LAST_MAN_STANDING("Last Man Standing"),
ABYSSAL_SIRE("Abyssal Sire"),
ALCHEMICAL_HYDRA("Alchemical Hydra"),
BARROWS_CHESTS("Barrows Chests"),
BRYOPHYTA("Bryophyta"),
CALLISTO("Callisto"),
CERBERUS("Cerberus"),
CHAMBERS_OF_XERIC("Chambers of Xeric"),
CHAMBERS_OF_XERIC_CHALLENGE_MODE("Chambers of Xeric: Challenge Mode"),
CHAOS_ELEMENTAL("Chaos Elemental"),
CHAOS_FANATIC("Chaos Fanatic"),
COMMMANDER_ZILYANA("Commander Zilyana"),
CORPOREAL_BEAST("Corporeal Beast"),
CRAZY_ARCHAEOLOGIST("Crazy Archaeologist"),
DAGANNOTH_PRIME("Dagannoth Prime"),
DAGANNOTH_REX("Dagannoth Rex"),
DAGANNOTH_SUPREME("Dagannoth Supreme"),
DERANGED_ARCHAEOLOGIST("Deranged Archaeologist"),
GENERAL_GRAARDOR("General Graardor"),
GIANT_MOLE("Giant Mole"),
GROTESQUE_GUARDIANS("Grotesque Guardians"),
HESPORI("Hespori"),
KALPHITE_QUEEN("Kalphite Queen"),
KING_BLACK_DRAGON("King Black Dragon"),
KRAKEN("Kraken"),
KREEARRA("Kree'Arra"),
KRIL_TSUTSAROTH("K'ril Tsutsaroth"),
MIMIC("Mimic"),
OBOR("Obor"),
SARACHNIS("Sarachnis"),
SCORPIA("Scorpia"),
SKOTIZO("Skotizo"),
THE_GAUNTLET("The Gauntlet"),
THE_CORRUPTED_GAUNTLET("The Corrupted Gauntlet"),
THEATRE_OF_BLOOD("Theatre of Blood"),
THERMONUCLEAR_SMOKE_DEVIL("Thermonuclear Smoke Devil"),
TZKAL_ZUK("TzKal-Zuk"),
TZTOK_JAD("TzTok-Jad"),
VENENATIS("Venenatis"),
VETION("Vet'ion"),
VORKATH("Vorkath"),
WINTERTODT("Wintertodt"),
ZALCANO("Zalcano"),
ZULRAH("Zulrah");
private final String name;
HiscoreSkill(String name)
{
this.name = name;
}
public String getName()
{
return name;
}
}

View File

@@ -70,7 +70,48 @@ public class HiscoreServiceTest
+ "42,14113\n"
+ "1,777\n"
+ "254,92\n"
+ "-1,-1\n"; // lms
+ "-1,-1\n" // lms
+ "24870,37\n"
+ "15020,388\n"
+ "50463,147\n"
+ "-1,-1\n"
+ "22744,107\n"
+ "-1,-1\n"
+ "20150,17\n"
+ "29400,18\n"
+ "13465,172\n"
+ "1889,581\n"
+ "42891,11\n"
+ "1624,1957\n"
+ "1243,2465\n"
+ "1548,2020\n"
+ "-1,-1\n"
+ "16781,327\n"
+ "19004,149\n"
+ "-1,-1\n"
+ "72046,5\n"
+ "5158,374\n"
+ "20902,279\n"
+ "702,6495\n"
+ "10170,184\n"
+ "8064,202\n"
+ "6936,2\n"
+ "-1,-1\n"
+ "-1,-1\n"
+ "19779,22\n"
+ "58283,10\n"
+ "-1,-1\n"
+ "-1,-1\n"
+ "-1,-1\n"
+ "29347,130\n"
+ "723,4\n"
+ "1264,38\n"
+ "44595,4\n"
+ "24820,4\n"
+ "12116,782\n"
+ "2299,724\n"
+ "19301,62\n"
+ "1498,5847\n";
private final MockWebServer server = new MockWebServer();
@@ -107,6 +148,8 @@ public class HiscoreServiceTest
Assert.assertEquals(254, result.getClueScrollMaster().getRank());
Assert.assertEquals(-1, result.getLastManStanding().getLevel());
Assert.assertEquals(2460, result.getLeaguePoints().getLevel());
Assert.assertEquals(37, result.getAbyssalSire().getLevel());
Assert.assertEquals(5847, result.getZulrah().getLevel());
}
}