Examples of QuestStateStartsWithCondition


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

        ConversationPhrases.NO_MESSAGES, null,
        ConversationStates.ATTENDING, "OK, no problem.", null);

    npc.add(ConversationStates.ATTENDING,
        behaviour.getProductionActivity(),
        new QuestStateStartsWithCondition(mithrilcloak.getQuestSlot(), "makingthread;"),
        ConversationStates.ATTENDING, null,
        new ChatAction() {
          public void fire(final Player player, final Sentence sentence,
              final EventRaiser npc) {
            npc.say("I still haven't finished your last order!");
          }
        });
    // 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);
View Full Code Here

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

    // 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.QuestStateStartsWithCondition

    // 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);

View Full Code Here

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

        Arrays.asList("weave", "fabric", "magical", "mithril fabric", "ida", "mithril", "cloak", "mithril cloak", "pedinghaus", "task", "quest"),
        new NotCondition(
                 new OrCondition(new QuestInStateCondition(mithrilcloak.getQuestSlot(), "got_mithril_thread"),
                         new QuestInStateCondition(mithrilcloak.getQuestSlot(), "taking_letter"),
                         new QuestInStateCondition(mithrilcloak.getQuestSlot(), "took_letter"),
                         new QuestStateStartsWithCondition(mithrilcloak.getQuestSlot(), "weavingfabric;")
                         )
                 ),
        ConversationStates.ATTENDING,
        "I haven't got any quest for you now.", null);
                 

    // player says yes they brought the items needed
    // we can't use the nice ChatActions here because we have to timestamp the quest slot
    npc.add(
      ConversationStates.SERVICE_OFFERED,
      ConversationPhrases.YES_MESSAGES,
      new QuestInStateCondition(mithrilcloak.getQuestSlot(), "took_letter"),
      ConversationStates.ATTENDING,
      null,
      new ChatAction() {
        public void fire(final Player player, final Sentence sentence, final EventRaiser npc) {
          if (player.isEquipped("mithril thread", 40)) {
           
              player.drop("mithril thread", 40);
              npc.say("Lovely. In "
                     + REQUIRED_HOURS_FABRIC + " hours your fabric will be ready.");
              player.setQuest(mithrilcloak.getQuestSlot(), "weavingfabric;" + System.currentTimeMillis());
              player.notifyWorldAboutChanges();
            } else {
              npc.say("You don't appear to have 40 spools of mithril thread with you. Sorry, I can't do anything without it.");
            }
        }
      });

    // player says they didn't bring the stuff yet
    npc.add(
      ConversationStates.SERVICE_OFFERED,
      ConversationPhrases.NO_MESSAGES,
      null,
      ConversationStates.ATTENDING,
      "Oh, ok, well I hope you haven't lost them, they are precious!",
      null);

    // player returns while fabric is still being woven, or is ready
    npc.add(ConversationStates.ATTENDING,
      Arrays.asList("weave", "fabric", "magical", "mithril fabric", "ida", "mithril", "cloak", "mithril cloak", "task", "quest"),
      new QuestStateStartsWithCondition(mithrilcloak.getQuestSlot(), "weavingfabric;"),
      ConversationStates.ATTENDING, null, new ChatAction() {
        public void fire(final Player player, final Sentence sentence, final EventRaiser npc) {
          final String[] tokens = player.getQuest(mithrilcloak.getQuestSlot()).split(";");
          final long delay = REQUIRED_HOURS_FABRIC * MathHelper.MILLISECONDS_IN_ONE_HOUR;
          final long timeRemaining = (Long.parseLong(tokens[1]) + delay)
View Full Code Here

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

    // that the player could be in many quest states and she still is just waiting for fabric
    npc.add(ConversationStates.ATTENDING,
        Arrays.asList("fabric", "mithril", "cloak", "mithril cloak", "task", "quest"),
        new OrCondition(
                new QuestInStateCondition(mithrilcloak.getQuestSlot(), "need_fabric"),
                new QuestStateStartsWithCondition(mithrilcloak.getQuestSlot(), "makingthread;"),
                new QuestInStateCondition(mithrilcloak.getQuestSlot(), "got_thread"),
                new QuestStateStartsWithCondition(mithrilcloak.getQuestSlot(), "fusingthread;"),
                new QuestInStateCondition(mithrilcloak.getQuestSlot(), "got_mithril_thread"),
                new QuestInStateCondition(mithrilcloak.getQuestSlot(), "taking_letter"),
                new QuestInStateCondition(mithrilcloak.getQuestSlot(), "took_letter"),
                new AndCondition(new QuestInStateCondition(mithrilcloak.getQuestSlot(), "got_fabric"),
                         new NotCondition(new PlayerHasItemWithHimCondition(mithrilcloak.getFabricName()))
View Full Code Here

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

      "Well, if you should like me to cast any mithril bars just say.",
      null);

    npc.add(ConversationStates.ATTENDING,
      Arrays.asList("clasp", "mithril clasp", "ida", "cloak", "mithril cloak"),
      new QuestStateStartsWithCondition(mithrilcloak.getQuestSlot(), "forgingclasp;"),
      ConversationStates.ATTENDING, null, new ChatAction() {
        public void fire(final Player player, final Sentence sentence, final EventRaiser npc) {
          final String[] tokens = player.getQuest(mithrilcloak.getQuestSlot()).split(";");
          // minutes -> milliseconds
          final long delay = REQUIRED_MINUTES_CLASP * MathHelper.MILLISECONDS_IN_ONE_MINUTE;
 
View Full Code Here

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

    // remind about getting clasp
    npc.add(ConversationStates.ATTENDING,
        Arrays.asList("clasp", "mithril clasp", "cloak", "mithril cloak", "task", "quest"),
        new OrCondition(
                new QuestInStateCondition(mithrilcloak.getQuestSlot(), "need_clasp"),
                new QuestStateStartsWithCondition(mithrilcloak.getQuestSlot(), "forgingclasp;"),
                new AndCondition(new QuestInStateCondition(mithrilcloak.getQuestSlot(), "got_clasp"),
                         new NotCondition(new PlayerHasItemWithHimCondition("mithril clasp")))
                ),
        ConversationStates.ATTENDING,
        "You haven't got the clasp from #Pedinghaus yet. As soon as I have that your cloak will be finished!",       
View Full Code Here

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

        null);
   
    // player can repeat quest
    npc.add(ConversationStates.ATTENDING,
        ConversationPhrases.QUEST_MESSAGES,
        new AndCondition(new QuestStateStartsWithCondition(QUEST_SLOT, "eating;"), new TimePassedCondition(QUEST_SLOT, 1, REQUIRED_MINUTES)),
        ConversationStates.QUEST_OFFERED,
        "I hope another chocolate bar wouldn't be greedy. Can you get me another one?",
        null)
   
    // player can't repeat quest
    npc.add(ConversationStates.ATTENDING,
        ConversationPhrases.QUEST_MESSAGES,
        new AndCondition(new QuestStateStartsWithCondition(QUEST_SLOT, "eating;"), new NotCondition(new TimePassedCondition(QUEST_SLOT, 1, REQUIRED_MINUTES))),
        ConversationStates.ATTENDING,
        "I've had too much chocolate. I feel sick.",
        null)
   
    // player should be bringing chocolate not asking about the quest
    npc.add(ConversationStates.ATTENDING,
        ConversationPhrases.QUEST_MESSAGES,
        new AndCondition(new QuestActiveCondition(QUEST_SLOT), new NotCondition(new QuestStateStartsWithCondition(QUEST_SLOT, "eating;"))),
        ConversationStates.ATTENDING, 
        "Waaaaaaaa! Where is my chocolate ...",
        null);
   
    // Player agrees to get the chocolate
View Full Code Here

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

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

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

         new TimePassedCondition(QUEST_SLOT, 1, REQUIRED_MINUTES)).fire(player,null, null);
  }
 
  @Override
  public boolean isCompleted(final Player player) {
    return new QuestStateStartsWithCondition(QUEST_SLOT,"eating;").fire(player, null, 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.