Jump to content
  • 0

[Seach] Rebirth System


Question

Posted

Hello every one i need your help.

 

I seach a rebirth system for L2J Free

 

I find one code but i am not sure if this code is correct.

 

Index: L2PcInstance.java
===================================================================
--- L2PcInstance.java	(revision 3713)
+++ L2PcInstance.java	(working copy)
@@ -260,8 +260,8 @@
    private static final String DELETE_SKILL_SAVE = "DELETE FROM character_skills_save WHERE charId=? AND class_index=?";

    // Character Character SQL String Definitions:
-    private static final String UPDATE_CHARACTER = "UPDATE characters SET level=?,maxHp=?,curHp=?,maxCp=?,curCp=?,maxMp=?,curMp=?,face=?,hairStyle=?,hairColor=?,heading=?,x=?,y=?,z=?,exp=?,expBeforeDeath=?,sp=?,karma=?,pvpkills=?,pkkills=?,rec_have=?,rec_left=?,clanid=?,race=?,classid=?,deletetime=?,title=?,accesslevel=?,online=?,isin7sdungeon=?,clan_privs=?,wantspeace=?,base_class=?,onlinetime=?,in_jail=?,jail_timer=?,newbie=?,nobless=?,pledge_rank=?,subpledge=?,last_recom_date=?,lvl_joined_academy=?,apprentice=?,sponsor=?,varka_ketra_ally=?,clan_join_expiry_time=?,clan_create_expiry_time=?,banchat_timer=?,char_name=?,death_penalty_level=? WHERE charId=?";
-    private static final String RESTORE_CHARACTER = "SELECT account_name, charId, char_name, level, maxHp, curHp, maxCp, curCp, maxMp, curMp, face, hairStyle, hairColor, sex, heading, x, y, z, exp, expBeforeDeath, sp, karma, pvpkills, pkkills, clanid, race, classid, deletetime, cancraft, title, rec_have, rec_left, accesslevel, online, char_slot, lastAccess, clan_privs, wantspeace, base_class, onlinetime, isin7sdungeon, in_jail, jail_timer, banchat_timer, newbie, nobless, pledge_rank, subpledge, last_recom_date, lvl_joined_academy, apprentice, sponsor, varka_ketra_ally, clan_join_expiry_time,clan_create_expiry_time,charViP,death_penalty_level FROM characters WHERE charId=?";
+    private static final String UPDATE_CHARACTER = "UPDATE characters SET level=?,maxHp=?,curHp=?,maxCp=?,curCp=?,maxMp=?,curMp=?,face=?,hairStyle=?,hairColor=?,heading=?,x=?,y=?,z=?,exp=?,expBeforeDeath=?,sp=?,karma=?,pvpkills=?,pkkills=?,rec_have=?,rec_left=?,clanid=?,race=?,classid=?,deletetime=?,title=?,accesslevel=?,online=?,isin7sdungeon=?,clan_privs=?,wantspeace=?,base_class=?,onlinetime=?,in_jail=?,jail_timer=?,newbie=?,nobless=?,pledge_rank=?,subpledge=?,last_recom_date=?,lvl_joined_academy=?,apprentice=?,sponsor=?,varka_ketra_ally=?,clan_join_expiry_time=?,clan_create_expiry_time=?,banchat_timer=?,char_name=?,death_penalty_level=?,rebirths=? WHERE charId=?";
+    private static final String RESTORE_CHARACTER = "SELECT account_name, charId, char_name, level, maxHp, curHp, maxCp, curCp, maxMp, curMp, face, hairStyle, hairColor, sex, heading, x, y, z, exp, expBeforeDeath, sp, karma, pvpkills, pkkills, clanid, race, classid, deletetime, cancraft, title, rec_have, rec_left, accesslevel, online, char_slot, lastAccess, clan_privs, wantspeace, base_class, onlinetime, isin7sdungeon, in_jail, jail_timer, banchat_timer, newbie, nobless, pledge_rank, subpledge, last_recom_date, lvl_joined_academy, apprentice, sponsor, varka_ketra_ally, clan_join_expiry_time,clan_create_expiry_time,charViP,death_penalty_level,rebirths FROM characters WHERE charId=?";

    // Character Subclass SQL String Definitions:
    private static final String RESTORE_CHAR_SUBCLASSES = "SELECT class_id,exp,sp,level,class_index FROM character_subclasses WHERE charId=? ORDER BY class_index ASC";
@@ -693,6 +693,9 @@
    //Death Penalty Buff Level
    private int _deathPenaltyBuffLevel = 0;

+    // Rebirth limit support
+    private int _rebirths = 0;
+
    private boolean _hero = false;
    private boolean _noble = false;
    private boolean _inOlympiadMode = false;
@@ -6197,6 +6200,7 @@
                player.setLvlJoinedAcademy(rset.getInt("lvl_joined_academy"));
                player.setAllianceWithVarkaKetra(rset.getInt("varka_ketra_ally"));
                player.setDeathPenaltyBuffLevel(rset.getInt("death_penalty_level"));
+		player.setRebirths(rset.getInt("rebirths");

                
                // Add the L2PcInstance object in _allObjects
@@ -6565,7 +6569,8 @@
            statement.setLong(48, getBanChatTimer());
            statement.setString(49, getName());
            statement.setLong(50, getDeathPenaltyBuffLevel());
-            statement.setInt(51, getObjectId());
+            statement.setInt(51, getRebirths());
+            statement.setInt(52, getObjectId());
            statement.execute();
            statement.close();
        }
@@ -11655,6 +11660,16 @@
		_deathPenaltyBuffLevel = level;
	}

+	public int getRebirths()
+	{
+		return _rebirths;
+	}
+
+	public void setRebirths(int rebirths)
+	{
+		_rebirths = rebirths;
+	}
+
	public void calculateDeathPenaltyBuffLevel(L2Character killer)
	{
		if( !(killer instanceof L2PlayableInstance)
[/Code]

 
[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 net.sf.l2j.gameserver.datatables.SkillTable;
import net.sf.l2j.gameserver.model.L2Skill;
import net.sf.l2j.gameserver.model.base.ClassId;
import net.sf.l2j.gameserver.model.base.Experience;
import net.sf.l2j.gameserver.network.SystemMessageId;
import net.sf.l2j.gameserver.network.serverpackets.SystemMessage;
import net.sf.l2j.gameserver.network.serverpackets.NpcHtmlMessage;
import net.sf.l2j.gameserver.templates.L2NpcTemplate;

/**
* Rebirth Npc's Instance
* 
* @author HanWik
*/

public class L2RebirthMasterInstance extends L2FolkInstance
{
int count; // how many of the item should be given?
int skillId; // which skill ID should be given?
int _maxRebirths; // how many rebirths are allowed?

public L2RebirthMasterInstance(int objectId, L2NpcTemplate template)
{
	super(objectId, template);
}

@Override
public void onBypassFeedback(L2PcInstance player, String command)
{
	if (command.startsWith("Rebirth"))
	{
		ClassId classId = player.getClassId();
		int jobLevel = classId.level();

		if (player.getLevel() >= 85 && jobLevel == 3 && !player.isSubClassActive() && player.getRebirths() <= _maxRebirths)
		{
			L2Skill skill=null;

			int levelval = player.getRebirths() + 1;
			skill = SkillTable.getInstance().getInfo(skillId,levelval);

			player.addSkill(skill, true);

			player.sendSkillList();

			ClassId _baseClass = classId;
           			for (ClassId child : ClassId.values())
			{
           				if (classId.childOf(child))
				{
					_baseClass = child;
					for (ClassId child2 : ClassId.values())
					{
						if (_baseClass.childOf(child2))
						{
							_baseClass = child2;
							for (ClassId child3 : ClassId.values())
							{
								if (_baseClass.childOf(child3))
									_baseClass = child3;
							}
						}
					}
				}
			}

			for (L2Skill skill : player.getAllSkills())
				if (skill.getId() != skillId)
					player.removeSkill(skill);

			player.sendSkillList();

			player.setClassId(_baseClass.getId());
       
			player.setBaseClass(player.getActiveClass());

			player.broadcastUserInfo();

			player.rewardSkills();

			// system sound for 1st and 2nd occupation
			player.sendPacket(new SystemMessage(SystemMessageId.CLASS_TRANSFER));
			// Update the overloaded status of the L2PcInstance
			player.refreshOverloaded();
			// Update the expertise status of the L2PcInstance
			player.refreshExpertisePenalty();

			player.setClassId(_baseClass.getId());
       
			if (player.isSubClassActive()) player.getSubClasses().get(player.getClassIndex()).setClassId(player.getActiveClass());
			else player.setBaseClass(player.getActiveClass());

           			long pXp = player.getExp();
           			long tXp = Experience.LEVEL[1];

           			player.removeExpAndSp(pXp - tXp, 0);

			player.sendMessage("You have been reborn");

			player.setRebirths(player.getRebirths() + 1);
		}
		else if (player.getRebirths() > _maxRebirths)
			player.sendMessage("You reached the maximum amount of rebirths");
		else if (player.isSubClassActive())
			player.sendMessage("You can only be reborn on your main class");
		else
			player.sendMessage("You are to low level, you need to atleast be 85");

	}
}
}

 

I find here http://www.l2jfree.com/index.php?topic=3932.0

 

So if some one can help me or share one for L2JFREE.

 

Thanks for your help

4 answers to this question

Recommended Posts

  • 0
Posted

Triple post?

 

First Warning, simply add this code and test is, what else do you need..

  • 0
Posted

I dont find the skill this code give, so i am not sure if this is good.

 

If i make a lot of post because their are 48H i wait a simple reponse.

 

SO thanks you matin

Guest
This topic is now closed to further replies.


×
×
  • Create New...