Examples of PlayerHasItemWithHimCondition


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

    triggers.addAll(ConversationPhrases.QUEST_MESSAGES);

    // player asks about quest or says coal when they are supposed to bring some coal and they have it
    npc.add(
        ConversationStates.ATTENDING, triggers,
        new AndCondition(new QuestInStateCondition(QUEST_SLOT, "start"), new PlayerHasItemWithHimCondition("coal",25)),
        ConversationStates.ATTENDING,
        null,
        new MultipleActions(
            new DropItemAction("coal",25),
            new ChatAction() {
              public void fire(final Player player,
                  final Sentence sentence,
                  final EventRaiser npc) {
                int grilledsteakAmount = Rand.rand(4) + 1;
                new EquipItemAction("grilled steak", grilledsteakAmount, true).fire(player, sentence, npc);
                npc.say("Thank you!! Take " + Grammar.thisthese(grilledsteakAmount) + " " +
                    Grammar.quantityNumberStrNoun(grilledsteakAmount, "grilled steak") + " from my grill!");
                new SetQuestAndModifyKarmaAction(getSlotName(), "waiting;"
                    + System.currentTimeMillis(), 10.0).fire(player, sentence, npc);
              }
            }));

    // player asks about quest or says coal when they are supposed to bring some coal and they don't have it
    npc.add(
        ConversationStates.ATTENDING, triggers,
        new AndCondition(new QuestInStateCondition(QUEST_SLOT, "start"), new NotCondition(new PlayerHasItemWithHimCondition("coal",25))),
        ConversationStates.ATTENDING,
        "You don't have the coal amount which I need yet. Go and pick some more pieces up, please.",
        null);
   
    npc.add(
View Full Code Here

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

      }
    };
    npc.add(ConversationStates.ATTENDING,
        Arrays.asList("flower", "zantedeschia", "fine", "amber", "done"),
        new AndCondition(new QuestInStateCondition(QUEST_SLOT, 0, "found_mom"), new PlayerHasItemWithHimCondition("zantedeschia")),
        ConversationStates.ATTENDING, null,
        new MultipleActions(new DropItemAction("zantedeschia"),
                                    new IncreaseXPAction(5000),
                                    new IncreaseKarmaAction(15),
                  addRandomNumberOfItemsAction,                      
View Full Code Here

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

        null);

    npc.add(ConversationStates.IDLE, ConversationPhrases.GREETING_MESSAGES,
        new AndCondition(new GreetingMatchesNameCondition(npc.getName()),
            new QuestNotCompletedCondition(QUEST_SLOT),
            new NotCondition(new PlayerHasItemWithHimCondition("kanmararn prison key"))),
        ConversationStates.IDLE,
        "Help! The duergars have raided the prison and locked me up! I'm supposed to be the Guard! It's a shambles.",
        new SetQuestAction(QUEST_SLOT, "start"));

    npc.add(ConversationStates.IDLE, ConversationPhrases.GREETING_MESSAGES,
        new AndCondition(new GreetingMatchesNameCondition(npc.getName()),
            new QuestNotCompletedCondition(QUEST_SLOT),
            new PlayerHasItemWithHimCondition("kanmararn prison key")),
        ConversationStates.ATTENDING,
        "You got the key to unlock me! *mumble*  Errrr ... it doesn't look too safe out there for me ... I think I'll just stay here ... perhaps someone could #offer me some good equipment ... ",
        new MultipleActions(new SetQuestAction(QUEST_SLOT, "done"),
                    new IncreaseXPAction(2000)));
  }
View Full Code Here

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

    // player says he has a blue elf cloak with him but he needs to bring more than one still
    // could also have used GreaterThanCondition for Quest State but this is okay, note we can only get to question 1 if we were active
    npc.add(ConversationStates.QUESTION_1,
        ConversationPhrases.YES_MESSAGES,
        new AndCondition(new QuestNotInStateCondition(QUEST_SLOT, "1"), new PlayerHasItemWithHimCondition("blue elf cloak")),
        ConversationStates.QUESTION_1, null,
        new MultipleActions(
            new DropItemAction("blue elf cloak"),
            new ChatAction() {
              public void fire(final Player player, final Sentence sentence, final EventRaiser raiser) {
                // find out how many cloaks the player still has to
                // bring. incase something has gone wrong and we can't parse the slot, assume it was just started
                final int toBring = MathHelper.parseIntDefault(player.getQuest(QUEST_SLOT),  REQUIRED_CLOAKS) -1;

                player.setQuest(QUEST_SLOT,
                    Integer.toString(toBring));
                raiser.say("Thank you very much! Do you have another one? I still need "
                    + Grammar.quantityplnoun(toBring,
                        "cloak", "one") + ".");

              }
            }));
   
    // player says he has a blue elf cloak with him and it's the last one
    final List<ChatAction> reward = new LinkedList<ChatAction>();
    reward.add(new DropItemAction("blue elf cloak"));
    reward.add(new EquipItemAction("golden shield", 1, true));
    reward.add(new IncreaseXPAction(15000));
    reward.add(new SetQuestAction(QUEST_SLOT, "done"));
    reward.add(new IncreaseKarmaAction(25));
    npc.add(ConversationStates.QUESTION_1,
        ConversationPhrases.YES_MESSAGES,
        new AndCondition(new QuestInStateCondition(QUEST_SLOT, "1"), new PlayerHasItemWithHimCondition("blue elf cloak")),
        ConversationStates.ATTENDING,
        "Thank you very much! Now I have enough cloaks to survive the winter. Here, take this golden shield as a reward.",
        new MultipleActions(reward));
   
    npc.add(ConversationStates.QUESTION_1,
        ConversationPhrases.YES_MESSAGES,
        new NotCondition(new PlayerHasItemWithHimCondition("blue elf cloak")),
        ConversationStates.ATTENDING,
        "Really? I don't see any...",
        null);
  }
View Full Code Here

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

    reward.add(new IncreaseKarmaAction(10));
   
    npc.add(ConversationStates.IDLE, ConversationPhrases.GREETING_MESSAGES,
        new AndCondition(new GreetingMatchesNameCondition(getName()),
            new QuestInStateCondition(QUEST_SLOT, "lorithien"),
            new PlayerHasItemWithHimCondition("gold bar", GOLD_AMOUNT)),
        ConversationStates.ATTENDING,
        "Oh, you brought the gold! Wonderful, I knew I could rely on you. Please, have this key to our customer room.",
        new MultipleActions(reward));
   
    npc.add(ConversationStates.IDLE, ConversationPhrases.GREETING_MESSAGES,
        new AndCondition(new GreetingMatchesNameCondition(getName()),
            new QuestInStateCondition(QUEST_SLOT, "lorithien"),
            new NotCondition(new PlayerHasItemWithHimCondition("gold bar", GOLD_AMOUNT))),
        ConversationStates.ATTENDING,
        "Haven't you got the gold bars from #Lorithien yet? Please go get them, quickly!",
        null);
  }
View Full Code Here

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

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

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

    /** If player has quest and has brought the food, ask for it */
    npc.add(
      ConversationStates.ATTENDING,
      Arrays.asList("food", "sandwich", "sandwiches"),
      new AndCondition(new QuestInStateCondition(QUEST_SLOT, "start"), new PlayerHasItemWithHimCondition("sandwich", FOOD_AMOUNT)),
      ConversationStates.QUEST_ITEM_BROUGHT,
      "Oh great! Did my brother Xoderos send you with those sandwiches?",
      null);

    final List<ChatAction> reward = new LinkedList<ChatAction>();
    reward.add(new DropItemAction("sandwich", FOOD_AMOUNT));
    reward.add(new IncreaseXPAction(150));
    reward.add(new SetQuestAction(QUEST_SLOT, "joshua"));
    reward.add(new IncreaseKarmaAction(15));

    npc.add(ConversationStates.QUEST_ITEM_BROUGHT,
      ConversationPhrases.YES_MESSAGES,
      new PlayerHasItemWithHimCondition("sandwich", FOOD_AMOUNT),
      ConversationStates.ATTENDING,
      "Thank you! Please let Xoderos know that I am fine. Say my name, Joshua, so he knows that you saw me. He will probably give you something in return.",
      new MultipleActions(reward));

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

    npc.add(ConversationStates.QUEST_ITEM_BROUGHT,
      ConversationPhrases.NO_MESSAGES, null,
      ConversationStates.QUEST_ITEM_BROUGHT,
View Full Code Here

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

            }
        });
       
        add(ConversationStates.BUY_PRICE_OFFERED,
          ConversationPhrases.YES_MESSAGES,
          new NotCondition(new PlayerHasItemWithHimCondition("money", MONEY)),
          ConversationStates.ATTENDING,
          "Sorry, you do not have enough money", null);

        add(ConversationStates.BUY_PRICE_OFFERED,
          ConversationPhrases.YES_MESSAGES,
          new PlayerHasItemWithHimCondition("money", MONEY),
          ConversationStates.IDLE, null,
          new RentSignChatAction());

        add(ConversationStates.BUY_PRICE_OFFERED,
          ConversationPhrases.NO_MESSAGES, null,
View Full Code Here

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

        player.equipOrPutOnGround(water);
      }
    });
    waterNPC.add(ConversationStates.ATTENDING,
          Arrays.asList("water", "clean", "check"),
          new PlayerHasItemWithHimCondition("water"),
          ConversationStates.ATTENDING,
          "That water looks clean to me! It must be from a pure source.",
          // take the item and give them a new one with an infostring or mark all?
          new MultipleActions(actions));
   
    // player asks about water but doesn't have it with them
    waterNPC.add(ConversationStates.ATTENDING,
          Arrays.asList("water", "clean", "check"),
          new NotCondition(new PlayerHasItemWithHimCondition("water")),
          ConversationStates.ATTENDING,
          "You can gather water from natural mountain springs or bigger springs like next to waterfalls. If you bring it to me I can check the purity for you.",
          null);

  }
View Full Code Here

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

        // player returns with no water at all.
    npc.add(ConversationStates.ATTENDING,
        ConversationPhrases.combine(ConversationPhrases.QUEST_MESSAGES, EXTRA_TRIGGER),
        new AndCondition(
            new QuestActiveCondition(QUEST_SLOT),
            new NotCondition(new PlayerHasItemWithHimCondition("water"))),
        ConversationStates.ATTENDING,
        "I'm waiting for you to bring me some drinking water, this sun is so hot.",
        null);
   
        // add the other possibilities
    npc.add(ConversationStates.ATTENDING,
        ConversationPhrases.combine(ConversationPhrases.QUEST_MESSAGES, EXTRA_TRIGGER),
        new AndCondition(
            new QuestActiveCondition(QUEST_SLOT),
            new PlayerHasItemWithHimCondition("water"),
            new NotCondition(new PlayerHasInfostringItemWithHimCondition("water", CLEAN_WATER_INFOSTRING))),
        ConversationStates.ATTENDING,
        "Hmm... it's not that I don't trust you, but I'm not sure that water is okay to drink. Could you go and ask #Stefan to #check it please?",
        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.