Search in sources :

Example 1 with SummonerBuilder

use of no.stelar7.api.r4j.impl.lol.builders.summoner.SummonerBuilder in project L4J8 by stelar7.

the class CheckNormalGameForWinTest method testFindSelfInNormalGame.

@Test
@Ignore
public void testFindSelfInNormalGame() {
    Summoner dev = new SummonerBuilder().withPlatform(Platform.NA1).withName("devitgg").get();
    List<MatchReference> refs = new MatchListBuilder().withPlatform(Platform.NA1).withAccountId(dev.getAccountId()).get();
    for (MatchReference current : refs) {
        Match fullGame = current.getFullMatch();
        List<Participant> candidates = new ArrayList<>();
        for (Participant participant : fullGame.getParticipants()) {
            if (participant.getChampionId() == current.getChampionId()) {
                candidates.add(participant);
            }
        }
        candidates.removeIf(candidate -> candidate.getTimeline().getLane() != current.getLane());
        candidates.removeIf(candidate -> candidate.getTimeline().getRole() != current.getRole());
        if (candidates.size() == 1) {
            Participant self = candidates.get(0);
            System.out.println("I " + (self.getStats().isWinner() ? "won!" : "lost :("));
        } else {
            System.out.println("Unable to find self!");
        }
    }
}
Also used : Summoner(no.stelar7.api.l4j8.pojo.summoner.Summoner) SummonerBuilder(no.stelar7.api.l4j8.impl.builders.summoner.SummonerBuilder) MatchListBuilder(no.stelar7.api.l4j8.impl.builders.match.MatchListBuilder)

Example 2 with SummonerBuilder

use of no.stelar7.api.r4j.impl.lol.builders.summoner.SummonerBuilder in project L4J8 by stelar7.

the class CheckNormalGameForWinTest method testFindSelfAfterNormalGame.

@Test
@Ignore
public void testFindSelfAfterNormalGame() {
    Summoner dev = new SummonerBuilder().withPlatform(Platform.NA1).withName("devitgg").get();
    while (new SpectatorBuilder().withPlatform(Platform.NA1).withSummonerId(dev.getSummonerId()).getCurrentGame() != null) {
        try {
            Thread.sleep(30000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
    List<MatchReference> refs = new MatchListBuilder().withPlatform(Platform.NA1).withAccountId(dev.getAccountId()).get();
    for (MatchReference current : refs) {
        Match fullGame = current.getFullMatch();
        List<Participant> candidates = new ArrayList<>();
        for (Participant participant : fullGame.getParticipants()) {
            if (participant.getChampionId() == current.getChampionId()) {
                candidates.add(participant);
            }
        }
        candidates.removeIf(candidate -> candidate.getTimeline().getLane() != current.getLane());
        candidates.removeIf(candidate -> candidate.getTimeline().getRole() != current.getRole());
        if (candidates.size() == 1) {
            Participant self = candidates.get(0);
            System.out.println("I " + (self.getStats().isWinner() ? "won!" : "lost :("));
        } else {
            System.out.println("Unable to find self!");
        }
    }
}
Also used : Summoner(no.stelar7.api.l4j8.pojo.summoner.Summoner) SummonerBuilder(no.stelar7.api.l4j8.impl.builders.summoner.SummonerBuilder) MatchListBuilder(no.stelar7.api.l4j8.impl.builders.match.MatchListBuilder) SpectatorBuilder(no.stelar7.api.l4j8.impl.builders.spectator.SpectatorBuilder)

Example 3 with SummonerBuilder

use of no.stelar7.api.r4j.impl.lol.builders.summoner.SummonerBuilder in project L4J8 by stelar7.

the class RatelimitTest method testRateLimitWithSleep.

@Test
@Ignore
public void testRateLimitWithSleep() throws InterruptedException {
    new SummonerBuilder().withPlatform(Constants.TEST_PLATFORM[0]).withAccountId(Constants.TEST_ACCOUNT_IDS[0]).get();
    TimeUnit.SECONDS.sleep(10);
    new SummonerBuilder().withPlatform(Constants.TEST_PLATFORM[0]).withAccountId(Constants.TEST_ACCOUNT_IDS[0]).get();
}
Also used : SummonerBuilder(no.stelar7.api.l4j8.impl.builders.summoner.SummonerBuilder)

Example 4 with SummonerBuilder

use of no.stelar7.api.r4j.impl.lol.builders.summoner.SummonerBuilder in project L4J8 by stelar7.

the class SummonerTest method testByAccount.

@Test
public void testByAccount() {
    for (int i = 0; i < Constants.TEST_ACCOUNT_IDS.length; i++) {
        Summoner optional = new SummonerBuilder().withPlatform(Constants.TEST_PLATFORM[i]).withAccountId(Constants.TEST_ACCOUNT_IDS[i]).get();
        doAssertions.accept(optional);
    }
}
Also used : Summoner(no.stelar7.api.l4j8.pojo.summoner.Summoner) SummonerBuilder(no.stelar7.api.l4j8.impl.builders.summoner.SummonerBuilder)

Example 5 with SummonerBuilder

use of no.stelar7.api.r4j.impl.lol.builders.summoner.SummonerBuilder in project L4J8 by stelar7.

the class SummonerTest method testByName.

@Test
public void testByName() {
    for (int i = 0; i < Constants.TEST_SUMMONER_NAMES.length; i++) {
        Summoner optional = new SummonerBuilder().withPlatform(Constants.TEST_PLATFORM[i]).withName(Constants.TEST_SUMMONER_NAMES[i]).get();
        doAssertions.accept(optional);
    }
}
Also used : Summoner(no.stelar7.api.l4j8.pojo.summoner.Summoner) SummonerBuilder(no.stelar7.api.l4j8.impl.builders.summoner.SummonerBuilder)

Aggregations

SummonerBuilder (no.stelar7.api.r4j.impl.lol.builders.summoner.SummonerBuilder)20 Summoner (no.stelar7.api.r4j.pojo.lol.summoner.Summoner)18 SpectatorBuilder (no.stelar7.api.r4j.impl.lol.builders.spectator.SpectatorBuilder)16 SummonerBuilder (no.stelar7.api.l4j8.impl.builders.summoner.SummonerBuilder)13 Summoner (no.stelar7.api.l4j8.pojo.summoner.Summoner)9 MatchListBuilder (no.stelar7.api.l4j8.impl.builders.match.MatchListBuilder)4 R4J (no.stelar7.api.r4j.impl.R4J)4 ChampionMasteryBuilder (no.stelar7.api.r4j.impl.lol.builders.championmastery.ChampionMasteryBuilder)4 FileSystemCacheProvider (no.stelar7.api.l4j8.basic.cache.impl.FileSystemCacheProvider)3 L4J8 (no.stelar7.api.l4j8.impl.L4J8)3 MatchListBuilder (no.stelar7.api.r4j.impl.lol.builders.matchv5.match.MatchListBuilder)3 ChampionMastery (no.stelar7.api.r4j.pojo.lol.championmastery.ChampionMastery)3 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 java.util (java.util)2 List (java.util.List)2 Predicate (java.util.function.Predicate)2