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

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


        "We just want to visit the first part of the dungeon, it seems to be very interesting. Some of these ugly things jump around there, even some mummies!",
        null);
   
    npc.add(ConversationStates.ATTENDING,
        ConversationPhrases.QUEST_MESSAGES,
        new AndCondition(new NotCondition(new TimePassedCondition(QUEST_SLOT, 1, WEEK_IN_MINUTES)), new QuestStateStartsWithCondition(QUEST_SLOT, "killed")),
        ConversationStates.ATTENDING,
        null,
        new SayTimeRemainingAction(QUEST_SLOT, 1, WEEK_IN_MINUTES, "These #creatures didn't return so far and we could see some lovely places all over. Please return in"));
   
   
    npc.add(ConversationStates.ATTENDING,
        ConversationPhrases.QUEST_MESSAGES,
        new AndCondition(new QuestStateStartsWithCondition(QUEST_SLOT,"killed"),
             new TimePassedCondition(QUEST_SLOT, 1, WEEK_IN_MINUTES)),
        ConversationStates.QUEST_OFFERED,
        "Those #creatures returned after the last time you helped us. May you help us again please?",
        null);
View Full Code Here


    npc.add(
      ConversationStates.IDLE,
      ConversationPhrases.GREETING_MESSAGES,
      new AndCondition(new GreetingMatchesNameCondition(npc.getName()),
          new QuestStartedCondition(QUEST_SLOT),
          new NotCondition(new QuestStateStartsWithCondition(QUEST_SLOT, "done"))),
      ConversationStates.QUESTION_1,
      "Welcome back! I hope you collected some #ingredients for the soup, or #everything.",
      null);

    // player asks what exactly is missing
    npc.add(ConversationStates.QUESTION_1, "ingredients",
      new AndCondition(new QuestStartedCondition(QUEST_SLOT), new NotCondition(new QuestStateStartsWithCondition(QUEST_SLOT, "done"))),
      ConversationStates.QUESTION_1, null,
      new ChatAction() {
        public void fire(final Player player, final Sentence sentence, final EventRaiser npc) {
          final List<String> needed = missingFood(player, true);
          npc.say("I still need "
              + Grammar.quantityplnoun(needed.size(),
                  "ingredient", "one") + ": "
              + Grammar.enumerateCollection(needed)
              + ". Did you bring anything I need?");
        }
      });

    // player says he has a required ingredient with him
    npc.add(ConversationStates.QUESTION_1,
        ConversationPhrases.YES_MESSAGES, null,
        ConversationStates.QUESTION_1, "What did you bring?", null);

    for(final String itemName : NEEDED_FOOD) {
      npc.add(ConversationStates.QUESTION_1, itemName, null,
        ConversationStates.QUESTION_1, null,
        new ChatAction() {
          public void fire(final Player player, final Sentence sentence, final EventRaiser npc) {
            List<String> missing = missingFood(player, false);

            if (missing.contains(itemName)) {
              if (player.drop(itemName)) {
                // register ingredient as done
                final String doneText = player.getQuest(QUEST_SLOT);
                player.setQuest(QUEST_SLOT, doneText + ";" + itemName);

                // check if the player has brought all Food
                missing = missingFood(player, true);

                if (!missing.isEmpty()) {
                  npc.say("Thank you very much! What else did you bring?");
                } else {
                  player.addKarma(5.0);
                  player.addXP(20);
                  /*
                   * place soup after XP added otherwise
                   * the XP change MIGHT change level and
                   * player MIGHT gain health points which
                   * changes the base HP, which is desired
                   * to be accurate for the place soup
                   * stage
                   */
                  placeSoupFor(player);
                  player.healPoison();
                  npc.say("The soup's on the table for you. It will heal you. "
                      + "My magical method in making the soup has given you a little karma too.");
                  player.setQuest(QUEST_SLOT, "done;"
                      + System.currentTimeMillis());
                  player.notifyWorldAboutChanges();
                  npc.setCurrentState(ConversationStates.ATTENDING);
                }
              } else {
                npc.say("Don't take me for a fool, traveller. You don't have "
                  + Grammar.a_noun(itemName)
                  + " with you.");
              }
            } else {
              npc.say("You brought me that ingredient already.");
            }
          }
      });
    }
   
    // Perhaps player wants to give all the ingredients at once
    npc.add(ConversationStates.QUESTION_1, "everything",
        null,
        ConversationStates.QUESTION_1,
        null,
        new ChatAction() {
          public void fire(final Player player, final Sentence sentence,
             final EventRaiser npc) {
            checkForAllIngredients(player, npc);
      }
    });

    // player says something which isn't in the needed food list.
    npc.add(ConversationStates.QUESTION_1, "",
      new NotCondition(new TriggerInListCondition(NEEDED_FOOD)),
      ConversationStates.QUESTION_1,
      "I won't put that in your soup.", null);

    // allow to say goodbye while Helena is listening for food names
    npc.add(ConversationStates.QUESTION_1, ConversationPhrases.GOODBYE_MESSAGES, null,
        ConversationStates.IDLE, "Bye.", null);

    npc.add(ConversationStates.ATTENDING, ConversationPhrases.NO_MESSAGES,
      new AndCondition(new QuestStartedCondition(QUEST_SLOT), new NotCondition(new QuestStateStartsWithCondition(QUEST_SLOT, "done"))),
      ConversationStates.ATTENDING,
      "I'm not sure what you want from me, then.", null);

    // player says he didn't bring any Food to different question
    npc.add(ConversationStates.QUESTION_1, ConversationPhrases.NO_MESSAGES,
      new AndCondition(new QuestStartedCondition(QUEST_SLOT), new NotCondition(new QuestStateStartsWithCondition(QUEST_SLOT, "done"))),
      ConversationStates.ATTENDING, "Okay then. Come back later.",
      null);
  }
View Full Code Here

      new SetQuestAction(QUEST_SLOT,"start;ham=10"));

    // player returns while quest is active
    npc.add(ConversationStates.IDLE, ConversationPhrases.GREETING_MESSAGES,
        new AndCondition(new GreetingMatchesNameCondition(npc.getName()),
            new QuestStateStartsWithCondition(QUEST_SLOT, "start;")),
        ConversationStates.QUEST_ITEM_BROUGHT,
        null,
        new SayRequiredItemAction(QUEST_SLOT, 1, "Welcome back! Have you brought the [item]?"));

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

    return history;   
  }
 
  @Override
  public boolean isRepeatable(final Player player) {
    return new AndCondition(new QuestStateStartsWithCondition(QUEST_SLOT,"killed;"),
         new TimePassedCondition(QUEST_SLOT, 1, MathHelper.MINUTES_IN_ONE_WEEK)).fire(player,null, null);
  }
View Full Code Here

         new TimePassedCondition(QUEST_SLOT, 1, MathHelper.MINUTES_IN_ONE_WEEK)).fire(player,null, null);
  }
 
  @Override
  public boolean isCompleted(final Player player) {
    return new QuestStateStartsWithCondition(QUEST_SLOT,"killed;").fire(player, null, null);
  }
View Full Code Here

      questTrigger = new LinkedList<String>(ConversationPhrases.QUEST_MESSAGES);
    questTrigger.add(extraTrigger);
 
      npc.add(
      ConversationStates.ATTENDING, questTrigger,
      new AndCondition(new QuestStateStartsWithCondition(QUEST_SLOT, "reward"),
               // delay is in minutes, last parameter is argument of timestamp
               new NotCondition(new TimePassedCondition(QUEST_SLOT,1,DELAY_IN_MINUTES))),
      ConversationStates.ATTENDING,
      null,
      new SayTimeRemainingAction(QUEST_SLOT,1,DELAY_IN_MINUTES,"Hello I am still busy with that baby dragon stew for Mr Yeti. You can get your reward in"));


    npc.add(
      ConversationStates.ATTENDING, questTrigger,
      new AndCondition(new QuestStateStartsWithCondition(QUEST_SLOT, "reward"),
               // delay is in minutes, last parameter is argument of timestamp
               new TimePassedCondition(QUEST_SLOT,1,DELAY_IN_MINUTES)),
      ConversationStates.ATTENDING,
      "Thank you! To say thank you, I'd like to offer you the chance to always #buy #roach from me cheaply. I have so much of it and perhaps you have a use for it.",
      new MultipleActions(new SetQuestAction(QUEST_SLOT,"done"), new IncreaseXPAction(1000)));
View Full Code Here

        + "They need to be taught a lesson, will you help?",
        null);

    npc.add(ConversationStates.ATTENDING,
        ConversationPhrases.QUEST_MESSAGES,
        new AndCondition(new QuestStateStartsWithCondition(QUEST_SLOT,"killed"),
             new TimePassedCondition(QUEST_SLOT, 1, WEEK_IN_MINUTES)),
        ConversationStates.QUEST_OFFERED,
        "Those pesky gnomes are stealing carrots again. I think they need another lesson. Will you help?",
        null);

    npc.add(ConversationStates.ATTENDING,
        ConversationPhrases.QUEST_MESSAGES,
        new AndCondition(new QuestStateStartsWithCondition(QUEST_SLOT,"killed"),
             new NotCondition(new TimePassedCondition(QUEST_SLOT, 1, WEEK_IN_MINUTES))),
        ConversationStates.ATTENDING,
        "The gnomes haven't made any trouble since you last taught them a lesson.",
        null);
View Full Code Here

    return 10;
  }
 
  @Override
  public boolean isRepeatable(final Player player) {
    return new AndCondition(new QuestStateStartsWithCondition(QUEST_SLOT,"killed"),
         new TimePassedCondition(QUEST_SLOT, 1, WEEK_IN_MINUTES)).fire(player,null, null);
  }
View Full Code Here

         new TimePassedCondition(QUEST_SLOT, 1, WEEK_IN_MINUTES)).fire(player,null, null);
  }
 
  @Override
  public boolean isCompleted(final Player player) {
    return new QuestStateStartsWithCondition(QUEST_SLOT,"killed").fire(player, null, null);
  }
View Full Code Here

  private void makeRingsStep() {
    final SpeakerNPC npc = npcs.get("Ognir");

    npc.add(ConversationStates.ATTENDING,
        Arrays.asList("wedding ring", "wedding"),
        new QuestStateStartsWithCondition(marriage.getQuestSlot(), "engaged"),
        ConversationStates.QUEST_ITEM_QUESTION,
        null,
        new ChatAction() {
          public void fire(final Player player, final Sentence sentence, final EventRaiser npc) {
            if (player.isQuestInState(marriage.getQuestSlot(), "engaged_with_ring")) {
              // player has wedding ring already. just remind to
              // get spouse to get one and hint to get dressed.
              npc.say("Looking forward to your wedding? Make sure your fiancee gets a wedding ring made for you, too! Oh and remember to get #dressed up for the big day.");
              npc.setCurrentState(ConversationStates.INFORMATION_2);
            } else {
              // says you'll need a ring
              npc.say("I need "
                  + REQUIRED_GOLD
                  + " gold bars and a fee of "
                  + REQUIRED_MONEY
                  + " money, to make a wedding ring for your fiancee. Do you have it?");
            }
          }
        });

    // response to wedding ring enquiry if you are not engaged
    npc.add(ConversationStates.ATTENDING,
        Arrays.asList("wedding ring", "wedding"),
        new QuestNotStartedCondition(marriage.getQuestSlot()),
        ConversationStates.ATTENDING,
        "I'd forge a wedding ring for you to give your partner, if you were engaged to someone. If you want to get engaged, speak to the nun outside the church.",
        null);

    // response to wedding ring enquiry when you're already married
    npc.add(ConversationStates.ATTENDING,
        Arrays.asList("wedding ring", "wedding"),
        new AndCondition(new QuestCompletedCondition(marriage.getQuestSlot()), new PlayerHasItemWithHimCondition("wedding ring")),
        ConversationStates.ATTENDING,
        "I hope you're still happily married! If you are having trouble and want a divorce, speak to the clerk in Ados Town Hall.",
        null);

    // response to wedding ring enquiry when you're already married and not wearing ring
    npc.add(ConversationStates.ATTENDING,
        Arrays.asList("wedding ring", "wedding"),
        new AndCondition(new QuestCompletedCondition(marriage.getQuestSlot()), new NotCondition(new PlayerHasItemWithHimCondition("wedding ring"))),
        ConversationStates.QUEST_ITEM_QUESTION,
        "Uh oh! You haven't got your wedding ring on! I can forge you another for " + REQUIRED_GOLD
                  + " gold bars and a fee of "
                  + REQUIRED_MONEY
                  + " money, do you want another?",
        null);

    // response to wedding ring enquiry when you're married but not taken honeymoon
    npc.add(ConversationStates.ATTENDING,
        Arrays.asList("wedding ring", "wedding"),
        new QuestInStateCondition(marriage.getQuestSlot(), "just_married"),
        ConversationStates.ATTENDING,
        "Congratulations on your recent wedding! Don't forget to ask Linda in Fado Hotel about your honeymoon.",
        null);

    // Here the behaviour is defined for if you make a wedding ring enquiry to Ognir and your
    // ring is being made
     npc.add(ConversationStates.ATTENDING,
        Arrays.asList("wedding ring", "wedding"),
         new QuestStateStartsWithCondition(marriage.getQuestSlot(), "forging"),
        ConversationStates.IDLE,
         null,
        new ChatAction() {
           public void fire(final Player player, final Sentence sentence, final EventRaiser npc) {
             final String[] tokens = player.getQuest(marriage.getQuestSlot()).split(";");
View Full Code Here

TOP

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

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.