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

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


  void fixRingStep(final SpeakerNPC npc) {

    npc.add(ConversationStates.ATTENDING, Arrays.asList("emerald ring", "life", "emerald"),
      new AndCondition(new PlayerHasItemWithHimCondition("emerald ring"),
                   new NotCondition(new QuestStateStartsWithCondition(QUEST_SLOT, FORGING))),
      ConversationStates.QUEST_ITEM_BROUGHT,
      null,
      new ChatAction() {
        public void fire(final Player player, final Sentence sentence, final EventRaiser npc) {
          final RingOfLife emeraldRing = (RingOfLife) player.getFirstEquipped("emerald ring");
         
            if (emeraldRing.isBroken()) {
              npc.say("What a pity, your emerald ring is broken. I can fix it, for a #price.");
            } else {
              // ring is not broken so he just lets player know
              // where it can be fixed
              npc.say("I see you already have an emerald ring. If it gets broken, you can come to me to fix it.");
              npc.setCurrentState(ConversationStates.ATTENDING);
            }
         
        }
      });
   
    npc.add(ConversationStates.ATTENDING,
        Arrays.asList("emerald ring", "life", "emerald"),
        new AndCondition(new NotCondition(new PlayerHasItemWithHimCondition("emerald ring")),
                 new NotCondition(new QuestStateStartsWithCondition(QUEST_SLOT, FORGING))),

        ConversationStates.ATTENDING,
        "It is difficult to get the ring of life. Do a favour for a powerful elf in Nal'wor and you may receive one as a reward."
        , null);
 
    npc.add(ConversationStates.ATTENDING,
        Arrays.asList("emerald ring", "life", "emerald"),
        new AndCondition(new QuestStateStartsWithCondition(QUEST_SLOT, FORGING),
            new NotCondition(new QuestStateStartsWithCondition(QUEST_SLOT, FORGING + "unbound")),
            new TimePassedCondition(QUEST_SLOT,1,REQUIRED_MINUTES)),
        ConversationStates.ATTENDING,
        "I'm pleased to say, your ring of life is fixed! It's good as new now.",
        new MultipleActions(
            new IncreaseXPAction(500),
            new SetQuestAction(QUEST_SLOT, "done"),
            new EquipItemAction("emerald ring", 1, true)));
   
    npc.add(ConversationStates.ATTENDING,
        Arrays.asList("emerald ring", "life", "emerald"),
        new AndCondition(new QuestStateStartsWithCondition(QUEST_SLOT, FORGING),
            new QuestStateStartsWithCondition(QUEST_SLOT, FORGING + "unbound"),
            new TimePassedCondition(QUEST_SLOT,1,REQUIRED_MINUTES)),
        ConversationStates.ATTENDING,
        "I'm pleased to say, your ring of life is fixed! It's good as new now.",
        new MultipleActions(
            new IncreaseXPAction(500),
            new SetQuestAction(QUEST_SLOT, "done"),
            new EquipItemAction("emerald ring", 1, false)));

    npc.add(ConversationStates.ATTENDING,
        Arrays.asList("emerald ring", "life", "emerald"),
        new AndCondition(new QuestStateStartsWithCondition(QUEST_SLOT, FORGING),
            new NotCondition(new TimePassedCondition(QUEST_SLOT,1,REQUIRED_MINUTES))),
        ConversationStates.IDLE, null,
        new SayTimeRemainingAction(QUEST_SLOT,1, REQUIRED_MINUTES,"I haven't finished fixing your ring of life. Please check back in"));
   
   
View Full Code Here


        null);

    // player asks about quest which he has done already and he is allowed to repeat it
    npc.add(ConversationStates.ATTENDING,
        ConversationPhrases.QUEST_MESSAGES,
        new AndCondition(new TimePassedCondition(QUEST_SLOT, 1, REQUIRED_MINUTES), new QuestStateStartsWithCondition(QUEST_SLOT, "waiting;")),
        ConversationStates.QUEST_OFFERED,
        "The last coal you brought me is mostly gone again. Will you bring me some more?",
        null);
   
    // player asks about quest which he has done already but it is not time to repeat it
    npc.add(ConversationStates.ATTENDING,
        ConversationPhrases.QUEST_MESSAGES,
        new AndCondition(new NotCondition(new TimePassedCondition(QUEST_SLOT, 1, REQUIRED_MINUTES)), new QuestStateStartsWithCondition(QUEST_SLOT, "waiting;")),
        ConversationStates.ATTENDING,
        null,
        new SayTimeRemainingAction(QUEST_SLOT, 1, REQUIRED_MINUTES, "The coal amount behind my counter is still high enough. I will not need more for"));

    // Player agrees to get the coal
View Full Code Here

    return "CoalForHaunchy";
  }

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

        new TimePassedCondition(QUEST_SLOT, 1, REQUIRED_MINUTES)).fire(player,null, null);
  }

  @Override
  public boolean isCompleted(final Player player) {
    return new QuestStateStartsWithCondition(QUEST_SLOT,"waiting;").fire(player, null, null);
  }
View Full Code Here

      null);

    // player asks about quest which he has done already and he is allowed to repeat it
        npc.add(ConversationStates.ATTENDING,
        ConversationPhrases.QUEST_MESSAGES,
        new AndCondition(new QuestStateStartsWithCondition(QUEST_SLOT, "done"), new TimePassedCondition(QUEST_SLOT, 1, REQUIRED_MINUTES)),
        ConversationStates.QUEST_OFFERED,
        "It is a long time ago that you watched out for my mum. May I ask you to take a look at her again and tell me if she is still fine, please?",
        null);

    // player asks about quest but time didn't pass yet
View Full Code Here

  }


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

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

         new TimePassedCondition(QUEST_SLOT, 1, WEEK_IN_MINUTES)).fire(player,null, null);
  }
 
  @Override
  public boolean isCompleted(final Player player) {
    return new QuestStateStartsWithCondition(QUEST_SLOT,"killed").fire(player, null, null);
  }
View Full Code Here

    return 70;
  }
 
  @Override
  public boolean isRepeatable(final Player player) {
    return new AndCondition(new QuestStateStartsWithCondition(QUEST_SLOT,"killed"),
         new TimePassedCondition(QUEST_SLOT, 1, 2*MathHelper.MINUTES_IN_ONE_WEEK)).fire(player,null, null);
  }
View Full Code Here

         new TimePassedCondition(QUEST_SLOT, 1, 2*MathHelper.MINUTES_IN_ONE_WEEK)).fire(player,null, null);
  }
 
  @Override
  public boolean isCompleted(final Player player) {
    return new QuestStateStartsWithCondition(QUEST_SLOT,"killed").fire(player, null, null);
  }
View Full Code Here

TOP

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

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.