Search in sources :

Example 61 with JsonHolder

use of cc.hyperium.utils.JsonHolder in project Hyperium by HyperiumClient.

the class ArenaStats method getDeepStats.

@Override
public List<StatsDisplayItem> getDeepStats(HypixelApiPlayer player) {
    List<StatsDisplayItem> items = getPreview(player);
    items.add(new DisplayLine(""));
    List<String[]> tableItems = new ArrayList<>();
    JsonHolder arena = player.getStats(GameType.ARENA);
    tableItems.add(new String[] { "Mode", "Kills", "Deaths", "Wins", "Losses", "Healed", "K/D", "W/L" });
    String[] names = new String[] { "1v1", "2v2", "4v4" };
    for (String name : names) {
        tableItems.add(new String[] { name, WebsiteUtils.comma(arena.optInt("kills_" + name)), WebsiteUtils.comma(arena.optInt("deaths_" + name)), WebsiteUtils.comma(arena.optInt("wins_" + name)), WebsiteUtils.comma(arena.optInt("losses_" + name)), WebsiteUtils.comma(arena.optInt("healed_" + name)), WebsiteUtils.buildRatio(arena.optInt("kills_" + name), arena.optInt("deaths_" + name)), WebsiteUtils.buildRatio(arena.optInt("wins_" + name), arena.optInt("losses_" + name)) });
    }
    items.add(new DisplayTable(tableItems));
    return items;
}
Also used : JsonHolder(cc.hyperium.utils.JsonHolder) DisplayLine(cc.hyperium.handlers.handlers.stats.display.DisplayLine) DisplayTable(cc.hyperium.handlers.handlers.stats.display.DisplayTable) StatsDisplayItem(cc.hyperium.handlers.handlers.stats.display.StatsDisplayItem) ArrayList(java.util.ArrayList)

Example 62 with JsonHolder

use of cc.hyperium.utils.JsonHolder in project Hyperium by HyperiumClient.

the class BlitzStats method getDeepStats.

@Override
public List<StatsDisplayItem> getDeepStats(HypixelApiPlayer player) {
    List<StatsDisplayItem> preview = getPreview(player);
    preview.add(new DisplayLine(""));
    List<String[]> lines = new ArrayList<>();
    lines.add(new String[] { "Kit", "Level" });
    JsonHolder blitz = player.getStats(GameType.SURVIVAL_GAMES);
    for (String st : WebsiteUtils.blitz_kits) {
        String tmp1 = null;
        if (!st.contains("Hype")) {
            tmp1 = st.replace(" ", "").toLowerCase();
        } else {
            tmp1 = st.toLowerCase();
        }
        if (blitz.has(tmp1))
            lines.add(new String[] { st, WebsiteUtils.numeral(blitz.optInt(tmp1) + 1) });
    }
    preview.add(new DisplayTable(lines));
    return preview;
}
Also used : JsonHolder(cc.hyperium.utils.JsonHolder) DisplayLine(cc.hyperium.handlers.handlers.stats.display.DisplayLine) DisplayTable(cc.hyperium.handlers.handlers.stats.display.DisplayTable) StatsDisplayItem(cc.hyperium.handlers.handlers.stats.display.StatsDisplayItem) ArrayList(java.util.ArrayList)

Example 63 with JsonHolder

use of cc.hyperium.utils.JsonHolder in project Hyperium by HyperiumClient.

the class DuelsStats method getPreview.

@Override
public List<StatsDisplayItem> getPreview(HypixelApiPlayer player) {
    List<StatsDisplayItem> preview = super.getPreview(player);
    preview.add(new DisplayLine(""));
    JsonHolder stats = player.getStats(GameType.DUELS);
    preview.add(new DisplayLine(bold("Tournament Wins: ", Arrays.stream(tournaments).mapToInt(tournament -> stats.optInt(tournament + "_wins")).sum())));
    return preview;
}
Also used : JsonHolder(cc.hyperium.utils.JsonHolder) DisplayLine(cc.hyperium.handlers.handlers.stats.display.DisplayLine) StatsDisplayItem(cc.hyperium.handlers.handlers.stats.display.StatsDisplayItem)

Example 64 with JsonHolder

