Search in sources :

Example 1 with StaticRune

use of no.stelar7.api.r4j.pojo.lol.staticdata.rune.StaticRune in project L4J8 by stelar7.

the class StaticTest method testRuneList.

@Test
public void testRuneList() {
    DataCall.setCacheProvider(new FileSystemCacheProvider());
    DataCall.setLogLevel(LogLevel.DEBUG);
    EnumSet<RuneDataFlags> dataFlags = EnumSet.of(RuneDataFlags.ALL, RuneDataFlags.IMAGE);
    Map<Integer, StaticRune> list = api.getRunes(Platform.EUW1, dataFlags, null, null);
}
Also used : StaticRune(no.stelar7.api.l4j8.pojo.staticdata.rune.StaticRune) FileSystemCacheProvider(no.stelar7.api.l4j8.basic.cache.impl.FileSystemCacheProvider)

Example 2 with StaticRune

use of no.stelar7.api.r4j.pojo.lol.staticdata.rune.StaticRune in project L4J8 by stelar7.

the class UseageTest method testUseage.

@Test
public void testUseage() {
    R4J api = new R4J(SecretFile.CREDS);
    DataCall.setCacheProvider(new FileSystemCacheProvider());
    Map<Integer, StaticRune> runeData = api.getDDragonAPI().getRunes();
    Map<Integer, StaticMastery> masteriesData = api.getDDragonAPI().getMasteries();
    Map<Integer, StaticChampion> championData = api.getDDragonAPI().getChampions();
    Map<Integer, StaticPerk> perkData = api.getDDragonAPI().getPerks();
    Summoner summoner = Summoner.byName(LeagueShard.EUW1, "stelar7");
    List<String> some = summoner.getLeagueGames().get();
    LOLMatch match = LOLMatch.get(summoner.getPlatform(), some.get(0));
    MatchParticipant self = match.getParticipants().stream().filter(p -> p.getPuuid().equals(summoner.getPUUID())).findFirst().get();
    StaticChampion champion = championData.get(self.getChampionId());
    ChampionMastery mastery = summoner.getChampionMastery(champion.getId());
    boolean didWin = self.didWin();
    System.out.format("Player '%s' played their latest game as '%s'%n", summoner.getName(), champion.getName());
    System.out.format("They have a masteryscore of %s on that champion%n", mastery.getChampionPoints());
    System.out.format("They played in %s, their role was: %s%n", self.getChampionSelectLane(), self.getRole());
    System.out.format("They %s that game%n", didWin ? "won" : "lost");
    System.out.format("%nThey used the following perks:%n");
    List<PerkSelection> perks = self.getPerks().getPerkStyles().stream().flatMap(s -> s.getSelections().stream()).collect(Collectors.toList());
    for (PerkSelection perk : perks) {
        StaticPerk perkInfo = perkData.get(perk.getPerk());
        String name = perkInfo.getName();
        System.out.format("Name: '%-20s' variables: %-5s, %-5s, %-5s%n", name, perk.getVar1(), perk.getVar2(), perk.getVar3());
    }
}
Also used : StaticPerk(no.stelar7.api.r4j.pojo.lol.staticdata.perk.StaticPerk) Summoner(no.stelar7.api.r4j.pojo.lol.summoner.Summoner) FileSystemCacheProvider(no.stelar7.api.r4j.basic.cache.impl.FileSystemCacheProvider) StaticMastery(no.stelar7.api.r4j.pojo.lol.staticdata.mastery.StaticMastery) java.util(java.util) Summoner(no.stelar7.api.r4j.pojo.lol.summoner.Summoner) R4J(no.stelar7.api.r4j.impl.R4J) ChampionMastery(no.stelar7.api.r4j.pojo.lol.championmastery.ChampionMastery) DataCall(no.stelar7.api.r4j.basic.calling.DataCall) StaticChampion(no.stelar7.api.r4j.pojo.lol.staticdata.champion.StaticChampion) Collectors(java.util.stream.Collectors) StaticPerk(no.stelar7.api.r4j.pojo.lol.staticdata.perk.StaticPerk) Test(org.junit.jupiter.api.Test) StaticRune(no.stelar7.api.r4j.pojo.lol.staticdata.rune.StaticRune) no.stelar7.api.r4j.pojo.lol.match.v5(no.stelar7.api.r4j.pojo.lol.match.v5) LeagueShard(no.stelar7.api.r4j.basic.constants.api.regions.LeagueShard) SecretFile(no.stelar7.api.r4j.tests.SecretFile) StaticChampion(no.stelar7.api.r4j.pojo.lol.staticdata.champion.StaticChampion) R4J(no.stelar7.api.r4j.impl.R4J) FileSystemCacheProvider(no.stelar7.api.r4j.basic.cache.impl.FileSystemCacheProvider) StaticRune(no.stelar7.api.r4j.pojo.lol.staticdata.rune.StaticRune) ChampionMastery(no.stelar7.api.r4j.pojo.lol.championmastery.ChampionMastery) StaticMastery(no.stelar7.api.r4j.pojo.lol.staticdata.mastery.StaticMastery) Test(org.junit.jupiter.api.Test)

