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!");
}
}
}
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!");
}
}
}
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();
}
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);
}
}
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);
}
}
Aggregations