Search in sources :

Example 26 with JsonHolder

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

the class QuakecraftStats method getPreview.

@Override
public List<StatsDisplayItem> getPreview(HypixelApiPlayer player) {
    List<StatsDisplayItem> stats = new ArrayList<>();
    JsonHolder quakeCraft = player.getStats(GameType.QUAKECRAFT);
    stats.add(new DisplayLine(bold("Coins: ", quakeCraft.optInt("coins"))));
    stats.add(new DisplayLine(bold("Highest Killstreak: ", quakeCraft.optInt("highest_killstreak"))));
    stats.add(new DisplayLine(bold("Dash Power: ", Integer.valueOf(quakeCraft.has("dash_power") ? quakeCraft.optString("dash_power") : "0") + 1)));
    stats.add(new DisplayLine(bold("Dash Cooldown: ", Integer.valueOf(quakeCraft.has("dash_cooldown") ? quakeCraft.optString("dash_cooldown") : "0") + 1)));
    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 27 with JsonHolder

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

the class SkyWarsStats method getDeepStats.

@Override
public List<StatsDisplayItem> getDeepStats(HypixelApiPlayer player) {
    List<StatsDisplayItem> stats = getPreview(player);
    JsonHolder skyWars = player.getStats(GameType.SKYWARS);
    SimpleDateFormat hhmmss = new SimpleDateFormat("HH:mm:ss");
    stats.add(new DisplayLine(""));
    stats.add(new DisplayLine(bold("K/D: ", WebsiteUtils.buildRatio(skyWars.optInt("kills"), skyWars.optInt("deaths")))));
    stats.add(new DisplayLine(bold("W/L: ", WebsiteUtils.buildRatio(skyWars.optInt("wins"), skyWars.optInt("losses")))));
    stats.add(new DisplayLine(""));
    stats.add(new DisplayLine(bold("Total Souls: ", skyWars.optInt("souls"))));
    stats.add(new DisplayLine(bold("Soul Well Usages: ", skyWars.optInt("soul_well"))));
    stats.add(new DisplayLine(bold("Soul Well Legendaries: ", skyWars.optInt("soul_well_legendaries"))));
    stats.add(new DisplayLine(bold("Soul Well Rares: ", skyWars.optInt("soul_well_rares"))));
    stats.add(new DisplayLine(bold("Souls Gathered: ", skyWars.optInt("souls_gathered"))));
    stats.add(new DisplayLine(bold("Souls Purchased: ", skyWars.optInt("paid_souls"))));
    int skywars_time_played = skyWars.optInt("time_played");
    int skywars_tmp_days = 0;
    // SKYWARS_TIME
    while (skywars_time_played > 24 * 60 * 60) {
        skywars_tmp_days++;
        skywars_time_played -= 24 * 60 * 60;
    }
    stats.add(new DisplayLine(""));
    stats.add(new DisplayLine(bold("Time played: (DD, HH:MM:SS): ", skywars_tmp_days + ", " + hhmmss.format(new Date(1000 * skywars_time_played)))));
    stats.add(new DisplayLine(""));
    stats.add(new DisplayLine(""));
    final String[] skywars_modes = { "Ranked", "Solo Normal", "Solo Insane", "Team Normal", "Team Insane", "Mega" };
    List<String[]> lines = new ArrayList<>();
    lines.add(new String[] { "Mode", "Kills", "Wins", "Deaths", "Losses", "K/D", "W/L" });
    for (String front : skywars_modes) {
        String api = front.toLowerCase().replace(" ", "_");
        lines.add(new String[] { front, String.valueOf(skyWars.optInt("kills_" + api)), String.valueOf(skyWars.optInt("wins_" + api)), String.valueOf(skyWars.optInt("deaths_" + api)), String.valueOf(skyWars.optInt("losses_" + api)), WebsiteUtils.buildRatio(skyWars.optInt("kills_" + api), skyWars.optInt("deaths_" + api)), WebsiteUtils.buildRatio(skyWars.optInt("wins_" + api), skyWars.optInt("losses_" + api)) });
    }
    stats.add(new DisplayTable(lines));
    return stats;
}
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) SimpleDateFormat(java.text.SimpleDateFormat) Date(java.util.Date)

Example 28 with JsonHolder

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

the class SkyWarsStats method getPreview.

@Override
public List<StatsDisplayItem> getPreview(HypixelApiPlayer player) {
    List<StatsDisplayItem> stats = new ArrayList<>();
    JsonHolder skyWars = player.getStats(GameType.SKYWARS);
    stats.add(new DisplayLine(bold("Coins: ", skyWars.optInt("coins"))));
    stats.add(new DisplayLine(bold("Kills: ", skyWars.optInt("kills"))));
    stats.add(new DisplayLine(bold("Assists: ", skyWars.optInt("assists"))));
    stats.add(new DisplayLine(bold("Deaths: ", skyWars.optInt("deaths"))));
    stats.add(new DisplayLine(bold("Wins: ", skyWars.optInt("wins"))));
    stats.add(new DisplayLine(bold("Losses: ", skyWars.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 29 with JsonHolder

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

the class SpeedUHCStats method getPreview.

@Override
public List<StatsDisplayItem> getPreview(HypixelApiPlayer player) {
    List<StatsDisplayItem> stats = new ArrayList<>();
    JsonHolder speedUhc = player.getStats(GameType.SPEED_UHC);
    stats.add(new DisplayLine(bold("Coins: ", speedUhc.optInt("coins"))));
    stats.add(new DisplayLine(bold("Kills: ", speedUhc.optInt("kills"))));
    stats.add(new DisplayLine(bold("Deaths: ", speedUhc.optInt("deaths"))));
    stats.add(new DisplayLine(bold("Wins: ", speedUhc.optInt("wins"))));
    stats.add(new DisplayLine(bold("Losses: ", speedUhc.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 30 with JsonHolder

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

the class TNTGamesStats method getDeepStats.

@Override
public List<StatsDisplayItem> getDeepStats(HypixelApiPlayer player) {
    List<StatsDisplayItem> stats = getPreview(player);
    JsonHolder tntGames = player.getStats(GameType.TNTGAMES);
    stats.add(new DisplayLine(bold("TNT Run Wins: ", tntGames.optInt("wins_tntrun"))));
    stats.add(new DisplayLine(bold("TNT Tag Wins: ", tntGames.optInt("wins_tnttag"))));
    stats.add(new DisplayLine(bold("PVP Run Wins: ", tntGames.optInt("wins_pvprun"))));
    stats.add(new DisplayLine(bold("Bowspleef Wins: ", tntGames.optInt("wins_bowspleef"))));
    stats.add(new DisplayLine(bold("Bowspleef W/L: ", WebsiteUtils.buildRatio(tntGames.optInt("wins_bowspleef"), tntGames.optInt("deaths_bowspleef")))));
    stats.add(new DisplayLine(bold("TNT Wizards Kills: ", tntGames.optInt("kills_capture"))));
    stats.add(new DisplayLine(bold("TNT Wizards Wins: ", tntGames.optInt("wins_capture"))));
    stats.add(new DisplayLine(bold("TNt Wizards K/D: ", WebsiteUtils.buildRatio(tntGames.optInt("kills_capsafture"), tntGames.optInt("deaths_capture")))));
    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)

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