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

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


    /*
     * Player asks about quest, remind what they're doing
     */
    npc.add(ConversationStates.ATTENDING,
        ConversationPhrases.QUEST_MESSAGES,
        new QuestInStateCondition(QUEST_SLOT,"wood"),
        ConversationStates.ATTENDING,
        "I'm waiting for you to bring me 10 pieces of #wood.",
        null);
   
    /*
     * Player asks about wood, but hasn't collected any - remind them.
     */
    npc.add(ConversationStates.ATTENDING,
        "wood",
        new AndCondition(new QuestInStateCondition(QUEST_SLOT,"wood"),
                 new NotCondition (new PlayerHasItemWithHimCondition("wood",10))),
        ConversationStates.ATTENDING,
        "Wood is a great item with many purposes. Of course you will " +
        "find some pieces in a forest. Please remember to come back when you " +
        "have ten pieces for me, and say #wood.",
        null);

    /*
     * Player asks about wood, and has collected some - take it and
ask for horse hair.
     */
    npc.add(ConversationStates.ATTENDING,
        "wood",
        new AndCondition(new QuestInStateCondition(QUEST_SLOT,"wood"),
                new PlayerHasItemWithHimCondition("wood",10)),
        ConversationStates.ATTENDING,
        "Great, now I can make new arrows. But for the bows I need " +
        "bowstrings. Please go to #Karl. I know he has horses and if " +
        "you tell him my name he will give you  #'horse hairs' from a horsetail.",
View Full Code Here


     */
    SpeakerNPC npc = npcs.get("Karl");

    npc.add(ConversationStates.ATTENDING,
        "Ouchit",
        new AndCondition(new QuestInStateCondition(QUEST_SLOT,"hair"),
                new NotCondition (new PlayerHasItemWithHimCondition("horse hair",1))),
        ConversationStates.ATTENDING,
        "Hello, hello! Ouchit needs more horse hairs from my horses? " +
        "No problem, here you are. Send Ouchit greetings from me.",
        new EquipItemAction("horse hair"));
View Full Code Here

    /*
     * Player asks about quest, remind what they're doing
     */
    npc.add(ConversationStates.ATTENDING,
        ConversationPhrases.QUEST_MESSAGES,
        new QuestInStateCondition(QUEST_SLOT,"hair"),
        ConversationStates.ATTENDING,
        "I'm waiting for you to bring me some #'horse hairs'.",
        null);
   
    /*
     * Player asks about horse hair, but hasn't collected any - remind them.
     */
    npc.add(ConversationStates.ATTENDING,
        Arrays.asList("hair", "horse", "horse hairs"),
        new AndCondition(new QuestInStateCondition(QUEST_SLOT,"hair"),
                new NotCondition (new PlayerHasItemWithHimCondition("horse hair"))),
        ConversationStates.ATTENDING,
        "Horse hairs can be used as a bowstring. Please fetch me some from #Karl.",
        null);

    /*
     * These actions are part of the reward
     */
    final List<ChatAction> reward = new LinkedList<ChatAction>();
    reward.add(new EquipItemAction("scale armor", 1, true));
    reward.add(new EquipItemAction("chain legs", 1, true));
    reward.add(new IncreaseXPAction(100));
    reward.add(new DropItemAction("horse hair"));
    reward.add(new SetQuestAndModifyKarmaAction(QUEST_SLOT, "done", 10.0));
   
    /*
     * Player asks about horse hair, and has collected some - take it
and ask for horse hair.
     */
    npc.add(ConversationStates.ATTENDING,
        Arrays.asList("hair", "horse", "horse hairs"),
        new AndCondition(new QuestInStateCondition(QUEST_SLOT,"hair"),
                new PlayerHasItemWithHimCondition("horse hair")),
        ConversationStates.ATTENDING,
        "Yay, you got the horse hairs. Thanks a lot. Karl is really nice. Here, " +
        "take this for your work. Someone left it here and I don't need those things.",
        new MultipleActions(reward));
View Full Code Here

      "I don't have a new task for you. But thank you for the suntan cream. I feel my skin is getting better already!",
      null);
   
    zara.add(ConversationStates.ATTENDING,
        ConversationPhrases.QUEST_MESSAGES,
        new QuestInStateCondition(QUEST_SLOT, "rejected"),
        ConversationStates.QUEST_OFFERED,
        "You refused to help me last time and my skin is getting worse. "
        + "Please can you bring me the magic #'suntan cream' that the #lifeguards produce?",
        null);
   
