Package games.stendhal.server.entity.npc.condition

Examples of games.stendhal.server.entity.npc.condition.QuestActiveCondition


    /** If player has quest and not in state recommended,
     * we can check the slot to see what the stored level was.
     * If the player has brought the right number of herbs, get them */
    npc.add(ConversationStates.ATTENDING, Arrays.asList("herb", "herbs"),
        new AndCondition(
            new QuestActiveCondition(QUEST_SLOT),
            new NotCondition(new QuestInStateCondition(QUEST_SLOT,"recommended"))),
        ConversationStates.ATTENDING, null,
        new ChatAction() {
          public void fire(final Player player, final Sentence sentence, final EventRaiser raiser) {
            try {
View Full Code Here


        /* Player says the production trigger word but the NPC is already producing items for that player */
    engine.add(
        ConversationStates.ATTENDING,
        behaviour.getProductionActivity(),
        new QuestActiveCondition(QUEST_SLOT),
                false, ConversationStates.ATTENDING,
        null, new ChatAction() {
          public void fire(final Player player, final Sentence sentence,
              final EventRaiser npc) {
                        // TODO: check - can the StateRemainingTimeAction be used here?
            npc.say("I still haven't finished your last order. Come back in "
                + behaviour.getApproximateRemainingTime(player)
                + "!");
          }
        });

        /* Player greets NPC and the NPC is already producing items for that player
         * There are two options: the NPC is still busy or he is finished
         * The method giveProduct(npc, player) used here takes care of both. */
    engine.add(
        ConversationStates.IDLE,
        ConversationPhrases.GREETING_MESSAGES,
        new AndCondition(new GreetingMatchesNameCondition(npcName),
            new QuestActiveCondition(QUEST_SLOT)),
        false, ConversationStates.ATTENDING,
        null, new ChatAction() {
          public void fire(final Player player, final Sentence sentence,
              final EventRaiser npc) {
            behaviour.giveProduct(npc, player);
View Full Code Here

        null);

    // player asks what exactly is missing
    npc.add(ConversationStates.ATTENDING,
        "list",
        new QuestActiveCondition(QUEST_SLOT),
        ConversationStates.QUESTION_2,
        null,
        new ChatAction() {
          public void fire(final Player player, final Sentence sentence, final EventRaiser raiser) {
            final List<String> needed = missingWeapons(player, true);
View Full Code Here

  private void playerReturnsWhileQuestIsActive(final SpeakerNPC npc) {
    npc.add(ConversationStates.IDLE,
        ConversationPhrases.GREETING_MESSAGES,
        new AndCondition(new GreetingMatchesNameCondition(npc.getName()),
            new QuestActiveCondition(QUEST_SLOT)),
        ConversationStates.ATTENDING,
        "Welcome back. I hope you have come to help me with my latest #list of weapons.",
        null);
  }
View Full Code Here

            "I lend out " + Grammar.enumerateCollectionWithHash(ITEMS) + ". If you're interested, please say which you want.",
            null);

        // player already has borrowed something it didn't return and will pay for it
        add(ConversationStates.ATTENDING, "borrow",
            new AndCondition(new QuestActiveCondition(QUEST_SLOT), new NotCondition(new PlayerHasRecordedItemWithHimCondition(QUEST_SLOT)))
            ConversationStates.QUESTION_1,
            "You didn't return what I last lent you! Do you want to pay for it at a cost of " + COST + " money?",
            null);
        
        // player already has borrowed something it didn't return and will return it
        add(ConversationStates.ATTENDING, "borrow",
            new AndCondition(new QuestActiveCondition(QUEST_SLOT), new PlayerHasRecordedItemWithHimCondition(QUEST_SLOT))
            ConversationStates.QUESTION_2,
            "You didn't return what I last lent you! Do you want to return it now?",
            null);
        
        // player wants to pay for previous item
        final List<ChatAction> payment = new LinkedList<ChatAction>();
        payment.add(new DropItemAction("money", COST));
        payment.add(new SetQuestAction(QUEST_SLOT, "done"));
        payment.add(new DecreaseKarmaAction(10));
        add(ConversationStates.QUESTION_1,
            ConversationPhrases.YES_MESSAGES,
            new PlayerHasItemWithHimCondition("money", COST)
            ConversationStates.ATTENDING,
            "Thanks. Just let me know if you want to #borrow any tools again.",
            new MultipleActions(payment));
        
        // player already has borrowed something and wants to return it
        final List<ChatAction> returnitem = new LinkedList<ChatAction>();
        returnitem.add(new DropRecordedItemAction(QUEST_SLOT));
        returnitem.add(new SetQuestAction(QUEST_SLOT, "done"));
        add(ConversationStates.QUESTION_2,
            ConversationPhrases.YES_MESSAGES,
            new PlayerHasRecordedItemWithHimCondition(QUEST_SLOT)
            ConversationStates.ATTENDING,
            "Thank you! Just let me know if you want to #borrow any tools again.",
            new MultipleActions(returnitem));
        
        // don't want to pay for it now
        add(ConversationStates.QUESTION_1,
            ConversationPhrases.NO_MESSAGES,
            null, 
            ConversationStates.ATTENDING,
            "No problem. Take as long as you need, but you can't borrow other tools till you return the last, or pay for it.",
            null);
        
        // don't want to return it now
        add(ConversationStates.QUESTION_2,
            ConversationPhrases.NO_MESSAGES,
            null, 
            ConversationStates.ATTENDING,
            "No problem. Take as long as you need, but you can't borrow other tools till you return the last, or pay for it.",
            null);
        
        
        // saying the item name and storing that item name into the quest slot, and giving the item
        for(final String itemName : ITEMS) {
          add(ConversationStates.ATTENDING,
              itemName,
              new AndCondition(
                  new LevelGreaterThanCondition(5),
                  new QuestCompletedCondition("pizza_delivery"),
                  new QuestNotActiveCondition(QUEST_SLOT)),
              ConversationStates.ATTENDING,
              null,
              new ChatAction() {
              public void fire(final Player player, final Sentence sentence, final EventRaiser npc) {
                final Item item =  SingletonRepository.getEntityManager().getItem(itemName);
                if (item == null) {
                  npc.say("Sorry, something went wrong. Could you say correctly the item, please?");
                } else {
                  player.equipOrPutOnGround(item);
                  player.setQuest(QUEST_SLOT, itemName);
                  npc.say("Here you are! Don't forget to #return it or you have to pay!");
                }
              }
            });
        }

        // additionally add "sugar" as trigger word
        add(ConversationStates.ATTENDING,
              "sugar",
              new AndCondition(
                  new LevelGreaterThanCondition(5),
                  new QuestCompletedCondition("pizza_delivery"),
                  new QuestNotActiveCondition(QUEST_SLOT)),
              ConversationStates.ATTENDING,
              null,
              new ChatAction() {
              public void fire(final Player player, final Sentence sentence, final EventRaiser npc) {
                npc.say("Sorry, I can't lend out sugar, only a #sugar #mill.");
              }
        });

        // too low level
        add(ConversationStates.ATTENDING,
              ITEMS,
              new LevelLessThanCondition(6),
              ConversationStates.ATTENDING,
              "Sorry, as you have little experience in this world I can't trust you with my tools.",
              null);
       
        // currently has borrowed an item
        add(ConversationStates.ATTENDING,
              ITEMS,
              new QuestActiveCondition(QUEST_SLOT),
              ConversationStates.ATTENDING,
              "You can't borrow from me again till you #return the last tool I lent you.",
              null);
       
        // haven't done pizza
        add(ConversationStates.ATTENDING,
              ITEMS,
              new QuestNotCompletedCondition("pizza_delivery"),
              ConversationStates.ATTENDING,
              "Only pizza deliverers can borrow tools, please deliver one for Leander and then ask me again.",
              null);
       
        // player asks about pay from attending state
        add(ConversationStates.ATTENDING, "pay",
            new QuestActiveCondition(QUEST_SLOT)
            ConversationStates.QUESTION_1,
            "If you lost what I lent you, you can pay " + COST + " money. Do you want to pay now?",
            null);
        
        // player asks about return from attending state
        add(ConversationStates.ATTENDING, "return",
            new AndCondition(new QuestActiveCondition(QUEST_SLOT), new PlayerHasRecordedItemWithHimCondition(QUEST_SLOT))
            ConversationStates.QUESTION_2,
            "Do you want to return what you borrowed now?",
            null);
       
        // player asks about return from attending state
        add(ConversationStates.ATTENDING, "return",
            new AndCondition(new QuestActiveCondition(QUEST_SLOT), new NotCondition(new PlayerHasRecordedItemWithHimCondition(QUEST_SLOT)))
            ConversationStates.QUESTION_1,
            "You don't have it with you! Do you want to pay " + COST + " money for it now?",
            null);
       
      }};
View Full Code Here

            ConversationPhrases.NO_MESSAGES, null,
            ConversationStates.ATTENDING, "OK, no problem.", null);

        add(ConversationStates.ATTENDING,
            Arrays.asList(behaviour.getProductionActivity(), "remind"),
            new QuestActiveCondition(behaviour.getQuestSlot()),
            ConversationStates.ATTENDING, null,
            new ChatAction() {
          public void fire(final Player player, final Sentence sentence,
              final EventRaiser npc) {
            behaviour.giveProduct(npc, player);
View Full Code Here

           add(ConversationStates.IDLE,
            ConversationPhrases.GREETING_MESSAGES,
            new AndCondition(new GreetingMatchesNameCondition(getName()),
                new QuestCompletedCondition(QUEST_SLOT),
                new NotCondition(new QuestActiveCondition(BeerForHayunn.QUEST_SLOT))),
            ConversationStates.ATTENDING,
            "Hi again, how can I #help you this time?",
            null);
            
        addHelp("As I say, I'm a retired adventurer, and now I teach people. Do you want me to teach you what I know?");
View Full Code Here

    reward.add(new IncreaseKarmaAction(5.0));
   
    npc.add(ConversationStates.ATTENDING,
        ConversationPhrases.combine(ConversationPhrases.QUEST_MESSAGES, EXTRA_TRIGGER),
        new AndCondition(
            new QuestActiveCondition(QUEST_SLOT),
            new PlayerHasInfostringItemWithHimCondition("water", CLEAN_WATER_INFOSTRING)),
        ConversationStates.ATTENDING,
        "Thank you ever so much! That's just what I wanted! Here, take these potions that Sarzina gave me - I hardly have use for them here.",
        new MultipleActions(reward));
   
        // player returns with no water at all.
    npc.add(ConversationStates.ATTENDING,
        ConversationPhrases.combine(ConversationPhrases.QUEST_MESSAGES, EXTRA_TRIGGER),
        new AndCondition(
            new QuestActiveCondition(QUEST_SLOT),
            new NotCondition(new PlayerHasItemWithHimCondition("water"))),
        ConversationStates.ATTENDING,
        "I'm waiting for you to bring me some drinking water, this sun is so hot.",
        null);
   
        // add the other possibilities
    npc.add(ConversationStates.ATTENDING,
        ConversationPhrases.combine(ConversationPhrases.QUEST_MESSAGES, EXTRA_TRIGGER),
        new AndCondition(
            new QuestActiveCondition(QUEST_SLOT),
            new PlayerHasItemWithHimCondition("water"),
            new NotCondition(new PlayerHasInfostringItemWithHimCondition("water", CLEAN_WATER_INFOSTRING))),
        ConversationStates.ATTENDING,
        "Hmm... it's not that I don't trust you, but I'm not sure that water is okay to drink. Could you go and ask #Stefan to #check it please?",
        null);
View Full Code Here

    // player returns while quest is still active
    npc.add(
        ConversationStates.IDLE,
        ConversationPhrases.GREETING_MESSAGES,
        new AndCondition(new GreetingMatchesNameCondition(npc.getName()),
            new QuestActiveCondition(QUEST_SLOT)),
        ConversationStates.QUESTION_2,
        "Welcome back! Have you brought any #cloaks with you?", null);
    // player asks what exactly is missing
    npc.add(ConversationStates.QUESTION_2,
        "cloaks",
View Full Code Here

        "My #basement is absolutely crawling with rats. Will you help me?",
        null);

    npc.add(ConversationStates.ATTENDING,
        ConversationPhrases.QUEST_MESSAGES,
        new QuestActiveCondition(QUEST_SLOT),
        ConversationStates.ATTENDING,
        "Thanks again! I think it's still clear down there.", null);

    final List<ChatAction> start = new LinkedList<ChatAction>();
   
View Full Code Here

TOP

Related Classes of games.stendhal.server.entity.npc.condition.QuestActiveCondition

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.