Advertisement
Reanimation06

L2jmobius h5 substuck

Nov 19th, 2023
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 10.56 KB | Gaming | 0 0
  1. 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
  2. index f984695..4fb5cc2 100644
  3. --- a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/Config.java
  4. +++ b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/Config.java
  5. @@ -147,6 +147,8 @@
  6.     private static final String CUSTOM_WAREHOUSE_SORTING_CONFIG_FILE = "./config/Custom/WarehouseSorting.ini";
  7.     private static final String CUSTOM_WEDDING_CONFIG_FILE = "./config/Custom/Wedding.ini";
  8.     private static final String CUSTOM_WALKER_BOT_PROTECTION_CONFIG_FILE = "./config/Custom/WalkerBotProtection.ini";
  9. +   private static final String CUSTOM_SUB_STUCK_CONFIG_FILE = "./config/Custom/SubStuck.ini";
  10.  
  11.  
  12.  
  13. @@ -1351,6 +1394,12 @@
  14.     public static long SELLBUFF_MAX_PRICE;
  15.     public static int SELLBUFF_MAX_BUFFS;
  16.    
  17. +   /** SUBSTUCK MOD **/
  18. +   public static boolean ACUMULATIVE_SUBCLASS_SKILLS;
  19. +   public static boolean ACUMULATIVE_SUBCLASS_PASIVE;
  20. +   public static boolean ACUMULATIVE_SUBCLASS_DONT_SKILLS;
  21. +   public static String[] ACUMULATIVE_SUBCLASS_DONT_SKILLS_ID;
  22. +  
  23.     public static boolean ENABLE_GUI;
  24.     public static boolean DARK_THEME;
  25.  
  26.  
  27. @@ -3125,6 +3217,13 @@
  28.             SELLBUFF_MAX_PRICE = sellBuffConfig.getLong("MaximumPrice", 100000000);
  29.             SELLBUFF_MAX_BUFFS = sellBuffConfig.getInt("MaxBuffs", 15);
  30.            
  31. +           // Load substuck config file (if exists)
  32. +           final PropertiesParser substuckConfig = new PropertiesParser(CUSTOM_SUB_STUCK_CONFIG_FILE);
  33. +           ACUMULATIVE_SUBCLASS_SKILLS = substuckConfig.getBoolean("AcumulativeSkills", false);
  34. +           ACUMULATIVE_SUBCLASS_PASIVE = substuckConfig.getBoolean("AcumulativeSkillsPasive", false);
  35. +           ACUMULATIVE_SUBCLASS_DONT_SKILLS = substuckConfig.getBoolean("DontAcumulativeSkills", true);
  36. +           ACUMULATIVE_SUBCLASS_DONT_SKILLS_ID = substuckConfig.getString("DontAcumulativeSkillsId", "351").split(";");
  37. +          
  38.             // Load ServerTime config file (if exists)
  39.             final PropertiesParser serverTimeConfig = new PropertiesParser(CUSTOM_SERVER_TIME_CONFIG_FILE);
  40.             DISPLAY_SERVER_TIME = serverTimeConfig.getBoolean("DisplayServerTime", false);
  41. 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
  42. index ec575d7..13be6d8 100644
  43. --- a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/actor/Player.java
  44. +++ b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/actor/Player.java
  45. @@ -345,6 +345,8 @@
  46.   */
  47.  public class Player extends Playable
  48.  {
  49. +   // SubAcu mod
  50. +   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";
  51.     // Character Skill SQL String Definitions:
  52.     private static final String RESTORE_SKILLS_FOR_CHAR = "SELECT skill_id,skill_level FROM character_skills WHERE charId=? AND class_index=?";
  53.     private static final String UPDATE_CHARACTER_SKILL_LEVEL = "UPDATE character_skills SET skill_level=? WHERE skill_id=? AND charId=? AND class_index=?";
  54. @@ -7729,44 +7731,142 @@
  55.      */
  56.     private void restoreSkills()
  57.     {
  58. -       try (Connection con = DatabaseFactory.getConnection();
  59. -           PreparedStatement ps = con.prepareStatement(RESTORE_SKILLS_FOR_CHAR))
  60. +       if (Config.ACUMULATIVE_SUBCLASS_SKILLS)
  61.         {
  62. -           // Retrieve all skills of this Player from the database
  63. -           ps.setInt(1, getObjectId());
  64. -           ps.setInt(2, _classIndex);
  65. -           try (ResultSet rs = ps.executeQuery())
  66. +           try (Connection con = DatabaseFactory.getConnection();
  67. +               PreparedStatement statement = con.prepareStatement(ACUMULATE_SKILLS_FOR_CHAR_SUB))
  68.             {
  69. -               while (rs.next())
  70. +               statement.setInt(1, getObjectId());
  71. +               // statement.setInt(2, getClassIndex());
  72. +               try (ResultSet rset = statement.executeQuery())
  73.                 {
  74. -                   final int id = rs.getInt("skill_id");
  75. -                   final int level = rs.getInt("skill_level");
  76.                    
  77. -                   // Create a Skill object for each record
  78. -                   final Skill skill = SkillData.getInstance().getSkill(id, level);
  79. -                   if (skill == null)
  80. +                   // Go though the recordset of this SQL query
  81. +                   while (rset.next())
  82.                     {
  83. -                       LOGGER.warning("Skipped null skill Id: " + id + " Level: " + level + " while restoring player skills for playerObjId: " + getObjectId());
  84. -                       continue;
  85. -                   }
  86. -                  
  87. -                   // Add the Skill object to the Creature _skills and its Func objects to the calculator set of the Creature
  88. -                   addSkill(skill);
  89. -                  
  90. -                   if (Config.SKILL_CHECK_ENABLE && (!canOverrideCond(PlayerCondOverride.SKILL_CONDITIONS) || Config.SKILL_CHECK_GM) && !SkillTreeData.getInstance().isSkillAllowed(this, skill))
  91. -                   {
  92. -                       Util.handleIllegalPlayerAction(this, "Player " + getName() + " has invalid skill " + skill.getName() + " (" + skill.getId() + "/" + skill.getLevel() + "), class:" + ClassListData.getInstance().getClass(getClassId()).getClassName(), IllegalActionPunishmentType.BROADCAST);
  93. -                       if (Config.SKILL_CHECK_REMOVE)
  94. +                       final int id = rset.getInt("skill_id");
  95. +                       final int level = rset.getInt("skill_level");
  96. +                       final int class_index = rset.getInt("class_index");
  97. +                      
  98. +                       // Create a L2Skill object for each record
  99. +                       final Skill skill = SkillData.getInstance().getSkill(id, level);
  100. +                      
  101. +                       if (skill == null)
  102.                         {
  103. -                           removeSkill(skill);
  104. +                           LOGGER.warning("Skipped null skill Id: " + id + " Level: " + level + " while restoring player skills for playerObjId: " + getObjectId());
  105. +                           continue;
  106. +                       }
  107. +                      
  108. +                       if (getClassIndex() != class_index)
  109. +                       {
  110. +                           // solo acumulamos activos.
  111. +                           if (Config.ACUMULATIVE_SUBCLASS_PASIVE && skill.isPassive())
  112. +                           {
  113. +                               continue;
  114. +                           }
  115. +                          
  116. +                           // no acumulamos algunos skills especificos.
  117. +                           if (Config.ACUMULATIVE_SUBCLASS_DONT_SKILLS)
  118. +                           {
  119. +                               List<String> dontAcumulativeSkillsIdList = Arrays.asList(Config.ACUMULATIVE_SUBCLASS_DONT_SKILLS_ID);
  120. +                               boolean isSkillInDontList = false;
  121. +                              
  122. +                               for (String skillId : dontAcumulativeSkillsIdList)
  123. +                               {
  124. +                                   try
  125. +                                   {
  126. +                                       int skillIdInt = Integer.parseInt(skillId);
  127. +                                       if (skillIdInt == id)
  128. +                                       {
  129. +                                           isSkillInDontList = true;
  130. +                                           break; // Salir del bucle si se encuentra una coincidencia
  131. +                                       }
  132. +                                   }
  133. +                                   catch (NumberFormatException e)
  134. +                                   {
  135. +                                       LOGGER.warning("Los skill IDs en DontAcumulativeSkillsId no están bien escritos ¬¬");
  136. +                                   }
  137. +                               }
  138. +                              
  139. +                               // Si el skill está en la lista de exclusión, no agregarlo
  140. +                               if (isSkillInDontList)
  141. +                               {
  142. +                                   continue;
  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(PlayerCondOverride.SKILL_CONDITIONS) || Config.SKILL_CHECK_GM))
  152. +                       {
  153. +                           if (!SkillTreeData.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(), IllegalActionPunishmentType.BROADCAST);
  156. +                               if (Config.SKILL_CHECK_REMOVE)
  157. +                               {
  158. +                                   removeSkill(skill);
  159. +                               }
  160. +                           }
  161.                         }
  162.                     }
  163.                 }
  164.             }
  165. +           catch (Exception e)
  166. +           {
  167. +               LOGGER.log(Level.WARNING, "Could not restore character " + this + " skills: " + e.getMessage(), e);
  168. +           }
  169.         }
  170. -       catch (Exception e)
  171. +       else
  172.         {
  173. -           LOGGER.log(Level.WARNING, "Could not restore character " + this + " skills: " + e.getMessage(), e);
  174. +           try (Connection con = DatabaseFactory.getConnection();
  175. +               PreparedStatement statement = con.prepareStatement(RESTORE_SKILLS_FOR_CHAR))
  176. +           {
  177. +               // Retrieve all skills of this L2PcInstance from the database
  178. +               statement.setInt(1, getObjectId());
  179. +               statement.setInt(2, getClassIndex());
  180. +               try (ResultSet rset = statement.executeQuery())
  181. +               {
  182. +                  
  183. +                   // Go though the recordset of this SQL query
  184. +                   while (rset.next())
  185. +                   {
  186. +                       final int id = rset.getInt("skill_id");
  187. +                       final int level = rset.getInt("skill_level");
  188. +                      
  189. +                       // Create a L2Skill object for each record
  190. +                       final Skill skill = SkillData.getInstance().getSkill(id, level);
  191. +                      
  192. +                       if (skill == null)
  193. +                       {
  194. +                           LOGGER.warning("Skipped null skill Id: " + id + " Level: " + level + " while restoring player skills for playerObjId: " + getObjectId());
  195. +                           continue;
  196. +                       }
  197. +                      
  198. +                       // Add the L2Skill object to the L2Character _skills and its Func objects to the calculator set of the L2Character
  199. +                       addSkill(skill);
  200. +                      
  201. +                       if (Config.SKILL_CHECK_ENABLE && (!canOverrideCond(PlayerCondOverride.SKILL_CONDITIONS) || Config.SKILL_CHECK_GM))
  202. +                       {
  203. +                           if (!SkillTreeData.getInstance().isSkillAllowed(this, skill))
  204. +                           {
  205. +                               Util.handleIllegalPlayerAction(this, "Player " + getName() + " has invalid skill " + skill.getName() + " (" + skill.getId() + "/" + skill.getLevel() + "), class:" + ClassListData.getInstance().getClass(getClassId()).getClassName(), IllegalActionPunishmentType.BROADCAST);
  206. +                               if (Config.SKILL_CHECK_REMOVE)
  207. +                               {
  208. +                                   removeSkill(skill);
  209. +                               }
  210. +                           }
  211. +                       }
  212. +                   }
  213. +               }
  214. +           }
  215. +          
  216. +           catch (Exception e)
  217. +           {
  218. +               LOGGER.log(Level.WARNING, "Could not restore character " + this + " skills: " + e.getMessage(), e);
  219. +           }
  220.         }
  221.     }
  222. diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/config/Custom/SubStuck.ini b/L2J_Mobius_CT_2.6_HighFive/dist/game/config/Custom/SubStuck.ini
  223. new file mode 100644
  224. index 0000000..e943557
  225. --- /dev/null
  226. +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/config/Custom/SubStuck.ini
  227. @@ -0,0 +1,17 @@
  228. +# ---------------------------------------------------------------------------
  229. +# Subclass Acu mod
  230. +# ---------------------------------------------------------------------------
  231. +
  232. +# Aqui activamos el sistema de subclass Acu
  233. +# default false
  234. +AcumulativeSkills = True
  235. +
  236. +# Aqui activamos para que no se acumulen los skills pasivos
  237. +AcumulativeSkillsPasive = False
  238. +
  239. +# Aqui activamos por si solo queremos q cierto skills no se acumulen, como por ejemplo los
  240. +# skills de 3ra y bien los pasivos de armas y armaduras
  241. +DontAcumulativeSkills = True
  242. +
  243. +# Aqui definimos los skills q no se acumularan
  244. +DontAcumulativeSkillsId = 141;249;250;463;227;236;252;258;465;234;235;251;231;232;253;259;118;233
  245. +
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement