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

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


    // player didn't killed creature
    npc.add(ConversationStates.ATTENDING,
        ConversationPhrases.FINISH_MESSAGES,
        new AndCondition(
            new QuestStartedCondition(QUEST_SLOT),
            new QuestNotCompletedCondition(QUEST_SLOT),
            new NotCondition(
                    new KilledForQuestCondition(QUEST_SLOT, 0))),
        ConversationStates.ATTENDING,
        null,
        new ChatAction() {
          public void fire(Player player, Sentence sentence, EventRaiser npc) {
              final String questKill = player.getQuest(QUEST_SLOT, 0).split(",")[0];
              npc.say("You didn't kill " + Grammar.a_noun(questKill)
                  + " yet. Go and do it and say #complete only after you're done.");             
          }
        });

    // player killed creature
    npc.add(ConversationStates.ATTENDING,
        ConversationPhrases.FINISH_MESSAGES,
        new AndCondition(
            new QuestStartedCondition(QUEST_SLOT),
            new QuestNotCompletedCondition(QUEST_SLOT),
                new KilledForQuestCondition(QUEST_SLOT, 0)),
        ConversationStates.ATTENDING,
        "Good work! Let me thank you in the name of the people of Semos!",
        new MultipleActions(
            new IncreaseXPDependentOnLevelAction(5, 95.0),
View Full Code Here


            // NPC_name quest doesn't exist anywhere else neither is
            // used for any other purpose
        add(ConversationStates.IDLE,
            ConversationPhrases.GREETING_MESSAGES,
            new AndCondition(new GreetingMatchesNameCondition(getName()),
                new QuestNotCompletedCondition("Zynn")),
            ConversationStates.INFORMATION_1,
            "Hi, potential reader! Here you can find records of the history of Semos, and lots of interesting facts about this island of Faiumoni. If you like, I can give you a quick introduction to its #geography and #history! I also keep up with the #news, so feel free to ask me about that.",
            new SetQuestAction("Zynn", "done"));
       
        addHelp("I can best help you by sharing my knowledge of Faiumoni's #geography and #history, as well as the latest #news.");
View Full Code Here

            ConversationStates.ATTENDING,
            "Oh sorry, I don't lend equipment to people with so little experience as you.",
            null);
        
        add(ConversationStates.ATTENDING, "borrow",
            new AndCondition(new LevelGreaterThanCondition(5), new QuestNotCompletedCondition("pizza_delivery"))
            ConversationStates.ATTENDING,
            "You'll have to speak to Leander and ask if you can help with the pizza before I'm allowed to lend you anything.",
            null);

        add(ConversationStates.ATTENDING, "borrow",
            new AndCondition(
                new LevelGreaterThanCondition(5),
                new QuestCompletedCondition("pizza_delivery"),
                new QuestNotActiveCondition(QUEST_SLOT)),
            ConversationStates.ATTENDING,
            "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
View Full Code Here

                // NPC_name quest doesn't exist anywhere else neither is
                // used for any other purpose
                add(ConversationStates.IDLE,
                    ConversationPhrases.GREETING_MESSAGES,
                    new AndCondition(new GreetingMatchesNameCondition(getName()),
                        new QuestNotCompletedCondition("Nomyr")),
                    ConversationStates.INFORMATION_1,
                    "Heh heh... Oh, hello stranger! You look a bit disoriented... d'you want to hear the latest gossip?",
                    new SetQuestAction("Nomyr", "done"));

                add(ConversationStates.ATTENDING,
View Full Code Here

  private void step1() {
    final SpeakerNPC npc = npcs.get("Sarzina");
   
    npc.add(ConversationStates.ATTENDING,
      ConversationPhrases.QUEST_MESSAGES,
      new QuestNotCompletedCondition(QUEST_SLOT),
      ConversationStates.QUEST_OFFERED,
      "Are you someone who likes to help others?", null);

    npc.add(ConversationStates.ATTENDING,
      ConversationPhrases.QUEST_MESSAGES,
View Full Code Here

        addOffer("If you wish to access your personal chest in solitude, I can give you access to a private #vault. A guidebook inside will explain how it works.");   
        addGoodbye("It was a pleasure to serve you.");
        add(ConversationStates.ANY, "vault", new QuestCompletedCondition("armor_dagobert"), ConversationStates.IDLE, null,
            new MultipleActions(new PlaySoundAction("keys-1", true), new VaultChatAction()));
       
        add(ConversationStates.ANY, "vault", new QuestNotCompletedCondition("armor_dagobert"), ConversationStates.ATTENDING, "Perhaps you could do a #favour for me, and then I will tell you more about the private banking vaults.", null);
       
        // remaining behaviour defined in games.stendhal.server.maps.quests.ArmorForDagobert 
      }

      @Override
View Full Code Here

    reward.add(new IncreaseXPAction(10));
    reward.add(new SetQuestAction(QUEST_SLOT, "done"));
   
    npc.add(ConversationStates.INFORMATION_3,
        Arrays.asList("buy", "sell", "offer", "sell studded shield"),
        new QuestNotCompletedCondition(QUEST_SLOT),
        ConversationStates.IDLE,
        answer + "If anybody asks, you don't know me!",
        new MultipleActions(reward));

    npc.add(ConversationStates.INFORMATION_3,
View Full Code Here

                null);


        // Player has never done the zoo quest, player asks what the task was
    npc.add(ConversationStates.ATTENDING, ConversationPhrases.QUEST_MESSAGES,
        new QuestNotCompletedCondition(QUEST_SLOT),
        ConversationStates.QUEST_OFFERED, "Our animals are hungry. We need " +
            "more food to feed them. Can you help us?",
        null);

      final Map<String,Integer> items = new HashMap<String, Integer>();   
View Full Code Here

        null
    );

    npc.add(ConversationStates.IDLE, ConversationPhrases.GREETING_MESSAGES,
        new AndCondition(new GreetingMatchesNameCondition(npc.getName()),
            new OrCondition(new QuestNotCompletedCondition(QUEST_SLOT),
                new AndCondition(new QuestCompletedCondition(QUEST_SLOT), new TimePassedCondition(QUEST_SLOT, 1, DELAY))
            )),
        ConversationStates.IDLE, "Sorry, can't stop to chat. The animals are all sick because they don't have enough food. See yourself out, won't you?",
        null
    );
View Full Code Here

    final SpeakerNPC npc = npcs.get("Io Flotto");

    npc.add(ConversationStates.ATTENDING,
      ConversationPhrases.HELP_MESSAGES,
      new QuestNotCompletedCondition(QUEST_SLOT),
      ConversationStates.ATTENDING,
      "I'm a telepath and a telekinetic; I can help you by sharing my mental skills with you. Do you want me to teach you the six basic elements of telepathy? I already know the answer but I'm being polite...",
      null);

    npc.add(ConversationStates.ATTENDING,
      ConversationPhrases.HELP_MESSAGES,
      new QuestCompletedCondition(QUEST_SLOT),
      ConversationStates.ATTENDING,
      "Do you want to repeat the six basic elements of telepathy? I already know the answer but I'm being polite...",
      null);

    npc.add(
      ConversationStates.ATTENDING,
      ConversationPhrases.YES_MESSAGES,
      null,
      ConversationStates.INFORMATION_1,
      "Type #/who to ascertain the names of those adventurers who are currently present in the world of Stendhal. Do you want to learn the second basic element of telepathy?",
      null);

    npc.add(
      ConversationStates.INFORMATION_1,
      ConversationPhrases.YES_MESSAGES,
      null,
      ConversationStates.INFORMATION_2,
      "Type #/where #username to discern where in Stendhal that person is currently roaming; you can use #'/where sheep' to keep track of any sheep you might own. To understand the system used for defining positions in Stendhal, try asking #Zynn; he knows more about it than I do. Ready for the third lesson?",
      null);

    npc.add(
      ConversationStates.INFORMATION_2,
      "Zynn",
      null,
      ConversationStates.INFORMATION_2,
      "His full name is Zynn Iwuhos. He spends most of his time in the library, making maps and writing historical record books. Ready for the next lesson?",
      null);

    npc.add(
      ConversationStates.INFORMATION_2,
      ConversationPhrases.YES_MESSAGES,
      null,
      ConversationStates.INFORMATION_3,
      "Type #'/tell username message' or #'/msg username message' to talk to anybody you wish, no matter where in Stendhal that person is.  You can type #'// response' to continue talking to the last person you send a message to. Ready to learn my fourth tip?",
      null);

    npc.add(
      ConversationStates.INFORMATION_3,
      ConversationPhrases.YES_MESSAGES,
      null,
      ConversationStates.INFORMATION_4,
      "Press #Shift+Up at the same time to recall things you previously said, in case you need to repeat yourself. Okay, shall we move on to the fifth lesson?",
      null);

    npc.add(
      ConversationStates.INFORMATION_4,
      ConversationPhrases.YES_MESSAGES,
      null,
      ConversationStates.INFORMATION_5,
      "Type #/support #<message> to report a problem. You can also try the IRC channel ##arianne on #'irc.freenode.net'. There is a web frontend at #http://stendhalgame.org/development/chat.html \nOkay, time for your last lesson in mental manipulation!",
      null);

    npc.add(
      ConversationStates.INFORMATION_5,
      ConversationPhrases.YES_MESSAGES,
      null,
      ConversationStates.INFORMATION_6,
      "You can travel to the astral plane at any time, thereby saving and closing your game. Just type #/quit, or press the #Esc key, or even simply close the window. Okay! Hmm, I think you want to learn how to float in the air like I do.",
      null);

    /** Give the reward to the patient newcomer user */
    final String answer = "*yawns* Maybe I'll show you later... I don't want to overload you with too much information at once. You can get a summary of all those lessons at any time, incidentally, just by typing #/help.\n";
    npc.add(ConversationStates.INFORMATION_6,
      ConversationPhrases.YES_MESSAGES,
      new QuestCompletedCondition(QUEST_SLOT),
      ConversationStates.IDLE,
      answer + "Hey! I know what you're thinking, and I don't like it!",
      null);

    final List<ChatAction> reward = new LinkedList<ChatAction>();
    reward.add(new EquipItemAction("money", 10));
    reward.add(new IncreaseXPAction(10));
    reward.add(new SetQuestAction(QUEST_SLOT, "done"));   

    npc.add(ConversationStates.INFORMATION_6,
      ConversationPhrases.YES_MESSAGES,
      new QuestNotCompletedCondition(QUEST_SLOT),
      ConversationStates.IDLE,
      answer + "Remember, don't let anything disturb your concentration.",
      new MultipleActions(reward));

    npc.add(
View Full Code Here

TOP

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

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.