Fixed Revelation skill removal.

This commit is contained in:
MobiusDev 2017-12-07 18:26:09 +00:00
parent c373bc6f68
commit 00a11c037e
29 changed files with 307 additions and 192 deletions

View File

@ -46,8 +46,8 @@ public final class MonkOfChaos extends AbstractNpcAI
private static final int CHAOS_POMANDER_DUALCLASS = 37375; private static final int CHAOS_POMANDER_DUALCLASS = 37375;
private static final String[] REVELATION_VAR_NAMES = private static final String[] REVELATION_VAR_NAMES =
{ {
"RevelationSkill1", PlayerVariables.REVELATION_SKILL_1_MAIN_CLASS,
"RevelationSkill2" PlayerVariables.REVELATION_SKILL_2_MAIN_CLASS,
}; };
private static final String[] DUALCLASS_REVELATION_VAR_NAMES = private static final String[] DUALCLASS_REVELATION_VAR_NAMES =
@ -159,9 +159,9 @@ public final class MonkOfChaos extends AbstractNpcAI
{ {
player.removeSkill(sk); player.removeSkill(sk);
player.getVariables().remove(varName); player.getVariables().remove(varName);
giveItems(player, chaosPomander, 1);
} }
} }
giveItems(player, chaosPomander, count);
htmltext = "canceled.html"; htmltext = "canceled.html";
break; break;
} }

View File

