Package games.stendhal.server.entity.npc

Examples of games.stendhal.server.entity.npc.ChatAction


  private void playerReturnsAfterGivingWhenFinished(final SpeakerNPC npc) {
    final ChatCondition condition = new AndCondition(
        new QuestStateStartsWithCondition(QUEST_SLOT, "making;"),
        new TimePassedCondition(QUEST_SLOT, 1, REQUIRED_MINUTES)
      );
    final ChatAction action = new SetQuestAction(QUEST_SLOT,"find_vera");
    npc.add(ConversationStates.IDLE, ConversationPhrases.GREETING_MESSAGES,
        new AndCondition(new GreetingMatchesNameCondition(npc.getName()), condition),
        ConversationStates.INFORMATION_1,
        "I finished the legs. But I cannot trust you. Before I give the" +
        " jewelled legs to you, I need a message from my darling. Ask Mayor" +
View Full Code Here


  //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"));
  npc.add(ConversationStates.IDLE, ConversationPhrases.GREETING_MESSAGES,
      legscondition,
View Full Code Here

  }

  private void bringFlowerToJefStep() {
    final SpeakerNPC npc = npcs.get("Jef");

    ChatAction addRandomNumberOfItemsAction = new ChatAction() {
      public void fire(final Player player, final Sentence sentence, final EventRaiser npc) {
        //add random number of red lionfish
        final StackableItem red_lionfish = (StackableItem) SingletonRepository.getEntityManager()
            .getItem("red lionfish");
        int redlionfishamount;
View Full Code Here

        // Player accepts the quest and gets to know what Wrviliza needs (switch to phase_2)
        npc.add(ConversationStates.QUEST_OFFERED,
            ConversationPhrases.YES_MESSAGES, null,
            ConversationStates.QUESTION_1, null,
            new MultipleActions(
                new ChatAction() {
                  public void fire(final Player player, final Sentence sentence, final EventRaiser raiser) {
                    int pLevel = player.getLevel();
                    player.setQuest(QUEST_SLOT, getRequiredItemsCollection(pLevel));
                  }
                },
View Full Code Here

            ConversationStates.ATTENDING,
            "Wruf! Take your time... No hurry!",
            null);

        // create the ChatAction to reward the player
        ChatAction addRewardAction = new ChatAction() {
            public void fire(final Player player, final Sentence sentence, final EventRaiser npc) {
                final StackableItem
                    koboldish_torcibud_vsop = (StackableItem)
                        SingletonRepository
                            .getEntityManager().getItem("vsop koboldish torcibud");
                final int torcibud_bottles = 1 + Rand.roll1D6();
                koboldish_torcibud_vsop.setQuantity(torcibud_bottles);
                koboldish_torcibud_vsop.setBoundTo(player.getName());
                // vsop torcibud will heal up to 75% of the player's base HP he has when getting rewarded
                // all vsop koboldish torcibud is persistent (set in the xml for this item) so this value will last
                koboldish_torcibud_vsop.put("amount", player.getBaseHP()*75/100);

                //player.equipOrPutOnGround(koboldish_torcibud_vsop);
                //put the rewarded bottles on the counter
                final IRPZone zone = SingletonRepository.getRPWorld().getZone("int_wofol_bar");
                koboldish_torcibud_vsop.setPosition(3, 3);
                zone.add(koboldish_torcibud_vsop);

                npc.say(
                    "Wrof! Here take "
                    + Integer.toString(torcibud_bottles)
                    + " bottles of my V.S.O.P. Koboldish Torcibud with my best wishes for you!");
            }
        };

        // Player collected all the items. grant the XP before handing out the torcibud
        ChatAction completeAction = new MultipleActions(
            new SetQuestAction(QUEST_SLOT, "done"),
            new SetQuestToFutureRandomTimeStampAction(QUEST_SLOT, 1, MIN_DELAY, MAX_DELAY),
            new IncreaseXPAction(XP_REWARD),
            addRewardAction);

View Full Code Here

    npc.add(ConversationStates.QUESTION_1,
        ConversationPhrases.YES_MESSAGES, null,
        ConversationStates.QUESTION_1, "Fine, what did you bring?",
        null);

    ChatAction completeAction = new MultipleActions(
                      new SetQuestAction(QUEST_SLOT, "reward"),
                      new SayTextAction("You have served me well, my crown will be the mightiest of them all!"
                      + " Go to see "+ REWARD_NPC_NAME+ " in the Wizard City to get your #reward."),
                      new IncreaseXPAction(XP_REWARD)
                      );
View Full Code Here

    final SpeakerNPC npc = npcs.get(REWARD_NPC_NAME);

    npc.add(ConversationStates.ATTENDING, "reward",
        new QuestInStateCondition(QUEST_SLOT, "reward"),
        ConversationStates.ATTENDING, null,
        new ChatAction() {
          public void fire(final Player player, final Sentence sentence, final EventRaiser entity) {
            entity.say("Oh yes, "
                  + NPC_NAME
                  + " told me to reward you well! I hope you enjoy your increased combat abilities!");
            rewardPlayer(player);
View Full Code Here

          }
        });

    ramon.add(ConversationStates.QUESTION_1,
        ConversationPhrases.YES_MESSAGES, null,
        ConversationStates.ATTENDING, null, new ChatAction() {
          public void fire(final Player player, final Sentence sentence, final EventRaiser npc) {
            dealCards(player, 1);
          }
        });

    // The player says he doesn't want to have another card.
    // Let the dealer give cards to the bank.
    ramon.add(ConversationStates.QUESTION_1,
        ConversationPhrases.NO_MESSAGES, null,
        ConversationStates.ATTENDING, null, new ChatAction() {
          public void fire(final Player player, final Sentence sentence, final EventRaiser npc) {
            playerStands = true;
            if (bankStands) {
              // Both stand. Let the dealer tell the final resul
              final String message = analyze(player);
View Full Code Here

          null);
  }

  private void bringFlowerStep() {
    final SpeakerNPC npc = npcs.get("Tywysoga");
    ChatAction addRandomNumberOfItemsAction = new ChatAction() {
      public void fire(final Player player, final Sentence sentence, final EventRaiser npc) {
        //add random number of goldbars
        final StackableItem goldbars = (StackableItem) SingletonRepository.getEntityManager()
            .getItem("gold bar");
        int goldamount;
View Full Code Here

    // player returns while quest is still active
    npc.add(ConversationStates.IDLE, ConversationPhrases.GREETING_MESSAGES,
        new AndCondition(new GreetingMatchesNameCondition(npc.getName()),
            new QuestActiveCondition(QUEST_SLOT)),
        ConversationStates.QUESTION_1, null,
        new ChatAction() {
          public void fire(final Player player, final Sentence sentence, final EventRaiser raiser) {
            raiser.say("Hi again! I still need "
              + player.getQuest(QUEST_SLOT)
              + " blue elven "
              + Grammar.plnoun(
                  MathHelper.parseInt(player.getQuest(QUEST_SLOT)),
                  "cloak") + ". Do you have any for me?");
          }
        });

    // player returns after finishing the quest
    npc.add(ConversationStates.IDLE, ConversationPhrases.GREETING_MESSAGES,
        new AndCondition(new GreetingMatchesNameCondition(npc.getName()),
            new QuestCompletedCondition(QUEST_SLOT)),
        ConversationStates.ATTENDING,
        "Welcome! Thanks again for those cloaks.", null);

    // player says he doesn't have any blue elf cloaks with him
    npc.add(ConversationStates.QUESTION_1, ConversationPhrases.NO_MESSAGES, null,
        ConversationStates.ATTENDING, "Too bad.", null);

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

TOP

Related Classes of games.stendhal.server.entity.npc.ChatAction

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.