Search in sources :

Example 1 with SummonerBuilder

use of no.stelar7.api.l4j8.impl.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.l4j8.impl.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.l4j8.impl.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.l4j8.impl.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.l4j8.impl.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.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 FileSystemCacheProvider (no.stelar7.api.l4j8.basic.cache.impl.FileSystemCacheProvider)3 L4J8 (no.stelar7.api.l4j8.impl.L4J8)3 SpectatorBuilder (no.stelar7.api.l4j8.impl.builders.spectator.SpectatorBuilder)2 StaticChampion (no.stelar7.api.l4j8.pojo.staticdata.champion.StaticChampion)2 java.awt (java.awt)1 AffineTransform (java.awt.geom.AffineTransform)1 java.awt.image (java.awt.image)1 java.io (java.io)1 URL (java.net.URL)1 java.util (java.util)1 List (java.util.List)1 CompletableFuture (java.util.concurrent.CompletableFuture)1 Predicate (java.util.function.Predicate)1 IntStream (java.util.stream.IntStream)1 ImageIO (javax.imageio.ImageIO)1 DataCall (no.stelar7.api.l4j8.basic.calling.DataCall)1 Platform (no.stelar7.api.l4j8.basic.constants.api.Platform)1