Search in sources :

Example 36 with JsonHolder

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

the class BedWarsStats method getPreview.

@Override
public List<StatsDisplayItem> getPreview(HypixelApiPlayer player) {
    ArrayList<StatsDisplayItem> items = new ArrayList<>();
    JsonHolder bedwars = player.getStats(GameType.BEDWARS);
    items.add(new DisplayLine(bold("Coins: ", bedwars.optInt("coins")), Color.WHITE.getRGB()));
    items.add(new DisplayLine(bold("Kills: ", bedwars.optInt("kills_bedwars")), Color.WHITE.getRGB()));
    items.add(new DisplayLine(bold("Deaths: ", bedwars.optInt("deaths_bedwars")), Color.WHITE.getRGB()));
    items.add(new DisplayLine(bold("Wins: ", bedwars.optInt("wins_bedwars")), Color.WHITE.getRGB()));
    items.add(new DisplayLine(bold("Losses: ", bedwars.optInt("losses_bedwars")), Color.WHITE.getRGB()));
    items.add(new DisplayLine(bold("K/D: ", WebsiteUtils.buildRatio(bedwars.optInt("kills_bedwars"), bedwars.optInt("deaths_bedwars"))), Color.WHITE.getRGB()));
    items.add(new DisplayLine(bold("W/L: ", WebsiteUtils.buildRatio(bedwars.optInt("wins_bedwars"), bedwars.optInt("losses_bedwars"))), Color.WHITE.getRGB()));
    items.add(new DisplayLine(""));
    items.add(new DisplayLine(bold("Bedwars level: ", WebsiteUtils.getBedwarsLevel(bedwars.optInt("Experience") + bedwars.optInt("Experience_new")))));
    items.add(new DisplayLine(bold("Beds Broken: ", bedwars.optInt("beds_broken_bedwars"))));
    items.add(new DisplayLine(""));
    items.add(new DisplayLine(bold("Final Kills: ", bedwars.optInt("final_kills_bedwars"))));
    items.add(new DisplayLine(bold("Final Deaths: ", bedwars.optInt("final_deaths_bedwars"))));
    items.add(new DisplayLine(bold("Final K/D: ", WebsiteUtils.buildRatio(bedwars.optInt("final_kills_bedwars"), bedwars.optInt("final_deaths_bedwars")))));
    items.add(new DisplayLine(bold("Final Kill / Normal deaths: ", WebsiteUtils.buildRatio(bedwars.optInt("final_kills_bedwars"), bedwars.optInt("deaths_bedwars")))));
    return items;
}
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 37 with JsonHolder

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

the class BedWarsStats method getDeepStats.

@Override
public List<StatsDisplayItem> getDeepStats(HypixelApiPlayer player) {
    List<StatsDisplayItem> preview = getPreview(player);
    preview.add(new DisplayLine(""));
    List<String[]> lines = new ArrayList<>();
    JsonHolder bedwars = player.getStats(GameType.BEDWARS);
    String[] bedwarsnames = { "Solo", "Doubles", "3v3v3v3", "4v4v4v4" };
    String[] bedwarsBackend = { "eight_one", "eight_two", "four_three", "four_four" };
    lines.add(new String[] { "Mode", "Kills", "Deaths", "Wins", "Losses", "Final Kills", "Final Deaths", "Beds Broken", "K/D", "Final K/D", "W/L" });
    for (int i = 0; i < bedwarsnames.length; i++) {
        lines.add(new String[] { bedwarsnames[i], WebsiteUtils.comma(bedwars.optInt(bedwarsBackend[i] + "_kills_bedwars")), WebsiteUtils.comma(bedwars.optInt(bedwarsBackend[i] + "_deaths_bedwars")), WebsiteUtils.comma(bedwars.optInt(bedwarsBackend[i] + "_wins_bedwars")), WebsiteUtils.comma(bedwars.optInt(bedwarsBackend[i] + "_losses_bedwars")), WebsiteUtils.comma(bedwars.optInt(bedwarsBackend[i] + "_final_kills_bedwars")), WebsiteUtils.comma(bedwars.optInt(bedwarsBackend[i] + "_final_deaths_bedwars")), WebsiteUtils.comma(bedwars.optInt(bedwarsBackend[i] + "_beds_broken_bedwars")), WebsiteUtils.buildRatio(bedwars.optInt(bedwarsBackend[i] + "_kills_bedwars"), bedwars.optInt(bedwarsBackend[i] + "_deaths_bedwars")), WebsiteUtils.buildRatio(bedwars.optInt(bedwarsBackend[i] + "_final_kills_bedwars"), bedwars.optInt(bedwarsBackend[i] + "_final_deaths_bedwars")), WebsiteUtils.buildRatio(bedwars.optInt(bedwarsBackend[i] + "_wins_bedwars"), bedwars.optInt(bedwarsBackend[i] + "_losses_bedwars")) });
    }
    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 38 with JsonHolder

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

the class GeneralStats method getDeepStats.

@Override
public List<StatsDisplayItem> getDeepStats(HypixelApiPlayer player) {
    List<StatsDisplayItem> items = getPreview(player);
    JsonHolder giftm = player.getGiftMeta();
    items.add(new DisplayLine(""));
    items.add(new DisplayLine(bold("Gift given: ", giftm.optInt("realBundlesGiven"))));
    items.add(new DisplayLine(bold("Gift received: ", giftm.optInt("realBundlesReceived"))));
    items.add(new DisplayLine(""));
    if (player.has("mostRecentGameType")) {
        items.add(new DisplayLine(bold("Most recent played: ", player.mostRecentGame().getName())));
        items.add(new DisplayLine(""));
    }
    items.add(new DisplayLine(bold("Rewards Claimed: ", player.getInt("totalRewards"))));
    items.add(new DisplayLine(bold("Daily Rewards Claimed: ", player.getInt("totalDailyRewards"))));
    items.add(new DisplayLine(bold("Best Rewards Streak: ", player.getInt("rewardHighScore"))));
    items.add(new DisplayLine(bold("Current reward streak: ", player.getInt("rewardScore"))));
    items.add(new DisplayLine(""));
    items.add(new DisplayLine(bold("Times voted: ", player.getInt("voting#total"))));
    items.add(new DisplayLine(""));
    JsonHolder petss2 = player.getRoot().optJSONObject("petStats");
    List<String[]> strings = new ArrayList<>();
    strings.add(new String[] { "Name", "Level" });
    for (String in : petss2.getKeys()) {
        JsonHolder tmp = petss2.optJSONObject(in);
        Pet pet = new Pet(tmp);
        String name;
        if (tmp.has("name"))
            name = tmp.optString("name");
        else
            name = in.replace("_", " ").toLowerCase();
        strings.add(new String[] { name, Integer.toString(pet.level) });
    }
    items.add(new DisplayLine("Pets", Color.WHITE.getRGB(), 2));
    items.add(new DisplayTable(strings));
    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) Pet(club.sk1er.website.Pet)

Example 39 with JsonHolder

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

the class MurderMysteryStats method getPreview.

@Override
public List<StatsDisplayItem> getPreview(HypixelApiPlayer player) {
    List<StatsDisplayItem> preview = new ArrayList<>();
    JsonHolder stats = player.getStats(GameType.MURDER_MYSTERY);
    preview.add(new DisplayLine(""));
    preview.add(new DisplayLine("General"));
    preview.add(new DisplayLine(bold("Coins: ", stats.optInt("coins"))));
    preview.add(new DisplayLine(""));
    preview.add(new DisplayLine("Overall Stats"));
    preview.add(new DisplayLine(bold("Kills: ", stats.optInt("kills"))));
    preview.add(new DisplayLine(bold("Wins: ", stats.optInt("wins"))));
    preview.add(new DisplayLine(bold("Deaths: ", stats.optInt("deaths"))));
    preview.add(new DisplayLine(bold("Bow Kills: ", stats.optInt("bow_kills"))));
    preview.add(new DisplayLine(bold("K/D: ", WebsiteUtils.buildRatio(stats.optInt("kills"), stats.optInt("deaths")))));
    preview.add(new DisplayLine(bold("W/L: ", WebsiteUtils.buildRatio(stats.optInt("wins"), stats.optInt("deaths")))));
    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) ArrayList(java.util.ArrayList)

Example 40 with JsonHolder

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

the class MurderMysteryStats method getDeepStats.

@Override
public List<StatsDisplayItem> getDeepStats(HypixelApiPlayer player) {
    List<StatsDisplayItem> preview = getPreview(player);
    JsonHolder stats = player.getStats(GameType.MURDER_MYSTERY);
    preview.add(new DisplayLine(""));
    preview.add(new DisplayLine("Classic Stats"));
    preview.add(new DisplayLine(bold("Kills: ", stats.optInt("kills_MURDER_CLASSIC"))));
    preview.add(new DisplayLine(bold("Wins: ", stats.optInt("wins_MURDER_CLASSIC"))));
    preview.add(new DisplayLine(bold("Deaths: ", stats.optInt("deaths_MURDER_CLASSIC"))));
    preview.add(new DisplayLine(bold("Bow Kills: ", stats.optInt("bow_kills"))));
    preview.add(new DisplayLine(bold("K/D: ", WebsiteUtils.buildRatio(stats.optInt("kills_MURDER_CLASSIC"), stats.optInt("deaths_MURDER_CLASSIC")))));
    preview.add(new DisplayLine(bold("W/L: ", WebsiteUtils.buildRatio(stats.optInt("wins_MURDER_CLASSIC"), stats.optInt("deaths_MURDER_CLASSIC")))));
    preview.add(new DisplayLine(""));
    preview.add(new DisplayLine("Hardcore Stats"));
    preview.add(new DisplayLine(bold("Kills: ", stats.optInt("kills_MURDER_HARDCORE"))));
    preview.add(new DisplayLine(bold("Wins: ", stats.optInt("wins_MURDER_HARDCORE"))));
    preview.add(new DisplayLine(bold("Deaths: ", stats.optInt("deaths_MURDER_HARDCORE"))));
    preview.add(new DisplayLine(bold("Bow Kills: ", stats.optInt("bow_kills"))));
    preview.add(new DisplayLine(bold("K/D: ", WebsiteUtils.buildRatio(stats.optInt("kills_MURDER_HARDCORE"), stats.optInt("deaths_MURDER_HARDCORE")))));
    preview.add(new DisplayLine(bold("W/L: ", WebsiteUtils.buildRatio(stats.optInt("wins_MURDER_HARDCORE"), stats.optInt("deaths_MURDER_HARDCORE")))));
    preview.add(new DisplayLine(""));
    preview.add(new DisplayLine("Assassins Stats"));
    preview.add(new DisplayLine(bold("Kills: ", stats.optInt("kills_MURDER_ASSASSINS"))));
    preview.add(new DisplayLine(bold("Wins: ", stats.optInt("wins_MURDER_ASSASSINS"))));
    preview.add(new DisplayLine(bold("Deaths: ", stats.optInt("deaths_MURDER_ASSASSINS"))));
    preview.add(new DisplayLine(bold("Bow Kills: ", stats.optInt("bow_kills"))));
    preview.add(new DisplayLine(bold("K/D: ", WebsiteUtils.buildRatio(stats.optInt("kills_MURDER_ASSASSINS"), stats.optInt("deaths_MURDER_ASSASSINS")))));
    preview.add(new DisplayLine(bold("W/L: ", WebsiteUtils.buildRatio(stats.optInt("wins_MURDER_ASSASSINS"), stats.optInt("deaths_MURDER_ASSASSINS")))));
    String[] murderMysteryModes = { "All", "Classic", "Assassins", "Hardcore" };
    String[] murderMysteryNames = { "", "_MURDER_CLASSIC", "_MURDER_ASSASIANS", "_MURDER_HARDCORE" };
    List<String[]> lines = new ArrayList<>();
    preview.add(new DisplayLine(""));
    lines.add(new String[] { "Mode", "Kills", "Wins", "Deaths", "Hero", "Bow Kills" });
    for (int i = 0; i < murderMysteryModes.length; i++) {
        String name = murderMysteryModes[i];
        String seed = murderMysteryNames[i];
        lines.add(new String[] { name, String.valueOf(stats.optInt("kills" + seed)), String.valueOf(stats.optInt("wins" + seed)), String.valueOf(stats.optInt("deaths" + seed)), String.valueOf(stats.optInt("was_hero" + seed)), String.valueOf(stats.optInt("bow_kills" + seed)) });
    }
    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)

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