/** * Method activate. * * @param player Player * @param item ItemInstance */ public void activate(Player player, ItemInstance item) { if ((player == null) || player.isInOlympiadMode()) { return; } CursedWeapon cw = _cursedWeaponsMap.get(item.getId()); if (cw == null) { return; } if (player.isCursedWeaponEquipped()) { if (player.getCursedWeaponEquippedId() != item.getId()) { CursedWeapon cw2 = _cursedWeaponsMap.get(player.getCursedWeaponEquippedId()); cw2.setNbKills(cw2.getStageKills() - 1); cw2.increaseKills(); } endOfLife(cw); player.getInventory().destroyItem(item, 1); } else if (cw.getTimeLeft() > 0) { cw.activate(player, item); saveData(cw); announce( new SystemMessage(SystemMessage.THE_OWNER_OF_S2_HAS_APPEARED_IN_THE_S1_REGION) .addZoneName(player.getLoc()) .addString(cw.getName())); } else { endOfLife(cw); player.getInventory().destroyItem(item, 1); } }
/** * Method increaseKills. * * @param itemId int */ public void increaseKills(int itemId) { CursedWeapon cw = _cursedWeaponsMap.get(itemId); if (cw != null) { cw.increaseKills(); saveData(cw); } }