Examples of GreetingMatchesNameCondition


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

          }
        });
    // player returns and says hi while sacs being made
    npc.add(ConversationStates.IDLE,
      ConversationPhrases.GREETING_MESSAGES,
      new AndCondition(new GreetingMatchesNameCondition(npc.getName()),
          new QuestStateStartsWithCondition(mithrilcloak.getQuestSlot(), "makingthread;")),
      ConversationStates.ATTENDING, null,
        new ChatAction() {
          public void fire(final Player player, final Sentence sentence,
              final EventRaiser npc) {
            behaviour.giveProduct(npc, player);
          }
        });
    // player returns and doesn't need fabric and sacs not being made
    npc.add(ConversationStates.IDLE,
      ConversationPhrases.GREETING_MESSAGES,
      new AndCondition(new GreetingMatchesNameCondition(npc.getName()),
          new NotCondition(
              new OrCondition(
                   new QuestInStateCondition(mithrilcloak.getQuestSlot(), "need_fabric"),
                   new QuestStateStartsWithCondition(mithrilcloak.getQuestSlot(), "makingthread;")
              )
          )),
      ConversationStates.IDLE, "Ha ha he he woo hoo!!!",
      null);


    // player returns and needs fabric
    npc.add(ConversationStates.IDLE,
      ConversationPhrases.GREETING_MESSAGES,
      new AndCondition(new GreetingMatchesNameCondition(npc.getName()),
          new QuestInStateCondition(mithrilcloak.getQuestSlot(), "need_fabric")),
      ConversationStates.ATTENDING, "Ha ha he he woo hoo ... ha ... Sorry, I get carried away sometimes. What do you want?",
      null);

View Full Code Here

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

    final SpeakerNPC npc = npcs.get("Boris Karlova");

    // player returns and says hi while sacs being made
    npc.add(ConversationStates.IDLE,
      ConversationPhrases.GREETING_MESSAGES,
      new AndCondition(new GreetingMatchesNameCondition(npc.getName()),
          new QuestStateStartsWithCondition(mithrilcloak.getQuestSlot(), "makingthread;")),
      ConversationStates.IDLE, null,
        new ChatAction() {
          public void fire(final Player player, final Sentence sentence,
                   final EventRaiser npc) {
            final String orderString = player.getQuest(mithrilcloak.getQuestSlot());
            final String[] order = orderString.split(";");
            final int numberOfProductItems = Integer.parseInt(order[1]);
            final long orderTime = Long.parseLong(order[3]);
            final long timeNow = new Date().getTime();
            if (timeNow - orderTime < (long)REQUIRED_MINUTES_THREAD * numberOfProductItems * MathHelper.MILLISECONDS_IN_ONE_MINUTE) {
              npc.say("Haaaa heee woooo hoo!");
            } else {
              npc.say("The boss gave me these " 
                  + Grammar.quantityplnoun(numberOfProductItems, "silk thread", "")
                  + ". Price gets his students to do his dirty work for him.");
              final StackableItem products = (StackableItem) SingletonRepository.getEntityManager().getItem(
                                                              "silk thread");
             
              player.addXP(100);
              products.setQuantity(numberOfProductItems);
              products.setBoundTo(player.getName());
              player.setQuest(mithrilcloak.getQuestSlot(), "got_thread");
              player.equipOrPutOnGround(products);
              player.notifyWorldAboutChanges();
            }
          }
        }
        );

    // player returns and doesn't need fabric and sacs not being made
    npc.add(ConversationStates.IDLE,
      ConversationPhrases.GREETING_MESSAGES,
      new AndCondition(new GreetingMatchesNameCondition(npc.getName()),
          new NotCondition(new QuestStateStartsWithCondition(mithrilcloak.getQuestSlot(), "makingthread;"))),
      ConversationStates.IDLE, "Ha ha he he woo hoo!!!",
      null);

  }
