Package games.stendhal.server.entity.npc.condition

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


        "I need #herbs for this.",
        null);
   
    npc.add(ConversationStates.ATTENDING,
        ConversationPhrases.QUEST_MESSAGES,
        new QuestInStateCondition(QUEST_SLOT,"recommended"),
        ConversationStates.ATTENDING,
        "Speak to my father, the King. I have asked him to grant you citizenship of Kalavan, " +
        "to express my gratitude to you.",
        null)
   
    npc.add(ConversationStates.ATTENDING,
        ConversationPhrases.QUEST_MESSAGES,
        new AndCondition(
            new QuestActiveCondition(QUEST_SLOT),
            new NotCondition(new QuestInStateCondition(QUEST_SLOT,"recommended"))),
        ConversationStates.ATTENDING,
        "I'm sure I asked you to do something for me, already.",
        null)

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


     * we can check the slot to see what the stored level was.
     * If the player has brought the right number of herbs, get them */
    npc.add(ConversationStates.ATTENDING, Arrays.asList("herb", "herbs"),
        new AndCondition(
            new QuestActiveCondition(QUEST_SLOT),
            new NotCondition(new QuestInStateCondition(QUEST_SLOT,"recommended"))),
        ConversationStates.ATTENDING, null,
        new ChatAction() {
          public void fire(final Player player, final Sentence sentence, final EventRaiser raiser) {
            try {
              final int level = Integer.parseInt(player.getQuest(QUEST_SLOT));
              final int required_arandula = 1
                + level / ARANDULA_DIVISOR;
              final int required_antidote = 1
                + level / ANTIDOTE_DIVISOR;
              final int required_potion = 1
                + level  / POTION_DIVISOR;
              if (player.isEquipped("kekik")
                && player.isEquipped("kokuda")
                && player.isEquipped("sclaria")
                && player.isEquipped("arandula",
                    required_arandula)
                && player.isEquipped("potion", required_potion)
                && player.isEquipped("antidote",
                    required_antidote))
              {
                player.drop("kekik");
                player.drop("kokuda");
                player.drop("sclaria");
                player.drop("antidote", required_antidote);
                player.drop("potion", required_potion);
                player.drop("arandula", required_arandula);
                raiser.say("Perfect! I will recommend you to my father, as a fine, " +
                    "helpful person. He will certainly agree you are eligible for " +
                    "citizenship of Kalavan.");
                player.addXP(level * 400);
                player.setQuest(QUEST_SLOT, "recommended");
                player.notifyWorldAboutChanges();
              } else {
                //reminder of the items to bring
                raiser.say("Shh! Don't say it till you have the "
                  + required_arandula
                  + " arandula, 1 #kokuda, 1 #sclaria, 1 #kekik, "
                  + required_potion
                  + " potions and "
                  + required_antidote
                  + " antidotes. I don't want anyone suspecting our code.");
              }
            } catch (final NumberFormatException e) {
              // Should not happen but catch the exception
              raiser.say("That's strange. I don't understand what has happened just now. " +
                  "Sorry but I'm all confused, try asking someone else for help.");
            }
          }
        });
   
    /** The player asked about herbs but he brought them already and needs to speak to the King next */
    npc.add(ConversationStates.ATTENDING,
        Arrays.asList("herb", "herbs"),
        new QuestInStateCondition(QUEST_SLOT,"recommended"),
        ConversationStates.ATTENDING,
        "The herbs you brought did a wonderful job. I told my father you can be trusted, you should " +
        "go speak with him now.",
        null);
   
View Full Code Here

    final SpeakerNPC npc = npcs.get("King Cozart");

    /** Complete the quest by speaking to King, who will return right back to idle once he rewards the player*/
    npc.add(ConversationStates.IDLE, ConversationPhrases.GREETING_MESSAGES,
      new AndCondition(new GreetingMatchesNameCondition(npc.getName()),
          new QuestInStateCondition(QUEST_SLOT, "recommended")),
      ConversationStates.IDLE,
      "Greetings! My wonderful daughter requests that I grant you citizenship of Kalavan City. Consider it done. Now, forgive me while I go back to my meal. Goodbye.",
      new MultipleActions(new IncreaseXPAction(500), new SetQuestAction(QUEST_SLOT, "done")));

    /** If you aren't in the condition to speak to him (not completed quest, or already spoke) the King will dismiss you */
 
View Full Code Here

    triggers.addAll(ConversationPhrases.FINISH_MESSAGES);
    triggers.addAll(ConversationPhrases.QUEST_MESSAGES);   
    npc.add(ConversationStates.ATTENDING,
        triggers,
        new AndCondition(
            new QuestInStateCondition(QUEST_SLOT, 0, "start"),
            new KilledForQuestCondition(QUEST_SLOT, 1)),
        ConversationStates.ATTENDING,
        "Brilliant! You killed some of these ugly creatures as I see! Hopefully they'll not return that fast or we will still not have the chance to explore some places."  + " Please take these greater potions as a reward for your help.",
        new MultipleActions(actions));

    npc.add(ConversationStates.ATTENDING,
        triggers,
        new AndCondition(
            new QuestInStateCondition(QUEST_SLOT, 0, "start"),
            new NotCondition(new KilledForQuestCondition(QUEST_SLOT, 1))),
        ConversationStates.ATTENDING,
        "Please free these lovely places on Athor from ugly #creatures!",
        null);
  }
View Full Code Here

      "He's the goldsmith in Ados. They're so short of supplies. Will you help?",
      null);

    /** Remind player about the quest */
    npc.add(ConversationStates.ATTENDING, Arrays.asList("food", "sandwich", "sandwiches"),
      new QuestInStateCondition(QUEST_SLOT, "start"),
      ConversationStates.ATTENDING,
      "#Joshua will be getting hungry! Please hurry!", null);

    npc.add(ConversationStates.ATTENDING, "Joshua",
      new QuestInStateCondition(QUEST_SLOT, "start"),
      ConversationStates.ATTENDING,
      "My brother, the goldsmith in Ados.", null);
   
    /** remind to take the sandwiches */
    npc.add(
      ConversationStates.ATTENDING, ConversationPhrases.QUEST_MESSAGES,
      new QuestInStateCondition(QUEST_SLOT, "start"),
      ConversationStates.ATTENDING,
      "Please don't forget the five #sandwiches for #Joshua!",
      null);
  }
View Full Code Here

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

    final SpeakerNPC npc = npcs.get("Xoderos");
   
    /** remind to complete the quest */
    npc.add(
      ConversationStates.ATTENDING, ConversationPhrases.QUEST_MESSAGES,
      new QuestInStateCondition(QUEST_SLOT, "joshua"),
      ConversationStates.ATTENDING,
      "I do hope #Joshua is well ....",
      null);
   
    /** Remind player about the quest */
    npc.add(ConversationStates.ATTENDING, Arrays.asList("food", "sandwich", "sandwiches"),
      new QuestInStateCondition(QUEST_SLOT, "joshua"),
      ConversationStates.ATTENDING,
      "I wish you could confirm for me that #Joshua is fine ...", null);
   
    // ideally, make it so that this slot being done means
    // you get a keyring object instead what we currently
    // have - a button in the settings panel
    final List<ChatAction> reward = new LinkedList<ChatAction>();
    reward.add(new IncreaseXPAction(50));
    reward.add(new SetQuestAction(QUEST_SLOT, "done"));
    reward.add(new EnableFeatureAction("keyring"));   
    /** Complete the quest */
    npc.add(
      ConversationStates.ATTENDING, "Joshua",
      new QuestInStateCondition(QUEST_SLOT, "joshua"),
      ConversationStates.ATTENDING,
      "I'm glad Joshua is well. Now, what can I do for you? I know, I'll fix that broken key ring that you're carrying ... there, it should work now!",
      new MultipleActions(reward));
  }
View Full Code Here

    // player returns after finishing the quest but not rewarded
    npc.add(ConversationStates.IDLE,
        ConversationPhrases.GREETING_MESSAGES,
        new AndCondition(new GreetingMatchesNameCondition(npc.getName()),
            new QuestInStateCondition(QUEST_SLOT, "done")),
        ConversationStates.ATTENDING,
        "Oh! I didn't reward you for helping me again! Here, take these boots. I think they're gorgeous but they don't fit me :(",
        new MultipleActions(new EquipItemAction("killer boots", 1, true), new SetQuestAction(QUEST_SLOT, "done;rewarded")));
 
    //     player returns after finishing the quest and was rewarded
    npc.add(ConversationStates.IDLE,
        ConversationPhrases.GREETING_MESSAGES,
        new AndCondition(new GreetingMatchesNameCondition(npc.getName()),
            new QuestInStateCondition(QUEST_SLOT, "done;rewarded")),
        ConversationStates.ATTENDING,
        "Thanks again for helping me! The cloaks look great!",
        null);
  }
View Full Code Here

      new EquipItemAction("empty scroll", 5),
      new SetHallOfFameToAgeDiffAction(QUEST_SLOT, 1, "P"),
      loadSignFromHallOfFame);
 
    npc.add(ConversationStates.ATTENDING, Arrays.asList("paper", "chase"),
        new AndCondition(new QuestInStateCondition(QUEST_SLOT, 0, "Fidorea"), new SystemPropertyCondition("stendhal.minetown")),
      ConversationStates.ATTENDING,
      "Very good. You did the complete quest, talking to all those people around the world. I will add you name to the sign for everyone to see. And here are some magic scrolls as reward. They will help you on further travels.",
      reward);
  }
View Full Code Here

    // compatibility with old quests:
    // player returns while initial quest is still active, set it to match the new way
    npc.add(ConversationStates.IDLE, ConversationPhrases.GREETING_MESSAGES,
        new AndCondition(new GreetingMatchesNameCondition(npc.getName()),
            new QuestInStateCondition(QUEST_SLOT, "start")),
        ConversationStates.QUEST_ITEM_BROUGHT,
        "Welcome back! Have you brought the "
            + Grammar.quantityplnoun(REQUIRED_HAM, "ham", "") + "?",
      new SetQuestAction(QUEST_SLOT,"start;ham=10"));
View Full Code Here

TOP

Related Classes of games.stendhal.server.entity.npc.condition.QuestInStateCondition

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.