package net.cobem.grizzly.habbohotel.guild;

import java.util.List;

public class GuildHandler {
    private GuildPieceHandler GuildPieceHandler;

    public GuildHandler() {
        GuildPieceHandler = new GuildPieceHandler();
    }

    public GuildPieceHandler getGuildPieces() {
        return GuildPieceHandler;
    }

    public String getImage(int GuildBase, int GuildBaseColor, List<Integer> GStates) {
        List<Integer> list = GStates;
        String str = "";
        int num = 0;
        String str2 = "b";

        if (String.valueOf(GuildBase).length() >= 2) {
            str2 = str2 + GuildBase;
        } else {
            str2 = str2 + "0" + GuildBase;
        }

        str = String.valueOf(GuildBaseColor);

        if (str.length() >= 2) {
            str2 = str2 + str;
        } else if (str.length() <= 1) {
            str2 = str2 + "0" + str;
        }
        int num2 = 0;

        if (list.get(9) != 0) {
            num2 = 4;
        } else if (list.get(6) != 0) {
            num2 = 3;
        } else if (list.get(3) != 0) {
            num2 = 2;
        } else if (list.get(0) != 0) {
            num2 = 1;
        }

        int num3 = 0;

        for (int i = 0; i < num2; i++) {
            str2 = str2 + "s";
            num = list.get(num3) - 20;

            if (String.valueOf(num).length() >= 2) {
                str2 = str2 + num;
            } else {
                str2 = str2 + "0" + num;
            }

            int num5 = list.get(1 + num3);
            str = String.valueOf(num5);

            if (str.length() >= 2) {
                str2 = str2 + str;
            } else if (str.length() <= 1) {
                str2 = str2 + "0" + str;
            }

            str2 = str2 + String.valueOf(list.get(2 + num3));

            switch (num3) {
                case 0:
                    num3 = 3;
                    break;

                case 3:
                    num3 = 6;
                    break;

                case 6:
                    num3 = 9;
                    break;
            }
        }
        return str2;
    }

    public String getHEX(int Color) {
        return getGuildPieces().getThirdColors().get(Color).FirstPiece;
    }


}