View Full Code Here

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

      });

    // player returns while fabric is still being woven, or is ready
    npc.add(ConversationStates.IDLE,
        ConversationPhrases.GREETING_MESSAGES,
        new AndCondition(new GreetingMatchesNameCondition(npc.getName()),
            new QuestStateStartsWithCondition(mithrilcloak.getQuestSlot(), "fusingthread;")),
        ConversationStates.ATTENDING, null, new ChatAction() {
          public void fire(final Player player, final Sentence sentence, final EventRaiser npc) {
            final String orderString = player.getQuest(mithrilcloak.getQuestSlot());
            final String[] order = orderString.split(";");
            final long delay = REQUIRED_HOURS_MITHRIL_THREAD * MathHelper.MILLISECONDS_IN_ONE_HOUR;
            final long timeRemaining = (Long.parseLong(order[1]) + delay)
              - System.currentTimeMillis();
            if (timeRemaining > 0L) {
              npc.say("Welcome. I'm still working on your request to fuse mithril thread"
                  + " for you. Come back in "
                  + TimeUtil.approxTimeUntil((int) (timeRemaining / 1000L)) + ".");
            } else {
              final StackableItem products = (StackableItem) SingletonRepository.
                    getEntityManager().getItem("mithril thread");
 
              products.setQuantity(40);
           
              products.setBoundTo(player.getName());
              player.equipOrPutOnGround(products);
              npc.say("Hello again. The magic is completed. Here you have your 40 spools of mithril thread. Now, you must go to #Whiggins to get the #fabric made.");
              player.setQuest(mithrilcloak.getQuestSlot(), "got_mithril_thread");
              // give some XP as a little bonus for industrious workers
              player.addXP(100);
              player.notifyWorldAboutChanges()
          }
          }
        }
    );

    // don't fuse thread unless state correct
    npc.add(
        ConversationStates.ATTENDING,
        "fuse",
        new NotCondition(new QuestInStateCondition(mithrilcloak.getQuestSlot(), "got_thread")),
        ConversationStates.ATTENDING, "I can only create mithril thread when you have got some silk #thread. And remember, I will know if you really need the magic performed or not.", null);
   
    // player returns and hasn't got thread yet/got thread already and
    npc.add(ConversationStates.IDLE,
        ConversationPhrases.GREETING_MESSAGES,
        new AndCondition(new GreetingMatchesNameCondition(npc.getName()),
            new NotCondition(
                 new OrCondition(
                         new QuestInStateCondition(mithrilcloak.getQuestSlot(), "got_thread"),
                         new QuestStateStartsWithCondition(mithrilcloak.getQuestSlot(), "fusingthread;")
                         )
            )),
        ConversationStates.ATTENDING, "Greetings. What an interesting place this is.",
        null);

    // player needs thread fused
    npc.add(ConversationStates.IDLE,
        ConversationPhrases.GREETING_MESSAGES,
        new AndCondition(new GreetingMatchesNameCondition(npc.getName()),
            new QuestInStateCondition(mithrilcloak.getQuestSlot(), "got_thread")),
        ConversationStates.ATTENDING, "Greetings, can I #offer you anything?",
        null);

  }
