Examples of PlayerHasItemWithHimCondition


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

   
    // Player returned with goblet and had killed the vampire lord, and has iron, so offer to forge the sword.
    npc.add(ConversationStates.IDLE, ConversationPhrases.GREETING_MESSAGES,
        new AndCondition(new GreetingMatchesNameCondition(npc.getName()),
          new QuestInStateCondition(QUEST_SLOT,"start"),
          new PlayerHasItemWithHimCondition("goblet"),
          new KilledCondition("vampire lord"),
          new PlayerHasItemWithHimCondition("iron", REQUIRED_IRON)),
      ConversationStates.IDLE,
      "You've brought everything I need to make the vampire sword. Come back in "
      + REQUIRED_MINUTES
      + " minutes and it will be ready",
      new MultipleActions(startforging));

    // Player returned with goblet and had killed the vampire lord, so offer to forge the sword if iron is brought
    npc.add(ConversationStates.IDLE, ConversationPhrases.GREETING_MESSAGES,
        new AndCondition(new GreetingMatchesNameCondition(npc.getName()),
            new QuestInStateCondition(QUEST_SLOT,"start"),
            new PlayerHasItemWithHimCondition("goblet"),
            new KilledCondition("vampire lord"),
            new NotCondition(new PlayerHasItemWithHimCondition("iron", REQUIRED_IRON))),
    ConversationStates.QUEST_ITEM_BROUGHT,
    "You have battled hard to bring that goblet. I will use it to #forge the vampire sword",
    null);
   
    // Player has only an empty goblet currently, remind to go to Catacombs
    npc.add(ConversationStates.IDLE, ConversationPhrases.GREETING_MESSAGES,
        new AndCondition(new GreetingMatchesNameCondition(npc.getName()),
          new QuestInStateCondition(QUEST_SLOT,"start"),
          new PlayerHasItemWithHimCondition("empty goblet"),
          new NotCondition(new PlayerHasItemWithHimCondition("goblet"))),
      ConversationStates.IDLE,
      "Did you lose your way? The Catacombs are in North Semos. Don't come back without a " +
      "full goblet! Bye!",
      null);
   
    // Player has a goblet (somehow) but did not kill a vampire lord
    npc.add(ConversationStates.IDLE, ConversationPhrases.GREETING_MESSAGES,
        new AndCondition(new GreetingMatchesNameCondition(npc.getName()),
            new QuestInStateCondition(QUEST_SLOT,"start"),
            new PlayerHasItemWithHimCondition("goblet"),
            new NotCondition(new KilledCondition("vampire lord"))),
    ConversationStates.IDLE,
    "Hm, that goblet is not filled with vampire blood; it can't be, you have not killed the vampire lord. You must slay him.",
    null);
   
    // Player lost the empty goblet?
    npc.add(ConversationStates.IDLE, ConversationPhrases.GREETING_MESSAGES,
        new AndCondition(new GreetingMatchesNameCondition(npc.getName()),
            new QuestInStateCondition(QUEST_SLOT,"start"),
            new NotCondition(new PlayerHasItemWithHimCondition("empty goblet")),
            new NotCondition(new PlayerHasItemWithHimCondition("goblet"))),
      ConversationStates.QUESTION_1,
      "I hope you didn't lose your goblet! Do you need another?",
      null);

    // Player lost the empty goblet, wants another
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("icecream")),
        ConversationStates.IDLE,
        "Mummy says I mustn't talk to you any more. You're a stranger.",
        null);
   
    // player didn't get ice cream, meanie
    npc.add(ConversationStates.IDLE,
        ConversationPhrases.GREETING_MESSAGES,
        new AndCondition(new GreetingMatchesNameCondition(npc.getName()),
            new QuestInStateCondition(QUEST_SLOT, "start"),
            new NotCondition(new PlayerHasItemWithHimCondition("icecream"))),
        ConversationStates.ATTENDING,
        "Hello. I'm hungry.",
        null);
   
    // player got ice cream and spoke to mummy
    npc.add(ConversationStates.IDLE,
        ConversationPhrases.GREETING_MESSAGES,
        new AndCondition(new GreetingMatchesNameCondition(npc.getName()),
            new QuestInStateCondition(QUEST_SLOT, "mummy"),
            new PlayerHasItemWithHimCondition("icecream")),
        ConversationStates.QUESTION_1,
        "Yummy! Is that ice cream for me?",
        null);
   
    // player spoke to mummy and hasn't got ice cream
    npc.add(ConversationStates.IDLE,
        ConversationPhrases.GREETING_MESSAGES,
        new AndCondition(new GreetingMatchesNameCondition(npc.getName()),
            new QuestInStateCondition(QUEST_SLOT, "mummy"),
            new NotCondition(new PlayerHasItemWithHimCondition("icecream"))),
        ConversationStates.ATTENDING,
        "Hello. I'm hungry.",
        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'm hungry! I'd like an ice cream, please. Vanilla, with a chocolate flake. Will you get me one?",
        null);
   
    // shouldn't happen
    npc.add(ConversationStates.ATTENDING,
        ConversationPhrases.QUEST_MESSAGES,
        new QuestCompletedCondition(QUEST_SLOT),
        ConversationStates.ATTENDING,
        "I'm full up now thank you!",
        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 ice cream wouldn't be greedy. Can you get me 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 ice cream. I feel sick.",
        null)
   
    // player should be bringing ice cream 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 ice cream ....",
        null);
   
    // Player agrees to get the ice cream
    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 ask my mummy instead.",
        new SetQuestAndModifyKarmaAction(QUEST_SLOT, "rejected", -5.0));
   
    // Player has got ice cream and spoken to mummy
    final List<ChatAction> reward = new LinkedList<ChatAction>();
    reward.add(new DropItemAction("icecream"));
    reward.add(new EquipItemAction("present"));
    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("icecream"),
        ConversationStates.ATTENDING,
        "Thank you EVER so much! You are very kind. Here, take this present.",
        new MultipleActions(reward));
   
    // player did have ice cream but put it on ground after question?
    npc.add(ConversationStates.QUESTION_1,
        ConversationPhrases.YES_MESSAGES,
        new NotCondition(new PlayerHasItemWithHimCondition("icecream")),
        ConversationStates.ATTENDING,
        "Hey, where's my ice cream gone?!",
        null);
   
    // Player says no, they've lost karma
