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

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


      caster.sendPrivateText("You have not sufficent mana to cast your spell \""+getName()+"\".");
      return false;
    }
   
    //check minimum level
    if (new LevelLessThanCondition(getMinimumLevel()).fire(caster, null, null)) {
      caster.sendPrivateText("You did not reach the minimum level for your spell \""+getName()+"\" yet.");
      return false;
    }
   
    long earliestPossibleNextCastingTime = getTimestamp() + getCooldown()*1000L;
View Full Code Here


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

        "Welcome to the Semos bakery! We'll #bake fine bread for anyone who helps bring our #flour delivery from the mill.");
       
        addOffer("Our pizza delivery team can #borrow some kitchen equipment from me.");
        
        add(ConversationStates.ATTENDING, "borrow",
            new LevelLessThanCondition(6),
            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() {
              public void fire(final Player player, final Sentence sentence, final EventRaiser npc) {
                npc.say("Sorry, I can't lend out sugar, only a #sugar #mill.");
              }
        });

        // too low level
        add(ConversationStates.ATTENDING,
              ITEMS,
              new LevelLessThanCondition(6),
              ConversationStates.ATTENDING,
              "Sorry, as you have little experience in this world I can't trust you with my tools.",
              null);
       
        // currently has borrowed an item
View Full Code Here

  private int price;
  private int quantity;
 
  public void add(SpeakerNPC npc) {
    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,
View Full Code Here

    npc2.add(ConversationStates.QUESTION_1, ConversationPhrases.NO_MESSAGES, null,
         ConversationStates.ATTENDING, "That's a bit cowardly, but never mind. If there's anything else you want, just say.",        
         null);

    npc2.add(ConversationStates.ATTENDING, "challenge",
         new LevelLessThanCondition(20),
         ConversationStates.ATTENDING, "Sorry, you are too weak for the #deathmatch now, come back when you have at least level 20.",
         null);
  }
View Full Code Here

        addJob("I #rent signs for a day.");
        addHelp("If you want to #rent a sign, just tell me what I should write on it.");
        setPlayerChatTimeout(CHAT_TIMEOUT);

        add(ConversationStates.ATTENDING, "",
          new AndCondition(getRentMatchCond(), new LevelLessThanCondition(6)),
          ConversationStates.ATTENDING,
          "Oh sorry, I don't rent signs to people who have so little experience as you.",
          null);

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

    // 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
    // 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 LevelLessThanCondition(REQUIRED_LEVEL),
      ConversationStates.ATTENDING,
      "That stuff's too strong for you. No chance mate!",
      null);
  }
View Full Code Here

     * most interested player for this long reading... How about keeping a
     * list of all the things the player has asked and reward him when the
     * list is complete?
     */
    npc.add(ConversationStates.ATTENDING, "bye",
      new LevelLessThanCondition(15),
      ConversationStates.IDLE,
      "Bye. Hey, if you're going to hang around the library, don't forget to be quiet; people could be studying!",
      null);

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

TOP

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

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.