Example 3 with StaticRune

use of no.stelar7.api.r4j.pojo.lol.staticdata.rune.StaticRune in project L4J8 by stelar7.

the class StaticTest method testRuneList.

@Test
public void testRuneList() {
    DataCall.setCacheProvider(new FileSystemCacheProvider());
    Map<Integer, StaticRune> list = api.getRunes();
}
Also used : StaticRune(no.stelar7.api.r4j.pojo.lol.staticdata.rune.StaticRune) FileSystemCacheProvider(no.stelar7.api.r4j.basic.cache.impl.FileSystemCacheProvider)

Example 4 with StaticRune

use of no.stelar7.api.r4j.pojo.lol.staticdata.rune.StaticRune in project L4J8 by stelar7.

the class UseageTest method testUseage.

@Test
public void testUseage() {
    L4J8 api = new L4J8(SecretFile.CREDS);
    DataCall.setLogLevel(LogLevel.DEBUG);
    DataCall.setCacheProvider(new FileSystemCacheProvider());
    Map<Integer, StaticRune> runeData = api.getStaticAPI().getRunes(Platform.EUW1, null, null, null);
    Map<Integer, StaticMastery> masteriesData = api.getStaticAPI().getMasteries(Platform.EUW1, null, null, null);
    Map<Integer, StaticChampion> championData = api.getStaticAPI().getChampions(Platform.EUW1, null, null, null);
    Summoner stelar7 = new SummonerBuilder().withPlatform(Platform.EUW1).withName("stelar7").get();
    List<MatchReference> some = stelar7.getGames().get();
    MatchReference mostRecentGame = some.stream().max(Comparator.comparing(MatchReference::getTimestamp)).get();
    Match match = mostRecentGame.getFullMatch();
    Participant self = match.getParticipantFromSummonerId(stelar7.getSummonerId());
    List<MatchRune> runes = self.getRunes();
    List<MatchMastery> masteries = self.getMasteries();
    StaticChampion champion = championData.get(mostRecentGame.getChampionId());
    ChampionMastery mastery = stelar7.getChampionMastery(champion.getId());
    boolean didWin = match.didWin(self);
    ParticipantIdentity opponentIdentity = match.getLaneOpponentIdentity(self);
    Participant opponent = match.getParticipantFromParticipantId(opponentIdentity.getParticipantId());
    StaticChampion opponentChampion = championData.get(opponent.getChampionId());
    System.out.format("Player '%s' played their latest game as '%s'%n", stelar7.getName(), champion.getName());
    System.out.format("They have a masteryscore of %s on that champion%n", mastery.getChampionPoints());
    System.out.format("They played in %s, their role was: %s%n", self.getTimeline().getLane(), self.getTimeline().getRole());
    System.out.format("They %s that game%n", didWin ? "won" : "lost");
    System.out.format("They laned against '%s' as '%s'%n", opponentIdentity.getPlayer().getSummonerName(), opponentChampion.getName());
    System.out.format("%nThey used the following runes:%n");
    for (MatchRune rune : runes) {
        String name = runeData.get(rune.getRuneId()).getName();
        System.out.format("Name: '%-45s' Count: %s%n", name, rune.getRank());
    }
    System.out.format("%nThey used the following masteries:%n");
    for (MatchMastery matchMastery : masteries) {
        String name = masteriesData.get(matchMastery.getMasteryId()).getName();
        System.out.format("Name: '%-45s' Level: %s%n", name, matchMastery.getRank());
    }
}
Also used : Summoner(no.stelar7.api.l4j8.pojo.summoner.Summoner) SummonerBuilder(no.stelar7.api.l4j8.impl.builders.summoner.SummonerBuilder) StaticChampion(no.stelar7.api.l4j8.pojo.staticdata.champion.StaticChampion) FileSystemCacheProvider(no.stelar7.api.l4j8.basic.cache.impl.FileSystemCacheProvider) L4J8(no.stelar7.api.l4j8.impl.L4J8) StaticRune(no.stelar7.api.l4j8.pojo.staticdata.rune.StaticRune) ChampionMastery(no.stelar7.api.l4j8.pojo.championmastery.ChampionMastery) StaticMastery(no.stelar7.api.l4j8.pojo.staticdata.mastery.StaticMastery) Test(org.junit.Test)

