Package games.stendhal.server.entity.item

Examples of games.stendhal.server.entity.item.Item


    assertEquals("Bye.", getReply(npc));
  }

  private void equipCloaks(final int quantity) {
    for (int i = 0; i < quantity; i++) {
      final Item item = ItemTestHelper.createItem("blue elf cloak");
      player.getSlot("bag").add(item);
    }
  }
View Full Code Here


  private boolean rollDice() {
    Area table = dealer.getPlayingArea();
    Rectangle tableBounds = table.getShape().getBounds();

    Item dice = player.getFirstEquipped("dice");
    if (dice == null) {
      return false;
    }

    RPObject parent = dice.getContainer();

    final RPAction action = new RPAction();
    action.put("type", "drop");
    action.put("baseitem", dice.getID().getObjectID());
    action.put(EquipActionConsts.BASE_OBJECT, parent.getID().getObjectID());
    action.put(EquipActionConsts.BASE_SLOT, dice.getContainerSlot().getName());
    action.put("x", (int)tableBounds.getCenterX());
    action.put("y", (int)tableBounds.getCenterY());

    new DropAction().onAction(player, action);
View Full Code Here

    final SpeakerNPC th = NPCList.get().get("th");
    assertNotNull(th);
    final Engine en = th.getEngine();
    final Player player = PlayerTestHelper.createPlayer("bob");
    en.setCurrentState(ConversationStates.ATTENDING);
    final Item helmet = SingletonRepository.getEntityManager().getItem("trophy helmet");
    player.equipToInventoryOnly(helmet);
    assertTrue(player.isEquipped("trophy helmet"));
    helmet.put("def", 2);
    assertThat(helmet.getInt("def"), greaterThan(1));
    player.setQuest("deathmatch", "start");
    en.step(player, "bail");
    assertEquals("Coward! I'm sorry to inform you, for this your helmet has been magically weakened.",
        getReply(th));
View Full Code Here

    assertEquals("Congratulations, here is your key to ados house 50! Make sure you change the locks if you ever lose it."
        + " Do you want to buy a spare key, at a price of 1000 money?", getReply(npc));

    assertTrue(player.isEquipped("player's house key"));
   
    Item item = player.getFirstEquipped("player's house key");
    assertNotNull(item);
    assertEquals("ados house 50;0;player", item.get("infostring"));
    assertFalse(item.isBound());
   
    assertTrue(en.step(player, "no"));
    assertEquals("No problem! Just so you know, if you need to #change your locks, I can do that, "
        + "and you can also #resell your house to me if you want to.", getReply(npc));
  }
View Full Code Here

   *
   * @throws Exception
   */
  @Test
  public void testOffer() throws Exception {
    Item item = SingletonRepository.getEntityManager().getItem("money");
    Integer price = Integer.valueOf(1);
    Player offerer = PlayerTestHelper.createPlayer(OFFERER_NAME);
    Offer o = new Offer(item, price, offerer);
    assertThat(o.getOfferer(), is(OFFERER_NAME));
    assertThat(o.getInt("price"), is(price.intValue()));
View Full Code Here

    };
    entity.addSlot(new PlayerSlot("lhand"));
    entity.addSlot(new PlayerSlot("rhand"));

    assertThat(entity.getItemAtk(), is(0f));
    final Item item = SingletonRepository.getEntityManager().getItem(
        "dagger");
    entity.getSlot("lhand").add(item);
    assertThat(entity.getItemAtk(), is((float) item.getAttack()));
    entity.getSlot("rhand").add(item);
    assertThat(entity.getItemAtk(), is((float) item.getAttack()));
    entity.getSlot("lhand").remove(item.getID());
    assertThat(entity.getItemAtk(), is((float) item.getAttack()));

  }
View Full Code Here

   *
   * @throws Exception
   */
  @Test
  public void testEquals() throws Exception {
    Item item = SingletonRepository.getEntityManager().getItem("money");
    Integer price = Integer.valueOf(1);
    Player offerer = PlayerTestHelper.createPlayer(OFFERER_NAME);
    Offer o = new Offer(item, price, offerer);
    assertThat(o, is(o));
    assertThat(o.getOfferer(), is(OFFERER_NAME));
View Full Code Here

    };
    entity.addSlot(new PlayerSlot("lhand"));
    entity.addSlot(new PlayerSlot("rhand"));

    assertThat(entity.getItemAtk(), is(0f));
    final Item item = SingletonRepository.getEntityManager().getItem(
        "cheese");
    entity.getSlot("lhand").add(item);
    assertThat(entity.getItemAtk(), is(0f));
    entity.getSlot("rhand").add(item);
    assertThat(entity.getItemAtk(), is(0f));
    entity.getSlot("lhand").remove(item.getID());
    assertThat(entity.getItemAtk(), is(0f));
  }
View Full Code Here

    };
    entity.addSlot(new PlayerSlot("lhand"));
    entity.addSlot(new PlayerSlot("rhand"));

    assertThat(entity.getItemAtk(), is(0f));
    final Item lefthanditem = SingletonRepository.getEntityManager()
        .getItem("l hand sword");
    entity.getSlot("lhand").add(lefthanditem);
    assertThat(entity.getItemAtk(), is(0f));

    final Item righthanditem = SingletonRepository.getEntityManager()
        .getItem("r hand sword");
    entity.getSlot("rhand").add(righthanditem);
    assertThat(entity.getItemAtk(),
        is((float) (lefthanditem.getAttack() + righthanditem
            .getAttack())));
  }
View Full Code Here

    entity.addSlot(new PlayerSlot("lhand"));
    entity.addSlot(new PlayerSlot("rhand"));

    assertThat(entity.getItemAtk(), is(0f));

    final Item lefthanditem = SingletonRepository.getEntityManager()
        .getItem("l hand sword");
    entity.getSlot("rhand").add(lefthanditem);
    assertThat(entity.getItemAtk(), is(0f));

    final Item righthanditem = SingletonRepository.getEntityManager()
        .getItem("r hand sword");
    entity.getSlot("lhand").add(righthanditem);
    assertThat(entity.getItemAtk(), is(0f));

  }
View Full Code Here

TOP

Related Classes of games.stendhal.server.entity.item.Item

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.