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

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


  }

  private void playerReturnsAfterGivingTooEarly(final SpeakerNPC npc) {
    final ChatCondition condition = new AndCondition(new GreetingMatchesNameCondition(npc.getName()),
        new QuestStateStartsWithCondition(QUEST_SLOT, "making;"),
        new NotCondition(new TimePassedCondition(QUEST_SLOT, 1, REQUIRED_MINUTES))
      );
    npc.add(ConversationStates.IDLE, ConversationPhrases.GREETING_MESSAGES,
        condition,
        ConversationStates.IDLE,
        null,
View Full Code Here


   * @return the condition
   */
  private AndCondition getConditionForBeingInCollectionPhase() {
    return new AndCondition(
                          new QuestActiveCondition(QUEST_SLOT),
                          new NotCondition(
                              new QuestStateStartsWithCondition(QUEST_SLOT,"making;")
                                  ),
                          new NotCondition(
                              new QuestStateStartsWithCondition(QUEST_SLOT,"decorating;")
                                  ),
                          new NotCondition(
                              new QuestStateStartsWithCondition(QUEST_SLOT,"find_vera")
                                  ),
                          new NotCondition(
                              new QuestStateStartsWithCondition(QUEST_SLOT,"kill_scientist")
                                  ),
                          new NotCondition(
                              new QuestStateStartsWithCondition(QUEST_SLOT,"legs")
                                          )
                              );
  }
View Full Code Here

 
  private void playerReturnsAfterRequestForLegs(final SpeakerNPC npc) {
  //player returns without legs
  final AndCondition nolegscondition = new AndCondition(new GreetingMatchesNameCondition(npc.getName()),
                  new QuestInStateCondition(QUEST_SLOT, "legs"),
                  new NotCondition(new PlayerHasItemWithHimCondition("shadow legs"))
                  );
  npc.add(ConversationStates.IDLE, ConversationPhrases.GREETING_MESSAGES,
      nolegscondition,
      ConversationStates.IDLE,
      "Hello again. Please return when you have the shadow legs, a base for me to add jewels to make jewelled legs for Vera.",
View Full Code Here

    // So then the NPC doesn't have to choose which reason to reject the player for (appears as a WARN from engine if he has to choose)
   
    // player is not old enough
    add(ConversationStates.ATTENDING,
         Arrays.asList("cost", "house", "buy", "purchase", "apartment"),
         new NotCondition(new AgeGreaterThanCondition(HouseSellerNPCBase.REQUIRED_AGE)),
         ConversationStates.ATTENDING,
         "The cost of a new apartment in Athor is "
             + getCost()
         + " money. But, you'll have to come back when you have spent at least "
         + Integer.toString((HouseSellerNPCBase.REQUIRED_AGE / 60)) + " hours on Faiumoni. Maybe I'll have managed to get a suntan by then.",
View Full Code Here

  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"));
   
   
    npc.add(ConversationStates.QUEST_ITEM_BROUGHT,
        "price",
        null,
        ConversationStates.QUEST_ITEM_BROUGHT,
        "The charge for my service is " + REQUIRED_MONEY
          + " money, and I need " + REQUIRED_GOLD
          + " gold bars and " + REQUIRED_GEM
          + " emerald to fix the ring. Do you want to pay now?",
        null);

    npc.add(ConversationStates.QUEST_ITEM_BROUGHT,
        ConversationPhrases.YES_MESSAGES,
        new AndCondition(
            new PlayerHasItemWithHimCondition("gold bar", REQUIRED_GOLD),
            new PlayerHasItemWithHimCondition("money", REQUIRED_MONEY),
            new PlayerHasItemWithHimCondition("emerald", REQUIRED_GEM)),
        ConversationStates.IDLE,
        "Okay, that's all I need to fix the ring. Come back in "
            + REQUIRED_MINUTES
            + " minutes and it will be ready. Bye for now.",
        new MultipleActions(
            new DropItemAction("gold bar", REQUIRED_GOLD),
            new DropItemAction("emerald", REQUIRED_GEM),
            new DropItemAction("money", REQUIRED_MONEY),
            new ChatAction() {
              public void fire(final Player player,
                  final Sentence sentence,
                  final EventRaiser npc) {
                final RingOfLife emeraldRing = (RingOfLife) player.getFirstEquipped("emerald ring");
                if (player.isBoundTo(emeraldRing)) {
                  player.setQuest(QUEST_SLOT, "forging;"
                      + System.currentTimeMillis());
                } else {
                  player.setQuest(QUEST_SLOT, "forgingunbound;"
                      + System.currentTimeMillis());
                }

              }
            },
            new DropItemAction("emerald ring")));
   
    npc.add(ConversationStates.QUEST_ITEM_BROUGHT,
        ConversationPhrases.YES_MESSAGES,
        new NotCondition(new  AndCondition(
            new PlayerHasItemWithHimCondition("gold bar", REQUIRED_GOLD),
            new PlayerHasItemWithHimCondition("money", REQUIRED_MONEY),
            new PlayerHasItemWithHimCondition("emerald", REQUIRED_GEM))),
        ConversationStates.IDLE,
        "Come back when you have the money, the gem and the gold. Goodbye.",
View Full Code Here

    npc.add(ConversationStates.ATTENDING,
        ConversationPhrases.QUEST_MESSAGES,
      new AndCondition(
          new LevelGreaterThanCondition(2),
          new QuestNotStartedCondition(QUEST_SLOT),
          new NotCondition(new QuestInStateCondition(QUEST_SLOT,"rejected"))),
      ConversationStates.QUESTION_1,
      "Hm, Do you know what I do for a living?", null);

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

            player.setQuest(QUEST_SLOT, "" + System.currentTimeMillis());
          }
        });

    fisherman.addMatching(ConversationStates.QUESTION_1, Expression.JOKER, new JokerExprMatcher(),
        new NotCondition(new TriggerInListCondition(ConversationPhrases.GOODBYE_MESSAGES)),
        ConversationStates.ATTENDING, null,
        new ChatAction() {
          public void fire(final Player player, final Sentence sentence, final EventRaiser npc) {
            String species = getCurrentSpecies();
            String obj = sentence.getObjectName();
View Full Code Here

    // says hi - didn't get the snow yeti asked for
    npc.add(ConversationStates.IDLE,
        ConversationPhrases.GREETING_MESSAGES,
        new AndCondition(new GreetingMatchesNameCondition(npc.getName()),
            new QuestInStateCondition(QUEST_SLOT, "start"),
            new NotCondition(new PlayerHasItemWithHimCondition("snowball", REQUIRED_SNOWBALLS))),
        ConversationStates.ATTENDING,
        "You're back already? Don't forget that you promised to collect a bunch of snowballs for me!",
        null);
   
    // says hi - quest was done before and is now repeatable
    npc.add(ConversationStates.IDLE,
        ConversationPhrases.GREETING_MESSAGES,
        new AndCondition(new GreetingMatchesNameCondition(npc.getName()),
            new QuestStartedCondition(QUEST_SLOT),
            new QuestNotInStateCondition(QUEST_SLOT, "start"),
            new TimePassedCondition(QUEST_SLOT, REQUIRED_MINUTES)),
        ConversationStates.ATTENDING,
        "Greetings again! Have you seen my latest snow sculptures? I need a #favor again ...",
        null);
   
    // says hi - quest was done before and is not yet repeatable
    npc.add(ConversationStates.IDLE,
        ConversationPhrases.GREETING_MESSAGES,
        new AndCondition(new GreetingMatchesNameCondition(npc.getName()),
            new QuestStartedCondition(QUEST_SLOT),
            new QuestNotInStateCondition(QUEST_SLOT, "start"),
            new NotCondition(new TimePassedCondition(QUEST_SLOT, REQUIRED_MINUTES))),
        ConversationStates.ATTENDING,
        null,
        new SayTimeRemainingAction(QUEST_SLOT, REQUIRED_MINUTES, "I have enough snow for my new sculpture. Thank you for helping! "
            + "I might start a new one in" ));

    // asks about quest - has never started it
    npc.add(ConversationStates.ATTENDING,
        ConversationPhrases.QUEST_MESSAGES,
        new QuestNotStartedCondition(QUEST_SLOT),
        ConversationStates.QUEST_OFFERED,
        "I like to make snow sculptures, but the snow in this cavern is not good enough. Would you help me and get some snowballs? I need twenty five of them.",
        null);
   
    // asks about quest but already on it
    npc.add(ConversationStates.ATTENDING,
        ConversationPhrases.QUEST_MESSAGES,
        new QuestInStateCondition(QUEST_SLOT, "start"),
        ConversationStates.ATTENDING,
        "You already promised me to bring some snowballs! Twenty five pieces, remember ...",
        null);
   
    // asks about quest - has done it but it's repeatable now
    npc.add(ConversationStates.ATTENDING,
        ConversationPhrases.QUEST_MESSAGES,
        new AndCondition(new QuestStartedCondition(QUEST_SLOT), new QuestNotInStateCondition(QUEST_SLOT, "start"), new TimePassedCondition(QUEST_SLOT, REQUIRED_MINUTES)),
        ConversationStates.QUEST_OFFERED,
        "I like to make snow sculptures, but the snow in this cavern is not good enough. Would you help me and get some snowballs? I need twenty five of them.",
        null);
   
    // asks about quest - has done it and it's too soon to do again
    npc.add(ConversationStates.ATTENDING,
        ConversationPhrases.QUEST_MESSAGES,
        new AndCondition(new QuestStartedCondition(QUEST_SLOT), new QuestNotInStateCondition(QUEST_SLOT, "start"), new NotCondition(new TimePassedCondition(QUEST_SLOT, REQUIRED_MINUTES))),
        ConversationStates.ATTENDING,
        "I have enough snow to finish my sculpture, but thanks for asking.",
        null);

    // player is willing to help
View Full Code Here

      null,
      new MultipleActions(reward));

    npc.add(ConversationStates.QUEST_ITEM_BROUGHT,
      ConversationPhrases.YES_MESSAGES,
      new NotCondition(new PlayerHasItemWithHimCondition("snowball", REQUIRED_SNOWBALLS)),
      ConversationStates.ATTENDING,
      "Hey! Where did you put the snowballs?",
      null);

    npc.add(
View Full Code Here

        null);

    /** Remind player about the quest */
    npc.add(ConversationStates.ATTENDING,
        "flask",
        new AndCondition(new QuestInStateCondition(QUEST_SLOT, "start"), new NotCondition(new PlayerHasItemWithHimCondition("flask"))),
        ConversationStates.ATTENDING,
        "*cough* Oh dear... I really need this medicine! Please hurry back with the #flask from #Margaret.",
        null);

        /** Remind player about the quest */
 
View Full Code Here

TOP

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

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.