Examples of PlayerHasItemWithHimCondition


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

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

    // accept the letter
    npc.add(ConversationStates.ATTENDING,
        Arrays.asList("letter", "note", "whiggins", "apology"),
        new AndCondition(new QuestInStateCondition(mithrilcloak.getQuestSlot(), "taking_letter"), new PlayerHasItemWithHimCondition("sealed envelope")),
        ConversationStates.ATTENDING,
        "*reads* ... *reads* ... Well, I must say, that is a weight off my mind. Thank you ever so much. Please convey my warmest regards to Whiggins. All is forgiven.",
        new MultipleActions(
                   new DropItemAction("sealed envelope"),
                   new SetQuestAndModifyKarmaAction(mithrilcloak.getQuestSlot(), "took_letter", 10.0)
View Full Code Here

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

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

    // accept the fabric and ask for scissors
    npc.add(ConversationStates.ATTENDING,
        Arrays.asList("fabric", "mithril", "cloak", "mithril cloak", "task", "quest"),
        new AndCondition(new QuestInStateCondition(mithrilcloak.getQuestSlot(), "got_fabric"), new PlayerHasItemWithHimCondition(mithrilcloak.getFabricName())),
        ConversationStates.ATTENDING,
        "Wow you got the " + mithrilcloak.getFabricName() + " , that took longer than I expected! Now, to cut it I need magical #scissors, if you would go get them from #Hogart. I will be waiting for you to return.",
        new MultipleActions(
                   new DropItemAction(mithrilcloak.getFabricName()),
                   new SetQuestAndModifyKarmaAction(mithrilcloak.getQuestSlot(), "need_scissors", 10.0)
        ));

    // remind about fabric. there are so many steps to getting fabric
    // that the player could be in many quest states and she still is just waiting for fabric
    npc.add(ConversationStates.ATTENDING,
        Arrays.asList("fabric", "mithril", "cloak", "mithril cloak", "task", "quest"),
        new OrCondition(
                new QuestInStateCondition(mithrilcloak.getQuestSlot(), "need_fabric"),
                new QuestStateStartsWithCondition(mithrilcloak.getQuestSlot(), "makingthread;"),
                new QuestInStateCondition(mithrilcloak.getQuestSlot(), "got_thread"),
                new QuestStateStartsWithCondition(mithrilcloak.getQuestSlot(), "fusingthread;"),
                new QuestInStateCondition(mithrilcloak.getQuestSlot(), "got_mithril_thread"),
                new QuestInStateCondition(mithrilcloak.getQuestSlot(), "taking_letter"),
                new QuestInStateCondition(mithrilcloak.getQuestSlot(), "took_letter"),
                new AndCondition(new QuestInStateCondition(mithrilcloak.getQuestSlot(), "got_fabric"),
                         new NotCondition(new PlayerHasItemWithHimCondition(mithrilcloak.getFabricName()))
                        )
                 ),
        ConversationStates.ATTENDING,
        "I'm still waiting for the " + mithrilcloak.getFabricName()
        + " so I can start work on your mithril cloak. You should ask #Kampusch about anything textile related.",       
View Full Code Here

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

    final SpeakerNPC npc = npcs.get("Ida");
   
    // Player brought the clasp, don't make them wait any longer for the cloak
    npc.add(ConversationStates.ATTENDING,
        Arrays.asList("clasp", "mithril clasp", "cloak", "mithril cloak", "task", "quest"),
        new AndCondition(new QuestInStateCondition(mithrilcloak.getQuestSlot(), "got_clasp"), new PlayerHasItemWithHimCondition("mithril clasp")),
        ConversationStates.ATTENDING,
        "Wow, Pedinghaus really outdid himself this time. It looks wonderful on your new cloak! Wear it with pride.",
        new MultipleActions(
                   new DropItemAction("mithril clasp"),
                   new SetQuestAndModifyKarmaAction(mithrilcloak.getQuestSlot(), "done", 10.0),
                   new EquipItemAction("mithril cloak", 1, true),
                   new IncreaseXPAction(1000)
                   )
        );

    // remind about getting clasp
    npc.add(ConversationStates.ATTENDING,
        Arrays.asList("clasp", "mithril clasp", "cloak", "mithril cloak", "task", "quest"),
        new OrCondition(
                new QuestInStateCondition(mithrilcloak.getQuestSlot(), "need_clasp"),
                new QuestStateStartsWithCondition(mithrilcloak.getQuestSlot(), "forgingclasp;"),
                new AndCondition(new QuestInStateCondition(mithrilcloak.getQuestSlot(), "got_clasp"),
                         new NotCondition(new PlayerHasItemWithHimCondition("mithril clasp")))
                ),
        ConversationStates.ATTENDING,
        "You haven't got the clasp from #Pedinghaus yet. As soon as I have that your cloak will be finished!",       
        null);
  }
View Full Code Here

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

          }
      });
       
    npc.add(ConversationStates.ATTENDING,
        Arrays.asList("blue striped cloak", "mithril", "mithril cloak", "ida"),
        new AndCondition(new QuestInStateCondition(mithrilcloak.getQuestSlot(), "taking_striped_cloak"), new PlayerHasItemWithHimCondition("blue striped cloak")),
        ConversationStates.ATTENDING,
        "Oh that's from Ida isn't it?! Oh yay! Thank you! Please tell her thanks from me!!",
        new MultipleActions(
                   new DropItemAction("blue striped cloak"),
                   new SetQuestAction(mithrilcloak.getQuestSlot(), "gave_striped_cloak")
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, "jynath"),
          new PlayerHasItemWithHimCondition("black book")),
      ConversationStates.ATTENDING,
      "Oh, you got the book back! Phew, thanks!",
      new MultipleActions(reward));

    // There is no other way to get the book.
    // Remove that quest slot so that the player can get
    // it again from Jynath
    // As the book is both bound and useless outside the
    // quest, this is not a problem
    npc.add(
      ConversationStates.IDLE,
      ConversationPhrases.GREETING_MESSAGES,
      new AndCondition(new GreetingMatchesNameCondition(npc.getName()),
          new QuestInStateCondition(QUEST_SLOT, "jynath"),
          new NotCondition(new PlayerHasItemWithHimCondition("black book"))),
      ConversationStates.ATTENDING,
      "Haven't you got that #book back from #Jynath? Please go look for it, quickly!",
      new SetQuestAction(QUEST_SLOT, "start"));
  }
View Full Code Here

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

   
    // player is supposed to speak to mummy now
    npc.add(ConversationStates.IDLE,
        ConversationPhrases.GREETING_MESSAGES,
        new AndCondition(new GreetingMatchesNameCondition(npc.getName()),
            new QuestInStateCondition(QUEST_SLOT, "start"), new PlayerHasItemWithHimCondition("chocolate bar")),
        ConversationStates.IDLE,
        "My mum wants to know who I was asking for chocolate from now :(",
        null);
   
    // player didn't get chocolate, meanie
    npc.add(ConversationStates.IDLE,
        ConversationPhrases.GREETING_MESSAGES,
        new AndCondition(new GreetingMatchesNameCondition(npc.getName()),
            new QuestInStateCondition(QUEST_SLOT, "start"), new NotCondition(new PlayerHasItemWithHimCondition("chocolate bar"))),
        ConversationStates.ATTENDING,
        "I hope that someone will bring me some chocolate soon...:(",
        null);
   
    // player got chocolate and spoke to mummy
    npc.add(ConversationStates.IDLE,
        ConversationPhrases.GREETING_MESSAGES,
        new AndCondition(new GreetingMatchesNameCondition(npc.getName()),
            new QuestInStateCondition(QUEST_SLOT, "mummy"), new PlayerHasItemWithHimCondition("chocolate bar")),
        ConversationStates.QUESTION_1,
        "Awesome! Is that chocolate for me?",
        null);
   
    // player spoke to mummy and hasn't got chocolate
    npc.add(ConversationStates.IDLE,
        ConversationPhrases.GREETING_MESSAGES,
        new AndCondition(new GreetingMatchesNameCondition(npc.getName()),
            new QuestInStateCondition(QUEST_SLOT, "mummy"), new NotCondition(new PlayerHasItemWithHimCondition("chocolate bar"))),
        ConversationStates.ATTENDING,
        "I hope that someone will bring me some chocolate soon...:(",
        null);
   
    // player is in another state like eating
    npc.add(ConversationStates.IDLE,
        ConversationPhrases.GREETING_MESSAGES,
        new AndCondition(new GreetingMatchesNameCondition(npc.getName()),
            new QuestStartedCondition(QUEST_SLOT), new QuestNotInStateCondition(QUEST_SLOT, "start"), new QuestNotInStateCondition(QUEST_SLOT, "mummy")),
        ConversationStates.ATTENDING,
        "Hello.",
        null);
   
    // player rejected quest
    npc.add(ConversationStates.IDLE,
        ConversationPhrases.GREETING_MESSAGES,
        new AndCondition(new GreetingMatchesNameCondition(npc.getName()),
            new QuestInStateCondition(QUEST_SLOT, "rejected")),
        ConversationStates.ATTENDING,
        "Hello.",
        null);
   
    // player asks about quest for first time (or rejected)
    npc.add(ConversationStates.ATTENDING,
        ConversationPhrases.QUEST_MESSAGES,
        new QuestNotStartedCondition(QUEST_SLOT),
        ConversationStates.QUEST_OFFERED,
        "I would really love to have some chocolate. I'd like one bar, please. A dark brown one or a sweet white one or some with flakes. Will you get me one?",
        null);
   
    // shouldn't happen
    npc.add(ConversationStates.ATTENDING,
        ConversationPhrases.QUEST_MESSAGES,
        new QuestCompletedCondition(QUEST_SLOT),
        ConversationStates.ATTENDING,
        "I still enjoy the last chocolate bar you brought me, thanks!",
        null);
   
    // player can repeat quest
    npc.add(ConversationStates.ATTENDING,
        ConversationPhrases.QUEST_MESSAGES,
        new AndCondition(new QuestStateStartsWithCondition(QUEST_SLOT, "eating;"), new TimePassedCondition(QUEST_SLOT, 1, REQUIRED_MINUTES)),
        ConversationStates.QUEST_OFFERED,
        "I hope another chocolate bar wouldn't be greedy. Can you get me another one?",
        null)
   
    // player can't repeat quest
    npc.add(ConversationStates.ATTENDING,
        ConversationPhrases.QUEST_MESSAGES,
        new AndCondition(new QuestStateStartsWithCondition(QUEST_SLOT, "eating;"), new NotCondition(new TimePassedCondition(QUEST_SLOT, 1, REQUIRED_MINUTES))),
        ConversationStates.ATTENDING,
        "I've had too much chocolate. I feel sick.",
        null)
   
    // player should be bringing chocolate not asking about the quest
    npc.add(ConversationStates.ATTENDING,
        ConversationPhrases.QUEST_MESSAGES,
        new AndCondition(new QuestActiveCondition(QUEST_SLOT), new NotCondition(new QuestStateStartsWithCondition(QUEST_SLOT, "eating;"))),
        ConversationStates.ATTENDING, 
        "Waaaaaaaa! Where is my chocolate ...",
        null);
   
    // Player agrees to get the chocolate
    npc.add(ConversationStates.QUEST_OFFERED,
        ConversationPhrases.YES_MESSAGES,
        null,
        ConversationStates.ATTENDING,
        "Thank you!",
        new SetQuestAndModifyKarmaAction(QUEST_SLOT, "start", 10.0));
   
    // Player says no, they've lost karma
    npc.add(ConversationStates.QUEST_OFFERED,
        ConversationPhrases.NO_MESSAGES,
        null,
        ConversationStates.IDLE,
        "Ok, I'll wait till mommy finds some helpers...",
        new SetQuestAndModifyKarmaAction(QUEST_SLOT, "rejected", -5.0));
   
    // Player has got chocolate bar and spoken to mummy
    final List<ChatAction> reward = new LinkedList<ChatAction>();
    reward.add(new DropItemAction("chocolate bar"));
    reward.add(new ChatAction() {
      public void fire(final Player player, final Sentence sentence, final EventRaiser npc) {
        // pick a random flower
        String rewardClass = Rand.rand(Arrays.asList("daisies","zantedeschia","pansy"));
       
        final StackableItem reward = (StackableItem) SingletonRepository.getEntityManager().getItem(rewardClass);
        reward.setQuantity(1);
        player.equipOrPutOnGround(reward);
        player.notifyWorldAboutChanges();
      }
    });
    reward.add(new IncreaseXPAction(500));
    reward.add(new SetQuestAction(QUEST_SLOT, "eating;"));
    reward.add(new SetQuestToTimeStampAction(QUEST_SLOT,1));
    reward.add(new IncreaseKarmaAction(10.0));
           
    npc.add(ConversationStates.QUESTION_1,
        ConversationPhrases.YES_MESSAGES,
        new PlayerHasItemWithHimCondition("chocolate bar"),
        ConversationStates.ATTENDING,
        "Thank you EVER so much! You are very kind. Here, take a fresh flower as a present.",
        new MultipleActions(reward));
   
 
    // player did have chocolate but put it on ground after question?
    npc.add(ConversationStates.QUESTION_1,
        ConversationPhrases.YES_MESSAGES,
        new NotCondition(new PlayerHasItemWithHimCondition("chocolate bar")),
        ConversationStates.ATTENDING,
        "Hey, where's my chocolate gone?!",
        null);
   
    // Player says no, they've lost karma
