Class AbstractQuest

java.lang.Object
games.stendhal.server.maps.quests.AbstractQuest
All Implemented Interfaces:
IQuest
Direct Known Subclasses:
AdMemoriaInPortfolio, AdosDeathmatch, AdventureIsland, AGrandfathersWish, AntivenomRing, BalloonForBobby, Blackjack, BowsForOuchit, BuiltQuest, CaptureFlagQuest, ChocolateForElisabeth, CloakCollector, CloakCollector2, CloaksForBario, ClubOfThorns, CodedMessageFromFinnFarmer, CollectEnemyData, CrownForTheWannaBeKing, DailyItemQuest, DailyMonsterQuest, DiceGambling, DragonLair, EasterGiftsForChildren, ElfPrincess, ElvishArmor, EmotionCrystals, FindGhosts, FindJefsMom, FindRatChildren, FishermansLicenseCollector, FishermansLicenseQuiz, FishSoup, FishSoupForHughie, FruitsForCoralia, GoodiesForRudolph, GuessKills, HelpMrsYeti, HelpTomi, HelpWithTheHarvest, HerbsForCarmen, HerbsForJynath, HouseBuying, HungryJoshua, IcecreamForAnnie, ImperialPrincess, JailedBarbarian, JailedDwarf, KanmararnSoldiers, KillBlordroughs, KillDarkElves, KillDhohrNuggetcutter, KillEnemyArmy, KillMonks, KillSpiders, KoboldishTorcibud, LearnAboutKarma, LearnAboutOrbs, LookUpQuote, LuaQuestHelper.LuaQuest, Marriage, Maze, McPeglegIOU, MealForGroongo, MedicineForTad, MeetBunny, MeetHackim, MeetHayunn, MeetIo, MeetKetteh, MeetMarieHenri, MeetMonogenes, MeetSanta, MeetZynn, MineTownRevivalWeeks, MineTownRevivalWeeksConstruction, MithrilCloak, MixtureForOrtiv, MuseumEntranceFee, NewsFromHackim, ObsidianKnife, PaperChase, RainbowBeans, RestockFlowerShop, ReverseArrow, RingMaker, SadScientist, ScubaLicenseQuiz, SevenCherubs, SheepGrowing, Snowballs, SolveRiddles, Soup, StuffForBaldemar, StuffForVulcanus, SuntanCreamForZara, SuppliesForPhalk, TakeGoldforGrafindle, TheMissingBooks, ThePiedPiper, ToysCollector, TutorialIsland, UltimateCollector, VampireSword, WaterForXhiphin, WeaponsCollector, WeaponsCollector2, WeeklyItemQuest, WizardBank, ZekielsPracticalTestQuest, ZooFood

