L2JLisvus

Would you like to react to this message? Create an account in a few clicks or log in to continue.

+3
dandiarena
jamaica
mystogan64
7 posters

    [Share] Custom subclass configuration. More than 3 subs.

    mystogan64
    mystogan64


    Posts : 51
    Join date : 2013-10-04

    [Share] Custom subclass configuration. More than 3 subs. Empty [Share] Custom subclass configuration. More than 3 subs.

    Post  mystogan64 15th October 2013, 08:46

    Hello , today's share is a custom subclass configuration for those who want to have more than 3 sub class in their server and <ALSO> they can enable or disable the option of keeping all subclass skills .
    Lets begin....... Smile


    net.sf.l2j.gameserver.model.actor.instance.L2PcInstance.java
    Code:

    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
    Code:

    // 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
    Code:


     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
    Code:

    # ------------------------------------------------------------
    # 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
    PasteBin: http://pastebin.com/GyF6eaN5

    Give me feedback because i tested and its working for rev.453.
    jamaica
    jamaica


    Posts : 134
    Join date : 2013-02-24
    Age : 35
    Location : Romania

    [Share] Custom subclass configuration. More than 3 subs. Empty Re: [Share] Custom subclass configuration. More than 3 subs.

    Post  jamaica 15th October 2013, 13:20

    tested in haste... and it seems its working with out problem, thanks and keep sharing...
    dandiarena
    dandiarena


    Posts : 95
    Join date : 2013-06-20
    Age : 33
    Location : Argentina

    [Share] Custom subclass configuration. More than 3 subs. Empty Re: [Share] Custom subclass configuration. More than 3 subs.

    Post  dandiarena 19th October 2013, 06:19

    dont work, give me an error, in game.
    mystogan64
    mystogan64


    Posts : 51
    Join date : 2013-10-04

    [Share] Custom subclass configuration. More than 3 subs. Empty Re: [Share] Custom subclass configuration. More than 3 subs.

    Post  mystogan64 19th October 2013, 07:09

    With your post you don't help us to solve your error. Please show us what kind of error you get ingame.
    dandiarena
    dandiarena


    Posts : 95
    Join date : 2013-06-20
    Age : 33
    Location : Argentina

    [Share] Custom subclass configuration. More than 3 subs. Empty Re: [Share] Custom subclass configuration. More than 3 subs.

    Post  dandiarena 19th October 2013, 15:44

    This my error, y compile ok, no error, when i talk with npc, add subclass, chose anyone. Give me this.


    [Share] Custom subclass configuration. More than 3 subs. 33uy1xc
    mystogan64
    mystogan64


    Posts : 51
    Join date : 2013-10-04

    [Share] Custom subclass configuration. More than 3 subs. Empty Re: [Share] Custom subclass configuration. More than 3 subs.

    Post  mystogan64 19th October 2013, 16:38

    Make sure that you removed only the lines that i have past above and not new lines that you added in the addSubClass method.
    dandiarena
    dandiarena


    Posts : 95
    Join date : 2013-06-20
    Age : 33
    Location : Argentina

    [Share] Custom subclass configuration. More than 3 subs. Empty Re: [Share] Custom subclass configuration. More than 3 subs.

    Post  dandiarena 19th October 2013, 16:53

    I did exactly what you posted.

    The issue is that the sub class does it, but not low level and class changes as you should be.

    But to throw that error.

    But if volves the npc, put change class, you can see the sub that choice, it and if there if choose recent class changes you and makes you level 40.

    It works like this? I do not think, I think when you talk and the sub choose automatically changes your class and level.
    mystogan64
    mystogan64


    Posts : 51
    Join date : 2013-10-04

    [Share] Custom subclass configuration. More than 3 subs. Empty Re: [Share] Custom subclass configuration. More than 3 subs.

    Post  mystogan64 20th October 2013, 00:06

    dandiarena wrote:I did exactly what you posted.

    The issue is that the sub class does it, but not low level and class changes as you should be.

    But to throw that error.

    But if volves the npc, put change class, you can see the sub that choice, it and if there if choose recent class changes you and makes you level 40.

    It works like this? I do not think, I think when you talk and the sub choose automatically changes your class and level.
    Please can you explain this line better , because i don't understand what have you wrote there.

    and here is a video how to add the code and also the results

    legionarios likes this post

    dandiarena
    dandiarena


    Posts : 95
    Join date : 2013-06-20
    Age : 33
    Location : Argentina

    [Share] Custom subclass configuration. More than 3 subs. Empty Re: [Share] Custom subclass configuration. More than 3 subs.

    Post  dandiarena 20th October 2013, 00:20

    when you talk to gran master, and select a class, automaticaly give you the chosen class and lvl 40.

    But my problem its that, dont change class and give lvl 40, when select class.

    if i talk again to master class, and select change subclass, appeared the subclass that i chose after, when you click, yes change class and get lvl 40.

    you undestand now?
    mystogan64
    mystogan64


    Posts : 51
    Join date : 2013-10-04

    [Share] Custom subclass configuration. More than 3 subs. Empty Re: [Share] Custom subclass configuration. More than 3 subs.

    Post  mystogan64 20th October 2013, 00:22

    Yes , please check the video. If you have done any other changes in L2VillageMasterInstance or L2PcInstance before my code , please change the lines that i am showing in the video.
    dandiarena
    dandiarena


    Posts : 95
    Join date : 2013-06-20
    Age : 33
    Location : Argentina

    [Share] Custom subclass configuration. More than 3 subs. Empty Re: [Share] Custom subclass configuration. More than 3 subs.

    Post  dandiarena 20th October 2013, 00:25

    im downloading the video now, i try, and then i tell you
    dandiarena
    dandiarena


    Posts : 95
    Join date : 2013-06-20
    Age : 33
    Location : Argentina

    [Share] Custom subclass configuration. More than 3 subs. Empty Re: [Share] Custom subclass configuration. More than 3 subs.

    Post  dandiarena 20th October 2013, 16:43

    mystogan64 wrote:
    i do all this, but give me the same error, cant change and give me lvl 40, this error in console that show you before.

    i think its a little problem in l2pcinstance, but i see your video lowly and i make the same thinks but dontwork for me u.u

    i download new svn again, and edit, but the same error too.
    DnR
    DnR
    Admin
    Admin


    Posts : 1476
    Join date : 2012-12-03
    Age : 34

    [Share] Custom subclass configuration. More than 3 subs. Empty Re: [Share] Custom subclass configuration. More than 3 subs.

    Post  DnR 23rd October 2013, 22:09

    Added max subclasses part to trunk.
    Thanks a lot.
    avatar
    xbacox2010


    Posts : 41
    Join date : 2013-10-20

    [Share] Custom subclass configuration. More than 3 subs. Empty Re: [Share] Custom subclass configuration. More than 3 subs.

    Post  xbacox2010 26th October 2013, 00:27

    the acumulate skills work fine..but its not good acumulate passives you can update the code?
    here look castingnotgood
    dandiarena
    dandiarena


    Posts : 95
    Join date : 2013-06-20
    Age : 33
    Location : Argentina

    [Share] Custom subclass configuration. More than 3 subs. Empty Re: [Share] Custom subclass configuration. More than 3 subs.

    Post  dandiarena 26th October 2013, 00:31

    xbacox2010 wrote:the acumulate skills work fine..but its not good acumulate passives you can update the code?
    here look castingnotgood
    this have a simple solution, or put anti light armor passive skills in magic class.

    or update skill light armor mastery 227 lvl 52 to all skill call light armor mastery in your navicat skill_tree.
    avatar
    xbacox2010


    Posts : 41
    Join date : 2013-10-20

    [Share] Custom subclass configuration. More than 3 subs. Empty Re: [Share] Custom subclass configuration. More than 3 subs.

    Post  xbacox2010 26th October 2013, 08:37

    how edit the values that you saying
    dandiarena
    dandiarena


    Posts : 95
    Join date : 2013-06-20
    Age : 33
    Location : Argentina

    [Share] Custom subclass configuration. More than 3 subs. Empty Re: [Share] Custom subclass configuration. More than 3 subs.

    Post  dandiarena 26th October 2013, 15:24

    Well the first part its simple, i used much because i like stuck servers and this problem its the firts.

    In the navicat, add new query, and put this...

    UPDATE `skill_trees` SET `skill_id`='227' WHERE (`name`='Light Armor Mastery');
    UPDATE `skill_trees` SET `skill_id`='231' WHERE (`name`='Heavy Armor Mastery');

    This update all skills to this id skill from all skills that have this names

    This works good, test it and tell me.



    avatar
    xbacox2010


    Posts : 41
    Join date : 2013-10-20

    [Share] Custom subclass configuration. More than 3 subs. Empty Re: [Share] Custom subclass configuration. More than 3 subs.

    Post  xbacox2010 26th October 2013, 22:12

    [Err] 1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'UPDATE `skill_trees` SET `skill_id`='227' WHERE (`name`='Light Armor Mastery');
    ' at line 1
    dandiarena
    dandiarena


    Posts : 95
    Join date : 2013-06-20
    Age : 33
    Location : Argentina

    [Share] Custom subclass configuration. More than 3 subs. Empty Re: [Share] Custom subclass configuration. More than 3 subs.

    Post  dandiarena 26th October 2013, 22:50

    Code:
    UPDATE `skill_trees` SET `skill_id`='227' WHERE (`name`='Light Armor Mastery');
    UPDATE `skill_trees` SET `skill_id`='231' WHERE (`name`='Heavy Armor Mastery');
    copy the same
    avatar
    xbacox2010


    Posts : 41
    Join date : 2013-10-20

    [Share] Custom subclass configuration. More than 3 subs. Empty Re: [Share] Custom subclass configuration. More than 3 subs.

    Post  xbacox2010 26th October 2013, 23:16

    work bad...
    dandiarena
    dandiarena


    Posts : 95
    Join date : 2013-06-20
    Age : 33
    Location : Argentina

    [Share] Custom subclass configuration. More than 3 subs. Empty Re: [Share] Custom subclass configuration. More than 3 subs.

    Post  dandiarena 26th October 2013, 23:19

    for me works good, try to do manually
    avatar
    xbacox2010


    Posts : 41
    Join date : 2013-10-20

    [Share] Custom subclass configuration. More than 3 subs. Empty Re: [Share] Custom subclass configuration. More than 3 subs.

    Post  xbacox2010 28th October 2013, 04:38

    works fine thanks Very Happy


    Last edited by xbacox2010 on 28th October 2013, 05:41; edited 1 time in total (Reason for editing : i am stupid :P)
    avatar
    xbacox2010


    Posts : 41
    Join date : 2013-10-20

    [Share] Custom subclass configuration. More than 3 subs. Empty Re: [Share] Custom subclass configuration. More than 3 subs.

    Post  xbacox2010 29th October 2013, 08:55

    how edit only base class get third change class skills and the others any subs  the third change class not give anything skills?


    Last edited by xbacox2010 on 30th October 2013, 01:51; edited 1 time in total (Reason for editing : ...)
    avatar
    manutuning2


    Posts : 33
    Join date : 2013-10-30

    [Share] Custom subclass configuration. More than 3 subs. Empty Re: [Share] Custom subclass configuration. More than 3 subs.

    Post  manutuning2 1st February 2014, 01:54

    is working badly for rev 470, will take some modification for the new trunk?

    I hope some solution

    thanks
    avatar
    FLeandro93


    Posts : 55
    Join date : 2014-06-20

    [Share] Custom subclass configuration. More than 3 subs. Empty Re: [Share] Custom subclass configuration. More than 3 subs.

    Post  FLeandro93 28th June 2014, 06:19

    restriction of skills de 3rd class if possible to add?

    Sponsored content


    [Share] Custom subclass configuration. More than 3 subs. Empty Re: [Share] Custom subclass configuration. More than 3 subs.

    Post  Sponsored content


      Current date/time is 17th October 2024, 00:36