public static Badge getGuildBadge(CharacterWrapper character) { String guildBadgeName = character.getCurrentGuildBadgeName(); if (guildBadgeName != null) { return new Badge( ImageCache.getIcon("badges/" + guildBadgeName), character.getCurrentGuildLevelName()); } return null; }
public static Badge getBadge(CharacterWrapper character, String advantage) { String key = character.getGameObject().getStringId() + advantage; Badge badge = cached.get(key); if (badge == null) { ImageIcon icon; if (character.getGameObject().hasThisAttribute(Constants.CUSTOM_CHARACTER)) { String badgeName = "custom/badges/one"; // default for (int n = 1; n <= 4; n++) { String levelKey = "level_" + n; ArrayList list = character.getGameObject().getAttributeList(levelKey, "advantages"); if (list != null && list.contains(advantage)) { badgeName = character.getGameObject().getAttribute(levelKey, "badge_icon"); break; } } icon = ImageCache.getIcon(badgeName); } else { icon = ImageCache.getIcon(makeBadgeName(advantage)); } badge = new Badge(icon, advantage); cached.put(key, badge); } return badge; }