use of no.stelar7.api.r4j.impl.lol.builders.matchv5.match.MatchListBuilder 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.impl.lol.builders.matchv5.match.MatchListBuilder in project L4J8 by stelar7.
the class MatchListV5Test method testMatchInvalidSpellSlots.
@Test
@Disabled
public void testMatchInvalidSpellSlots() throws IOException {
DataCall.setCacheProvider(new FileSystemCacheProvider());
MatchListBuilder builder = new MatchListBuilder();
Summoner sum = Summoner.byName(LeagueShard.EUW1, "stelar7");
LazyList<String> all = sum.getLeagueGames().getLazy();
MatchBuilder mb = new MatchBuilder(sum.getPlatform());
TimelineBuilder tb = new TimelineBuilder(sum.getPlatform());
StringWriter sw = new StringWriter();
JsonWriter sb = new JsonWriter(sw);
sb.beginObject();
int i = 0;
for (String matchid : all) {
if (i++ > 10)
break;
tb = tb.withId(matchid);
mb = mb.withId(matchid);
LOLMatch match = mb.getMatch();
LOLTimeline lolTimeline = tb.getTimeline();
List<TimelineDamageData> wierdEntries = new ArrayList<>();
lolTimeline.getFrames().forEach(frame -> {
frame.getEvents().forEach(event -> {
if (event.getType() == EventType.CHAMPION_KILL) {
event.getVictimDamageReceived().forEach(d -> {
if (d.getSpellSlot() == SpellSlotType.INVALID || d.getSpellSlot() == SpellSlotType.UNDOCUMENTED || d.getSpellSlot() == SpellSlotType.UNUSED || d.getSpellSlot() == SpellSlotType.OUT_OF_BOUNDS) {
wierdEntries.add(d);
}
});
event.getVictimDamageDealt().forEach(d -> {
if (d.getSpellSlot() == SpellSlotType.INVALID || d.getSpellSlot() == SpellSlotType.UNDOCUMENTED || d.getSpellSlot() == SpellSlotType.UNUSED || d.getSpellSlot() == SpellSlotType.OUT_OF_BOUNDS) {
wierdEntries.add(d);
}
});
}
});
});
if (wierdEntries.size() > 0) {
sb.name(tb.getID());
sb.beginArray();
for (TimelineDamageData wierdEntry : wierdEntries) {
sb.jsonValue(Utils.getGson().toJson(wierdEntry));
}
sb.endArray();
}
}
sb.endObject();
sb.flush();
String output = Utils.getGson().toJson(new JsonParser().parse(sw.toString()));
Files.write(Paths.get("C:\\Users\\stelar7\\Desktop\\errors.json"), output.getBytes(StandardCharsets.UTF_8));
}
use of no.stelar7.api.r4j.impl.lol.builders.matchv5.match.MatchListBuilder in project L4J8 by stelar7.
the class MatchListV5Test method testMatchParticipantIds.
@Test
@Disabled
public void testMatchParticipantIds() {
DataCall.setCacheProvider(new FileSystemCacheProvider());
MatchListBuilder builder = new MatchListBuilder();
Summoner sum = Summoner.byName(LeagueShard.EUW1, "fckmuffin");
LazyList<String> all = sum.getLeagueGames().getLazy();
MatchBuilder mb = new MatchBuilder(sum.getPlatform());
TimelineBuilder tb = new TimelineBuilder(sum.getPlatform());
for (String matchid : all) {
tb = tb.withId(matchid);
mb = mb.withId(matchid);
LOLMatch match = mb.getMatch();
LOLTimeline lolTimeline = tb.getTimeline();
List<TimelineDamageData> wierdEntries = new ArrayList<>();
lolTimeline.getFrames().forEach(frame -> {
frame.getParticipantFrames().forEach((k, v) -> {
if (!k.equals(String.valueOf(v.getParticipantId()))) {
System.out.println(matchid + " has mismatched participantid and key");
}
});
});
}
}
Aggregations