Jump to content
  • 0

Rebirth system for L2j aCis


Question

Recommended Posts

  • 0
Posted
<npc id="35010" name="Mercenary" title="">
		<set name="level" val="67"/>
		<set name="radius" val="8"/>
		<set name="height" val="24"/>
		<set name="rHand" val="128"/>
		<set name="lHand" val="628"/>
		<set name="type" val="L2RebirthInstance"/>
		<set name="exp" val="449"/>
		<set name="sp" val="1"/>
		<set name="hp" val="2295.48154"/>
		<set name="mp" val="1251"/>
		<set name="hpRegen" val="7.5"/>
		<set name="mpRegen" val="2.7"/>
		<set name="pAtk" val="624.93199"/>
		<set name="pDef" val="281.55251"/>
		<set name="mAtk" val="426.74754"/>
		<set name="mDef" val="206.02791"/>
		<set name="crit" val="4"/>
		<set name="atkSpd" val="253"/>
		<set name="str" val="40"/>
		<set name="int" val="21"/>
		<set name="dex" val="30"/>
		<set name="wit" val="20"/>
		<set name="con" val="43"/>
		<set name="men" val="20"/>
		<set name="corpseTime" val="7"/>
		<set name="walkSpd" val="50"/>
		<set name="runSpd" val="195"/>
		<set name="dropHerbGroup" val="0"/>
		<ai type="DEFAULT" ssCount="0" ssRate="0" spsCount="0" spsRate="0" aggro="0" clan="door_clan;mercenary_siege_clan" clanRange="1200" canMove="true" seedable="false"/>
		<skills>
			<skill id="4045" level="1"/>
			<skill id="4416" level="23"/>
		</skills>
	</npc>

I make this npc

  • 0
Posted

I try every possible variants, no work , in code, i have sme syntax, but i don't know to make that HTML and ByPasses.

if (command.startsWith("performRebirth"))
		{
			// Maximum rebirth count. Return the player's current Rebirth Level.
			int currBirth = getRebirthLevel(player);
			if (currBirth >= Config.REBIRTH_MAX)
			{
				NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
				html.setFile("data/html/managers/rebirth-max.htm");
				
				player.sendPacket(html);
				return;
			}
			
			// Level requirement for a rebirth.
			if (player.getLevel() < Config.REBIRTH_MIN_LEVEL)
			{
				NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
				html.setFile("data/html/managers/rebirth-level.htm");
				
				player.sendPacket(html);
				return;
			}
			
			int itemId = 0, itemCount = 0, loopBirth = 0;
			for (String readItems : Config.REBIRTH_ITEMS)
			{
				String[] currItem = readItems.split(",");
				if (loopBirth == currBirth)
				{
					itemId = Integer.parseInt(currItem[0]);
					itemCount = Integer.parseInt(currItem[1]);
					break;
				}
				loopBirth++;
			}
			
			// Rewards the player with an item.
			rebirthItemReward(player, itemId, itemCount);
			
			// Check and see if its the player's first rebirth calling.
			boolean firstBirth = currBirth == 0;
			
			// Player meets requirements and starts Rebirth process.
			grantRebirth(player, (currBirth + 1), firstBirth);
		}
		else
			super.onBypassFeedback(player, command);
	}
	
	@Override
	public void showChatWindow(L2PcInstance player)
	{
		NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
		html.setFile("data/html/managers/rebirth.htm");
		html.replace("%objectId%", String.valueOf(getObjectId()));
		html.replace("%level%", + Config.REBIRTH_RETURN_TO_LEVEL);
		
		player.sendPacket(html);

 

  • 0
Posted

Ok guys, i make something, and now, i need again config ByPass.

Here is in game HTML http://hqXSGkS.jpg

 

 

Here is it my bypass

<button action="bypass -h npc_%objectId%_performRebirth" value="Rebirth" width=130 height=30 back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df">

and , my question is, How i can update the bypass to work link for rebirth from picture?

Here it is Java code

/*
 * 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.l2j.gameserver.model.actor.instance;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.HashMap;

import net.sf.l2j.Config;
import net.sf.l2j.L2DatabaseFactory;
import net.sf.l2j.gameserver.model.base.Experience;
import net.sf.l2j.gameserver.model.item.instance.ItemInstance;
import net.sf.l2j.gameserver.model.L2Skill;
import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
import net.sf.l2j.gameserver.network.SystemMessageId;
import net.sf.l2j.gameserver.network.serverpackets.NpcHtmlMessage;
import net.sf.l2j.gameserver.network.serverpackets.StatusUpdate;
import net.sf.l2j.gameserver.network.serverpackets.SystemMessage;
import net.sf.l2j.gameserver.model.actor.template.NpcTemplate;

/**
 * Rebirth Manager
 * @author Trance
 * @skype chr.trance
 */
public final class L2RebirthInstance extends L2NpcInstance
{
	private static HashMap<Integer, Integer> _rebirthInfo = new HashMap<>();
	
	public L2RebirthInstance(int objectId, NpcTemplate template)
	{
		super(objectId, template);
	}
	
	@Override
	public void onBypassFeedback(L2PcInstance player, String command)
	{
		if (command.startsWith("performRebirth"))
		{
			// Maximum rebirth count. Return the player's current Rebirth Level.
			int currBirth = getRebirthLevel(player);
			if (currBirth >= Config.REBIRTH_MAX)
			{
				NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
				html.setFile("data/html/default/30428.htm");
				
				player.sendPacket(html);
				return;
			}
			
			// Level requirement for a rebirth.
			if (player.getLevel() < Config.REBIRTH_MIN_LEVEL)
			{
				NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
				html.setFile("data/html/default/30428.htm");
				
				player.sendPacket(html);
				return;
			}
			
			int itemId = 0, itemCount = 0, loopBirth = 0;
			for (String readItems : Config.REBIRTH_ITEMS)
			{
				String[] currItem = readItems.split(",");
				if (loopBirth == currBirth)
				{
					itemId = Integer.parseInt(currItem[0]);
					itemCount = Integer.parseInt(currItem[1]);
					break;
				}
				loopBirth++;
			}
			
			// Rewards the player with an item.
			rebirthItemReward(player, itemId, itemCount);
			
			// Check and see if its the player's first rebirth calling.
			boolean firstBirth = currBirth == 0;
			
			// Player meets requirements and starts Rebirth process.
			grantRebirth(player, (currBirth + 1), firstBirth);
		}
		else
			super.onBypassFeedback(player, command);
	}
	
	@Override
	public void showChatWindow(L2PcInstance player)
	{
		NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
		html.setFile("data/html/default/30428.htm");
		html.replace("%objectId%", String.valueOf(getObjectId()));
		html.replace("%level%", + Config.REBIRTH_RETURN_TO_LEVEL);
		
		player.sendPacket(html);
    }
	
	/**
	 * Physically rewards player and resets status to nothing.
	 *
	 * @param player the player
	 * @param newBirthCount the new birth count
	 * @param firstBirth the first birth
	 */
	public void grantRebirth(L2PcInstance player, int newBirthCount, boolean firstBirth)
	{
		try
		{
			// Delevel.
			player.removeExpAndSp(player.getExp() - Experience.LEVEL[Config.REBIRTH_RETURN_TO_LEVEL], 0);
			
			// Back to the first class.
			player.setClassId(player.getClassId().getFirstClass().getId());
			
			// Send the Server->Client packet StatusUpdate with current HP, MP and CP to this L2PcInstance
			player.broadcastStatusUpdate();
			
			// Broadcast informations from a user to himself and his knownlist.
			player.broadcastUserInfo();
			
			// Remove the player's current skills.
			for (L2Skill skill : player.getSkills().values())
				player.removeSkill(skill);
			
			// Give all available skills to the player.
			player.giveAvailableSkills();
			
			// Update L2PcInstance stats in the characters table of the database.
			player.store();
			
			if (firstBirth)
				// Stores the player's information in the DB.
				storePlayerBirth(player);
			else
				// Updates the player's information in the DB.
				updatePlayerBirth(player, newBirthCount);
			
			// Displays a congratulation window to the player.
			NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
			html.setFile("data/html/managers/rebirth-successfully.htm");
			html.replace("%level%", + Config.REBIRTH_RETURN_TO_LEVEL);
			
			player.sendPacket(html);
		}
		catch (Exception e)
		{
			e.printStackTrace();
		}
	}
	
	/**
	 * Rewards the player with an item.
	 *
	 * @param player the player
	 * @param itemId : Identifier of the item.
	 * @param itemCount : Quantity of items to add.
	 */
	public static void rebirthItemReward(L2PcInstance player, int itemId, int itemCount)
{
		// Incorrect amount.
		if (itemCount <= 0)
			return;
		
		final ItemInstance item = player.getInventory().addItem("Quest", itemId, itemCount, player, player);
		if (item == null)
			return;
		
		// Send message to the client.
		if (itemId == 57)
		{
			SystemMessage smsg = SystemMessage.getSystemMessage(SystemMessageId.EARNED_S1_ADENA);
			smsg.addItemNumber(itemCount);
			player.sendPacket(smsg);
		}
		else
		{
			if (itemCount > 1)
			{
				SystemMessage smsg = SystemMessage.getSystemMessage(SystemMessageId.EARNED_S2_S1_S);
				smsg.addItemName(itemId);
				smsg.addItemNumber(itemCount);
				player.sendPacket(smsg);
			}
			else
			{
				SystemMessage smsg = SystemMessage.getSystemMessage(SystemMessageId.EARNED_ITEM_S1);
				smsg.addItemName(itemId);
				player.sendPacket(smsg);
			}
		}
		
		// Send status update packet.
		StatusUpdate su = new StatusUpdate(player);
		su.addAttribute(StatusUpdate.CUR_LOAD, player.getCurrentLoad());
		player.sendPacket(su);
	}
	
	/**
	 * Return the player's current Rebirth Level.
	 *
	 * @param player the player
     * @return the rebirth level
	 */
	public static int getRebirthLevel(L2PcInstance player)
	{
		int playerId = player.getObjectId();
		if (_rebirthInfo.get(playerId) == null)
			loadRebirthInfo(player);
		
		return _rebirthInfo.get(playerId);
	}
	
	/**
	 * Database caller to retrieve player's current Rebirth Level.
	 *
	 * @param player the player
	 */
	public static void loadRebirthInfo(L2PcInstance player)
	{
		int playerId = player.getObjectId(), rebirthCount = 0;
		
		try (Connection con = L2DatabaseFactory.getInstance().getConnection())
		{
			ResultSet rset;
			PreparedStatement statement = con.prepareStatement("SELECT * FROM `character_rebirths` 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();
		}
		_rebirthInfo.put(playerId, rebirthCount);
	}
	
	/**
	 * Stores the player's information in the DB.
	 *
	 * @param player the player
	 */
	public static void storePlayerBirth(L2PcInstance player)
	{
		try (Connection con = L2DatabaseFactory.getInstance().getConnection())
		{
			PreparedStatement statement = con.prepareStatement("INSERT INTO `character_rebirths` (playerId,rebirthCount) VALUES (?,1)");
			statement.setInt(1, player.getObjectId());
			statement.execute();
			
			_rebirthInfo.put(player.getObjectId(), 1);
		}
		catch (Exception e)
		{
			e.printStackTrace();
		}
	}
	
	/**
	 * Updates the player's information in the DB.
	 *
	 * @param player the player
	 * @param newRebirthCount the new rebirth count
	 */
	public static void updatePlayerBirth(L2PcInstance player, int newRebirthCount)
	{
		int playerId = player.getObjectId();
		
		try (Connection con = L2DatabaseFactory.getInstance().getConnection())
		{
			PreparedStatement statement = con.prepareStatement("UPDATE `character_rebirths` SET rebirthCount = ? WHERE playerId = ?");
			statement.setInt(1, newRebirthCount);
			statement.setInt(2, playerId);
			statement.execute();
			
			_rebirthInfo.put(playerId, newRebirthCount);
		}
		catch (Exception e)
		{
			e.printStackTrace();
		}
	}
}

Thanks to everyone!

  • 0
Posted

hi people. 
I have configured everything for rebirth but when I talk to the npc he tells me that he has no skills to teach. Does anyone know where I could have gone wrong?

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Posts

    • Honestly, I think L2ETINA is worth keeping an eye on again. With the new team coming in, it feels like there’s finally some fresh energy around the project. They’ve got skilled people working on it now, and from what I’ve seen, they’re actually focused on bringing the project back to life and expanding it instead of just making empty promises. I also like the transparency so far. They’re communicating with the community and being open about what they’re working on and where they want to take L2ETINA. Obviously, there’s still a lot to prove and nobody can predict how things will turn out. But compared to before, I’m definitely more optimistic about the project now. I’m going to keep watching the progress and see what the new team can deliver. So far, I like the direction they’re taking.
    • [RED-TEAM REVERSECODE]LINEAGE2 ESSENCE SAMURAI CROW 542 KR [DEVMODE works tested100%pv+sv+nv] ✯✯✯✯✯✯✯✯✯✯✯ UPDATE ✯✯✯✯✯✯✯✯✯✯✯✯✯✯ LINEAGE2 ESSENCE  SAMURAI CROW 542 EU [UPDATE 09.12.2025][LANG:EUROPE-ORIGINAL] Clean System Patch Lineage 2 Core.dll + Engine.dll unpacked*super clean 100% [unpacked  RED-TEAM REVERSECODE-TEAM ] [ Kill game guard ][ Kill FROST ] [ Kill AwesomiumProcess ] [SELL WTS PM ME ] DEVMODE - works tested 100% pv+sv+nv ✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯   ================================================== ✯✯✯✯✯✯✯✯✯✯✯ UPDATE ✯✯✯✯✯✯✯✯✯✯✯✯✯✯ LINEAGE2 ESSENCE  SAMURAI CROW 547 KR [UPDATE 27.01.2026][LANG:KOREAN-ORIGINAL] Clean System Patch Lineage 2 Core.dll + Engine.dll unpacked*super clean 100% [unpacked  RED-TEAM REVERSECODE-TEAM ] [ Kill game guard ][ Kill FROST ] [ Kill AwesomiumProcess ] [SELL WTS PM ME ] DEVMODE - works tested 100% pv+sv+nv ✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯ ================================================== LINEAGE2 Server War: Age of the Legion Protocols:558 [UPDATE 17 03 2026][LANG:KOREAN-ORIGINAL] ✯✯✯✯✯✯✯✯✯✯✯ UPDATE ✯✯✯✯✯✯✯✯✯✯✯✯✯✯ [MAIN] LINEAGE2   Server War: Age of the Legion 558 KR [UPDATE 11 03 2026]][LANG:KOREAN-ORIGINAL] Clean System Patch Lineage 2 Core.dll + Engine.dll unpacked*super clean 100% [unpacked  RED-TEAM REVERSECODE-TEAM ] [ Kill game guard ][ Kill FROST ] [ Kill AwesomiumProcess ] [SELL WTS PM ME ] DEVMODE - works tested 100% pv+sv+nv ✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯   ================================================== [REVERSECODE RED-TEAM]L2 ESSENCE Echo of Elements 557 EU[UPDATE 15.04.2026][LANG:EUROPE-ORIGINAL] ✯✯✯✯✯✯✯✯✯✯✯ UPDATE ✯✯✯✯✯✯✯✯✯✯✯✯✯✯ LINEAGE2 ESSENCE Echo of Elements 557 EU [UPDATE 15.04.2026][LANG:EUROPE-ORIGINAL] Clean System Patch Lineage 2 Core.dll + Engine.dll unpacked*super clean 100% [unpacked  RED-TEAM REVERSECODE-TEAM ] [ Kill game guard ][ Kill FROST ] [ Kill AwesomiumProcess ] [SELL WTS PM ME ] DEVMODE - works tested 100% pv+sv+nv ✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯ ================================================== [REVERSECODE RED-TEAM]L2 ESSENCE Echo of Elements 557 EU[UPDATE 20.04.2026][LANG:EUROPE-ORIGINAL] ✯✯✯✯✯✯✯✯✯✯✯ UPDATE ✯✯✯✯✯✯✯✯✯✯✯✯✯✯ LINEAGE2 ESSENCE Echo of Elements 557 EU [UPDATE 20.04.2026][LANG:EUROPE-ORIGINAL] Clean System Patch Lineage 2 Core.dll + Engine.dll unpacked*super clean 100% [ unpacked  REVERSECODE RED-TEAM ] [ Kill game guard ][ Kill FROST ] [ Kill AwesomiumProcess ] [SELL WTS PM ME ] DEVMODE - works tested 100% pv+sv+nv ✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯ ✯✯✯✯✯✯✯✯✯✯✯ UPDATE ✯✯✯✯✯✯✯✯✯✯✯✯✯✯ LINEAGE2 ESSENCE Celestial Destiny 563 EU [UPDATE 28.07.2026][LANG:EUROPE-ORIGINAL] Clean System Patch Lineage 2 Martial Art: Dragon Attacks the Heavens Unpack NCGuard (Anti-Tamper Protected)  Core.dll + Engine.dll + NWindow.dll super clean 100% [ unpacked  REVERSECODE RED-TEAM ] [ Kill game guard ][ Kill FROST ][ LCID FIX ] [ Kill AwesomiumProcess ] + DEVMODE works tested 100% pv+sv+nv [SELL WTS PM ME ] ✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯ new products in development updates information [MAIN] IRON MASTERS Protocols:591 KR [UPDATE 25.08.2026][LANG:KOREAN-ORIGINAL] ✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯ in my profile there is a link to my discord group  we write all the questions there - if you are interested in something ✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯   PATCH DEVELOPER LABORATORY  REVERSECODE  RED-TEAM  Service Creating Full Clean Patched Systems  Unreal Scripts / Reverse Enginering / Game Client Modifications Portfolio Discord Group https://discord.gg/56EuZyFJj2   ✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯   [  A large selection of Products In our group at the link in the Discord   ] DO NOT LEAVE POSTS IN THIS SECTION IF YOU HAVE ANY QUESTIONS, CONTACT US IN THE DISCORD AND ASK YOUR QUESTIONS. ( prices are shown in green text in the first post ) You can also write in a private message. ( pm forum personal messgame ) those who write about non-existent goods or write insults will be denied services.      
    • 🚀 Full suite available: ChatGPT Plus, Gemini Pro, Claude, Cursor, and Canva Pro with instant automated setup!
  • Topics

×
×
  • Create New...

Important Information

This community uses essential cookies to function properly. Non-essential cookies and third-party services are used only with your consent. Read our Privacy Policy and We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue..