Search in sources :

Example 26 with DisplayLine

use of cc.hyperium.handlers.handlers.stats.display.DisplayLine 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)

Example 27 with DisplayLine

use of cc.hyperium.handlers.handlers.stats.display.DisplayLine in project Hyperium by HyperiumClient.

the class BlitzStats method getPreview.

@Override
public List<StatsDisplayItem> getPreview(HypixelApiPlayer player) {
    ArrayList<StatsDisplayItem> items = new ArrayList<>();
    JsonHolder stats = player.getStats(GameType.SURVIVAL_GAMES);
    items.add(new DisplayLine(bold("Coins: ", stats.optInt("coins")), Color.WHITE.getRGB()));
    items.add(new DisplayLine(bold("Kills: ", stats.optInt("kills")), Color.WHITE.getRGB()));
    items.add(new DisplayLine(bold("Deaths: ", stats.optInt("deaths")), Color.WHITE.getRGB()));
    items.add(new DisplayLine(bold("Wins: ", stats.optInt("wins")), Color.WHITE.getRGB()));
    items.add(new DisplayLine(bold("K/D: ", WebsiteUtils.buildRatio(stats.optInt("kills"), stats.optInt("deaths"))), Color.WHITE.getRGB()));
    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 28 with DisplayLine

use of cc.hyperium.handlers.handlers.stats.display.DisplayLine in project Hyperium by HyperiumClient.

the class AbstractHypixelStats method process.

public void process(HypixelApiPlayer player, ArrayList<StatsDisplayItem> statsDisplayItems, JsonArray ob) {
    for (JsonElement jsonElement : ob) {
        JsonHolder quest = new JsonHolder(jsonElement.getAsJsonObject());
        String quest_backend = quest.optString("id");
        StringBuilder tmp = new StringBuilder(HypixelAPI.INSTANCE.getFrontendNameOfQuest(quest_backend));
        // TODO get quest names
        JsonHolder playerQuestData = player.getQuests().optJSONObject(HypixelAPI.INSTANCE.getFrontendNameOfQuest(quest_backend));
        long last_completed = playerQuestData.optLong("last_completed");
        tmp.append(": ");
        JsonArray requirements = quest.optJSONArray("requirements");
        boolean daily = requirements.size() > 0 && new JsonHolder(requirements.get(0).getAsJsonObject()).optString("type").equalsIgnoreCase("DailyResetQuestRequirement");
        boolean completed = daily ? isToday(last_completed) : isWeek(last_completed);
        if (completed)
            if (daily)
                completedDaily++;
            else
                completedWeekly++;
        if (daily)
            totalDaily++;
        else
            totalWeekly++;
        tmp.append(completed ? C.GREEN + "Completed" : C.RED + "Not Completed");
        statsDisplayItems.add(new DisplayLine(tmp.toString()));
        JsonArray tasks = quest.optJSONArray("objectives");
        JsonHolder objectives = playerQuestData.optJSONObject("active").optJSONObject("objectives");
        for (JsonElement task : tasks) {
            JsonHolder task1 = new JsonHolder(task.getAsJsonObject());
            String line = task1.optString("text");
            if (task1.optString("type").equalsIgnoreCase("IntegerObjective")) {
                line += (objectives.optInt(task1.optString("id")) + "/" + task1.optInt("integer"));
            }
            if (!completed && !line.isEmpty()) {
                statsDisplayItems.add(new DisplayLine("  - " + line));
            }
        }
    }
}
Also used : JsonHolder(cc.hyperium.utils.JsonHolder) JsonArray(com.google.gson.JsonArray) DisplayLine(cc.hyperium.handlers.handlers.stats.display.DisplayLine) JsonElement(com.google.gson.JsonElement)

Example 29 with DisplayLine

use of cc.hyperium.handlers.handlers.stats.display.DisplayLine in project Hyperium by HyperiumClient.

the class AbstractHypixelStats method getPreview.

public List<StatsDisplayItem> getPreview(HypixelApiPlayer player) {
    ArrayList<StatsDisplayItem> items = new ArrayList<>();
    GameType gameType = GameType.fromRealName(getName());
    if (gameType == null) {
        items.add(new DisplayLine("No default preview for " + getName(), Color.WHITE.getRGB()));
    } else {
        JsonHolder stats = player.getStats(gameType);
        items.add(new DisplayLine(bold("Coins: ", stats.optInt("coins")), Color.WHITE.getRGB()));
        items.add(new DisplayLine(bold("Kills: ", stats.optInt("kills")), Color.WHITE.getRGB()));
        items.add(new DisplayLine(bold("Deaths: ", stats.optInt("deaths")), Color.WHITE.getRGB()));
        items.add(new DisplayLine(bold("Wins: ", stats.optInt("wins")), Color.WHITE.getRGB()));
        items.add(new DisplayLine(bold("Losses: ", stats.optInt("losses")), Color.WHITE.getRGB()));
        items.add(new DisplayLine(bold("K/D: ", WebsiteUtils.buildRatio(stats.optInt("kills"), stats.optInt("deaths"))), Color.WHITE.getRGB()));
        items.add(new DisplayLine(bold("W/L: ", WebsiteUtils.buildRatio(stats.optInt("wins"), stats.optInt("losses"))), Color.WHITE.getRGB()));
    }
    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) GameType(net.hypixel.api.GameType)

Example 30 with DisplayLine

use of cc.hyperium.handlers.handlers.stats.display.DisplayLine in project Hyperium by HyperiumClient.

the class ArenaStats method getPreview.

@Override
public List<StatsDisplayItem> getPreview(HypixelApiPlayer player) {
    ArrayList<StatsDisplayItem> items = new ArrayList<>();
    JsonHolder arena = player.getStats(GameType.ARENA);
    items.add(new DisplayLine(bold("Coins: ", arena.optInt("coins"))));
    int kills = arena.optInt("kills_1v1") + arena.optInt("kills_2v2") + arena.optInt("kills_4v4");
    items.add(new DisplayLine(bold("Kills: ", kills), Color.WHITE.getRGB()));
    int deaths = arena.optInt("deaths_1v1") + arena.optInt("deaths_2v2") + arena.optInt("deaths_4v4");
    items.add(new DisplayLine(bold("Deaths: ", deaths), Color.WHITE.getRGB()));
    int wins = arena.optInt("wins_1v1") + arena.optInt("wins_2v2") + arena.optInt("wins_4v4");
    items.add(new DisplayLine(bold("Wins: ", wins), Color.WHITE.getRGB()));
    int losses = arena.optInt("losses_1v1") + arena.optInt("losses_2v2") + arena.optInt("losses_4v4");
    items.add(new DisplayLine(bold("Losses: ", losses), Color.WHITE.getRGB()));
    items.add(new DisplayLine(bold("K/D: ", WebsiteUtils.buildRatio(kills, deaths)), Color.WHITE.getRGB()));
    items.add(new DisplayLine(bold("W/L: ", WebsiteUtils.buildRatio(wins, losses)), Color.WHITE.getRGB()));
    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)

Aggregations

DisplayLine (cc.hyperium.handlers.handlers.stats.display.DisplayLine)44 StatsDisplayItem (cc.hyperium.handlers.handlers.stats.display.StatsDisplayItem)43 JsonHolder (cc.hyperium.utils.JsonHolder)42 ArrayList (java.util.ArrayList)32 DisplayTable (cc.hyperium.handlers.handlers.stats.display.DisplayTable)10 SimpleDateFormat (java.text.SimpleDateFormat)2 Date (java.util.Date)2 Pet (club.sk1er.website.Pet)1 JsonArray (com.google.gson.JsonArray)1 JsonElement (com.google.gson.JsonElement)1 GameType (net.hypixel.api.GameType)1