BBMAXI 14 Опубликовано 2 февраля, 2011 Эвент "Система перерождения" Кому непонятно, читаем код Эвента. Index: /trunk/gameserver/java/config/additions.ini =================================================================== --- /trunk/gameserver/java/config/additions.ini (revision 282) +++ /trunk/gameserver/java/config/additions.ini (revision 311) @@ -1,13 +1,37 @@ +#----------------------------------- +# Эвент перерождение +#----------------------------------- +REBIRTH_ALLOW_REBIRTH = True +REBIRTH_MIN_LEVEL = 80 +REBIRTH_ITEM1_NEEDED = 57 +REBIRTH_ITEM1_AMOUNT = 1000 +REBIRTH_ITEM2_NEEDED = 57 +REBIRTH_ITEM2_AMOUNT = 2000 +REBIRTH_ITEM3_NEEDED = 57 +REBIRTH_ITEM3_AMOUNT = 3000 +REBIRTH_MAGE_SKILL1_ID = 1062 +REBIRTH_MAGE_SKILL1_LEVEL = 2 +REBIRTH_MAGE_SKILL2_ID = 1085 +REBIRTH_MAGE_SKILL2_LEVEL = 3 +REBIRTH_MAGE_SKILL3_ID = 1059 +REBIRTH_MAGE_SKILL3_LEVEL = 3 +REBIRTH_FIGHTER_SKILL1_ID = 1045 +REBIRTH_FIGHTER_SKILL1_LEVEL = 6 +REBIRTH_FIGHTER_SKILL2_ID = 1048 +REBIRTH_FIGHTER_SKILL2_LEVEL = 6 +REBIRTH_FIGHTER_SKILL3_ID = 1086 +REBIRTH_FIGHTER_SKILL3_LEVEL = 2 + Index: /trunk/gameserver/java/net/sf/engine/rebirth/BypassHandler.java =================================================================== --- /trunk/gameserver/java/net/sf/engine/rebirth/BypassHandler.java (revision 311) +++ /trunk/gameserver/java/net/sf/engine/rebirth/BypassHandler.java (revision 311) @@ -0,0 +1,55 @@ +/* + * This program is free software: you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free Software + * Foundation, either version 3 of the License, or (at your option) any later + * version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License along with + * this program. If not, see <http://www.gnu.org/licenses/>. + */ +package net.sf.engine.rebirth; + +import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance; + +/** + * This 'Bypass Handler' is a handy tool indeed!<br> + * Basically, you can send any custom bypass commmands to it from ANY + * npc and it will call the appropriate function.<br> + * + * <strong>Example:</strong><br> + * <button value=" Request Rebirth " action="bypass -h custom_rebirth_confirmrequest" width=110 height=36 back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df"> + * + * @author JStar + */ +public class BypassHandler +{ + private static BypassHandler _instance = null; + + private BypassHandler() + { + //Do Nothing ^_- + } + + /** Receives the non-static instance of the RebirthManager.*/ + public static BypassHandler getInstance() + { + if(_instance == null) + { + _instance = new BypassHandler(); + } + return _instance; + } + + /** Handles player's Bypass request to the Custom Content. */ + public void handleBypass(L2PcInstance player, String command) + { + if(command.startsWith("custom_rebirth")){//Rebirth Manager and Engine Caller + RebirthManager.getInstance().handleCommand(player, command); + } + } +} Index: /trunk/gameserver/java/net/sf/engine/rebirth/CustomAdminCommandHandler.java =================================================================== --- /trunk/gameserver/java/net/sf/engine/rebirth/CustomAdminCommandHandler.java (revision 311) +++ /trunk/gameserver/java/net/sf/engine/rebirth/CustomAdminCommandHandler.java (revision 311) @@ -0,0 +1,46 @@ +/* + * This program is free software: you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free Software + * Foundation, either version 3 of the License, or (at your option) any later + * version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License along with + * this program. If not, see <http://www.gnu.org/licenses/>. + */ +package net.sf.engine.rebirth; + +import net.sf.l2j.gameserver.handler.IAdminCommandHandler; +import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance; + +/** + *A 'Custom' Admin Handler for all your custom content. + * + * @author JStar + */ +public class CustomAdminCommandHandler implements IAdminCommandHandler +{ + private static final String[] ADMIN_COMMANDS = + { + "admin_custom_reconfig" + }; + + public boolean useAdminCommand(String command, L2PcInstance player) + { + if(command.startsWith("admin_custom_reconfig")) + { + player.sendMessage("Успешная перезагрузка 'Custom Content' файла конфига."); + } + + return true; + } + + public String[] getAdminCommandList() + { + return ADMIN_COMMANDS; + } +} Index: /trunk/gameserver/java/net/sf/engine/rebirth/WorldHandler.java =================================================================== --- /trunk/gameserver/java/net/sf/engine/rebirth/WorldHandler.java (revision 311) +++ /trunk/gameserver/java/net/sf/engine/rebirth/WorldHandler.java (revision 311) @@ -0,0 +1,58 @@ +/* + * This program is free software: you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free Software + * Foundation, either version 3 of the License, or (at your option) any later + * version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License along with + * this program. If not, see <http://www.gnu.org/licenses/>. + */ +package net.sf.engine.rebirth; + +import net.sf.engine.rebirth.RebirthManager; +import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance; + +/** + *This will simply manage any custom 'Enter World callers' needed.<br> + *Rather then having to add them to the core's. (yuck!) + * + * @author JStar + */ +public class WorldHandler +{ + + private static WorldHandler _instance = null; + + private WorldHandler() + { + //Do Nothing ^_- + } + + /** Receives the non-static instance of the RebirthManager.*/ + public static WorldHandler getInstance() + { + if(_instance == null) + { + _instance = new WorldHandler(); + } + return _instance; + } + + /** Requests entry into the world - manages appropriately. */ + public void enterWorld(L2PcInstance player) + { + RebirthManager.getInstance().grantRebirthSkills(player);//Rebirth Caller - if player has any skills, they will be granted them. + } + + /** Requests removal from the world - manages appropriately. */ + public void exitWorld(L2PcInstance player) + { + //TODO: Remove the rebirth engine's bonus skills from player? + } + +} Index: /trunk/gameserver/java/net/sf/engine/rebirth/RebirthManager.java =================================================================== --- /trunk/gameserver/java/net/sf/engine/rebirth/RebirthManager.java (revision 311) +++ /trunk/gameserver/java/net/sf/engine/rebirth/RebirthManager.java (revision 311) @@ -0,0 +1,415 @@ +/* + * This program is free software: you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free Software + * Foundation, either version 3 of the License, or (at your option) any later + * version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License along with + * this program. If not, see <http://www.gnu.org/licenses/>. + */ +package net.sf.engine.rebirth; + +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.util.HashMap; + +import javolution.text.TextBuilder; +import net.sf.l2j.Config; +import net.sf.l2j.L2DatabaseFactory; +import net.sf.l2j.gameserver.datatables.ItemTable; +import net.sf.l2j.gameserver.datatables.SkillTable; +import net.sf.l2j.gameserver.model.L2ItemInstance; +import net.sf.l2j.gameserver.model.L2Skill; +import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance; +import net.sf.l2j.gameserver.model.base.Experience; +import net.sf.l2j.gameserver.serverpackets.CreatureSay; +import net.sf.l2j.gameserver.serverpackets.NpcHtmlMessage; +import net.sf.l2j.gameserver.serverpackets.SocialAction; + + + +/** + * <strong>This 'Custom Engine' was developed for L2J Forum Member 'sauron3256' on November 1st, 2008.</strong><br><br> + * <strong>Quick Summary:</strong><br> + * This engine will grant the player special bonus skills at the cost of reseting him to level 1.<br> + * The -USER- can set up to 3 Rebirths, the skills received and their respective levels, and the item and price of each rebirth.<br> + * PLAYER's information is stored in an SQL Db under the table name: REBIRTH_MANAGER.<br> + * + * @author <strong>JStar</strong> + */ +public class RebirthManager +{ + /** The current instance - static repeller */ + private static RebirthManager _instance = null; + + /** Basically, this will act as a cache so it doesnt have to read DB information on relog. */ + private HashMap<Integer,Integer> _playersRebirthInfo = new HashMap<Integer,Integer>(); + + /** Creates a new NON-STATIC instance */ + private RebirthManager() + { + //Do Nothing ^_- + } + + /** Receives the non-static instance of the RebirthManager.*/ + public static RebirthManager getInstance() + { + if(_instance == null) + { + _instance = new RebirthManager(); + } + return _instance; + } + + /** This is what it called from the Bypass Handler. (I think that's all thats needed here).*/ + public void handleCommand(L2PcInstance player,String command) + { + if(command.startsWith("custom_rebirth_requestrebirth")) + { + displayRebirthWindow(player); + } + else if(command.startsWith("custom_rebirth_confirmrequest")) + { + requestRebirth(player); + } + } + + /** Display's an HTML window with the Rebirth Options */ + public void displayRebirthWindow(L2PcInstance player) + { + try + { + int currBirth = getRebirthLevel(player); + if(currBirth >= 3) + { + player.sendMessage("Вы уже сделали максимальное количество перерождений!"); + return; + } + + boolean isMage = player.getBaseTemplate().classId.isMage(); + L2Skill skill = getRebirthSkill((currBirth + 1), isMage); + + String icon = ""+skill.getId(); + if(icon.length() < 4) + { + icon = "0"+icon; + } + + String playerName = "<font color=FF9900>"+player.getName()+"</font>";//return the player's name. + + TextBuilder text = new TextBuilder(); + text.append("<html>"); + text.append("<body>"); + text.append("<center>"); + text.append("<title>- Меню перерождения -</title>"); + text.append("<img src=\"L2UI_CH3.herotower_deco\" width=256 height=32>"); + text.append("<br>"); + text.append("<table border=1 cellspacing=1 cellpadding=1 height=37><tr><td valign=top>"); + text.append("<img src=\"icon.skill3123\" width=32 height=32>");//Cool rebirth icon 'logo' :P + text.append("</td></tr></table>"); + text.append("<br>"); + text.append("<table width=240 bgcolor=555555 border=1 cellpadding=1 cellspacing=0><tr>"); + text.append("<td height=40 width=35><img src=\"icon.skill"+icon+"\" width=32 height=32 align=left></td>"); + text.append("<td height=40 width=140><center><font color=\"FFFFCC\">Bonus Skill Recieved</font><br1><font color=\"FF9900\">" + skill.getName() + "</font></td>"); + text.append("<td height=40 width=100><center><font color=\"66CC66\">Skill Lvl</font><br1><font color=\"FFFF99\">" + skill.getLevel() + "</font></center></td>"); + text.append("</tr></table>"); + text.append("<br>"); + text.append("<img src=\"L2UI.SquareWhite\" width=\"280\" height=\"1\"><br1>"); + text.append("<table bgcolor=555555 width=270 height=80><tr><td valign=center align=center>- [ <font color=\"66CC66\">Rebirth Information</font> ] -<br1>"); + text.append("<table bgcolor=555555 width=250 height=150><tr><td valign=top align=center><center>"); + text.append("So, " + playerName + ", you wish to be <font color=Level>Reborn</font>? "); + text.append("Being <font color=Level>Reborn</font> has it's advantages, and it's disadvantages you know. "); + text.append("When you are <font color=Level>Reborn</font> you are granted a new bonus skill (listed above), "); + text.append("but your character is reset to level 1 and returned to his starting class. So "); + text.append("<font color=LEVEL>choose wisely</font> " + playerName + ".<br1>"); + text.append("</center></td></tr></table>"); + text.append("</td></tr></table>"); + text.append("<img src=\"L2UI.SquareWhite\" width=\"280\" height=\"1\"><br>"); + text.append("<center><button value=\" Request Rebirth \" action=\"bypass -h custom_rebirth_confirmrequest\" width=250 height=36 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"); + text.append("</center>"); + text.append("</body>"); + text.append("</html>"); + + NpcHtmlMessage html = new NpcHtmlMessage(1); + html.setHtml(text.toString()); + player.sendPacket(html); + } + catch(Exception e) + { + e.printStackTrace(); + } + } + + /** Checks to see if the player is eligible for a Rebirth, if so it grants it and stores information */ + public void requestRebirth(L2PcInstance player) + { + if(!Config.REBIRTH_ALLOW_REBIRTH) + { //See if the Rebirth Engine is currently allowed. + player.sendMessage("The 'Rebirth Engine' is currently offline. Try again later!"); + return; + } + + else if(player.getLevel() < Config.REBIRTH_MIN_LEVEL) + { //Check the player's level. + player.sendMessage("You do not meet the level requirement for a Rebirth!"); + return; + } + + else if(player.isSubClassActive()) + { + player.sendMessage("Please switch to your Main Class before attempting a Rebirth."); + return; + } + + int currBirth = getRebirthLevel(player); + int itemNeeded = 0; + int itemAmount = 0; + + if(currBirth >= 3) + { + player.sendMessage("You are currently at your maximum rebirth count!"); + return; + } + + switch(currBirth) + {//Get the requirements + case 0: itemNeeded = Config.REBIRTH_ITEM1_NEEDED; itemAmount = Config.REBIRTH_ITEM1_AMOUNT; break; + case 1: itemNeeded = Config.REBIRTH_ITEM2_NEEDED; itemAmount = Config.REBIRTH_ITEM2_AMOUNT; break; + case 2: itemNeeded = Config.REBIRTH_ITEM3_NEEDED; itemAmount = Config.REBIRTH_ITEM3_AMOUNT; break; + } + + if(itemNeeded != 0) + {//Their is an item required + if(!playerIsEligible(player, itemNeeded, itemAmount)){//Checks to see if player has required items, and takes them if so. + return; + } + } + + boolean firstBirth = currBirth == 0;//Check and see if its the player's first Rebirth calling. + grantRebirth(player,(currBirth + 1), firstBirth); //Player meets requirements and starts Rebirth Process. + } + + /** Physically rewards player and resets status to nothing. */ + public void grantRebirth(L2PcInstance player, int newBirthCount, boolean firstBirth) + { + try{ + + player.removeExpAndSp(player.getExp() - Experience.LEVEL[1], 0);//Set player to level 1. + player.setClassId(player.getBaseClass());//Resets character to first class. + for (L2Skill skill : player.getAllSkills()){//Remove the player's current skills. + player.removeSkill(skill); + } + player.giveAvailableSkills();//Give players their eligible skills. + player.store(); //Updates the player's information in the Character Database. + + if(firstBirth) storePlayerBirth(player); + else updatePlayerBirth(player,newBirthCount); + + grantRebirthSkills(player);//Give the player his new Skills. + displayCongrats(player);//Displays a congratulation message to the player. + } + catch(Exception e) + { + e.printStackTrace(); + } + } + + /** Special effects when the player levels. */ + public void displayCongrats(L2PcInstance player) + { + player.broadcastPacket(new SocialAction(player.getObjectId(), 3));//Victory Social Action. + player.sendMessage("Congratulations "+player.getName()+"! You have been Reborn!"); + } + + /** Check and verify the player DOES have the item required for a request. Also, remove the item if he has.*/ + public boolean playerIsEligible(L2PcInstance player, int itemId, int itemAmount) + { + String itemName = ItemTable.getInstance().getTemplate(itemId).getName(); + L2ItemInstance itemNeeded = player.getInventory().getItemByItemId(itemId); + + if(itemNeeded == null || itemNeeded.getCount() < itemAmount) + { + player.sendMessage("You need atleast "+itemAmount+" [ "+itemName+" ] to request a Rebirth!"); + return false; + } + + //Player has the required items, so we're going to take them! + + player.getInventory().destroyItemByItemId("Rebirth", itemId, itemAmount, player, null); + + player.sendMessage("Removed "+itemAmount+" "+itemName+" from your inventory!"); + return true; + } + + /** Gives the available Bonus Skills to the player. */ + public void grantRebirthSkills(L2PcInstance player) + { + int rebirthLevel = getRebirthLevel(player); //returns the current Rebirth Level + boolean isMage = player.getBaseTemplate().classId.isMage(); //Returns true if BASE CLASS is a mage. + + //Simply return since no bonus skills are granted. + if(rebirthLevel == 0) return; + + //Load the bonus skills unto the player. + CreatureSay rebirthText = null; + for(int i = 0; i < rebirthLevel; i++) + { + L2Skill bonusSkill = getRebirthSkill((i + 1), isMage); + player.addSkill(bonusSkill, false); + + //If you'd rather make it simple, simply comment this out and replace with a simple player.sendmessage(); + rebirthText = new CreatureSay(0, 18, "Rebirth Manager ", " Granted you [ "+bonusSkill.getName()+" ] level [ "+bonusSkill.getLevel()+" ]!"); + player.sendPacket(rebirthText); + } + } + + /** Return the player's current Rebirth Level */ + public int getRebirthLevel(L2PcInstance player) + { + int playerId = player.getObjectId(); + if(_playersRebirthInfo.get(playerId) == null) + { + loadRebirthInfo(player); + } + return _playersRebirthInfo.get(playerId); + } + + /** Return the L2Skill the player is going to be rewarded. */ + public L2Skill getRebirthSkill(int rebirthLevel,boolean mage) + { + L2Skill skill = null; + if(mage) + { //Player is a Mage. + switch(rebirthLevel) + { + case 1:skill = SkillTable.getInstance().getInfo(Config.REBIRTH_MAGE_SKILL1_ID, Config.REBIRTH_MAGE_SKILL1_LEVEL); break; + case 2:skill = SkillTable.getInstance().getInfo(Config.REBIRTH_MAGE_SKILL2_ID, Config.REBIRTH_MAGE_SKILL2_LEVEL); break; + case 3:skill = SkillTable.getInstance().getInfo(Config.REBIRTH_MAGE_SKILL3_ID, Config.REBIRTH_MAGE_SKILL3_LEVEL); break; + } + } + else + { //Player is a Fighter. + switch(rebirthLevel) + { + case 1:skill = SkillTable.getInstance().getInfo(Config.REBIRTH_FIGHTER_SKILL1_ID, Config.REBIRTH_FIGHTER_SKILL1_LEVEL); break; + case 2:skill = SkillTable.getInstance().getInfo(Config.REBIRTH_FIGHTER_SKILL2_ID, Config.REBIRTH_FIGHTER_SKILL2_LEVEL); break; + case 3:skill = SkillTable.getInstance().getInfo(Config.REBIRTH_FIGHTER_SKILL3_ID, Config.REBIRTH_FIGHTER_SKILL3_LEVEL); break; + } + } + return skill; + } + + /** Database caller to retrieve player's current Rebirth Level */ + public void loadRebirthInfo(L2PcInstance player) + { + int playerId = player.getObjectId(); + int rebirthCount = 0; + + Connection con = null; + try + { + ResultSet rset; + con = L2DatabaseFactory.getInstance().getConnection(); + PreparedStatement statement = con.prepareStatement + ("SELECT * FROM `rebirth_manager` WHERE playerId = ?"); + statement.setInt(1, playerId); + rset = statement.executeQuery(); + + while (rset.next()) + { + rebirthCount = rset.getInt("rebirthCount"); + } + + rset.close(); + statement.close(); + + } + catch(Exception e) + { + e.printStackTrace(); + } + finally + { + try + { + con.close(); + } + catch (Exception e) + { + + } + } + _playersRebirthInfo.put(playerId, rebirthCount); + } + + /** Stores the player's information in the DB. */ + public void storePlayerBirth(L2PcInstance player) + { + Connection con = null; + try + { + con = L2DatabaseFactory.getInstance().getConnection(); + PreparedStatement statement = con.prepareStatement + ("INSERT INTO `rebirth_manager` (playerId,rebirthCount) VALUES (?,1)"); + statement.setInt(1, player.getObjectId()); + statement.execute(); + + _playersRebirthInfo.put(player.getObjectId(), 1); + + } + catch(Exception e) + { + e.printStackTrace(); + } + finally + { + try + { + con.close(); + } + catch (Exception e) + { + } + } + } + + /** Updates the player's information in the DB. */ + public void updatePlayerBirth(L2PcInstance player,int newRebirthCount) + { + Connection con = null; + try + { + int playerId = player.getObjectId(); + + con = L2DatabaseFactory.getInstance().getConnection(); + PreparedStatement statement = con.prepareStatement + ("UPDATE `rebirth_manager` SET rebirthCount = ? WHERE playerId = ?"); + statement.setInt(1, newRebirthCount); + statement.setInt(2, playerId); + statement.execute(); + + _playersRebirthInfo.put(playerId, newRebirthCount); + + } + catch(Exception e) + { + e.printStackTrace(); + } + finally + { + try + { + con.close(); + } + catch (Exception e) + { + } + } + } +} Index: /trunk/gameserver/java/net/sf/l2j/Config.java =================================================================== --- /trunk/gameserver/java/net/sf/l2j/Config.java (revision 282) +++ /trunk/gameserver/java/net/sf/l2j/Config.java (revision 311) @@ -63,4 +63,25 @@ public static boolean ALLOW_LOGIN_OPTIMIZE; + /** Rebirth Engine */ + public static boolean REBIRTH_ALLOW_REBIRTH; + public static int REBIRTH_MIN_LEVEL; + public static int REBIRTH_ITEM1_NEEDED; + public static int REBIRTH_ITEM1_AMOUNT; + public static int REBIRTH_ITEM2_NEEDED; + public static int REBIRTH_ITEM2_AMOUNT; + public static int REBIRTH_ITEM3_NEEDED; + public static int REBIRTH_ITEM3_AMOUNT; + public static int REBIRTH_MAGE_SKILL1_ID; + public static int REBIRTH_MAGE_SKILL1_LEVEL; + public static int REBIRTH_MAGE_SKILL2_ID; + public static int REBIRTH_MAGE_SKILL2_LEVEL; + public static int REBIRTH_MAGE_SKILL3_ID; + public static int REBIRTH_MAGE_SKILL3_LEVEL; + public static int REBIRTH_FIGHTER_SKILL1_ID; + public static int REBIRTH_FIGHTER_SKILL1_LEVEL; + public static int REBIRTH_FIGHTER_SKILL2_ID; + public static int REBIRTH_FIGHTER_SKILL2_LEVEL; + public static int REBIRTH_FIGHTER_SKILL3_ID; + public static int REBIRTH_FIGHTER_SKILL3_LEVEL; // CTF EVENT OPEN @@ -2276,4 +2297,25 @@ is.close(); + REBIRTH_ALLOW_REBIRTH = Boolean.parseBoolean(additionsSettings.getProperty("REBIRTH_ALLOW_REBIRTH", "False")); + REBIRTH_MIN_LEVEL = Integer.parseInt(additionsSettings.getProperty("REBIRTH_MIN_LEVEL","80")); + REBIRTH_ITEM1_NEEDED = Integer.parseInt(additionsSettings.getProperty("REBIRTH_ITEM1_NEEDED","0")); + REBIRTH_ITEM1_AMOUNT = Integer.parseInt(additionsSettings.getProperty("REBIRTH_ITEM1_AMOUNT","0")); + REBIRTH_ITEM2_NEEDED = Integer.parseInt(additionsSettings.getProperty("REBIRTH_ITEM2_NEEDED","0")); + REBIRTH_ITEM2_AMOUNT = Integer.parseInt(additionsSettings.getProperty("REBIRTH_ITEM2_AMOUNT","0")); + REBIRTH_ITEM3_NEEDED = Integer.parseInt(additionsSettings.getProperty("REBIRTH_ITEM3_NEEDED","0")); + REBIRTH_ITEM3_AMOUNT = Integer.parseInt(additionsSettings.getProperty("REBIRTH_ITEM3_AMOUNT","0")); + REBIRTH_MAGE_SKILL1_ID = Integer.parseInt(additionsSettings.getProperty("REBIRTH_MAGE_SKILL1_ID","0")); + REBIRTH_MAGE_SKILL1_LEVEL = Integer.parseInt(additionsSettings.getProperty("REBIRTH_MAGE_SKILL1_LEVEL","0")); + REBIRTH_MAGE_SKILL2_ID = Integer.parseInt(additionsSettings.getProperty("REBIRTH_MAGE_SKILL2_ID","0")); + REBIRTH_MAGE_SKILL2_LEVEL = Integer.parseInt(additionsSettings.getProperty("REBIRTH_MAGE_SKILL2_LEVEL","0")); + REBIRTH_MAGE_SKILL3_ID = Integer.parseInt(additionsSettings.getProperty("REBIRTH_MAGE_SKILL3_ID","0")); + REBIRTH_MAGE_SKILL3_LEVEL = Integer.parseInt(additionsSettings.getProperty("REBIRTH_MAGE_SKILL3_LEVEL","0")); + REBIRTH_FIGHTER_SKILL1_ID = Integer.parseInt(additionsSettings.getProperty("REBIRTH_FIGHTER_SKILL1_ID","0")); + REBIRTH_FIGHTER_SKILL1_LEVEL = Integer.parseInt(additionsSettings.getProperty("REBIRTH_FIGHTER_SKILL1_LEVEL","0")); + REBIRTH_FIGHTER_SKILL2_ID = Integer.parseInt(additionsSettings.getProperty("REBIRTH_FIGHTER_SKILL2_ID","0")); + REBIRTH_FIGHTER_SKILL2_LEVEL = Integer.parseInt(additionsSettings.getProperty("REBIRTH_FIGHTER_SKILL2_LEVEL","0")); + REBIRTH_FIGHTER_SKILL3_ID = Integer.parseInt(additionsSettings.getProperty("REBIRTH_FIGHTER_SKILL3_ID","0")); + REBIRTH_FIGHTER_SKILL3_LEVEL = Integer.parseInt(additionsSettings.getProperty("REBIRTH_FIGHTER_SKILL3_LEVEL","0")); + CTF_EVEN_TEAMS = additionsSettings.getProperty("CTFEvenTeams", "BALANCE"); CTF_ALLOW_INTERFERENCE = Boolean.parseBoolean(additionsSettings.getProperty("CTFAllowInterference", "false")); Index: /trunk/gameserver/java/net/sf/l2j/gameserver/clientpackets/RequestBypassToServer.java =================================================================== --- /trunk/gameserver/java/net/sf/l2j/gameserver/clientpackets/RequestBypassToServer.java (revision 288) +++ /trunk/gameserver/java/net/sf/l2j/gameserver/clientpackets/RequestBypassToServer.java (revision 311) @@ -4,4 +4,5 @@ import java.util.logging.Logger; +import net.sf.engine.rebirth.BypassHandler; import net.sf.l2j.Config; import net.sf.l2j.gameserver.ai.CtrlIntention; @@ -168,4 +169,9 @@ player.processQuestEvent(p.substring(0, idx), p.substring(idx).trim()); } + else if(_command.startsWith("custom_")) + { + L2PcInstance player = getClient().getActiveChar(); + BypassHandler.getInstance().handleBypass(player, _command); + } } catch (Exception e) Index: /trunk/gameserver/java/net/sf/l2j/gameserver/clientpackets/EnterWorld.java =================================================================== --- /trunk/gameserver/java/net/sf/l2j/gameserver/clientpackets/EnterWorld.java (revision 271) +++ /trunk/gameserver/java/net/sf/l2j/gameserver/clientpackets/EnterWorld.java (revision 311) @@ -7,4 +7,5 @@ import net.sf.engine.Heroes; +import net.sf.engine.rebirth.WorldHandler; import net.sf.l2j.Base64; import net.sf.l2j.Config; @@ -68,4 +69,5 @@ import net.sf.l2j.util.Rnd; +@SuppressWarnings("unused") public class EnterWorld extends L2GameClientPacket { @@ -364,4 +366,5 @@ } RegionBBSManager.getInstance().changeCommunityBoard(); + WorldHandler.getInstance().enterWorld(activeChar); if (CTF._savePlayers.contains(activeChar.getName())) Index: /trunk/datapack/sql/rebirth_manager.sql =================================================================== --- /trunk/datapack/sql/rebirth_manager.sql (revision 312) +++ /trunk/datapack/sql/rebirth_manager.sql (revision 312) @@ -0,0 +1,13 @@ +-- ---------------------------- +-- Table structure for rebirth_manager +-- ---------------------------- +CREATE TABLE IF NOT EXISTS `rebirth_manager`( + `playerId` int(20) NOT NULL, + `rebirthCount` int(2) NOT NULL, + PRIMARY KEY (`playerId`) +); + + +-- ---------------------------- +-- Records +-- ---------------------------- Index: /trunk/datapack/sql/npc.sql =================================================================== --- /trunk/datapack/sql/npc.sql (revision 193) +++ /trunk/datapack/sql/npc.sql (revision 312) @@ -8377,4 +8377,5 @@ (70010, 31606, "Catrina", 1, "TvT Event Manager", 1, "Monster2.queen_of_cat", 8, 15, 70, "female", "L2TvTEventNpc", 40, 3862, 1493, 11.85, 2.78, 40, 43, 30, 21, 20, 10, 0, 0, 1314, 470, 780, 382, 278, 0, 333, 0, 0, 0, 28, 132, "NULL", 0, 0, 0, "LAST_HIT", 0, 0, 0, "fighter"); +INSERT INTO `npc` VALUES ('55555', '22124', 'Totor', '1', 'Rebirth Manager', '1', 'NPC.a_fighterguild_master_FHuman', '11.00', '27.00', '83', 'male', 'L2Merchant', '40', '3862', '1493', '11.85', '2.78', '40', '43', '30', '21', '20', '10', '0', '0', '1314', '470', '780', '382', '278', '0', '333', '0', '0', '0', '88', '132', null, '0', '0', '0', 'LAST_HIT','0', '0', '0', 'mage'), INSERT INTO `npc` VALUES ('99999', '30134', 'Buffer', '1', 'L2j-Device', '1', 'Monster3.Elite_Mage', '6.50', '21.96', '70', 'male', 'L2Buff', '40', '10', '10', '10.00', '10.00', '40', '43', '30', '21', '20', '10', '0', '0', '10', '470', '10', '382', '278', '0', '333', '6579', '0', '0', '88', '132', null, '0', '0', '0', 'LAST_HIT', '0', '0', '0', 'mage'); INSERT INTO `npc` VALUES ('100000', '30134', 'Color Manager', '1', 'L2j-Device', '1', 'Monster3.Elite_Mage', '6.50', '21.96', '70', 'male', 'L2CustomColorManager', '40', '10', '10', '10.00', '10.00', '40', '43', '30', '21', '20', '10', '0', '0', '10', '470', '10', '382', '278', '0', '333', '6579', '0', '0', '88', '132', null, '0', '0', '0', 'LAST_HIT', '0', '0', '0', 'mage'); Index: /trunk/datapack/tools/Installer.cmd =================================================================== --- /trunk/datapack/tools/Installer.cmd (revision 101) +++ /trunk/datapack/tools/Installer.cmd (revision 312) @@ -379,4 +379,7 @@ %mysqlPath% -h %gshost% -u %gsuser% --password=%gspass% -D %gsdb% < ../sql/ctf_teams.sql @cls +echo ***** ������� 98 ����⮢ ***** +%mysqlPath% -h %gshost% -u %gsuser% --password=%gspass% -D %gsdb% < ../sql/rebirth_manager.sql +@cls echo ***** ������� 100 ����⮢ ***** %mysqlPath% -h %gshost% -u %gsuser% --password=%gspass% -D %gsdb% < ../sql/castle_manor_production.sql Index: /trunk/datapack/tools/full_install.sql =================================================================== --- /trunk/datapack/tools/full_install.sql (revision 21) +++ /trunk/datapack/tools/full_install.sql (revision 312) @@ -84,2 +84,3 @@ DROP TABLE IF EXISTS castle_manor_procure; DROP TABLE IF EXISTS castle_manor_production; +DROP TABLE IF EXISTS rebirth_manager; Index: /trunk/datapack/data/html/default/55555.htm =================================================================== --- /trunk/datapack/data/html/default/55555.htm (revision 312) +++ /trunk/datapack/data/html/default/55555.htm (revision 312) @@ -0,0 +1,16 @@ +<html> +<body> +<title>- Rebirth Request Menu -</title> +<br> +<br> +<br> +So, you wish to be Reborn? +Being Reborn has it's advantages, and it's disadvantages you know. <br> +When you are Reborn you are granted a new bonus skill (listed above), <br> +but your character is reset to level 1 and returned to his starting class. So <br> +choose wisely.<br> +<br> +<br> +<button value=" Request Rebirth " action="bypass -h custom_rebirth_confirmrequest" width=250 height=36 back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df"/> +</body> +</html> Поделиться сообщением Ссылка на сообщение Поделиться на другие сайты