public static void handleEmblem(final String root, Guilde g) { saveImage(root + "/images/emblem/", BattleApiConstants.getEmblemeRing(g)); saveImage(root + "/images/emblem/", BattleApiConstants.getEmblemeIcon(g.getEmblem())); saveImage(root + "/images/emblem/", BattleApiConstants.getEmblemeBorder(g.getEmblem())); saveImage(root + "/images/emblem/", BattleApiConstants.getEmblemeBg(g.getEmblem())); saveImage(root + "/images/emblem/", BattleApiConstants.getEmblemeOverlay(g.getEmblem())); saveImage(root + "/images/emblem/", BattleApiConstants.getEmblemeShadow(g.getEmblem())); saveImage(root + "/images/emblem/", BattleApiConstants.getEmblemeHooks()); }
public static void saveSpecImages(String root, List<PersonnageDisplay> list) { List<String> specs = new ArrayList<String>(); for (PersonnageDisplay p : list) { if (!specs.contains(p.getSpecIcon())) { specs.add(p.getSpecIcon()); } } for (String spec : specs) { spec = BattleApiConstants.buildSpecIconUrl(spec); saveImage(root + "/images/specs/", spec); } }
public static Personnage getPersonnage(final String name, final String realm) { String readCharacter = queryBattle(BattleApiConstants.getCharacterQueryUrl(name, realm)); LOGGER.debug(readCharacter); if (readCharacter == null) { return null; } Personnage p = new Personnage(); try { ObjectMapper mapper = new ObjectMapper(); ObjectReader reader = mapper.readerFor(Personnage.class); p = reader.readValue(readCharacter); } catch (Exception e) { LOGGER.error(e); } return p; }
public static Guilde getGuilde() { String readGuildMembersCount = queryBattle(BattleApiConstants.getGuildeMembersQueryUrl()); LOGGER.debug(readGuildMembersCount); if (readGuildMembersCount == null) { return null; } readGuildMembersCount = readGuildMembersCount.substring(readGuildMembersCount.indexOf("(") + 1); readGuildMembersCount = readGuildMembersCount.substring(0, readGuildMembersCount.length() - 2); Guilde g = new Guilde(); try { ObjectMapper mapper = new ObjectMapper(); ObjectReader reader = mapper.readerFor(Guilde.class); g = reader.readValue(readGuildMembersCount); LOGGER.info("Nombre de membres " + g.getMembers().size()); } catch (Exception e) { LOGGER.error(e); } return g; }
private static List<Race> getListRaces() { String sRaces = queryBattle(BattleApiConstants.getRacesQueryUrl()); LOGGER.debug(sRaces); if (sRaces == null) { return null; } List<Race> races = new ArrayList<Race>(); try { ObjectMapper mapper = new ObjectMapper(); ObjectReader reader = mapper.readerFor(new TypeReference<List<Race>>() {}).withRootName("races"); races = reader.readValue(sRaces); LOGGER.debug("Nombre de races " + races.size()); for (Race race : races) { LOGGER.debug(race.toString()); } } catch (Exception e) { LOGGER.error(e); } return races; }
public static void saveRoleImages(String root) { saveImage(root + "/images/roles/", BattleApiConstants.getRoleIcon()); }