Advertisement
Reanimation06

L2j substuck simple versión

Sep 28th, 2023
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 6.30 KB | Gaming | 0 0
  1.  
  2.  
  3. player.properties
  4.  
  5.  
  6. #=============================================================#
  7.  
  8. #                       Stuck Sub Class                       #
  9.  
  10. #=============================================================#
  11.  
  12. #When you add subclass your skills from main class and subclass will stuck
  13.  
  14. #Attention - this will unbalance the server
  15.  
  16. #Default: False
  17.  
  18. StuckSubclass = True
  19.  
  20.  
  21. #=============================================================#
  22.  
  23. #                  Custom Start Level Sub Class               #
  24.  
  25. #=============================================================#
  26.  
  27. #Custom lvl when player add new subclass
  28.  
  29. #default = 40
  30.  
  31. CustomSubclassLvl = 79
  32.  
  33.  
  34. -------------------------------------------------------------------------------------------
  35.  
  36. PcInstance.java
  37.  
  38.  
  39.     // Character Skill Save SQL String Definitions:
  40.  
  41.     private static final String ADD_SKILL_SAVE = "INSERT INTO character_skills_save (char_obj_id,skill_id,skill_level,effect_count,effect_cur_time,reuse_delay,systime,restore_type,class_index,buff_index) VALUES (?,?,?,?,?,?,?,?,?,?)";
  42.  
  43. +   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)";
  44.  
  45.     private static final String RESTORE_SKILL_SAVE = "SELECT skill_id,skill_level,effect_count,effect_cur_time, reuse_delay, systime, restore_type FROM character_skills_save WHERE char_obj_id=? AND class_index=? ORDER BY buff_index ASC";
  46.  
  47.     private static final String DELETE_SKILL_SAVE = "DELETE FROM character_skills_save WHERE char_obj_id=? AND class_index=?";
  48.  
  49.  
  50. line 6417
  51.  
  52.  
  53.     /**
  54.  
  55.      * Retrieve from the database all skills of this L2PcInstance and add them to _skills.
  56.  
  57.      */
  58.  
  59.     private void restoreSkills()
  60.  
  61.     {
  62.  
  63.         try (Connection con = L2DatabaseFactory.getInstance().getConnection())
  64.  
  65.         {
  66.  
  67. +           if(!Config.KEEP_SUBCLASS_SKILLS)
  68.  
  69. +           {
  70.  
  71.             PreparedStatement statement = con.prepareStatement(RESTORE_SKILLS_FOR_CHAR);
  72.  
  73.             statement.setInt(1, getObjectId());
  74.  
  75.             statement.setInt(2, getClassIndex());
  76.  
  77.             ResultSet rset = statement.executeQuery();
  78.  
  79.  
  80.             // Go though the recordset of this SQL query
  81.  
  82.             while (rset.next())
  83.  
  84.             {
  85.  
  86.                 int id = rset.getInt("skill_id");
  87.  
  88.                 int level = rset.getInt("skill_level");
  89.  
  90.  
  91.                 if (id > 9000)
  92.  
  93.                     continue; // fake skills for base stats
  94.  
  95.  
  96.                 // Create a L2Skill object for each record
  97.  
  98.                 L2Skill skill = SkillTable.getInstance().getInfo(id, level);
  99.  
  100.  
  101.                 // Add the L2Skill object to the L2Character _skills and its Func objects to the calculator set of the L2Character
  102.  
  103.                 super.addSkill(skill);
  104.  
  105.             }
  106.  
  107.  
  108.             rset.close();
  109.  
  110.             statement.close();
  111.  
  112. +       }  
  113.  
  114. +       else
  115.  
  116. +       {
  117.  
  118. +           // Retrieve all skills of this L2PcInstance from the database
  119.  
  120. +           PreparedStatement statement = con.prepareStatement(RESTORE_SKILLS_FOR_CHAR_ALT_SUBCLASS);
  121.  
  122. +           statement.setInt(1, getObjectId());
  123.  
  124. +           ResultSet rset = statement.executeQuery();
  125.  
  126. +          
  127.  
  128. +           // Go though the recordset of this SQL query
  129.  
  130. +           while (rset.next())
  131.  
  132. +           {
  133.  
  134. +               int id = rset.getInt("skill_id");
  135.  
  136. +               int level = rset.getInt("skill_level");
  137.  
  138. +              
  139.  
  140. +               if (id > 9000)
  141.  
  142. +                   continue; // fake skills for base stats
  143.  
  144. +              
  145.  
  146. +               // Create a L2Skill object for each record
  147.  
  148. +               L2Skill skill = SkillTable.getInstance().getInfo(id, level);
  149.  
  150. +              
  151.  
  152. +               // Add the L2Skill object to the L2Character _skills and its Func objects to the calculator set of the L2Character
  153.  
  154. +               super.addSkill(skill);
  155.  
  156. +           }
  157.  
  158. +          
  159.  
  160. +           rset.close();
  161.  
  162. +           statement.close();
  163.  
  164. +       }
  165.  
  166. +   }
  167.  
  168.         catch (Exception e)
  169.  
  170.         {
  171.  
  172.             _log.warning("Could not restore character skills: " + e);
  173.  
  174.         }
  175.  
  176.     }
  177.  
  178. ---------------------------------------------------------------------------------------------------------------------------
  179.  
  180. SubClass.java
  181.  
  182.  
  183. package net.sf.l2j.gameserver.model.base;
  184.  
  185.  
  186. +import net.sf.l2j.Config;
  187.  
  188. /**
  189.  
  190.  * Character Sub-Class Definition <BR>
  191.  
  192.  * Used to store key information about a character's sub-class.
  193.  
  194.  * @author Tempy
  195.  
  196.  */
  197.  
  198. public final class SubClass
  199.  
  200. {
  201.  
  202.     private PlayerClass _class;
  203.  
  204. -   private long _exp = Experience.LEVEL[40];
  205.  
  206. +   private long _exp = Experience.LEVEL[Config.CUSTOM_SUBCLASS_LVL];
  207.  
  208.     private int _sp = 0;
  209.  
  210. -   private byte _level = 40;
  211.  
  212. +   private byte _level = (byte)Config.CUSTOM_SUBCLASS_LVL;
  213.  
  214.     private int _classIndex = 1;
  215.  
  216.  
  217.     public SubClass(int classId, long exp, int sp, byte level, int classIndex)
  218.  
  219.     {
  220.  
  221.         _class = PlayerClass.values()[classId];
  222.  
  223.         _exp = exp;
  224.  
  225.         _sp = sp;
  226.  
  227.         _level = level;
  228.  
  229.         _classIndex = classIndex;
  230.  
  231.     }
  232.  
  233.  
  234. ---------------------------------------------------------------------------------------------------------------------------
  235.  
  236. Config.java
  237.  
  238.  
  239.     /** Buffs */
  240.  
  241.     public static boolean STORE_SKILL_COOLTIME;
  242.  
  243.     public static int BUFFS_MAX_AMOUNT;
  244.  
  245.  
  246. +   /**Stuck Subclass **/
  247.  
  248. +   public static boolean KEEP_SUBCLASS_SKILLS;
  249.  
  250. +   public static int CUSTOM_SUBCLASS_LVL;
  251.  
  252.  
  253.     // --------------------------------------------------
  254.  
  255.     // Server
  256.  
  257.     // --------------------------------------------------
  258.  
  259.  
  260. Line 1038
  261.  
  262.  
  263.             KARMA_AWARD_PK_KILL = players.getProperty("AwardPKKillPVPPoint", true);
  264.  
  265.             KARMA_PK_LIMIT = players.getProperty("MinimumPKRequiredToDrop", 5);
  266.  
  267.             KARMA_NONDROPPABLE_PET_ITEMS = players.getProperty("ListOfPetItems", "2375,3500,3501,3502,4422,4423,4424,4425,6648,6649,6650");
  268.  
  269.             KARMA_NONDROPPABLE_ITEMS = players.getProperty("ListOfNonDroppableItemsForPK", "1147,425,1146,461,10,2368,7,6,2370,2369");
  270.  
  271.  
  272. +            KEEP_SUBCLASS_SKILLS = Boolean.parseBoolean(players.getProperty("StuckSubclass", "False"));
  273.  
  274. +            CUSTOM_SUBCLASS_LVL = Integer.parseInt(players.getProperty("CustomSubclassLvl", "40"));
  275.  
  276.  
  277.             String[] array = KARMA_NONDROPPABLE_PET_ITEMS.split(",");
  278.  
  279.             KARMA_LIST_NONDROPPABLE_PET_ITEMS = new int[array.length];
  280.  
  281.  
  282.             for (int i = 0; i < array.length; i++)
  283.  
  284.                 KARMA_LIST_NONDROPPABLE_PET_ITEMS[i] = Integer.parseInt(array[i]);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement