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

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


    // player wants to learn how to attack
    npc.add(
        ConversationStates.ATTENDING,
        ConversationPhrases.YES_MESSAGES,
        new QuestInStateCondition(QUEST_SLOT, 0, "start"),
        ConversationStates.ATTENDING,
        "Well, back when I was a young adventurer, I clicked on my enemies to attack them. I'm sure that will work for you, too. Good luck, and come back once you are done.",
        null);

    //player doesn't want to learn how to attack
    npc.add(
        ConversationStates.ATTENDING,
        ConversationPhrases.NO_MESSAGES,
        new QuestInStateCondition(QUEST_SLOT, 0, "start"),
        ConversationStates.ATTENDING,
        "Fine, you seem like an intelligent type. I'm sure you'll work it out!",
        null);

    //player returns to Hayunn not having killed a rat
    npc.add(ConversationStates.IDLE,
        ConversationPhrases.GREETING_MESSAGES,
        new AndCondition(new GreetingMatchesNameCondition(npc.getName()),
            new QuestInStateCondition(QUEST_SLOT, 0, "start"),
            new NotCondition(new KilledForQuestCondition(QUEST_SLOT,1))),
        ConversationStates.ATTENDING,
        "I see you haven't managed to kill a rat yet. Do you need me to tell you how to fight them?",
        null);

    //player returns to Hayunn having killed a rat
    final List<ChatAction> actions = new LinkedList<ChatAction>();
    actions.add(new IncreaseXPAction(10));
    actions.add(new SetQuestAction(QUEST_SLOT, "killed"));

    npc.add(
        ConversationStates.IDLE,
        ConversationPhrases.GREETING_MESSAGES,
        new AndCondition(new GreetingMatchesNameCondition(npc.getName()),
            new QuestInStateCondition(QUEST_SLOT, 0, "start"),
            new KilledForQuestCondition(QUEST_SLOT, 1)),
        ConversationStates.INFORMATION_1,
        "You killed the rat! Now, I guess you want to explore. Do you want to know the way to Semos?",
        new MultipleActions(actions));


       // The player has had enough info for now. Send them to semos. When they come back they can learn some more tips.

    final List<ChatAction> reward = new LinkedList<ChatAction>();
    reward.add(new EquipItemAction("money", 5));
    reward.add(new IncreaseXPAction(10));
    reward.add(new SetQuestAction(QUEST_SLOT, "taught"));
    reward.add(new ExamineChatAction("monogenes.png", "Monogenes", "North part of Semos city."));

    npc.add(
      ConversationStates.INFORMATION_1,
      ConversationPhrases.YES_MESSAGES,
      null,
      ConversationStates.IDLE,
      "Follow the path through this village to the east, and you can't miss Semos. If you go and speak to Monogenes, the old man in this picture, he will give you a map. Here's 5 money to get you started. Bye bye!",
      new MultipleActions(reward));

       // incase player didn't finish learning everything when he came after killing the rat, he must have another chance. Here it is.
    // 'little tip' is a pun as he gives some money, that is a tip, too.
    npc.add(ConversationStates.IDLE,
        ConversationPhrases.GREETING_MESSAGES,
        new AndCondition(new GreetingMatchesNameCondition(npc.getName()),
            new QuestInStateCondition(QUEST_SLOT, "killed")),
        ConversationStates.INFORMATION_1,
            "You ran off pretty fast after coming to tell me you killed that rat! I was about to give you a little tip. Do you want it?",
        null);
   
    // Player has returned to say hi again.
    npc.add(ConversationStates.IDLE,
        ConversationPhrases.GREETING_MESSAGES,
        new AndCondition(new GreetingMatchesNameCondition(npc.getName()),
            new QuestInStateCondition(QUEST_SLOT, "taught")),
        ConversationStates.INFORMATION_2,
            "Hello again. Have you come to learn more from me?",
        null);

    npc.add(
      ConversationStates.INFORMATION_2,
      ConversationPhrases.YES_MESSAGES,
      null,
      ConversationStates.INFORMATION_3,
      "Perhaps you have found Semos dungeons by now. The corridors are pretty narrow down there, so there's a trick to moving quickly and accurately, if you'd like to hear it. #Yes?",
      null);

    npc.add(
      ConversationStates.INFORMATION_3,
      ConversationPhrases.YES_MESSAGES,
      null,
      ConversationStates.INFORMATION_4,
      "Simple, really; just click the place you want to move to. There's a lot more information than I can relate just off the top of my head... do you want to know where to read more?",
      null);

    final String epilog = "You can find answers to frequently asked questions by typing #/faq \nYou can read about some of the currently most powerful and successful warriors at #http://stendhalgame.org\n ";
   
      //This is used if the player returns, asks for #help and then say #yes
      npc.add(ConversationStates.ATTENDING,
      ConversationPhrases.YES_MESSAGES, new QuestCompletedCondition(QUEST_SLOT),
      ConversationStates.ATTENDING,
      epilog + "You know, you remind me of my younger self...",
      null);

    final List<ChatAction> reward2 = new LinkedList<ChatAction>();
    reward2.add(new EquipItemAction("studded shield"));
    reward2.add(new IncreaseXPAction(20));
    reward2.add(new SetQuestAction(QUEST_SLOT, "done"));

    npc.add(ConversationStates.INFORMATION_4,
        ConversationPhrases.YES_MESSAGES, new QuestNotCompletedCondition(QUEST_SLOT),
        ConversationStates.IDLE,
        epilog + "Well, good luck in the dungeons! This shield should help you. Here's hoping you find fame and glory, and keep watch for monsters!",
        new MultipleActions(reward2));

    npc.add(new ConversationStates[] { ConversationStates.ATTENDING,
          ConversationStates.INFORMATION_1,
          ConversationStates.INFORMATION_2,
          ConversationStates.INFORMATION_3,
          ConversationStates.INFORMATION_4},
        ConversationPhrases.NO_MESSAGES, new NotCondition(new QuestInStateCondition(QUEST_SLOT, "start")), ConversationStates.IDLE,
        "Oh well, I'm sure someone else will stop by for a chat soon. Bye...",
        null);

    npc.setPlayerChatTimeout(TIME_OUT);
  }
View Full Code Here


        // Player sends his greetings to Wrviliza and has rejected the quest in the past
        npc.add(ConversationStates.IDLE,
            ConversationPhrases.GREETING_MESSAGES,
            new AndCondition(new GreetingMatchesNameCondition(npc.getName()),
                new QuestInStateCondition(QUEST_SLOT, "rejected")),
            ConversationStates.QUEST_OFFERED,
            "Wroff! Welcome back wanderer... Are you back to help me gather #stuff to make good #torcibud this time?",
            null);

        // Player asks for a quest
        npc.add(ConversationStates.ATTENDING,
            ConversationPhrases.QUEST_MESSAGES,
            new QuestNotStartedCondition(QUEST_SLOT),
            ConversationStates.QUEST_OFFERED,
            "Wrof! My stock of supplies for preparing koboldish #torcibud is running thin. Would you help me getting some #stuff?",
            null
        );

        // Player has done the quest already but not enough time has passed since completing it
        npc.add(ConversationStates.ATTENDING,
            ConversationPhrases.QUEST_MESSAGES,
            new AndCondition(
                new QuestCompletedCondition(QUEST_SLOT),
                new TimeReachedCondition(QUEST_SLOT, 1)),
            ConversationStates.QUEST_OFFERED,
            "Wroff! Indeed I'd need some #stuff for making some more koboldish #torcibud. Will you help?",
            null);

        // Player has done the quest already but it's too early to get another
        npc.add(ConversationStates.ATTENDING,
            ConversationPhrases.QUEST_MESSAGES,
            new AndCondition(
                new QuestCompletedCondition(QUEST_SLOT),
                new NotCondition(new TimeReachedCondition(QUEST_SLOT, 1))),
            ConversationStates.ATTENDING, null,
            new SayTimeRemainingUntilTimeReachedAction(QUEST_SLOT, 1,
                "Wrof! Thank you but my stock of supplies for making good #torcibud will be fine for"));

        // Player is curious about torcibud when offered the quest
        npc.add(ConversationStates.QUEST_OFFERED,
            "torcibud",
            new QuestNotStartedCondition(QUEST_SLOT),
            ConversationStates.QUEST_OFFERED,
            "Wruff. I will make more when I have enough #stuff! Are you going to help?",
            null);

        // Player is curious about stuff, ingredients or supplies when offered the quest
        // NOTE:
        // the answer given by the NPC does not contain any trigger words on pourpose
        // as it should only hint what's kind of things are needed.
        // some details about the required items are given only once the quest has been accepted.
        npc.add(ConversationStates.QUEST_OFFERED,
            Arrays.asList("stuff","ingredients","supplies"),
            new OrCondition(
                new QuestNotStartedCondition(QUEST_SLOT),
                new QuestInStateCondition(QUEST_SLOT, "rejected")),
            ConversationStates.QUEST_OFFERED,
            "Wrof! Some bottles, artichokes, a few herbs and fierywater... Things like that. So, will you help?",
            null);

        // Player accepts the quest and gets to know what Wrviliza needs (switch to phase_2)
        npc.add(ConversationStates.QUEST_OFFERED,
            ConversationPhrases.YES_MESSAGES, null,
            ConversationStates.QUESTION_1, null,
            new MultipleActions(
                new ChatAction() {
                  public void fire(final Player player, final Sentence sentence, final EventRaiser raiser) {
                    int pLevel = player.getLevel();
                    player.setQuest(QUEST_SLOT, getRequiredItemsCollection(pLevel));
                  }
                },
                new IncreaseKarmaAction(20),
                // here we have been careful to say the items from the collection only after the quest slot was set,
                // because in this quest, the amounts depend on level, above.
                new SayRequiredItemsFromCollectionAction(
                        QUEST_SLOT,
                        "Wroff! Right now, I need [items]. Do you by chance have anything of that with you already?")));

        // Player is not inclined to comply with the request and has not already rejected it once
        npc.add(ConversationStates.QUEST_OFFERED,
            ConversationPhrases.NO_MESSAGES,
            new AndCondition(
                new QuestNotActiveCondition(QUEST_SLOT),
                new QuestNotInStateCondition(QUEST_SLOT, "rejected")),
            ConversationStates.ATTENDING,
            "Wruff... I guess I will have to ask to someone with a better attitude!",
            new MultipleActions(
                new SetQuestAction(QUEST_SLOT, "rejected"),
                new DecreaseKarmaAction(20.0)));

        //Player is not inclined to comply with the request and he has rejected it last time
        //If player wants to buy any beverage here, he should really take the quest now
        //Wrviliza holds a grudge by turning idle again.
        npc.add(ConversationStates.QUEST_OFFERED,
            ConversationPhrases.NO_MESSAGES,
            new QuestInStateCondition(QUEST_SLOT, "rejected"),
            ConversationStates.IDLE,
            "Wruff... I guess you will wander around with a dry gulch then...",
            new MultipleActions(
                new SetQuestAction(QUEST_SLOT, "rejected"),
                new DecreaseKarmaAction(20.0)));
View Full Code Here

    npc.add(ConversationStates.IDLE,
        ConversationPhrases.GREETING_MESSAGES,
        new AndCondition(new GreetingMatchesNameCondition(npc.getName()),
            new OrCondition(
                new QuestCompletedCondition(QUEST_SLOT),
                new QuestInStateCondition(QUEST_SLOT, "reward"))),
        ConversationStates.IDLE,
        "My new crown will be ready soon and I will dethrone the king! Mwahahaha!",
        null);
  }
View Full Code Here

   */
  private void step_3() {
    final SpeakerNPC npc = npcs.get(REWARD_NPC_NAME);

    npc.add(ConversationStates.ATTENDING, "reward",
        new QuestInStateCondition(QUEST_SLOT, "reward"),
        ConversationStates.ATTENDING, null,
        new ChatAction() {
          public void fire(final Player player, final Sentence sentence, final EventRaiser entity) {
            entity.say("Oh yes, "
                  + NPC_NAME
View Full Code Here

    reward.add(new IncreaseXPAction(15000));
    reward.add(new SetQuestAction(QUEST_SLOT, "done"));
    reward.add(new IncreaseKarmaAction(25));
    npc.add(ConversationStates.QUESTION_1,
        ConversationPhrases.YES_MESSAGES,
        new AndCondition(new QuestInStateCondition(QUEST_SLOT, "1"), new PlayerHasItemWithHimCondition("blue elf cloak")),
        ConversationStates.ATTENDING,
        "Thank you very much! Now I have enough cloaks to survive the winter. Here, take this golden shield as a reward.",
        new MultipleActions(reward));
   
    npc.add(ConversationStates.QUESTION_1,
View Full Code Here

        "Yes, she is my twin sister. People consider her normal because she hides her special abilities.",
        null);

    // change
    npc.add(ConversationStates.ATTENDING,
        Arrays.asList("change", "change"), new QuestInStateCondition(
            "debuggera", "friends"), ConversationStates.ATTENDING,
        "I can teleport you.", null);
    npc.add(ConversationStates.ATTENDING,
        Arrays.asList("change", "change"),
        new QuestNotInStateCondition("debuggera", "friends"),
        ConversationStates.ATTENDING,
        "Do you want to become my #friend?", null);

    // friends
    npc.add(ConversationStates.ATTENDING,
        Arrays.asList("friend", "friends"), new QuestInStateCondition(
            "debuggera", "friends"), ConversationStates.ATTENDING,
        "We are friends.", null);
    npc.add(
        ConversationStates.ATTENDING,
        Arrays.asList("friend", "friends"),
View Full Code Here

  private void step_3() {
    final SpeakerNPC npc = npcs.get("Zogfang");

    npc.add(ConversationStates.IDLE, ConversationPhrases.GREETING_MESSAGES,
        new AndCondition(new GreetingMatchesNameCondition(npc.getName()),
            new QuestInStateCondition(QUEST_SLOT, 0, "start"),
            new NotCondition(new KilledForQuestCondition(QUEST_SLOT, 1))),
        ConversationStates.ATTENDING,
        null,
        new ChatAction() {
          public void fire(final Player player, final Sentence sentence, final EventRaiser raiser) {
            raiser.say("Just go kill Dhohr Nuggetcutter and his minions; the mountain leader, hero and elder dwarves. Even the simple mountain dwarves are a danger to us, kill them too.");               
        }
    });
   
    npc.add(ConversationStates.IDLE, ConversationPhrases.GREETING_MESSAGES,
        new AndCondition(new GreetingMatchesNameCondition(npc.getName()),
            new QuestInStateCondition(QUEST_SLOT, 0, "start"),
            new KilledForQuestCondition(QUEST_SLOT, 1)),
        ConversationStates.ATTENDING,
        null,
        new ChatAction() {
          public void fire(final Player player, final Sentence sentence, final EventRaiser raiser) {
View Full Code Here

    /** Remind player about the quest */
    npc.add(
      ConversationStates.ATTENDING,
      "gold",
      new QuestInStateCondition(QUEST_SLOT, "start"),
      ConversationStates.ATTENDING,
      "#Lorithien will be getting so worried with all that gold not safe! Please fetch it!",
      null);

    npc.add(ConversationStates.ATTENDING, "lorithien", null,
View Full Code Here

   
    npc.add(
      ConversationStates.IDLE,
      ConversationPhrases.GREETING_MESSAGES,
      new AndCondition(new GreetingMatchesNameCondition(getName()),
          new QuestInStateCondition(QUEST_SLOT, "start")),
      ConversationStates.ATTENDING,
      "I'm so glad you're here! I'll be much happier when this gold is safely in the bank.",
      new MultipleActions(givegold));

    /** If player keep asking for book, just tell him to hurry up */
    npc.add(
      ConversationStates.IDLE,
      ConversationPhrases.GREETING_MESSAGES,
      new AndCondition(new GreetingMatchesNameCondition(getName()),
          new QuestInStateCondition(QUEST_SLOT, "lorithien")),
      ConversationStates.ATTENDING,
      "Oh, please take that gold back to #Grafindle before it gets lost!",
      null);

    npc.add(ConversationStates.ATTENDING, "grafindle", null,
View Full Code Here

    reward.add(new SetQuestAction(QUEST_SLOT, "done"));
    reward.add(new IncreaseKarmaAction(10));
   
    npc.add(ConversationStates.IDLE, ConversationPhrases.GREETING_MESSAGES,
        new AndCondition(new GreetingMatchesNameCondition(getName()),
            new QuestInStateCondition(QUEST_SLOT, "lorithien"),
            new PlayerHasItemWithHimCondition("gold bar", GOLD_AMOUNT)),
        ConversationStates.ATTENDING,
        "Oh, you brought the gold! Wonderful, I knew I could rely on you. Please, have this key to our customer room.",
        new MultipleActions(reward));
   
    npc.add(ConversationStates.IDLE, ConversationPhrases.GREETING_MESSAGES,
        new AndCondition(new GreetingMatchesNameCondition(getName()),
            new QuestInStateCondition(QUEST_SLOT, "lorithien"),
            new NotCondition(new PlayerHasItemWithHimCondition("gold bar", GOLD_AMOUNT))),
        ConversationStates.ATTENDING,
        "Haven't you got the gold bars from #Lorithien yet? Please go get them, quickly!",
        null);
  }
View Full Code Here

TOP

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

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.