use of cc.hyperium.utils.JsonHolder in project Hyperium by HyperiumClient.

the class MegaWallsStats method getPreview.

@Override
public List<StatsDisplayItem> getPreview(HypixelApiPlayer player) {
    List<StatsDisplayItem> stats = new ArrayList<>();
    JsonHolder megaWalls = player.getStats(GameType.WALLS3);
    stats.add(new DisplayLine(bold("Coins: ", megaWalls.optInt("coins"))));
    stats.add(new DisplayLine(bold("Kills: ", megaWalls.optInt("kills"))));
    stats.add(new DisplayLine(bold("Deaths: ", megaWalls.optInt("deaths"))));
    stats.add(new DisplayLine(bold("Wins: ", megaWalls.optInt("wins"))));
    stats.add(new DisplayLine(bold("Losses: ", megaWalls.optInt("losses"))));
    return stats;
}
Also used : JsonHolder(cc.hyperium.utils.JsonHolder) DisplayLine(cc.hyperium.handlers.handlers.stats.display.DisplayLine) StatsDisplayItem(cc.hyperium.handlers.handlers.stats.display.StatsDisplayItem) ArrayList(java.util.ArrayList)

Example 65 with JsonHolder

use of cc.hyperium.utils.JsonHolder in project Hyperium by HyperiumClient.

the class PaintballStats method getDeepStats.

@Override
public List<StatsDisplayItem> getDeepStats(HypixelApiPlayer player) {
    List<StatsDisplayItem> stats = getPreview(player);
    JsonHolder paintball = player.getStats(GameType.PAINTBALL);
    SimpleDateFormat hhmmss = new SimpleDateFormat("HH:mm:ss");
    stats.add(new DisplayLine(""));
    stats.add(new DisplayLine(bold("Shots fired: ", paintball.optInt("shots_fired"))));
    stats.add(new DisplayLine(bold("K/D: ", WebsiteUtils.buildRatio(paintball.optInt("kills"), paintball.optInt("deaths")))));
    stats.add(new DisplayLine(bold("Shot / kill: ", WebsiteUtils.buildRatio(paintball.optInt("shots_fired"), paintball.optInt("kills")))));
    hhmmss.setTimeZone(TimeZone.getTimeZone("GMT"));
    stats.add(new DisplayLine(bold("Time in forcefield (HH-MM-SS): ", hhmmss.format(new Date(1000 * paintball.optInt("forcefieldTime"))))));
    return stats;
}
Also used : JsonHolder(cc.hyperium.utils.JsonHolder) DisplayLine(cc.hyperium.handlers.handlers.stats.display.DisplayLine) StatsDisplayItem(cc.hyperium.handlers.handlers.stats.display.StatsDisplayItem) SimpleDateFormat(java.text.SimpleDateFormat) Date(java.util.Date)

Aggregations

JsonHolder (cc.hyperium.utils.JsonHolder)81 DisplayLine (cc.hyperium.handlers.handlers.stats.display.DisplayLine)42 StatsDisplayItem (cc.hyperium.handlers.handlers.stats.display.StatsDisplayItem)42 ArrayList (java.util.ArrayList)34 NettyClient (cc.hyperium.netty.NettyClient)13 DisplayTable (cc.hyperium.handlers.handlers.stats.display.DisplayTable)10 JsonArray (com.google.gson.JsonArray)9 JsonElement (com.google.gson.JsonElement)8 HyperiumPurchase (cc.hyperium.purchases.HyperiumPurchase)5 JsonObject (com.google.gson.JsonObject)5 URL (java.net.URL)5 UUID (java.util.UUID)5 HashMap (java.util.HashMap)4 InvokeEvent (cc.hyperium.event.InvokeEvent)3 PurchaseLoadEvent (cc.hyperium.event.network.PurchaseLoadEvent)3 AbstractAnimationHandler (cc.hyperium.handlers.handlers.animation.AbstractAnimationHandler)3 DisplayItem (cc.hyperium.mods.chromahud.api.DisplayItem)3 IOException (java.io.IOException)3 ExecutionException (java.util.concurrent.ExecutionException)3 GuiButton (net.minecraft.client.gui.GuiButton)3