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

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


    // player says hi before starting the quest
    npc.add(
      ConversationStates.IDLE,
      ConversationPhrases.GREETING_MESSAGES,
      new AndCondition(new GreetingMatchesNameCondition(npc.getName()),
          new QuestCompletedCondition(FishermansLicenseQuiz.QUEST_SLOT),
          new QuestNotStartedCondition(QUEST_SLOT)),
      ConversationStates.ATTENDING,
      "Hello again! The second part of your #exam is waiting for you!",
      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.ATTENDING,
      "Welcome back. I hope you were not lazy and that you brought me some other fish #species.",
      null);

    // player returns after finishing the quest
    npc.add(
      ConversationStates.IDLE,
      ConversationPhrases.GREETING_MESSAGES,
      new AndCondition(new GreetingMatchesNameCondition(npc.getName()),
          new QuestCompletedCondition(QUEST_SLOT)),
      ConversationStates.ATTENDING,
      "Welcome fisherman! Nice to see you again. I wish you luck for fishing.",
      null);
  }
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() {
View Full Code Here

    givegold.add(new SetQuestAction(QUEST_SLOT, "lorithien"))
   
    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);

View Full Code Here

    reward.add(new IncreaseXPAction(200));
    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

      }

      @Override
          protected void createDialog() {
        add(ConversationStates.IDLE, ConversationPhrases.GREETING_MESSAGES,
            new GreetingMatchesNameCondition(getName()), true,
            ConversationStates.IDLE, "Sit down, shut up, and watch me!", null);
          }
       
    };
View Full Code Here

    /** The King is also in the castle and he is the father of the Princess who gave the quest */
    final SpeakerNPC npc = npcs.get("King Cozart");

    /** Complete the quest by speaking to King, who will return right back to idle once he rewards the player*/
    npc.add(ConversationStates.IDLE, ConversationPhrases.GREETING_MESSAGES,
      new AndCondition(new GreetingMatchesNameCondition(npc.getName()),
          new QuestInStateCondition(QUEST_SLOT, "recommended")),
      ConversationStates.IDLE,
      "Greetings! My wonderful daughter requests that I grant you citizenship of Kalavan City. Consider it done. Now, forgive me while I go back to my meal. Goodbye.",
      new MultipleActions(new IncreaseXPAction(500), new SetQuestAction(QUEST_SLOT, "done")));

    /** If you aren't in the condition to speak to him (not completed quest, or already spoke) the King will dismiss you */
    npc.add(ConversationStates.IDLE, ConversationPhrases.GREETING_MESSAGES,
      new AndCondition(new GreetingMatchesNameCondition(npc.getName()),
          new QuestNotInStateCondition(QUEST_SLOT, "recommended")),
      ConversationStates.IDLE,
      "Leave me! Can't you see I am trying to eat?",
      null);
  }
View Full Code Here

        /* The Player greets the NPC.
        * The NPC is not currently producing for player (not started, is rejected, or is complete) */
    engine.add(ConversationStates.IDLE,
        ConversationPhrases.GREETING_MESSAGES,
        new AndCondition(new GreetingMatchesNameCondition(npcName),
            new QuestNotActiveCondition(QUEST_SLOT)),
        false, ConversationStates.ATTENDING, thisWelcomeMessage, null);

    engine.add(ConversationStates.ATTENDING,
        behaviour.getProductionActivity(),
        new SentenceHasErrorCondition(),
        false, ConversationStates.ATTENDING,
        null, new ComplainAboutSentenceErrorAction());

        /* In the behaviour a production activity is defined, e.g. 'cast' or 'mill'
        * and this is used as the trigger to start the production,
        * provided that the NPC is not currently producing for player (not started, is rejected, or is complete) */   
        engine.add(
        ConversationStates.ATTENDING,
        behaviour.getProductionActivity(),
        new AndCondition(
          new NotCondition(new SentenceHasErrorCondition()),
          new QuestNotActiveCondition(QUEST_SLOT)
        ),
                false,
                ConversationStates.ATTENDING, null,
        new ProducerBehaviourAction(behaviour) {
          @Override
          public void fireRequestOK(final ItemParserResult res, final Player player, final Sentence sentence, final EventRaiser npc) {
            // Find out how much items we shall produce.
            if (res.getAmount() > 1000) {
              logger.warn("Decreasing very large amount of "
                  + res.getAmount()
                  + " " + res.getChosenItemName()
                  + " to 1 for player "
                  + player.getName() + " talking to "
                  + npcName + " saying " + sentence);
              res.setAmount(1);
            }

            if (behaviour.askForResources(res, npc, player)) {
              currentBehavRes = res;
              npc.setCurrentState(ConversationStates.PRODUCTION_OFFERED);
            }
          }
        });

        /* Player agrees to the proposed production deal */
    engine.add(ConversationStates.PRODUCTION_OFFERED,
        ConversationPhrases.YES_MESSAGES, null,
        false, ConversationStates.ATTENDING,
        null, new ChatAction() {
          public void fire(final Player player, final Sentence sentence, final EventRaiser npc) {
            behaviour.transactAgreedDeal(currentBehavRes, npc, player);

            currentBehavRes = null;
          }
        });

        /* Player does not agree to the proposed production deal */
    engine.add(ConversationStates.PRODUCTION_OFFERED,
        ConversationPhrases.NO_MESSAGES, null,
        false, ConversationStates.ATTENDING, "OK, no problem.", null);

        /* 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) {
View Full Code Here

   */
  private void carmen() {
    final SpeakerNPC npc = npcs.get("Carmen");

    npc.add(ConversationStates.IDLE, ConversationPhrases.GREETING_MESSAGES,
        new GreetingMatchesNameCondition(npc.getName()),
        ConversationStates.ATTENDING,
        "Hello. I can #heal you in these #troubled #times.", null);

    npc.addReply(Arrays.asList("troubled", "times"),
        "I sense many changes approaching. I believe that a #Cataclysm is coming.");
View Full Code Here

    final SpeakerNPC npc = npcs.get("Diogenes");

    npc.add(
      ConversationStates.IDLE,
      ConversationPhrases.GREETING_MESSAGES,
      new GreetingMatchesNameCondition(npc.getName()),
      ConversationStates.ATTENDING,
      "Greetings. I expect you are wondering what strange things are happening here?",
      null);

    npc.addReply(ConversationPhrases.YES_MESSAGES,
View Full Code Here

TOP

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

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.