From 803a019a278f9522e25dd6ca55856f10b4d66ecd Mon Sep 17 00:00:00 2001 From: Magic fTail Date: Wed, 31 Oct 2018 17:21:53 +0100 Subject: [PATCH] http api/service: update Jagex hiscore API --- .../http/api/hiscore/HiscoreResult.java | 112 +++++++++--------- .../api/hiscore/HiscoreResultBuilder.java | 14 +-- .../http/api/hiscore/HiscoreSkill.java | 10 +- .../service/hiscore/HiscoreServiceTest.java | 19 +-- 4 files changed, 80 insertions(+), 75 deletions(-) diff --git a/http-api/src/main/java/net/runelite/http/api/hiscore/HiscoreResult.java b/http-api/src/main/java/net/runelite/http/api/hiscore/HiscoreResult.java index 06f2921d99..a26aa5de5e 100644 --- a/http-api/src/main/java/net/runelite/http/api/hiscore/HiscoreResult.java +++ b/http-api/src/main/java/net/runelite/http/api/hiscore/HiscoreResult.java @@ -53,15 +53,15 @@ public class HiscoreResult private Skill runecraft; private Skill hunter; private Skill construction; + private Skill bountyHunterHunter; + private Skill bountyHunterRogue; + private Skill clueScrollAll; private Skill clueScrollEasy; private Skill clueScrollMedium; - private Skill clueScrollAll; - private Skill bountyHunterRogue; - private Skill bountyHunterHunter; private Skill clueScrollHard; - private Skill lastManStanding; private Skill clueScrollElite; private Skill clueScrollMaster; + private Skill lastManStanding; public String getPlayer() { @@ -313,6 +313,36 @@ public class HiscoreResult this.construction = construction; } + public Skill getBountyHunterHunter() + { + return bountyHunterHunter; + } + + public void setBountyHunterHunter(Skill bountyHunterHunter) + { + this.bountyHunterHunter = bountyHunterHunter; + } + + public Skill getBountyHunterRogue() + { + return bountyHunterRogue; + } + + public void setBountyHunterRogue(Skill bountyHunterRogue) + { + this.bountyHunterRogue = bountyHunterRogue; + } + + public Skill getClueScrollAll() + { + return clueScrollAll; + } + + public void setClueScrollAll(Skill clueScrollAll) + { + this.clueScrollAll = clueScrollAll; + } + public Skill getClueScrollEasy() { return clueScrollEasy; @@ -333,36 +363,6 @@ public class HiscoreResult this.clueScrollMedium = clueScrollMedium; } - public Skill getClueScrollAll() - { - return clueScrollAll; - } - - public void setClueScrollAll(Skill clueScrollAll) - { - this.clueScrollAll = clueScrollAll; - } - - public Skill getBountyHunterRogue() - { - return bountyHunterRogue; - } - - public void setBountyHunterRogue(Skill bountyHunterRogue) - { - this.bountyHunterRogue = bountyHunterRogue; - } - - public Skill getBountyHunterHunter() - { - return bountyHunterHunter; - } - - public void setBountyHunterHunter(Skill bountyHunterHunter) - { - this.bountyHunterHunter = bountyHunterHunter; - } - public Skill getClueScrollHard() { return clueScrollHard; @@ -373,16 +373,6 @@ public class HiscoreResult this.clueScrollHard = clueScrollHard; } - public Skill getLastManStanding() - { - return lastManStanding; - } - - public void setLastManStanding(Skill lastManStanding) - { - this.lastManStanding = lastManStanding; - } - public Skill getClueScrollElite() { return clueScrollElite; @@ -403,6 +393,16 @@ public class HiscoreResult this.clueScrollMaster = clueScrollMaster; } + public Skill getLastManStanding() + { + return lastManStanding; + } + + public void setLastManStanding(Skill lastManStanding) + { + this.lastManStanding = lastManStanding; + } + public Skill getSkill(HiscoreSkill skill) { switch (skill) @@ -455,24 +455,24 @@ public class HiscoreResult return getConstruction(); case OVERALL: return getOverall(); + case BOUNTY_HUNTER_HUNTER: + return getBountyHunterHunter(); + case BOUNTY_HUNTER_ROGUE: + return getBountyHunterRogue(); + case CLUE_SCROLL_ALL: + return getClueScrollAll(); case CLUE_SCROLL_EASY: return getClueScrollEasy(); case CLUE_SCROLL_MEDIUM: return getClueScrollMedium(); - case CLUE_SCROLL_ALL: - return getClueScrollAll(); - case BOUNTY_HUNTER_ROGUE: - return getBountyHunterRogue(); - case BOUNTY_HUNTER_HUNTER: - return getBountyHunterHunter(); case CLUE_SCROLL_HARD: return getClueScrollHard(); - case LAST_MAN_STANDING: - return getLastManStanding(); case CLUE_SCROLL_ELITE: return getClueScrollElite(); case CLUE_SCROLL_MASTER: return getClueScrollMaster(); + case LAST_MAN_STANDING: + return getLastManStanding(); } throw new IllegalArgumentException("Invalid hiscore item"); @@ -507,15 +507,15 @@ public class HiscoreResult hash = 29 * hash + Objects.hashCode(this.runecraft); hash = 29 * hash + Objects.hashCode(this.hunter); hash = 29 * hash + Objects.hashCode(this.construction); - hash = 29 * hash + Objects.hashCode(this.clueScrollEasy); - hash = 29 * hash + Objects.hashCode(this.clueScrollMedium); - hash = 29 * hash + Objects.hashCode(this.clueScrollAll); hash = 29 * hash + Objects.hashCode(this.bountyHunterRogue); hash = 29 * hash + Objects.hashCode(this.bountyHunterHunter); + hash = 29 * hash + Objects.hashCode(this.clueScrollAll); + hash = 29 * hash + Objects.hashCode(this.clueScrollEasy); + hash = 29 * hash + Objects.hashCode(this.clueScrollMedium); hash = 29 * hash + Objects.hashCode(this.clueScrollHard); - hash = 29 * hash + Objects.hashCode(this.lastManStanding); hash = 29 * hash + Objects.hashCode(this.clueScrollElite); hash = 29 * hash + Objects.hashCode(this.clueScrollMaster); + hash = 29 * hash + Objects.hashCode(this.lastManStanding); return hash; } diff --git a/http-api/src/main/java/net/runelite/http/api/hiscore/HiscoreResultBuilder.java b/http-api/src/main/java/net/runelite/http/api/hiscore/HiscoreResultBuilder.java index 3b25da419b..37beca0ae1 100644 --- a/http-api/src/main/java/net/runelite/http/api/hiscore/HiscoreResultBuilder.java +++ b/http-api/src/main/java/net/runelite/http/api/hiscore/HiscoreResultBuilder.java @@ -77,15 +77,15 @@ public class HiscoreResultBuilder hiscoreResult.setRunecraft(skills.get(21)); hiscoreResult.setHunter(skills.get(22)); hiscoreResult.setConstruction(skills.get(23)); - hiscoreResult.setClueScrollEasy(skills.get(24)); - hiscoreResult.setClueScrollMedium(skills.get(25)); + hiscoreResult.setBountyHunterHunter(skills.get(24)); + hiscoreResult.setBountyHunterRogue(skills.get(25)); hiscoreResult.setClueScrollAll(skills.get(26)); - hiscoreResult.setBountyHunterRogue(skills.get(27)); - hiscoreResult.setBountyHunterHunter(skills.get(28)); + hiscoreResult.setClueScrollEasy(skills.get(27)); + hiscoreResult.setClueScrollMedium(skills.get(28)); hiscoreResult.setClueScrollHard(skills.get(29)); - hiscoreResult.setLastManStanding(skills.get(30)); - hiscoreResult.setClueScrollElite(skills.get(31)); - hiscoreResult.setClueScrollMaster(skills.get(32)); + hiscoreResult.setClueScrollElite(skills.get(30)); + hiscoreResult.setClueScrollMaster(skills.get(31)); + hiscoreResult.setLastManStanding(skills.get(32)); return hiscoreResult; } } diff --git a/http-api/src/main/java/net/runelite/http/api/hiscore/HiscoreSkill.java b/http-api/src/main/java/net/runelite/http/api/hiscore/HiscoreSkill.java index 57cc7423d5..ae745522d0 100644 --- a/http-api/src/main/java/net/runelite/http/api/hiscore/HiscoreSkill.java +++ b/http-api/src/main/java/net/runelite/http/api/hiscore/HiscoreSkill.java @@ -50,15 +50,15 @@ public enum HiscoreSkill RUNECRAFT("Runecraft"), HUNTER("Hunter"), CONSTRUCTION("Construction"), + BOUNTY_HUNTER_HUNTER("Bounty Hunter - Hunter"), + BOUNTY_HUNTER_ROGUE("Bounty Hunter - Rogue"), + CLUE_SCROLL_ALL("Clue Scrolls (all)"), CLUE_SCROLL_EASY("Clue Scrolls (easy)"), CLUE_SCROLL_MEDIUM("Clue Scrolls (medium)"), - CLUE_SCROLL_ALL("Clue Scrolls (all)"), - BOUNTY_HUNTER_ROGUE("Bounty Hunter - Rogue"), - BOUNTY_HUNTER_HUNTER("Bounty Hunter - Hunter"), CLUE_SCROLL_HARD("Clue Scrolls (hard)"), - LAST_MAN_STANDING("Last Man Standing"), CLUE_SCROLL_ELITE("Clue Scrolls (elite)"), - CLUE_SCROLL_MASTER("Clue Scrolls (master)"); + CLUE_SCROLL_MASTER("Clue Scrolls (master)"), + LAST_MAN_STANDING("Last Man Standing"); private final String name; diff --git a/http-service/src/test/java/net/runelite/http/service/hiscore/HiscoreServiceTest.java b/http-service/src/test/java/net/runelite/http/service/hiscore/HiscoreServiceTest.java index a9b127c6d4..17074fc898 100644 --- a/http-service/src/test/java/net/runelite/http/service/hiscore/HiscoreServiceTest.java +++ b/http-service/src/test/java/net/runelite/http/service/hiscore/HiscoreServiceTest.java @@ -61,14 +61,14 @@ public class HiscoreServiceTest + "516239,9,1000\n" + "492790,1,0\n" + "-1,-1\n" - + "-1,-1\n" + + "73,1738\n" + "531,1432\n" - + "-1,-1\n" - + "-1,-1\n" - + "-1,-1\n" - + "-1,-1\n" - + "-1,-1\n" - + "254,92"; + + "8008,131\n" + + "1337,911\n" + + "42,14113\n" + + "1,777\n" + + "254,92\n" + + "-1,-1"; private final MockWebServer server = new MockWebServer(); @@ -97,7 +97,12 @@ public class HiscoreServiceTest Assert.assertEquals(159727L, result.getFishing().getExperience()); Assert.assertEquals(492790, result.getConstruction().getRank()); Assert.assertEquals(1432, result.getClueScrollAll().getLevel()); + Assert.assertEquals(8008, result.getClueScrollEasy().getRank()); + Assert.assertEquals(911, result.getClueScrollMedium().getLevel()); + Assert.assertEquals(42, result.getClueScrollHard().getRank()); + Assert.assertEquals(777, result.getClueScrollElite().getLevel()); Assert.assertEquals(254, result.getClueScrollMaster().getRank()); + Assert.assertEquals(-1, result.getLastManStanding().getLevel()); } }