Search in sources :

Example 6 with SpectatorGameInfo

use of no.stelar7.api.r4j.pojo.lol.spectator.SpectatorGameInfo in project L4J8 by stelar7.

the class CurrentGameTest method testCurrentGame.

@Test
public void testCurrentGame() {
    final R4J r4J = new R4J(SecretFile.CREDS);
    SpectatorBuilder sb = new SpectatorBuilder().withPlatform(LeagueShard.EUW1);
    // Get a game in progess
    final List<SpectatorGameInfo> game = sb.getFeaturedGames();
    // Get a summoner from that game
    final String name = game.get(0).getParticipants().get(0).getSummonerName();
    final Summoner sum = new SummonerBuilder().withPlatform(game.get(0).getPlatform()).withName(name).get();
    // Get game info
    final SpectatorGameInfo currentGame = sb.withSummonerId(sum.getSummonerId()).getCurrentGame();
    if (currentGame != null) {
        doAssertions.accept(currentGame);
    }
}
Also used : Summoner(no.stelar7.api.r4j.pojo.lol.summoner.Summoner) SpectatorGameInfo(no.stelar7.api.r4j.pojo.lol.spectator.SpectatorGameInfo) SummonerBuilder(no.stelar7.api.r4j.impl.lol.builders.summoner.SummonerBuilder) R4J(no.stelar7.api.r4j.impl.R4J) SpectatorBuilder(no.stelar7.api.r4j.impl.lol.builders.spectator.SpectatorBuilder)

Example 7 with SpectatorGameInfo

use of no.stelar7.api.r4j.pojo.lol.spectator.SpectatorGameInfo in project L4J8 by stelar7.

the class TournamentTest method testAllRegistrations.

@Test
@Disabled
public void testAllRegistrations() {
    final ProviderRegistrationParameters params = new ProviderRegistrationParameters(LeagueShard.EUW1, "http://stelar7.no/loltest/provider.php");
    final long providerId = this.api.registerAsProvider(params);
    final TournamentRegistrationParameters trparams = new TournamentRegistrationParameters("THE BEST TOURNAMENT EVER", providerId);
    final long tournamentId = this.api.registerTournament(trparams);
    final int teamSize = 5;
    SpectatorBuilder spectatorBuilder = new SpectatorBuilder().withPlatform(LeagueShard.EUW1);
    final SpectatorGameInfo game = spectatorBuilder.getFeaturedGames().get(0);
    List<String> names = game.getParticipants().stream().map(SpectatorParticipant::getSummonerName).collect(Collectors.toList());
    List<String> ids = new ArrayList<>();
    SummonerBuilder sb = new SummonerBuilder().withPlatform(LeagueShard.EUW1);
    for (String name : names) {
        ids.add(sb.withName(name).get().getSummonerId());
    }
    final TournamentCodeUpdateParameters tcinner = new TournamentCodeUpdateParameters(ids, TournamentMapType.SUMMONERS_RIFT, TournamentPickType.TOURNAMENT_DRAFT, TournamentSpectatorType.ALL);
    final TournamentCodeParameters tcparams = new TournamentCodeParameters(tcinner, "THIS IS METADATA YOOO", teamSize);
    final List<String> codes = this.api.generateTournamentCodes(tcparams, tournamentId, 1);
    final TournamentCodeUpdateParameters tcuparams = new TournamentCodeUpdateParameters(ids, TournamentMapType.TWISTED_TREELINE, TournamentPickType.TOURNAMENT_DRAFT, TournamentSpectatorType.ALL);
    final List<LobbyEvent> events = this.api.getTournamentLobbyInfo(codes.get(0));
    if (!api.isStub()) {
        this.api.updateTournament(codes.get(0), tcuparams);
        final TournamentCode id = this.api.getTournamentInfo(codes.get(0));
        final List<Long> tournamentCodeMatchIds = this.api.getMatchIds(LeagueShard.EUW1, codes.get(0));
        final LOLMatch matchDetail = this.api.getMatchInfo(LeagueShard.EUW1, codes.get(0), tournamentCodeMatchIds.get(0));
    }
}
Also used : SummonerBuilder(no.stelar7.api.r4j.impl.lol.builders.summoner.SummonerBuilder) LOLMatch(no.stelar7.api.r4j.pojo.lol.match.v5.LOLMatch) SpectatorBuilder(no.stelar7.api.r4j.impl.lol.builders.spectator.SpectatorBuilder)

Aggregations

L4J8 (no.stelar7.api.l4j8.impl.L4J8)3 SpectatorBuilder (no.stelar7.api.l4j8.impl.builders.spectator.SpectatorBuilder)3 SpectatorGameInfo (no.stelar7.api.l4j8.pojo.spectator.SpectatorGameInfo)3 R4J (no.stelar7.api.r4j.impl.R4J)3 SpectatorBuilder (no.stelar7.api.r4j.impl.lol.builders.spectator.SpectatorBuilder)3 SpectatorGameInfo (no.stelar7.api.r4j.pojo.lol.spectator.SpectatorGameInfo)3 SummonerBuilder (no.stelar7.api.r4j.impl.lol.builders.summoner.SummonerBuilder)2 Summoner (no.stelar7.api.r4j.pojo.lol.summoner.Summoner)2 SummonerBuilder (no.stelar7.api.l4j8.impl.builders.summoner.SummonerBuilder)1 Summoner (no.stelar7.api.l4j8.pojo.summoner.Summoner)1 LOLMatch (no.stelar7.api.r4j.pojo.lol.match.v5.LOLMatch)1