All pastes #252446 Raw Edit

Miscellany

public text v1 · immutable
#252446 ·published 2006-11-19 15:29 UTC
rendered paste body
Index: C:/Documents and Settings/Administrator/My Documents/Workspace/L2_GameServer_c5/java/config/altsettings.properties
===================================================================
--- C:/Documents and Settings/Administrator/My Documents/Workspace/L2_GameServer_c5/java/config/altsettings.properties	(revision 223)
+++ C:/Documents and Settings/Administrator/My Documents/Workspace/L2_GameServer_c5/java/config/altsettings.properties	(working copy)
@@ -113,6 +113,10 @@
 # - skills of fighters/mages costs x3 SP
 AltGameSkillLearn = False
 
+# If true, previous skills will not be removed when you change your subclass.
+# Default = False
+AltSubClassSkills = False
+
 # Allow player sub-class addition without checking for unique quest items.
 AltSubClassWithoutQuests = False
 
Index: C:/Documents and Settings/Administrator/My Documents/Workspace/L2_GameServer_c5/java/net/sf/l2j/Config.java
===================================================================
--- C:/Documents and Settings/Administrator/My Documents/Workspace/L2_GameServer_c5/java/net/sf/l2j/Config.java	(revision 223)
+++ C:/Documents and Settings/Administrator/My Documents/Workspace/L2_GameServer_c5/java/net/sf/l2j/Config.java	(working copy)
@@ -275,6 +275,9 @@
     
     /** How much adena receive characters who pick two or less of the winning number */
     public static int ALT_LOTTERY_2_AND_1_NUMBER_PRIZE;
+    
+    /** AltSettings for subclass. Load Subclass skills if false, Load all character skills if true. */
+    public static boolean ALT_SUBCLASS_SKILLS;
 
     /* **************************************************************************
      * GM CONFIG General GM AccessLevel *
@@ -1434,6 +1437,8 @@
                 ALT_LOTTERY_4_NUMBER_RATE        = Float.parseFloat(altSettings.getProperty("AltLottery4NumberRate","0.2"));
                 ALT_LOTTERY_3_NUMBER_RATE        = Float.parseFloat(altSettings.getProperty("AltLottery3NumberRate","0.2"));
                 ALT_LOTTERY_2_AND_1_NUMBER_PRIZE = Integer.parseInt(altSettings.getProperty("AltLottery2and1NumberPrize","200"));
+                
+                ALT_SUBCLASS_SKILLS = Boolean.parseBoolean(altSettings.getProperty("AltSubClassSkills", "False"));
 	        }
 	        catch (Exception e)
 	        {
Index: C:/Documents and Settings/Administrator/My Documents/Workspace/L2_GameServer_c5/java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java
===================================================================
--- C:/Documents and Settings/Administrator/My Documents/Workspace/L2_GameServer_c5/java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java	(revision 223)
+++ C:/Documents and Settings/Administrator/My Documents/Workspace/L2_GameServer_c5/java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java	(working copy)
@@ -181,6 +181,7 @@
 public final class L2PcInstance extends L2PlayableInstance
 {
 	private static final String RESTORE_SKILLS_FOR_CHAR = "SELECT skill_id,skill_level FROM character_skills WHERE char_obj_id=? AND class_index=?";
+	private static final String RESTORE_SKILLS_FOR_CHAR_ALT_SUBCLASS = "SELECT skill_id,skill_level FROM character_skills WHERE char_obj_id=?";
 	private static final String ADD_NEW_SKILL = "INSERT INTO character_skills (char_obj_id,skill_id,skill_level,skill_name,class_index) VALUES (?,?,?,?,?)";
 	private static final String UPDATE_CHARACTER_SKILL_LEVEL = "UPDATE character_skills SET skill_level=? WHERE skill_id=? AND char_obj_id=? AND class_index=?";
 	private static final String DELETE_SKILL_FROM_CHAR = "DELETE FROM character_skills WHERE skill_id=? AND char_obj_id=? AND class_index=?";
@@ -5411,31 +5412,61 @@
 		
 		try
 		{
-			// Retrieve all skills of this L2PcInstance from the database
-			con = L2DatabaseFactory.getInstance().getConnection();
-			PreparedStatement statement = con.prepareStatement(RESTORE_SKILLS_FOR_CHAR);
-			statement.setInt(1, getObjectId());
-			statement.setInt(2, getClassIndex());
-			ResultSet rset = statement.executeQuery();
-			
-			// Go though the recordset of this SQL query
-			while (rset.next())
+			if(!Config.ALT_SUBCLASS_SKILLS)
 			{
-				int id = rset.getInt("skill_id");
-				int level = rset.getInt("skill_level");
+				// Retrieve all skills of this L2PcInstance from the database
+				con = L2DatabaseFactory.getInstance().getConnection();
+				PreparedStatement statement = con.prepareStatement(RESTORE_SKILLS_FOR_CHAR);
+				statement.setInt(1, getObjectId());
+				statement.setInt(2, getClassIndex());
+				ResultSet rset = statement.executeQuery();
 				
-				if (id > 9000)
-					continue; // fake skills for base stats
+				// Go though the recordset of this SQL query
+				while (rset.next())
+				{
+					int id = rset.getInt("skill_id");
+					int level = rset.getInt("skill_level");
+					
+					if (id > 9000)
+						continue; // fake skills for base stats
+					
+					// Create a L2Skill object for each record
+					L2Skill skill = SkillTable.getInstance().getInfo(id, level);
+					
+					// Add the L2Skill object to the L2Character _skills and its Func objects to the calculator set of the L2Character
+					super.addSkill(skill);
+				}
 				
-				// Create a L2Skill object for each record
-				L2Skill skill = SkillTable.getInstance().getInfo(id, level);
+				rset.close();
+				statement.close();
+			}
+			else
+			{
+				// Retrieve all skills of this L2PcInstance from the database
+				con = L2DatabaseFactory.getInstance().getConnection();
+				PreparedStatement statement = con.prepareStatement(RESTORE_SKILLS_FOR_CHAR_ALT_SUBCLASS);
+				statement.setInt(1, getObjectId());
+				ResultSet rset = statement.executeQuery();
 				
-				// Add the L2Skill object to the L2Character _skills and its Func objects to the calculator set of the L2Character
-				super.addSkill(skill);
+				// Go though the recordset of this SQL query
+				while (rset.next())
+				{
+					int id = rset.getInt("skill_id");
+					int level = rset.getInt("skill_level");
+					
+					if (id > 9000)
+						continue; // fake skills for base stats
+					
+					// Create a L2Skill object for each record
+					L2Skill skill = SkillTable.getInstance().getInfo(id, level);
+					
+					// Add the L2Skill object to the L2Character _skills and its Func objects to the calculator set of the L2Character
+					super.addSkill(skill);
+				}
+				
+				rset.close();
+				statement.close();
 			}
-			
-			rset.close();
-			statement.close();
 		}
 		catch (Exception e)
 		{