Package marauroa.common.game.RPObject

Examples of marauroa.common.game.RPObject.ID


    assertEquals(owner, object.getContainer());
  }

  @Test
  public final void testRemove() {
    ID id = new ID(0,"");
    RPSlot rps = new RPSlot();
    assertNull(rps.remove(null));
    assertNull(rps.remove(new ID(0, "")));
    rps.setOwner(new RPObject());
    RPObject rpoWithID = new RPObject(id);
    rps.add(rpoWithID );
    assertSame(rpoWithID,rps.remove(id));
  }
View Full Code Here


   */
  @Test
  public final void testGetID() {
    final RPObject rpo = new RPObject();
    rpo.put("type", "hugo");
    rpo.setID(new ID(1, "woohoo"));
    final IEntity en = new MockEntity();
    en.initialize(rpo);
    assertNotNull("id must not be null", en.getID());
    assertEquals(1, en.getID().getObjectID());
    assertEquals("woohoo", en.getID().getZoneID());
View Full Code Here

    assertThat(entity.getMinimumLevel(),is(Integer.valueOf(0)));
    assertThat(entity.getRange(),is(Integer.valueOf(10)));
    assertThat(entity.getRate(),is(Integer.valueOf(1)));
    assertThat(entity.getRegen(),is(Integer.valueOf(100)));
    assertThat(entity.getClass().getName(), is("games.stendhal.server.entity.spell.HealingSpell"));
    entity.setID(new ID(1, "some_zone"))
    RPObject object = new SpellTransformer().transform(entity);
    assertThat(object, is((RPObject)entity));
  }
View Full Code Here

  private static RPObject createPlayer() {
    final RPObject rpo = new RPObject();

    rpo.put("type", "player");
    rpo.put("name", "player");
    rpo.setID(new ID(USER_ID, ZONE_NAME));

    final User pl = new User();
    pl.initialize(rpo);

    for (final String slotName : Constants.CARRYING_SLOTS) {
View Full Code Here

  private static RPObject createItem(final String itemName, final int id, final int amount) {
    final RPObject rpo = new RPObject();
    rpo.put("type", "item");
    rpo.put("name", itemName);
    rpo.put("quantity", amount);
    rpo.setID(new ID(id, ZONE_NAME));

    return rpo;
  }
View Full Code Here

    assertFalse(tad.isTalking());
    assertEquals("Bye.", getReply(tad));

    final StackableItem flask = new StackableItem("flask", "", "", null);
    flask.setQuantity(1);
    flask.setID(new ID(2, ZONE_NAME));
    player.getSlot("bag").add(flask);
    assertTrue(player.isEquipped("flask"));
    engineTad.step(player, ConversationPhrases.GREETING_MESSAGES.get(0));
    assertTrue(tad.isTalking());
    assertEquals(
        "Ok, you got the flask! Here take this money to cover your expense. Now, I need you to take it to #ilisa... she'll know what to do next.",
        getReply(tad));
    assertTrue(player.hasQuest(QUEST_SLOT));
    assertEquals("ilisa", player.getQuest(QUEST_SLOT));
    engineTad.step(player, ConversationPhrases.GOODBYE_MESSAGES.get(0));

    final SpeakerNPC ilisa = getNPC("Ilisa");
    final Engine engineIlisa = ilisa.getEngine();
    engineIlisa.step(player, ConversationPhrases.GREETING_MESSAGES.get(0));
    assertEquals(
        "Ah, I see you have that flask. #Tad needs medicine, right? Hmm... I'll need a #herb. Can you help?",
        getReply(ilisa));
    engineIlisa.step(player, "yes");
    assertEquals("North of Semos, near the tree grove, grows a herb called arandula. Here is a picture I drew so you know what to look for.",getReply(ilisa));
    assertEquals("corpse&herbs", player.getQuest(QUEST_SLOT));
    engineIlisa.step(player, "tad");
    assertEquals("He needs a very powerful potion to heal himself. He offers a good reward to anyone who will help him.", getReply(ilisa));
    engineIlisa.step(player, ConversationPhrases.GOODBYE_MESSAGES.get(0));
    assertEquals("Bye.", getReply(ilisa));

    engineTad.step(player, ConversationPhrases.GREETING_MESSAGES.get(0));
    assertTrue(tad.isTalking());

    assertEquals("Tad has already asked and the quest was accepted",
        "*sniff* *sniff* I still feel ill, please hurry with that #favour for me.", getReply(tad));
    engineTad.step(player, ConversationPhrases.GOODBYE_MESSAGES.get(0));
    assertFalse(tad.isTalking());
    assertEquals("Bye.", getReply(tad));

    engineIlisa.step(player, ConversationPhrases.GREETING_MESSAGES.get(0));
    assertEquals("Can you fetch those #herbs for the #medicine?", getReply(ilisa));
    engineIlisa.step(player, ConversationPhrases.GOODBYE_MESSAGES.get(0));
    assertEquals("Bye.", getReply(ilisa));
   
    // doesn't work as it causes an npe and adding it to setUp() doesn't help
    //PlayerTestHelper.equipWithItem(player, "arandula");
    final StackableItem arandula = new StackableItem("arandula", "", "", null);
    arandula.setQuantity(1);
    arandula.setID(new ID(2, ZONE_NAME));
    player.getSlot("bag").add(arandula);
    engineIlisa.step(player, ConversationPhrases.GREETING_MESSAGES.get(0));
    assertEquals(
        "Okay! Thank you. Now I will just mix these... a pinch of this... and a few drops... there! Can you ask #Tad to stop by and collect it? I want to see how he's doing.",
        getReply(ilisa));
View Full Code Here

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

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

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

  public boolean isAttacking(final IEntity defender) {
    if (defender == null) {
      return false;
    }
   
    final ID defenderID = defender.getID();
    return (isAttacking() && attacking.equals(defenderID));
  }
View Full Code Here

TOP

Related Classes of marauroa.common.game.RPObject.ID

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.