Examples of SpeakerNPC


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

   * Tests for hiAndBye.
   */
  @Test
  public void testHiAndBye() {
   
    final SpeakerNPC npc = getNPC("Erna");
    final Engine en = npc.getEngine();
   
    en.step(player, "hi");
    assertTrue(npc.isTalking());
    assertEquals(
        "Welcome to the Semos bakery! We'll #bake fine bread for anyone who helps bring our #flour delivery from the mill.",
        getReply(npc));
    en.step(player, "bye");
    assertFalse(npc.isTalking());
    assertEquals("Bye.", getReply(npc));
  }
View Full Code Here

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

  /**
   * Tests for hiAndMakeNoStuff.
   */
  @Test
  public void testHiAndMakeNoStuff() {
    final SpeakerNPC npc = getNPC("Erna");
    final Engine en = npc.getEngine();
   
    en.step(player, "hi");
    assertTrue(npc.isTalking());
    assertEquals(
        "Welcome to the Semos bakery! We'll #bake fine bread for anyone who helps bring our #flour delivery from the mill.",
        getReply(npc));
    en.step(player, "make");
    assertTrue(npc.isTalking());
    assertEquals(
        "I can only bake a loaf of bread if you bring me 2 #'sacks of flour'.",
        getReply(npc));
    en.step(player, "bye");
    assertFalse(npc.isTalking());
    assertEquals("Bye.", getReply(npc));
  }
View Full Code Here

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

  /**
   * Tests for baking a single bread.
   */
  @Test
  public void testBakeSingleBread() {
    final SpeakerNPC npc = getNPC("Erna");
    final Engine en = npc.getEngine();
   
    en.step(player, "hi");
    assertTrue(npc.isTalking());
    assertEquals(
        "Welcome to the Semos bakery! We'll #bake fine bread for anyone who helps bring our #flour delivery from the mill.",
        getReply(npc));
    final StackableItem flour = new StackableItem("flour", "", "", null);
    flour.setQuantity(2);
    flour.setID(new ID(2, ZONE_NAME));
    player.getSlot("bag").add(flour);
    assertEquals(2, player.getNumberOfEquipped("flour"));

    en.step(player, "make");
    assertTrue(npc.isTalking());
    assertEquals(
        "I need you to fetch me 2 #'sacks of flour' for this job. Do you have it?",
        getReply(npc));
    en.step(player, "yes");
    final String[] questStatus = player.getQuest(QUEST1).split(";");
    final String[] expected = { "1", "bread", "" };
    assertEquals("amount", expected[0], questStatus[0]);
    assertEquals("item", expected[1], questStatus[1]);

    assertTrue(npc.isTalking());
    assertEquals(
        "OK, I will bake a loaf of bread for you, but that will take some time. Please come back in 10 minutes.",
        getReply(npc));
    assertEquals(0, player.getNumberOfEquipped("flour"));
    assertEquals(0, player.getNumberOfEquipped("bread"));
    en.step(player, "bye");
    assertFalse(npc.isTalking());
    player.setQuest(QUEST1, "1;;0");

    en.step(player, "hi");
    assertEquals(
        "Welcome back! I'm done with your order. Here you have the loaf of bread.",
View Full Code Here

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

  /**
   * Tests for baking multiple breads.
   */
  @Test
  public void testBakeMultipleBreads() {
    final SpeakerNPC npc = getNPC("Erna");
    final Engine en = npc.getEngine();
   
    en.step(player, "hi");
    assertTrue(npc.isTalking());
    assertEquals(
        "Welcome to the Semos bakery! We'll #bake fine bread for anyone who helps bring our #flour delivery from the mill.",
        getReply(npc));
    final StackableItem flour = new StackableItem("flour", "", "", null);
    flour.setQuantity(4);
    flour.setID(new ID(2, ZONE_NAME));
    player.getSlot("bag").add(flour);
    assertEquals(4, player.getNumberOfEquipped("flour"));

    en.step(player, "make 2 breads");
    assertTrue(npc.isTalking());
    assertEquals(
        "I need you to fetch me 4 #'sacks of flour' for this job. Do you have it?",
        getReply(npc));
    en.step(player, "yes");
    final String[] questStatus = player.getQuest(QUEST1).split(";");
    final String[] expected = { "2", "bread", "" };
    assertEquals("amount", expected[0], questStatus[0]);
    assertEquals("item", expected[1], questStatus[1]);

    assertTrue(npc.isTalking());
    assertEquals(
        "OK, I will bake 2 loaves of bread for you, but that will take some time. Please come back in 20 minutes.",
        getReply(npc));
    assertEquals(0, player.getNumberOfEquipped("flour"));
    assertEquals(0, player.getNumberOfEquipped("bread"));
    en.step(player, "bye");
    assertFalse(npc.isTalking());
    player.setQuest(QUEST1, "2;;0");

    en.step(player, "hi");
    assertEquals(
        "Welcome back! I'm done with your order. Here you have 2 loaves of bread.",
View Full Code Here

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

  /**
   * Tests for baking multiple breads without naming them.
   */
  @Test
  public void testBakeMultipleWithoutName() {
    final SpeakerNPC npc = getNPC("Erna");
    final Engine en = npc.getEngine();
   
    en.step(player, "hi");
    assertTrue(npc.isTalking());
    assertEquals(
        "Welcome to the Semos bakery! We'll #bake fine bread for anyone who helps bring our #flour delivery from the mill.",
        getReply(npc));
    final StackableItem flour = new StackableItem("flour", "", "", null);
    flour.setQuantity(6);
    flour.setID(new ID(2, ZONE_NAME));
    player.getSlot("bag").add(flour);
    assertEquals(6, player.getNumberOfEquipped("flour"));

    en.step(player, "make 3");
    assertTrue(npc.isTalking());
    assertEquals(
        "I need you to fetch me 6 #'sacks of flour' for this job. Do you have it?",
        getReply(npc));
    en.step(player, "yes");
    final String[] questStatus = player.getQuest(QUEST1).split(";");
    final String[] expected = { "3", "bread", "" };
    assertEquals("amount", expected[0], questStatus[0]);
    assertEquals("item", expected[1], questStatus[1]);

    assertTrue(npc.isTalking());
    assertEquals(
        "OK, I will bake 3 loaves of bread for you, but that will take some time. Please come back in 30 minutes.",
        getReply(npc));
    assertEquals(0, player.getNumberOfEquipped("flour"));
    assertEquals(0, player.getNumberOfEquipped("bread"));
    en.step(player, "bye");
    assertFalse(npc.isTalking());
    player.setQuest(QUEST1, "3;;0");

    en.step(player, "hi");
    assertEquals(
        "Welcome back! I'm done with your order. Here you have 3 loaves of bread.",
View Full Code Here

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

  /**
   * Tests for borrowing the sugar mill.
   */
  @Test
  public void testBorrowSugarMill() {
    final SpeakerNPC npc = getNPC("Erna");
    final Engine en = npc.getEngine();
   
    en.step(player, "hi");
    assertTrue(npc.isTalking());
    assertEquals(
        "Welcome to the Semos bakery! We'll #bake fine bread for anyone who helps bring our #flour delivery from the mill.",
        getReply(npc));

    en.step(player, "borrow");
    assertTrue(npc.isTalking());
    assertEquals(
        "Oh sorry, I don't lend equipment to people with so little experience as you.",
        getReply(npc));

    // level up
    player.setLevel(10);
    en.step(player, "borrow");
    assertTrue(npc.isTalking());
    assertEquals(
        "You'll have to speak to Leander and ask if you can help with the pizza before I'm allowed to lend you anything.",
        getReply(npc));

    player.setQuest("pizza_delivery", "done");
    en.step(player, "borrow");
    assertTrue(npc.isTalking());
    assertEquals(
        "I lend out #'sugar mill' and #'pestle and mortar'. If you're interested, please say which you want.",
        getReply(npc));

    en.step(player, "sugar mill");
    assertTrue(npc.isTalking());
    assertEquals(
        "Here you are! Don't forget to #return it or you have to pay!",
        getReply(npc));
    final String[] questStatus = player.getQuest(QUEST2).split(";");
    assertEquals("sugar mill", questStatus[0]);

    en.step(player, "bye");
    assertFalse(npc.isTalking());
    player.setQuest(QUEST2, ";");

    assertEquals(1, player.getNumberOfEquipped("sugar mill"));

    en.step(player, "hi");
View Full Code Here

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

  /**
   * Tests for borrowing sugar.
   */
  @Test
  public void testBorrowSugar() {
    final SpeakerNPC npc = getNPC("Erna");
    final Engine en = npc.getEngine();
   
    en.step(player, "hi");
    assertTrue(npc.isTalking());
    assertEquals(
        "Welcome to the Semos bakery! We'll #bake fine bread for anyone who helps bring our #flour delivery from the mill.",
        getReply(npc));

    en.step(player, "borrow");
    assertTrue(npc.isTalking());
    assertEquals(
        "Oh sorry, I don't lend equipment to people with so little experience as you.",
        getReply(npc));

    // level up
    player.setLevel(10);
    en.step(player, "borrow");
    assertTrue(npc.isTalking());
    assertEquals(
        "You'll have to speak to Leander and ask if you can help with the pizza before I'm allowed to lend you anything.",
        getReply(npc));

    player.setQuest("pizza_delivery", "done");
    en.step(player, "borrow");
    assertTrue(npc.isTalking());
    assertEquals(
        "I lend out #'sugar mill' and #'pestle and mortar'. If you're interested, please say which you want.",
        getReply(npc));

    en.step(player, "sugar");
    assertTrue(npc.isTalking());
    assertEquals(
        "Sorry, I can't lend out sugar, only a #sugar #mill.",
        getReply(npc));

    en.step(player, "bye");
    assertFalse(npc.isTalking());
    player.setQuest(QUEST2, ";");

    assertEquals(0, player.getNumberOfEquipped("sugar mill"));

    en.step(player, "hi");
View Full Code Here

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

  /**
   * Tests for borrowing pestle and mortar.
   */
  @Test
  public void testBorrowPestleMortar() {
    final SpeakerNPC npc = getNPC("Erna");
    final Engine en = npc.getEngine();
   
    en.step(player, "hi");
    assertTrue(npc.isTalking());
    assertEquals(
        "Welcome to the Semos bakery! We'll #bake fine bread for anyone who helps bring our #flour delivery from the mill.",
        getReply(npc));

    en.step(player, "borrow");
    assertTrue(npc.isTalking());
    assertEquals(
        "Oh sorry, I don't lend equipment to people with so little experience as you.",
        getReply(npc));

    // level up
    player.setLevel(10);
    en.step(player, "borrow");
    assertTrue(npc.isTalking());
    assertEquals(
        "You'll have to speak to Leander and ask if you can help with the pizza before I'm allowed to lend you anything.",
        getReply(npc));

    player.setQuest("pizza_delivery", "done");
    en.step(player, "borrow");
    assertTrue(npc.isTalking());
    assertEquals(
        "I lend out #'sugar mill' and #'pestle and mortar'. If you're interested, please say which you want.",
        getReply(npc));

    en.step(player, "pestle and mortar");
    assertTrue(npc.isTalking());
    assertEquals(
        "Here you are! Don't forget to #return it or you have to pay!",
        getReply(npc));
    final String[] questStatus = player.getQuest(QUEST2).split(";");
    assertEquals("pestle and mortar", questStatus[0]);

    en.step(player, "bye");
    assertFalse(npc.isTalking());
    player.setQuest(QUEST2, ";");

    assertEquals(1, player.getNumberOfEquipped("pestle and mortar"));

    en.step(player, "hi");
View Full Code Here

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

  /**
   * Tests for borrowing pestle and mortar with additional space.
   */
  @Test
  public void testBorrowPestleAndMortarWithSpace() {
    final SpeakerNPC npc = getNPC("Erna");
    final Engine en = npc.getEngine();
   
    en.step(player, "hi");
    assertTrue(npc.isTalking());
    assertEquals(
        "Welcome to the Semos bakery! We'll #bake fine bread for anyone who helps bring our #flour delivery from the mill.",
        getReply(npc));

    en.step(player, "borrow");
    assertTrue(npc.isTalking());
    assertEquals(
        "Oh sorry, I don't lend equipment to people with so little experience as you.",
        getReply(npc));

    // level up
    player.setLevel(10);
    en.step(player, "borrow");
    assertTrue(npc.isTalking());
    assertEquals(
        "You'll have to speak to Leander and ask if you can help with the pizza before I'm allowed to lend you anything.",
        getReply(npc));

    player.setQuest("pizza_delivery", "done");
    en.step(player, "borrow");
    assertTrue(npc.isTalking());
    assertEquals(
        "I lend out #'sugar mill' and #'pestle and mortar'. If you're interested, please say which you want.",
        getReply(npc));

    en.step(player, "pestle and  mortar");
    assertTrue(npc.isTalking());
    assertEquals(
        "Here you are! Don't forget to #return it or you have to pay!",
        getReply(npc));
    final String[] questStatus = player.getQuest(QUEST2).split(";");
    assertEquals("pestle and mortar", questStatus[0]);

    en.step(player, "bye");
    assertFalse(npc.isTalking());
    player.setQuest(QUEST2, ";");

    assertEquals(1, player.getNumberOfEquipped("pestle and mortar"));

    en.step(player, "hi");
View Full Code Here

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

  /**
   * Tests for hiAndBye.
   */
  @Test
  public void testHiAndBye() {
    final SpeakerNPC npc = getNPC("Starkad");
    final Engine en = npc.getEngine();

    assertTrue(en.step(player, "hi"));
    assertEquals("Greetings! How may I help you?", getReply(npc));

    assertTrue(en.step(player, "bye"));
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.