use of no.stelar7.api.l4j8.pojo.match.Match in project L4J8 by stelar7.
the class TestVALMatch method getSingle.
@Test
public void getSingle() throws IOException {
R4J api = new R4J(SecretFile.CREDS);
VALMatchAPI matchAPI = api.getVALAPI().getMatchAPI();
RiotAccount account = api.getAccountAPI().getAccountByTag(RegionShard.EUROPE, "Coup De Graçe", "EUNE");
List<MatchReference> matchlist = matchAPI.getMatchList(ValorantShard.EU, account.getPUUID());
VALMatch match = matchAPI.getMatch(ValorantShard.EU, matchlist.get(0).getMatchId());
Files.write(Paths.get(System.getProperty("user.home") + "\\Desktop\\game.json"), Utils.getGson().toJson(match).getBytes(StandardCharsets.UTF_8));
System.out.println(match);
}
use of no.stelar7.api.l4j8.pojo.match.Match in project L4J8 by stelar7.
the class TestVALMatch method getDeep.
@Test
public void getDeep() {
R4J api = new R4J(SecretFile.CREDS);
VALMatchAPI matchAPI = api.getVALAPI().getMatchAPI();
RiotAccount account = api.getAccountAPI().getAccountByTag(RegionShard.EUROPE, "Jbzz", "EUW");
List<String> ids = new ArrayList<>();
ids.add(account.getPUUID());
List<MatchReference> matchlist = matchAPI.getMatchList(ValorantShard.EU, account.getPUUID());
matchlist.forEach(m -> {
VALMatch match = matchAPI.getMatch(ValorantShard.EU, m.getMatchId());
match.getRoundResults().forEach(r -> {
if (match.getPlayers().stream().anyMatch(p -> p.getCharacter() == null)) {
System.out.println();
}
r.getPlayerStats().forEach(s -> {
if (s.getAbility().getGrenadeEffects() != null && !s.getAbility().getGrenadeEffects().equals("null")) {
System.out.println();
}
});
});
match.getPlayers().forEach(p -> ids.add(p.getPUUID()));
});
ids.forEach(puuid -> {
List<MatchReference> matches = matchAPI.getMatchList(ValorantShard.EU, puuid);
matches.forEach(m -> {
VALMatch match = matchAPI.getMatch(ValorantShard.EU, m.getMatchId());
match.getRoundResults().forEach(r -> {
r.getPlayerStats().forEach(s -> {
if (s.getAbility().getGrenadeEffects() != null && !s.getAbility().getGrenadeEffects().equals("null")) {
System.out.println();
}
});
});
});
});
}
use of no.stelar7.api.l4j8.pojo.match.Match 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.l4j8.pojo.match.Match 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");
}
});
});
}
}
use of no.stelar7.api.l4j8.pojo.match.Match in project L4J8 by stelar7.
the class TFTMatchAPI method getMatchRAW.
public GAMHSMatch getMatchRAW(RegionShard platform, String gameId) {
DataCallBuilder builder = new DataCallBuilder().withURLParameter(Constants.MATCH_ID_PLACEHOLDER, gameId).withHeader(Constants.X_RIOT_TOKEN_HEADER_KEY, DataCall.getCredentials().getTFTAPIKey()).withEndpoint(URLEndpoint.V1_TFT_MATCH).withPlatform(platform);
Map<String, Object> data = new TreeMap<>();
data.put("platform", platform);
data.put("gameid", gameId);
Optional<?> chl = DataCall.getCacheProvider().get(URLEndpoint.V1_TFT_MATCH, data);
if (chl.isPresent()) {
return (GAMHSMatch) chl.get();
}
try {
GAMHSMatch match = (GAMHSMatch) builder.build();
data.put("value", match);
DataCall.getCacheProvider().store(URLEndpoint.V1_TFT_MATCH, data);
return match;
} catch (ClassCastException e) {
return null;
}
}
Aggregations