Class BringOrderedListOfItemsQuestLogic

java.lang.Object
games.stendhal.server.maps.quests.logic.BringOrderedListOfItemsQuestLogic

public class BringOrderedListOfItemsQuestLogic extends Object
Basic behavior for quests which are based on bringing a list of items to an NPC, in a specific order. The NPC keeps track of the items already brought to him.
  • Constructor Details

    • BringOrderedListOfItemsQuestLogic

      public BringOrderedListOfItemsQuestLogic()
  • Method Details

    • itemsStillNeeded

      public String itemsStillNeeded(Player player)
      Gets a sentence to be said by the NPC, enumerating the items that still need to be brought. The item names are not prefixed by a hash. For a variant where they are, see itemsStillNeededWithHash(Player).
      Parameters:
      player - the player which needs to bring items
      Returns:
      an enumeration of still needed items
      See Also:
      itemsStillNeededWithHash(Player)
    • itemsStillNeededWithHash

      public String itemsStillNeededWithHash(Player player)
      Gets a sentence to be said by the NPC, enumerating the items that still need to be brought. The item names are prefixed by a hash. For a variant where they aren't, see itemsStillNeeded(Player).
      Parameters:
      player - the player which needs to bring items
      Returns:
      an enumeration of still needed items
      See Also:
      itemsStillNeeded(Player)
    • neededItemsWithAmounts

      public List<String> neededItemsWithAmounts(Player player)
      Gets a list of items that still need to be brought. Each item is prefixed by the quantity still needed. An example list element: "5 iron bars". For a sentence that groups the list items, see itemsStillNeeded(Player).
      Parameters:
      player - the player which needs to bring items
      Returns:
      a list of still needed items, along with their respective quantities
      See Also:
      itemsStillNeeded(Player)
    • proceedItems

      public boolean proceedItems(Player player, EventRaiser eventRaiser)
      Give items to the NPC, in the required order.
      Parameters:
      player - the player which needs to bring items
      eventRaiser - the NPC that should say what's the next item to bring
      Returns:
      true if there are still items to bring after this, false otherwise
    • updateQuantitiesInQuestStatus

      public void updateQuantitiesInQuestStatus(Player player)
      Updates the status of the player's quest with the quantities of already brought items.
      Parameters:
      player - the player for which to update the quest status
    • setItemCollector

      public void setItemCollector(ItemCollector itemCollector)
      Sets the item collector to be used.
      Parameters:
      itemCollector - an ItemCollector
    • setQuest

      public void setQuest(IQuest quest)
      Sets the quest on which to apply the logic.
      Parameters:
      quest - a quest