Jump to content
  • 0

Mod Rebirth - para aCis 398+


Denky

Question

Algum filho de Deus, consegue adaptar esse mod pra mim?
ele é muito antigo, a aCis atualmente esta muito diferente.

Minha experiencia nao é tanta no projeto para adaptar a esse nivel ainda...

Te Ajudei? Curte ai para me ajudar!
Ass.: Denkyto (discord)

banner-pdl.png.f366c9249de658e0a684c96487f0950d.png

 

Link to comment
Share on other sites

6 answers to this question

Recommended Posts

  • 0
1 hora atrás, Denky disse:

Algum filho de Deus, consegue adaptar esse mod pra mim?
ele é muito antigo, a aCis atualmente esta muito diferente.

Minha experiencia nao é tanta no projeto para adaptar a esse nivel ainda...

Crie NPC com type -> NoblesseNpc

Codigo DIFF ABAIXO.

https://pastebin.com/QZe1yH5k

As htmls voce pega no tópico la

  • Like 2
Link to comment
Share on other sites


  • 0
2 horas atrás, S.Christian disse:

Crie NPC com type -> NoblesseNpc

Codigo DIFF ABAIXO.

https://pastebin.com/QZe1yH5k

As htmls voce pega no tópico la

o rebirth tambem funciona ?

Te Ajudei? Curte ai para me ajudar!
Ass.: Denkyto (discord)

banner-pdl.png.f366c9249de658e0a684c96487f0950d.png

 

Link to comment
Share on other sites

  • 0

a minha intenção é o mod (rebirth) que ta no arquivo baixado la.

mas ja inicia errado kkk quando eu tento colocar no primeiro arquivo da diff.

o general skills é todo diferente, nem tem for pra iterar...

Edited by Denky

Te Ajudei? Curte ai para me ajudar!
Ass.: Denkyto (discord)

banner-pdl.png.f366c9249de658e0a684c96487f0950d.png

 

Link to comment
Share on other sites

  • 0
2 horas atrás, Denky disse:

a minha intenção é nesse mod aqui 

 

### Eclipse Workspace Patch 1.0
#P aCis_gameserver
Index: java/net/sf/l2j/gameserver/network/clientpackets/RequestAcquireSkillInfo.java
===================================================================
--- java/net/sf/l2j/gameserver/network/clientpackets/RequestAcquireSkillInfo.java	(revision 4)
+++ java/net/sf/l2j/gameserver/network/clientpackets/RequestAcquireSkillInfo.java	(working copy)
@@ -17,8 +17,8 @@
 import net.sf.l2j.Config;
 import net.sf.l2j.gameserver.datatables.SkillTable;
 import net.sf.l2j.gameserver.datatables.SkillTreeTable;
-import net.sf.l2j.gameserver.datatables.SpellbookTable;
 import net.sf.l2j.gameserver.model.L2PledgeSkillLearn;
+import net.sf.l2j.gameserver.model.L2RebirthSkillLearn;
 import net.sf.l2j.gameserver.model.L2Skill;
 import net.sf.l2j.gameserver.model.L2SkillLearn;
 import net.sf.l2j.gameserver.model.actor.L2Npc;
@@ -62,7 +62,7 @@
 		
 		switch (_skillType)
 		{
-			// General skills
+			// Trance's Rebirth skills.
 			case 0:
 				int skillLvl = activeChar.getSkillLevel(_skillId);
 				if (skillLvl >= _skillLevel)
@@ -74,14 +74,13 @@
 				if (!trainer.getTemplate().canTeach(activeChar.getSkillLearningClassId()))
 					return;
 					
-				for (L2SkillLearn sl : SkillTreeTable.getInstance().getAvailableSkills(activeChar, activeChar.getSkillLearningClassId()))
+				for (L2RebirthSkillLearn rsl : SkillTreeTable.getInstance().getAvailableRebirthSkills(activeChar, activeChar.getSkillLearningClassId()))
 				{
-					if (sl.getId() == _skillId && sl.getLevel() == _skillLevel)
+					if (rsl.getId() == _skillId && rsl.getLevel() == _skillLevel)
 					{
-						AcquireSkillInfo asi = new AcquireSkillInfo(_skillId, _skillLevel, sl.getSpCost(), 0);
-						int spellbookItemId = SpellbookTable.getInstance().getBookForSkill(_skillId, _skillLevel);
-						if (spellbookItemId != 0)
-							asi.addRequirement(99, spellbookItemId, 1, 50);
+						AcquireSkillInfo asi = new AcquireSkillInfo(_skillId, _skillLevel, rsl.getCostSp(), 0);
+						if (Config.LIFE_CRYSTAL_NEEDED && rsl.getItemId() != 0)
+							asi.addRequirement(1, rsl.getItemId(), 1, 0);
 						sendPacket(asi);
 						break;
 					}
Index: java/net/sf/l2j/gameserver/model/base/ClassId.java
===================================================================
--- java/net/sf/l2j/gameserver/model/base/ClassId.java	(revision 4)
+++ java/net/sf/l2j/gameserver/model/base/ClassId.java	(working copy)
@@ -248,4 +248,15 @@
 	{
 		return _parent;
 	}
+
+	/**
+	 * @return to the first class
+	 */
+	public final ClassId getFirstClass()
+	{
+		if (_parent == null)
+			return this;
+		
+		return _parent.getFirstClass();
+	}
 }
\ No newline at end of file
Index: java/net/sf/l2j/gameserver/model/actor/instance/L2RebirthInstance.java
===================================================================
--- java/net/sf/l2j/gameserver/model/actor/instance/L2RebirthInstance.java	(revision 0)
+++ java/net/sf/l2j/gameserver/model/actor/instance/L2RebirthInstance.java	(working copy)
@@ -0,0 +1,301 @@
+/*
+ * 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.L2ItemInstance;
+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.templates.chars.L2NpcTemplate;
+
+/**
+ * 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, L2NpcTemplate 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/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);
+    }
+	
+	/**
+	 * 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.getAllSkills())
+				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 L2ItemInstance 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();
+		}
+	}
+}
\ No newline at end of file
Index: java/net/sf/l2j/gameserver/network/clientpackets/RequestAcquireSkill.java
===================================================================
--- java/net/sf/l2j/gameserver/network/clientpackets/RequestAcquireSkill.java	(revision 4)
+++ java/net/sf/l2j/gameserver/network/clientpackets/RequestAcquireSkill.java	(working copy)
@@ -17,8 +17,8 @@
 import net.sf.l2j.Config;
 import net.sf.l2j.gameserver.datatables.SkillTable;
 import net.sf.l2j.gameserver.datatables.SkillTreeTable;
-import net.sf.l2j.gameserver.datatables.SpellbookTable;
 import net.sf.l2j.gameserver.model.L2PledgeSkillLearn;
+import net.sf.l2j.gameserver.model.L2RebirthSkillLearn;
 import net.sf.l2j.gameserver.model.L2ShortCut;
 import net.sf.l2j.gameserver.model.L2Skill;
 import net.sf.l2j.gameserver.model.L2SkillLearn;
@@ -80,7 +80,7 @@
 		// Types.
 		switch (_skillType)
 		{
-			case 0: // General skills.
+			case 0: // Trance's Rebirth skills.
 				// Player already has such skill with same or higher level.
 				int skillLvl = activeChar.getSkillLevel(_skillId);
 				if (skillLvl >= _skillLevel)
@@ -90,16 +90,17 @@
 				if (Math.max(skillLvl, 0) + 1 != _skillLevel)
 					return;
 				
-				int spCost = 0;
+				int spCost = 0, idItem = 0;
 				
 				// Find skill information.
-				for (L2SkillLearn sl : SkillTreeTable.getInstance().getAvailableSkills(activeChar, activeChar.getSkillLearningClassId()))
+				for (L2RebirthSkillLearn rsl : SkillTreeTable.getInstance().getAvailableRebirthSkills(activeChar, activeChar.getSkillLearningClassId()))
 				{
 					// Skill found.
-					if (sl.getId() == _skillId && sl.getLevel() == _skillLevel)
+					if (rsl.getId() == _skillId && rsl.getLevel() == _skillLevel)
 					{
 						exists = true;
-						spCost = sl.getSpCost();
+						idItem = rsl.getItemId();
+						spCost = rsl.getCostSp();
 						break;
 					}
 				}
@@ -116,11 +117,10 @@
 					return;
 				}
 				
-				// Get spellbook and try to consume it.
-				int spbId = SpellbookTable.getInstance().getBookForSkill(_skillId, _skillLevel);
-				if (spbId > 0)
+				// Get item and try to consume it.
+				if (idItem > 0)
 				{
-					if (!activeChar.destroyItemByItemId("SkillLearn", spbId, 1, trainer, true))
+					if (!activeChar.destroyItemByItemId("SkillLearn", idItem, 1, trainer, false))
 					{
 						activeChar.sendPacket(SystemMessageId.ITEM_MISSING_TO_LEARN_SKILL);
 						L2NpcInstance.showSkillList(activeChar, trainer, activeChar.getSkillLearningClassId());
Index: java/net/sf/l2j/gameserver/model/actor/instance/L2NpcInstance.java
===================================================================
--- java/net/sf/l2j/gameserver/model/actor/instance/L2NpcInstance.java	(revision 4)
+++ java/net/sf/l2j/gameserver/model/actor/instance/L2NpcInstance.java	(working copy)
@@ -19,11 +19,11 @@
 import net.sf.l2j.gameserver.datatables.SkillTable;
 import net.sf.l2j.gameserver.datatables.SkillTable.FrequentSkill;
 import net.sf.l2j.gameserver.datatables.SkillTreeTable;
+import net.sf.l2j.gameserver.model.L2RebirthSkillLearn;
 import net.sf.l2j.gameserver.model.L2Effect;
 import net.sf.l2j.gameserver.model.L2EnchantSkillData;
 import net.sf.l2j.gameserver.model.L2EnchantSkillLearn;
 import net.sf.l2j.gameserver.model.L2Skill;
-import net.sf.l2j.gameserver.model.L2SkillLearn;
 import net.sf.l2j.gameserver.model.actor.L2Npc;
 import net.sf.l2j.gameserver.model.actor.status.FolkStatus;
 import net.sf.l2j.gameserver.model.base.ClassId;
@@ -99,13 +99,13 @@
 		AcquireSkillList asl = new AcquireSkillList(AcquireSkillList.SkillType.Usual);
 		boolean empty = true;
 		
-		for (L2SkillLearn sl : SkillTreeTable.getInstance().getAvailableSkills(player, classId))
+		for (L2RebirthSkillLearn rsl : SkillTreeTable.getInstance().getAvailableRebirthSkills(player, classId))
 		{
-			L2Skill sk = SkillTable.getInstance().getInfo(sl.getId(), sl.getLevel());
+			L2Skill sk = SkillTable.getInstance().getInfo(rsl.getId(), rsl.getLevel());
 			if (sk == null)
 				continue;
 			
-			asl.addSkill(sl.getId(), sl.getLevel(), sl.getLevel(), sl.getSpCost(), 0);
+			asl.addSkill(rsl.getId(), rsl.getLevel(), rsl.getLevel(), rsl.getCostSp(), 0);
 			empty = false;
 		}
 		
Index: config/events.properties
===================================================================
--- config/events.properties	(revision 4)
+++ config/events.properties	(working copy)
@@ -251,4 +251,19 @@
 AltFishChampionshipReward2 = 500000
 AltFishChampionshipReward3 = 300000
 AltFishChampionshipReward4 = 200000
-AltFishChampionshipReward5 = 100000
\ No newline at end of file
+AltFishChampionshipReward5 = 100000
+
+#================================================================
+#                    Trance's Rebirth Manager
+#================================================================
+# Minimum level for Rebirth
+RebirthMinLevel = 78
+
+# Maximum rebirth's allowed
+RebirthMaxAllowed = 3
+
+# Return to level
+RebirthReturnToLevel = 1
+
+# Rebirth items
+RebirthItems = 2822,1;2822,1;2822,1;
\ No newline at end of file
Index: java/net/sf/l2j/gameserver/datatables/SkillTreeTable.java
===================================================================
--- java/net/sf/l2j/gameserver/datatables/SkillTreeTable.java	(revision 4)
+++ java/net/sf/l2j/gameserver/datatables/SkillTreeTable.java	(working copy)
@@ -26,6 +26,7 @@
 import net.sf.l2j.gameserver.model.L2EnchantSkillData;
 import net.sf.l2j.gameserver.model.L2EnchantSkillLearn;
 import net.sf.l2j.gameserver.model.L2PledgeSkillLearn;
+import net.sf.l2j.gameserver.model.L2RebirthSkillLearn;
 import net.sf.l2j.gameserver.model.L2Skill;
 import net.sf.l2j.gameserver.model.L2SkillLearn;
 import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
@@ -46,6 +47,7 @@
 	private List<L2PledgeSkillLearn> _pledgeSkillTrees;
 	private Map<Integer, L2EnchantSkillData> _enchantSkillData;
 	private List<L2EnchantSkillLearn> _enchantSkillTrees;
+	private List<L2RebirthSkillLearn> _rebirthSkillTrees;
 	
 	public static SkillTreeTable getInstance()
 	{
@@ -207,10 +209,43 @@
 			_log.severe("PledgeTable: Error while loading pledge skills: " + e);
 		}
 		
+		// Rebirth skills tree
+		try
+		{
+			_rebirthSkillTrees = new ArrayList<>();
+			
+			File f = new File("./data/xml/skillstrees/rebirth_skills_tree.xml");
+			Document doc = XMLDocumentFactory.getInstance().loadDocument(f);
+			
+			for (Node list = doc.getFirstChild().getFirstChild(); list != null; list = list.getNextSibling())
+			{
+				if ("skill".equalsIgnoreCase(list.getNodeName()))
+				{
+					NamedNodeMap skillAttr = list.getAttributes();
+					
+					int skillId = Integer.parseInt(skillAttr.getNamedItem("id").getNodeValue());
+					int skillLvl = Integer.parseInt(skillAttr.getNamedItem("lvl").getNodeValue());
+					int costSp = Integer.valueOf(skillAttr.getNamedItem("sp").getNodeValue());
+					int itemId = 0;
+					
+					Node att = skillAttr.getNamedItem("itemId");
+					if (att != null)
+						itemId = Integer.valueOf(att.getNodeValue());
+					
+					_rebirthSkillTrees.add(new L2RebirthSkillLearn(skillId, skillLvl, costSp, itemId));
+				}
+			}
+		}
+		catch (Exception e)
+		{
+			_log.severe("RebirthTable: Error while loading rebirth skills: " + e);
+		}
+		
 		_log.config("FishingSkillTreeTable: Loaded " + _fishingSkillTrees.size() + " general skills.");
 		_log.config("DwarvenCraftSkillTreeTable: Loaded " + _expandDwarvenCraftSkillTrees.size() + " dwarven skills.");
 		_log.config("EnchantSkillTreeTable: Loaded " + _enchantSkillData.size() + " enchant types and " + _enchantSkillTrees.size() + " enchant skills.");
 		_log.config("PledgeSkillTreeTable: Loaded " + _pledgeSkillTrees.size() + " pledge skills.");
+		_log.config("RebirthSkillTreeTable: Loaded " + _rebirthSkillTrees.size() + " rebirth skills.");
 	}
 	
 	/**
@@ -509,6 +544,39 @@
 		return result;
 	}
 	
+	/**
+	 * @param cha L2PcInstance, player whom skills are compared.
+	 * @param classId 
+	 * @return list of available rebirth skills for L2PcInstance.
+	 */
+	public List<L2RebirthSkillLearn> getAvailableRebirthSkills(L2PcInstance cha, ClassId classId)
+	{
+		List<L2RebirthSkillLearn> result = new ArrayList<>();
+		
+		L2Skill[] chaSkills = cha.getAllSkills();
+		
+		for (L2RebirthSkillLearn rsl : _rebirthSkillTrees)
+		{
+			boolean found = false;
+			
+			for (L2Skill s : chaSkills)
+			{
+				if (s.getId() == rsl.getId())
+				{
+					if (s.getLevel() == rsl.getLevel() - 1)
+						result.add(rsl);
+					
+					found = true;
+					break;
+				}
+			}
+			
+			if (!found && rsl.getLevel() == 1)
+				result.add(rsl);
+		}
+		return result;
+	}
+	
 	public int getMinSkillLevel(int skillId, int skillLvl)
 	{
 		int skillHashCode = SkillTable.getSkillHashCode(skillId, skillLvl);
Index: java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java
===================================================================
--- java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java	(revision 4)
+++ java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java	(working copy)
@@ -5643,16 +5643,6 @@
 								player._classIndex = subClass.getClassIndex();
 					}
 				}
-				if (player.getClassIndex() == 0 && activeClassId != player.getBaseClass())
-				{
-					// Subclass in use but doesn't exist in DB -
-					// a possible restart-while-modifysubclass cheat has been attempted.
-					// Switching to use base class
-					player.setClassId(player.getBaseClass());
-					_log.warning("Player " + player.getName() + " reverted to base class. Possibly has tried a relogin exploit while subclassing.");
-				}
-				else
-					player._activeClass = activeClassId;
 				
 				player.setApprentice(rset.getInt("apprentice"));
 				player.setSponsor(rset.getInt("sponsor"));
Index: java/net/sf/l2j/gameserver/model/actor/L2Character.java
===================================================================
--- java/net/sf/l2j/gameserver/model/actor/L2Character.java	(revision 4)
+++ java/net/sf/l2j/gameserver/model/actor/L2Character.java	(working copy)
@@ -4515,6 +4515,10 @@
 		if (skill == null)
 			return null;
 		
+		// Skip the rebirth skills.
+		if (skill.getId() >= 549 && skill.getId() <= 560)
+			return null;
+		
 		return removeSkill(skill.getId(), true);
 	}
 	
Index: java/net/sf/l2j/Config.java
===================================================================
--- java/net/sf/l2j/Config.java	(revision 4)
+++ java/net/sf/l2j/Config.java	(working copy)
@@ -225,6 +225,12 @@
 	public static int ALT_FISH_CHAMPIONSHIP_REWARD_4;
 	public static int ALT_FISH_CHAMPIONSHIP_REWARD_5;
 	
