Search in sources :

Example 1 with HiscoreResult

use of net.runelite.http.api.hiscore.HiscoreResult in project runelite by runelite.

the class HiscoreResultBuilder method build.

public HiscoreResult build() {
    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.setClueScrollEasy(skills.get(24));
    hiscoreResult.setClueScrollMedium(skills.get(25));
    hiscoreResult.setClueScrollAll(skills.get(26));
    hiscoreResult.setBountyHunterRogue(skills.get(27));
    hiscoreResult.setBountyHunterHunter(skills.get(28));
    hiscoreResult.setClueScrollHard(skills.get(29));
    hiscoreResult.setLastManStanding(skills.get(30));
    hiscoreResult.setClueScrollElite(skills.get(31));
    hiscoreResult.setClueScrollMaster(skills.get(32));
    return hiscoreResult;
}
Also used : HiscoreResult(net.runelite.http.api.hiscore.HiscoreResult)

Example 2 with HiscoreResult

use of net.runelite.http.api.hiscore.HiscoreResult in project runelite by runelite.

the class HiscoreServiceTest method testNormalLookup.

@Test
public void testNormalLookup() throws Exception {
    HiscoreTestService hiscores = new HiscoreTestService(server.url("/"));
    HiscoreResult result = hiscores.lookupUsername("zezima", HiscoreEndpoint.NORMAL).build();
    Assert.assertEquals(50, result.getAttack().getLevel());
    Assert.assertEquals(159727L, result.getFishing().getExperience());
    Assert.assertEquals(492790, result.getConstruction().getRank());
    Assert.assertEquals(1432, result.getClueScrollAll().getLevel());
    Assert.assertEquals(254, result.getClueScrollMaster().getRank());
}
Also used : HiscoreResult(net.runelite.http.api.hiscore.HiscoreResult) Test(org.junit.Test)

Example 3 with HiscoreResult

use of net.runelite.http.api.hiscore.HiscoreResult in project runelite by runelite.

the class XpMapperTest method testHiscoreResultToXpData.

@Test
public void testHiscoreResultToXpData() {
    HiscoreResult hiscoreResult = new HiscoreResult();
    hiscoreResult.setAgility(new Skill(42, 9, 9001));
    XpData xpData = XpMapper.INSTANCE.hiscoreResultToXpData(hiscoreResult);
    assertEquals(42, xpData.getAgility_rank());
    assertEquals(9001, xpData.getAgility_xp());
}
Also used : Skill(net.runelite.http.api.hiscore.Skill) XpData(net.runelite.http.api.xp.XpData) HiscoreResult(net.runelite.http.api.hiscore.HiscoreResult) Test(org.junit.Test)

Example 4 with HiscoreResult

use of net.runelite.http.api.hiscore.HiscoreResult in project runelite by runelite.

the class HiscoreController method lookup.

@RequestMapping("/{endpoint}")
public HiscoreResult lookup(@PathVariable HiscoreEndpoint endpoint, @RequestParam String username) throws IOException {
    HiscoreResultBuilder resultBuilder = hiscoreService.lookupUsername(username, endpoint);
    HiscoreResult result = resultBuilder.build();
    // Submit to xp tracker?
    switch(endpoint) {
        case NORMAL:
        case IRONMAN:
        case ULTIMATE_IRONMAN:
        case HARDCORE_IRONMAN:
            xpTrackerService.update(username, result);
    }
    return result;
}
Also used : HiscoreResult(net.runelite.http.api.hiscore.HiscoreResult) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 5 with HiscoreResult

use of net.runelite.http.api.hiscore.HiscoreResult in project runelite by runelite.

the class XpTrackerService method update.

public void update(String username) throws IOException {
    HiscoreResultBuilder hiscoreResultBuilder = hiscoreService.lookupUsername(username, HiscoreEndpoint.NORMAL);
    HiscoreResult hiscoreResult = hiscoreResultBuilder.build();
    update(username, hiscoreResult);
}
Also used : HiscoreResult(net.runelite.http.api.hiscore.HiscoreResult) HiscoreResultBuilder(net.runelite.http.service.hiscore.HiscoreResultBuilder)

Aggregations

HiscoreResult (net.runelite.http.api.hiscore.HiscoreResult)5 Test (org.junit.Test)2 Skill (net.runelite.http.api.hiscore.Skill)1 XpData (net.runelite.http.api.xp.XpData)1 HiscoreResultBuilder (net.runelite.http.service.hiscore.HiscoreResultBuilder)1 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)1