Examples of QuestStartedCondition


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

    // 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(
View Full Code Here

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

    // player returns while quest is still active
    npc.add(
      ConversationStates.IDLE,
      ConversationPhrases.GREETING_MESSAGES,
      new AndCondition(new GreetingMatchesNameCondition(npc.getName()),
          new QuestStartedCondition(QUEST_SLOT),
          new NotCondition(new QuestStateStartsWithCondition(QUEST_SLOT, "done"))),
      ConversationStates.QUESTION_1,
      "Welcome back! I hope you collected some #ingredients for the soup, or #everything.",
      null);

    // player asks what exactly is missing
    npc.add(ConversationStates.QUESTION_1, "ingredients",
      new AndCondition(new QuestStartedCondition(QUEST_SLOT), new NotCondition(new QuestStateStartsWithCondition(QUEST_SLOT, "done"))),
      ConversationStates.QUESTION_1, null,
      new ChatAction() {
        public void fire(final Player player, final Sentence sentence, final EventRaiser npc) {
          final List<String> needed = missingFood(player, true);
          npc.say("I still need "
              + Grammar.quantityplnoun(needed.size(),
                  "ingredient", "one") + ": "
              + Grammar.enumerateCollection(needed)
              + ". Did you bring anything I need?");
        }
      });

    // player says he has a required ingredient with him
    npc.add(ConversationStates.QUESTION_1,
        ConversationPhrases.YES_MESSAGES, null,
        ConversationStates.QUESTION_1, "What did you bring?", null);

    for(final String itemName : NEEDED_FOOD) {
      npc.add(ConversationStates.QUESTION_1, itemName, null,
        ConversationStates.QUESTION_1, null,
        new ChatAction() {
          public void fire(final Player player, final Sentence sentence, final EventRaiser npc) {
            List<String> missing = missingFood(player, false);

            if (missing.contains(itemName)) {
              if (player.drop(itemName)) {
                // register ingredient as done
                final String doneText = player.getQuest(QUEST_SLOT);
                player.setQuest(QUEST_SLOT, doneText + ";" + itemName);

                // check if the player has brought all Food
                missing = missingFood(player, true);

                if (!missing.isEmpty()) {
                  npc.say("Thank you very much! What else did you bring?");
                } else {
                  player.addKarma(5.0);
                  player.addXP(20);
                  /*
                   * place soup after XP added otherwise
                   * the XP change MIGHT change level and
                   * player MIGHT gain health points which
                   * changes the base HP, which is desired
                   * to be accurate for the place soup
                   * stage
                   */
                  placeSoupFor(player);
                  player.healPoison();
                  npc.say("The soup's on the table for you. It will heal you. "
                      + "My magical method in making the soup has given you a little karma too.");
                  player.setQuest(QUEST_SLOT, "done;"
                      + System.currentTimeMillis());
                  player.notifyWorldAboutChanges();
                  npc.setCurrentState(ConversationStates.ATTENDING);
                }
              } else {
                npc.say("Don't take me for a fool, traveller. You don't have "
                  + Grammar.a_noun(itemName)
                  + " with you.");
              }
            } else {
              npc.say("You brought me that ingredient already.");
            }
          }
      });
    }
   
    // Perhaps player wants to give all the ingredients at once
    npc.add(ConversationStates.QUESTION_1, "everything",
        null,
        ConversationStates.QUESTION_1,
        null,
        new ChatAction() {
          public void fire(final Player player, final Sentence sentence,
             final EventRaiser npc) {
            checkForAllIngredients(player, npc);
      }
    });

    // player says something which isn't in the needed food list.
    npc.add(ConversationStates.QUESTION_1, "",
      new NotCondition(new TriggerInListCondition(NEEDED_FOOD)),
      ConversationStates.QUESTION_1,
      "I won't put that in your soup.", null);

    // allow to say goodbye while Helena is listening for food names
    npc.add(ConversationStates.QUESTION_1, ConversationPhrases.GOODBYE_MESSAGES, null,
        ConversationStates.IDLE, "Bye.", null);

    npc.add(ConversationStates.ATTENDING, ConversationPhrases.NO_MESSAGES,
      new AndCondition(new QuestStartedCondition(QUEST_SLOT), new NotCondition(new QuestStateStartsWithCondition(QUEST_SLOT, "done"))),
      ConversationStates.ATTENDING,
      "I'm not sure what you want from me, then.", null);

    // player says he didn't bring any Food to different question
    npc.add(ConversationStates.QUESTION_1, ConversationPhrases.NO_MESSAGES,
      new AndCondition(new QuestStartedCondition(QUEST_SLOT), new NotCondition(new QuestStateStartsWithCondition(QUEST_SLOT, "done"))),
      ConversationStates.ATTENDING, "Okay then. Come back later.",
      null);
  }