View Full Code Here

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

 
  private void playerReturnsAfterKillingTheImperialScientist(SpeakerNPC npc) {
    final ChatCondition condition = new AndCondition(
        new QuestStateStartsWithCondition(QUEST_SLOT, "kill_scientist"),
        new KilledForQuestCondition(QUEST_SLOT, 1),
        new PlayerHasItemWithHimCondition("goblet")
      );
    ChatAction action = new MultipleActions(
                    new SetQuestAction(QUEST_SLOT, "decorating;"),
                    new SetQuestToTimeStampAction(QUEST_SLOT, 1),
                    new DropItemAction("goblet",1)
View Full Code Here

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

        new GreetingMatchesNameCondition(npc.getName()),
        new QuestStateStartsWithCondition(QUEST_SLOT, "kill_scientist"),
        new NotCondition(
            new AndCondition(
                    new KilledForQuestCondition(QUEST_SLOT, 1),
                    new PlayerHasItemWithHimCondition("goblet")))
      );
    npc.add(ConversationStates.IDLE, ConversationPhrases.GREETING_MESSAGES,
        condition, ConversationStates.IDLE,
        "I am only in pain. Kill my brother and bring me his blood. It's all I want now.",
        null);
View Full Code Here

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

  }
 
  private void playerReturnsWithLetter(final SpeakerNPC npc) {
    final ChatCondition condition = new AndCondition(
        new QuestStateStartsWithCondition(QUEST_SLOT, "find_vera"),
        new PlayerHasItemWithHimCondition("note")
      );
   
    final ChatAction action = new MultipleActions(
          new SetQuestAction(QUEST_SLOT, 0, "kill_scientist"),
          new StartRecordingKillsAction(QUEST_SLOT, 1, "Sergej Elos", 0, 1),
View Full Code Here

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

  }
 
  private void playerReturnsWithoutLetter(final SpeakerNPC npc) {
    final ChatCondition condition = new AndCondition(new GreetingMatchesNameCondition(npc.getName()),
        new QuestStateStartsWithCondition(QUEST_SLOT, "find_vera"),
        new NotCondition(new PlayerHasItemWithHimCondition("note"))
      );
    npc.add(ConversationStates.IDLE, ConversationPhrases.GREETING_MESSAGES,
        condition,
        ConversationStates.IDLE,
        "Please ask Mayor Sakhs about my wife Vera.",
View Full Code Here

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

 
  private void playerReturnsAfterRequestForLegs(final SpeakerNPC npc) {
  //player returns without legs
  final AndCondition nolegscondition = new AndCondition(new GreetingMatchesNameCondition(npc.getName()),
                  new QuestInStateCondition(QUEST_SLOT, "legs"),
                  new NotCondition(new PlayerHasItemWithHimCondition("shadow legs"))
                  );
  npc.add(ConversationStates.IDLE, ConversationPhrases.GREETING_MESSAGES,
      nolegscondition,
      ConversationStates.IDLE,
      "Hello again. Please return when you have the shadow legs, a base for me to add jewels to make jewelled legs for Vera.",
      null);   
   
  //player returns with legs
  final AndCondition legscondition = new AndCondition(new GreetingMatchesNameCondition(npc.getName()),
                new QuestInStateCondition(QUEST_SLOT, "legs"),
                new PlayerHasItemWithHimCondition("shadow legs")
                );
  final ChatAction action = new MultipleActions(
  new SetQuestAction(QUEST_SLOT,"making;"),
  new SetQuestToTimeStampAction(QUEST_SLOT, 1),
  new DropItemAction("shadow legs"));
View Full Code Here

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

  }

  void fixRingStep(final SpeakerNPC npc) {

    npc.add(ConversationStates.ATTENDING, Arrays.asList("emerald ring", "life", "emerald"),
      new AndCondition(new PlayerHasItemWithHimCondition("emerald ring"),
                   new NotCondition(new QuestStateStartsWithCondition(QUEST_SLOT, FORGING))),
      ConversationStates.QUEST_ITEM_BROUGHT,
      null,
      new ChatAction() {
        public void fire(final Player player, final Sentence sentence, final EventRaiser npc) {
          final RingOfLife emeraldRing = (RingOfLife) player.getFirstEquipped("emerald ring");
         
            if (emeraldRing.isBroken()) {
              npc.say("What a pity, your emerald ring is broken. I can fix it, for a #price.");
            } else {
              // ring is not broken so he just lets player know
              // where it can be fixed
              npc.say("I see you already have an emerald ring. If it gets broken, you can come to me to fix it.");
              npc.setCurrentState(ConversationStates.ATTENDING);
            }
         
        }
      });
   
    npc.add(ConversationStates.ATTENDING,
        Arrays.asList("emerald ring", "life", "emerald"),
        new AndCondition(new NotCondition(new PlayerHasItemWithHimCondition("emerald ring")),
                 new NotCondition(new QuestStateStartsWithCondition(QUEST_SLOT, FORGING))),

        ConversationStates.ATTENDING,
        "It is difficult to get the ring of life. Do a favour for a powerful elf in Nal'wor and you may receive one as a reward."
        , null);
 
    npc.add(ConversationStates.ATTENDING,
        Arrays.asList("emerald ring", "life", "emerald"),
        new AndCondition(new QuestStateStartsWithCondition(QUEST_SLOT, FORGING),
            new NotCondition(new QuestStateStartsWithCondition(QUEST_SLOT, FORGING + "unbound")),
            new TimePassedCondition(QUEST_SLOT,1,REQUIRED_MINUTES)),
        ConversationStates.ATTENDING,
        "I'm pleased to say, your ring of life is fixed! It's good as new now.",
        new MultipleActions(
            new IncreaseXPAction(500),
            new SetQuestAction(QUEST_SLOT, "done"),
            new EquipItemAction("emerald ring", 1, true)));
   
    npc.add(ConversationStates.ATTENDING,
        Arrays.asList("emerald ring", "life", "emerald"),
        new AndCondition(new QuestStateStartsWithCondition(QUEST_SLOT, FORGING),
            new QuestStateStartsWithCondition(QUEST_SLOT, FORGING + "unbound"),
            new TimePassedCondition(QUEST_SLOT,1,REQUIRED_MINUTES)),
        ConversationStates.ATTENDING,
        "I'm pleased to say, your ring of life is fixed! It's good as new now.",
        new MultipleActions(
            new IncreaseXPAction(500),
            new SetQuestAction(QUEST_SLOT, "done"),
            new EquipItemAction("emerald ring", 1, false)));

    npc.add(ConversationStates.ATTENDING,
        Arrays.asList("emerald ring", "life", "emerald"),
        new AndCondition(new QuestStateStartsWithCondition(QUEST_SLOT, FORGING),
            new NotCondition(new TimePassedCondition(QUEST_SLOT,1,REQUIRED_MINUTES))),
        ConversationStates.IDLE, null,
        new SayTimeRemainingAction(QUEST_SLOT,1, REQUIRED_MINUTES,"I haven't finished fixing your ring of life. Please check back in"));
   
   
    npc.add(ConversationStates.QUEST_ITEM_BROUGHT,
        "price",
        null,
        ConversationStates.QUEST_ITEM_BROUGHT,
        "The charge for my service is " + REQUIRED_MONEY
          + " money, and I need " + REQUIRED_GOLD
          + " gold bars and " + REQUIRED_GEM
          + " emerald to fix the ring. Do you want to pay now?",
        null);

    npc.add(ConversationStates.QUEST_ITEM_BROUGHT,
        ConversationPhrases.YES_MESSAGES,
        new AndCondition(
            new PlayerHasItemWithHimCondition("gold bar", REQUIRED_GOLD),
            new PlayerHasItemWithHimCondition("money", REQUIRED_MONEY),
            new PlayerHasItemWithHimCondition("emerald", REQUIRED_GEM)),
        ConversationStates.IDLE,
        "Okay, that's all I need to fix the ring. Come back in "
            + REQUIRED_MINUTES
            + " minutes and it will be ready. Bye for now.",
        new MultipleActions(
            new DropItemAction("gold bar", REQUIRED_GOLD),
            new DropItemAction("emerald", REQUIRED_GEM),
            new DropItemAction("money", REQUIRED_MONEY),
            new ChatAction() {
              public void fire(final Player player,
                  final Sentence sentence,
                  final EventRaiser npc) {
                final RingOfLife emeraldRing = (RingOfLife) player.getFirstEquipped("emerald ring");
                if (player.isBoundTo(emeraldRing)) {
                  player.setQuest(QUEST_SLOT, "forging;"
                      + System.currentTimeMillis());
                } else {
                  player.setQuest(QUEST_SLOT, "forgingunbound;"
                      + System.currentTimeMillis());
                }

              }
            },
            new DropItemAction("emerald ring")));
   
    npc.add(ConversationStates.QUEST_ITEM_BROUGHT,
        ConversationPhrases.YES_MESSAGES,
        new NotCondition(new  AndCondition(
            new PlayerHasItemWithHimCondition("gold bar", REQUIRED_GOLD),
            new PlayerHasItemWithHimCondition("money", REQUIRED_MONEY),
            new PlayerHasItemWithHimCondition("emerald", REQUIRED_GEM))),
        ConversationStates.IDLE,
        "Come back when you have the money, the gem and the gold. Goodbye.",
        null);

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

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

    // says hi - got the snow yeti asked for
    npc.add(ConversationStates.IDLE,
        ConversationPhrases.GREETING_MESSAGES,
        new AndCondition(new GreetingMatchesNameCondition(npc.getName()),
            new QuestInStateCondition(QUEST_SLOT, "start"),
            new PlayerHasItemWithHimCondition("snowball", REQUIRED_SNOWBALLS)),
        ConversationStates.QUEST_ITEM_BROUGHT,
        "Greetings stranger! I see you have the snow I asked for. Are these snowballs for me?",
        null);

    // says hi - didn't get the snow yeti asked for
    npc.add(ConversationStates.IDLE,
        ConversationPhrases.GREETING_MESSAGES,
        new AndCondition(new GreetingMatchesNameCondition(npc.getName()),
            new QuestInStateCondition(QUEST_SLOT, "start"),
            new NotCondition(new PlayerHasItemWithHimCondition("snowball", REQUIRED_SNOWBALLS))),
        ConversationStates.ATTENDING,
        "You're back already? Don't forget that you promised to collect a bunch of snowballs for me!",
        null);
   
    // says hi - quest was done before and is now repeatable
View Full Code Here

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

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

    npc.add(ConversationStates.QUEST_ITEM_BROUGHT,
      ConversationPhrases.YES_MESSAGES,
      new NotCondition(new PlayerHasItemWithHimCondition("snowball", REQUIRED_SNOWBALLS)),
      ConversationStates.ATTENDING,
      "Hey! Where did you put the snowballs?",
      null);

    npc.add(
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.