Package games.stendhal.server.entity.item

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


     
      // Restore the stored items
      ItemTransformer transformer = new ItemTransformer();
      for (final RPObject rpobject : objects) {
        try {
          Item item = transformer.transform(rpobject);
         
          // log removed items
          if (item == null) {
            int quantity = 1;
            if (rpobject.has("quantity")) {
View Full Code Here


     * ItemXMLLoader).
     */
    if (creator == null) {
      return null;
    }
    final Item item = creator.create();
    if (item != null) {
      item.setEquipableSlots(slots);
      item.setDescription(description);
      if (damageType != null) {
        item.setDamageType(damageType);
      }
      item.setSusceptibilities(susceptibilities);
    }

    return item;
  }
View Full Code Here

   * @param name   name of item
   * @param price  price of item (negative is for cases in which the player has to pay money)
   * @return Item
   */
  private Item prepareItem(String name, int price) {
    Item prototype = SingletonRepository.getEntityManager().getItem(name);
    Item item = new ItemInformation(prototype);
    if (seller) {
      item.put("price", -price);
    } else {
      item.put("price", price);
    }
    item.put("description_info", item.describe());
    // compatibility with 0.85 clients
    item.put("description", item.describe());
    return item;
  }
View Full Code Here

      final StendhalRPWorld world = SingletonRepository.getRPWorld();
      final StendhalRPZone zone = world.getZone(getID().getZoneID());

      // create a new grown item
      final Item grownItem = SingletonRepository.getEntityManager().getItem(
          growingItemName);
      grownItem.setPlantGrower(this);
      grownItem.setPosition(getX(), getY());

      // The item should not expire to avoid unnecessary loop of spawning
      // and expiring
      zone.add(grownItem, false);
      hasPickableFruit = true;
View Full Code Here

    assertTrue(getReply(npc).startsWith("You don't seem to have "));
    en.step(player, "bye");
    assertEquals("Good bye, it was pleasant talking with you.", getReply(npc));
   
    player.setQuest(questSlot, "obsidian;100");
    Item item = ItemTestHelper.createItem("obsidian");
    player.getSlot("bag").add(item);
    final int xp = player.getXP();
   
    en.step(player, "hi");
    assertEquals("Welcome to Kirdneh Museum.", getReply(npc));
View Full Code Here

   *            If the activity was successful.
   */
  @Override
  protected void onFinished(final Player player, final boolean successful) {
    if (successful) {
      final Item item = SingletonRepository.getEntityManager().getItem(itemName);

      if (item != null) {
        player.equipOrPutOnGround(item);
        player.incMinedForItem(item.getName(), item.getQuantity());
          SingletonRepository.getAchievementNotifier().onObtain(player);
        player.sendPrivateText("You found "
            + Grammar.a_noun(item.getTitle()) + ".");
      } else {
        logger.error("could not find item: " + itemName);
      }
      setState(getState()- 1);
      handleRespawn();
View Full Code Here

    assertEquals("Congratulations, here is your key to athor apartment 101! 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));
    en.step(player, "yes");

    assertTrue(player.isEquipped("player's house key"));
   
    Item item = player.getFirstEquipped("player's house key");
    assertNotNull(item);
    assertEquals("athor apartment 101;0;player", item.get("infostring"));
    assertFalse(item.isBound());
   
    player.equip(SingletonRepository.getEntityManager().getItem("money"), 1000);
    assertEquals("Before we go on, I must warn you that anyone with a key to your house can enter it, and access the items in the chest in your house. Do you still wish to buy a spare key?", getReply(npc));
    en.step(player, "yes");
View Full Code Here

      itemName += args;
    }

    itemName = Grammar.singular(itemName);

    final Item item = player.getFirstEquipped(itemName);

    if (item != null) {
       
          final Present present = (Present) SingletonRepository.getEntityManager().getItem("present");
          present.setContent(itemName);
View Full Code Here

  void processWin(final Player player, final int sum) {
    final Pair<String, String> prizeAndText = prizes.get(sum);
    if (prizeAndText != null) {
      final String prizeName = prizeAndText.first();
      final String text = prizeAndText.second();
      final Item prize = SingletonRepository.getEntityManager().getItem(
          prizeName);
      if (prizeName.equals("golden legs")) {
        prize.setBoundTo(player.getName());
      }

      say("Congratulations, " + player.getTitle() + ", you have "
          + sum + " points. " + text);
      player.equipOrPutOnGround(prize);
View Full Code Here

      entity.sendPrivateText("You need a " + tools.get(0) +" to harvest " + grainName + " fields.");
      return false;
    }

    onFruitPicked(null);
    final Item grain = SingletonRepository.getEntityManager().getItem(grainName);
    entity.equipOrPutOnGround(grain);
    if(entity instanceof Player) {
      ((Player) entity).incHarvestedForItem(grainName, 1);
      SingletonRepository.getAchievementNotifier().onObtain((Player) entity);
    }
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.