View Full Code Here

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

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

    // take scissors and ask for needle now
    npc.add(ConversationStates.ATTENDING,
        Arrays.asList("scissors", "magical", "magical scissors", "mithril", "cloak", "mithril cloak", "task", "quest"),
        new AndCondition(new QuestInStateCondition(mithrilcloak.getQuestSlot(), "got_scissors"), new PlayerHasItemWithHimCondition("magical scissors")),
        ConversationStates.ATTENDING,
        "You brought those magical scissors! Excellent! Now that I can cut the fabric I need a magical needle. You can buy one from a trader in the abandoned keep of Ados mountains, #Ritati Dragon something or other. Just go to him and ask for his 'specials'.",
        new MultipleActions(
                   new DropItemAction("magical scissors"),
                   new SetQuestAndModifyKarmaAction(mithrilcloak.getQuestSlot(), "need_needle;", 10.0),
                   new IncreaseXPAction(100)
                   )
        );

    // remind about scissors
    npc.add(ConversationStates.ATTENDING,
        Arrays.asList("scissors", "magical", "magical scissors", "mithril", "cloak", "mithril cloak", "task", "quest"),
        new OrCondition(
                new QuestInStateCondition(mithrilcloak.getQuestSlot(), "need_scissors"),
                new QuestStateStartsWithCondition(mithrilcloak.getQuestSlot(), "need_eggshells;"),
                new QuestStateStartsWithCondition(mithrilcloak.getQuestSlot(), "makingscissors;"),
                new AndCondition(new QuestInStateCondition(mithrilcloak.getQuestSlot(), "got_scissors"),
                         new NotCondition(new PlayerHasItemWithHimCondition("magical scissors")))
                ),
        ConversationStates.ATTENDING,
        "Ask #Hogart about #scissors, I'm sure he will remember the messages I've sent him!",       
        null);
