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