Noticias:

No tienes permiso para ver los enlaces. Para poder verlos Registrate o Conectate.

Menú Principal

Sub Acumulativas (Fissban)

Iniciado por fissban, Ago 03, 2025, 01:40 AM

Tema anterior - Siguiente tema

fissban

Con este codigo implementado, cuando hagas una subclase automaticamente en ella tienes las skills activas y pasivas de la clase base.

### Eclipse Workspace Patch 1.0
#P L2J_Server
Index: dist/game/config/L2JMods.properties
===================================================================
--- dist/game/config/L2JMods.properties	(revision 6353)
+++ dist/game/config/L2JMods.properties	(working copy)
@@ -3,6 +3,24 @@
 # Be warned that there may be no support for these mods beyond the original author's assistance.
 
 # ---------------------------------------------------------------------------
+# Subclass Acu by fissban
+# ---------------------------------------------------------------------------
+
+# Aqui activamos el sistema de subclass Acu
+# default false
+AcumulativeSkills = false
+
+# Aqui activamos para que solo se acumulen los skills pasivos
+AcumulativeSkillsPasive = False
+
+# Aqui activamos por si solo queremos q cierto skills no se acumulen, como por ejemplo los
+# skills de 3ra y bien los pasivos de armas y armaduras
+DontAcumulativeSkills = False
+
+# Aqui definimos los skills q no se acumularan
+DontAcumulativeSkillsId = 351;349
+
+# ---------------------------------------------------------------------------
 # Champion mobs - Turn random mobs into Champions
 # ---------------------------------------------------------------------------
 
Index: java/com/l2jserver/Config.java
===================================================================
--- java/com/l2jserver/Config.java	(revision 6353)
+++ java/com/l2jserver/Config.java	(working copy)
@@ -103,6 +103,11 @@
 	public static final String SECURITY_CONFIG_FILE = "./config/Security.properties";
 	public static final String EMAIL_CONFIG_FILE = "./config/Email.properties";
 	public static final String CH_SIEGE_FILE = "./config/ConquerableHallSiege.properties";
+	
+	public static boolean ACUMULATIVE_SUBCLASS_SKILLS;
+	public static boolean ACUMULATIVE_SUBCLASS_PASIVE;
+	public static boolean ACUMULATIVE_SUBCLASS_DONT_SKILLS;
+	public static String[] ACUMULATIVE_SUBCLASS_DONT_SKILLS_ID;
 	// --------------------------------------------------
 	// L2J Variable Definitions
 	// --------------------------------------------------
@@ -2429,6 +2434,10 @@
 				_log.log(Level.SEVERE, "Error while loading L2JMod settings!", e);
 			}
 			
+			ACUMULATIVE_SUBCLASS_SKILLS = Boolean.parseBoolean(L2JModSettings.getProperty("AcumulativeSkills", "false"));
+			ACUMULATIVE_SUBCLASS_PASIVE = Boolean.parseBoolean(L2JModSettings.getProperty("AcumulativeSkillsPasive", "false"));
+			ACUMULATIVE_SUBCLASS_DONT_SKILLS = Boolean.parseBoolean(L2JModSettings.getProperty("DontAcumulativeSkills", "true"));
+			ACUMULATIVE_SUBCLASS_DONT_SKILLS_ID = String.valueOf(L2JModSettings.getProperty("DontAcumulativeSkillsId", "351")).split(";");
 			L2JMOD_CHAMPION_ENABLE = Boolean.parseBoolean(L2JModSettings.getProperty("ChampionEnable", "false"));
 			L2JMOD_CHAMPION_PASSIVE = Boolean.parseBoolean(L2JModSettings.getProperty("ChampionPassive", "false"));
 			L2JMOD_CHAMPION_FREQUENCY = Integer.parseInt(L2JModSettings.getProperty("ChampionFrequency", "0"));
Index: java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java
===================================================================
--- java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java	(revision 6511)
+++ java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java	(working copy)
@@ -310,6 +310,8 @@
  */
 public final class L2PcInstance extends L2Playable
 {
+	// SubAcu by fissban
+	private static final String ACUMULATE_SKILLS_FOR_CHAR_SUB = "SELECT skill_id,skill_level,class_index FROM character_skills WHERE charId=? ORDER BY skill_id,skill_level ASC";
 	// Character Skill SQL String Definitions:
 	private static final String RESTORE_SKILLS_FOR_CHAR = "SELECT skill_id,skill_level FROM character_skills WHERE charId=? AND class_index=?";
 	private static final String ADD_NEW_SKILL = "INSERT INTO character_skills (charId,skill_id,skill_level,class_index) VALUES (?,?,?,?)";
@@ -8560,50 +8562,129 @@
 	 */
 	private void restoreSkills()
 	{
-		try (Connection con = L2DatabaseFactory.getInstance().getConnection();
-			PreparedStatement statement = con.prepareStatement(RESTORE_SKILLS_FOR_CHAR))
+		if (Config.ACUMULATIVE_SUBCLASS_SKILLS)
 		{
-			// Retrieve all skills of this L2PcInstance from the database
-			statement.setInt(1, getObjectId());
-			statement.setInt(2, getClassIndex());
-			final ResultSet rset = statement.executeQuery();
-			
-			// Go though the recordset of this SQL query
-			while (rset.next())
+			try (Connection con = L2DatabaseFactory.getInstance().getConnection();
+				PreparedStatement statement = con.prepareStatement(ACUMULATE_SKILLS_FOR_CHAR_SUB))
 			{
-				final int id = rset.getInt("skill_id");
-				final int level = rset.getInt("skill_level");
-				
-				// Create a L2Skill object for each record
-				final L2Skill skill = SkillTable.getInstance().getInfo(id, level);
-				
-				if (skill == null)
+				statement.setInt(1, getObjectId());
+				// statement.setInt(2, getClassIndex());
+				try (ResultSet rset = statement.executeQuery())
 				{
-					_log.warning("Skipped null skill Id: " + id + " Level: " + level + " while restoring player skills for playerObjId: " + getObjectId());
-					continue;
+					
+					// Go though the recordset of this SQL query
+					while (rset.next())
+					{
+						final int id = rset.getInt("skill_id");
+						final int level = rset.getInt("skill_level");
+						final int class_index = rset.getInt("class_index");
+						
+						// Create a L2Skill object for each record
+						final L2Skill skill = SkillTable.getInstance().getInfo(id, level);
+						
+						if (skill == null)
+						{
+							_log.warning("Skipped null skill Id: " + id + " Level: " + level + " while restoring player skills for playerObjId: " + getObjectId());
+							continue;
+						}
+						
+						if (getClassIndex() != class_index)
+						{
+							// solo acumulamos activos.
+							if (Config.ACUMULATIVE_SUBCLASS_PASIVE && skill.isPassive())
+							{
+								continue;
+							}
+							
+							// no acumulamos algunos skills especificos.
+							if (Config.ACUMULATIVE_SUBCLASS_SKILLS)
+							{
+								for (String skillId : Config.ACUMULATIVE_SUBCLASS_DONT_SKILLS_ID)
+								{
+									try
+									{
+										if (Integer.getInteger(skillId) == id)
+										{
+											continue;
+										}
+									}
+									catch (Exception e)
+									{
+										_log.warning("los skills usados en DontAcumulativeSkillsId no esta bien escrito ¬¬");
+									}
+								}
+							}
+						}
+						
+						// Add the L2Skill object to the L2Character _skills and its Func objects to the calculator set of the L2Character
+						addSkill(skill);
+						
+						if (Config.SKILL_CHECK_ENABLE && (!canOverrideCond(PcCondOverride.SKILL_CONDITIONS) || Config.SKILL_CHECK_GM))
+						{
+							if (!SkillTreesData.getInstance().isSkillAllowed(this, skill))
+							{
+								Util.handleIllegalPlayerAction(this, "Player " + getName() + " has invalid skill " + skill.getName() + " (" + skill.getId() + "/" + skill.getLevel() + "), class:" + ClassListData.getInstance().getClass(getClassId()).getClassName(), 1);
+								if (Config.SKILL_CHECK_REMOVE)
+								{
+									removeSkill(skill);
+								}
+							}
+						}
+					}
 				}
-				
-				// Add the L2Skill object to the L2Character _skills and its Func objects to the calculator set of the L2Character
-				addSkill(skill);
-				
-				if (Config.SKILL_CHECK_ENABLE && (!canOverrideCond(PcCondOverride.SKILL_CONDITIONS) || Config.SKILL_CHECK_GM))
+			}
+			catch (Exception e)
+			{
+				_log.log(Level.WARNING, "Could not restore character " + this + " skills: " + e.getMessage(), e);
+			}
+		}
+		else
+		{
+			try (Connection con = L2DatabaseFactory.getInstance().getConnection();
+				PreparedStatement statement = con.prepareStatement(RESTORE_SKILLS_FOR_CHAR))
+			{
+				// Retrieve all skills of this L2PcInstance from the database
+				statement.setInt(1, getObjectId());
+				statement.setInt(2, getClassIndex());
+				try (ResultSet rset = statement.executeQuery())
 				{
-					if (!SkillTreesData.getInstance().isSkillAllowed(this, skill))
+					// Go though the recordset of this SQL query
+					while (rset.next())
 					{
-						Util.handleIllegalPlayerAction(this, "Player " + getName() + " has invalid skill " + skill.getName() + " (" + skill.getId() + "/" + skill.getLevel() + "), class:" + ClassListData.getInstance().getClass(getClassId()).getClassName(), 1);
-						if (Config.SKILL_CHECK_REMOVE)
+						final int id = rset.getInt("skill_id");
+						final int level = rset.getInt("skill_level");
+						
+						// Create a L2Skill object for each record
+						final L2Skill skill = SkillTable.getInstance().getInfo(id, level);
+						
+						if (skill == null)
 						{
-							removeSkill(skill);
+							_log.warning("Skipped null skill Id: " + id + " Level: " + level + " while restoring player skills for playerObjId: " + getObjectId());
+							continue;
 						}
+						
+						// Add the L2Skill object to the L2Character _skills and its Func objects to the calculator set of the L2Character
+						addSkill(skill);
+						
+						if (Config.SKILL_CHECK_ENABLE && (!canOverrideCond(PcCondOverride.SKILL_CONDITIONS) || Config.SKILL_CHECK_GM))
+						{
+							if (!SkillTreesData.getInstance().isSkillAllowed(this, skill))
+							{
+								Util.handleIllegalPlayerAction(this, "Player " + getName() + " has invalid skill " + skill.getName() + " (" + skill.getId() + "/" + skill.getLevel() + "), class:" + ClassListData.getInstance().getClass(getClassId()).getClassName(), 1);
+								if (Config.SKILL_CHECK_REMOVE)
+								{
+									removeSkill(skill);
+								}
+							}
+						}
 					}
 				}
 			}
-			rset.close();
+			catch (Exception e)
+			{
+				_log.log(Level.WARNING, "Could not restore character " + this + " skills: " + e.getMessage(), e);
+			}
 		}
-		catch (Exception e)
-		{
-			_log.log(Level.WARNING, "Could not restore character " + this + " skills: " + e.getMessage(), e);
-		}
 	}
 	
 	/**