Search in sources :

Example 21 with Match

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);
}
Also used : RiotAccount(no.stelar7.api.r4j.pojo.shared.RiotAccount) VALMatchAPI(no.stelar7.api.r4j.impl.val.VALMatchAPI) R4J(no.stelar7.api.r4j.impl.R4J)

Example 22 with 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();
                    }
                });
            });
        });
    });
}
Also used : RiotAccount(no.stelar7.api.r4j.pojo.shared.RiotAccount) VALMatchAPI(no.stelar7.api.r4j.impl.val.VALMatchAPI) R4J(no.stelar7.api.r4j.impl.R4J)

Example 23 with Match

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));
}
Also used : Summoner(no.stelar7.api.r4j.pojo.lol.summoner.Summoner) FileSystemCacheProvider(no.stelar7.api.r4j.basic.cache.impl.FileSystemCacheProvider) JsonWriter(com.google.gson.stream.JsonWriter) JsonParser(com.google.gson.JsonParser)

Example 24 with Match

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");
                }
            });
        });
    }
}
Also used : Summoner(no.stelar7.api.r4j.pojo.lol.summoner.Summoner) FileSystemCacheProvider(no.stelar7.api.r4j.basic.cache.impl.FileSystemCacheProvider)

Example 25 with Match

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;
    }
}
Also used : GAMHSMatch(no.stelar7.api.r4j.pojo.shared.GAMHSMatch)

Aggregations

Summoner (no.stelar7.api.r4j.pojo.lol.summoner.Summoner)8 R4J (no.stelar7.api.r4j.impl.R4J)7 SummonerBuilder (no.stelar7.api.l4j8.impl.builders.summoner.SummonerBuilder)6 Summoner (no.stelar7.api.l4j8.pojo.summoner.Summoner)6 MatchListBuilder (no.stelar7.api.l4j8.impl.builders.match.MatchListBuilder)5 java.util (java.util)4 FileSystemCacheProvider (no.stelar7.api.l4j8.basic.cache.impl.FileSystemCacheProvider)4 FileSystemCacheProvider (no.stelar7.api.r4j.basic.cache.impl.FileSystemCacheProvider)4 SummonerBuilder (no.stelar7.api.r4j.impl.lol.builders.summoner.SummonerBuilder)4 VALMatchAPI (no.stelar7.api.r4j.impl.val.VALMatchAPI)4 java.awt (java.awt)3 AffineTransform (java.awt.geom.AffineTransform)3 java.awt.image (java.awt.image)3 java.io (java.io)3 URL (java.net.URL)3 List (java.util.List)3 Predicate (java.util.function.Predicate)3 IntStream (java.util.stream.IntStream)3 ImageIO (javax.imageio.ImageIO)3 L4J8 (no.stelar7.api.l4j8.impl.L4J8)3