Example 5 with StaticRune

use of no.stelar7.api.r4j.pojo.lol.staticdata.rune.StaticRune in project L4J8 by stelar7.

the class StaticTest method testRuneSingle.

@Test
public void testRuneSingle() {
    DataCall.setCacheProvider(new FileSystemCacheProvider());
    DataCall.setLogLevel(LogLevel.DEBUG);
    EnumSet<RuneDataFlags> dataFlags = EnumSet.of(RuneDataFlags.ALL, RuneDataFlags.IMAGE);
    StaticRune rune = api.getRune(Platform.EUW1, 5023, dataFlags, null, null);
    Assert.assertTrue("missing id?", rune.getId() == 5023);
    Assert.assertTrue("missing stats?", rune.getStats() != null);
    Assert.assertTrue("missing desc?", rune.getDescription() != null);
    Assert.assertTrue("missing tags?", rune.getTags() != null);
    Assert.assertTrue("missing image?", rune.getImage() != null);
    Assert.assertTrue("missing sandesc?", rune.getSanitizedDescription() != null);
    Assert.assertTrue("missing rune?", rune.getRune() != null);
    Assert.assertTrue("missing name?", rune.getName() != null);
}
Also used : StaticRune(no.stelar7.api.l4j8.pojo.staticdata.rune.StaticRune) FileSystemCacheProvider(no.stelar7.api.l4j8.basic.cache.impl.FileSystemCacheProvider)

Aggregations

FileSystemCacheProvider (no.stelar7.api.l4j8.basic.cache.impl.FileSystemCacheProvider)3 StaticRune (no.stelar7.api.l4j8.pojo.staticdata.rune.StaticRune)3 FileSystemCacheProvider (no.stelar7.api.r4j.basic.cache.impl.FileSystemCacheProvider)3 StaticRune (no.stelar7.api.r4j.pojo.lol.staticdata.rune.StaticRune)3 java.util (java.util)1 Collectors (java.util.stream.Collectors)1 L4J8 (no.stelar7.api.l4j8.impl.L4J8)1 SummonerBuilder (no.stelar7.api.l4j8.impl.builders.summoner.SummonerBuilder)1 ChampionMastery (no.stelar7.api.l4j8.pojo.championmastery.ChampionMastery)1 StaticChampion (no.stelar7.api.l4j8.pojo.staticdata.champion.StaticChampion)1 StaticMastery (no.stelar7.api.l4j8.pojo.staticdata.mastery.StaticMastery)1 Summoner (no.stelar7.api.l4j8.pojo.summoner.Summoner)1 DataCall (no.stelar7.api.r4j.basic.calling.DataCall)1 LeagueShard (no.stelar7.api.r4j.basic.constants.api.regions.LeagueShard)1 R4J (no.stelar7.api.r4j.impl.R4J)1 ChampionMastery (no.stelar7.api.r4j.pojo.lol.championmastery.ChampionMastery)1 no.stelar7.api.r4j.pojo.lol.match.v5 (no.stelar7.api.r4j.pojo.lol.match.v5)1 StaticChampion (no.stelar7.api.r4j.pojo.lol.staticdata.champion.StaticChampion)1 StaticMastery (no.stelar7.api.r4j.pojo.lol.staticdata.mastery.StaticMastery)1 StaticPerk (no.stelar7.api.r4j.pojo.lol.staticdata.perk.StaticPerk)1