+	/** Trance's Rebirth Manager */
+	public static int REBIRTH_MIN_LEVEL;
+	public static int REBIRTH_MAX;
+	public static int REBIRTH_RETURN_TO_LEVEL;
+	public static String[] REBIRTH_ITEMS;
+	
 	// --------------------------------------------------
 	// HexID
 	// --------------------------------------------------
@@ -870,6 +876,11 @@
 			ALT_FISH_CHAMPIONSHIP_REWARD_4 = events.getProperty("AltFishChampionshipReward4", 200000);
 			ALT_FISH_CHAMPIONSHIP_REWARD_5 = events.getProperty("AltFishChampionshipReward5", 100000);
 			
+			REBIRTH_MIN_LEVEL = events.getProperty("RebirthMinLevel", 78);
+			REBIRTH_MAX = events.getProperty("RebirthMaxAllowed", 3);
+			REBIRTH_RETURN_TO_LEVEL = events.getProperty("RebirthReturnToLevel", 1);
+			REBIRTH_ITEMS = events.getProperty("RebirthItems", "").split(";");
+			
 			// FloodProtector
 			ExProperties security = load(FLOOD_PROTECTOR_FILE);
 			loadFloodProtectorConfig(security, FLOOD_PROTECTOR_ROLL_DICE, "RollDice", "42");
Index: java/net/sf/l2j/gameserver/model/L2RebirthSkillLearn.java
===================================================================
--- java/net/sf/l2j/gameserver/model/L2RebirthSkillLearn.java	(revision 0)
+++ java/net/sf/l2j/gameserver/model/L2RebirthSkillLearn.java	(working copy)
@@ -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.l2j.gameserver.model;
+
+/**
+ * @author Trance
+ * @skype chr.trance
+ */
+public final class L2RebirthSkillLearn
+{
+	private final int _id;
+	private final int _level;
+	private final int _costSp;
+	private final int _itemId;
+	
+	public L2RebirthSkillLearn(int id, int lvl, int costSp, int itemId)
+	{
+		_id = id;
+		_level = lvl;
+		_costSp = costSp;
+		_itemId = itemId;
+	}
+	
+	public int getId()
+	{
+		return _id;
+	}
+	
+	public int getLevel()
+	{
+		return _level;
+	}
+	
+	public int getCostSp()
+	{
+		return _costSp;
+	}
+	
+	public int getItemId()
+	{
+		return _itemId;
+	}
+}
\ No newline at end of file

mas ja inicia errado kkk
 

package net.sf.l2j.gameserver.network.clientpackets;

import net.sf.l2j.Config;
import net.sf.l2j.gameserver.data.SkillTable;
import net.sf.l2j.gameserver.data.xml.SkillTreeData;
import net.sf.l2j.gameserver.data.xml.SpellbookData;
import net.sf.l2j.gameserver.model.actor.Player;
import net.sf.l2j.gameserver.model.actor.instance.Folk;
import net.sf.l2j.gameserver.model.holder.skillnode.ClanSkillNode;
import net.sf.l2j.gameserver.model.holder.skillnode.FishingSkillNode;
import net.sf.l2j.gameserver.model.holder.skillnode.GeneralSkillNode;
import net.sf.l2j.gameserver.network.serverpackets.AcquireSkillInfo;
import net.sf.l2j.gameserver.skills.L2Skill;

public class RequestAcquireSkillInfo extends L2GameClientPacket
{
	private int _skillId;
	private int _skillLevel;
	private int _skillType;

	@Override
	protected void readImpl()
	{
		_skillId = readD();
		_skillLevel = readD();
		_skillType = readD();
	}

	@Override
	protected void runImpl()
	{
		// Not valid skill data, return.
		if (_skillId <= 0 || _skillLevel <= 0)
			return;

		// Incorrect player, return.
		final Player player = getClient().getPlayer();
		if (player == null)
			return;

		// Incorrect npc, return.
		final Folk folk = player.getCurrentFolk();
		if (folk == null || !player.getAI().canDoInteract(folk))
			return;

		// Skill doesn't exist, return.
		final L2Skill skill = SkillTable.getInstance().getInfo(_skillId, _skillLevel);
		if (skill == null)
			return;

		final AcquireSkillInfo asi;

		switch (_skillType)
		{
			// General skills
			case 0:
				// Player already has such skill with same or higher level.
				int skillLvl = player.getSkillLevel(_skillId);
				

				// Requested skill must be 1 level higher than existing skill.
				if ((skillLvl >= _skillLevel) || (skillLvl != _skillLevel - 1) || !folk.getTemplate().canTeach(player.getClassId()))
					return;

				// Search if the asked skill exists on player template.
				final GeneralSkillNode gsn = player.getTemplate().findSkill(_skillId, _skillLevel);
				if (gsn != null)
				{
					asi = new AcquireSkillInfo(_skillId, _skillLevel, gsn.getCorrectedCost(), 0);
					final int bookId = SpellbookData.getInstance().getBookForSkill(_skillId, _skillLevel);
					if (bookId != 0)
						asi.addRequirement(99, bookId, 1, 50);
					sendPacket(asi);
				}
				break;

			// Common skills
			case 1:
				// Player already has such skill with same or higher level.
				skillLvl = player.getSkillLevel(_skillId);
				if (skillLvl >= _skillLevel)
					return;

				// Requested skill must be 1 level higher than existing skill.
				if (skillLvl != _skillLevel - 1)
					return;

				final FishingSkillNode fsn = SkillTreeData.getInstance().getFishingSkillFor(player, _skillId, _skillLevel);
				if (fsn != null)
				{
					asi = new AcquireSkillInfo(_skillId, _skillLevel, 0, 1);
					asi.addRequirement(4, fsn.getItemId(), fsn.getItemCount(), 0);
					sendPacket(asi);
				}
				break;

			// Pledge skills.
			case 2:
				if (!player.isClanLeader())
					return;

				final ClanSkillNode csn = SkillTreeData.getInstance().getClanSkillFor(player, _skillId, _skillLevel);
				if (csn != null)
				{
					asi = new AcquireSkillInfo(skill.getId(), skill.getLevel(), csn.getCost(), 2);
					if (Config.LIFE_CRYSTAL_NEEDED && csn.getItemId() != 0)
						asi.addRequirement(1, csn.getItemId(), 1, 0);
					sendPacket(asi);
				}
				break;
		}
	}
}

o general skills é todo diferente, nem tem for pra iterar...

Entendi, mas na proxima vez, coloca mod num bloco de nota e zipa pq ta muito cumprido isso dai, vou analisar aqui

Edited by S.Christian
  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Poh passa pra mim, eu não tenho interesse em nada sobre essas coisas, apenas estou rodando o forum que nem louco pra achar uma rev boa pra jogar só eu e minha esposa 😕 Dou minha palavra que não tenho vontade nenhuma de repassar ja que esse tipo de coisa anda rolando na comunidade 😕 Se puder eu agradeço,senao nao tem problema eu entendo completamente ^^ Meu Discord: xii_gaia_iix
    • Olá a todos gostaria de informa que demos um tempo no projeto mais já estamos voltando ativa com uma revisão estável e 100% limpa de mods. Não iremos disponibilizar a soucer do projeto devido a uns caras malandros aqui que já esta vendendo a revisão sem nem esta estável.
    • podes subir denuevo la data por favor 
    • UP!!! Vou Reupar em breve, tive que recriar o app... 
    • Sobre o rate limit. Antes de tudo, é importante entender o seguinte: o SphereAPI é um cluster — não é apenas um único servidor. Existe um servidor público por padrão, mas os outros IPs dos servidores da Sphere são ocultos por questões de segurança e são adicionados manualmente no painel de administração, especificando o IP e a PORTA. Dessa forma, evitamos ataques DDoS. O SphereAPI trabalha de forma paralela, mesmo que os servidores não estejam diretamente conectados entre si. Se alguém tentar fazer um ataque DDoS a um dos servidores da Sphere, isso não afetará os clientes do SphereWeb que estão em outros servidores. O próprio SphereAPI foi escrito na linguagem Golang para distribuir ao máximo a carga, utilizar concorrência e multiprocessamento. Atualmente, no servidor público, tenho dezenas e dezenas de sites conectados, e a cada segundo o Sphere executa requisições e gerencia conexões, enquanto o SphereAPI consome apenas 27MB de RAM. Eu considero isso um bom resultado do meu trabalho. Dos sites SphereWeb, só recebo requisições quando realmente necessário. Se algum site de servidor for alvo de um ataque DDoS, isso não afeta a Sphere de forma alguma.  
    • obg pelas, informações.  desculpe o excesso de perguntas. normalmente as pessoas nao fazem perguntas tao tecnicas, e acabam por desconherem o nivel grande do projeto que estao usando. gosto de fazer essas perguntas, para que fique registrado e as pessoas possam ver depois. sem precisar perguntar novamente : D vc fez algum tipo de ratelimit ?
    • SphereAPI (ela processa todas as conexões) faz consultas ao banco de dados somente quando necessário. Nós armazenamos todos os dados em cache, assim as consultas só são feitas quando o cache está desatualizado. Simplificando: se 100 pessoas acessarem sua página de estatísticas em 1 minuto, a consulta para obter os dados será feita apenas uma vez. E o resultado da consulta é armazenado tanto na memória da SphereAPI quanto da SphereWeb.
    • quais foram as tecnicas que vc usou para evitar excesso de consultas, tais como tops e afins que fazem JOIN nas tabelas, e podem causar lentidão ?
    • Se o servidor da Sphere não conseguir se conectar ou perder a conexão com o banco de dados do servidor de jogo, ou não conseguir executar uma consulta SQL, então o SphereWeb mostrará que o servidor está indisponível no painel de lista de servidores da administração. Na área administrativa será exibida a mensagem de erro, indicando a causa do problema. E se for um erro de consulta SQL, a consulta será pausada para evitar novas tentativas com erro no banco de dados do servidor. A Sphere aguardará até que o problema seja resolvido – ou seja, até que o erro seja corrigido. Depois disso, será possível limpar a lista de erros, e a Sphere tentará se conectar novamente.   Vale destacar que, para otimização, a API da Sphere mantém uma conexão permanente com o banco de dados do servidor de jogo enquanto o site estiver sendo acessado. Se ninguém acessar seu site por mais de 15 minutos, a Sphere se desconectará do banco de dados do jogo e só se reconectará quando alguém acessar novamente.   Provavelmente não expliquei tudo de forma clara, pois há muitos detalhes que não mencionei.
×
×
  • Create New...

Important Information

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.