diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/areas/TalkingIsland/MonkOfChaos/MonkOfChaos.java b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/areas/TalkingIsland/MonkOfChaos/MonkOfChaos.java index 9757b3464d..7056cf6859 100644 --- a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/areas/TalkingIsland/MonkOfChaos/MonkOfChaos.java +++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/areas/TalkingIsland/MonkOfChaos/MonkOfChaos.java @@ -46,8 +46,8 @@ public final class MonkOfChaos extends AbstractNpcAI private static final int CHAOS_POMANDER_DUALCLASS = 37375; private static final String[] REVELATION_VAR_NAMES = { - "RevelationSkill1", - "RevelationSkill2" + PlayerVariables.REVELATION_SKILL_1_MAIN_CLASS, + PlayerVariables.REVELATION_SKILL_2_MAIN_CLASS, }; private static final String[] DUALCLASS_REVELATION_VAR_NAMES = @@ -159,9 +159,9 @@ public final class MonkOfChaos extends AbstractNpcAI { player.removeSkill(sk); player.getVariables().remove(varName); - giveItems(player, chaosPomander, 1); } } + giveItems(player, chaosPomander, count); htmltext = "canceled.html"; break; } diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/features/SkillTransfer/SkillTransfer.java b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/features/SkillTransfer/SkillTransfer.java index 293a187ae0..8cde8d3c50 100644 --- a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/features/SkillTransfer/SkillTransfer.java +++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/features/SkillTransfer/SkillTransfer.java @@ -51,7 +51,10 @@ public final class SkillTransfer extends AbstractNpcAI private SkillTransfer() { setPlayerProfessionChangeId(this::onProfessionChange); - setOnEnterWorld(Config.SKILL_CHECK_ENABLE); + if (Config.SKILL_CHECK_ENABLE) + { + setOnEnterWorld(Config.SKILL_CHECK_ENABLE); + } } public void onProfessionChange(OnPlayerProfessionChange event) diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/data/xml/impl/SkillTreesData.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/data/xml/impl/SkillTreesData.java index e0ce62ab0f..884e4273b4 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/data/xml/impl/SkillTreesData.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/data/xml/impl/SkillTreesData.java @@ -1375,11 +1375,7 @@ public final class SkillTreesData implements IGameXmlReader */ public L2SkillLearn getRevelationSkill(SubclassType type, int id, int lvl) { - if (_revelationSkillTree.get(type) != null) - { - return _revelationSkillTree.get(type).get(SkillData.getSkillHashCode(id, lvl)); - } - return null; + return _revelationSkillTree.get(type).get(SkillData.getSkillHashCode(id, lvl)); } /** @@ -1687,12 +1683,6 @@ public final class SkillTreesData implements IGameXmlReader return true; } - // Exclude Revelation Skills from this check. - if (getRevelationSkill(player.isDualClassActive() ? SubclassType.DUALCLASS : player.isSubClassActive() ? SubclassType.SUBCLASS : SubclassType.BASECLASS, skill.getId(), Math.min(skill.getLevel(), maxLvl)) != null) - { - return true; - } - // Exclude Transfer Skills from this check. if (getTransferSkill(skill.getId(), Math.min(skill.getLevel(), maxLvl), player.getClassId()) != null) { @@ -1704,6 +1694,13 @@ public final class SkillTreesData implements IGameXmlReader { return true; } + + // Exclude Revelation Skills from this check. + if (getRevelationSkill(player.isDualClassActive() ? SubclassType.DUALCLASS : SubclassType.BASECLASS, skill.getId(), Math.min(skill.getLevel(), maxLvl)) != null) + { + return true; + } + return false; } diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java index f4b0855fa6..759b4e8a7a 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java @@ -9603,6 +9603,28 @@ public final class L2PcInstance extends L2Playable try { + final SubClass subClass = getSubClasses().remove(classIndex); + if (subClass == null) + { + return false; + } + + if (subClass.isDualClass()) + { + getVariables().remove(PlayerVariables.ABILITY_POINTS_DUAL_CLASS); + getVariables().remove(PlayerVariables.ABILITY_POINTS_USED_DUAL_CLASS); + int revelationSkill = getVariables().getInt(PlayerVariables.REVELATION_SKILL_1_DUAL_CLASS, 0); + if (revelationSkill != 0) + { + removeSkill(revelationSkill); + } + revelationSkill = getVariables().getInt(PlayerVariables.REVELATION_SKILL_2_DUAL_CLASS, 0); + if (revelationSkill != 0) + { + removeSkill(revelationSkill); + } + } + try (Connection con = DatabaseFactory.getInstance().getConnection(); PreparedStatement deleteHennas = con.prepareStatement(DELETE_CHAR_HENNAS); PreparedStatement deleteShortcuts = con.prepareStatement(DELETE_CHAR_SHORTCUTS); @@ -9634,34 +9656,12 @@ public final class L2PcInstance extends L2Playable deleteSubclass.setInt(1, getObjectId()); deleteSubclass.setInt(2, classIndex); deleteSubclass.execute(); - - if (getSubClasses().get(classIndex).isDualClass()) - { - getVariables().remove(PlayerVariables.ABILITY_POINTS_DUAL_CLASS); - getVariables().remove(PlayerVariables.ABILITY_POINTS_USED_DUAL_CLASS); - int revelationSkill = getVariables().getInt(PlayerVariables.REVELATION_SKILL_1_DUAL_CLASS, 0); - if (revelationSkill != 0) - { - removeSkill(revelationSkill); - } - revelationSkill = getVariables().getInt(PlayerVariables.REVELATION_SKILL_2_DUAL_CLASS, 0); - if (revelationSkill != 0) - { - removeSkill(revelationSkill); - } - getVariables().remove(PlayerVariables.REVELATION_SKILL_1_DUAL_CLASS); - getVariables().remove(PlayerVariables.REVELATION_SKILL_2_DUAL_CLASS); - } } catch (Exception e) { _log.log(Level.WARNING, "Could not modify sub class for " + getName() + " to class index " + classIndex + ": " + e.getMessage(), e); - - // This must be done in order to maintain data consistency. - getSubClasses().remove(classIndex); return false; } - getSubClasses().remove(classIndex); } finally { diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/variables/PlayerVariables.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/variables/PlayerVariables.java index 7d45eaef7f..833deff3c1 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/variables/PlayerVariables.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/variables/PlayerVariables.java @@ -54,6 +54,8 @@ public class PlayerVariables extends AbstractVariables public static final String ABILITY_POINTS_DUAL_CLASS = "ABILITY_POINTS_DUAL_CLASS"; public static final String ABILITY_POINTS_USED_MAIN_CLASS = "ABILITY_POINTS_USED"; public static final String ABILITY_POINTS_USED_DUAL_CLASS = "ABILITY_POINTS_DUAL_CLASS_USED"; + public static final String REVELATION_SKILL_1_MAIN_CLASS = "RevelationSkill1"; + public static final String REVELATION_SKILL_2_MAIN_CLASS = "RevelationSkill2"; public static final String REVELATION_SKILL_1_DUAL_CLASS = "DualclassRevelationSkill1"; public static final String REVELATION_SKILL_2_DUAL_CLASS = "DualclassRevelationSkill2"; public static final String EXTEND_DROP = "EXTEND_DROP"; diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/network/clientpackets/RequestAcquireSkill.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/network/clientpackets/RequestAcquireSkill.java index 9778fe7c2f..d1fa956db8 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/network/clientpackets/RequestAcquireSkill.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/network/clientpackets/RequestAcquireSkill.java @@ -25,6 +25,7 @@ import com.l2jmobius.gameserver.data.xml.impl.SkillTreesData; import com.l2jmobius.gameserver.enums.CategoryType; import com.l2jmobius.gameserver.enums.IllegalActionPunishmentType; import com.l2jmobius.gameserver.enums.Race; +import com.l2jmobius.gameserver.enums.SubclassType; import com.l2jmobius.gameserver.enums.UserInfoType; import com.l2jmobius.gameserver.model.ClanPrivilege; import com.l2jmobius.gameserver.model.L2Clan; @@ -65,8 +66,8 @@ public final class RequestAcquireSkill implements IClientIncomingPacket { private static final String[] REVELATION_VAR_NAMES = { - "RevelationSkill1", - "RevelationSkill2" + PlayerVariables.REVELATION_SKILL_1_MAIN_CLASS, + PlayerVariables.REVELATION_SKILL_2_MAIN_CLASS }; private static final String[] DUALCLASS_REVELATION_VAR_NAMES = @@ -449,6 +450,16 @@ public final class RequestAcquireSkill implements IClientIncomingPacket giveSkill(activeChar, trainer, skill); } + + final List skills = SkillTreesData.getInstance().getAvailableRevelationSkills(activeChar, SubclassType.BASECLASS); + if (skills.size() > 0) + { + activeChar.sendPacket(new ExAcquirableSkillListByClass(skills, AcquireSkillType.REVELATION)); + } + else + { + activeChar.sendPacket(SystemMessageId.THERE_ARE_NO_OTHER_SKILLS_TO_LEARN); + } break; } case REVELATION_DUALCLASS: @@ -492,6 +503,16 @@ public final class RequestAcquireSkill implements IClientIncomingPacket giveSkill(activeChar, trainer, skill); } + + final List skills = SkillTreesData.getInstance().getAvailableRevelationSkills(activeChar, SubclassType.DUALCLASS); + if (skills.size() > 0) + { + activeChar.sendPacket(new ExAcquirableSkillListByClass(skills, AcquireSkillType.REVELATION_DUALCLASS)); + } + else + { + activeChar.sendPacket(SystemMessageId.THERE_ARE_NO_OTHER_SKILLS_TO_LEARN); + } break; } default: diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/areas/TalkingIsland/MonkOfChaos/MonkOfChaos.java b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/areas/TalkingIsland/MonkOfChaos/MonkOfChaos.java index 9757b3464d..7056cf6859 100644 --- a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/areas/TalkingIsland/MonkOfChaos/MonkOfChaos.java +++ b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/areas/TalkingIsland/MonkOfChaos/MonkOfChaos.java @@ -46,8 +46,8 @@ public final class MonkOfChaos extends AbstractNpcAI private static final int CHAOS_POMANDER_DUALCLASS = 37375; private static final String[] REVELATION_VAR_NAMES = { - "RevelationSkill1", - "RevelationSkill2" + PlayerVariables.REVELATION_SKILL_1_MAIN_CLASS, + PlayerVariables.REVELATION_SKILL_2_MAIN_CLASS, }; private static final String[] DUALCLASS_REVELATION_VAR_NAMES = @@ -159,9 +159,9 @@ public final class MonkOfChaos extends AbstractNpcAI { player.removeSkill(sk); player.getVariables().remove(varName); - giveItems(player, chaosPomander, 1); } } + giveItems(player, chaosPomander, count); htmltext = "canceled.html"; break; } diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/features/SkillTransfer/SkillTransfer.java b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/features/SkillTransfer/SkillTransfer.java index 293a187ae0..8cde8d3c50 100644 --- a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/features/SkillTransfer/SkillTransfer.java +++ b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/features/SkillTransfer/SkillTransfer.java @@ -51,7 +51,10 @@ public final class SkillTransfer extends AbstractNpcAI private SkillTransfer() { setPlayerProfessionChangeId(this::onProfessionChange); - setOnEnterWorld(Config.SKILL_CHECK_ENABLE); + if (Config.SKILL_CHECK_ENABLE) + { + setOnEnterWorld(Config.SKILL_CHECK_ENABLE); + } } public void onProfessionChange(OnPlayerProfessionChange event) diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/data/xml/impl/SkillTreesData.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/data/xml/impl/SkillTreesData.java index e0ce62ab0f..884e4273b4 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/data/xml/impl/SkillTreesData.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/data/xml/impl/SkillTreesData.java @@ -1375,11 +1375,7 @@ public final class SkillTreesData implements IGameXmlReader */ public L2SkillLearn getRevelationSkill(SubclassType type, int id, int lvl) { - if (_revelationSkillTree.get(type) != null) - { - return _revelationSkillTree.get(type).get(SkillData.getSkillHashCode(id, lvl)); - } - return null; + return _revelationSkillTree.get(type).get(SkillData.getSkillHashCode(id, lvl)); } /** @@ -1687,12 +1683,6 @@ public final class SkillTreesData implements IGameXmlReader return true; } - // Exclude Revelation Skills from this check. - if (getRevelationSkill(player.isDualClassActive() ? SubclassType.DUALCLASS : player.isSubClassActive() ? SubclassType.SUBCLASS : SubclassType.BASECLASS, skill.getId(), Math.min(skill.getLevel(), maxLvl)) != null) - { - return true; - } - // Exclude Transfer Skills from this check. if (getTransferSkill(skill.getId(), Math.min(skill.getLevel(), maxLvl), player.getClassId()) != null) { @@ -1704,6 +1694,13 @@ public final class SkillTreesData implements IGameXmlReader { return true; } + + // Exclude Revelation Skills from this check. + if (getRevelationSkill(player.isDualClassActive() ? SubclassType.DUALCLASS : SubclassType.BASECLASS, skill.getId(), Math.min(skill.getLevel(), maxLvl)) != null) + { + return true; + } + return false; } diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java index ff68c02c0f..148b58aba8 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java @@ -9604,6 +9604,28 @@ public final class L2PcInstance extends L2Playable try { + final SubClass subClass = getSubClasses().remove(classIndex); + if (subClass == null) + { + return false; + } + + if (subClass.isDualClass()) + { + getVariables().remove(PlayerVariables.ABILITY_POINTS_DUAL_CLASS); + getVariables().remove(PlayerVariables.ABILITY_POINTS_USED_DUAL_CLASS); + int revelationSkill = getVariables().getInt(PlayerVariables.REVELATION_SKILL_1_DUAL_CLASS, 0); + if (revelationSkill != 0) + { + removeSkill(revelationSkill); + } + revelationSkill = getVariables().getInt(PlayerVariables.REVELATION_SKILL_2_DUAL_CLASS, 0); + if (revelationSkill != 0) + { + removeSkill(revelationSkill); + } + } + try (Connection con = DatabaseFactory.getInstance().getConnection(); PreparedStatement deleteHennas = con.prepareStatement(DELETE_CHAR_HENNAS); PreparedStatement deleteShortcuts = con.prepareStatement(DELETE_CHAR_SHORTCUTS); @@ -9635,34 +9657,12 @@ public final class L2PcInstance extends L2Playable deleteSubclass.setInt(1, getObjectId()); deleteSubclass.setInt(2, classIndex); deleteSubclass.execute(); - - if (getSubClasses().get(classIndex).isDualClass()) - { - getVariables().remove(PlayerVariables.ABILITY_POINTS_DUAL_CLASS); - getVariables().remove(PlayerVariables.ABILITY_POINTS_USED_DUAL_CLASS); - int revelationSkill = getVariables().getInt(PlayerVariables.REVELATION_SKILL_1_DUAL_CLASS, 0); - if (revelationSkill != 0) - { - removeSkill(revelationSkill); - } - revelationSkill = getVariables().getInt(PlayerVariables.REVELATION_SKILL_2_DUAL_CLASS, 0); - if (revelationSkill != 0) - { - removeSkill(revelationSkill); - } - getVariables().remove(PlayerVariables.REVELATION_SKILL_1_DUAL_CLASS); - getVariables().remove(PlayerVariables.REVELATION_SKILL_2_DUAL_CLASS); - } } catch (Exception e) { _log.log(Level.WARNING, "Could not modify sub class for " + getName() + " to class index " + classIndex + ": " + e.getMessage(), e); - - // This must be done in order to maintain data consistency. - getSubClasses().remove(classIndex); return false; } - getSubClasses().remove(classIndex); } finally { diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/variables/PlayerVariables.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/variables/PlayerVariables.java index 269911c172..526aed9ae1 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/variables/PlayerVariables.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/variables/PlayerVariables.java @@ -54,6 +54,8 @@ public class PlayerVariables extends AbstractVariables public static final String ABILITY_POINTS_DUAL_CLASS = "ABILITY_POINTS_DUAL_CLASS"; public static final String ABILITY_POINTS_USED_MAIN_CLASS = "ABILITY_POINTS_USED"; public static final String ABILITY_POINTS_USED_DUAL_CLASS = "ABILITY_POINTS_DUAL_CLASS_USED"; + public static final String REVELATION_SKILL_1_MAIN_CLASS = "RevelationSkill1"; + public static final String REVELATION_SKILL_2_MAIN_CLASS = "RevelationSkill2"; public static final String REVELATION_SKILL_1_DUAL_CLASS = "DualclassRevelationSkill1"; public static final String REVELATION_SKILL_2_DUAL_CLASS = "DualclassRevelationSkill2"; public static final String EXTEND_DROP = "EXTEND_DROP"; diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/network/clientpackets/RequestAcquireSkill.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/network/clientpackets/RequestAcquireSkill.java index 9d97309efc..1870a90d27 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/network/clientpackets/RequestAcquireSkill.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/network/clientpackets/RequestAcquireSkill.java @@ -25,6 +25,7 @@ import com.l2jmobius.gameserver.data.xml.impl.SkillTreesData; import com.l2jmobius.gameserver.enums.CategoryType; import com.l2jmobius.gameserver.enums.IllegalActionPunishmentType; import com.l2jmobius.gameserver.enums.Race; +import com.l2jmobius.gameserver.enums.SubclassType; import com.l2jmobius.gameserver.enums.UserInfoType; import com.l2jmobius.gameserver.model.ClanPrivilege; import com.l2jmobius.gameserver.model.L2Clan; @@ -65,8 +66,8 @@ public final class RequestAcquireSkill implements IClientIncomingPacket { private static final String[] REVELATION_VAR_NAMES = { - "RevelationSkill1", - "RevelationSkill2" + PlayerVariables.REVELATION_SKILL_1_MAIN_CLASS, + PlayerVariables.REVELATION_SKILL_2_MAIN_CLASS }; private static final String[] DUALCLASS_REVELATION_VAR_NAMES = @@ -449,6 +450,16 @@ public final class RequestAcquireSkill implements IClientIncomingPacket giveSkill(activeChar, trainer, skill); } + + final List skills = SkillTreesData.getInstance().getAvailableRevelationSkills(activeChar, SubclassType.BASECLASS); + if (skills.size() > 0) + { + activeChar.sendPacket(new ExAcquirableSkillListByClass(skills, AcquireSkillType.REVELATION)); + } + else + { + activeChar.sendPacket(SystemMessageId.THERE_ARE_NO_OTHER_SKILLS_TO_LEARN); + } break; } case REVELATION_DUALCLASS: @@ -492,6 +503,16 @@ public final class RequestAcquireSkill implements IClientIncomingPacket giveSkill(activeChar, trainer, skill); } + + final List skills = SkillTreesData.getInstance().getAvailableRevelationSkills(activeChar, SubclassType.DUALCLASS); + if (skills.size() > 0) + { + activeChar.sendPacket(new ExAcquirableSkillListByClass(skills, AcquireSkillType.REVELATION_DUALCLASS)); + } + else + { + activeChar.sendPacket(SystemMessageId.THERE_ARE_NO_OTHER_SKILLS_TO_LEARN); + } break; } default: diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/areas/TalkingIsland/MonkOfChaos/MonkOfChaos.java b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/areas/TalkingIsland/MonkOfChaos/MonkOfChaos.java index 9757b3464d..7056cf6859 100644 --- a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/areas/TalkingIsland/MonkOfChaos/MonkOfChaos.java +++ b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/areas/TalkingIsland/MonkOfChaos/MonkOfChaos.java @@ -46,8 +46,8 @@ public final class MonkOfChaos extends AbstractNpcAI private static final int CHAOS_POMANDER_DUALCLASS = 37375; private static final String[] REVELATION_VAR_NAMES = { - "RevelationSkill1", - "RevelationSkill2" + PlayerVariables.REVELATION_SKILL_1_MAIN_CLASS, + PlayerVariables.REVELATION_SKILL_2_MAIN_CLASS, }; private static final String[] DUALCLASS_REVELATION_VAR_NAMES = @@ -159,9 +159,9 @@ public final class MonkOfChaos extends AbstractNpcAI { player.removeSkill(sk); player.getVariables().remove(varName); - giveItems(player, chaosPomander, 1); } } + giveItems(player, chaosPomander, count); htmltext = "canceled.html"; break; } diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/features/SkillTransfer/SkillTransfer.java b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/features/SkillTransfer/SkillTransfer.java index 293a187ae0..8cde8d3c50 100644 --- a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/features/SkillTransfer/SkillTransfer.java +++ b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/features/SkillTransfer/SkillTransfer.java @@ -51,7 +51,10 @@ public final class SkillTransfer extends AbstractNpcAI private SkillTransfer() { setPlayerProfessionChangeId(this::onProfessionChange); - setOnEnterWorld(Config.SKILL_CHECK_ENABLE); + if (Config.SKILL_CHECK_ENABLE) + { + setOnEnterWorld(Config.SKILL_CHECK_ENABLE); + } } public void onProfessionChange(OnPlayerProfessionChange event) diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/data/xml/impl/SkillTreesData.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/data/xml/impl/SkillTreesData.java index e0ce62ab0f..884e4273b4 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/data/xml/impl/SkillTreesData.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/data/xml/impl/SkillTreesData.java @@ -1375,11 +1375,7 @@ public final class SkillTreesData implements IGameXmlReader */ public L2SkillLearn getRevelationSkill(SubclassType type, int id, int lvl) { - if (_revelationSkillTree.get(type) != null) - { - return _revelationSkillTree.get(type).get(SkillData.getSkillHashCode(id, lvl)); - } - return null; + return _revelationSkillTree.get(type).get(SkillData.getSkillHashCode(id, lvl)); } /** @@ -1687,12 +1683,6 @@ public final class SkillTreesData implements IGameXmlReader return true; } - // Exclude Revelation Skills from this check. - if (getRevelationSkill(player.isDualClassActive() ? SubclassType.DUALCLASS : player.isSubClassActive() ? SubclassType.SUBCLASS : SubclassType.BASECLASS, skill.getId(), Math.min(skill.getLevel(), maxLvl)) != null) - { - return true; - } - // Exclude Transfer Skills from this check. if (getTransferSkill(skill.getId(), Math.min(skill.getLevel(), maxLvl), player.getClassId()) != null) { @@ -1704,6 +1694,13 @@ public final class SkillTreesData implements IGameXmlReader { return true; } + + // Exclude Revelation Skills from this check. + if (getRevelationSkill(player.isDualClassActive() ? SubclassType.DUALCLASS : SubclassType.BASECLASS, skill.getId(), Math.min(skill.getLevel(), maxLvl)) != null) + { + return true; + } + return false; } diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java index 1cd362d530..122ac6c6af 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java @@ -9614,6 +9614,28 @@ public final class L2PcInstance extends L2Playable try { + final SubClass subClass = getSubClasses().remove(classIndex); + if (subClass == null) + { + return false; + } + + if (subClass.isDualClass()) + { + getVariables().remove(PlayerVariables.ABILITY_POINTS_DUAL_CLASS); + getVariables().remove(PlayerVariables.ABILITY_POINTS_USED_DUAL_CLASS); + int revelationSkill = getVariables().getInt(PlayerVariables.REVELATION_SKILL_1_DUAL_CLASS, 0); + if (revelationSkill != 0) + { + removeSkill(revelationSkill); + } + revelationSkill = getVariables().getInt(PlayerVariables.REVELATION_SKILL_2_DUAL_CLASS, 0); + if (revelationSkill != 0) + { + removeSkill(revelationSkill); + } + } + try (Connection con = DatabaseFactory.getInstance().getConnection(); PreparedStatement deleteHennas = con.prepareStatement(DELETE_CHAR_HENNAS); PreparedStatement deleteShortcuts = con.prepareStatement(DELETE_CHAR_SHORTCUTS); @@ -9645,34 +9667,12 @@ public final class L2PcInstance extends L2Playable deleteSubclass.setInt(1, getObjectId()); deleteSubclass.setInt(2, classIndex); deleteSubclass.execute(); - - if (getSubClasses().get(classIndex).isDualClass()) - { - getVariables().remove(PlayerVariables.ABILITY_POINTS_DUAL_CLASS); - getVariables().remove(PlayerVariables.ABILITY_POINTS_USED_DUAL_CLASS); - int revelationSkill = getVariables().getInt(PlayerVariables.REVELATION_SKILL_1_DUAL_CLASS, 0); - if (revelationSkill != 0) - { - removeSkill(revelationSkill); - } - revelationSkill = getVariables().getInt(PlayerVariables.REVELATION_SKILL_2_DUAL_CLASS, 0); - if (revelationSkill != 0) - { - removeSkill(revelationSkill); - } - getVariables().remove(PlayerVariables.REVELATION_SKILL_1_DUAL_CLASS); - getVariables().remove(PlayerVariables.REVELATION_SKILL_2_DUAL_CLASS); - } } catch (Exception e) { _log.log(Level.WARNING, "Could not modify sub class for " + getName() + " to class index " + classIndex + ": " + e.getMessage(), e); - - // This must be done in order to maintain data consistency. - getSubClasses().remove(classIndex); return false; } - getSubClasses().remove(classIndex); } finally { diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/variables/PlayerVariables.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/variables/PlayerVariables.java index 269911c172..526aed9ae1 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/variables/PlayerVariables.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/variables/PlayerVariables.java @@ -54,6 +54,8 @@ public class PlayerVariables extends AbstractVariables public static final String ABILITY_POINTS_DUAL_CLASS = "ABILITY_POINTS_DUAL_CLASS"; public static final String ABILITY_POINTS_USED_MAIN_CLASS = "ABILITY_POINTS_USED"; public static final String ABILITY_POINTS_USED_DUAL_CLASS = "ABILITY_POINTS_DUAL_CLASS_USED"; + public static final String REVELATION_SKILL_1_MAIN_CLASS = "RevelationSkill1"; + public static final String REVELATION_SKILL_2_MAIN_CLASS = "RevelationSkill2"; public static final String REVELATION_SKILL_1_DUAL_CLASS = "DualclassRevelationSkill1"; public static final String REVELATION_SKILL_2_DUAL_CLASS = "DualclassRevelationSkill2"; public static final String EXTEND_DROP = "EXTEND_DROP"; diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/network/clientpackets/RequestAcquireSkill.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/network/clientpackets/RequestAcquireSkill.java index 9d97309efc..1870a90d27 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/network/clientpackets/RequestAcquireSkill.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/network/clientpackets/RequestAcquireSkill.java @@ -25,6 +25,7 @@ import com.l2jmobius.gameserver.data.xml.impl.SkillTreesData; import com.l2jmobius.gameserver.enums.CategoryType; import com.l2jmobius.gameserver.enums.IllegalActionPunishmentType; import com.l2jmobius.gameserver.enums.Race; +import com.l2jmobius.gameserver.enums.SubclassType; import com.l2jmobius.gameserver.enums.UserInfoType; import com.l2jmobius.gameserver.model.ClanPrivilege; import com.l2jmobius.gameserver.model.L2Clan; @@ -65,8 +66,8 @@ public final class RequestAcquireSkill implements IClientIncomingPacket { private static final String[] REVELATION_VAR_NAMES = { - "RevelationSkill1", - "RevelationSkill2" + PlayerVariables.REVELATION_SKILL_1_MAIN_CLASS, + PlayerVariables.REVELATION_SKILL_2_MAIN_CLASS }; private static final String[] DUALCLASS_REVELATION_VAR_NAMES = @@ -449,6 +450,16 @@ public final class RequestAcquireSkill implements IClientIncomingPacket giveSkill(activeChar, trainer, skill); } + + final List skills = SkillTreesData.getInstance().getAvailableRevelationSkills(activeChar, SubclassType.BASECLASS); + if (skills.size() > 0) + { + activeChar.sendPacket(new ExAcquirableSkillListByClass(skills, AcquireSkillType.REVELATION)); + } + else + { + activeChar.sendPacket(SystemMessageId.THERE_ARE_NO_OTHER_SKILLS_TO_LEARN); + } break; } case REVELATION_DUALCLASS: @@ -492,6 +503,16 @@ public final class RequestAcquireSkill implements IClientIncomingPacket giveSkill(activeChar, trainer, skill); } + + final List skills = SkillTreesData.getInstance().getAvailableRevelationSkills(activeChar, SubclassType.DUALCLASS); + if (skills.size() > 0) + { + activeChar.sendPacket(new ExAcquirableSkillListByClass(skills, AcquireSkillType.REVELATION_DUALCLASS)); + } + else + { + activeChar.sendPacket(SystemMessageId.THERE_ARE_NO_OTHER_SKILLS_TO_LEARN); + } break; } default: diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/ai/areas/TalkingIsland/MonkOfChaos/MonkOfChaos.java b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/ai/areas/TalkingIsland/MonkOfChaos/MonkOfChaos.java index 9757b3464d..7056cf6859 100644 --- a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/ai/areas/TalkingIsland/MonkOfChaos/MonkOfChaos.java +++ b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/ai/areas/TalkingIsland/MonkOfChaos/MonkOfChaos.java @@ -46,8 +46,8 @@ public final class MonkOfChaos extends AbstractNpcAI private static final int CHAOS_POMANDER_DUALCLASS = 37375; private static final String[] REVELATION_VAR_NAMES = { - "RevelationSkill1", - "RevelationSkill2" + PlayerVariables.REVELATION_SKILL_1_MAIN_CLASS, + PlayerVariables.REVELATION_SKILL_2_MAIN_CLASS, }; private static final String[] DUALCLASS_REVELATION_VAR_NAMES = @@ -159,9 +159,9 @@ public final class MonkOfChaos extends AbstractNpcAI { player.removeSkill(sk); player.getVariables().remove(varName); - giveItems(player, chaosPomander, 1); } } + giveItems(player, chaosPomander, count); htmltext = "canceled.html"; break; } diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/features/SkillTransfer/SkillTransfer.java b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/features/SkillTransfer/SkillTransfer.java index 293a187ae0..8cde8d3c50 100644 --- a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/features/SkillTransfer/SkillTransfer.java +++ b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/features/SkillTransfer/SkillTransfer.java @@ -51,7 +51,10 @@ public final class SkillTransfer extends AbstractNpcAI private SkillTransfer() { setPlayerProfessionChangeId(this::onProfessionChange); - setOnEnterWorld(Config.SKILL_CHECK_ENABLE); + if (Config.SKILL_CHECK_ENABLE) + { + setOnEnterWorld(Config.SKILL_CHECK_ENABLE); + } } public void onProfessionChange(OnPlayerProfessionChange event) diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/data/xml/impl/SkillTreesData.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/data/xml/impl/SkillTreesData.java index e0ce62ab0f..884e4273b4 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/data/xml/impl/SkillTreesData.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/data/xml/impl/SkillTreesData.java @@ -1375,11 +1375,7 @@ public final class SkillTreesData implements IGameXmlReader */ public L2SkillLearn getRevelationSkill(SubclassType type, int id, int lvl) { - if (_revelationSkillTree.get(type) != null) - { - return _revelationSkillTree.get(type).get(SkillData.getSkillHashCode(id, lvl)); - } - return null; + return _revelationSkillTree.get(type).get(SkillData.getSkillHashCode(id, lvl)); } /** @@ -1687,12 +1683,6 @@ public final class SkillTreesData implements IGameXmlReader return true; } - // Exclude Revelation Skills from this check. - if (getRevelationSkill(player.isDualClassActive() ? SubclassType.DUALCLASS : player.isSubClassActive() ? SubclassType.SUBCLASS : SubclassType.BASECLASS, skill.getId(), Math.min(skill.getLevel(), maxLvl)) != null) - { - return true; - } - // Exclude Transfer Skills from this check. if (getTransferSkill(skill.getId(), Math.min(skill.getLevel(), maxLvl), player.getClassId()) != null) { @@ -1704,6 +1694,13 @@ public final class SkillTreesData implements IGameXmlReader { return true; } + + // Exclude Revelation Skills from this check. + if (getRevelationSkill(player.isDualClassActive() ? SubclassType.DUALCLASS : SubclassType.BASECLASS, skill.getId(), Math.min(skill.getLevel(), maxLvl)) != null) + { + return true; + } + return false; } diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java index 0a02cab7e4..76b3588b54 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java @@ -9607,6 +9607,28 @@ public final class L2PcInstance extends L2Playable try { + final SubClass subClass = getSubClasses().remove(classIndex); + if (subClass == null) + { + return false; + } + + if (subClass.isDualClass()) + { + getVariables().remove(PlayerVariables.ABILITY_POINTS_DUAL_CLASS); + getVariables().remove(PlayerVariables.ABILITY_POINTS_USED_DUAL_CLASS); + int revelationSkill = getVariables().getInt(PlayerVariables.REVELATION_SKILL_1_DUAL_CLASS, 0); + if (revelationSkill != 0) + { + removeSkill(revelationSkill); + } + revelationSkill = getVariables().getInt(PlayerVariables.REVELATION_SKILL_2_DUAL_CLASS, 0); + if (revelationSkill != 0) + { + removeSkill(revelationSkill); + } + } + try (Connection con = DatabaseFactory.getInstance().getConnection(); PreparedStatement deleteHennas = con.prepareStatement(DELETE_CHAR_HENNAS); PreparedStatement deleteShortcuts = con.prepareStatement(DELETE_CHAR_SHORTCUTS); @@ -9638,34 +9660,12 @@ public final class L2PcInstance extends L2Playable deleteSubclass.setInt(1, getObjectId()); deleteSubclass.setInt(2, classIndex); deleteSubclass.execute(); - - if (getSubClasses().get(classIndex).isDualClass()) - { - getVariables().remove(PlayerVariables.ABILITY_POINTS_DUAL_CLASS); - getVariables().remove(PlayerVariables.ABILITY_POINTS_USED_DUAL_CLASS); - int revelationSkill = getVariables().getInt(PlayerVariables.REVELATION_SKILL_1_DUAL_CLASS, 0); - if (revelationSkill != 0) - { - removeSkill(revelationSkill); - } - revelationSkill = getVariables().getInt(PlayerVariables.REVELATION_SKILL_2_DUAL_CLASS, 0); - if (revelationSkill != 0) - { - removeSkill(revelationSkill); - } - getVariables().remove(PlayerVariables.REVELATION_SKILL_1_DUAL_CLASS); - getVariables().remove(PlayerVariables.REVELATION_SKILL_2_DUAL_CLASS); - } } catch (Exception e) { _log.log(Level.WARNING, "Could not modify sub class for " + getName() + " to class index " + classIndex + ": " + e.getMessage(), e); - - // This must be done in order to maintain data consistency. - getSubClasses().remove(classIndex); return false; } - getSubClasses().remove(classIndex); } finally { diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/variables/PlayerVariables.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/variables/PlayerVariables.java index 269911c172..526aed9ae1 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/variables/PlayerVariables.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/variables/PlayerVariables.java @@ -54,6 +54,8 @@ public class PlayerVariables extends AbstractVariables public static final String ABILITY_POINTS_DUAL_CLASS = "ABILITY_POINTS_DUAL_CLASS"; public static final String ABILITY_POINTS_USED_MAIN_CLASS = "ABILITY_POINTS_USED"; public static final String ABILITY_POINTS_USED_DUAL_CLASS = "ABILITY_POINTS_DUAL_CLASS_USED"; + public static final String REVELATION_SKILL_1_MAIN_CLASS = "RevelationSkill1"; + public static final String REVELATION_SKILL_2_MAIN_CLASS = "RevelationSkill2"; public static final String REVELATION_SKILL_1_DUAL_CLASS = "DualclassRevelationSkill1"; public static final String REVELATION_SKILL_2_DUAL_CLASS = "DualclassRevelationSkill2"; public static final String EXTEND_DROP = "EXTEND_DROP"; diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/network/clientpackets/RequestAcquireSkill.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/network/clientpackets/RequestAcquireSkill.java index 9d97309efc..1870a90d27 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/network/clientpackets/RequestAcquireSkill.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/network/clientpackets/RequestAcquireSkill.java @@ -25,6 +25,7 @@ import com.l2jmobius.gameserver.data.xml.impl.SkillTreesData; import com.l2jmobius.gameserver.enums.CategoryType; import com.l2jmobius.gameserver.enums.IllegalActionPunishmentType; import com.l2jmobius.gameserver.enums.Race; +import com.l2jmobius.gameserver.enums.SubclassType; import com.l2jmobius.gameserver.enums.UserInfoType; import com.l2jmobius.gameserver.model.ClanPrivilege; import com.l2jmobius.gameserver.model.L2Clan; @@ -65,8 +66,8 @@ public final class RequestAcquireSkill implements IClientIncomingPacket { private static final String[] REVELATION_VAR_NAMES = { - "RevelationSkill1", - "RevelationSkill2" + PlayerVariables.REVELATION_SKILL_1_MAIN_CLASS, + PlayerVariables.REVELATION_SKILL_2_MAIN_CLASS }; private static final String[] DUALCLASS_REVELATION_VAR_NAMES = @@ -449,6 +450,16 @@ public final class RequestAcquireSkill implements IClientIncomingPacket giveSkill(activeChar, trainer, skill); } + + final List skills = SkillTreesData.getInstance().getAvailableRevelationSkills(activeChar, SubclassType.BASECLASS); + if (skills.size() > 0) + { + activeChar.sendPacket(new ExAcquirableSkillListByClass(skills, AcquireSkillType.REVELATION)); + } + else + { + activeChar.sendPacket(SystemMessageId.THERE_ARE_NO_OTHER_SKILLS_TO_LEARN); + } break; } case REVELATION_DUALCLASS: @@ -492,6 +503,16 @@ public final class RequestAcquireSkill implements IClientIncomingPacket giveSkill(activeChar, trainer, skill); } + + final List skills = SkillTreesData.getInstance().getAvailableRevelationSkills(activeChar, SubclassType.DUALCLASS); + if (skills.size() > 0) + { + activeChar.sendPacket(new ExAcquirableSkillListByClass(skills, AcquireSkillType.REVELATION_DUALCLASS)); + } + else + { + activeChar.sendPacket(SystemMessageId.THERE_ARE_NO_OTHER_SKILLS_TO_LEARN); + } break; } default: diff --git a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/features/SkillTransfer/SkillTransfer.java b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/features/SkillTransfer/SkillTransfer.java index 293a187ae0..8cde8d3c50 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/features/SkillTransfer/SkillTransfer.java +++ b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/features/SkillTransfer/SkillTransfer.java @@ -51,7 +51,10 @@ public final class SkillTransfer extends AbstractNpcAI private SkillTransfer() { setPlayerProfessionChangeId(this::onProfessionChange); - setOnEnterWorld(Config.SKILL_CHECK_ENABLE); + if (Config.SKILL_CHECK_ENABLE) + { + setOnEnterWorld(Config.SKILL_CHECK_ENABLE); + } } public void onProfessionChange(OnPlayerProfessionChange event) diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/data/xml/impl/SkillTreesData.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/data/xml/impl/SkillTreesData.java index e0ce62ab0f..884e4273b4 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/data/xml/impl/SkillTreesData.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/data/xml/impl/SkillTreesData.java @@ -1375,11 +1375,7 @@ public final class SkillTreesData implements IGameXmlReader */ public L2SkillLearn getRevelationSkill(SubclassType type, int id, int lvl) { - if (_revelationSkillTree.get(type) != null) - { - return _revelationSkillTree.get(type).get(SkillData.getSkillHashCode(id, lvl)); - } - return null; + return _revelationSkillTree.get(type).get(SkillData.getSkillHashCode(id, lvl)); } /** @@ -1687,12 +1683,6 @@ public final class SkillTreesData implements IGameXmlReader return true; } - // Exclude Revelation Skills from this check. - if (getRevelationSkill(player.isDualClassActive() ? SubclassType.DUALCLASS : player.isSubClassActive() ? SubclassType.SUBCLASS : SubclassType.BASECLASS, skill.getId(), Math.min(skill.getLevel(), maxLvl)) != null) - { - return true; - } - // Exclude Transfer Skills from this check. if (getTransferSkill(skill.getId(), Math.min(skill.getLevel(), maxLvl), player.getClassId()) != null) { @@ -1704,6 +1694,13 @@ public final class SkillTreesData implements IGameXmlReader { return true; } + + // Exclude Revelation Skills from this check. + if (getRevelationSkill(player.isDualClassActive() ? SubclassType.DUALCLASS : SubclassType.BASECLASS, skill.getId(), Math.min(skill.getLevel(), maxLvl)) != null) + { + return true; + } + return false; } diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java index 6a737129e5..dada6f9fb5 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java @@ -9547,6 +9547,28 @@ public final class L2PcInstance extends L2Playable try { + final SubClass subClass = getSubClasses().remove(classIndex); + if (subClass == null) + { + return false; + } + + if (subClass.isDualClass()) + { + getVariables().remove(PlayerVariables.ABILITY_POINTS_DUAL_CLASS); + getVariables().remove(PlayerVariables.ABILITY_POINTS_USED_DUAL_CLASS); + int revelationSkill = getVariables().getInt(PlayerVariables.REVELATION_SKILL_1_DUAL_CLASS, 0); + if (revelationSkill != 0) + { + removeSkill(revelationSkill); + } + revelationSkill = getVariables().getInt(PlayerVariables.REVELATION_SKILL_2_DUAL_CLASS, 0); + if (revelationSkill != 0) + { + removeSkill(revelationSkill); + } + } + try (Connection con = DatabaseFactory.getInstance().getConnection(); PreparedStatement deleteHennas = con.prepareStatement(DELETE_CHAR_HENNAS); PreparedStatement deleteShortcuts = con.prepareStatement(DELETE_CHAR_SHORTCUTS); @@ -9578,34 +9600,12 @@ public final class L2PcInstance extends L2Playable deleteSubclass.setInt(1, getObjectId()); deleteSubclass.setInt(2, classIndex); deleteSubclass.execute(); - - if (getSubClasses().get(classIndex).isDualClass()) - { - getVariables().remove(PlayerVariables.ABILITY_POINTS_DUAL_CLASS); - getVariables().remove(PlayerVariables.ABILITY_POINTS_USED_DUAL_CLASS); - int revelationSkill = getVariables().getInt(PlayerVariables.REVELATION_SKILL_1_DUAL_CLASS, 0); - if (revelationSkill != 0) - { - removeSkill(revelationSkill); - } - revelationSkill = getVariables().getInt(PlayerVariables.REVELATION_SKILL_2_DUAL_CLASS, 0); - if (revelationSkill != 0) - { - removeSkill(revelationSkill); - } - getVariables().remove(PlayerVariables.REVELATION_SKILL_1_DUAL_CLASS); - getVariables().remove(PlayerVariables.REVELATION_SKILL_2_DUAL_CLASS); - } } catch (Exception e) { _log.log(Level.WARNING, "Could not modify sub class for " + getName() + " to class index " + classIndex + ": " + e.getMessage(), e); - - // This must be done in order to maintain data consistency. - getSubClasses().remove(classIndex); return false; } - getSubClasses().remove(classIndex); } finally { diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/variables/PlayerVariables.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/variables/PlayerVariables.java index 269911c172..526aed9ae1 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/variables/PlayerVariables.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/variables/PlayerVariables.java @@ -54,6 +54,8 @@ public class PlayerVariables extends AbstractVariables public static final String ABILITY_POINTS_DUAL_CLASS = "ABILITY_POINTS_DUAL_CLASS"; public static final String ABILITY_POINTS_USED_MAIN_CLASS = "ABILITY_POINTS_USED"; public static final String ABILITY_POINTS_USED_DUAL_CLASS = "ABILITY_POINTS_DUAL_CLASS_USED"; + public static final String REVELATION_SKILL_1_MAIN_CLASS = "RevelationSkill1"; + public static final String REVELATION_SKILL_2_MAIN_CLASS = "RevelationSkill2"; public static final String REVELATION_SKILL_1_DUAL_CLASS = "DualclassRevelationSkill1"; public static final String REVELATION_SKILL_2_DUAL_CLASS = "DualclassRevelationSkill2"; public static final String EXTEND_DROP = "EXTEND_DROP"; diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/clientpackets/RequestAcquireSkill.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/clientpackets/RequestAcquireSkill.java index 9d97309efc..1870a90d27 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/clientpackets/RequestAcquireSkill.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/clientpackets/RequestAcquireSkill.java @@ -25,6 +25,7 @@ import com.l2jmobius.gameserver.data.xml.impl.SkillTreesData; import com.l2jmobius.gameserver.enums.CategoryType; import com.l2jmobius.gameserver.enums.IllegalActionPunishmentType; import com.l2jmobius.gameserver.enums.Race; +import com.l2jmobius.gameserver.enums.SubclassType; import com.l2jmobius.gameserver.enums.UserInfoType; import com.l2jmobius.gameserver.model.ClanPrivilege; import com.l2jmobius.gameserver.model.L2Clan; @@ -65,8 +66,8 @@ public final class RequestAcquireSkill implements IClientIncomingPacket { private static final String[] REVELATION_VAR_NAMES = { - "RevelationSkill1", - "RevelationSkill2" + PlayerVariables.REVELATION_SKILL_1_MAIN_CLASS, + PlayerVariables.REVELATION_SKILL_2_MAIN_CLASS }; private static final String[] DUALCLASS_REVELATION_VAR_NAMES = @@ -449,6 +450,16 @@ public final class RequestAcquireSkill implements IClientIncomingPacket giveSkill(activeChar, trainer, skill); } + + final List skills = SkillTreesData.getInstance().getAvailableRevelationSkills(activeChar, SubclassType.BASECLASS); + if (skills.size() > 0) + { + activeChar.sendPacket(new ExAcquirableSkillListByClass(skills, AcquireSkillType.REVELATION)); + } + else + { + activeChar.sendPacket(SystemMessageId.THERE_ARE_NO_OTHER_SKILLS_TO_LEARN); + } break; } case REVELATION_DUALCLASS: @@ -492,6 +503,16 @@ public final class RequestAcquireSkill implements IClientIncomingPacket giveSkill(activeChar, trainer, skill); } + + final List skills = SkillTreesData.getInstance().getAvailableRevelationSkills(activeChar, SubclassType.DUALCLASS); + if (skills.size() > 0) + { + activeChar.sendPacket(new ExAcquirableSkillListByClass(skills, AcquireSkillType.REVELATION_DUALCLASS)); + } + else + { + activeChar.sendPacket(SystemMessageId.THERE_ARE_NO_OTHER_SKILLS_TO_LEARN); + } break; } default: