Rebirth error

Support for the latest build of L2J Server, get help here with installations, upgrades, problems.
Do not post bugs reports here, use viewforum.php?f=77 instead.
There is no support for other server builds than the official provided by l2jserver.com
Forum rules
READ NOW: L2j Forums Rules of Conduct
Post Reply
xAddytzu
Posts: 36
Joined: Sat Oct 11, 2008 9:57 am

Rebirth error

Post by xAddytzu »

If you want to receive support we need this info to help you properly.
» Find Revision
L2J Revision Number:
L2JDP Revision Number:
compile:
    [javac] Compiling 1234 source files to C:\Documents and Settings\xdditzu\Desktop\Lineage2\L2Java\L2_GameServer\build\classes
    [javac] C:\Documents and Settings\xdditzu\Desktop\Lineage2\L2Java\L2_GameServer\java\net\sf\l2j\gameserver\model\rebirth\RebirthManager.java:228: cannot find symbol
    [javac] symbol  : method destroyItem(java.lang.String,net.sf.l2j.gameserver.model.L2ItemInstance,int,net.sf.l2j.gameserver.model.actor.instance.L2PcInstance,<nulltype>)
    [javac] location: class net.sf.l2j.gameserver.model.PcInventory
    [javac] player.getInventory().destroyItem("Rebirth Engine", itemNeeded, itemAmount, player, null);
    [javac]                              ^
    [javac] Note: C:\Documents and Settings\xdditzu\Desktop\Lineage2\L2Java\L2_GameServer\java\net\sf\l2j\gameserver\GeoEngine.java uses or overrides a deprecated API.
    [javac] Note: Recompile with -Xlint:deprecation for details.
    [javac] 1 error
User avatar
janiii
L2j Veteran
L2j Veteran
Posts: 4269
Joined: Wed May 28, 2008 3:15 pm
Location: Slovakia

Re: Rebirth error

Post by janiii »

itemAmount needs to be of type long if you have latest revision.
DO NOT EVEN TRY TO MESS WITH ME!
forum flOOder dancing dEVILoper
I don't give private support - PM will be ignored!
xAddytzu
Posts: 36
Joined: Sat Oct 11, 2008 9:57 am

Re: Rebirth error

Post by xAddytzu »

if I don't have last rev, can do something
xAddytzu
Posts: 36
Joined: Sat Oct 11, 2008 9:57 am

Re: Rebirth error

Post by xAddytzu »

janiii can u help me ?? please
User avatar
janiii
L2j Veteran
L2j Veteran
Posts: 4269
Joined: Wed May 28, 2008 3:15 pm
Location: Slovakia

Re: Rebirth error

Post by janiii »

i dont know your code, and i dont know your revision. if you are using eclipse, it suggests you the solution if there is some problem in code.
DO NOT EVEN TRY TO MESS WITH ME!
forum flOOder dancing dEVILoper
I don't give private support - PM will be ignored!
xAddytzu
Posts: 36
Joined: Sat Oct 11, 2008 9:57 am

Re: Rebirth error

Post by xAddytzu »

Look the code

Code: Select all

 Index: C:/Documents and Settings/Admin/Desktop/Pandora/WorkSpace/L2J Stock/java/net/sf/l2j/Config.java===================================================================--- C:/Documents and Settings/Admin/Desktop/Pandora/WorkSpace/L2J Stock/java/net/sf/l2j/Config.java (revision 2589)+++ C:/Documents and Settings/Admin/Desktop/Pandora/WorkSpace/L2J Stock/java/net/sf/l2j/Config.java (working copy)@@ -40,11 +40,10 @@ public final class Config {    protected static final Logger _log = Logger.getLogger(Config.class.getName());-       /******************************************************************************************************************************************************/     /** L2J Property File Definitions Start Here**/    /******************************************************************************************************************************************************/-   +       /** Properties file for Character Configurations */     public static final String  CHARACTER_CONFIG_FILE                          = "./config/Character.properties";     /** Properties file for Dynamic Extensions*/@@ -88,6 +87,93 @@     /** L2J Variable Definitions Start Here**/    /******************************************************************************************************************************************************/    +   +   /******************************************************************************************************************************************************/+    /** Jstar's Custom Material ~ Start **/+   /******************************************************************************************************************************************************/+   /** Properties file for Jstar's Custom Content */+    public static final String  JSTAR_CUSTOM_CONTENT                           = "./config/JstarCustom.properties";+    +    /** Rebirth Engine */+       /* General Information */+       public static boolean REBIRTH_ALLOW_REBIRTH;+       public static int REBIRTH_MIN_LEVEL;+       +       /* Items required per rebirth 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;+       +       /* Bonus skills and levels for Mages or Fighters */+       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;+   +   /** Loads the custom content Configuration File. */+   public static void loadJstarContent(){+       try{+           _log.info("Loading Jstar's Content");+           Properties customContent = new Properties();+           InputStream input = new FileInputStream(new File(JSTAR_CUSTOM_CONTENT));+           customContent.load(input);+           +           /* General Information */+           REBIRTH_ALLOW_REBIRTH          = Boolean.parseBoolean(customContent.getProperty("REBIRTH_ALLOW_REBIRTH", "False"));+           REBIRTH_MIN_LEVEL              = Integer.parseInt(customContent.getProperty("REBIRTH_MIN_LEVEL","80"));+           +           REBIRTH_ITEM1_NEEDED           = Integer.parseInt(customContent.getProperty("REBIRTH_ITEM1_NEEDED","0"));+           REBIRTH_ITEM1_AMOUNT           = Integer.parseInt(customContent.getProperty("REBIRTH_ITEM1_AMOUNT","0"));+           REBIRTH_ITEM2_NEEDED           = Integer.parseInt(customContent.getProperty("REBIRTH_ITEM2_NEEDED","0"));+           REBIRTH_ITEM2_AMOUNT           = Integer.parseInt(customContent.getProperty("REBIRTH_ITEM2_AMOUNT","0"));+           REBIRTH_ITEM3_NEEDED           = Integer.parseInt(customContent.getProperty("REBIRTH_ITEM3_NEEDED","0"));+           REBIRTH_ITEM3_AMOUNT           = Integer.parseInt(customContent.getProperty("REBIRTH_ITEM3_AMOUNT","0"));+           +           REBIRTH_MAGE_SKILL1_ID         = Integer.parseInt(customContent.getProperty("REBIRTH_MAGE_SKILL1_ID","0"));+           REBIRTH_MAGE_SKILL1_LEVEL      = Integer.parseInt(customContent.getProperty("REBIRTH_MAGE_SKILL1_LEVEL","0"));+           REBIRTH_MAGE_SKILL2_ID         = Integer.parseInt(customContent.getProperty("REBIRTH_MAGE_SKILL2_ID","0"));+           REBIRTH_MAGE_SKILL2_LEVEL      = Integer.parseInt(customContent.getProperty("REBIRTH_MAGE_SKILL2_LEVEL","0"));+           REBIRTH_MAGE_SKILL3_ID         = Integer.parseInt(customContent.getProperty("REBIRTH_MAGE_SKILL3_ID","0"));+           REBIRTH_MAGE_SKILL3_LEVEL      = Integer.parseInt(customContent.getProperty("REBIRTH_MAGE_SKILL3_LEVEL","0"));+           REBIRTH_FIGHTER_SKILL1_ID      = Integer.parseInt(customContent.getProperty("REBIRTH_FIGHTER_SKILL1_ID","0"));+           REBIRTH_FIGHTER_SKILL1_LEVEL   = Integer.parseInt(customContent.getProperty("REBIRTH_FIGHTER_SKILL1_LEVEL","0"));+           REBIRTH_FIGHTER_SKILL2_ID      = Integer.parseInt(customContent.getProperty("REBIRTH_FIGHTER_SKILL2_ID","0"));+           REBIRTH_FIGHTER_SKILL2_LEVEL   = Integer.parseInt(customContent.getProperty("REBIRTH_FIGHTER_SKILL2_LEVEL","0"));+           REBIRTH_FIGHTER_SKILL3_ID      = Integer.parseInt(customContent.getProperty("REBIRTH_FIGHTER_SKILL3_ID","0"));+           REBIRTH_FIGHTER_SKILL3_LEVEL   = Integer.parseInt(customContent.getProperty("REBIRTH_FIGHTER_SKILL3_LEVEL","0"));+       }+        catch (Exception e)+        {+            e.printStackTrace();+            throw new Error("Failed to Load "+JSTAR_CUSTOM_CONTENT+" File.");+        }+     +   }+   +   +   +   +   +   +   +   /******************************************************************************************************************************************************/+    /** Jstar's Custom Material ~ Finish **/+   /******************************************************************************************************************************************************/+   +   +    +       /** ************************************************** **/    /** Character Settings -Begin                          **/    /** ************************************************** **/@@ -911,6 +997,9 @@             InputStream is = null;             try             {+               /* Jstar's Custom Content */+               loadJstarContent();+                               try {                    Properties serverSettings    = new Properties();                    is                           = new FileInputStream(new File(CONFIGURATION_FILE));Index: C:/Documents and Settings/Admin/Desktop/Pandora/WorkSpace/L2J Stock/java/net/sf/l2j/gameserver/network/clientpackets/RequestBypassToServer.java===================================================================--- C:/Documents and Settings/Admin/Desktop/Pandora/WorkSpace/L2J Stock/java/net/sf/l2j/gameserver/network/clientpackets/RequestBypassToServer.java (revision 2589)+++ C:/Documents and Settings/Admin/Desktop/Pandora/WorkSpace/L2J Stock/java/net/sf/l2j/gameserver/network/clientpackets/RequestBypassToServer.java (working copy)@@ -34,6 +34,8 @@ import net.sf.l2j.gameserver.network.serverpackets.ActionFailed; import net.sf.l2j.gameserver.network.serverpackets.NpcHtmlMessage; +import custom.handlers.BypassHandler;+ /**  * This class ...  *@@ -172,6 +174,12 @@                else                    player.processQuestEvent(p.substring(0, idx), p.substring(idx).trim());            }+           +           // Jstar's Custom Bypass Caller!+           else if(_command.startsWith("custom_")){+               L2PcInstance player = getClient().getActiveChar();+               BypassHandler.getInstance().handleBypass(player, _command);+           }        }        catch (Exception e)        {Index: C:/Documents and Settings/Admin/Desktop/Pandora/WorkSpace/L2J Stock/java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java===================================================================--- C:/Documents and Settings/Admin/Desktop/Pandora/WorkSpace/L2J Stock/java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java    (revision 2589)+++ C:/Documents and Settings/Admin/Desktop/Pandora/WorkSpace/L2J Stock/java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java    (working copy)@@ -74,6 +74,9 @@ import net.sf.l2j.gameserver.network.serverpackets.SystemMessage; import net.sf.l2j.gameserver.network.serverpackets.UserInfo; import net.sf.l2j.gameserver.util.FloodProtector;++import custom.handlers.WorldHandler;+ /**  * Enter World Packet Handler<p>  * <p>@@ -361,6 +364,9 @@         RegionBBSManager.getInstance().changeCommunityBoard();                  TvTEvent.onLogin(activeChar);+        +        //Jstar's Custom Enter World Caller. - No need to add so much to the core! 2 Lines ftw!+        WorldHandler.getInstance().enterWorld(activeChar);     }      /**Index: C:/Documents and Settings/Admin/Desktop/Pandora/WorkSpace/L2J Stock/java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java===================================================================--- C:/Documents and Settings/Admin/Desktop/Pandora/WorkSpace/L2J Stock/java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java   (revision 2589)+++ C:/Documents and Settings/Admin/Desktop/Pandora/WorkSpace/L2J Stock/java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java   (working copy)@@ -2418,7 +2418,7 @@     * Give all available skills to the player.<br><br>     *     */-   private void giveAvailableSkills()+   public void giveAvailableSkills()    {        int unLearnable = 0;        int skillCounter = 0;Index: C:/Documents and Settings/Admin/Desktop/Pandora/WorkSpace/L2J Stock/java/net/sf/l2j/gameserver/handler/AdminCommandHandler.java===================================================================--- C:/Documents and Settings/Admin/Desktop/Pandora/WorkSpace/L2J Stock/java/net/sf/l2j/gameserver/handler/AdminCommandHandler.java (revision 2589)+++ C:/Documents and Settings/Admin/Desktop/Pandora/WorkSpace/L2J Stock/java/net/sf/l2j/gameserver/handler/AdminCommandHandler.java (working copy)@@ -21,6 +21,8 @@ import net.sf.l2j.Config; import net.sf.l2j.gameserver.handler.admincommandhandlers.*; +import custom.handlers.CustomAdminHandler;+ /**  * This class ...  *@@ -101,6 +103,10 @@        registerAdminCommandHandler(new AdminGeoEditor());        registerAdminCommandHandler(new AdminManor());        registerAdminCommandHandler(new AdminTvTEvent());+       +       //Jstar's Custom Admin Controller.+       registerAdminCommandHandler(new CustomAdminHandler());+               _log.config("AdminCommandHandler: Loaded " + _datatable.size() + " handlers.");    }    Index: C:/Documents and Settings/Admin/Desktop/Pandora/WorkSpace/L2J Stock/java/custom/handlers/BypassHandler.java===================================================================--- C:/Documents and Settings/Admin/Desktop/Pandora/WorkSpace/L2J Stock/java/custom/handlers/BypassHandler.java (revision 0)+++ C:/Documents and Settings/Admin/Desktop/Pandora/WorkSpace/L2J Stock/java/custom/handlers/BypassHandler.java (revision 0)@@ -0,0 +1,52 @@+/*+ * 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 custom.handlers;++import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;++import custom.model.rebirth.RebirthManager;++/**+ * 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: C:/Documents and Settings/Admin/Desktop/Pandora/WorkSpace/L2J Stock/java/custom/handlers/CustomAdminHandler.java===================================================================--- C:/Documents and Settings/Admin/Desktop/Pandora/WorkSpace/L2J Stock/java/custom/handlers/CustomAdminHandler.java    (revision 0)+++ C:/Documents and Settings/Admin/Desktop/Pandora/WorkSpace/L2J Stock/java/custom/handlers/CustomAdminHandler.java    (revision 0)@@ -0,0 +1,47 @@+/*+ * 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 custom.handlers;++import net.sf.l2j.Config;+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 CustomAdminHandler implements IAdminCommandHandler+{+   private static final String[] ADMIN_COMMANDS =+   {+       "admin_custom_reconfig"+   };+   +   public boolean useAdminCommand(String command, L2PcInstance player)+   {+       if(command.startsWith("admin_custom_reconfig")){+           Config.loadJstarContent();+           player.sendMessage("Successfully reloaded the 'Custom Content' config file.");+       }+       +       return true;+   }+   +   public String[] getAdminCommandList()+   {+       return ADMIN_COMMANDS;+   }+}Index: C:/Documents and Settings/Admin/Desktop/Pandora/WorkSpace/L2J Stock/java/custom/handlers/WorldHandler.java===================================================================--- C:/Documents and Settings/Admin/Desktop/Pandora/WorkSpace/L2J Stock/java/custom/handlers/WorldHandler.java  (revision 0)+++ C:/Documents and Settings/Admin/Desktop/Pandora/WorkSpace/L2J Stock/java/custom/handlers/WorldHandler.java  (revision 0)@@ -0,0 +1,53 @@+/*+ * 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 custom.handlers;++import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;++import custom.model.rebirth.RebirthManager;++/**+ *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: C:/Documents and Settings/Admin/Desktop/Pandora/WorkSpace/L2J Stock/java/custom/model/rebirth/RebirthManager.java===================================================================--- C:/Documents and Settings/Admin/Desktop/Pandora/WorkSpace/L2J Stock/java/custom/model/rebirth/RebirthManager.java   (revision 0)+++ C:/Documents and Settings/Admin/Desktop/Pandora/WorkSpace/L2J Stock/java/custom/model/rebirth/RebirthManager.java   (revision 0)@@ -0,0 +1,384 @@+/*+ * 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 custom.model.rebirth;++import java.sql.PreparedStatement;+import java.sql.ResultSet;+import java.util.HashMap;+import javolution.text.TextBuilder;+//import javolution.util.FastList;+//import java.util.StringTokenizer;++import net.sf.l2j.Config;+import net.sf.l2j.L2DatabaseFactory;+import net.sf.l2j.gameserver.datatables.SkillTable;+import net.sf.l2j.gameserver.datatables.ItemTable;+//import net.sf.l2j.gameserver.cache.HtmCache;+import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;+import net.sf.l2j.gameserver.model.base.Experience;+import net.sf.l2j.gameserver.model.L2ItemInstance;+import net.sf.l2j.gameserver.model.L2Skill;+import net.sf.l2j.gameserver.network.serverpackets.CreatureSay;+import net.sf.l2j.gameserver.network.serverpackets.ExShowScreenMessage;+import net.sf.l2j.gameserver.network.serverpackets.MagicSkillUse;+import net.sf.l2j.gameserver.network.serverpackets.NpcHtmlMessage;+import net.sf.l2j.gameserver.network.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); //Returns the player's current birth level+           if(currBirth >= 3){//Don't send html if player is already at max rebirth count.+               player.sendMessage("You are currently at your maximum rebirth count!");+               return;+           }+           boolean isMage = player.getBaseTemplate().classId.isMage(); //Returns true if BASE CLASS is a mage.+           L2Skill skill = getRebirthSkill((currBirth + 1), isMage);//Returns the skill based on next Birth and if isMage.+           +           String icon = ""+skill.getId();//Returns the skill's id.+           if(icon.length() < 4){//Incase the skill is only 3 digits.+               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>- Rebirth Request Menu -</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.+       MagicSkillUse  MSU = new MagicSkillUse(player, player, 2024, 1, 1, 0);//Fireworks Display+       player.broadcastPacket(MSU);+       ExShowScreenMessage screen = new ExShowScreenMessage("Congratulations "+player.getName()+"! You have been Reborn!", 15000);+       player.sendPacket(screen);+   }+   +   /** 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().destroyItem("Rebirth Engine", itemNeeded, 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;+       +       java.sql.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){+       java.sql.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){+       java.sql.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){}+        }+   }+}+++++++++++++++++++++++++++++ 
User avatar
janiii
L2j Veteran
L2j Veteran
Posts: 4269
Joined: Wed May 28, 2008 3:15 pm
Location: Slovakia

Re: Rebirth error

Post by janiii »

check the error in eclipse, really. check for that itemAmount, if it should not be of type long, dont know your code you are using (i mean your whole code). if you dont give the info of your revision, i cant help you, sorry.
DO NOT EVEN TRY TO MESS WITH ME!
forum flOOder dancing dEVILoper
I don't give private support - PM will be ignored!
xAddytzu
Posts: 36
Joined: Sat Oct 11, 2008 9:57 am

Re: Rebirth error

Post by xAddytzu »

i use interlude..
Eragon
Posts: 82
Joined: Thu Apr 21, 2005 2:14 pm

Re: Rebirth error

Post by Eragon »

Doesnt this thread belong to the Legacy Support Section ?
xAddytzu
Posts: 36
Joined: Sat Oct 11, 2008 9:57 am

Re: Rebirth error

Post by xAddytzu »

my mistake, but nobody can't help me?
xAddytzu
Posts: 36
Joined: Sat Oct 11, 2008 9:57 am

Re: Rebirth error

Post by xAddytzu »

Solved !
Post Reply