Examples of PlayerHasItemWithHimCondition


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

    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

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

     * 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

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

    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);

    final List<ChatAction> reward = new LinkedList<ChatAction>();
    reward.add(new DropItemAction("suntan cream"));
    reward.add(new EquipItemAction("small key", 1, true));
    reward.add(new IncreaseXPAction(1000));
    reward.add(new SetQuestAction(QUEST_SLOT, "done"));
    reward.add(new IncreaseKarmaAction(15));
   
    zara.add(
      ConversationStates.QUEST_ITEM_BROUGHT,
      ConversationPhrases.YES_MESSAGES,
      // make sure the player isn't cheating by putting the
      // cream away and then saying "yes"
      new PlayerHasItemWithHimCondition("suntan cream"),
      ConversationStates.ATTENDING,
      "Thank you! I feel much better immediately! Here, take this key to my row house in Ados. Feel at home as long as I'm still here!",
      new MultipleActions(reward));

    zara.add(ConversationStates.QUEST_ITEM_BROUGHT,
View Full Code Here

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

   */
  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

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

    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),
            new IncreaseXPAction(10000),
View Full Code Here

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

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

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

      }
    });
   
    npc.add(ConversationStates.QUEST_ITEM_BROUGHT,
      ConversationPhrases.YES_MESSAGES,
      new PlayerHasItemWithHimCondition("wood", REQUIRED_WOOD),
      ConversationStates.ATTENDING, null,
      new MultipleActions(reward));

    //player said the wood was for her but has dropped it from his bag or hands
    npc.add(ConversationStates.QUEST_ITEM_BROUGHT,
      ConversationPhrases.YES_MESSAGES,
      new NotCondition(new PlayerHasItemWithHimCondition("wood", REQUIRED_WOOD)),
      ConversationStates.ATTENDING,
      "Hey! Where did you put the wood?",
      null);

    // player had wood but said it is not for sally
View Full Code Here

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

    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

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

  private void bringBookStep() {
    final SpeakerNPC npc = npcs.get("Alrak");
    npc.add(ConversationStates.IDLE, ConversationPhrases.GREETING_MESSAGES,
        new AndCondition(new GreetingMatchesNameCondition(npc.getName()),
            new QuestInStateCondition(QUEST_SLOT, "got_book"),
            new PlayerHasItemWithHimCondition("blue book")),
        ConversationStates.IDLE,
        "Great! I think I'll read this for a while. Bye!",
        new MultipleActions(
            new DropItemAction("blue book"),
            new IncreaseXPAction(500),
            new SetQuestAction(QUEST_SLOT, "reading;"),
            new SetQuestToTimeStampAction(QUEST_SLOT, 1)));

    npc.add(ConversationStates.IDLE,
        ConversationPhrases.GREETING_MESSAGES,
        new AndCondition(new GreetingMatchesNameCondition(npc.getName()),
            new OrCondition(new QuestInStateCondition(QUEST_SLOT,"seeking_book"), new QuestInStateCondition(QUEST_SLOT, "got_book")),
            new NotCondition(new PlayerHasItemWithHimCondition("blue book"))),
        ConversationStates.ATTENDING,
        "Hello again. I hope you haven't forgotten about the gem book I wanted.",
        null);
  }
View Full Code Here

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

    npc.add(ConversationStates.IDLE,
        ConversationPhrases.GREETING_MESSAGES,
        new AndCondition(new GreetingMatchesNameCondition(npc.getName()),
            new QuestInStateCondition(QUEST_SLOT, "knife_offered"),
            new KilledCondition("black dragon"),
            new PlayerHasItemWithHimCondition("obsidian"),
            new PlayerHasItemWithHimCondition(FISH)),
        ConversationStates.IDLE,
        "You found the gem for the blade and the fish bone to make the handle! I'll start work right away. Come back in "
        + REQUIRED_MINUTES + " minutes.",
        new MultipleActions(
        new DropItemAction("obsidian"),
        new DropItemAction(FISH),
        new SetQuestAction(QUEST_SLOT, "forging;"),
        new SetQuestToTimeStampAction(QUEST_SLOT, 1)));

    // player says hi to NPC when equipped with the fish and the gem and
    // he's not killed a black dragon
    npc.add(ConversationStates.IDLE,
        ConversationPhrases.GREETING_MESSAGES,
        new AndCondition(new GreetingMatchesNameCondition(npc.getName()),
            new QuestInStateCondition(QUEST_SLOT, "knife_offered"),
            new NotCondition(new KilledCondition("black dragon")),
            new PlayerHasItemWithHimCondition("obsidian"),
            new PlayerHasItemWithHimCondition(FISH)),
        ConversationStates.ATTENDING,
        "Didn't you hear me properly? I told you to go slay a black dragon for the obsidian, not buy it! How do I know this isn't a fake gem? *grumble* I'm not making a special knife for someone who is scared to face a dragon.",
        null);

    // player says hi to NPC when not equipped with the fish and the gem
    npc.add(ConversationStates.IDLE,
        ConversationPhrases.GREETING_MESSAGES,
        new AndCondition(new GreetingMatchesNameCondition(npc.getName()),
            new QuestInStateCondition(QUEST_SLOT, "knife_offered"),
            new NotCondition(
                new AndCondition(
                    new PlayerHasItemWithHimCondition("obsidian"),
                    new PlayerHasItemWithHimCondition(FISH)))),
        ConversationStates.ATTENDING,
        "Hello again. Don't forget I offered to make that obsidian knife, if you bring me a "
          + FISH
          + " and a piece of obsidian from a black dragon you killed. In the meantime if I can #help you, just say the word.",
        null);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.