Advertisement
Reanimation06

L2j substuck fissban versión

Sep 28th, 2023
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 10.03 KB | Gaming | 0 0
  1. ### Eclipse Workspace Patch 1.0
  2. #P L2J_Server
  3. Index: dist/game/config/L2JMods.properties
  4. ===================================================================
  5. --- dist/game/config/L2JMods.properties (revision 6353)
  6. +++ dist/game/config/L2JMods.properties (working copy)
  7. @@ -3,6 +3,24 @@
  8.  # Be warned that there may be no support for these mods beyond the original author's assistance.
  9.  
  10. # ---------------------------------------------------------------------------
  11. +# Subclass Acu by fissban
  12. +# ---------------------------------------------------------------------------
  13. +
  14. +# Aqui activamos el sistema de subclass Acu
  15. +# default false
  16. +AcumulativeSkills = false
  17. +
  18. +# Aqui activamos para que solo se acumulen los skills pasivos
  19. +AcumulativeSkillsPasive = False
  20. +
  21. +# Aqui activamos por si solo queremos q cierto skills no se acumulen, como por ejemplo los
  22. +# skills de 3ra y bien los pasivos de armas y armaduras
  23. +DontAcumulativeSkills = False
  24. +
  25. +# Aqui definimos los skills q no se acumularan
  26. +DontAcumulativeSkillsId = 351;349
  27. +
  28. +# ---------------------------------------------------------------------------
  29. # Champion mobs - Turn random mobs into Champions
  30. # ---------------------------------------------------------------------------
  31.  
  32. Index: java/com/l2jserver/Config.java
  33. ===================================================================
  34. --- java/com/l2jserver/Config.java  (revision 6353)
  35. +++ java/com/l2jserver/Config.java  (working copy)
  36. @@ -103,6 +103,11 @@
  37.     public static final String SECURITY_CONFIG_FILE = "./config/Security.properties";
  38.     public static final String EMAIL_CONFIG_FILE = "./config/Email.properties";
  39.     public static final String CH_SIEGE_FILE = "./config/ConquerableHallSiege.properties";
  40. +  
  41. +   public static boolean ACUMULATIVE_SUBCLASS_SKILLS;
  42. +   public static boolean ACUMULATIVE_SUBCLASS_PASIVE;
  43. +   public static boolean ACUMULATIVE_SUBCLASS_DONT_SKILLS;
  44. +   public static String[] ACUMULATIVE_SUBCLASS_DONT_SKILLS_ID;
  45.     // --------------------------------------------------
  46.     // L2J Variable Definitions
  47.     // --------------------------------------------------
  48. @@ -2429,6 +2434,10 @@
  49.                 _log.log(Level.SEVERE, "Error while loading L2JMod settings!", e);
  50.             }
  51.            
  52. +           ACUMULATIVE_SUBCLASS_SKILLS = Boolean.parseBoolean(L2JModSettings.getProperty("AcumulativeSkills", "false"));
  53. +           ACUMULATIVE_SUBCLASS_PASIVE = Boolean.parseBoolean(L2JModSettings.getProperty("AcumulativeSkillsPasive", "false"));
  54. +           ACUMULATIVE_SUBCLASS_DONT_SKILLS = Boolean.parseBoolean(L2JModSettings.getProperty("DontAcumulativeSkills", "true"));
  55. +           ACUMULATIVE_SUBCLASS_DONT_SKILLS_ID = String.valueOf(L2JModSettings.getProperty("DontAcumulativeSkillsId", "351")).split(";");
  56.             L2JMOD_CHAMPION_ENABLE = Boolean.parseBoolean(L2JModSettings.getProperty("ChampionEnable", "false"));
  57.             L2JMOD_CHAMPION_PASSIVE = Boolean.parseBoolean(L2JModSettings.getProperty("ChampionPassive", "false"));
  58.             L2JMOD_CHAMPION_FREQUENCY = Integer.parseInt(L2JModSettings.getProperty("ChampionFrequency", "0"));
  59. Index: java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java
  60. ===================================================================
  61. --- java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java    (revision 6511)
  62. +++ java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java    (working copy)
  63. @@ -310,6 +310,8 @@
  64.  */
  65. public final class L2PcInstance extends L2Playable
  66. {
  67. +   // SubAcu by fissban
  68. +   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";
  69.     // Character Skill SQL String Definitions:
  70.     private static final String RESTORE_SKILLS_FOR_CHAR = "SELECT skill_id,skill_level FROM character_skills WHERE charId=? AND class_index=?";
  71.     private static final String ADD_NEW_SKILL = "INSERT INTO character_skills (charId,skill_id,skill_level,class_index) VALUES (?,?,?,?)";
  72. @@ -8560,50 +8562,129 @@
  73.      */
  74.     private void restoreSkills()
  75.     {
  76. -       try (Connection con = L2DatabaseFactory.getInstance().getConnection();
  77. -           PreparedStatement statement = con.prepareStatement(RESTORE_SKILLS_FOR_CHAR))
  78. +       if (Config.ACUMULATIVE_SUBCLASS_SKILLS)
  79.         {
  80. -           // Retrieve all skills of this L2PcInstance from the database
  81. -           statement.setInt(1, getObjectId());
  82. -           statement.setInt(2, getClassIndex());
  83. -           final ResultSet rset = statement.executeQuery();
  84. -          
  85. -           // Go though the recordset of this SQL query
  86. -           while (rset.next())
  87. +           try (Connection con = L2DatabaseFactory.getInstance().getConnection();
  88. +               PreparedStatement statement = con.prepareStatement(ACUMULATE_SKILLS_FOR_CHAR_SUB))
  89.             {
  90. -               final int id = rset.getInt("skill_id");
  91. -               final int level = rset.getInt("skill_level");
  92. -              
  93. -               // Create a L2Skill object for each record
  94. -               final L2Skill skill = SkillTable.getInstance().getInfo(id, level);
  95. -              
  96. -               if (skill == null)
  97. +               statement.setInt(1, getObjectId());
  98. +               // statement.setInt(2, getClassIndex());
  99. +               try (ResultSet rset = statement.executeQuery())
  100.                 {
  101. -                   _log.warning("Skipped null skill Id: " + id + " Level: " + level + " while restoring player skills for playerObjId: " + getObjectId());
  102. -                   continue;
  103. +                  
  104. +                   // Go though the recordset of this SQL query
  105. +                   while (rset.next())
  106. +                   {
  107. +                       final int id = rset.getInt("skill_id");
  108. +                       final int level = rset.getInt("skill_level");
  109. +                       final int class_index = rset.getInt("class_index");
  110. +                      
  111. +                       // Create a L2Skill object for each record
  112. +                       final L2Skill skill = SkillTable.getInstance().getInfo(id, level);
  113. +                      
  114. +                       if (skill == null)
  115. +                       {
  116. +                           _log.warning("Skipped null skill Id: " + id + " Level: " + level + " while restoring player skills for playerObjId: " + getObjectId());
  117. +                           continue;
  118. +                       }
  119. +                      
  120. +                       if (getClassIndex() != class_index)
  121. +                       {
  122. +                           // solo acumulamos activos.
  123. +                           if (Config.ACUMULATIVE_SUBCLASS_PASIVE && skill.isPassive())
  124. +                           {
  125. +                               continue;
  126. +                           }
  127. +                          
  128. +                           // no acumulamos algunos skills especificos.
  129. +                           if (Config.ACUMULATIVE_SUBCLASS_SKILLS)
  130. +                           {
  131. +                               for (String skillId : Config.ACUMULATIVE_SUBCLASS_DONT_SKILLS_ID)
  132. +                               {
  133. +                                   try
  134. +                                   {
  135. +                                       if (Integer.getInteger(skillId) == id)
  136. +                                       {
  137. +                                           continue;
  138. +                                       }
  139. +                                   }
  140. +                                   catch (Exception e)
  141. +                                   {
  142. +                                       _log.warning("los skills usados en DontAcumulativeSkillsId no esta bien escrito ¬¬");
  143. +                                   }
  144. +                               }
  145. +                           }
  146. +                       }
  147. +                      
  148. +                       // Add the L2Skill object to the L2Character _skills and its Func objects to the calculator set of the L2Character
  149. +                       addSkill(skill);
  150. +                      
  151. +                       if (Config.SKILL_CHECK_ENABLE && (!canOverrideCond(PcCondOverride.SKILL_CONDITIONS) || Config.SKILL_CHECK_GM))
  152. +                       {
  153. +                           if (!SkillTreesData.getInstance().isSkillAllowed(this, skill))
  154. +                           {
  155. +                               Util.handleIllegalPlayerAction(this, "Player " + getName() + " has invalid skill " + skill.getName() + " (" + skill.getId() + "/" + skill.getLevel() + "), class:" + ClassListData.getInstance().getClass(getClassId()).getClassName(), 1);
  156. +                               if (Config.SKILL_CHECK_REMOVE)
  157. +                               {
  158. +                                   removeSkill(skill);
  159. +                               }
  160. +                           }
  161. +                       }
  162. +                   }
  163.                 }
  164. -              
  165. -               // Add the L2Skill object to the L2Character _skills and its Func objects to the calculator set of the L2Character
  166. -               addSkill(skill);
  167. -              
  168. -               if (Config.SKILL_CHECK_ENABLE && (!canOverrideCond(PcCondOverride.SKILL_CONDITIONS) || Config.SKILL_CHECK_GM))
  169. +           }
  170. +           catch (Exception e)
  171. +           {
  172. +               _log.log(Level.WARNING, "Could not restore character " + this + " skills: " + e.getMessage(), e);
  173. +           }
  174. +       }
  175. +       else
  176. +       {
  177. +           try (Connection con = L2DatabaseFactory.getInstance().getConnection();
  178. +               PreparedStatement statement = con.prepareStatement(RESTORE_SKILLS_FOR_CHAR))
  179. +           {
  180. +               // Retrieve all skills of this L2PcInstance from the database
  181. +               statement.setInt(1, getObjectId());
  182. +               statement.setInt(2, getClassIndex());
  183. +               try (ResultSet rset = statement.executeQuery())
  184.                 {
  185. -                   if (!SkillTreesData.getInstance().isSkillAllowed(this, skill))
  186. +                   // Go though the recordset of this SQL query
  187. +                   while (rset.next())
  188.                     {
  189. -                       Util.handleIllegalPlayerAction(this, "Player " + getName() + " has invalid skill " + skill.getName() + " (" + skill.getId() + "/" + skill.getLevel() + "), class:" + ClassListData.getInstance().getClass(getClassId()).getClassName(), 1);
  190. -                       if (Config.SKILL_CHECK_REMOVE)
  191. +                       final int id = rset.getInt("skill_id");
  192. +                       final int level = rset.getInt("skill_level");
  193. +                      
  194. +                       // Create a L2Skill object for each record
  195. +                       final L2Skill skill = SkillTable.getInstance().getInfo(id, level);
  196. +                      
  197. +                       if (skill == null)
  198.                         {
  199. -                           removeSkill(skill);
  200. +                           _log.warning("Skipped null skill Id: " + id + " Level: " + level + " while restoring player skills for playerObjId: " + getObjectId());
  201. +                           continue;
  202.                         }
  203. +                      
  204. +                       // Add the L2Skill object to the L2Character _skills and its Func objects to the calculator set of the L2Character
  205. +                       addSkill(skill);
  206. +                      
  207. +                       if (Config.SKILL_CHECK_ENABLE && (!canOverrideCond(PcCondOverride.SKILL_CONDITIONS) || Config.SKILL_CHECK_GM))
  208. +                       {
  209. +                           if (!SkillTreesData.getInstance().isSkillAllowed(this, skill))
  210. +                           {
  211. +                               Util.handleIllegalPlayerAction(this, "Player " + getName() + " has invalid skill " + skill.getName() + " (" + skill.getId() + "/" + skill.getLevel() + "), class:" + ClassListData.getInstance().getClass(getClassId()).getClassName(), 1);
  212. +                               if (Config.SKILL_CHECK_REMOVE)
  213. +                               {
  214. +                                   removeSkill(skill);
  215. +                               }
  216. +                           }
  217. +                       }
  218.                     }
  219.                 }
  220.             }
  221. -           rset.close();
  222. +           catch (Exception e)
  223. +           {
  224. +               _log.log(Level.WARNING, "Could not restore character " + this + " skills: " + e.getMessage(), e);
  225. +           }
  226.         }
  227. -       catch (Exception e)
  228. -       {
  229. -           _log.log(Level.WARNING, "Could not restore character " + this + " skills: " + e.getMessage(), e);
  230. -       }
  231.     }
  232.    
  233.     /**
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement