use of no.stelar7.api.r4j.impl.lol.builders.spectator.SpectatorBuilder 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.r4j.impl.lol.builders.spectator.SpectatorBuilder in project L4J8 by stelar7.
the class FeaturedGameTest method testCurrentGame.
@Test
public void testCurrentGame() {
final L4J8 l4j8 = new L4J8(SecretFile.CREDS);
SpectatorBuilder sb = new SpectatorBuilder().withPlatform(Platform.EUW1);
final List<SpectatorGameInfo> game = sb.getFeaturedGames();
doAssertions.accept(game);
}
use of no.stelar7.api.r4j.impl.lol.builders.spectator.SpectatorBuilder 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());
}
use of no.stelar7.api.r4j.impl.lol.builders.spectator.SpectatorBuilder 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");
}
use of no.stelar7.api.r4j.impl.lol.builders.spectator.SpectatorBuilder in project L4J8 by stelar7.
the class RatelimitTest method testRateLimit.
@Test
@Disabled
public void testRateLimit() {
final R4J test = new R4J(SecretFile.CREDS);
String id = new SpectatorBuilder().withPlatform(LeagueShard.EUW1).getFeaturedGames().get(0).getParticipants().get(0).getSummonerName();
Summoner s = new SummonerBuilder().withPlatform(LeagueShard.EUW1).withName(id).get();
for (int i2 = 0; i2 < 130; i2++) {
new SummonerBuilder().withPlatform(LeagueShard.EUW1).withName(id).get();
}
}
Aggregations