Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- net.sf.l2j.gameserver.model.actor.instance.L2PcInstance.java
- ============================================================================================
- private static final String RESTORE_SKILLS_FOR_CHAR = "SELECT skill_id,skill_level FROM character_skills WHERE char_obj_id=? AND class_index=?";
- +/** The Constant RESTORE_SKILLS_FOR_CHAR_ALT_SUBCLASS. */
- +private static final String RESTORE_SKILLS_FOR_CHAR_ALT_SUBCLASS = "SELECT skill_id,skill_level FROM character_skills WHERE char_obj_id=? ORDER BY (skill_level+0)";
- -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())
- - {
- - 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();
- - }
- +try
- + {
- + if (!Config.KEEP_SUBCLASS_SKILLS)
- + {
- + // 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())
- + {
- + 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 = null;
- + statement = null;
- + }
- + 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();
- +
- + // 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 = null;
- + statement = null;
- + }
- +
- + }
- -if (getTotalSubClasses() == 3 || classIndex == 0)
- +if ((getTotalSubClasses() == Config.MAX_SUBCLASS) || (classIndex == 0))
- --------------------------------------------------------------------------------------------
- net.sf.l2j.gameserver.model.actor.instance.L2VillageMasterInstance.java
- ============================================================================================
- // Avoid giving player an option to add a new sub class, if they have three already.
- - if (player.getTotalSubClasses() == 3)
- + if (player.getTotalSubClasses() == Config.MAX_SUBCLASS)
- --------------------------------------------------------------------------------------------
- net.sf.l2j.Config.java
- ============================================================================================
- public static int AUTO_REWARD_COUNT;
- + public static int MAX_SUBCLASS;
- + public static boolean KEEP_SUBCLASS_SKILLS;
- AUTO_REWARD_COUNT = Integer.parseInt(customSettings.getProperty("AutoRewardCount", "1000"));
- +MAX_SUBCLASS = Integer.parseInt(customSettings.getProperty("MaxSubClasses", "3"));
- +KEEP_SUBCLASS_SKILLS = Boolean.parseBoolean(customSettings.getProperty("KeepSubClassSkills", "False"));
- --------------------------------------------------------------------------------------------
- gameserver/config/custom.properties
- ============================================================================================
- # ------------------------------------------------------------
- # SubClass Configuration L2JLisvus-c4
- # ------------------------------------------------------------
- #Max allowed subclass for a player
- #Default : 3
- MaxSubClasses = 3
- #Enable/Disable custom subclass option
- #If True then player will keep all the skill from all subclass
- #Default: False
- KeepSubClassSkills = False
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement