Ability to make a skill tree with multiple requisites per skill.

Contributed by hexash14.
This commit is contained in:
MobiusDev
2019-02-06 04:27:53 +00:00
parent 78dacf5dfe
commit b56c8ac983
11 changed files with 23 additions and 23 deletions

View File

@@ -608,7 +608,7 @@ public final class RequestAcquireSkill implements IClientIncomingPacket
{ {
for (SkillHolder skill : skillLearn.getPreReqSkills()) for (SkillHolder skill : skillLearn.getPreReqSkills())
{ {
if (player.getSkillLevel(skill.getSkillId()) != skill.getSkillLevel()) if (player.getSkillLevel(skill.getSkillId()) < skill.getSkillLevel())
{ {
if (skill.getSkillId() == CommonSkill.ONYX_BEAST_TRANSFORMATION.getId()) if (skill.getSkillId() == CommonSkill.ONYX_BEAST_TRANSFORMATION.getId())
{ {

View File

@@ -608,7 +608,7 @@ public final class RequestAcquireSkill implements IClientIncomingPacket
{ {
for (SkillHolder skill : skillLearn.getPreReqSkills()) for (SkillHolder skill : skillLearn.getPreReqSkills())
{ {
if (player.getSkillLevel(skill.getSkillId()) != skill.getSkillLevel()) if (player.getSkillLevel(skill.getSkillId()) < skill.getSkillLevel())
{ {
if (skill.getSkillId() == CommonSkill.ONYX_BEAST_TRANSFORMATION.getId()) if (skill.getSkillId() == CommonSkill.ONYX_BEAST_TRANSFORMATION.getId())
{ {

View File

@@ -608,7 +608,7 @@ public final class RequestAcquireSkill implements IClientIncomingPacket
{ {
for (SkillHolder skill : skillLearn.getPreReqSkills()) for (SkillHolder skill : skillLearn.getPreReqSkills())
{ {
if (player.getSkillLevel(skill.getSkillId()) != skill.getSkillLevel()) if (player.getSkillLevel(skill.getSkillId()) < skill.getSkillLevel())
{ {
if (skill.getSkillId() == CommonSkill.ONYX_BEAST_TRANSFORMATION.getId()) if (skill.getSkillId() == CommonSkill.ONYX_BEAST_TRANSFORMATION.getId())
{ {

View File

@@ -608,7 +608,7 @@ public final class RequestAcquireSkill implements IClientIncomingPacket
{ {
for (SkillHolder skill : skillLearn.getPreReqSkills()) for (SkillHolder skill : skillLearn.getPreReqSkills())
{ {
if (player.getSkillLevel(skill.getSkillId()) != skill.getSkillLevel()) if (player.getSkillLevel(skill.getSkillId()) < skill.getSkillLevel())
{ {
if (skill.getSkillId() == CommonSkill.ONYX_BEAST_TRANSFORMATION.getId()) if (skill.getSkillId() == CommonSkill.ONYX_BEAST_TRANSFORMATION.getId())
{ {

View File

@@ -608,7 +608,7 @@ public final class RequestAcquireSkill implements IClientIncomingPacket
{ {
for (SkillHolder skill : skillLearn.getPreReqSkills()) for (SkillHolder skill : skillLearn.getPreReqSkills())
{ {
if (player.getSkillLevel(skill.getSkillId()) != skill.getSkillLevel()) if (player.getSkillLevel(skill.getSkillId()) < skill.getSkillLevel())
{ {
if (skill.getSkillId() == CommonSkill.ONYX_BEAST_TRANSFORMATION.getId()) if (skill.getSkillId() == CommonSkill.ONYX_BEAST_TRANSFORMATION.getId())
{ {

View File

@@ -608,7 +608,7 @@ public final class RequestAcquireSkill implements IClientIncomingPacket
{ {
for (SkillHolder skill : skillLearn.getPreReqSkills()) for (SkillHolder skill : skillLearn.getPreReqSkills())
{ {
if (player.getSkillLevel(skill.getSkillId()) != skill.getSkillLevel()) if (player.getSkillLevel(skill.getSkillId()) < skill.getSkillLevel())
{ {
if (skill.getSkillId() == CommonSkill.ONYX_BEAST_TRANSFORMATION.getId()) if (skill.getSkillId() == CommonSkill.ONYX_BEAST_TRANSFORMATION.getId())
{ {

View File

@@ -413,25 +413,25 @@ public final class RequestAcquireSkill implements IClientIncomingPacket
* Consume required items if the skill require it and all requirements are meet.<br> * Consume required items if the skill require it and all requirements are meet.<br>
* @param player the skill learning player. * @param player the skill learning player.
* @param trainer the skills teaching Npc. * @param trainer the skills teaching Npc.
* @param s the skill to be learn. * @param skillLearn the skill to be learn.
* @return {@code true} if all requirements are meet, {@code false} otherwise. * @return {@code true} if all requirements are meet, {@code false} otherwise.
*/ */
private boolean checkPlayerSkill(L2PcInstance player, L2Npc trainer, L2SkillLearn s) private boolean checkPlayerSkill(L2PcInstance player, L2Npc trainer, L2SkillLearn skillLearn)
{ {
if (s != null) if (skillLearn != null)
{ {
if ((s.getSkillId() == _id) && (s.getSkillLevel() == _level)) if ((skillLearn.getSkillId() == _id) && (skillLearn.getSkillLevel() == _level))
{ {
// Hack check. // Hack check.
if (s.getGetLevel() > player.getLevel()) if (skillLearn.getGetLevel() > player.getLevel())
{ {
player.sendPacket(SystemMessageId.YOU_DO_NOT_MEET_THE_SKILL_LEVEL_REQUIREMENTS); player.sendPacket(SystemMessageId.YOU_DO_NOT_MEET_THE_SKILL_LEVEL_REQUIREMENTS);
Util.handleIllegalPlayerAction(player, "Player " + player.getName() + ", level " + player.getLevel() + " is requesting skill Id: " + _id + " level " + _level + " without having minimum required level, " + s.getGetLevel() + "!", IllegalActionPunishmentType.NONE); Util.handleIllegalPlayerAction(player, "Player " + player.getName() + ", level " + player.getLevel() + " is requesting skill Id: " + _id + " level " + _level + " without having minimum required level, " + skillLearn.getGetLevel() + "!", IllegalActionPunishmentType.NONE);
return false; return false;
} }
// First it checks that the skill require SP and the player has enough SP to learn it. // First it checks that the skill require SP and the player has enough SP to learn it.
final int levelUpSp = s.getCalculatedLevelUpSp(player.getClassId(), player.getLearningClass()); final int levelUpSp = skillLearn.getCalculatedLevelUpSp(player.getClassId(), player.getLearningClass());
if ((levelUpSp > 0) && (levelUpSp > player.getSp())) if ((levelUpSp > 0) && (levelUpSp > player.getSp()))
{ {
player.sendPacket(SystemMessageId.YOU_DO_NOT_HAVE_ENOUGH_SP_TO_LEARN_THIS_SKILL); player.sendPacket(SystemMessageId.YOU_DO_NOT_HAVE_ENOUGH_SP_TO_LEARN_THIS_SKILL);
@@ -445,11 +445,11 @@ public final class RequestAcquireSkill implements IClientIncomingPacket
} }
// Check for required skills. // Check for required skills.
if (!s.getPreReqSkills().isEmpty()) if (!skillLearn.getPreReqSkills().isEmpty())
{ {
for (SkillHolder skill : s.getPreReqSkills()) for (SkillHolder skill : skillLearn.getPreReqSkills())
{ {
if (player.getSkillLevel(skill.getSkillId()) != skill.getSkillLevel()) if (player.getSkillLevel(skill.getSkillId()) < skill.getSkillLevel())
{ {
if (skill.getSkillId() == CommonSkill.ONYX_BEAST_TRANSFORMATION.getId()) if (skill.getSkillId() == CommonSkill.ONYX_BEAST_TRANSFORMATION.getId())
{ {
@@ -465,11 +465,11 @@ public final class RequestAcquireSkill implements IClientIncomingPacket
} }
// Check for required items. // Check for required items.
if (!s.getRequiredItems().isEmpty()) if (!skillLearn.getRequiredItems().isEmpty())
{ {
// Then checks that the player has all the items // Then checks that the player has all the items
long reqItemCount = 0; long reqItemCount = 0;
for (ItemHolder item : s.getRequiredItems()) for (ItemHolder item : skillLearn.getRequiredItems())
{ {
reqItemCount = player.getInventory().getInventoryItemCount(item.getId(), -1); reqItemCount = player.getInventory().getInventoryItemCount(item.getId(), -1);
if (reqItemCount < item.getCount()) if (reqItemCount < item.getCount())
@@ -481,7 +481,7 @@ public final class RequestAcquireSkill implements IClientIncomingPacket
} }
} }
// If the player has all required items, they are consumed. // If the player has all required items, they are consumed.
for (ItemHolder itemIdCount : s.getRequiredItems()) for (ItemHolder itemIdCount : skillLearn.getRequiredItems())
{ {
if (!player.destroyItemByItemId("SkillLearn", itemIdCount.getId(), itemIdCount.getCount(), trainer, true)) if (!player.destroyItemByItemId("SkillLearn", itemIdCount.getId(), itemIdCount.getCount(), trainer, true))
{ {

View File

@@ -608,7 +608,7 @@ public final class RequestAcquireSkill implements IClientIncomingPacket
{ {
for (SkillHolder skill : skillLearn.getPreReqSkills()) for (SkillHolder skill : skillLearn.getPreReqSkills())
{ {
if (player.getSkillLevel(skill.getSkillId()) != skill.getSkillLevel()) if (player.getSkillLevel(skill.getSkillId()) < skill.getSkillLevel())
{ {
if (skill.getSkillId() == CommonSkill.ONYX_BEAST_TRANSFORMATION.getId()) if (skill.getSkillId() == CommonSkill.ONYX_BEAST_TRANSFORMATION.getId())
{ {

View File

@@ -608,7 +608,7 @@ public final class RequestAcquireSkill implements IClientIncomingPacket
{ {
for (SkillHolder skill : skillLearn.getPreReqSkills()) for (SkillHolder skill : skillLearn.getPreReqSkills())
{ {
if (player.getSkillLevel(skill.getSkillId()) != skill.getSkillLevel()) if (player.getSkillLevel(skill.getSkillId()) < skill.getSkillLevel())
{ {
if (skill.getSkillId() == CommonSkill.ONYX_BEAST_TRANSFORMATION.getId()) if (skill.getSkillId() == CommonSkill.ONYX_BEAST_TRANSFORMATION.getId())
{ {

View File

@@ -608,7 +608,7 @@ public final class RequestAcquireSkill implements IClientIncomingPacket
{ {
for (SkillHolder skill : skillLearn.getPreReqSkills()) for (SkillHolder skill : skillLearn.getPreReqSkills())
{ {
if (player.getSkillLevel(skill.getSkillId()) != skill.getSkillLevel()) if (player.getSkillLevel(skill.getSkillId()) < skill.getSkillLevel())
{ {
if (skill.getSkillId() == CommonSkill.ONYX_BEAST_TRANSFORMATION.getId()) if (skill.getSkillId() == CommonSkill.ONYX_BEAST_TRANSFORMATION.getId())
{ {

View File

@@ -608,7 +608,7 @@ public final class RequestAcquireSkill implements IClientIncomingPacket
{ {
for (SkillHolder skill : skillLearn.getPreReqSkills()) for (SkillHolder skill : skillLearn.getPreReqSkills())
{ {
if (player.getSkillLevel(skill.getSkillId()) != skill.getSkillLevel()) if (player.getSkillLevel(skill.getSkillId()) < skill.getSkillLevel())
{ {
if (skill.getSkillId() == CommonSkill.ONYX_BEAST_TRANSFORMATION.getId()) if (skill.getSkillId() == CommonSkill.ONYX_BEAST_TRANSFORMATION.getId())
{ {