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

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


        new SetQuestAction(QUEST_SLOT, "book_read"));
           

    npc.add(ConversationStates.QUEST_2_OFFERED,
        "obsidian",
        new LevelGreaterThanCondition(REQUIRED_LEVEL),
        ConversationStates.QUEST_2_OFFERED,
        "That book says that the black gem, obsidian, can be used to make a very sharp cutting edge. Fascinating! If you slay a black dragon to bring it, I'll make a #knife for you.",
        new SetQuestAction(QUEST_SLOT, "knife_offered"));

    npc.add(ConversationStates.QUEST_2_OFFERED,
        "knife",
        new LevelGreaterThanCondition(REQUIRED_LEVEL),
        ConversationStates.QUEST_2_OFFERED,
        "I'll make an obsidian knife if you can slay a black dragon and get the gem which makes the blade. Bring a "
            + FISH
            + " so that I can make the bone handle, too.",
        new SetQuestAction(QUEST_SLOT, "knife_offered"));
   
    npc.add(ConversationStates.QUEST_2_OFFERED,
        Arrays.asList("obsidian", "knife"),
        new NotCondition(new LevelGreaterThanCondition(REQUIRED_LEVEL)),
        ConversationStates.ATTENDING,
        "Well, I don't think you're quite ready for such a dangerous weapon yet. How about you come back when you're above level " + Integer.toString(REQUIRED_LEVEL) + "?",
        null);
   
    npc.add(ConversationStates.IDLE,
View Full Code Here


  @Override
  public Collection<Achievement> createAchievements() {
    List<Achievement> xpAchievements = new LinkedList<Achievement>();
    xpAchievements.add(createAchievement("xp.level.010", "Greenhorn", "Reach level 10", Achievement.EASY_BASE_SCORE, true,
                        new LevelGreaterThanCondition(9)));
    xpAchievements.add(createAchievement("xp.level.050", "Novice", "Reach level 50", Achievement.EASY_BASE_SCORE, true,
                        new LevelGreaterThanCondition(49)));
    xpAchievements.add(createAchievement("xp.level.100", "Apprentice", "Reach level 100", Achievement.EASY_BASE_SCORE, true,
                        new LevelGreaterThanCondition(99)));
    xpAchievements.add(createAchievement("xp.level.200", "Adventurer", "Reach level 200", Achievement.MEDIUM_BASE_SCORE, true,
                        new LevelGreaterThanCondition(199)));
    xpAchievements.add(createAchievement("xp.level.300", "Experienced Adventurer", "Reach level 300", Achievement.MEDIUM_BASE_SCORE, true,
                        new LevelGreaterThanCondition(299)));
    xpAchievements.add(createAchievement("xp.level.400", "Master Adventurer", "Reach level 400", Achievement.MEDIUM_BASE_SCORE, true,
                        new LevelGreaterThanCondition(399)));
    xpAchievements.add(createAchievement("xp.level.500", "Stendhal Master", "Reach level 500", Achievement.HARD_BASE_SCORE, true,
                        new LevelGreaterThanCondition(499)));
    xpAchievements.add(createAchievement("xp.level.597", "Stendhal High Master", "Reach level 597", Achievement.HARD_BASE_SCORE, true,
                        new LevelGreaterThanCondition(596)));
    return xpAchievements;
  }
View Full Code Here

        addReply("island", "I can summon a magical island for you personally. It is sustained by your life force, so if you leave it, you must return quickly or "
            + "it will dissipate. You should not try to leave and return more than once. To enter, just pay the #fee.");
        addGoodbye("Bye.");
        add(ConversationStates.ANY,
            "fee",
            new AndCondition(new LevelGreaterThanCondition(MIN_LEVEL - 1),
                new TimePassedCondition(QUEST_SLOT, DAYS_BEFORE_REPEAT * MINUTES_IN_DAYS)),
                ConversationStates.QUEST_OFFERED,
                null,
                new ChatAction() {
          public void fire(final Player player, final Sentence sentence, final EventRaiser npc) {
            npc.say("The fee is your current level, multiplied by " + COST_FACTOR + " and payable in cash. At your level of "
                + player.getLevel() + " the fee is " + COST_FACTOR * player.getLevel() + " money. Do you want to fight?");     
          }
        });

        // player meets conditions, first remind them of the dangers and wait for a 'yes'
        add(ConversationStates.ANY,
            Arrays.asList("challenge", "fight", "battle"),
            new AndCondition(new LevelGreaterThanCondition(MIN_LEVEL - 1),
                new TimePassedCondition(QUEST_SLOT, DAYS_BEFORE_REPEAT * MINUTES_IN_DAYS)),
                ConversationStates.QUEST_OFFERED,
                "I accept your challenge. If you can pay the #fee, I will summon an island with " + NUMBER_OF_CREATURES
                + " dangerous creatures for you to face. So, are you sure you want to enter the adventure island?",
                null);
        // player returns within DAYS_BEFORE_REPEAT days, and his island has expired
        add(ConversationStates.ANY,
            Arrays.asList("challenge", "fight", "battle", "fee"),
            new AndCondition(
                new NotCondition(new TimePassedCondition(QUEST_SLOT, DAYS_BEFORE_REPEAT * MINUTES_IN_DAYS)),
                new NotCondition(new AdventureZoneExistsCondition())
            ),
            ConversationStates.ATTENDING,
            null,
            new SayTimeRemainingAction(QUEST_SLOT, DAYS_BEFORE_REPEAT * MINUTES_IN_DAYS, "Your life force will not support the island so soon after you last visited. You will be ready again in"));

        // player returns within DAYS_BEFORE_REPEAT days, if the zone still exists that he was in before, send him straight up.
        add(ConversationStates.ANY,
            Arrays.asList("challenge", "fight", "battle", "fee"),
            new AndCondition(
                new NotCondition(new TimePassedCondition(QUEST_SLOT, DAYS_BEFORE_REPEAT * MINUTES_IN_DAYS)),
                new AdventureZoneExistsCondition()
            ),
            ConversationStates.QUESTION_1,
            "The island which I recently summoned for you, remains for you to visit at no extra cost. Do you wish to return to it?",
            null);

        // player below MIN_LEVEL
        add(ConversationStates.ANY,
            Arrays.asList("challenge", "fight", "battle", "fee"),
            new LevelLessThanCondition(MIN_LEVEL),
            ConversationStates.ATTENDING,
            "You are too weak to fight against " + NUMBER_OF_CREATURES  + " at once. Come back when you are at least Level " + MIN_LEVEL + ".",
            null);
        // all conditions are met and player says yes he wants to fight
        add(ConversationStates.QUEST_OFFERED,
            ConversationPhrases.YES_MESSAGES,
            new LevelGreaterThanCondition(MIN_LEVEL - 1),
            ConversationStates.IDLE,
            null,
            new ChallengeChatAction());
        // player was reminded of dangers and he doesn't want to fight
        add(ConversationStates.QUEST_OFFERED,
View Full Code Here

    final SpeakerNPC npc = npcs.get("Carmen");

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

            ConversationStates.ATTENDING,
            "Oh sorry, I don't lend equipment to people with so little experience as you.",
            null);
        
        add(ConversationStates.ATTENDING, "borrow",
            new AndCondition(new LevelGreaterThanCondition(5), new QuestNotCompletedCondition("pizza_delivery"))
            ConversationStates.ATTENDING,
            "You'll have to speak to Leander and ask if you can help with the pizza before I'm allowed to lend you anything.",
            null);

        add(ConversationStates.ATTENDING, "borrow",
            new AndCondition(
                new LevelGreaterThanCondition(5),
                new QuestCompletedCondition("pizza_delivery"),
                new QuestNotActiveCondition(QUEST_SLOT)),
            ConversationStates.ATTENDING,
            "I lend out " + Grammar.enumerateCollectionWithHash(ITEMS) + ". If you're interested, please say which you want.",
            null);

        // player already has borrowed something it didn't return and will pay for it
        add(ConversationStates.ATTENDING, "borrow",
            new AndCondition(new QuestActiveCondition(QUEST_SLOT), new NotCondition(new PlayerHasRecordedItemWithHimCondition(QUEST_SLOT)))
            ConversationStates.QUESTION_1,
            "You didn't return what I last lent you! Do you want to pay for it at a cost of " + COST + " money?",
            null);
        
        // player already has borrowed something it didn't return and will return it
        add(ConversationStates.ATTENDING, "borrow",
            new AndCondition(new QuestActiveCondition(QUEST_SLOT), new PlayerHasRecordedItemWithHimCondition(QUEST_SLOT))
            ConversationStates.QUESTION_2,
            "You didn't return what I last lent you! Do you want to return it now?",
            null);
        
        // player wants to pay for previous item
        final List<ChatAction> payment = new LinkedList<ChatAction>();
        payment.add(new DropItemAction("money", COST));
        payment.add(new SetQuestAction(QUEST_SLOT, "done"));
        payment.add(new DecreaseKarmaAction(10));
        add(ConversationStates.QUESTION_1,
            ConversationPhrases.YES_MESSAGES,
            new PlayerHasItemWithHimCondition("money", COST)
            ConversationStates.ATTENDING,
            "Thanks. Just let me know if you want to #borrow any tools again.",
            new MultipleActions(payment));
        
        // player already has borrowed something and wants to return it
        final List<ChatAction> returnitem = new LinkedList<ChatAction>();
        returnitem.add(new DropRecordedItemAction(QUEST_SLOT));
        returnitem.add(new SetQuestAction(QUEST_SLOT, "done"));
        add(ConversationStates.QUESTION_2,
            ConversationPhrases.YES_MESSAGES,
            new PlayerHasRecordedItemWithHimCondition(QUEST_SLOT)
            ConversationStates.ATTENDING,
            "Thank you! Just let me know if you want to #borrow any tools again.",
            new MultipleActions(returnitem));
        
        // don't want to pay for it now
        add(ConversationStates.QUESTION_1,
            ConversationPhrases.NO_MESSAGES,
            null, 
            ConversationStates.ATTENDING,
            "No problem. Take as long as you need, but you can't borrow other tools till you return the last, or pay for it.",
            null);
        
        // don't want to return it now
        add(ConversationStates.QUESTION_2,
            ConversationPhrases.NO_MESSAGES,
            null, 
            ConversationStates.ATTENDING,
            "No problem. Take as long as you need, but you can't borrow other tools till you return the last, or pay for it.",
            null);
        
        
        // saying the item name and storing that item name into the quest slot, and giving the item
        for(final String itemName : ITEMS) {
          add(ConversationStates.ATTENDING,
              itemName,
              new AndCondition(
                  new LevelGreaterThanCondition(5),
                  new QuestCompletedCondition("pizza_delivery"),
                  new QuestNotActiveCondition(QUEST_SLOT)),
              ConversationStates.ATTENDING,
              null,
              new ChatAction() {
              public void fire(final Player player, final Sentence sentence, final EventRaiser npc) {
                final Item item =  SingletonRepository.getEntityManager().getItem(itemName);
                if (item == null) {
                  npc.say("Sorry, something went wrong. Could you say correctly the item, please?");
                } else {
                  player.equipOrPutOnGround(item);
                  player.setQuest(QUEST_SLOT, itemName);
                  npc.say("Here you are! Don't forget to #return it or you have to pay!");
                }
              }
            });
        }

        // additionally add "sugar" as trigger word
        add(ConversationStates.ATTENDING,
              "sugar",
              new AndCondition(
                  new LevelGreaterThanCondition(5),
                  new QuestCompletedCondition("pizza_delivery"),
                  new QuestNotActiveCondition(QUEST_SLOT)),
              ConversationStates.ATTENDING,
              null,
              new ChatAction() {
View Full Code Here

    npc.add(ConversationStates.ATTENDING, "sell",
        new LevelLessThanCondition(6),
        ConversationStates.ATTENDING,
        "I am sorry, I only accept offers from people who have a good reputation. You can gain experience by helping people with their tasks or defending the city from evil creatures.", null);
    npc.add(ConversationStates.ATTENDING, "sell",
        new LevelGreaterThanCondition(5),
        ConversationStates.ATTENDING, null,
        new PrepareOfferChatAction());
    npc.add(ConversationStates.ATTENDING, "sell", null, ConversationStates.ATTENDING, null,
        new PrepareOfferChatAction());
    npc.add(ConversationStates.SELL_PRICE_OFFERED, ConversationPhrases.YES_MESSAGES,
View Full Code Here

    npc2.add(ConversationStates.ATTENDING, Arrays.asList("heroes", "who", "hero", "status") , new DeathMatchEmptyCondition(),
         ConversationStates.ATTENDING,
         "Are you a hero? Make the #challenge if you are sure you want to join the deathmatch.", null);

    npc2.add(ConversationStates.ATTENDING, "challenge",
         new AndCondition(new LevelGreaterThanCondition(19),
              new DeathMatchEmptyCondition(),
              new NotCondition(new PlayerHasPetOrSheepCondition())),
         ConversationStates.IDLE, null,        
         new TeleportAction("0_ados_wall_n", 100, 86, Direction.DOWN));


    npc2.add(ConversationStates.ATTENDING, "challenge",
       new AndCondition(new LevelGreaterThanCondition(19),
            new NotCondition(new DeathMatchEmptyCondition()),
            new NotCondition(new PlayerHasPetOrSheepCondition())),
         ConversationStates.QUESTION_1, null,        
         new ChatAction() {
           public void fire(final Player player, final Sentence sentence, final EventRaiser npc) {
             final List<Player> dmplayers = arena.getPlayers();
             final List<String> dmplayernames = new LinkedList<String>();
             for (Player dmplayer : dmplayers) {
               dmplayernames.add(dmplayer.getName());
             }
             // List the players inside deathmatch
             npc.say("There are heroes battling right now in the deathmatch, so it may be dangerous there. Do you want to join "
                 + Grammar.enumerateCollection(dmplayernames) + "?");
           }
         });

    npc2.add(ConversationStates.ATTENDING, "challenge",
       new AndCondition(new LevelGreaterThanCondition(19),
            new PlayerHasPetOrSheepCondition()),
       ConversationStates.ATTENDING, "Sorry, but it would be too scary for your pet in there.",
         null);

View Full Code Here

          ConversationStates.ATTENDING,
          "Oh sorry, I don't rent signs to people who have so little experience as you.",
          null);

        add(ConversationStates.ATTENDING, "",
          new AndCondition(getRentMatchCond(), new LevelGreaterThanCondition(5), new NotCondition(new TextHasParameterCondition())),
          ConversationStates.ATTENDING,
          "Just tell me #rent followed by the text I should write on it.",
          null);

        add(ConversationStates.ATTENDING, "",
          new AndCondition(getRentMatchCond(), new LevelGreaterThanCondition(5), new TextHasParameterCondition()),
          ConversationStates.BUY_PRICE_OFFERED,
          null,
          new ChatAction() {
            public void fire(final Player player, final Sentence sentence, final EventRaiser npc) {
              text = sentence.getOriginalText().substring(5).trim();
View Full Code Here

  private void prepareRequestingStep() {
    final SpeakerNPC npc = npcs.get("Ortiv Milquetoast");

    npc.add(ConversationStates.IDLE, ConversationPhrases.GREETING_MESSAGES,
      new AndCondition(new GreetingMatchesNameCondition(npc.getName()),
          new LevelGreaterThanCondition(2),
          new QuestNotStartedCondition(QUEST_SLOT),
          new NotCondition(new QuestInStateCondition(QUEST_SLOT,"rejected"))),
      ConversationStates.QUESTION_1,
      "Ohh a stranger found my hidden house, welcome! Maybe you can help me with something?", null);
View Full Code Here

    // player responds to word 'deal' - enough level
    npc.add(ConversationStates.INFORMATION_1,
      "deal",
      new AndCondition(
          new QuestNotStartedCondition(QUEST_SLOT),
          new LevelGreaterThanCondition(REQUIRED_LEVEL-1)),
      ConversationStates.QUEST_OFFERED,
      "Nosy, aint yer? I deal in rainbow beans. You take some, and who knows where the trip will take yer. It'll cost you "
      + REQUIRED_MONEY
      + " money. You want to buy some?",
      null);
   
    // player responds to word 'deal' - low level
    npc.add(ConversationStates.INFORMATION_1,
      "deal",
      new AndCondition(
          new QuestNotStartedCondition(QUEST_SLOT),
          new LevelLessThanCondition(REQUIRED_LEVEL)),
      ConversationStates.ATTENDING,
      "It's not stuff you're ready for, pal. Now get out of 'ere! An don't you come back till you've got more hairs on that chest!",
      null);

    // player wants to take the beans but hasn't the money
    npc.add(ConversationStates.QUEST_OFFERED,
      ConversationPhrases.YES_MESSAGES,
      new NotCondition(new PlayerHasItemWithHimCondition("money", REQUIRED_MONEY)),
      ConversationStates.ATTENDING,
      "Scammer! You don't have the cash.",
      null);

    // player wants to take the beans
    npc.add(ConversationStates.QUEST_OFFERED,
        ConversationPhrases.YES_MESSAGES,
        new PlayerHasItemWithHimCondition("money", REQUIRED_MONEY),
        ConversationStates.ATTENDING,
        "Alright, here's the beans. Once you take them, you come down in about 30 minutes. And if you get nervous up there, hit one of the green panic squares to take you back here.",
        new MultipleActions(
            new DropItemAction("money", REQUIRED_MONEY),
            new EquipItemAction("rainbow beans", 1, true),
            // this is still complicated and could probably be split out further
            new ChatAction() {
              public void fire(final Player player, final Sentence sentence, final EventRaiser npc) {
                if (player.hasQuest(QUEST_SLOT)) {
                  final String[] tokens = player.getQuest(QUEST_SLOT).split(";");
                  if (tokens.length == 4) {
                    // we stored an old time taken or set it to -1 (never taken), either way, remember this.
                    player.setQuest(QUEST_SLOT, "bought;"
                        + System.currentTimeMillis() + ";taken;" + tokens[3]);
                  } else {
                    // it must have started with "done" (old quest slot status was done;timestamp), but now we store when the beans were taken.
                    // And they haven't taken beans since
                    player.setQuest(QUEST_SLOT, "bought;"
                        + System.currentTimeMillis() + ";taken;-1");

                  }
                } else {
                  // first time they bought beans here
                  player.setQuest(QUEST_SLOT, "bought;"
                      + System.currentTimeMillis() + ";taken;-1");

                }
              }
            }));
   
    // player is not willing to experiment
    npc.add(
      ConversationStates.QUEST_OFFERED,
      ConversationPhrases.NO_MESSAGES,
      null,
      ConversationStates.ATTENDING,
      "Aight, ain't for everyone. Anythin else you want, you say so.",
      null);

    // player says 'deal' or asks about beans when NPC is ATTENDING, not
    // just in information state (like if they said no then changed mind and
    // are trying to get him to deal again)
    npc.add(ConversationStates.ATTENDING,
      Arrays.asList("deal", "beans", "rainbow beans", "yes"),
      new LevelGreaterThanCondition(REQUIRED_LEVEL-1),
      ConversationStates.ATTENDING,
      "We already talked about this, conversation's moved on now mate, keep up! Try another time.",
      null);
     
    // player says 'deal' or asks about beans when NPC is ATTENDING, not
View Full Code Here

TOP

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

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.