Search in sources :

Example 36 with Summoner

use of no.stelar7.api.r4j.pojo.lol.summoner.Summoner in project L4J8 by stelar7.

the class CheckNormalGameForWinTest method testFindSelfInNormalGame.

@Test
@Disabled
public void testFindSelfInNormalGame() {
    Summoner summoner = new SummonerBuilder().withPlatform(LeagueShard.NA1).withName("devitgg").get();
    List<String> refs = new MatchListBuilder().withPlatform(LeagueShard.NA1).withPuuid(summoner.getPUUID()).get();
    for (String current : refs) {
        LOLMatch match = LOLMatch.get(LeagueShard.NA1, current);
        MatchParticipant self = match.getParticipants().stream().filter(p -> p.getPuuid().equals(summoner.getPUUID())).findFirst().get();
        System.out.println("I " + (self.didWin() ? "won!" : "lost :("));
    }
}
Also used : Summoner(no.stelar7.api.r4j.pojo.lol.summoner.Summoner) SummonerBuilder(no.stelar7.api.r4j.impl.lol.builders.summoner.SummonerBuilder) MatchListBuilder(no.stelar7.api.r4j.impl.lol.builders.matchv5.match.MatchListBuilder)

Example 37 with Summoner

use of no.stelar7.api.r4j.pojo.lol.summoner.Summoner in project L4J8 by stelar7.

the class GenerateDataTest method generateStuff.

@Test
@Disabled
public void generateStuff() throws IOException {
    R4J api = new R4J(SecretFile.CREDS);
    Summoner self = Summoner.byName(LeagueShard.EUW1, "stelar7");
    MatchIterator iterator = self.getLeagueGames().getMatchIterator();
    int i = 0;
    List<InternalMatchData> matchData = new ArrayList<>();
    for (LOLMatch m : iterator) {
        MatchParticipant lookup = m.getParticipants().stream().filter(p -> p.getPuuid().equals(self.getPUUID())).findFirst().get();
        InternalMatchData data = new InternalMatchData();
        data.queue = m.getQueue().commonName();
        data.win = lookup.didWin();
        data.startTime = m.getMatchCreationAsDate().toInstant().toEpochMilli();
        Map<String, InternalMatchSummoner> sums = new HashMap<>();
        for (MatchParticipant p : m.getParticipants()) {
            InternalMatchSummoner sum = new InternalMatchSummoner();
            sum.name = p.getSummonerName();
            sum.champion = p.getChampionId();
            sum.summoner1 = p.getSummoner1Id();
            sum.summoner2 = p.getSummoner2Id();
            sum.perks = generatePerkList(p.getPerks());
            sum.kills = p.getKills();
            sum.deaths = p.getDeaths();
            sum.assists = p.getAssists();
            sum.level = p.getChampionLevel();
            sum.cs = p.getTotalMinionsKilled();
            List<Integer> items = Arrays.asList(p.getItem0(), p.getItem1(), p.getItem2(), p.getItem3(), p.getItem4(), p.getItem5(), p.getItem6());
            Collections.sort(items);
            sum.items = items;
            if (lookup.getTeam() == p.getTeam()) {
                data.team.add(sum);
            } else {
                data.enemy.add(sum);
            }
            if (p.equals(lookup)) {
                data.lookup = sum;
            }
        }
        matchData.add(data);
        if (i++ > 10) {
            break;
        }
    }
    Files.write(Paths.get("C:\\Users\\Steffen\\Desktop\\output.json"), Utils.getGson().toJson(matchData).getBytes(StandardCharsets.UTF_8));
}
Also used : Summoner(no.stelar7.api.r4j.pojo.lol.summoner.Summoner) R4J(no.stelar7.api.r4j.impl.R4J)

Example 38 with Summoner

use of no.stelar7.api.r4j.pojo.lol.summoner.Summoner in project L4J8 by stelar7.

the class MatchListV5Test method testForMissingAttributes.

@Test
public void testForMissingAttributes() {
    LeagueAPI leagueAPI = r4J.getLoLAPI().getLeagueAPI();
    List<LeagueEntry> divis = leagueAPI.getLeagueByTierDivision(LeagueShard.EUW1, GameQueueType.RANKED_SOLO_5X5, TierDivisionType.GOLD_I, 1);
    for (LeagueEntry entry : divis) {
        Summoner summoner = Summoner.bySummonerId(LeagueShard.EUW1, entry.getSummonerId());
        List<String> lazy = summoner.getLeagueGames().get();
        for (int i = 0; i < lazy.size() && i < 5; i++) {
            String match = lazy.get(i);
            LOLMatch lolMatch = LOLMatch.get(LeagueShard.EUW1, match);
            lolMatch.getTimeline();
        }
    }
}
Also used : Summoner(no.stelar7.api.r4j.pojo.lol.summoner.Summoner) LeagueEntry(no.stelar7.api.r4j.pojo.lol.league.LeagueEntry) LeagueAPI(no.stelar7.api.r4j.impl.lol.raw.LeagueAPI)

Example 39 with Summoner

use of no.stelar7.api.r4j.pojo.lol.summoner.Summoner in project L4J8 by stelar7.

the class TestTFTSummoner method testByName.

@Test
public void testByName() {
    Summoner s = api.getSummonerByName(LeagueShard.EUW1, "stelar7");
    doAssertions.accept(s);
}
Also used : Summoner(no.stelar7.api.r4j.pojo.lol.summoner.Summoner)

Example 40 with Summoner

use of no.stelar7.api.r4j.pojo.lol.summoner.Summoner in project L4J8 by stelar7.

the class TestTFTSummoner method testById.

@Test
public void testById() {
    Summoner s = api.getSummonerByName(LeagueShard.EUW1, "stelar7");
    Summoner s2 = api.getSummonerById(LeagueShard.EUW1, s.getSummonerId());
    doAssertions.accept(s2);
}
Also used : Summoner(no.stelar7.api.r4j.pojo.lol.summoner.Summoner)

Aggregations

Summoner (no.stelar7.api.r4j.pojo.lol.summoner.Summoner)33 SummonerBuilder (no.stelar7.api.r4j.impl.lol.builders.summoner.SummonerBuilder)19 SpectatorBuilder (no.stelar7.api.r4j.impl.lol.builders.spectator.SpectatorBuilder)15 Summoner (no.stelar7.api.l4j8.pojo.summoner.Summoner)13 SummonerBuilder (no.stelar7.api.l4j8.impl.builders.summoner.SummonerBuilder)9 R4J (no.stelar7.api.r4j.impl.R4J)7 FileSystemCacheProvider (no.stelar7.api.r4j.basic.cache.impl.FileSystemCacheProvider)5 Optional (java.util.Optional)4 ChampionMasteryBuilder (no.stelar7.api.r4j.impl.lol.builders.championmastery.ChampionMasteryBuilder)4 ChampionMastery (no.stelar7.api.r4j.pojo.lol.championmastery.ChampionMastery)4 java.util (java.util)3 FileSystemCacheProvider (no.stelar7.api.l4j8.basic.cache.impl.FileSystemCacheProvider)3 L4J8 (no.stelar7.api.l4j8.impl.L4J8)3 MatchListBuilder (no.stelar7.api.l4j8.impl.builders.match.MatchListBuilder)3 JsonWriter (com.google.gson.stream.JsonWriter)2 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