public static boolean isAllowed(String type, final String key) { if (KoLCharacter.isTrendy() && !TrendyRequest.isTrendy(type, key)) { return false; } if (!KoLCharacter.getRestricted()) { return true; } if (type.equals("Bookshelf")) { type = "Bookshelf Books"; } else if (type.equals("Clan Item")) { type = "Clan Items"; } if (type.equals("Bookshelf Books")) { // Work around a KoL bug: most restricted books are // listed both under Bookshelf Books and Items, but // 3 are listed under only one or the other. return StandardRequest.isNotRestricted("Bookshelf Books", key) && StandardRequest.isNotRestricted("Items", key); } List<String> list = StandardRequest.typeToList(type); return list != null && StandardRequest.isNotRestricted(list, key); }
public static final void parseResponse(final String location, final String responseText) { TrendyRequest.reset(); Matcher matcher = StandardRequest.STANDARD_PATTERN.matcher(responseText); while (matcher.find()) { String type = matcher.group(1); List<String> list = StandardRequest.typeToList(type); if (list == null) { continue; } Matcher objectMatcher = StandardRequest.OBJECT_PATTERN.matcher(matcher.group(2)); while (objectMatcher.find()) { String object = objectMatcher.group(1).trim().toLowerCase(); if (object.length() > 0) { list.add(object); } } } // Buggy items that should be on the list but aren't. if (!itemMap.isEmpty()) { itemMap.add("actual reality goggles"); } StandardRequest.initialized = true; }