public abstract class AbstractQuest extends Object implements IQuest
Abstract class for quests. This is a default implementation of IQuest.
Author:
hendrik
  • Field Details

    • questInfo

      protected QuestInfo questInfo
    • npcs

      protected NPCList npcs
      NPCList.
  • Constructor Details

    • AbstractQuest

      public AbstractQuest()
  • Method Details

    • getQuestInfo

      public QuestInfo getQuestInfo(Player player)
      Description copied from interface: IQuest
      function will return information about this quest
      Specified by:
      getQuestInfo in interface IQuest
      Parameters:
      player - - player for whom required quest info
      Returns:
      - QuestInfo object with info about this quest
    • updatePlayer

      public void updatePlayer(Player player)
      Specified by:
      updatePlayer in interface IQuest
      Parameters:
      player - Player
    • fillQuestInfo

      public void fillQuestInfo(String name, String description, boolean repeatable, Integer completionsOpenIndex, Integer completionsCompleteIndex)
      fill fields of questInfo object with info about this quest
      Parameters:
      name - - name of the quest
      description - - short description of this quest in a neutral tense (not first person)
      repeatable - - is quest repeatable or not
      completionsOpenIndex - Slot index where completions count is stored while quest is in open state.
      completionsCompleteIndex - Slot index where completions count is stored while quest is in complete state.
    • fillQuestInfo

      public void fillQuestInfo(String name, String description, boolean repeatable, int completionsIndex)
      fill fields of questInfo object with info about this quest
      Parameters:
      name - - name of the quest
      description - - short description of this quest in a neutral tense (not first person)
      repeatable - - is quest repeatable or not
      completionsIndex - Slot index where completions count is stored while quest in open or complete state.
    • fillQuestInfo

      public void fillQuestInfo(String name, String description, boolean repeatable, Pair<Integer,Integer> completionsIndex)
      fill fields of questInfo object with info about this quest
      Parameters:
      name - - name of the quest
      description - - short description of this quest in a neutral tense (not first person)
      repeatable - - is quest repeatable or not
      completionsIndexes - Pair of indexes where first value represents slot index for open state and second represents index for complete state.
    • fillQuestInfo

      public void fillQuestInfo(String name, String description, boolean repeatable)
      fill fields of questInfo object with info about this quest
      Parameters:
      name - - name of the quest
      description - - short description of this quest in a neutral tense (not first person)
      repeatable - - is quest repeatable or not
    • getSlotName

      public abstract String getSlotName()
      The slot-name in !quests.
      Specified by:
      getSlotName in interface IQuest
      Returns:
      the slot's name
    • addToWorld

      public abstract void addToWorld()
      Description copied from interface: IQuest
      adds the quest to the game world (e.g. by placing SpeakerNPCs there)
      Specified by:
      addToWorld in interface IQuest
    • removeFromWorld

      public boolean removeFromWorld()
      removes a quest from the world.
      Specified by:
      removeFromWorld in interface IQuest
      Returns:
      true, if the quest could be removed; false otherwise.
    • getHint

      public List<String> getHint(Player player)
      Description copied from interface: IQuest
      Gets a list of possible hint-names.

      The hint system will ensure that the same hint is not displayed twice. This class creates a list of useful hints (without hints about already completed parts).

      Specified by:
      getHint in interface IQuest
      Parameters:
      player - Player
      Returns:
      list of history item-names
    • getMinLevel

      public int getMinLevel()
      Description copied from interface: IQuest
      Returns the minimum level of player expected to start the quest. Used for choosing which hints to give. To set a hard minimum level requirement for doing the quest, use level related ChatConditions in the quest methods
      Specified by:
      getMinLevel in interface IQuest
      Returns:
      level
    • getFormattedHistory

      public List<String> getFormattedHistory(Player player)
      Specified by:
      getFormattedHistory in interface IQuest
    • isCompleted

      public boolean isCompleted(Player player)
      Description copied from interface: IQuest
      Was the quest completed? Note: A quest can be completed without its status being "Done" (e. g. rejected, failed).
      Specified by:
      isCompleted in interface IQuest
      Parameters:
      player - Player
      Returns:
      true, if it was completed, false otherwise
    • getCompletedCount

      public int getCompletedCount(Player player)
      Description copied from interface: IQuest
      Retrieves number of times player has completed quest.
      Specified by:
      getCompletedCount in interface IQuest
      Parameters:
      player - Player for whom quest is being checked.
      Returns:
      Number of completions.
    • isRepeatable

      public boolean isRepeatable(Player player)
      Description copied from interface: IQuest
      May the quest be repeated?
      Specified by:
      isRepeatable in interface IQuest
      Parameters:
      player - Player
      Returns:
      true, if it can be repeated, false otherwise
    • isStarted

      public boolean isStarted(Player player)
      Description copied from interface: IQuest
      Was the quest started?
      Specified by:
      isStarted in interface IQuest
      Parameters:
      player - Player
      Returns:
      true, if it was started, false otherwise
    • getName

      public abstract String getName()
      Description copied from interface: IQuest
      Returns the name of the quest.
      Specified by:
      getName in interface IQuest
      Returns:
      name
    • isVisibleOnQuestStatus

      public boolean isVisibleOnQuestStatus()
      Denotes whether quest details should be included in travel log. Override to create custom checks.
      Specified by:
      isVisibleOnQuestStatus in interface IQuest
      Returns:
      `true` if details should be included.
    • isVisibleOnQuestStatus

      public boolean isVisibleOnQuestStatus(Player player)
      Denotes whether quest details should be included in travel log. Override to create custom checks.
      Specified by:
      isVisibleOnQuestStatus in interface IQuest
      Parameters:
      player - Player for whom details are requested.
      Returns:
      `true` if details should be included.
    • getRegion

      public String getRegion()
      Returns the region where the quest adventure takes place (or begins), or null for global quests
      Specified by:
      getRegion in interface IQuest
      Returns:
      region, or null for global quests
    • getNPCName

      public String getNPCName()
      Returns the starter NPC for the quest, or null if there is none
      Specified by:
      getNPCName in interface IQuest
      Returns:
      NPC name, or null for quests with no starter NPC