Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/Config.java b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/Config.java
- index f984695..acaee2a 100644
- --- a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/Config.java
- +++ b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/Config.java
- @@ -147,6 +147,7 @@
- private static final String CUSTOM_WAREHOUSE_SORTING_CONFIG_FILE = "./config/Custom/WarehouseSorting.ini";
- private static final String CUSTOM_WEDDING_CONFIG_FILE = "./config/Custom/Wedding.ini";
- private static final String CUSTOM_WALKER_BOT_PROTECTION_CONFIG_FILE = "./config/Custom/WalkerBotProtection.ini";
- + private static final String CUSTOM_SUB_STUCK_CONFIG_FILE = "./config/Custom/SubStuck.ini";
- // --------------------------------------------------
- // Variable Definitions
- @@ -1237,6 +1238,7 @@
- public static int NOBLESS_MASTER_LEVEL_REQUIREMENT;
- public static boolean NOBLESS_MASTER_REWARD_TIARA;
- public static boolean L2WALKER_PROTECTION;
- + public static boolean KEEP_SUBCLASS_SKILLS;
- public static int DUALBOX_CHECK_MAX_PLAYERS_PER_IP;
- public static int DUALBOX_CHECK_MAX_OLYMPIAD_PARTICIPANTS_PER_IP;
- public static int DUALBOX_CHECK_MAX_L2EVENT_PARTICIPANTS_PER_IP;
- @@ -3161,6 +3163,10 @@
- // Load WalkerBotProtection config file (if exists)
- final PropertiesParser walkerBotProtectionConfig = new PropertiesParser(CUSTOM_WALKER_BOT_PROTECTION_CONFIG_FILE);
- L2WALKER_PROTECTION = walkerBotProtectionConfig.getBoolean("L2WalkerProtection", false);
- +
- + // Load substuck config file (if exists)
- + final PropertiesParser substuckConfig = new PropertiesParser(CUSTOM_SUB_STUCK_CONFIG_FILE);
- + KEEP_SUBCLASS_SKILLS = substuckConfig.getBoolean("KeepSubClassSkills", false);
- }
- else if (SERVER_MODE == ServerMode.LOGIN)
- {
- diff --git a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/actor/Player.java b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/actor/Player.java
- index ec575d7..074d782 100644
- --- a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/actor/Player.java
- +++ b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/actor/Player.java
- @@ -62,7 +62,6 @@
- import org.l2jmobius.gameserver.data.sql.OfflineTraderTable;
- import org.l2jmobius.gameserver.data.xml.AdminData;
- import org.l2jmobius.gameserver.data.xml.CategoryData;
- -import org.l2jmobius.gameserver.data.xml.ClassListData;
- import org.l2jmobius.gameserver.data.xml.EnchantSkillGroupsData;
- import org.l2jmobius.gameserver.data.xml.ExperienceData;
- import org.l2jmobius.gameserver.data.xml.FishData;
- @@ -81,7 +80,6 @@
- import org.l2jmobius.gameserver.enums.ClassId;
- import org.l2jmobius.gameserver.enums.FlyType;
- import org.l2jmobius.gameserver.enums.HtmlActionScope;
- -import org.l2jmobius.gameserver.enums.IllegalActionPunishmentType;
- import org.l2jmobius.gameserver.enums.InstanceType;
- import org.l2jmobius.gameserver.enums.ItemLocation;
- import org.l2jmobius.gameserver.enums.MountType;
- @@ -347,6 +345,7 @@
- {
- // 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 RESTORE_SKILLS_FOR_CHAR_ALT_SUBCLASS = "SELECT skill_id,skill_level FROM character_skills WHERE charId=? ORDER BY (skill_level+0)";
- private static final String UPDATE_CHARACTER_SKILL_LEVEL = "UPDATE character_skills SET skill_level=? WHERE skill_id=? AND charId=? AND class_index=?";
- private static final String ADD_NEW_SKILLS = "REPLACE INTO character_skills (charId,skill_id,skill_level,class_index) VALUES (?,?,?,?)";
- private static final String DELETE_SKILL_FROM_CHAR = "DELETE FROM character_skills WHERE skill_id=? AND charId=? AND class_index=?";
- @@ -7727,46 +7726,67 @@
- /**
- * Retrieve from the database all skills of this Player and add them to _skills.
- */
- - private void restoreSkills()
- + public synchronized void restoreSkills()
- {
- - try (Connection con = DatabaseFactory.getConnection();
- - PreparedStatement ps = con.prepareStatement(RESTORE_SKILLS_FOR_CHAR))
- + try (Connection con = DatabaseFactory.getConnection())
- {
- - // Retrieve all skills of this Player from the database
- - ps.setInt(1, getObjectId());
- - ps.setInt(2, _classIndex);
- - try (ResultSet rs = ps.executeQuery())
- + if (!Config.KEEP_SUBCLASS_SKILLS)
- {
- - while (rs.next())
- + final PreparedStatement statement = con.prepareStatement(RESTORE_SKILLS_FOR_CHAR);
- + statement.setInt(1, getObjectId());
- + statement.setInt(2, getClassIndex());
- + final ResultSet rset = statement.executeQuery();
- +
- + // Go though the recordset of this SQL query
- + while (rset.next())
- {
- - final int id = rs.getInt("skill_id");
- - final int level = rs.getInt("skill_level");
- + final int id = rset.getInt("skill_id");
- + final int level = rset.getInt("skill_level");
- + if (id > 9000)
- + {
- + continue; // fake skills for base stats
- + }
- // Create a Skill object for each record
- final Skill skill = SkillData.getInstance().getSkill(id, level);
- - if (skill == null)
- - {
- - LOGGER.warning("Skipped null skill Id: " + id + " Level: " + level + " while restoring player skills for playerObjId: " + getObjectId());
- - continue;
- - }
- // Add the Skill object to the Creature _skills and its Func objects to the calculator set of the Creature
- - addSkill(skill);
- -
- - if (Config.SKILL_CHECK_ENABLE && (!canOverrideCond(PlayerCondOverride.SKILL_CONDITIONS) || Config.SKILL_CHECK_GM) && !SkillTreeData.getInstance().isSkillAllowed(this, skill))
- - {
- - Util.handleIllegalPlayerAction(this, "Player " + getName() + " has invalid skill " + skill.getName() + " (" + skill.getId() + "/" + skill.getLevel() + "), class:" + ClassListData.getInstance().getClass(getClassId()).getClassName(), IllegalActionPunishmentType.BROADCAST);
- - if (Config.SKILL_CHECK_REMOVE)
- - {
- - removeSkill(skill);
- - }
- - }
- + super.addSkill(skill);
- }
- +
- + rset.close();
- + statement.close();
- + }
- + else
- + {
- + final PreparedStatement statement = con.prepareStatement(RESTORE_SKILLS_FOR_CHAR_ALT_SUBCLASS);
- + statement.setInt(1, getObjectId());
- + final ResultSet rset = statement.executeQuery();
- +
- + // 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");
- + if (id > 9000)
- + {
- + continue; // fake skills for base stats
- + }
- +
- + // Create a Skill object for each record
- + final Skill skill = SkillData.getInstance().getSkill(id, level);
- +
- + // Add the Skill object to the Creature _skills and its Func objects to the calculator set of the Creature
- + super.addSkill(skill);
- + }
- +
- + rset.close();
- + statement.close();
- }
- }
- catch (Exception e)
- {
- - LOGGER.log(Level.WARNING, "Could not restore character " + this + " skills: " + e.getMessage(), e);
- + LOGGER.warning("Could not restore character skills: " + e);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement