public boolean updateFunctions( L2PcInstance player, int type, int lvl, int lease, long rate, boolean addNew) { if (player == null) { return false; } if (lease > 0) { if (!player.destroyItemByItemId("Consume", Inventory.ADENA_ID, lease, null, true)) { return false; } } if (addNew) { _function.put(type, new FortFunction(type, lvl, lease, 0, rate, 0, false)); } else { if ((lvl == 0) && (lease == 0)) { removeFunction(type); } else { int diffLease = lease - _function.get(type).getLease(); if (diffLease > 0) { _function.remove(type); _function.put(type, new FortFunction(type, lvl, lease, 0, rate, -1, false)); } else { _function.get(type).setLease(lease); _function.get(type).setLvl(lvl); _function.get(type).dbSave(); } } } return true; }
@Override public boolean useVoicedCommand(String command, L2PcInstance activeChar, String params) { if (command.equals("bank")) { activeChar.sendMessage( ".deposit (" + Config.BANKING_SYSTEM_ADENA + " Adena = " + Config.BANKING_SYSTEM_GOLDBARS + " Goldbar) / .withdraw (" + Config.BANKING_SYSTEM_GOLDBARS + " Goldbar = " + Config.BANKING_SYSTEM_ADENA + " Adena)"); } else if (command.equals("deposit")) { if (activeChar.getInventory().getInventoryItemCount(57, 0) >= Config.BANKING_SYSTEM_ADENA) { if (!activeChar.reduceAdena("Goldbar", Config.BANKING_SYSTEM_ADENA, activeChar, false)) { return false; } activeChar .getInventory() .addItem("Goldbar", 3470, Config.BANKING_SYSTEM_GOLDBARS, activeChar, null); activeChar.getInventory().updateDatabase(); activeChar.sendMessage( "Thank you, you now have " + Config.BANKING_SYSTEM_GOLDBARS + " Goldbar(s), and " + Config.BANKING_SYSTEM_ADENA + " less adena."); } else { activeChar.sendMessage( "You do not have enough Adena to convert to Goldbar(s), you need " + Config.BANKING_SYSTEM_ADENA + " Adena."); } } else if (command.equals("withdraw")) { if (activeChar.getInventory().getInventoryItemCount(3470, 0) >= Config.BANKING_SYSTEM_GOLDBARS) { if (!activeChar.destroyItemByItemId( "Adena", 3470, Config.BANKING_SYSTEM_GOLDBARS, activeChar, false)) { return false; } activeChar.getInventory().addAdena("Adena", Config.BANKING_SYSTEM_ADENA, activeChar, null); activeChar.getInventory().updateDatabase(); activeChar.sendMessage( "Thank you, you now have " + Config.BANKING_SYSTEM_ADENA + " Adena, and " + Config.BANKING_SYSTEM_GOLDBARS + " less Goldbar(s)."); } else { activeChar.sendMessage( "You do not have any Goldbars to turn into " + Config.BANKING_SYSTEM_ADENA + " Adena."); } } return true; }
/** * @see com.l2jserver.gameserver.handler.IVoicedCommandHandler#useVoicedCommand(java.lang.String, * com.l2jserver.gameserver.model.actor.instance.L2PcInstance, java.lang.String) */ public boolean useVoicedCommand(String command, L2PcInstance activeChar, String params) { String screenMsgNoble = "Congratulations On Becoming A Noblesse!"; try { if (validateNobleCommand(activeChar) && activeChar.destroyItemByItemId( "Noble", 3470, Config.L2JMOD_SYSTEM_NOBLE_AMOUNT_ITEM, activeChar, true)) { activeChar.startParalyze(); activeChar.setNoble(true); activeChar.sendPacket(new UserInfo(activeChar)); activeChar.sendPacket(new ExBrExtraUserInfo(activeChar)); ExShowScreenMessage showMessage = new ExShowScreenMessage(screenMsgNoble, Config.L2JMOD_CUSTOM_WHITE_SCREEN_MESSAGE_TIME); activeChar.sendPacket(showMessage); activeChar.startAbnormalEffect(AbnormalEffect.REAL_TARGET); activeChar.startAbnormalEffect(AbnormalEffect.MAGIC_CIRCLE); activeChar.broadcastPacket(new PlaySound("Itemsound.quest_finish")); activeChar.setIsTeleporting(true); // block movements ThreadPoolManager.getInstance() .scheduleGeneral( new Runnable() { @Override public void run() { activeChar.stopAbnormalEffect(AbnormalEffect.REAL_TARGET); activeChar.stopAbnormalEffect(AbnormalEffect.MAGIC_CIRCLE); activeChar.setIsTeleporting(false); // restore movements } }, Config.L2JMOD_CUSTOM_WHITE_SCREEN_MESSAGE_TIME / 3); } } catch (Exception e) { _log.log( Level.SEVERE, "Error when trying to become the player:" + activeChar.getName() + " in noble: " + e.getMessage(), e); } return true; }
private void enterInstance(L2PcInstance player, String template) { InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(player); if (world != null) { if (world instanceof DPFWorld) { teleportPlayer(player, ENTRY_POINT, world.getInstanceId()); return; } player.sendPacket(SystemMessageId.ALREADY_ENTERED_ANOTHER_INSTANCE_CANT_ENTER); return; } if (!checkTeleport(player)) { return; } world = new DPFWorld(); world.setInstanceId(InstanceManager.getInstance().createDynamicInstance(template)); world.setTemplateId(TEMPLATE_ID); world.addAllowed(player.getObjectId()); world.setStatus(0); InstanceManager.getInstance().addWorld(world); teleportPlayer(player, ENTRY_POINT, world.getInstanceId()); _log.info( "Tower of Infinitum - Demon Prince floor started " + template + " Instance: " + world.getInstanceId() + " created by player: " + player.getName()); for (L2PcInstance partyMember : player.getParty().getMembers()) { teleportPlayer(partyMember, ENTRY_POINT, world.getInstanceId()); partyMember.destroyItemByItemId("Quest", SEAL_BREAKER_5, 1, null, true); world.addAllowed(partyMember.getObjectId()); } }