View Full Code Here

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

       
        // player has met io before and has a pk skull
        add(ConversationStates.IDLE,
            ConversationPhrases.GREETING_MESSAGES,
            new AndCondition(new GreetingMatchesNameCondition(getName()),
                new QuestStartedCondition("meet_io"),
                new ChatCondition() {
                  public boolean fire(final Player player, final Sentence sentence, final Entity entity) {
                    return player.isBadBoy() ;
                  }
                }),
                ConversationStates.QUESTION_1,
                null,
                new SayTextWithPlayerNameAction("Hi again, [name]. I sense you have been branded with the mark of a killer. Do you wish to have it removed?"));
       
        // player has met io before and has not got a pk skull
        add(ConversationStates.IDLE,
            ConversationPhrases.GREETING_MESSAGES,
            new AndCondition(new GreetingMatchesNameCondition(getName()),
                new QuestStartedCondition("meet_io"),
                new ChatCondition() {
                  public boolean fire(final Player player, final Sentence sentence, final Entity entity) {
                    return !player.isBadBoy() ;
                  }
                }),
View Full Code Here

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

    // Fidorea introduces the quests
    npc.add(
      ConversationStates.ATTENDING,
      ConversationPhrases.QUEST_MESSAGES,
      new AndCondition(new QuestStartedCondition(QUEST_SLOT), new SystemPropertyCondition("stendhal.minetown")),
      ConversationStates.ATTENDING,
      "I have nothing to do for you. But thanks for asking",
      null);
    npc.add(
      ConversationStates.ATTENDING,
      ConversationPhrases.QUEST_MESSAGES,
      new AndCondition(new QuestNotStartedCondition(QUEST_SLOT), new SystemPropertyCondition("stendhal.minetown")),
      ConversationStates.QUEST_OFFERED,
      "Those who had to stay at home because of their duties, have prepared a #paper #chase.",
      null);
    npc.add(
      ConversationStates.QUEST_OFFERED,
      Arrays.asList("paper", "chase"),
      new SystemPropertyCondition("stendhal.minetown"),
      ConversationStates.ATTENDING,
      "You must ask every person on the trail about the #paper #chase. First you must find the beer-loving author of KNOW HOW TO KILL CREATURES.",
      startAction);


    // add normal way points (without first and last)
    for (int i = 0; i < points.size() - 1; i++) {
      addTaskToNPC(i);
    }

    // Fidorea does the post processing of this quest
    npc.add(ConversationStates.ATTENDING, Arrays.asList("paper", "chase"),
        new AndCondition(new QuestNotStartedCondition(QUEST_SLOT), new SystemPropertyCondition("stendhal.minetown")),
      ConversationStates.ATTENDING, "Oh, that is a nice #quest.", null);
    npc.add(ConversationStates.ATTENDING, Arrays.asList("paper", "chase"),
      new AndCondition(
          new QuestStartedCondition(QUEST_SLOT),
          new QuestNotInStateCondition(QUEST_SLOT, 0, "Fidorea"),
          new QuestNotInStateCondition(QUEST_SLOT, 0, "done"),
          new SystemPropertyCondition("stendhal.minetown")),
      ConversationStates.ATTENDING, "I guess you still have to talk to some people.", null);
View Full Code Here

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

    // time as finished
    npc.add(
      ConversationStates.IDLE,
      ConversationPhrases.GREETING_MESSAGES,
      new AndCondition(new GreetingMatchesNameCondition(npc.getName()),
          new QuestStartedCondition(QUEST_SLOT),
          new TimePassedCondition(QUEST_SLOT, 1, REQUIRED_MINUTES)),
      ConversationStates.QUEST_OFFERED,
      "Oi, you. Back for more rainbow beans?", null);

    // player returns after finishing the quest (it is repeatable) before
    // the time as finished
    npc.add(
      ConversationStates.IDLE,
      ConversationPhrases.GREETING_MESSAGES,
      new AndCondition(new GreetingMatchesNameCondition(npc.getName()),
          new QuestStartedCondition(QUEST_SLOT),
          new NotCondition(new TimePassedCondition(QUEST_SLOT, 1, REQUIRED_MINUTES))),
      ConversationStates.ATTENDING,
      null,
      new SayTimeRemainingAction(QUEST_SLOT, 1, REQUIRED_MINUTES, "Alright? I hope you don't want more beans. You can't take more of that stuff for at least another"));
View Full Code Here

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

        });
   
    // player already was set a riddle he couldn't solve
    reaper.add(ConversationStates.ATTENDING,
        "leave",
        new QuestStartedCondition(QUEST_SLOT),
        ConversationStates.QUESTION_1,
        null,
        new ChatAction() {
        public void fire(final Player player, final Sentence sentence, final EventRaiser npc) {
          final String riddle = player.getQuest(QUEST_SLOT);
View Full Code Here

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

    return player.hasQuest(QUEST_SLOT) && !"start".equals(player.getQuest(QUEST_SLOT)) && !"rejected".equals(player.getQuest(QUEST_SLOT));
  }

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

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

    // player who is rejected or 'done' but waiting to start again, returns
    npc.add(ConversationStates.IDLE,
      ConversationPhrases.GREETING_MESSAGES,
      new AndCondition(new GreetingMatchesNameCondition(npc.getName()),
          new QuestNotInStateCondition(QUEST_SLOT, "start"),
          new QuestStartedCondition(QUEST_SLOT)),
      ConversationStates.ATTENDING,
      "Hello again.",
      null);
   
    // if they ask for quest while on it, remind them
    npc.add(ConversationStates.ATTENDING,
      ConversationPhrases.QUEST_MESSAGES,
      new QuestInStateCondition(QUEST_SLOT, "start"),
      ConversationStates.ATTENDING,
      "You already promised me to bring me some fish soup for Hughie! Please hurry!",
      null);

    // first time player asks/ player had rejected
    npc.add(ConversationStates.ATTENDING,
        ConversationPhrases.QUEST_MESSAGES,
        new QuestNotStartedCondition(QUEST_SLOT),
        ConversationStates.QUEST_OFFERED,
        "My poor boy is sick and the potions I give him aren't working! Please could you fetch him some fish soup?",
        null);
   
    // player returns - enough time has passed
    npc.add(ConversationStates.ATTENDING,
        ConversationPhrases.QUEST_MESSAGES,
        new AndCondition(new QuestNotInStateCondition(QUEST_SLOT, "start"), new QuestStartedCondition(QUEST_SLOT), new TimePassedCondition(QUEST_SLOT,REQUIRED_MINUTES)),
        ConversationStates.QUEST_OFFERED,
        "My Hughie is getting sick again! Please could you bring another bowl of fish soup? It helped last time.",
        null);

    // player returns - not enough time has passed
    npc.add(ConversationStates.ATTENDING,
        ConversationPhrases.QUEST_MESSAGES,
        new AndCondition(new QuestNotInStateCondition(QUEST_SLOT, "start"), new QuestStartedCondition(QUEST_SLOT), new NotCondition(new TimePassedCondition(QUEST_SLOT,REQUIRED_MINUTES))),
        ConversationStates.ATTENDING,
        "Hughie is sleeping off his fever now and I'm hopeful he recovers. Thank you so much.",
        null);
   
    // player is willing to help
View Full Code Here

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

        }
      });

    npc.add(ConversationStates.ATTENDING,
      Arrays.asList("forge", "missing"),
      new QuestStartedCondition(QUEST_SLOT),
      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(";");
View Full Code Here

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

   
    npc.add(ConversationStates.IDLE,
        ConversationPhrases.GREETING_MESSAGES,
        new AndCondition(new GreetingMatchesNameCondition(npc.getName()),
            new NotCondition(new NakedCondition()),
            new QuestStartedCondition(QUEST_SLOT),
            new QuestNotInStateCondition(QUEST_SLOT, "seen_naked")),
        ConversationStates.ATTENDING,
        null,
        new SayTextWithPlayerNameAction("Hi again, [name]."));
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.