A Project for Chronicle 4 based on L2JServer.


    help with this code

    Share

    lordeze

    Posts : 97
    Join date : 2013-05-07

    help with this code

    Post  lordeze on 11th July 2013, 19:07

    I got this code and I need a help text so I can adapt it to the trunk with eclipse does not give me error but I have manually put results need help and can not find the error in the lines. changes the svn changes as the number of lines I need help know the numbers of the lines and some of the code is changed then I agreo with eclipse to compile it snv

    Index: L2J_Server/dist/game/config/Character.properties
    ================================================== =================
    --- L2J_Server/dist/game/config/Character.properties (revision 4004)
    +++ L2J_Server/dist/game/config/Character.properties
    (working copy)
    @@ -133,6 +133,10 @@
    # Deault: False
    SubclassStoreSkillCooltime = False

    +# If true, previous skills will not be removed when you change your subclass.
    +# default = false
    +AltSubClassSkills = False
    +
    # These are alternative rules for shields.
    # If True and they block:
    # The damage is powerAtk-shieldDef,

    Index: C:/workspace/x7 L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java
    ================================================== =================
    --- C:/workspace/x7 L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java (revision 4004)
    +++ C:/workspace/x7 L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java (working copy)
    @@ -257,6 +257,7 @@
    public final class L2PcInstance extends L2Playable
    {
    // Character Skill SQL String Definitions:
    + private static final String ACUMULATE_SKILLS_FOR_CHAR_SUB = "SELECT skill_id,skill_level FROM character_skills WHERE charId=? ORDER BY skill_id , skill_level ASC";
    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 ADD_NEW_SKILL = "INSERT INTO character_skills (charId,skill_id,skill_level,class_index) VALUES (?,?,?,?)";
    private static final String UPDATE_CHARACTER_SKILL_LEVEL = "UPDATE character_skills SET skill_level=? WHERE skill_id=? AND charId=? AND class_index=?";
    @@ -8104,15 +8105,18 @@
    {
    Connection con = null;

    - 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();
    + try
    + {
    + boolean isAcumulative = Config.ACUMULATIVE_SUBCLASS_SKILLS;
    +
    + // Retrieve all skills of this L2PcInstance from the database
    + con = L2DatabaseFactory.getInstance().getConnection();
    + PreparedStatement statement = con.prepareStatement(isAcumulative ? ACUMULATE_SKILLS_FOR_CHAR_SUB : RESTORE_SKILLS_FOR_CHAR);
    +
    + statement.setInt(1, getObjectId());
    + if (!isAcumulative)
    + statement.setInt(2, getClassIndex());
    + ResultSet rset = statement.executeQuery();

    // Go though the recordset of this SQL query
    while (rset.next())

    Index: C:/workspace/x7 L2_GameServer/java/com/l2jserver/Config.java
    ================================================== =================
    --- C:/workspace/x7 L2_GameServer/java/com/l2jserver/Config.java (revision 4004)
    +++ C:/workspace/x7 L2_GameServer/java/com/l2jserver/Config.java (working copy)
    @@ -103,6 +103,7 @@
    public static int PLAYER_FAKEDEATH_UP_PROTECTION;
    public static boolean STORE_SKILL_COOLTIME;
    public static boolean SUBCLASS_STORE_SKILL_COOLTIME;
    + public static boolean ACUMULATIVE_SUBCLASS_SKILLS;
    public static boolean ALT_GAME_SHIELD_BLOCKS;
    public static int ALT_PERFECT_SHLD_BLOCK;
    public static boolean ALLOW_CLASS_MASTERS;

    @@ -1330,6 +1360,7 @@
    PLAYER_FAKEDEATH_UP_PROTECTION = Integer.parseInt(Character.getProperty("PlayerFakeDeathUpProtection", "0"));
    STORE_SKILL_COOLTIME = Boolean.parseBoolean(Character.getProperty("StoreS killCooltime", "true"));
    SUBCLASS_STORE_SKILL_COOLTIME = Boolean.parseBoolean(Character.getProperty("SubclassStoreSkillCooltime", "false"));
    + ACUMULATIVE_SUBCLASS_SKILLS = Boolean.parseBoolean(Character.getProperty("AltSubClassSkills", "False"));
    ALT_GAME_SHIELD_BLOCKS = Boolean.parseBoolean(Character.getProperty("AltShieldBlocks", "false"));
    ALT_PERFECT_SHLD_BLOCK = Integer.parseInt(Character.getProperty("AltPerfectShieldBlockRate", "10"));
    ALLOW_CLASS_MASTERS = Boolean.parseBoolean(Character.getProperty("AllowClassMasters", "False"));

    thank you very much for your help
    avatar
    DnR
    Admin
    Admin

    Posts : 1023
    Join date : 2012-12-03

    Re: help with this code

    Post  DnR on 12th July 2013, 12:04

    Unfortunately, i can' t create a patch for you right now, but point out the differences, so that you can adapt the code manually via notepad. Use find button to find nearby existing lines, so that you know where to add each part.

    In config/custom.properties

    +# If true, previous skills will not be removed when you change your subclass.
    +# default = false
    +AltSubClassSkills = False
    +

    Index: C:/workspace/x7 L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java
    ================================================== =================
    --- C:/workspace/x7 L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java (revision 4004)
    +++ C:/workspace/x7 L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java (working copy)
    @@ -257,6 +257,7 @@
    public final class L2PcInstance extends L2Playable
    {
    // Character Skill SQL String Definitions:
    + private static final String ACUMULATE_SKILLS_FOR_CHAR_SUB = "SELECT skill_id,skill_level FROM character_skills WHERE char_obj_id=? ORDER BY skill_id , skill_level ASC";
    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 ADD_NEW_SKILL = "INSERT INTO character_skills (charId,skill_id,skill_level,class_index) VALUES (?,?,?,?)";
    private static final String UPDATE_CHARACTER_SKILL_LEVEL = "UPDATE character_skills SET skill_level=? WHERE skill_id=? AND charId=? AND class_index=?";
    @@ -8104,15 +8105,18 @@
    {
    Connection con = null;

    - 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();
    + try
    + {
    + boolean isAcumulative = Config.ACUMULATIVE_SUBCLASS_SKILLS;
    +
    + // Retrieve all skills of this L2PcInstance from the database
    + con = L2DatabaseFactory.getInstance().getConnection();
    + PreparedStatement statement = con.prepareStatement(isAcumulative ? ACUMULATE_SKILLS_FOR_CHAR_SUB : RESTORE_SKILLS_FOR_CHAR);
    +
    + statement.setInt(1, getObjectId());
    + if (!isAcumulative)
    + statement.setInt(2, getClassIndex());
    + ResultSet rset = statement.executeQuery();

    // Go though the recordset of this SQL query
    while (rset.next())

    Index: C:/workspace/x7 L2_GameServer/java/com/l2jserver/Config.java
    ================================================== =================
    --- C:/workspace/x7 L2_GameServer/java/com/l2jserver/Config.java (revision 4004)
    +++ C:/workspace/x7 L2_GameServer/java/com/l2jserver/Config.java (working copy)
    @@ -103,6 +103,7 @@
    public static int PLAYER_FAKEDEATH_UP_PROTECTION;
    public static boolean STORE_SKILL_COOLTIME;
    public static boolean SUBCLASS_STORE_SKILL_COOLTIME;
    + public static boolean ACUMULATIVE_SUBCLASS_SKILLS;
    public static boolean ALT_GAME_SHIELD_BLOCKS;
    public static int ALT_PERFECT_SHLD_BLOCK;
    public static boolean ALLOW_CLASS_MASTERS;

    @@ -1330,6 +1360,7 @@
    + ACUMULATIVE_SUBCLASS_SKILLS = Boolean.parseBoolean(customSettings.getProperty("AltSubClassSkills", "False"));
    ALLOW_CLASS_MASTERS = Boolean.parseBoolean(customSettings.getProperty("AllowClassMasters", "False"));

    I'm sorry. I hope this helps too.

      Current date/time is 26th September 2017, 14:04