osvaldotl2015 Posted October 8, 2015 Posted October 8, 2015 (edited) //This code provides lvl 80 character =================================================================== Config.java (revision 0) =================================================================== + public static boolean ENABLE_CMD_UPLEVEL; + public static int UPLEVEL_ITEM_ID; + public static int UPLEVEL_ITEM_COUNT; public static String ALLOWED_SKILLS; public static String ALLOWED_SKILLS; public static FastList<Integer> ALLOWED_SKILLS_LIST = new FastList<>(); + ENABLE_CMD_UPLEVEL = Boolean.parseBoolean(L2JFrozenSettings.getProperty("EnableUpSystem", "True")); + UPLEVEL_ITEM_ID = Integer.parseInt(L2JFrozenSettings.getProperty("UpLevelItemID", "3481")); + UPLEVEL_ITEM_COUNT = Integer.parseInt(L2JFrozenSettings ALT_SERVER_NAME_ENABLED = Boolean.parseBoolean(L2JFrozenSettings.getProperty("ServerNameEnabled", "false")); ANNOUNCE_TO_ALL_SPAWN_RB = Boolean.parseBoolean(L2JFrozenSettings.getProperty("AnnounceToAllSpawnRb", "false")); =================================================================== gameserver/handler/VoicedCommandHandler.java =================================================================== import com.l2jfrozen.gameserver.handler.voicedcommandhandlers.Voting; import com.l2jfrozen.gameserver.handler.voicedcommandhandlers.Wedding; + import com.l2jfrozen.gameserver.handler.voicedcommandhandlers.UpLevel; + if (Config.ENABLE_CMD_UPLEVEL) + registerVoicedCommandHandler(new UpLevel()); + if (Config.BANKING_SYSTEM_ENABLED) + { + registerVoicedCommandHandler(new BankingCmd()); + } if (Config.CTF_COMMAND) { registerVoicedCommandHandler(new CTFCmd()); } =================================================================== gameserver/handler/voicedcommandhandlers/UpLevel.java (revision 0) =================================================================== package com.l2jfrozen.gameserver.handler.voicedcommandhandlers; import java.text.SimpleDateFormat; import com.l2jfrozen.Config; import com.l2jfrozen.gameserver.handler.IVoicedCommandHandler; import com.l2jfrozen.gameserver.model.PcInventory; import com.l2jfrozen.gameserver.model.L2World; import com.l2jfrozen.gameserver.model.actor.instance.L2PlayableInstance; import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance; import com.l2jfrozen.gameserver.model.actor.instance.L2ItemInstance; import com.l2jfrozen.gameserver.network.serverpackets.ActionFailed; import com.l2jfrozen.gameserver.network.serverpackets.SocialAction; /* * Edited By Dagger */ public class UpLevel implements IVoicedCommandHandler { private static final String[] VOICED_COMMANDS = {"up"}; public boolean useVoicedCommand(String command, L2PcInstance activeChar, String target) { if (command.equalsIgnoreCase("up")) { if(activeChar.getInventory().getItemByItemId(Config.UPLEVEL_ITEM_ID) != null && activeChar.getInventory().getItemByItemId(Config.HERO_ITEM_ID).getCount() >= Config.UPLEVEL_ITEM_COUNT) { activeChar.getInventory().destroyItemByItemId("GoldDragon", Config.UPLEVEL_ITEM_ID, Config.UPLEVEL_ITEM_COUNT, activeChar, activeChar.getTarget()); activeChar.broadcastPacket(new SocialAction(activeChar.getObjectId(), 16)); activeChar.getStat().addExp(activeChar.getStat().getExpForLevel(81)); activeChar.sendMessage("Felicidades : "+activeChar.getName()+" Ha Ganado LvL 80 usando el comando .up ! ."); activeChar.broadcastUserInfo(); } else { activeChar.sendMessage("No tienes el item necesario para usar este comando !!! "); return true; } } return false; } public String[] getVoicedCommandList() { return VOICED_COMMANDS; } } //No dejar nueva linea =================================================================== gameserver.config.functions.l2jfrozen.properties =================================================================== # Npc Protector Message ProtectorMessage = Hey Tu ! aqui no se puede matar !!! +# +#Comando .up ( Enable = True | Disable = False ) +#Subir de nivel 80 al personaje +EnableUpSystem = True +UpLevelItemID = 3481 +UpLevelItemCount = 1 //No dejar nueva linea Edited October 14, 2015 by osvaldotl2015 Quote
AbsolutePower Posted October 12, 2015 Posted October 12, 2015 mate dad shit will give npe(null pointer exception) :) if the UPLEVEL_ITEM_ID is not enough count in your invetory probably you should make a check for the count in your invetory. and also you need a check for the lvl up,if they are already 80 lvl to not use it again. Quote
Tryskell Posted October 14, 2015 Posted October 14, 2015 Use following for "item blabla destroyed", inventory update (you miss it) and weight refresh. It also checks on item consumption (atm you can spam your command even with 0 item, I guess). if (activeChar.destroyItemByItemId(... Quote
osvaldotl2015 Posted October 14, 2015 Author Posted October 14, 2015 Use following for "item blabla destroyed", inventory update (you miss it) and weight refresh. It also checks on item consumption (atm you can spam your command even with 0 item, I guess). if (activeChar.destroyItemByItemId(... Ty :) Code reloaded :) Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.