View Full Code Here

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

        null);

    // agrees to buy 1 needle
    npc.add(ConversationStates.QUEST_ITEM_QUESTION,
        ConversationPhrases.YES_MESSAGES,
        new PlayerHasItemWithHimCondition("money", NEEDLE_COST),
        ConversationStates.IDLE,
        "Ok, here you are. Be careful with them, they break easy. Now, get lost, you have hung around here far too long already.",       
        new MultipleActions(
          new DropItemAction("money", NEEDLE_COST),
          new EquipItemAction("magical needle", 1, true)
          ));

    // said he had money but he didn't
    npc.add(ConversationStates.QUEST_ITEM_QUESTION,
        ConversationPhrases.YES_MESSAGES,
        new NotCondition(new PlayerHasItemWithHimCondition("money", NEEDLE_COST)),
        ConversationStates.ATTENDING,
        "What the ... you don't have enough money! Get outta here!",
        null);

    // doesn't want to buy needle
View Full Code Here

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

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

    // player brings needle for first or subsequent time
    npc.add(ConversationStates.ATTENDING,
        Arrays.asList("needle", "magical needle", "magical", "mithril", "cloak", "mithril cloak", "task", "quest"),
        new AndCondition(new QuestStateStartsWithCondition(mithrilcloak.getQuestSlot(), "told_joke"), new PlayerHasItemWithHimCondition("magical needle")),
        ConversationStates.ATTENDING,
        null,
        new MultipleActions(
          new ChatAction() {
            public void fire(final Player player, final Sentence sentence, final EventRaiser npc) {
              final String[] questslot = player.getQuest(mithrilcloak.getQuestSlot()).split(";");   
              int needles = 1;
              int saidjoke = 1;
              if (questslot.length > 2) {
                // if the split works, we had stored a needle number before
                needles = Integer.parseInt(questslot[1]);
                saidjoke = Integer.parseInt(questslot[2]);
                npc.say("I'm really sorry about the previous needle breaking. I'll start work again on your cloak,"
                    + " please return in another " + REQUIRED_HOURS_SEWING + " hours.");
               } else if (questslot.length > 1) {
                // it wasn't split with a needle number, only joke
                // so this is the first time we brought a needle
                saidjoke = Integer.parseInt(questslot[1]);
                npc.say("Looks like you found Ritatty then, good. I'll start on the cloak now!"
                    + " A seamstress needs to take her time, so return in " + REQUIRED_HOURS_SEWING + " hours.");
                // ida breaks needles - she will need 1 - 3
                needles = Rand.randUniform(1, 3);
              }
              player.setQuest(mithrilcloak.getQuestSlot(), "sewing;" + System.currentTimeMillis() + ";" + needles + ";" + saidjoke);
            }
          },
          new DropItemAction("magical needle")
          )
        );

    // remind about needle
    npc.add(ConversationStates.ATTENDING,
        Arrays.asList("needle", "magical needle", "magical", "mithril", "cloak", "mithril cloak", "task", "quest"),
        new OrCondition(new QuestStateStartsWithCondition(mithrilcloak.getQuestSlot(), "need_needle"),
                new AndCondition(
                  new QuestStateStartsWithCondition(mithrilcloak.getQuestSlot(), "told_joke"),
                  new NotCondition(new PlayerHasItemWithHimCondition("magical needle"))
                )
            ),
        ConversationStates.ATTENDING,
        "Please ask Ritati thingummy for his 'specials', or just ask about a #needle.",       
        null);
View Full Code Here

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

     * 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.",
        new MultipleActions(new SetQuestAndModifyKarmaAction(QUEST_SLOT, "hair", 2.0), new DropItemAction("wood", 10)));
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.