@ -51,8 +51,11 @@ public final class SkillTransfer extends AbstractNpcAI
private SkillTransfer() private SkillTransfer()
{ {
setPlayerProfessionChangeId(this::onProfessionChange); setPlayerProfessionChangeId(this::onProfessionChange);
if (Config.SKILL_CHECK_ENABLE)
{
setOnEnterWorld(Config.SKILL_CHECK_ENABLE); setOnEnterWorld(Config.SKILL_CHECK_ENABLE);
} }
}
public void onProfessionChange(OnPlayerProfessionChange event) public void onProfessionChange(OnPlayerProfessionChange event)
{ {

View File

@ -1374,13 +1374,9 @@ public final class SkillTreesData implements IGameXmlReader
* @return the revelation skill from the Revelation Skill Tree for a given {@code id} and {@code lvl} * @return the revelation skill from the Revelation Skill Tree for a given {@code id} and {@code lvl}
*/ */
public L2SkillLearn getRevelationSkill(SubclassType type, int id, int lvl) public L2SkillLearn getRevelationSkill(SubclassType type, int id, int lvl)
{
if (_revelationSkillTree.get(type) != null)
{ {
return _revelationSkillTree.get(type).get(SkillData.getSkillHashCode(id, lvl)); return _revelationSkillTree.get(type).get(SkillData.getSkillHashCode(id, lvl));
} }
return null;
}
/** /**
* Gets the minimum level for new skill. * Gets the minimum level for new skill.
@ -1687,12 +1683,6 @@ public final class SkillTreesData implements IGameXmlReader
return true; 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. // Exclude Transfer Skills from this check.
if (getTransferSkill(skill.getId(), Math.min(skill.getLevel(), maxLvl), player.getClassId()) != null) if (getTransferSkill(skill.getId(), Math.min(skill.getLevel(), maxLvl), player.getClassId()) != null)
{ {
@ -1704,6 +1694,13 @@ public final class SkillTreesData implements IGameXmlReader
{ {
return true; 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; return false;
} }

View File

@ -9603,6 +9603,28 @@ public final class L2PcInstance extends L2Playable
try 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(); try (Connection con = DatabaseFactory.getInstance().getConnection();
PreparedStatement deleteHennas = con.prepareStatement(DELETE_CHAR_HENNAS); PreparedStatement deleteHennas = con.prepareStatement(DELETE_CHAR_HENNAS);
PreparedStatement deleteShortcuts = con.prepareStatement(DELETE_CHAR_SHORTCUTS); PreparedStatement deleteShortcuts = con.prepareStatement(DELETE_CHAR_SHORTCUTS);
@ -9634,34 +9656,12 @@ public final class L2PcInstance extends L2Playable
deleteSubclass.setInt(1, getObjectId()); deleteSubclass.setInt(1, getObjectId());
deleteSubclass.setInt(2, classIndex); deleteSubclass.setInt(2, classIndex);
deleteSubclass.execute(); 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) catch (Exception e)
{ {
_log.log(Level.WARNING, "Could not modify sub class for " + getName() + " to class index " + classIndex + ": " + e.getMessage(), 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; return false;
} }
getSubClasses().remove(classIndex);
} }
finally finally
{ {

View File

@ -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_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_MAIN_CLASS = "ABILITY_POINTS_USED";
public static final String ABILITY_POINTS_USED_DUAL_CLASS = "ABILITY_POINTS_DUAL_CLASS_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_1_DUAL_CLASS = "DualclassRevelationSkill1";
public static final String REVELATION_SKILL_2_DUAL_CLASS = "DualclassRevelationSkill2"; public static final String REVELATION_SKILL_2_DUAL_CLASS = "DualclassRevelationSkill2";
public static final String EXTEND_DROP = "EXTEND_DROP"; public static final String EXTEND_DROP = "EXTEND_DROP";

View File

@ -25,6 +25,7 @@ import com.l2jmobius.gameserver.data.xml.impl.SkillTreesData;
import com.l2jmobius.gameserver.enums.CategoryType; import com.l2jmobius.gameserver.enums.CategoryType;
import com.l2jmobius.gameserver.enums.IllegalActionPunishmentType; import com.l2jmobius.gameserver.enums.IllegalActionPunishmentType;
import com.l2jmobius.gameserver.enums.Race; import com.l2jmobius.gameserver.enums.Race;
import com.l2jmobius.gameserver.enums.SubclassType;
import com.l2jmobius.gameserver.enums.UserInfoType; import com.l2jmobius.gameserver.enums.UserInfoType;
import com.l2jmobius.gameserver.model.ClanPrivilege; import com.l2jmobius.gameserver.model.ClanPrivilege;
import com.l2jmobius.gameserver.model.L2Clan; import com.l2jmobius.gameserver.model.L2Clan;
@ -65,8 +66,8 @@ public final class RequestAcquireSkill implements IClientIncomingPacket
{ {
private static final String[] REVELATION_VAR_NAMES = private static final String[] REVELATION_VAR_NAMES =
{ {
"RevelationSkill1", PlayerVariables.REVELATION_SKILL_1_MAIN_CLASS,
"RevelationSkill2" PlayerVariables.REVELATION_SKILL_2_MAIN_CLASS
}; };
private static final String[] DUALCLASS_REVELATION_VAR_NAMES = private static final String[] DUALCLASS_REVELATION_VAR_NAMES =
@ -449,6 +450,16 @@ public final class RequestAcquireSkill implements IClientIncomingPacket
giveSkill(activeChar, trainer, skill); giveSkill(activeChar, trainer, skill);
} }
final List<L2SkillLearn> 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; break;
} }
case REVELATION_DUALCLASS: case REVELATION_DUALCLASS:
@ -492,6 +503,16 @@ public final class RequestAcquireSkill implements IClientIncomingPacket
giveSkill(activeChar, trainer, skill); giveSkill(activeChar, trainer, skill);
} }
final List<L2SkillLearn> 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; break;
} }
default: default:

View File

@ -46,8 +46,8 @@ public final class MonkOfChaos extends AbstractNpcAI
private static final int CHAOS_POMANDER_DUALCLASS = 37375; private static final int CHAOS_POMANDER_DUALCLASS = 37375;
private static final String[] REVELATION_VAR_NAMES = private static final String[] REVELATION_VAR_NAMES =
{ {
"RevelationSkill1", PlayerVariables.REVELATION_SKILL_1_MAIN_CLASS,
"RevelationSkill2" PlayerVariables.REVELATION_SKILL_2_MAIN_CLASS,
}; };
private static final String[] DUALCLASS_REVELATION_VAR_NAMES = private static final String[] DUALCLASS_REVELATION_VAR_NAMES =
@ -159,9 +159,9 @@ public final class MonkOfChaos extends AbstractNpcAI
{ {
player.removeSkill(sk); player.removeSkill(sk);
player.getVariables().remove(varName); player.getVariables().remove(varName);
giveItems(player, chaosPomander, 1);
} }
} }
giveItems(player, chaosPomander, count);
htmltext = "canceled.html"; htmltext = "canceled.html";
break; break;
} }

View File

@ -51,8 +51,11 @@ public final class SkillTransfer extends AbstractNpcAI
private SkillTransfer() private SkillTransfer()
{ {
setPlayerProfessionChangeId(this::onProfessionChange); setPlayerProfessionChangeId(this::onProfessionChange);
if (Config.SKILL_CHECK_ENABLE)
{
setOnEnterWorld(Config.SKILL_CHECK_ENABLE); setOnEnterWorld(Config.SKILL_CHECK_ENABLE);
} }
}
public void onProfessionChange(OnPlayerProfessionChange event) public void onProfessionChange(OnPlayerProfessionChange event)
{ {

View File

@ -1374,13 +1374,9 @@ public final class SkillTreesData implements IGameXmlReader
* @return the revelation skill from the Revelation Skill Tree for a given {@code id} and {@code lvl} * @return the revelation skill from the Revelation Skill Tree for a given {@code id} and {@code lvl}
*/ */
public L2SkillLearn getRevelationSkill(SubclassType type, int id, int lvl) public L2SkillLearn getRevelationSkill(SubclassType type, int id, int lvl)
{
if (_revelationSkillTree.get(type) != null)
{ {
return _revelationSkillTree.get(type).get(SkillData.getSkillHashCode(id, lvl)); return _revelationSkillTree.get(type).get(SkillData.getSkillHashCode(id, lvl));
} }
return null;
}
/** /**
* Gets the minimum level for new skill. * Gets the minimum level for new skill.
@ -1687,12 +1683,6 @@ public final class SkillTreesData implements IGameXmlReader
return true; 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. // Exclude Transfer Skills from this check.
if (getTransferSkill(skill.getId(), Math.min(skill.getLevel(), maxLvl), player.getClassId()) != null) if (getTransferSkill(skill.getId(), Math.min(skill.getLevel(), maxLvl), player.getClassId()) != null)
{ {
@ -1704,6 +1694,13 @@ public final class SkillTreesData implements IGameXmlReader
{ {
return true; 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; return false;
} }

View File

@ -9604,6 +9604,28 @@ public final class L2PcInstance extends L2Playable
try 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(); try (Connection con = DatabaseFactory.getInstance().getConnection();
PreparedStatement deleteHennas = con.prepareStatement(DELETE_CHAR_HENNAS); PreparedStatement deleteHennas = con.prepareStatement(DELETE_CHAR_HENNAS);
PreparedStatement deleteShortcuts = con.prepareStatement(DELETE_CHAR_SHORTCUTS); PreparedStatement deleteShortcuts = con.prepareStatement(DELETE_CHAR_SHORTCUTS);
@ -9635,34 +9657,12 @@ public final class L2PcInstance extends L2Playable
deleteSubclass.setInt(1, getObjectId()); deleteSubclass.setInt(1, getObjectId());
deleteSubclass.setInt(2, classIndex); deleteSubclass.setInt(2, classIndex);
deleteSubclass.execute(); 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) catch (Exception e)
{ {
_log.log(Level.WARNING, "Could not modify sub class for " + getName() + " to class index " + classIndex + ": " + e.getMessage(), 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; return false;
} }
getSubClasses().remove(classIndex);
} }
finally finally
{ {

View File

@ -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_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_MAIN_CLASS = "ABILITY_POINTS_USED";
public static final String ABILITY_POINTS_USED_DUAL_CLASS = "ABILITY_POINTS_DUAL_CLASS_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_1_DUAL_CLASS = "DualclassRevelationSkill1";
public static final String REVELATION_SKILL_2_DUAL_CLASS = "DualclassRevelationSkill2"; public static final String REVELATION_SKILL_2_DUAL_CLASS = "DualclassRevelationSkill2";
public static final String EXTEND_DROP = "EXTEND_DROP"; public static final String EXTEND_DROP = "EXTEND_DROP";

View File

@ -25,6 +25,7 @@ import com.l2jmobius.gameserver.data.xml.impl.SkillTreesData;
import com.l2jmobius.gameserver.enums.CategoryType; import com.l2jmobius.gameserver.enums.CategoryType;
import com.l2jmobius.gameserver.enums.IllegalActionPunishmentType; import com.l2jmobius.gameserver.enums.IllegalActionPunishmentType;
import com.l2jmobius.gameserver.enums.Race; import com.l2jmobius.gameserver.enums.Race;
import com.l2jmobius.gameserver.enums.SubclassType;
import com.l2jmobius.gameserver.enums.UserInfoType; import com.l2jmobius.gameserver.enums.UserInfoType;
import com.l2jmobius.gameserver.model.ClanPrivilege; import com.l2jmobius.gameserver.model.ClanPrivilege;
import com.l2jmobius.gameserver.model.L2Clan; import com.l2jmobius.gameserver.model.L2Clan;
@ -65,8 +66,8 @@ public final class RequestAcquireSkill implements IClientIncomingPacket
{ {
private static final String[] REVELATION_VAR_NAMES = private static final String[] REVELATION_VAR_NAMES =
{ {
"RevelationSkill1", PlayerVariables.REVELATION_SKILL_1_MAIN_CLASS,
"RevelationSkill2" PlayerVariables.REVELATION_SKILL_2_MAIN_CLASS
}; };
private static final String[] DUALCLASS_REVELATION_VAR_NAMES = private static final String[] DUALCLASS_REVELATION_VAR_NAMES =
@ -449,6 +450,16 @@ public final class RequestAcquireSkill implements IClientIncomingPacket
giveSkill(activeChar, trainer, skill); giveSkill(activeChar, trainer, skill);
} }
final List<L2SkillLearn> 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; break;
} }
case REVELATION_DUALCLASS: case REVELATION_DUALCLASS:
@ -492,6 +503,16 @@ public final class RequestAcquireSkill implements IClientIncomingPacket
giveSkill(activeChar, trainer, skill); giveSkill(activeChar, trainer, skill);
} }
final List<L2SkillLearn> 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; break;
} }
default: default:

View File

@ -46,8 +46,8 @@ public final class MonkOfChaos extends AbstractNpcAI
private static final int CHAOS_POMANDER_DUALCLASS = 37375; private static final int CHAOS_POMANDER_DUALCLASS = 37375;
private static final String[] REVELATION_VAR_NAMES = private static final String[] REVELATION_VAR_NAMES =
{ {
"RevelationSkill1", PlayerVariables.REVELATION_SKILL_1_MAIN_CLASS,
"RevelationSkill2" PlayerVariables.REVELATION_SKILL_2_MAIN_CLASS,
}; };
private static final String[] DUALCLASS_REVELATION_VAR_NAMES = private static final String[] DUALCLASS_REVELATION_VAR_NAMES =
@ -159,9 +159,9 @@ public final class MonkOfChaos extends AbstractNpcAI
{ {
player.removeSkill(sk); player.removeSkill(sk);
player.getVariables().remove(varName); player.getVariables().remove(varName);
giveItems(player, chaosPomander, 1);
} }
} }
giveItems(player, chaosPomander, count);
htmltext = "canceled.html"; htmltext = "canceled.html";
break; break;
} }

View File

@ -51,8 +51,11 @@ public final class SkillTransfer extends AbstractNpcAI
private SkillTransfer() private SkillTransfer()
{ {
setPlayerProfessionChangeId(this::onProfessionChange); setPlayerProfessionChangeId(this::onProfessionChange);
if (Config.SKILL_CHECK_ENABLE)
{
setOnEnterWorld(Config.SKILL_CHECK_ENABLE); setOnEnterWorld(Config.SKILL_CHECK_ENABLE);
} }
}
public void onProfessionChange(OnPlayerProfessionChange event) public void onProfessionChange(OnPlayerProfessionChange event)
{ {

View File

@ -1374,13 +1374,9 @@ public final class SkillTreesData implements IGameXmlReader
* @return the revelation skill from the Revelation Skill Tree for a given {@code id} and {@code lvl} * @return the revelation skill from the Revelation Skill Tree for a given {@code id} and {@code lvl}
*/ */
public L2SkillLearn getRevelationSkill(SubclassType type, int id, int lvl) public L2SkillLearn getRevelationSkill(SubclassType type, int id, int lvl)
{
if (_revelationSkillTree.get(type) != null)
{ {
return _revelationSkillTree.get(type).get(SkillData.getSkillHashCode(id, lvl)); return _revelationSkillTree.get(type).get(SkillData.getSkillHashCode(id, lvl));
} }
return null;
}
/** /**
* Gets the minimum level for new skill. * Gets the minimum level for new skill.
@ -1687,12 +1683,6 @@ public final class SkillTreesData implements IGameXmlReader
return true; 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. // Exclude Transfer Skills from this check.
if (getTransferSkill(skill.getId(), Math.min(skill.getLevel(), maxLvl), player.getClassId()) != null) if (getTransferSkill(skill.getId(), Math.min(skill.getLevel(), maxLvl), player.getClassId()) != null)
{ {
@ -1704,6 +1694,13 @@ public final class SkillTreesData implements IGameXmlReader
{ {
return true; 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; return false;
} }

View File

@ -9614,6 +9614,28 @@ public final class L2PcInstance extends L2Playable
try 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(); try (Connection con = DatabaseFactory.getInstance().getConnection();
PreparedStatement deleteHennas = con.prepareStatement(DELETE_CHAR_HENNAS); PreparedStatement deleteHennas = con.prepareStatement(DELETE_CHAR_HENNAS);
PreparedStatement deleteShortcuts = con.prepareStatement(DELETE_CHAR_SHORTCUTS); PreparedStatement deleteShortcuts = con.prepareStatement(DELETE_CHAR_SHORTCUTS);
@ -9645,34 +9667,12 @@ public final class L2PcInstance extends L2Playable
deleteSubclass.setInt(1, getObjectId()); deleteSubclass.setInt(1, getObjectId());
deleteSubclass.setInt(2, classIndex); deleteSubclass.setInt(2, classIndex);
deleteSubclass.execute(); 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) catch (Exception e)
{ {
_log.log(Level.WARNING, "Could not modify sub class for " + getName() + " to class index " + classIndex + ": " + e.getMessage(), 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; return false;
} }
getSubClasses().remove(classIndex);
} }
finally finally
{ {

View File

@ -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_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_MAIN_CLASS = "ABILITY_POINTS_USED";
public static final String ABILITY_POINTS_USED_DUAL_CLASS = "ABILITY_POINTS_DUAL_CLASS_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_1_DUAL_CLASS = "DualclassRevelationSkill1";
public static final String REVELATION_SKILL_2_DUAL_CLASS = "DualclassRevelationSkill2"; public static final String REVELATION_SKILL_2_DUAL_CLASS = "DualclassRevelationSkill2";
public static final String EXTEND_DROP = "EXTEND_DROP"; public static final String EXTEND_DROP = "EXTEND_DROP";

View File

@ -25,6 +25,7 @@ import com.l2jmobius.gameserver.data.xml.impl.SkillTreesData;
import com.l2jmobius.gameserver.enums.CategoryType; import com.l2jmobius.gameserver.enums.CategoryType;
import com.l2jmobius.gameserver.enums.IllegalActionPunishmentType; import com.l2jmobius.gameserver.enums.IllegalActionPunishmentType;
import com.l2jmobius.gameserver.enums.Race; import com.l2jmobius.gameserver.enums.Race;
import com.l2jmobius.gameserver.enums.SubclassType;
import com.l2jmobius.gameserver.enums.UserInfoType; import com.l2jmobius.gameserver.enums.UserInfoType;
import com.l2jmobius.gameserver.model.ClanPrivilege; import com.l2jmobius.gameserver.model.ClanPrivilege;
import com.l2jmobius.gameserver.model.L2Clan; import com.l2jmobius.gameserver.model.L2Clan;
@ -65,8 +66,8 @@ public final class RequestAcquireSkill implements IClientIncomingPacket
{ {
private static final String[] REVELATION_VAR_NAMES = private static final String[] REVELATION_VAR_NAMES =
{ {
"RevelationSkill1", PlayerVariables.REVELATION_SKILL_1_MAIN_CLASS,
"RevelationSkill2" PlayerVariables.REVELATION_SKILL_2_MAIN_CLASS
}; };
private static final String[] DUALCLASS_REVELATION_VAR_NAMES = private static final String[] DUALCLASS_REVELATION_VAR_NAMES =
@ -449,6 +450,16 @@ public final class RequestAcquireSkill implements IClientIncomingPacket
giveSkill(activeChar, trainer, skill); giveSkill(activeChar, trainer, skill);
} }
final List<L2SkillLearn> 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; break;
} }
case REVELATION_DUALCLASS: case REVELATION_DUALCLASS:
@ -492,6 +503,16 @@ public final class RequestAcquireSkill implements IClientIncomingPacket
giveSkill(activeChar, trainer, skill); giveSkill(activeChar, trainer, skill);
} }
final List<L2SkillLearn> 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; break;
} }
default: default:

View File

@ -46,8 +46,8 @@ public final class MonkOfChaos extends AbstractNpcAI
private static final int CHAOS_POMANDER_DUALCLASS = 37375; private static final int CHAOS_POMANDER_DUALCLASS = 37375;
private static final String[] REVELATION_VAR_NAMES = private static final String[] REVELATION_VAR_NAMES =
{ {
"RevelationSkill1", PlayerVariables.REVELATION_SKILL_1_MAIN_CLASS,
"RevelationSkill2" PlayerVariables.REVELATION_SKILL_2_MAIN_CLASS,
}; };
private static final String[] DUALCLASS_REVELATION_VAR_NAMES = private static final String[] DUALCLASS_REVELATION_VAR_NAMES =
@ -159,9 +159,9 @@ public final class MonkOfChaos extends AbstractNpcAI
{ {
player.removeSkill(sk); player.removeSkill(sk);
player.getVariables().remove(varName); player.getVariables().remove(varName);
giveItems(player, chaosPomander, 1);
} }
} }
giveItems(player, chaosPomander, count);
htmltext = "canceled.html"; htmltext = "canceled.html";
break; break;
} }

View File

@ -51,8 +51,11 @@ public final class SkillTransfer extends AbstractNpcAI
private SkillTransfer() private SkillTransfer()
{ {
setPlayerProfessionChangeId(this::onProfessionChange); setPlayerProfessionChangeId(this::onProfessionChange);
if (Config.SKILL_CHECK_ENABLE)
{
setOnEnterWorld(Config.SKILL_CHECK_ENABLE); setOnEnterWorld(Config.SKILL_CHECK_ENABLE);
} }
}
public void onProfessionChange(OnPlayerProfessionChange event) public void onProfessionChange(OnPlayerProfessionChange event)
{ {

View File

@ -1374,13 +1374,9 @@ public final class SkillTreesData implements IGameXmlReader
* @return the revelation skill from the Revelation Skill Tree for a given {@code id} and {@code lvl} * @return the revelation skill from the Revelation Skill Tree for a given {@code id} and {@code lvl}
*/ */
public L2SkillLearn getRevelationSkill(SubclassType type, int id, int lvl) public L2SkillLearn getRevelationSkill(SubclassType type, int id, int lvl)
{
if (_revelationSkillTree.get(type) != null)
{ {
return _revelationSkillTree.get(type).get(SkillData.getSkillHashCode(id, lvl)); return _revelationSkillTree.get(type).get(SkillData.getSkillHashCode(id, lvl));
} }
return null;
}
/** /**
* Gets the minimum level for new skill. * Gets the minimum level for new skill.
@ -1687,12 +1683,6 @@ public final class SkillTreesData implements IGameXmlReader
return true; 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. // Exclude Transfer Skills from this check.
if (getTransferSkill(skill.getId(), Math.min(skill.getLevel(), maxLvl), player.getClassId()) != null) if (getTransferSkill(skill.getId(), Math.min(skill.getLevel(), maxLvl), player.getClassId()) != null)
{ {
@ -1704,6 +1694,13 @@ public final class SkillTreesData implements IGameXmlReader
{ {
return true; 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; return false;
} }

View File

@ -9607,6 +9607,28 @@ public final class L2PcInstance extends L2Playable
try 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(); try (Connection con = DatabaseFactory.getInstance().getConnection();
PreparedStatement deleteHennas = con.prepareStatement(DELETE_CHAR_HENNAS); PreparedStatement deleteHennas = con.prepareStatement(DELETE_CHAR_HENNAS);
PreparedStatement deleteShortcuts = con.prepareStatement(DELETE_CHAR_SHORTCUTS); PreparedStatement deleteShortcuts = con.prepareStatement(DELETE_CHAR_SHORTCUTS);
@ -9638,34 +9660,12 @@ public final class L2PcInstance extends L2Playable
deleteSubclass.setInt(1, getObjectId()); deleteSubclass.setInt(1, getObjectId());
deleteSubclass.setInt(2, classIndex); deleteSubclass.setInt(2, classIndex);
deleteSubclass.execute(); 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) catch (Exception e)
{ {
_log.log(Level.WARNING, "Could not modify sub class for " + getName() + " to class index " + classIndex + ": " + e.getMessage(), 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; return false;
} }
getSubClasses().remove(classIndex);
} }
finally finally
{ {

View File

@ -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_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_MAIN_CLASS = "ABILITY_POINTS_USED";
public static final String ABILITY_POINTS_USED_DUAL_CLASS = "ABILITY_POINTS_DUAL_CLASS_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_1_DUAL_CLASS = "DualclassRevelationSkill1";
public static final String REVELATION_SKILL_2_DUAL_CLASS = "DualclassRevelationSkill2"; public static final String REVELATION_SKILL_2_DUAL_CLASS = "DualclassRevelationSkill2";
public static final String EXTEND_DROP = "EXTEND_DROP"; public static final String EXTEND_DROP = "EXTEND_DROP";

View File

@ -25,6 +25,7 @@ import com.l2jmobius.gameserver.data.xml.impl.SkillTreesData;
import com.l2jmobius.gameserver.enums.CategoryType; import com.l2jmobius.gameserver.enums.CategoryType;
import com.l2jmobius.gameserver.enums.IllegalActionPunishmentType; import com.l2jmobius.gameserver.enums.IllegalActionPunishmentType;
import com.l2jmobius.gameserver.enums.Race; import com.l2jmobius.gameserver.enums.Race;
import com.l2jmobius.gameserver.enums.SubclassType;
import com.l2jmobius.gameserver.enums.UserInfoType; import com.l2jmobius.gameserver.enums.UserInfoType;
import com.l2jmobius.gameserver.model.ClanPrivilege; import com.l2jmobius.gameserver.model.ClanPrivilege;
import com.l2jmobius.gameserver.model.L2Clan; import com.l2jmobius.gameserver.model.L2Clan;
@ -65,8 +66,8 @@ public final class RequestAcquireSkill implements IClientIncomingPacket
{ {
private static final String[] REVELATION_VAR_NAMES = private static final String[] REVELATION_VAR_NAMES =
{ {
"RevelationSkill1", PlayerVariables.REVELATION_SKILL_1_MAIN_CLASS,
"RevelationSkill2" PlayerVariables.REVELATION_SKILL_2_MAIN_CLASS
}; };
private static final String[] DUALCLASS_REVELATION_VAR_NAMES = private static final String[] DUALCLASS_REVELATION_VAR_NAMES =
@ -449,6 +450,16 @@ public final class RequestAcquireSkill implements IClientIncomingPacket
giveSkill(activeChar, trainer, skill); giveSkill(activeChar, trainer, skill);
} }
final List<L2SkillLearn> 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; break;
} }
case REVELATION_DUALCLASS: case REVELATION_DUALCLASS:
@ -492,6 +503,16 @@ public final class RequestAcquireSkill implements IClientIncomingPacket
giveSkill(activeChar, trainer, skill); giveSkill(activeChar, trainer, skill);
} }
final List<L2SkillLearn> 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; break;
} }
default: default:

View File

@ -51,8 +51,11 @@ public final class SkillTransfer extends AbstractNpcAI
private SkillTransfer() private SkillTransfer()
{ {
setPlayerProfessionChangeId(this::onProfessionChange); setPlayerProfessionChangeId(this::onProfessionChange);
if (Config.SKILL_CHECK_ENABLE)
{
setOnEnterWorld(Config.SKILL_CHECK_ENABLE); setOnEnterWorld(Config.SKILL_CHECK_ENABLE);
} }
}
public void onProfessionChange(OnPlayerProfessionChange event) public void onProfessionChange(OnPlayerProfessionChange event)
{ {

View File

@ -1374,13 +1374,9 @@ public final class SkillTreesData implements IGameXmlReader
* @return the revelation skill from the Revelation Skill Tree for a given {@code id} and {@code lvl} * @return the revelation skill from the Revelation Skill Tree for a given {@code id} and {@code lvl}
*/ */
public L2SkillLearn getRevelationSkill(SubclassType type, int id, int lvl) public L2SkillLearn getRevelationSkill(SubclassType type, int id, int lvl)
{
if (_revelationSkillTree.get(type) != null)
{ {
return _revelationSkillTree.get(type).get(SkillData.getSkillHashCode(id, lvl)); return _revelationSkillTree.get(type).get(SkillData.getSkillHashCode(id, lvl));
} }
return null;
}
/** /**
* Gets the minimum level for new skill. * Gets the minimum level for new skill.
@ -1687,12 +1683,6 @@ public final class SkillTreesData implements IGameXmlReader
return true; 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. // Exclude Transfer Skills from this check.
if (getTransferSkill(skill.getId(), Math.min(skill.getLevel(), maxLvl), player.getClassId()) != null) if (getTransferSkill(skill.getId(), Math.min(skill.getLevel(), maxLvl), player.getClassId()) != null)
{ {
@ -1704,6 +1694,13 @@ public final class SkillTreesData implements IGameXmlReader
{ {
return true; 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; return false;
} }

View File

@ -9547,6 +9547,28 @@ public final class L2PcInstance extends L2Playable
try 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(); try (Connection con = DatabaseFactory.getInstance().getConnection();
PreparedStatement deleteHennas = con.prepareStatement(DELETE_CHAR_HENNAS); PreparedStatement deleteHennas = con.prepareStatement(DELETE_CHAR_HENNAS);
PreparedStatement deleteShortcuts = con.prepareStatement(DELETE_CHAR_SHORTCUTS); PreparedStatement deleteShortcuts = con.prepareStatement(DELETE_CHAR_SHORTCUTS);
@ -9578,34 +9600,12 @@ public final class L2PcInstance extends L2Playable
deleteSubclass.setInt(1, getObjectId()); deleteSubclass.setInt(1, getObjectId());
deleteSubclass.setInt(2, classIndex); deleteSubclass.setInt(2, classIndex);
deleteSubclass.execute(); 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) catch (Exception e)
{ {
_log.log(Level.WARNING, "Could not modify sub class for " + getName() + " to class index " + classIndex + ": " + e.getMessage(), 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; return false;
} }
getSubClasses().remove(classIndex);
} }
finally finally
{ {

View File

@ -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_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_MAIN_CLASS = "ABILITY_POINTS_USED";
public static final String ABILITY_POINTS_USED_DUAL_CLASS = "ABILITY_POINTS_DUAL_CLASS_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_1_DUAL_CLASS = "DualclassRevelationSkill1";
public static final String REVELATION_SKILL_2_DUAL_CLASS = "DualclassRevelationSkill2"; public static final String REVELATION_SKILL_2_DUAL_CLASS = "DualclassRevelationSkill2";
public static final String EXTEND_DROP = "EXTEND_DROP"; public static final String EXTEND_DROP = "EXTEND_DROP";

View File

@ -25,6 +25,7 @@ import com.l2jmobius.gameserver.data.xml.impl.SkillTreesData;
import com.l2jmobius.gameserver.enums.CategoryType; import com.l2jmobius.gameserver.enums.CategoryType;
import com.l2jmobius.gameserver.enums.IllegalActionPunishmentType; import com.l2jmobius.gameserver.enums.IllegalActionPunishmentType;
import com.l2jmobius.gameserver.enums.Race; import com.l2jmobius.gameserver.enums.Race;
import com.l2jmobius.gameserver.enums.SubclassType;
import com.l2jmobius.gameserver.enums.UserInfoType; import com.l2jmobius.gameserver.enums.UserInfoType;
import com.l2jmobius.gameserver.model.ClanPrivilege; import com.l2jmobius.gameserver.model.ClanPrivilege;
import com.l2jmobius.gameserver.model.L2Clan; import com.l2jmobius.gameserver.model.L2Clan;
@ -65,8 +66,8 @@ public final class RequestAcquireSkill implements IClientIncomingPacket
{ {
private static final String[] REVELATION_VAR_NAMES = private static final String[] REVELATION_VAR_NAMES =
{ {
"RevelationSkill1", PlayerVariables.REVELATION_SKILL_1_MAIN_CLASS,
"RevelationSkill2" PlayerVariables.REVELATION_SKILL_2_MAIN_CLASS
}; };
private static final String[] DUALCLASS_REVELATION_VAR_NAMES = private static final String[] DUALCLASS_REVELATION_VAR_NAMES =
@ -449,6 +450,16 @@ public final class RequestAcquireSkill implements IClientIncomingPacket
giveSkill(activeChar, trainer, skill); giveSkill(activeChar, trainer, skill);
} }
final List<L2SkillLearn> 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; break;
} }
case REVELATION_DUALCLASS: case REVELATION_DUALCLASS:
@ -492,6 +503,16 @@ public final class RequestAcquireSkill implements IClientIncomingPacket
giveSkill(activeChar, trainer, skill); giveSkill(activeChar, trainer, skill);
} }
final List<L2SkillLearn> 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; break;
} }
default: default: