Package games.stendhal.server.entity.item

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


                 * (because you have to walk much to fulfil
                 * it).
                 *
                 */
                final String[] items = { "golden boots", "golden armor", "golden helmet" };
                final Item item = SingletonRepository.getEntityManager()
                  .getItem(items[Rand.rand(items.length)]);
                item.setBoundTo(player.getName());
                player.equipOrPutOnGround(item);
                player.addXP(2000);
              }
            }
            player.notifyWorldAboutChanges();
View Full Code Here


        public void fire(final Player player, final Sentence sentence, final EventRaiser raiser) {
          // from all notes that the player is carrying, try to
          // find the IOU note
          final List<Item> notes = player.getAllEquipped("note");
          Item iouNote = null;
          for (final Item note : notes) {
            if ("charles".equalsIgnoreCase(note.getInfoString())) {
              iouNote = note;
              break;
            }
View Full Code Here

    return "At last, my collection is complete! Thank you very much; "
        + "here, take this #'ice sword' in exchange!";
  }

  public void rewardPlayer(final Player player) {
    final Item iceSword = SingletonRepository.getEntityManager().getItem("ice sword");
    iceSword.setBoundTo(player.getName());
    player.equipOrPutOnGround(iceSword);
    player.addXP(5000);
  }
View Full Code Here

  @Override
  public boolean transactAgreedDeal(ItemParserResult res, final EventRaiser seller, final Player player) {
    String chosenItemName = res.getChosenItemName();
    int amount = res.getAmount();

    final Item item = getAskedItem(chosenItemName);
    if (item == null) {
      logger.error("Trying to sell an nonexistent item: " + chosenItemName);
      return false;
    }
View Full Code Here

      return false;
    }
  }

  public Item getAskedItem(final String askedItem) {
    final Item item = SingletonRepository.getEntityManager().getItem(askedItem);
    return item;
  }
View Full Code Here

      //found more that one item, important for answer of NPC
      if(equipped.size() > 1) {
        foundMoreThanOne = true;
      }
      //choose the first item as reference
      Item toRepair = equipped.iterator().next();
      //select the most damaged item from the found items
      for(Item i : equipped) {
        if(i.getDeterioration() > toRepair.getDeterioration()) {
          toRepair = i;
        }
      }
      // check if item is damaged
      if(toRepair.getDeterioration() > 0) {
        int price = priceCalculator.calculatePrice(toRepair, player);
        //only repair if player can afford it
        if (player.isEquipped("money", price)) {
          toRepair.repair();
          player.drop("money", price);
          //tell player about result of repairing as for more than one found item the most damaged one is repaired
          if(foundMoreThanOne) {
            seller.say("You do carry more than one "+res.getChosenItemName()+" with you. So I repaired the most damaged one.");
          } else {
View Full Code Here

   * @param clazz
   * @return success flag
   */
  public static boolean equipWithItem(final Player player, final String clazz) {
    ItemTestHelper.generateRPClasses();
    final Item item = SingletonRepository.getEntityManager().getItem(clazz);

    return player.equipToInventoryOnly(item);
  }
View Full Code Here

   * @param info
   * @return success flag
   */
  public static boolean equipWithItem(final Player player, final String clazz, final String info) {
    ItemTestHelper.generateRPClasses();
    final Item item = SingletonRepository.getEntityManager().getItem(clazz);
    item.setInfoString(info);

    return player.equipToInventoryOnly(item);
  }
View Full Code Here

          + level - 26);
    }

    final EntityManager em = SingletonRepository.getEntityManager();

    final Item shield = em.getItem("wooden shield");

    final Item armor = em.getItem("dress");

    final Item helmet = em.getItem("leather helmet");

    final Item legs = em.getItem("leather legs");

    final Item boots = em.getItem("leather boots");

    player = Player.createZeroLevelPlayer("Tester", null);

    player.equipToInventoryOnly(shield);
    player.equipToInventoryOnly(armor);
View Full Code Here

    final int oldXP = player.getXP();
    en.step(player, "emerald");
    assertEquals("I'm pleased to say, your ring of life is fixed! It's good as new now.", getReply(npc));
    assertEquals("player earns 500 experience points.", oldXP + 500, player.getXP());
   
    final Item ring = player.getFirstEquipped("emerald ring");
    assertTrue(ring.isBound());
    assertTrue(player.isBoundTo(ring));
    assertEquals("You see an emerald ring, known as ring of life. Wear it, and you risk less from death.", ring.getDescription());
    assertEquals("You see an emerald ring, known as the ring of life. Wear it, and you risk less from death. It is a special quest reward for player, and cannot be used by others.", ring.describe());
    assertThat(en.getCurrentState(), is(ConversationStates.ATTENDING));
    assertTrue(player.isQuestCompleted(QUEST_SLOT));
    en.step(player, "bye");
    assertEquals("Bye, my friend.", getReply(npc));
  }
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.