Пример #1
0
 /**
  * Get a list of quests this player can obtain.<br>
  * This follows the content system, in which:<br>
  *
  * <ul>
  *   <li>If the List size is 0, then there are no available quests.
  *   <li>If the List size is greater than 0, then there are quests.
  *   <li>If the List <b>object</b> is <code>null</code>, then there is an active quest given.
  * </ul>
  *
  * @param player Player to lookup
  * @param desc NPC to lookup
  * @return List of quests, or <code>null</code>.
  */
 public static List<String> getAvailableQuests(Player player, NPCDescription desc) {
   List<String> quests = desc.getQuests();
   List<String> availablequests = new ArrayList<String>();
   for (String q : quests) {
     LogStatus l = QuestStatisticUtils.hasQuest(player.getName(), q);
     if (l == LogStatus.GIVEN || l == LogStatus.ACTIVE) {
       availablequests = null;
       break;
     } else if (l == LogStatus.UNKNOWN) {
       availablequests.add(q);
     } else {
       QuestDetails details = Managers.getQuestManager().getDetails(q);
       if (details != null) {
         if (QuestDetailsUtils.getRequirementsMet(details, player)) availablequests.add(q);
       }
     }
   }
   return availablequests;
 }