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

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


    return 60;
  }
 
  @Override
  public boolean isRepeatable(final Player player) {
    return new QuestInStateCondition(QUEST_SLOT,0,"flower_brought").fire(player,null, null);
  }
View Full Code Here


  // The quest may have been completed a few times already and then re-opened as it's repeatable
  // since this method is used to separate open quests from completed quests, we'll say that being completed
  // means it's done and not re-opened
  @Override
  public boolean isCompleted(final Player player) {
    return new QuestInStateCondition(QUEST_SLOT,0,"flower_brought").fire(player,null, null);
  }
View Full Code Here

  private void step_4() {
    final SpeakerNPC npc = npcs.get("Ilisa");

    npc.add(ConversationStates.IDLE, ConversationPhrases.GREETING_MESSAGES,
        new AndCondition(new GreetingMatchesNameCondition(npc.getName()),
            new QuestInStateCondition(QUEST_SLOT, "ilisa"),
            new NotCondition(new PlayerHasItemWithHimCondition("flask"))),
        ConversationStates.ATTENDING,
        "Medicine for #Tad? Didn't he tell you to bring a flask?", null);

    final List<ChatAction> processStep = new LinkedList<ChatAction>();
    processStep.add(new DropItemAction("flask"));
    processStep.add(new IncreaseXPAction(10));
    processStep.add(new SetQuestAction(QUEST_SLOT, "corpse&herbs"));

    npc.add(ConversationStates.IDLE, ConversationPhrases.GREETING_MESSAGES,
        new AndCondition(new GreetingMatchesNameCondition(npc.getName()),
            new QuestInStateCondition(QUEST_SLOT, "ilisa"),
            new PlayerHasItemWithHimCondition("flask")),
        ConversationStates.ATTENDING,
        "Ah, I see you have that flask. #Tad needs medicine, right? Hmm... I'll need a #herb. Can you help?",
        new MultipleActions(processStep));
View Full Code Here

  private void step_5() {
    final SpeakerNPC npc = npcs.get("Ilisa");

    npc.add(ConversationStates.IDLE, ConversationPhrases.GREETING_MESSAGES,
        new AndCondition(new GreetingMatchesNameCondition(npc.getName()),
            new QuestInStateCondition(QUEST_SLOT, "corpse&herbs"),
            new NotCondition(new PlayerHasItemWithHimCondition("arandula"))),
        ConversationStates.ATTENDING,
        "Can you fetch those #herbs for the #medicine?", null);

    final List<ChatAction> processStep = new LinkedList<ChatAction>();
    processStep.add(new DropItemAction("arandula"));
    processStep.add(new IncreaseXPAction(50));
    processStep.add(new SetQuestAction(QUEST_SLOT, "potion"));

    npc.add(ConversationStates.IDLE, ConversationPhrases.GREETING_MESSAGES,
        new AndCondition(new GreetingMatchesNameCondition(npc.getName()),
            new QuestInStateCondition(QUEST_SLOT, "corpse&herbs"),
            new PlayerHasItemWithHimCondition("arandula")),
        ConversationStates.ATTENDING,
        "Okay! Thank you. Now I will just mix these... a pinch of this... and a few drops... there! Can you ask #Tad to stop by and collect it? I want to see how he's doing.",
        new MultipleActions(processStep));
View Full Code Here

  private void step_6() {
    final SpeakerNPC npc = npcs.get("Tad");

        // another reminder incase player says task again                                                                                                   
        npc.add(ConversationStates.ATTENDING, ConversationPhrases.QUEST_MESSAGES,
                new QuestInStateCondition(QUEST_SLOT, "corpse&herbs"),
                ConversationStates.ATTENDING,
                "*cough* I hope #ilisa hurries with my medicine...",
                null);

    final List<ChatAction> processStep = new LinkedList<ChatAction>();
    processStep.add(new IncreaseXPAction(200));
    processStep.add(new SetQuestAction(QUEST_SLOT, "done"));
   
    // note Ilisa is spelled with a small i here because I
    // and l cannot be told apart in game
    npc.add(ConversationStates.IDLE, ConversationPhrases.GREETING_MESSAGES,
        new AndCondition(new GreetingMatchesNameCondition(npc.getName()),
            new QuestInStateCondition(QUEST_SLOT, "potion")),
        ConversationStates.ATTENDING, "Thanks! I will go talk with #ilisa as soon as possible.",
        new MultipleActions(processStep));
  }
View Full Code Here

    triggers.addAll(ConversationPhrases.QUEST_MESSAGES);

    // player asks about quest or says coal when they are supposed to bring some coal and they have it
    npc.add(
        ConversationStates.ATTENDING, triggers,
        new AndCondition(new QuestInStateCondition(QUEST_SLOT, "start"), new PlayerHasItemWithHimCondition("coal",25)),
        ConversationStates.ATTENDING,
        null,
        new MultipleActions(
            new DropItemAction("coal",25),
            new ChatAction() {
              public void fire(final Player player,
                  final Sentence sentence,
                  final EventRaiser npc) {
                int grilledsteakAmount = Rand.rand(4) + 1;
                new EquipItemAction("grilled steak", grilledsteakAmount, true).fire(player, sentence, npc);
                npc.say("Thank you!! Take " + Grammar.thisthese(grilledsteakAmount) + " " +
                    Grammar.quantityNumberStrNoun(grilledsteakAmount, "grilled steak") + " from my grill!");
                new SetQuestAndModifyKarmaAction(getSlotName(), "waiting;"
                    + System.currentTimeMillis(), 10.0).fire(player, sentence, npc);
              }
            }));

    // player asks about quest or says coal when they are supposed to bring some coal and they don't have it
    npc.add(
        ConversationStates.ATTENDING, triggers,
        new AndCondition(new QuestInStateCondition(QUEST_SLOT, "start"), new NotCondition(new PlayerHasItemWithHimCondition("coal",25))),
        ConversationStates.ATTENDING,
        "You don't have the coal amount which I need yet. Go and pick some more pieces up, please.",
        null);
   
    npc.add(
View Full Code Here

  private void askingStep() {
    final SpeakerNPC npc = npcs.get("Carena");

    npc.add(ConversationStates.ATTENDING,
      ConversationPhrases.QUEST_MESSAGES,
      new OrCondition(new QuestNotStartedCondition(QUEST_SLOT), new QuestInStateCondition(QUEST_SLOT, "rejected")),
      ConversationStates.QUEST_OFFERED,
      "I feel so lonely. I only ever see creatures and alive people. If I knew about #spirits like me, I would feel better.",
      null);

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

  private void offerQuestStep() {
    final SpeakerNPC npc = npcs.get("Jef");

    npc.add(ConversationStates.ATTENDING,
      ConversationPhrases.QUEST_MESSAGES,
      new OrCondition(new QuestNotStartedCondition(QUEST_SLOT), new QuestInStateCondition(QUEST_SLOT, 0, "rejected")),
      ConversationStates.QUEST_OFFERED,
      "I miss my mother! She wanted to go to the market but didn't return so far. Can you watch out for her please?",
      null);

    // player asks about quest which he has done already and he is allowed to repeat it
View Full Code Here

  private void findMomStep() {
    final SpeakerNPC amber = npcs.get("Amber");

        // give the flower if it's at least 5 days since the player activated the quest the last time, and set the time slot again
    amber.add(ConversationStates.ATTENDING, "Jef",
      new AndCondition(new QuestInStateCondition(QUEST_SLOT, 0,"start"),
               new PlayerCanEquipItemCondition("zantedeschia")),

      ConversationStates.IDLE,
      "Oh I see :) My son Jef asked you to take a look after me. He is such a nice and gentle boy! Please give him this zantedeschia here. I love these flowers! Please give it to him and tell him that I'm #fine.",
      new MultipleActions(new EquipItemAction("zantedeschia", 1, true),
                                new SetQuestAction(QUEST_SLOT, 0, "found_mom")));
   

    // don't put the flower on the ground - if player has no space, tell them
    amber.add(ConversationStates.ATTENDING, "Jef",
        new AndCondition(new QuestInStateCondition(QUEST_SLOT, 0, "start"),
                 new NotCondition(new PlayerCanEquipItemCondition("zantedeschia"))),
        ConversationStates.IDLE,
        "Oh, I wanted to give you a flower for my son to show him that I'm fine, but as I see now, you don't have enough space for equipping it. Please return to me when you will have made some space in your bags!",
        null);
View Full Code Here

      }
    };
    npc.add(ConversationStates.ATTENDING,
        Arrays.asList("flower", "zantedeschia", "fine", "amber", "done"),
        new AndCondition(new QuestInStateCondition(QUEST_SLOT, 0, "found_mom"), new PlayerHasItemWithHimCondition("zantedeschia")),
        ConversationStates.ATTENDING, null,
        new MultipleActions(new DropItemAction("zantedeschia"),
                                    new IncreaseXPAction(5000),
                                    new IncreaseKarmaAction(15),
                  addRandomNumberOfItemsAction,                      
View Full Code Here

TOP

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

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.