View Full Code Here

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

    actions.add(new IncreaseKarmaAction(15.0))
    actions.add(new GiveMapAction(false));
   
    henry.add(ConversationStates.IDLE,
        ConversationPhrases.GREETING_MESSAGES,
        new AndCondition(new GreetingMatchesNameCondition(henry.getName()),
            new QuestInStateCondition(QUEST_SLOT, "start"),
            new PlayerHasInfostringItemWithHimCondition("leather legs", "tom"),
            new PlayerHasInfostringItemWithHimCondition("note", "charles"),
            new PlayerHasInfostringItemWithHimCondition("scale armor", "peter")),
        ConversationStates.ATTENDING,
        "Oh my! Peter, Tom, and Charles are all dead? *cries*. Anyway, here is your reward. And keep the IOU.",
        new MultipleActions(actions));

    henry.add(ConversationStates.IDLE,
        ConversationPhrases.GREETING_MESSAGES,
        new AndCondition(new GreetingMatchesNameCondition(henry.getName()),
            new QuestInStateCondition(QUEST_SLOT, "start"),
            new NotCondition(
                new AndCondition(
                    new PlayerHasInfostringItemWithHimCondition("leather legs", "tom"),
                    new PlayerHasInfostringItemWithHimCondition("note", "charles"),
View Full Code Here

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

     * book.
     */
    npc.add(
      ConversationStates.IDLE,
      ConversationPhrases.GREETING_MESSAGES,
      new AndCondition(new GreetingMatchesNameCondition(npc.getName()),
          new QuestInStateCondition(QUEST_SLOT, "start")),
      ConversationStates.ATTENDING,
      "Oh, Ceryl's looking for that book back? My goodness! I completely forgot about it... here you go!",
      new MultipleActions(new EquipItemAction("black book", 1, true), new SetQuestAction(QUEST_SLOT, "jynath")));

    /** If player keeps asking for the book, just tell him to hurry up */
    npc.add(
      ConversationStates.IDLE,
      ConversationPhrases.GREETING_MESSAGES,
      new AndCondition(new GreetingMatchesNameCondition(npc.getName()),
          new QuestInStateCondition(QUEST_SLOT, "jynath")),
      ConversationStates.ATTENDING,
      "You'd better take that book back to #Ceryl quickly... he'll be waiting for you.",
      null);

View Full Code Here

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

    reward.add(new SetQuestAction(QUEST_SLOT, "done"));

    npc.add(
      ConversationStates.IDLE,
      ConversationPhrases.GREETING_MESSAGES,
      new AndCondition(new GreetingMatchesNameCondition(npc.getName()),
          new QuestInStateCondition(QUEST_SLOT, "jynath"),
          new PlayerHasItemWithHimCondition("black book")),
      ConversationStates.ATTENDING,
      "Oh, you got the book back! Phew, thanks!",
      new MultipleActions(reward));

    // There is no other way to get the book.
    // Remove that quest slot so that the player can get
    // it again from Jynath
    // As the book is both bound and useless outside the
    // quest, this is not a problem
    npc.add(
      ConversationStates.IDLE,
      ConversationPhrases.GREETING_MESSAGES,
      new AndCondition(new GreetingMatchesNameCondition(npc.getName()),
          new QuestInStateCondition(QUEST_SLOT, "jynath"),
          new NotCondition(new PlayerHasItemWithHimCondition("black book"))),
      ConversationStates.ATTENDING,
      "Haven't you got that #book back from #Jynath? Please go look for it, quickly!",
      new SetQuestAction(QUEST_SLOT, "start"));
View Full Code Here

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

    final SpeakerNPC npc = npcs.get("Elisabeth");
   
    // first conversation with Elisabeth.
    npc.add(ConversationStates.IDLE,
        ConversationPhrases.GREETING_MESSAGES,
        new AndCondition(new GreetingMatchesNameCondition(npc.getName()),
            new QuestNotStartedCondition(QUEST_SLOT), new QuestNotInStateCondition(QUEST_SLOT, "rejected")),
        ConversationStates.ATTENDING,
        "I can't remember when I smelt the good taste of #chocolate the last time...",
        null);
   
    npc.addReply("chocolate", "My mom told me, that chocolate can be found in an assassin school, which is quite #dangerous. She said also that someone sells it in Ados...");
   
    npc.addReply("dangerous", "Some bandits wait on the road to the school and assassins guard the way there, so mom and I have to stay in Kirdneh because it's safe here...");
   
    // player is supposed to speak to mummy now
    npc.add(ConversationStates.IDLE,
        ConversationPhrases.GREETING_MESSAGES,
        new AndCondition(new GreetingMatchesNameCondition(npc.getName()),
            new QuestInStateCondition(QUEST_SLOT, "start"), new PlayerHasItemWithHimCondition("chocolate bar")),
        ConversationStates.IDLE,
        "My mum wants to know who I was asking for chocolate from now :(",
        null);
   
    // player didn't get chocolate, meanie
    npc.add(ConversationStates.IDLE,
        ConversationPhrases.GREETING_MESSAGES,
        new AndCondition(new GreetingMatchesNameCondition(npc.getName()),
            new QuestInStateCondition(QUEST_SLOT, "start"), new NotCondition(new PlayerHasItemWithHimCondition("chocolate bar"))),
        ConversationStates.ATTENDING,
        "I hope that someone will bring me some chocolate soon...:(",
        null);
   
    // player got chocolate and spoke to mummy
    npc.add(ConversationStates.IDLE,
        ConversationPhrases.GREETING_MESSAGES,
        new AndCondition(new GreetingMatchesNameCondition(npc.getName()),
            new QuestInStateCondition(QUEST_SLOT, "mummy"), new PlayerHasItemWithHimCondition("chocolate bar")),
        ConversationStates.QUESTION_1,
        "Awesome! Is that chocolate for me?",
        null);
   
    // player spoke to mummy and hasn't got chocolate
    npc.add(ConversationStates.IDLE,
        ConversationPhrases.GREETING_MESSAGES,
        new AndCondition(new GreetingMatchesNameCondition(npc.getName()),
            new QuestInStateCondition(QUEST_SLOT, "mummy"), new NotCondition(new PlayerHasItemWithHimCondition("chocolate bar"))),
        ConversationStates.ATTENDING,
        "I hope that someone will bring me some chocolate soon...:(",
        null);
   
    // player is in another state like eating
    npc.add(ConversationStates.IDLE,
        ConversationPhrases.GREETING_MESSAGES,
        new AndCondition(new GreetingMatchesNameCondition(npc.getName()),
            new QuestStartedCondition(QUEST_SLOT), new QuestNotInStateCondition(QUEST_SLOT, "start"), new QuestNotInStateCondition(QUEST_SLOT, "mummy")),
        ConversationStates.ATTENDING,
        "Hello.",
        null);
   
    // player rejected quest
    npc.add(ConversationStates.IDLE,
        ConversationPhrases.GREETING_MESSAGES,
        new AndCondition(new GreetingMatchesNameCondition(npc.getName()),
            new QuestInStateCondition(QUEST_SLOT, "rejected")),
        ConversationStates.ATTENDING,
        "Hello.",
        null);
   
View Full Code Here

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

    final SpeakerNPC mummyNPC = npcs.get("Carey");

    // player speaks to mummy before Elisabeth
    mummyNPC.add(ConversationStates.IDLE,
          ConversationPhrases.GREETING_MESSAGES,
          new AndCondition(new GreetingMatchesNameCondition(mummyNPC.getName()),
              new QuestNotStartedCondition(QUEST_SLOT)),
          ConversationStates.ATTENDING, "Hello, nice to meet you.",
          null);

    // player is supposed to begetting chocolate
    mummyNPC.add(ConversationStates.IDLE,
          ConversationPhrases.GREETING_MESSAGES,
          new AndCondition(new GreetingMatchesNameCondition(mummyNPC.getName()),
              new QuestInStateCondition(QUEST_SLOT, "start")),
          ConversationStates.ATTENDING,
          "Oh you met my daughter Elisabeth already. You seem like a nice person so it would be really kind, if you can bring her a chocolate bar because I'm not #strong enough for that.",
          new SetQuestAction(QUEST_SLOT, "mummy"));

    mummyNPC.addReply("strong", "I tried to get some chocolate for Elisabeth a few times, but I couldn't make my way through the assassins and bandits running around #there.");
   
    mummyNPC.addReply("there", "They live in and around the Ados castle. Take care there! I also heard about #someone who sells chocolate bars.");
   
    mummyNPC.addReply("someone", "I never visited that guy because he seems to be really... well he works somewhere where I don't want to be in Ados.");
   
    // any other state
    mummyNPC.add(ConversationStates.IDLE,
          ConversationPhrases.GREETING_MESSAGES, new GreetingMatchesNameCondition(mummyNPC.getName()), true,
          ConversationStates.ATTENDING, "Hello again.", null);
  }
View Full Code Here

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

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

    npc.add(ConversationStates.IDLE, ConversationPhrases.GREETING_MESSAGES,
      new AndCondition(new GreetingMatchesNameCondition(npc.getName()),
          new QuestStateStartsWithCondition(QUEST_SLOT, "start")),
      ConversationStates.ATTENDING, null,
      new ChatAction() {
        public void fire(final Player player, final Sentence sentence, final EventRaiser raiser) {
          final String[] tokens = player.getQuest(QUEST_SLOT).split(";");
         
          int idx1 = 1;
          for (ItemData itemdata : neededItems.values()) {
              itemdata.resetAmount();
              itemdata.subAmount(tokens[idx1]);
              idx1++;
          }

          boolean missingSomething = false;

          int size = neededItems.size();
          for (int idx = 1; !missingSomething && idx <= size; idx++) {
            ItemData itemData = neededItems.get(idx);
            missingSomething = proceedItem(player, raiser,
                itemData);
          }
         
          if (player.hasKilledSolo("black giant") && !missingSomething) {
            raiser.say("You've brought everything I need to forge the shield. Come back in "
              + REQUIRED_MINUTES
              + " minutes and it will be ready.");
            player.setQuest(QUEST_SLOT, "forging;" + System.currentTimeMillis());
          } else {
            if (!player.hasKilledSolo("black giant") && !missingSomething) {
              raiser.say("This shield can only be given to those who have killed a black giant, and without the help of others.");
            }

            StringBuilder sb = new StringBuilder(30);
            sb.append("start");
            for (ItemData id : neededItems.values()) {
              sb.append(";");
              sb.append(id.getAlreadyBrought());
            }
            player.setQuest(QUEST_SLOT, sb.toString());
             
          }
        }

 
        private boolean proceedItem(final Player player,
            final EventRaiser engine, final ItemData itemData) {
          if (itemData.getStillNeeded() > 0) {
           
            if (player.isEquipped(itemData.getName(), itemData.getStillNeeded())) {
              player.drop(itemData.getName(), itemData.getStillNeeded());
              itemData.setAmount(0);
            } else {
              final int amount = player.getNumberOfEquipped(itemData.getName());
              if (amount > 0) {
                player.drop(itemData.getName(), amount);
                itemData.subAmount(amount);
              }

              engine.say(itemData.getAnswer());
              return true;
            }
          }
          return false;
        }
      });

    npc.add(ConversationStates.IDLE, ConversationPhrases.GREETING_MESSAGES,
        new AndCondition(new GreetingMatchesNameCondition(npc.getName()),
            new QuestStateStartsWithCondition(QUEST_SLOT, "forging;")),
        ConversationStates.IDLE, null, new ChatAction() {
        public void fire(final Player player, final Sentence sentence, final EventRaiser raiser) {

          final String[] tokens = player.getQuest(QUEST_SLOT).split(";");
View Full Code Here

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

  private void createBringingStep() {
    final SpeakerNPC zara = npcs.get("Zara");

    zara.add(ConversationStates.IDLE,
      ConversationPhrases.GREETING_MESSAGES,
      new AndCondition(new GreetingMatchesNameCondition(zara.getName()),
          new QuestInStateCondition(QUEST_SLOT, "start"),
          new PlayerHasItemWithHimCondition("suntan cream")),
      ConversationStates.QUEST_ITEM_BROUGHT,
      "Great! You got the suntan cream! Is it for me?",
      null);
   
    zara.add(ConversationStates.IDLE,
        ConversationPhrases.GREETING_MESSAGES,
        new AndCondition(new GreetingMatchesNameCondition(zara.getName()),
            new QuestInStateCondition(QUEST_SLOT, "start"),
            new NotCondition(new PlayerHasItemWithHimCondition("suntan cream"))),
        ConversationStates.ATTENDING,
        "I know that the #'suntan cream' is hard to get, but I hope that you didn't forget my painful problem...",
        null);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.