Search in sources :

Example 1 with GameType

use of net.hypixel.api.GameType in project Hyperium by HyperiumClient.

the class GuildStatsGui method drawScreen.

@Override
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
    super.drawScreen(mouseX, mouseY, partialTicks);
    ScaledResolution current = ResolutionUtil.current();
    drawScaledText(guild.getName() + " " + guild.getFormatedTag(), current.getScaledWidth() / 2, 30, 3, -1, true, true);
    int columnX = current.getScaledWidth() / 50;
    int offsetLeftColumn = offset + 50;
    fontRendererObj.drawString(boldText("Founded: ", HypixelApiPlayer.DMY.format(new Date(guild.getCreateDate()))), columnX, 100 - offsetLeftColumn, -1, true);
    fontRendererObj.drawString(boldText("Members: ", WebsiteUtils.comma(guild.getMembers().size())), columnX, 110 - offsetLeftColumn, -1, true);
    fontRendererObj.drawString(boldText("Guild Coins: ", WebsiteUtils.comma(guild.getTotalGuildCoins())), columnX, 120 - offsetLeftColumn, -1, true);
    fontRendererObj.drawString(boldText("Legacy Ranking: ", WebsiteUtils.comma(guild.getLegacyRanking())), columnX, 130 - offsetLeftColumn, -1, true);
    List<String> strings = fontRendererObj.listFormattedStringToWidth(boldText("Description: ", guild.getDescription()), current.getScaledWidth() / 4);
    int i = 0;
    for (String string : strings) {
        fontRendererObj.drawString(string, columnX, 140 + i - offsetLeftColumn, -1, true);
        i += 10;
    }
    fontRendererObj.drawString(boldText("Guild Level: ", Double.toString(guild.getLevel())), columnX, 150 + i - offsetLeftColumn, -1, true);
    fontRendererObj.drawString(boldText("Total Wins: ", Integer.toString(guild.getWins("total"))), columnX, 170 + i - offsetLeftColumn, -1, true);
    for (GameType gameType : GameType.values()) {
        if (gameType == GameType.UNKNOWN || gameType == GameType.LEGACY)
            continue;
        fontRendererObj.drawString(boldText(gameType.getName() + " Wins: ", Integer.toString(guild.getWins(gameType.name()))), columnX, 180 + i - offsetLeftColumn, -1, true);
        i += 10;
    }
    List<HypixelApiGuild.GuildPlayer> inOrder = guild.getInOrder();
    int memberX = 2 * current.getScaledWidth() / 6;
    int memberStart = 50 - offset;
    int memberWidth = current.getScaledWidth() - memberX - 40;
    fontRendererObj.drawString(C.BOLD + "Name", memberX, memberStart, -1, true);
    fontRendererObj.drawString(C.BOLD + "Rank", memberX + memberWidth / 3F, memberStart, -1, true);
    fontRendererObj.drawString(C.BOLD + "Join date", memberX + memberWidth / 3F * 2, memberStart, -1, true);
    memberStart += 10;
    for (HypixelApiGuild.GuildPlayer guildPlayer : inOrder) {
        String display = guildPlayer.getDisplay();
        fontRendererObj.drawString(display, memberX, memberStart, -1, true);
        String rank = guildPlayer.getRank();
        if (rank.equals("GUILDMASTER"))
            rank = "Guild Master";
        if (rank.equals("OFFICER"))
            rank = "Officer";
        if (rank.equals("MEMBER"))
            rank = "Member";
        fontRendererObj.drawString(rank, memberX + memberWidth / 3F, memberStart, -1, true);
        fontRendererObj.drawString(HypixelApiPlayer.DMYHHMMSS.format(guildPlayer.getJoinLong()), memberX + memberWidth / 3F * 2, memberStart, -1, true);
        memberStart += 10;
    }
}
Also used : ScaledResolution(net.minecraft.client.gui.ScaledResolution) HypixelApiGuild(club.sk1er.website.api.requests.HypixelApiGuild) GameType(net.hypixel.api.GameType) Date(java.util.Date)

Example 2 with GameType

use of net.hypixel.api.GameType 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)

Aggregations

GameType (net.hypixel.api.GameType)2 DisplayLine (cc.hyperium.handlers.handlers.stats.display.DisplayLine)1 StatsDisplayItem (cc.hyperium.handlers.handlers.stats.display.StatsDisplayItem)1 JsonHolder (cc.hyperium.utils.JsonHolder)1 HypixelApiGuild (club.sk1er.website.api.requests.HypixelApiGuild)1 ArrayList (java.util.ArrayList)1 Date (java.util.Date)1 ScaledResolution (net.minecraft.client.gui.ScaledResolution)1