Fixed Revelation skill removal.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
@@ -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
|
||||
{
|
||||
|
@@ -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";
|
||||
|
@@ -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<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;
|
||||
}
|
||||
case REVELATION_DUALCLASS:
|
||||
@@ -492,6 +503,16 @@ public final class RequestAcquireSkill implements IClientIncomingPacket
|
||||
|
||||
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;
|
||||
}
|
||||
default:
|
||||
|
Reference in New Issue
Block a user