Package games.stendhal.server.entity.npc

Examples of games.stendhal.server.entity.npc.ChatCondition


  }


  private void playerReturnsWithoutKillingTheImperialScientistOrWithoutGoblet(
      SpeakerNPC npc) {
    final ChatCondition condition = new AndCondition(
        new GreetingMatchesNameCondition(npc.getName()),
        new QuestStateStartsWithCondition(QUEST_SLOT, "kill_scientist"),
        new NotCondition(
            new AndCondition(
                    new KilledForQuestCondition(QUEST_SLOT, 1),
View Full Code Here


        "I am only in pain. Kill my brother and bring me his blood. It's all I want now.",
        null);
  }
 
  private void playerReturnsWithLetter(final SpeakerNPC npc) {
    final ChatCondition condition = new AndCondition(
        new QuestStateStartsWithCondition(QUEST_SLOT, "find_vera"),
        new PlayerHasItemWithHimCondition("note")
      );
   
    final ChatAction action = new MultipleActions(
View Full Code Here

        "Do it!",
        null);
  }
 
  private void playerReturnsWithoutLetter(final SpeakerNPC npc) {
    final ChatCondition condition = new AndCondition(new GreetingMatchesNameCondition(npc.getName()),
        new QuestStateStartsWithCondition(QUEST_SLOT, "find_vera"),
        new NotCondition(new PlayerHasItemWithHimCondition("note"))
      );
    npc.add(ConversationStates.IDLE, ConversationPhrases.GREETING_MESSAGES,
        condition,
View Full Code Here

        "I think he is in Kalavan." ,
        action);
  }

  private void playerReturnsAfterGivingWhenFinished(final SpeakerNPC npc) {
    final ChatCondition condition = new AndCondition(
        new QuestStateStartsWithCondition(QUEST_SLOT, "making;"),
        new TimePassedCondition(QUEST_SLOT, 1, REQUIRED_MINUTES)
      );
    final ChatAction action = new SetQuestAction(QUEST_SLOT,"find_vera");
    npc.add(ConversationStates.IDLE, ConversationPhrases.GREETING_MESSAGES,
View Full Code Here

        "Pah! Bye!",
        null);
  }

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

                "Come back in"));
  }
 
  private void bringItemsPhase(final SpeakerNPC npc) {
    //condition for quest being active and in item collection phase
    ChatCondition itemPhaseCondition = getConditionForBeingInCollectionPhase();
   
    //player returns during item collection phase
    npc.add(ConversationStates.IDLE, ConversationPhrases.GREETING_MESSAGES,
        new AndCondition(new GreetingMatchesNameCondition(npc.getName()),
            itemPhaseCondition),
View Full Code Here

                                 new NotCondition(new TimePassedCondition(QUEST_SLOT, 1, DELAY))),
        ConversationStates.IDLE,
        "I gave you a flower not five minutes past! Her Royal Highness can enjoy that one for a while.",
        null);
     
      final ChatCondition lostFlowerCondition = new AndCondition(new GreetingMatchesNameCondition(rose.getName()),
         // had got the flower before and was supposed to take it to the princess next
           new QuestInStateCondition(QUEST_SLOT, 0, "got_flower"),
         // check chest and so on first - maybe the player does still have it (though we can't check house chests or the floor)
         new ChatCondition() {
             public boolean fire(final Player player, final Sentence sentence, final Entity entity) {
               return player.getTotalNumberOf("rhosyd") == 0;
             }
         },
        // just to check there is space
View Full Code Here

   *             interpretation.
   */
  @Override
  protected AccessCheckingPortal createPortal(final ConfigurableFactoryContext ctx) {
    String rejectMessage = getRejectedMessage(ctx);
    ChatCondition condition = getCondition(ctx);
    ChatAction action = getAction(ctx);
    if (rejectMessage != null) {
      return new ConditionAndActionPortal(condition, rejectMessage, action);
    } else {
      return new ConditionAndActionPortal(condition, action);
View Full Code Here

      protected void createDialog() {
        addOffer("Can you keep a secret? Dr. Feelgood, our veterinarian, can sell you medicine that he doesn't need for the animals.");
        addJob("I'm the keeper of this animal refuge. I will take care of any abandoned pets I am brought.");
        add(ConversationStates.ATTENDING,
          ConversationPhrases.HELP_MESSAGES,
          new ChatCondition() {
            public boolean fire(final Player player, final Sentence sentence,
                      final Entity engine) {
              return player.hasPet();
            }
          },
          ConversationStates.SERVICE_OFFERED, "Have you brought that pet to be taken care of here?",
          null);
       
        add(ConversationStates.SERVICE_OFFERED,
          ConversationPhrases.YES_MESSAGES, null,
          ConversationStates.ATTENDING, null,
          new ChatAction() {
            public void fire(final Player player, final Sentence sentence,
                     final EventRaiser npc) {
              Pet pet = player.getPet();
              String petName = pet.getTitle();
              // these numbers are hardcoded, they're the area in the pet sanctuary which is for pets. It has food spawners.
              int x = Rand.randUniform(2, 12);
              int y = Rand.randUniform(7, 29);
              StendhalRPZone zone = SingletonRepository.getRPWorld().getZone(ZONE_NAME);
              if (StendhalRPAction.placeat(zone, pet, x, y)) {
                player.removePet(pet);
                // reward with some karma but limit abuse
                if (player.getKarma() < 60.0) {
                  player.addKarma(30.0);
                }
                npc.say("Thank you for rescuing this " + petName + ", I will take good care of it. Remember you can come back "
                + "and visit the pet sanctuary any time you like!");
                notifyWorldAboutChanges();
              } else {
                // there was no room for the pet
                npc.say("It looks like we don't have any space left in our pet sanctuary! I hope you can look after this " + petName + " a little longer.")
              }
            }
          });

        add(ConversationStates.SERVICE_OFFERED,
          ConversationPhrases.NO_MESSAGES, null,
          ConversationStates.ATTENDING, "Oh, it's so nice to see an owner and their pet happy together. Good luck both of you.", null);
       
        add(ConversationStates.ATTENDING,
          ConversationPhrases.HELP_MESSAGES,
          new ChatCondition() {
            public boolean fire(final Player player, final Sentence sentence,
                      final Entity engine) {
              return !player.hasPet();
            }
          },
View Full Code Here

        add(ConversationStates.IDLE,
            ConversationPhrases.GREETING_MESSAGES,
            new AndCondition(
                new GreetingMatchesNameCondition(getName()),
                new QuestNotStartedCondition("introduce_players"),
                new ChatCondition() {
                  public boolean fire(final Player player, final Sentence sentence, final Entity entity) {
                    return !player.isGhost();
                  }
                }),
                ConversationStates.ATTENDING,
View Full Code Here

TOP

Related Classes of games.stendhal.server.entity.npc.ChatCondition

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.