Beispiel #1
0
  public void dropItem(NpcInstance npc, int itemId, long count) {
    Player player = getPlayer();
    if (player == null) {
      return;
    }

    ItemInstance item = ItemFunctions.createItem(itemId);
    item.setCount(count);
    item.dropToTheGround(player, npc);
  }
Beispiel #2
0
 /*
  * Выбирает 1 предмет из группы
  */
 public void getGroupItem(Player activeChar, RewardData[] dropData, Map<Integer, Long> report) {
   ItemInstance item;
   long count = 0;
   for (RewardData d : dropData)
     if (Rnd.get(1, RewardList.MAX_CHANCE)
         <= d.getChance() * Config.EVENT_COFFER_OF_SHADOWS_REWARD_RATE) {
       count = Rnd.get(d.getMinDrop(), d.getMaxDrop());
       item = ItemFunctions.createItem(d.getItemId());
       item.setCount(count);
       activeChar.getInventory().addItem(item);
       Long old = report.get(d.getItemId());
       report.put(d.getItemId(), old != null ? old + count : count);
     }
 }