View Full Code Here

    final SpeakerNPC zara = npcs.get("Zara");

    zara.add(ConversationStates.IDLE,
      ConversationPhrases.GREETING_MESSAGES,
      new AndCondition(new GreetingMatchesNameCondition(zara.getName()),
          new QuestInStateCondition(QUEST_SLOT, "start"),
          new PlayerHasItemWithHimCondition("suntan cream")),
      ConversationStates.QUEST_ITEM_BROUGHT,
      "Great! You got the suntan cream! Is it for me?",
      null);
   
    zara.add(ConversationStates.IDLE,
        ConversationPhrases.GREETING_MESSAGES,
        new AndCondition(new GreetingMatchesNameCondition(zara.getName()),
            new QuestInStateCondition(QUEST_SLOT, "start"),
            new NotCondition(new PlayerHasItemWithHimCondition("suntan cream"))),
        ConversationStates.ATTENDING,
        "I know that the #'suntan cream' is hard to get, but I hope that you didn't forget my painful problem...",
        null);
View Full Code Here

   */
  private void bringCocktailStep() {
    final SpeakerNPC npc = npcs.get("Princess Esclara");
    npc.add(
      ConversationStates.ATTENDING, triggers,
      new AndCondition(new QuestInStateCondition(QUEST_SLOT, "start"), new PlayerHasItemWithHimCondition("pina colada")),
      ConversationStates.ATTENDING,
      null,
      new MultipleActions(
            new DropItemAction("pina colada"),
            new ChatAction() {
              public void fire(final Player player,
                  final Sentence sentence,
                  final EventRaiser npc) {
                int pieAmount = Rand.roll1D6() + 1;
                new EquipItemAction("fish pie", pieAmount, true).fire(player, sentence, npc);
                npc.say("Thank you!! Take " +
                    Grammar.thisthese(pieAmount) + " " +
                    Grammar.quantityplnoun(pieAmount, "fish pie", "") +
                    " from my cook, and this kiss, from me.");
                new SetQuestAndModifyKarmaAction(getSlotName(), "drinking;"
                                 + System.currentTimeMillis(), 15.0).fire(player, sentence, npc);
              }
            }));

    npc.add(
      ConversationStates.ATTENDING, triggers,
      new AndCondition(new QuestInStateCondition(QUEST_SLOT, "start"), new NotCondition(new PlayerHasItemWithHimCondition("pina colada"))),
      ConversationStates.ATTENDING,
      "You don't have any drink I like yet. Go, and you better get an exotic one!",
      null);

    npc.add(
View Full Code Here

   
    // the player returns to Maerion after having started the quest.
    // Maerion checks if the player has killed one of enough dark elf types
    npc.add(ConversationStates.IDLE, ConversationPhrases.GREETING_MESSAGES,
        new AndCondition(new GreetingMatchesNameCondition(npc.getName()),
            new QuestInStateCondition(QUEST_SLOT, "start"),
            new NotCondition(new KilledCondition("dark elf archer", "dark elf captain", "thing"))),
        ConversationStates.QUEST_STARTED,
        "Don't you remember promising to sort out my dark elf problem? Kill every dark elf in the #secret room below - especially the snivelling dark elf captain and any evil dark elf archers you find! And bring me the amulet from the mutant thing.",
        null);
   
    npc.add(ConversationStates.IDLE,
        ConversationPhrases.GREETING_MESSAGES,
        new AndCondition(new GreetingMatchesNameCondition(npc.getName()),
            new QuestInStateCondition(QUEST_SLOT, "start"),
            new KilledCondition("dark elf archer", "dark elf captain", "thing"),
            new NotCondition(new PlayerHasItemWithHimCondition("amulet")))
        , ConversationStates.QUEST_STARTED
        , "What happened to the amulet? Remember I need it back!"
        , null);
 
    npc.add(ConversationStates.IDLE,
        ConversationPhrases.GREETING_MESSAGES,
        new AndCondition(new GreetingMatchesNameCondition(npc.getName()),
            new QuestInStateCondition(QUEST_SLOT, "start"),
            new KilledCondition("dark elf archer", "dark elf captain", "thing"),
            new PlayerHasItemWithHimCondition("amulet"))
        , ConversationStates.ATTENDING
        , "Many, many thanks. I am relieved to have that back. Here, take this ring. It can revive the powers of the dead.",
        new MultipleActions(new DropItemAction("amulet"),
            new EquipItemAction("emerald ring", 1, true),
            new IncreaseXPAction(10000),
            new IncreaseKarmaAction(5.0),
            new SetQuestAction(QUEST_SLOT, "done")));
   
   
    // support for new-style quest
   
    // building string for completed quest state
    StringBuilder sb = new StringBuilder("started");
    for(int i=0;i<creatures.size();i++) {
      sb.append(";");
      sb.append(creatures.get(i));
    }
    final String completedQuestState = sb.toString();
   
    // the player returns to Maerion after having started the quest.
    // Maerion checks if the player has killed one of enough dark elf types
    npc.add(ConversationStates.IDLE, ConversationPhrases.GREETING_MESSAGES,
        new AndCondition(
            new QuestInStateCondition(QUEST_SLOT,0,"started"),
            new NotCondition(
                new QuestInStateCondition(QUEST_SLOT, completedQuestState))),
        ConversationStates.QUEST_STARTED,
        "Don't you remember promising to sort out my dark elf problem?"+
        " Kill every dark elf in the #secret room below - especially"+
        " the ones who command, do magic or are archers." +
        "  Don't forget the evil matronmother too."+
        " And bring me the amulet from the mutant thing.",
        new ExamineChatAction("dark-elves-wanted.png", "Wanted!", ""));
   
    npc.add(ConversationStates.IDLE,
        ConversationPhrases.GREETING_MESSAGES,
        new AndCondition(new GreetingMatchesNameCondition(npc.getName()),
            new QuestInStateCondition(QUEST_SLOT, completedQuestState),
            new NotCondition(
                new PlayerHasItemWithHimCondition("amulet")))
        , ConversationStates.QUEST_STARTED
        , "What happened to the amulet? Remember I need it back!"
        , null);
 
    npc.add(ConversationStates.IDLE,
        ConversationPhrases.GREETING_MESSAGES,
        new AndCondition(new GreetingMatchesNameCondition(npc.getName()),
            new QuestInStateCondition(QUEST_SLOT, completedQuestState),                  
            new PlayerHasItemWithHimCondition("amulet"))
        , ConversationStates.ATTENDING
        , "Many, many thanks. I am relieved to have that back. Here, take this ring. It can revive the powers of the dead.",
        new MultipleActions(new DropItemAction("amulet"),
            new EquipItemAction("emerald ring", 1, true),
View Full Code Here

    // player returns with the promised wood
    npc.add(ConversationStates.IDLE,
      ConversationPhrases.GREETING_MESSAGES,
      new AndCondition(new GreetingMatchesNameCondition(npc.getName()),
          new QuestInStateCondition(QUEST_SLOT, "start"), new PlayerHasItemWithHimCondition("wood", REQUIRED_WOOD)),
      ConversationStates.QUEST_ITEM_BROUGHT,
      "Hi again! You've got wood, I see; do you have those 10 pieces of wood I asked about earlier?",
      null);

    //player returns without promised wood
    npc.add(ConversationStates.IDLE,
      ConversationPhrases.GREETING_MESSAGES,
      new AndCondition(new GreetingMatchesNameCondition(npc.getName()),
          new QuestInStateCondition(QUEST_SLOT, "start"), new NotCondition(new PlayerHasItemWithHimCondition("wood", REQUIRED_WOOD))),
      ConversationStates.ATTENDING,
      "You're back already? Don't forget that you promised to collect ten pieces of wood for me!",
      null);

    // first chat of player with sally
    npc.add(ConversationStates.IDLE,
      ConversationPhrases.GREETING_MESSAGES,
      new AndCondition(new GreetingMatchesNameCondition(npc.getName()),
          new QuestNotStartedCondition(QUEST_SLOT)),
      ConversationStates.ATTENDING, "Hi! I need a little #favor ... ",
      null);

    // player who is rejected or 'done' but waiting to start again, returns
    npc.add(ConversationStates.IDLE,
      ConversationPhrases.GREETING_MESSAGES,
      new AndCondition(new GreetingMatchesNameCondition(npc.getName()),
          new QuestNotInStateCondition(QUEST_SLOT, "start"),
          new QuestStartedCondition(QUEST_SLOT)),
      ConversationStates.ATTENDING,
      "Hi again!",
      null);
   
    // if they ask for quest while on it, remind them
    npc.add(ConversationStates.ATTENDING,
      ConversationPhrases.QUEST_MESSAGES,
      new QuestInStateCondition(QUEST_SLOT, "start"),
      ConversationStates.ATTENDING,
      "You already promised me to bring me some wood! Ten pieces, remember?",
      null);

    // first time player asks/ player had rejected
View Full Code Here

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

    // offer moss when prompted
    npc.add(ConversationStates.ANY,
        Arrays.asList("moss", "magical", "twilight", "ida", "cloak", "mithril cloak", "specials", "twilight moss"),
        new QuestInStateCondition(mithrilcloak.getQuestSlot(), "twilight_zone"),
        ConversationStates.QUEST_ITEM_QUESTION,
        "Keep it quiet will you! Yeah, I got moss, it's "
        + Integer.toString(MOSS_COST) + " money each. How many do you want?",
        null);
View Full Code Here

    final SpeakerNPC npc = npcs.get("Ida");
    // player hasn't given elixir to lda in the twilight zone yet
    npc.add(ConversationStates.ATTENDING,
        Arrays.asList("magical", "mithril", "cloak", "mithril cloak", "task", "quest", "twilight"),
        new QuestInStateCondition(mithrilcloak.getQuestSlot(), "twilight_zone"),
        ConversationStates.ATTENDING,   
        "What's happening to me? I'm feverish .. I see twilight .. you can't understand unless you visit me here ... you must ask #Pdiddi how to get to the #twilight.",       
        null);

    npc.addReply("Pdiddi", "Oh, I'm too confused... I can't tell you anything about him...");


    // player gave elixir and returned
    npc.add(ConversationStates.ATTENDING,
        Arrays.asList("magical", "mithril", "cloak", "mithril cloak", "task", "quest", "twilight", "elixir"),
        new QuestInStateCondition(mithrilcloak.getQuestSlot(), "taking_striped_cloak"),
        ConversationStates.ATTENDING,   
        "When I was sick I got behind on my other jobs. I promised #Josephine I'd make her a stripey cloak but I have no time. So please, I'm relying on you to buy one and take it to her. They sell blue striped cloaks in Ados abandoned keep. Thank you!",       
        null);


    // Ida and lda look the same but one lives in her true home sewing room and one lives in the twilight zone
    // hence they need different names according to engine, but name will look the same on client
    final SpeakerNPC npc2 = npcs.get("lda");

    npc2.add(ConversationStates.IDLE,
        ConversationPhrases.GREETING_MESSAGES,
        new AndCondition(new GreetingMatchesNameCondition(npc2.getName()),
            new QuestInStateCondition(mithrilcloak.getQuestSlot(), "twilight_zone"),
            new NotCondition(new PlayerHasItemWithHimCondition("twilight elixir"))),
        ConversationStates.IDLE,   
        "I'm sick .. so sick .. only some powerful medicine will fix me.",       
        null);

    npc2.add(ConversationStates.IDLE,
        ConversationPhrases.GREETING_MESSAGES,
        new AndCondition(new GreetingMatchesNameCondition(npc2.getName()),
            new QuestInStateCondition(mithrilcloak.getQuestSlot(), "twilight_zone"),
            new PlayerHasItemWithHimCondition("twilight elixir")),
        ConversationStates.QUEST_ITEM_QUESTION,   
        "Is that elixir for me? If #yes I will take it immediately. You must return to see me again in my normal state.",       
         null);

    npc2.add(ConversationStates.QUEST_ITEM_QUESTION,
        ConversationPhrases.YES_MESSAGES,
        new AndCondition(new QuestInStateCondition(mithrilcloak.getQuestSlot(), "twilight_zone"),
                 new PlayerHasItemWithHimCondition("twilight elixir")
                 ),
        ConversationStates.IDLE,   
        "Thank you!",       
        new MultipleActions(
                new DropItemAction("twilight elixir"),
                new SetQuestAction(mithrilcloak.getQuestSlot(), "taking_striped_cloak"),
                new TeleportAction("int_ados_sewing_room", 12, 20, Direction.DOWN)
                )
        );

    npc2.add(ConversationStates.QUEST_ITEM_QUESTION,
        ConversationPhrases.NO_MESSAGES,
        new AndCondition(new QuestInStateCondition(mithrilcloak.getQuestSlot(), "twilight_zone"),
                 new PlayerHasItemWithHimCondition("twilight elixir")
                 ),
        ConversationStates.IDLE,   
        "I'm getting sicker ...",       
         null);
View Full Code Here

TOP

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

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.