/** * This method is used to drop the CW from player.<br> * It drops the item on ground, and reset player stats. * * @param killer : The player who killed CW owner. */ private void dropFromPlayer(L2Character killer) { _player.abortAttack(); // Prevent item from being removed by ItemsAutoDestroy _item.setDestroyProtected(true); _player.dropItem("DieDrop", _item, killer, true); _isActivated = false; _isDropped = true; _player.setKarma(_playerKarma); _player.setPkKills(_playerPkKills); _player.setCursedWeaponEquippedId(0); removeDemonicSkills(); // Cancel the daily timer. It will be reactivated when someone will pickup the weapon. cancelDailyTimerTask(); // Activate the "1h dropped CW" timer. _dropTimerTask = ThreadPoolManager.getInstance().scheduleGeneral(new DropTimerTask(), 3600000L); // Reset current stage to 1. _currentStage = 1; // Drop infos from database. removeFromDb(); SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.S2_WAS_DROPPED_IN_THE_S1_REGION); sm.addZoneName(_player.getX(), _player.getY(), _player.getZ()); sm.addItemName(_itemId); Broadcast.toAllOnlinePlayers(sm); }
/** * This method is used to drop the CW from a monster.<br> * It drops the item on ground, and broadcast earthquake && red sky animations. * * @param attackable : The monster who dropped CW. * @param player : The player who killed the monster. */ private void dropFromMob(L2Attackable attackable, L2PcInstance player) { _isActivated = false; // get position int x = attackable.getX() + Rnd.get(-70, 70); int y = attackable.getY() + Rnd.get(-70, 70); int z = GeoData.getInstance().getHeight(x, y, attackable.getZ()); // create item and drop it _item = ItemTable.getInstance().createItem("CursedWeapon", _itemId, 1, player, attackable); _item.setDestroyProtected(true); _item.dropMe(attackable, x, y, z); // RedSky and Earthquake Broadcast.toAllOnlinePlayers(new ExRedSky(10)); Broadcast.toAllOnlinePlayers(new Earthquake(x, y, z, 14, 3)); _isDropped = true; SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.S2_WAS_DROPPED_IN_THE_S1_REGION); sm.addZoneName(player.getX(), player.getY(), player.getZ()); sm.addItemName(_itemId); Broadcast.toAllOnlinePlayers(sm); }
/** * Method used to send messages.<br> * * <ul> * <li>one is broadcasted to warn ppl CW is online. * <li>the other shows left timer for for CW owner (either in hours or minutes). * </ul> */ public void cursedOnLogin() { SystemMessage msg = SystemMessage.getSystemMessage(SystemMessageId.S2_OWNER_HAS_LOGGED_INTO_THE_S1_REGION); msg.addZoneName(_player.getX(), _player.getY(), _player.getZ()); msg.addItemName(_player.getCursedWeaponEquippedId()); Broadcast.toAllOnlinePlayers(msg); int timeLeft = (int) (getTimeLeft() / 60000); if (timeLeft > 60) { msg = SystemMessage.getSystemMessage(SystemMessageId.S2_HOUR_OF_USAGE_TIME_ARE_LEFT_FOR_S1); msg.addItemName(_player.getCursedWeaponEquippedId()); msg.addNumber(Math.round(timeLeft / 60)); } else { msg = SystemMessage.getSystemMessage(SystemMessageId.S2_MINUTE_OF_USAGE_TIME_ARE_LEFT_FOR_S1); msg.addItemName(_player.getCursedWeaponEquippedId()); msg.addNumber(timeLeft); } _player.sendPacket(msg); }
@Override public void run() { _hungryTime--; _timer++; if (_hungryTime <= 0) endOfLife(); else if (_player != null && _player.isOnline() && _timer % 60 == 0) { SystemMessage msg; int timeLeft = (int) (getTimeLeft() / 60000); if (timeLeft > 60) { msg = SystemMessage.getSystemMessage(SystemMessageId.S2_HOUR_OF_USAGE_TIME_ARE_LEFT_FOR_S1); msg.addItemName(_player.getCursedWeaponEquippedId()); msg.addNumber(Math.round(timeLeft / 60)); } else { msg = SystemMessage.getSystemMessage( SystemMessageId.S2_MINUTE_OF_USAGE_TIME_ARE_LEFT_FOR_S1); msg.addItemName(_player.getCursedWeaponEquippedId()); msg.addNumber(timeLeft); } _player.sendPacket(msg); } }