Search in sources :

Example 11 with Summoner

use of no.stelar7.api.r4j.pojo.lol.summoner.Summoner in project L4J8 by stelar7.

the class LeagueTest method testLeagueEntry.

@Test
public void testLeagueEntry() {
    String id = new SpectatorBuilder().withPlatform(LeagueShard.EUW1).getFeaturedGames().get(0).getParticipants().get(0).getSummonerName();
    Summoner s = new SummonerBuilder().withPlatform(LeagueShard.EUW1).withName(id).get();
    List<LeagueEntry> data = new LeagueBuilder().withPlatform(LeagueShard.EUW1).withSummonerId(s.getSummonerId()).getLeagueEntries();
    System.out.println(data.size());
}
Also used : Summoner(no.stelar7.api.r4j.pojo.lol.summoner.Summoner) SummonerBuilder(no.stelar7.api.r4j.impl.lol.builders.summoner.SummonerBuilder) LeagueBuilder(no.stelar7.api.r4j.impl.lol.builders.league.LeagueBuilder) LeagueEntry(no.stelar7.api.r4j.pojo.lol.league.LeagueEntry) SpectatorBuilder(no.stelar7.api.r4j.impl.lol.builders.spectator.SpectatorBuilder)

Example 12 with Summoner

use of no.stelar7.api.r4j.pojo.lol.summoner.Summoner in project L4J8 by stelar7.

the class ChampionMasteryTest method testChampionMasteryScore.

@Test
public void testChampionMasteryScore() {
    String id = new SpectatorBuilder().withPlatform(LeagueShard.EUW1).getFeaturedGames().get(0).getParticipants().get(0).getSummonerName();
    Summoner s = new SummonerBuilder().withPlatform(LeagueShard.EUW1).withName(id).get();
    Integer score = new ChampionMasteryBuilder().withPlatform(s.getPlatform()).withSummonerId(s.getSummonerId()).getMasteryScore();
    Assertions.assertNotNull(score, "no data");
}
Also used : Summoner(no.stelar7.api.r4j.pojo.lol.summoner.Summoner) ChampionMasteryBuilder(no.stelar7.api.r4j.impl.lol.builders.championmastery.ChampionMasteryBuilder) SummonerBuilder(no.stelar7.api.r4j.impl.lol.builders.summoner.SummonerBuilder) SpectatorBuilder(no.stelar7.api.r4j.impl.lol.builders.spectator.SpectatorBuilder)

Example 13 with Summoner

use of no.stelar7.api.r4j.pojo.lol.summoner.Summoner 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 14 with Summoner

use of no.stelar7.api.r4j.pojo.lol.summoner.Summoner in project L4J8 by stelar7.

the class MatchListV5Test method testMatchListParams.

@Test
@Disabled
public void testMatchListParams() {
    DataCall.setCacheProvider(new FileSystemCacheProvider());
    Summoner sum = Summoner.byName(LeagueShard.EUW1, "rufen03");
    MatchListBuilder builder = new MatchListBuilder();
    builder = builder.withPuuid(sum.getPUUID()).withPlatform(LeagueShard.EUW1);
    List<String> strings1 = builder.withCount(100).get();
    List<String> strings = builder.withQueue(GameQueueType.TEAM_BUILDER_RANKED_SOLO).get();
    List<String> strings2 = builder.withType(MatchlistMatchType.RANKED).get();
    System.out.println();
}
Also used : Summoner(no.stelar7.api.r4j.pojo.lol.summoner.Summoner) FileSystemCacheProvider(no.stelar7.api.r4j.basic.cache.impl.FileSystemCacheProvider)

Example 15 with Summoner

use of no.stelar7.api.r4j.pojo.lol.summoner.Summoner in project L4J8 by stelar7.

the class TestTFTSummoner method testByPUUID.

@Test
public void testByPUUID() {
    Summoner s = api.getSummonerByName(LeagueShard.EUW1, "stelar7");
    Summoner optional = api.getSummonerByPUUID(LeagueShard.EUW1, s.getPUUID());
    doAssertions.accept(optional);
}
Also used : Summoner(no.stelar7.api.r4j.pojo.lol.summoner.Summoner)

Aggregations

Summoner (no.stelar7.api.r4j.pojo.lol.summoner.Summoner)33 SummonerBuilder (no.stelar7.api.r4j.impl.lol.builders.summoner.SummonerBuilder)19 SpectatorBuilder (no.stelar7.api.r4j.impl.lol.builders.spectator.SpectatorBuilder)15 Summoner (no.stelar7.api.l4j8.pojo.summoner.Summoner)13 SummonerBuilder (no.stelar7.api.l4j8.impl.builders.summoner.SummonerBuilder)9 R4J (no.stelar7.api.r4j.impl.R4J)7 FileSystemCacheProvider (no.stelar7.api.r4j.basic.cache.impl.FileSystemCacheProvider)5 Optional (java.util.Optional)4 ChampionMasteryBuilder (no.stelar7.api.r4j.impl.lol.builders.championmastery.ChampionMasteryBuilder)4 ChampionMastery (no.stelar7.api.r4j.pojo.lol.championmastery.ChampionMastery)4 java.util (java.util)3 FileSystemCacheProvider (no.stelar7.api.l4j8.basic.cache.impl.FileSystemCacheProvider)3 L4J8 (no.stelar7.api.l4j8.impl.L4J8)3 MatchListBuilder (no.stelar7.api.l4j8.impl.builders.match.MatchListBuilder)3 JsonWriter (com.google.gson.stream.JsonWriter)2 java.awt (java.awt)2 AffineTransform (java.awt.geom.AffineTransform)2 java.awt.image (java.awt.image)2 java.io (java.io)2 URL (java.net.URL)2