From 581cae366f73c1ce492b7fdaeddf8e7ba5cece19 Mon Sep 17 00:00:00 2001 From: MobiusDev <8391001+MobiusDevelopment@users.noreply.github.com> Date: Sun, 1 Jul 2018 00:23:30 +0000 Subject: [PATCH] Fixed skills ignoring social class. --- .../data/xml/impl/SkillTreesData.java | 4 +-- .../l2jmobius/gameserver/model/L2Clan.java | 12 ++++++-- .../gameserver/model/entity/Castle.java | 7 +++-- .../model/residences/AbstractResidence.java | 29 +++++++++---------- .../data/xml/impl/SkillTreesData.java | 4 +-- .../l2jmobius/gameserver/model/L2Clan.java | 12 ++++++-- .../gameserver/model/entity/Castle.java | 7 +++-- .../model/residences/AbstractResidence.java | 29 +++++++++---------- .../data/xml/impl/SkillTreesData.java | 4 +-- .../l2jmobius/gameserver/model/L2Clan.java | 12 ++++++-- .../gameserver/model/entity/Castle.java | 7 +++-- .../model/residences/AbstractResidence.java | 29 +++++++++---------- .../data/xml/impl/SkillTreesData.java | 4 +-- .../l2jmobius/gameserver/model/L2Clan.java | 12 ++++++-- .../gameserver/model/entity/Castle.java | 7 +++-- .../model/residences/AbstractResidence.java | 29 +++++++++---------- .../l2jmobius/gameserver/model/L2Clan.java | 12 ++++++-- .../data/xml/impl/SkillTreesData.java | 4 +-- .../l2jmobius/gameserver/model/L2Clan.java | 14 ++++++--- .../model/residences/AbstractResidence.java | 29 +++++++++---------- .../data/xml/impl/SkillTreesData.java | 4 +-- .../l2jmobius/gameserver/model/L2Clan.java | 14 ++++++--- .../model/residences/AbstractResidence.java | 29 +++++++++---------- .../data/xml/impl/SkillTreesData.java | 4 +-- .../l2jmobius/gameserver/model/L2Clan.java | 14 ++++++--- .../model/residences/AbstractResidence.java | 29 +++++++++---------- 26 files changed, 196 insertions(+), 165 deletions(-) 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 0ae19f1ae8..b463616b5d 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 @@ -1271,7 +1271,7 @@ public final class SkillTreesData implements IGameXmlReader * @param lvl the pledge skill level * @return the pledge skill from the Pledge Skill Tree for a given {@code id} and {@code lvl} */ - private L2SkillLearn getPledgeSkill(int id, int lvl) + public L2SkillLearn getPledgeSkill(int id, int lvl) { return _pledgeSkillTree.get(SkillData.getSkillHashCode(id, lvl)); } @@ -1282,7 +1282,7 @@ public final class SkillTreesData implements IGameXmlReader * @param lvl the sub-pledge skill level * @return the sub-pledge skill from the Sub-Pledge Skill Tree for a given {@code id} and {@code lvl} */ - private L2SkillLearn getSubPledgeSkill(int id, int lvl) + public L2SkillLearn getSubPledgeSkill(int id, int lvl) { return _subPledgeSkillTree.get(SkillData.getSkillHashCode(id, lvl)); } diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/L2Clan.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/L2Clan.java index 1a63f18d20..79f61e5c5c 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/L2Clan.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/L2Clan.java @@ -41,6 +41,7 @@ import com.l2jmobius.gameserver.data.sql.impl.CharNameTable; import com.l2jmobius.gameserver.data.sql.impl.ClanTable; import com.l2jmobius.gameserver.data.sql.impl.CrestTable; import com.l2jmobius.gameserver.data.xml.impl.SkillData; +import com.l2jmobius.gameserver.data.xml.impl.SkillTreesData; import com.l2jmobius.gameserver.enums.ClanRewardType; import com.l2jmobius.gameserver.enums.UserInfoType; import com.l2jmobius.gameserver.instancemanager.CastleManager; @@ -1447,19 +1448,24 @@ public class L2Clan implements IIdentifiable, INamable return; } + final int playerSocialClass = player.getPledgeClass() + 1; for (Skill skill : _skills.values()) { - if (skill.getMinPledgeClass() <= player.getPledgeClass()) + final L2SkillLearn skillLearn = SkillTreesData.getInstance().getPledgeSkill(skill.getId(), skill.getLevel()); + if ((skillLearn == null) || (skillLearn.getSocialClass() == null) || (playerSocialClass >= skillLearn.getSocialClass().ordinal())) { player.addSkill(skill, false); // Skill is not saved to player DB } } - if (player.getPledgeType() == 0) { for (Skill skill : _subPledgeSkills.values()) { - player.addSkill(skill, false); // Skill is not saved to player DB + final L2SkillLearn skillLearn = SkillTreesData.getInstance().getSubPledgeSkill(skill.getId(), skill.getLevel()); + if ((skillLearn == null) || (skillLearn.getSocialClass() == null) || (playerSocialClass >= skillLearn.getSocialClass().ordinal())) + { + player.addSkill(skill, false); // Skill is not saved to player DB + } } } else diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/entity/Castle.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/entity/Castle.java index 9b249a9069..c6da2bb89a 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/entity/Castle.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/entity/Castle.java @@ -55,7 +55,6 @@ import com.l2jmobius.gameserver.model.holders.CastleSpawnHolder; import com.l2jmobius.gameserver.model.itemcontainer.Inventory; import com.l2jmobius.gameserver.model.residences.AbstractResidence; import com.l2jmobius.gameserver.model.skills.CommonSkill; -import com.l2jmobius.gameserver.model.skills.Skill; import com.l2jmobius.gameserver.model.zone.type.L2CastleZone; import com.l2jmobius.gameserver.model.zone.type.L2ResidenceTeleportZone; import com.l2jmobius.gameserver.model.zone.type.L2SiegeZone; @@ -1156,8 +1155,10 @@ public final class Castle extends AbstractResidence public void giveResidentialSkills(L2PcInstance player) { super.giveResidentialSkills(player); - final Skill skill = _castleSide == CastleSide.DARK ? CommonSkill.ABILITY_OF_DARKNESS.getSkill() : CommonSkill.ABILITY_OF_LIGHT.getSkill(); - player.addSkill(skill); + if (player.getPledgeClass() > 8) // Marquis + { + player.addSkill(_castleSide == CastleSide.DARK ? CommonSkill.ABILITY_OF_DARKNESS.getSkill() : CommonSkill.ABILITY_OF_LIGHT.getSkill()); + } } @Override diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/residences/AbstractResidence.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/residences/AbstractResidence.java index 81ec17cf73..11c78a1a47 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/residences/AbstractResidence.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/residences/AbstractResidence.java @@ -28,11 +28,12 @@ import java.util.logging.Level; import java.util.logging.Logger; import com.l2jmobius.commons.database.DatabaseFactory; +import com.l2jmobius.gameserver.data.xml.impl.SkillData; import com.l2jmobius.gameserver.data.xml.impl.SkillTreesData; import com.l2jmobius.gameserver.model.L2SkillLearn; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; +import com.l2jmobius.gameserver.model.base.SocialClass; import com.l2jmobius.gameserver.model.events.ListenersContainer; -import com.l2jmobius.gameserver.model.holders.SkillHolder; import com.l2jmobius.gameserver.model.interfaces.INamable; import com.l2jmobius.gameserver.model.zone.type.L2ResidenceZone; @@ -47,7 +48,7 @@ public abstract class AbstractResidence extends ListenersContainer implements IN private L2ResidenceZone _zone = null; private final Map _functions = new ConcurrentHashMap<>(); - private final List _residentialSkills = new ArrayList<>(); + private List _residentialSkills = new ArrayList<>(); public AbstractResidence(int residenceId) { @@ -63,11 +64,7 @@ public abstract class AbstractResidence extends ListenersContainer implements IN protected void initResidentialSkills() { - final List residentialSkills = SkillTreesData.getInstance().getAvailableResidentialSkills(getResidenceId()); - for (L2SkillLearn s : residentialSkills) - { - _residentialSkills.add(new SkillHolder(s.getSkillId(), s.getSkillLevel())); - } + _residentialSkills = SkillTreesData.getInstance().getAvailableResidentialSkills(getResidenceId()); } public final int getResidenceId() @@ -97,18 +94,18 @@ public abstract class AbstractResidence extends ListenersContainer implements IN _zone = zone; } - public final List getResidentialSkills() - { - return _residentialSkills; - } - public void giveResidentialSkills(L2PcInstance player) { if ((_residentialSkills != null) && !_residentialSkills.isEmpty()) { - for (SkillHolder sh : _residentialSkills) + final int playerSocialClass = player.getPledgeClass() + 1; + for (L2SkillLearn skill : _residentialSkills) { - player.addSkill(sh.getSkill(), false); + final SocialClass skillSocialClass = skill.getSocialClass(); + if ((skillSocialClass == null) || (playerSocialClass >= skillSocialClass.ordinal())) + { + player.addSkill(SkillData.getInstance().getSkill(skill.getSkillId(), skill.getSkillLevel()), false); + } } } } @@ -117,9 +114,9 @@ public abstract class AbstractResidence extends ListenersContainer implements IN { if ((_residentialSkills != null) && !_residentialSkills.isEmpty()) { - for (SkillHolder sh : _residentialSkills) + for (L2SkillLearn skill : _residentialSkills) { - player.removeSkill(sh.getSkill(), false); + player.removeSkill(skill.getSkillId(), false); } } } 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 0ae19f1ae8..b463616b5d 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 @@ -1271,7 +1271,7 @@ public final class SkillTreesData implements IGameXmlReader * @param lvl the pledge skill level * @return the pledge skill from the Pledge Skill Tree for a given {@code id} and {@code lvl} */ - private L2SkillLearn getPledgeSkill(int id, int lvl) + public L2SkillLearn getPledgeSkill(int id, int lvl) { return _pledgeSkillTree.get(SkillData.getSkillHashCode(id, lvl)); } @@ -1282,7 +1282,7 @@ public final class SkillTreesData implements IGameXmlReader * @param lvl the sub-pledge skill level * @return the sub-pledge skill from the Sub-Pledge Skill Tree for a given {@code id} and {@code lvl} */ - private L2SkillLearn getSubPledgeSkill(int id, int lvl) + public L2SkillLearn getSubPledgeSkill(int id, int lvl) { return _subPledgeSkillTree.get(SkillData.getSkillHashCode(id, lvl)); } diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/L2Clan.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/L2Clan.java index 091545ed6f..a19a506072 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/L2Clan.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/L2Clan.java @@ -41,6 +41,7 @@ import com.l2jmobius.gameserver.data.sql.impl.CharNameTable; import com.l2jmobius.gameserver.data.sql.impl.ClanTable; import com.l2jmobius.gameserver.data.sql.impl.CrestTable; import com.l2jmobius.gameserver.data.xml.impl.SkillData; +import com.l2jmobius.gameserver.data.xml.impl.SkillTreesData; import com.l2jmobius.gameserver.enums.ClanRewardType; import com.l2jmobius.gameserver.enums.UserInfoType; import com.l2jmobius.gameserver.instancemanager.CastleManager; @@ -1448,19 +1449,24 @@ public class L2Clan implements IIdentifiable, INamable return; } + final int playerSocialClass = player.getPledgeClass() + 1; for (Skill skill : _skills.values()) { - if (skill.getMinPledgeClass() <= player.getPledgeClass()) + final L2SkillLearn skillLearn = SkillTreesData.getInstance().getPledgeSkill(skill.getId(), skill.getLevel()); + if ((skillLearn == null) || (skillLearn.getSocialClass() == null) || (playerSocialClass >= skillLearn.getSocialClass().ordinal())) { player.addSkill(skill, false); // Skill is not saved to player DB } } - if (player.getPledgeType() == 0) { for (Skill skill : _subPledgeSkills.values()) { - player.addSkill(skill, false); // Skill is not saved to player DB + final L2SkillLearn skillLearn = SkillTreesData.getInstance().getSubPledgeSkill(skill.getId(), skill.getLevel()); + if ((skillLearn == null) || (skillLearn.getSocialClass() == null) || (playerSocialClass >= skillLearn.getSocialClass().ordinal())) + { + player.addSkill(skill, false); // Skill is not saved to player DB + } } } else diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/entity/Castle.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/entity/Castle.java index 9b249a9069..c6da2bb89a 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/entity/Castle.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/entity/Castle.java @@ -55,7 +55,6 @@ import com.l2jmobius.gameserver.model.holders.CastleSpawnHolder; import com.l2jmobius.gameserver.model.itemcontainer.Inventory; import com.l2jmobius.gameserver.model.residences.AbstractResidence; import com.l2jmobius.gameserver.model.skills.CommonSkill; -import com.l2jmobius.gameserver.model.skills.Skill; import com.l2jmobius.gameserver.model.zone.type.L2CastleZone; import com.l2jmobius.gameserver.model.zone.type.L2ResidenceTeleportZone; import com.l2jmobius.gameserver.model.zone.type.L2SiegeZone; @@ -1156,8 +1155,10 @@ public final class Castle extends AbstractResidence public void giveResidentialSkills(L2PcInstance player) { super.giveResidentialSkills(player); - final Skill skill = _castleSide == CastleSide.DARK ? CommonSkill.ABILITY_OF_DARKNESS.getSkill() : CommonSkill.ABILITY_OF_LIGHT.getSkill(); - player.addSkill(skill); + if (player.getPledgeClass() > 8) // Marquis + { + player.addSkill(_castleSide == CastleSide.DARK ? CommonSkill.ABILITY_OF_DARKNESS.getSkill() : CommonSkill.ABILITY_OF_LIGHT.getSkill()); + } } @Override diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/residences/AbstractResidence.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/residences/AbstractResidence.java index 81ec17cf73..11c78a1a47 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/residences/AbstractResidence.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/residences/AbstractResidence.java @@ -28,11 +28,12 @@ import java.util.logging.Level; import java.util.logging.Logger; import com.l2jmobius.commons.database.DatabaseFactory; +import com.l2jmobius.gameserver.data.xml.impl.SkillData; import com.l2jmobius.gameserver.data.xml.impl.SkillTreesData; import com.l2jmobius.gameserver.model.L2SkillLearn; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; +import com.l2jmobius.gameserver.model.base.SocialClass; import com.l2jmobius.gameserver.model.events.ListenersContainer; -import com.l2jmobius.gameserver.model.holders.SkillHolder; import com.l2jmobius.gameserver.model.interfaces.INamable; import com.l2jmobius.gameserver.model.zone.type.L2ResidenceZone; @@ -47,7 +48,7 @@ public abstract class AbstractResidence extends ListenersContainer implements IN private L2ResidenceZone _zone = null; private final Map _functions = new ConcurrentHashMap<>(); - private final List _residentialSkills = new ArrayList<>(); + private List _residentialSkills = new ArrayList<>(); public AbstractResidence(int residenceId) { @@ -63,11 +64,7 @@ public abstract class AbstractResidence extends ListenersContainer implements IN protected void initResidentialSkills() { - final List residentialSkills = SkillTreesData.getInstance().getAvailableResidentialSkills(getResidenceId()); - for (L2SkillLearn s : residentialSkills) - { - _residentialSkills.add(new SkillHolder(s.getSkillId(), s.getSkillLevel())); - } + _residentialSkills = SkillTreesData.getInstance().getAvailableResidentialSkills(getResidenceId()); } public final int getResidenceId() @@ -97,18 +94,18 @@ public abstract class AbstractResidence extends ListenersContainer implements IN _zone = zone; } - public final List getResidentialSkills() - { - return _residentialSkills; - } - public void giveResidentialSkills(L2PcInstance player) { if ((_residentialSkills != null) && !_residentialSkills.isEmpty()) { - for (SkillHolder sh : _residentialSkills) + final int playerSocialClass = player.getPledgeClass() + 1; + for (L2SkillLearn skill : _residentialSkills) { - player.addSkill(sh.getSkill(), false); + final SocialClass skillSocialClass = skill.getSocialClass(); + if ((skillSocialClass == null) || (playerSocialClass >= skillSocialClass.ordinal())) + { + player.addSkill(SkillData.getInstance().getSkill(skill.getSkillId(), skill.getSkillLevel()), false); + } } } } @@ -117,9 +114,9 @@ public abstract class AbstractResidence extends ListenersContainer implements IN { if ((_residentialSkills != null) && !_residentialSkills.isEmpty()) { - for (SkillHolder sh : _residentialSkills) + for (L2SkillLearn skill : _residentialSkills) { - player.removeSkill(sh.getSkill(), false); + player.removeSkill(skill.getSkillId(), false); } } } 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 0ae19f1ae8..b463616b5d 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 @@ -1271,7 +1271,7 @@ public final class SkillTreesData implements IGameXmlReader * @param lvl the pledge skill level * @return the pledge skill from the Pledge Skill Tree for a given {@code id} and {@code lvl} */ - private L2SkillLearn getPledgeSkill(int id, int lvl) + public L2SkillLearn getPledgeSkill(int id, int lvl) { return _pledgeSkillTree.get(SkillData.getSkillHashCode(id, lvl)); } @@ -1282,7 +1282,7 @@ public final class SkillTreesData implements IGameXmlReader * @param lvl the sub-pledge skill level * @return the sub-pledge skill from the Sub-Pledge Skill Tree for a given {@code id} and {@code lvl} */ - private L2SkillLearn getSubPledgeSkill(int id, int lvl) + public L2SkillLearn getSubPledgeSkill(int id, int lvl) { return _subPledgeSkillTree.get(SkillData.getSkillHashCode(id, lvl)); } diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/L2Clan.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/L2Clan.java index 091545ed6f..a19a506072 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/L2Clan.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/L2Clan.java @@ -41,6 +41,7 @@ import com.l2jmobius.gameserver.data.sql.impl.CharNameTable; import com.l2jmobius.gameserver.data.sql.impl.ClanTable; import com.l2jmobius.gameserver.data.sql.impl.CrestTable; import com.l2jmobius.gameserver.data.xml.impl.SkillData; +import com.l2jmobius.gameserver.data.xml.impl.SkillTreesData; import com.l2jmobius.gameserver.enums.ClanRewardType; import com.l2jmobius.gameserver.enums.UserInfoType; import com.l2jmobius.gameserver.instancemanager.CastleManager; @@ -1448,19 +1449,24 @@ public class L2Clan implements IIdentifiable, INamable return; } + final int playerSocialClass = player.getPledgeClass() + 1; for (Skill skill : _skills.values()) { - if (skill.getMinPledgeClass() <= player.getPledgeClass()) + final L2SkillLearn skillLearn = SkillTreesData.getInstance().getPledgeSkill(skill.getId(), skill.getLevel()); + if ((skillLearn == null) || (skillLearn.getSocialClass() == null) || (playerSocialClass >= skillLearn.getSocialClass().ordinal())) { player.addSkill(skill, false); // Skill is not saved to player DB } } - if (player.getPledgeType() == 0) { for (Skill skill : _subPledgeSkills.values()) { - player.addSkill(skill, false); // Skill is not saved to player DB + final L2SkillLearn skillLearn = SkillTreesData.getInstance().getSubPledgeSkill(skill.getId(), skill.getLevel()); + if ((skillLearn == null) || (skillLearn.getSocialClass() == null) || (playerSocialClass >= skillLearn.getSocialClass().ordinal())) + { + player.addSkill(skill, false); // Skill is not saved to player DB + } } } else diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/entity/Castle.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/entity/Castle.java index 9b249a9069..c6da2bb89a 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/entity/Castle.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/entity/Castle.java @@ -55,7 +55,6 @@ import com.l2jmobius.gameserver.model.holders.CastleSpawnHolder; import com.l2jmobius.gameserver.model.itemcontainer.Inventory; import com.l2jmobius.gameserver.model.residences.AbstractResidence; import com.l2jmobius.gameserver.model.skills.CommonSkill; -import com.l2jmobius.gameserver.model.skills.Skill; import com.l2jmobius.gameserver.model.zone.type.L2CastleZone; import com.l2jmobius.gameserver.model.zone.type.L2ResidenceTeleportZone; import com.l2jmobius.gameserver.model.zone.type.L2SiegeZone; @@ -1156,8 +1155,10 @@ public final class Castle extends AbstractResidence public void giveResidentialSkills(L2PcInstance player) { super.giveResidentialSkills(player); - final Skill skill = _castleSide == CastleSide.DARK ? CommonSkill.ABILITY_OF_DARKNESS.getSkill() : CommonSkill.ABILITY_OF_LIGHT.getSkill(); - player.addSkill(skill); + if (player.getPledgeClass() > 8) // Marquis + { + player.addSkill(_castleSide == CastleSide.DARK ? CommonSkill.ABILITY_OF_DARKNESS.getSkill() : CommonSkill.ABILITY_OF_LIGHT.getSkill()); + } } @Override diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/residences/AbstractResidence.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/residences/AbstractResidence.java index 81ec17cf73..11c78a1a47 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/residences/AbstractResidence.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/residences/AbstractResidence.java @@ -28,11 +28,12 @@ import java.util.logging.Level; import java.util.logging.Logger; import com.l2jmobius.commons.database.DatabaseFactory; +import com.l2jmobius.gameserver.data.xml.impl.SkillData; import com.l2jmobius.gameserver.data.xml.impl.SkillTreesData; import com.l2jmobius.gameserver.model.L2SkillLearn; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; +import com.l2jmobius.gameserver.model.base.SocialClass; import com.l2jmobius.gameserver.model.events.ListenersContainer; -import com.l2jmobius.gameserver.model.holders.SkillHolder; import com.l2jmobius.gameserver.model.interfaces.INamable; import com.l2jmobius.gameserver.model.zone.type.L2ResidenceZone; @@ -47,7 +48,7 @@ public abstract class AbstractResidence extends ListenersContainer implements IN private L2ResidenceZone _zone = null; private final Map _functions = new ConcurrentHashMap<>(); - private final List _residentialSkills = new ArrayList<>(); + private List _residentialSkills = new ArrayList<>(); public AbstractResidence(int residenceId) { @@ -63,11 +64,7 @@ public abstract class AbstractResidence extends ListenersContainer implements IN protected void initResidentialSkills() { - final List residentialSkills = SkillTreesData.getInstance().getAvailableResidentialSkills(getResidenceId()); - for (L2SkillLearn s : residentialSkills) - { - _residentialSkills.add(new SkillHolder(s.getSkillId(), s.getSkillLevel())); - } + _residentialSkills = SkillTreesData.getInstance().getAvailableResidentialSkills(getResidenceId()); } public final int getResidenceId() @@ -97,18 +94,18 @@ public abstract class AbstractResidence extends ListenersContainer implements IN _zone = zone; } - public final List getResidentialSkills() - { - return _residentialSkills; - } - public void giveResidentialSkills(L2PcInstance player) { if ((_residentialSkills != null) && !_residentialSkills.isEmpty()) { - for (SkillHolder sh : _residentialSkills) + final int playerSocialClass = player.getPledgeClass() + 1; + for (L2SkillLearn skill : _residentialSkills) { - player.addSkill(sh.getSkill(), false); + final SocialClass skillSocialClass = skill.getSocialClass(); + if ((skillSocialClass == null) || (playerSocialClass >= skillSocialClass.ordinal())) + { + player.addSkill(SkillData.getInstance().getSkill(skill.getSkillId(), skill.getSkillLevel()), false); + } } } } @@ -117,9 +114,9 @@ public abstract class AbstractResidence extends ListenersContainer implements IN { if ((_residentialSkills != null) && !_residentialSkills.isEmpty()) { - for (SkillHolder sh : _residentialSkills) + for (L2SkillLearn skill : _residentialSkills) { - player.removeSkill(sh.getSkill(), false); + player.removeSkill(skill.getSkillId(), false); } } } 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 0ae19f1ae8..b463616b5d 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 @@ -1271,7 +1271,7 @@ public final class SkillTreesData implements IGameXmlReader * @param lvl the pledge skill level * @return the pledge skill from the Pledge Skill Tree for a given {@code id} and {@code lvl} */ - private L2SkillLearn getPledgeSkill(int id, int lvl) + public L2SkillLearn getPledgeSkill(int id, int lvl) { return _pledgeSkillTree.get(SkillData.getSkillHashCode(id, lvl)); } @@ -1282,7 +1282,7 @@ public final class SkillTreesData implements IGameXmlReader * @param lvl the sub-pledge skill level * @return the sub-pledge skill from the Sub-Pledge Skill Tree for a given {@code id} and {@code lvl} */ - private L2SkillLearn getSubPledgeSkill(int id, int lvl) + public L2SkillLearn getSubPledgeSkill(int id, int lvl) { return _subPledgeSkillTree.get(SkillData.getSkillHashCode(id, lvl)); } diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/L2Clan.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/L2Clan.java index 091545ed6f..a19a506072 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/L2Clan.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/L2Clan.java @@ -41,6 +41,7 @@ import com.l2jmobius.gameserver.data.sql.impl.CharNameTable; import com.l2jmobius.gameserver.data.sql.impl.ClanTable; import com.l2jmobius.gameserver.data.sql.impl.CrestTable; import com.l2jmobius.gameserver.data.xml.impl.SkillData; +import com.l2jmobius.gameserver.data.xml.impl.SkillTreesData; import com.l2jmobius.gameserver.enums.ClanRewardType; import com.l2jmobius.gameserver.enums.UserInfoType; import com.l2jmobius.gameserver.instancemanager.CastleManager; @@ -1448,19 +1449,24 @@ public class L2Clan implements IIdentifiable, INamable return; } + final int playerSocialClass = player.getPledgeClass() + 1; for (Skill skill : _skills.values()) { - if (skill.getMinPledgeClass() <= player.getPledgeClass()) + final L2SkillLearn skillLearn = SkillTreesData.getInstance().getPledgeSkill(skill.getId(), skill.getLevel()); + if ((skillLearn == null) || (skillLearn.getSocialClass() == null) || (playerSocialClass >= skillLearn.getSocialClass().ordinal())) { player.addSkill(skill, false); // Skill is not saved to player DB } } - if (player.getPledgeType() == 0) { for (Skill skill : _subPledgeSkills.values()) { - player.addSkill(skill, false); // Skill is not saved to player DB + final L2SkillLearn skillLearn = SkillTreesData.getInstance().getSubPledgeSkill(skill.getId(), skill.getLevel()); + if ((skillLearn == null) || (skillLearn.getSocialClass() == null) || (playerSocialClass >= skillLearn.getSocialClass().ordinal())) + { + player.addSkill(skill, false); // Skill is not saved to player DB + } } } else diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/entity/Castle.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/entity/Castle.java index 9b249a9069..c6da2bb89a 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/entity/Castle.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/entity/Castle.java @@ -55,7 +55,6 @@ import com.l2jmobius.gameserver.model.holders.CastleSpawnHolder; import com.l2jmobius.gameserver.model.itemcontainer.Inventory; import com.l2jmobius.gameserver.model.residences.AbstractResidence; import com.l2jmobius.gameserver.model.skills.CommonSkill; -import com.l2jmobius.gameserver.model.skills.Skill; import com.l2jmobius.gameserver.model.zone.type.L2CastleZone; import com.l2jmobius.gameserver.model.zone.type.L2ResidenceTeleportZone; import com.l2jmobius.gameserver.model.zone.type.L2SiegeZone; @@ -1156,8 +1155,10 @@ public final class Castle extends AbstractResidence public void giveResidentialSkills(L2PcInstance player) { super.giveResidentialSkills(player); - final Skill skill = _castleSide == CastleSide.DARK ? CommonSkill.ABILITY_OF_DARKNESS.getSkill() : CommonSkill.ABILITY_OF_LIGHT.getSkill(); - player.addSkill(skill); + if (player.getPledgeClass() > 8) // Marquis + { + player.addSkill(_castleSide == CastleSide.DARK ? CommonSkill.ABILITY_OF_DARKNESS.getSkill() : CommonSkill.ABILITY_OF_LIGHT.getSkill()); + } } @Override diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/residences/AbstractResidence.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/residences/AbstractResidence.java index 81ec17cf73..11c78a1a47 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/residences/AbstractResidence.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/residences/AbstractResidence.java @@ -28,11 +28,12 @@ import java.util.logging.Level; import java.util.logging.Logger; import com.l2jmobius.commons.database.DatabaseFactory; +import com.l2jmobius.gameserver.data.xml.impl.SkillData; import com.l2jmobius.gameserver.data.xml.impl.SkillTreesData; import com.l2jmobius.gameserver.model.L2SkillLearn; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; +import com.l2jmobius.gameserver.model.base.SocialClass; import com.l2jmobius.gameserver.model.events.ListenersContainer; -import com.l2jmobius.gameserver.model.holders.SkillHolder; import com.l2jmobius.gameserver.model.interfaces.INamable; import com.l2jmobius.gameserver.model.zone.type.L2ResidenceZone; @@ -47,7 +48,7 @@ public abstract class AbstractResidence extends ListenersContainer implements IN private L2ResidenceZone _zone = null; private final Map _functions = new ConcurrentHashMap<>(); - private final List _residentialSkills = new ArrayList<>(); + private List _residentialSkills = new ArrayList<>(); public AbstractResidence(int residenceId) { @@ -63,11 +64,7 @@ public abstract class AbstractResidence extends ListenersContainer implements IN protected void initResidentialSkills() { - final List residentialSkills = SkillTreesData.getInstance().getAvailableResidentialSkills(getResidenceId()); - for (L2SkillLearn s : residentialSkills) - { - _residentialSkills.add(new SkillHolder(s.getSkillId(), s.getSkillLevel())); - } + _residentialSkills = SkillTreesData.getInstance().getAvailableResidentialSkills(getResidenceId()); } public final int getResidenceId() @@ -97,18 +94,18 @@ public abstract class AbstractResidence extends ListenersContainer implements IN _zone = zone; } - public final List getResidentialSkills() - { - return _residentialSkills; - } - public void giveResidentialSkills(L2PcInstance player) { if ((_residentialSkills != null) && !_residentialSkills.isEmpty()) { - for (SkillHolder sh : _residentialSkills) + final int playerSocialClass = player.getPledgeClass() + 1; + for (L2SkillLearn skill : _residentialSkills) { - player.addSkill(sh.getSkill(), false); + final SocialClass skillSocialClass = skill.getSocialClass(); + if ((skillSocialClass == null) || (playerSocialClass >= skillSocialClass.ordinal())) + { + player.addSkill(SkillData.getInstance().getSkill(skill.getSkillId(), skill.getSkillLevel()), false); + } } } } @@ -117,9 +114,9 @@ public abstract class AbstractResidence extends ListenersContainer implements IN { if ((_residentialSkills != null) && !_residentialSkills.isEmpty()) { - for (SkillHolder sh : _residentialSkills) + for (L2SkillLearn skill : _residentialSkills) { - player.removeSkill(sh.getSkill(), false); + player.removeSkill(skill.getSkillId(), false); } } } diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/L2Clan.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/L2Clan.java index cadd146a2e..a0d095574d 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/L2Clan.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/L2Clan.java @@ -41,6 +41,7 @@ import com.l2jmobius.gameserver.data.sql.impl.CharNameTable; import com.l2jmobius.gameserver.data.sql.impl.ClanTable; import com.l2jmobius.gameserver.data.sql.impl.CrestTable; import com.l2jmobius.gameserver.data.xml.impl.SkillData; +import com.l2jmobius.gameserver.data.xml.impl.SkillTreesData; import com.l2jmobius.gameserver.instancemanager.CastleManager; import com.l2jmobius.gameserver.instancemanager.FortManager; import com.l2jmobius.gameserver.instancemanager.SiegeManager; @@ -1414,19 +1415,24 @@ public class L2Clan implements IIdentifiable, INamable return; } + final int playerSocialClass = player.getPledgeClass() + 1; for (Skill skill : _skills.values()) { - if (skill.getMinPledgeClass() <= player.getPledgeClass()) + final L2SkillLearn skillLearn = SkillTreesData.getInstance().getPledgeSkill(skill.getId(), skill.getLevel()); + if ((skillLearn == null) || (skillLearn.getSocialClass() == null) || (playerSocialClass >= skillLearn.getSocialClass().ordinal())) { player.addSkill(skill, false); // Skill is not saved to player DB } } - if (player.getPledgeType() == 0) { for (Skill skill : _subPledgeSkills.values()) { - player.addSkill(skill, false); // Skill is not saved to player DB + final L2SkillLearn skillLearn = SkillTreesData.getInstance().getSubPledgeSkill(skill.getId(), skill.getLevel()); + if ((skillLearn == null) || (skillLearn.getSocialClass() == null) || (playerSocialClass >= skillLearn.getSocialClass().ordinal())) + { + player.addSkill(skill, false); // Skill is not saved to player DB + } } } else 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 0ae19f1ae8..b463616b5d 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 @@ -1271,7 +1271,7 @@ public final class SkillTreesData implements IGameXmlReader * @param lvl the pledge skill level * @return the pledge skill from the Pledge Skill Tree for a given {@code id} and {@code lvl} */ - private L2SkillLearn getPledgeSkill(int id, int lvl) + public L2SkillLearn getPledgeSkill(int id, int lvl) { return _pledgeSkillTree.get(SkillData.getSkillHashCode(id, lvl)); } @@ -1282,7 +1282,7 @@ public final class SkillTreesData implements IGameXmlReader * @param lvl the sub-pledge skill level * @return the sub-pledge skill from the Sub-Pledge Skill Tree for a given {@code id} and {@code lvl} */ - private L2SkillLearn getSubPledgeSkill(int id, int lvl) + public L2SkillLearn getSubPledgeSkill(int id, int lvl) { return _subPledgeSkillTree.get(SkillData.getSkillHashCode(id, lvl)); } diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/L2Clan.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/L2Clan.java index e1430183ba..d432250001 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/L2Clan.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/L2Clan.java @@ -41,6 +41,7 @@ import com.l2jmobius.gameserver.data.sql.impl.CharNameTable; import com.l2jmobius.gameserver.data.sql.impl.ClanTable; import com.l2jmobius.gameserver.data.sql.impl.CrestTable; import com.l2jmobius.gameserver.data.xml.impl.SkillData; +import com.l2jmobius.gameserver.data.xml.impl.SkillTreesData; import com.l2jmobius.gameserver.enums.ClanRewardType; import com.l2jmobius.gameserver.enums.UserInfoType; import com.l2jmobius.gameserver.instancemanager.CastleManager; @@ -1448,19 +1449,24 @@ public class L2Clan implements IIdentifiable, INamable return; } + final int playerSocialClass = player.getPledgeClass() + 1; for (Skill skill : _skills.values()) { - if (skill.getMinPledgeClass() <= player.getPledgeClass()) + final L2SkillLearn skillLearn = SkillTreesData.getInstance().getPledgeSkill(skill.getId(), skill.getLevel()); + if ((skillLearn == null) || (skillLearn.getSocialClass() == null) || (playerSocialClass >= skillLearn.getSocialClass().ordinal())) { player.addSkill(skill, false); // Skill is not saved to player DB } } - if (player.getPledgeType() == 0) { for (Skill skill : _subPledgeSkills.values()) { - player.addSkill(skill, false); // Skill is not saved to player DB + final L2SkillLearn skillLearn = SkillTreesData.getInstance().getSubPledgeSkill(skill.getId(), skill.getLevel()); + if ((skillLearn == null) || (skillLearn.getSocialClass() == null) || (playerSocialClass >= skillLearn.getSocialClass().ordinal())) + { + player.addSkill(skill, false); // Skill is not saved to player DB + } } } else @@ -2491,7 +2497,7 @@ public class L2Clan implements IIdentifiable, INamable boolean increaseClanLevel = false; - // Such as https://l2wiki.com/classic/Clans__Clan_Level + // Such as https://l2wiki.com/classic/Clans_�_Clan_Level switch (_level) { case 0: diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/residences/AbstractResidence.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/residences/AbstractResidence.java index 81ec17cf73..11c78a1a47 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/residences/AbstractResidence.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/residences/AbstractResidence.java @@ -28,11 +28,12 @@ import java.util.logging.Level; import java.util.logging.Logger; import com.l2jmobius.commons.database.DatabaseFactory; +import com.l2jmobius.gameserver.data.xml.impl.SkillData; import com.l2jmobius.gameserver.data.xml.impl.SkillTreesData; import com.l2jmobius.gameserver.model.L2SkillLearn; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; +import com.l2jmobius.gameserver.model.base.SocialClass; import com.l2jmobius.gameserver.model.events.ListenersContainer; -import com.l2jmobius.gameserver.model.holders.SkillHolder; import com.l2jmobius.gameserver.model.interfaces.INamable; import com.l2jmobius.gameserver.model.zone.type.L2ResidenceZone; @@ -47,7 +48,7 @@ public abstract class AbstractResidence extends ListenersContainer implements IN private L2ResidenceZone _zone = null; private final Map _functions = new ConcurrentHashMap<>(); - private final List _residentialSkills = new ArrayList<>(); + private List _residentialSkills = new ArrayList<>(); public AbstractResidence(int residenceId) { @@ -63,11 +64,7 @@ public abstract class AbstractResidence extends ListenersContainer implements IN protected void initResidentialSkills() { - final List residentialSkills = SkillTreesData.getInstance().getAvailableResidentialSkills(getResidenceId()); - for (L2SkillLearn s : residentialSkills) - { - _residentialSkills.add(new SkillHolder(s.getSkillId(), s.getSkillLevel())); - } + _residentialSkills = SkillTreesData.getInstance().getAvailableResidentialSkills(getResidenceId()); } public final int getResidenceId() @@ -97,18 +94,18 @@ public abstract class AbstractResidence extends ListenersContainer implements IN _zone = zone; } - public final List getResidentialSkills() - { - return _residentialSkills; - } - public void giveResidentialSkills(L2PcInstance player) { if ((_residentialSkills != null) && !_residentialSkills.isEmpty()) { - for (SkillHolder sh : _residentialSkills) + final int playerSocialClass = player.getPledgeClass() + 1; + for (L2SkillLearn skill : _residentialSkills) { - player.addSkill(sh.getSkill(), false); + final SocialClass skillSocialClass = skill.getSocialClass(); + if ((skillSocialClass == null) || (playerSocialClass >= skillSocialClass.ordinal())) + { + player.addSkill(SkillData.getInstance().getSkill(skill.getSkillId(), skill.getSkillLevel()), false); + } } } } @@ -117,9 +114,9 @@ public abstract class AbstractResidence extends ListenersContainer implements IN { if ((_residentialSkills != null) && !_residentialSkills.isEmpty()) { - for (SkillHolder sh : _residentialSkills) + for (L2SkillLearn skill : _residentialSkills) { - player.removeSkill(sh.getSkill(), false); + player.removeSkill(skill.getSkillId(), false); } } } diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/data/xml/impl/SkillTreesData.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/data/xml/impl/SkillTreesData.java index 0ae19f1ae8..b463616b5d 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/data/xml/impl/SkillTreesData.java +++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/data/xml/impl/SkillTreesData.java @@ -1271,7 +1271,7 @@ public final class SkillTreesData implements IGameXmlReader * @param lvl the pledge skill level * @return the pledge skill from the Pledge Skill Tree for a given {@code id} and {@code lvl} */ - private L2SkillLearn getPledgeSkill(int id, int lvl) + public L2SkillLearn getPledgeSkill(int id, int lvl) { return _pledgeSkillTree.get(SkillData.getSkillHashCode(id, lvl)); } @@ -1282,7 +1282,7 @@ public final class SkillTreesData implements IGameXmlReader * @param lvl the sub-pledge skill level * @return the sub-pledge skill from the Sub-Pledge Skill Tree for a given {@code id} and {@code lvl} */ - private L2SkillLearn getSubPledgeSkill(int id, int lvl) + public L2SkillLearn getSubPledgeSkill(int id, int lvl) { return _subPledgeSkillTree.get(SkillData.getSkillHashCode(id, lvl)); } diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/L2Clan.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/L2Clan.java index 85cd93e136..02322037c9 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/L2Clan.java +++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/L2Clan.java @@ -41,6 +41,7 @@ import com.l2jmobius.gameserver.data.sql.impl.CharNameTable; import com.l2jmobius.gameserver.data.sql.impl.ClanTable; import com.l2jmobius.gameserver.data.sql.impl.CrestTable; import com.l2jmobius.gameserver.data.xml.impl.SkillData; +import com.l2jmobius.gameserver.data.xml.impl.SkillTreesData; import com.l2jmobius.gameserver.enums.ClanRewardType; import com.l2jmobius.gameserver.enums.UserInfoType; import com.l2jmobius.gameserver.instancemanager.CastleManager; @@ -1448,19 +1449,24 @@ public class L2Clan implements IIdentifiable, INamable return; } + final int playerSocialClass = player.getPledgeClass() + 1; for (Skill skill : _skills.values()) { - if (skill.getMinPledgeClass() <= player.getPledgeClass()) + final L2SkillLearn skillLearn = SkillTreesData.getInstance().getPledgeSkill(skill.getId(), skill.getLevel()); + if ((skillLearn == null) || (skillLearn.getSocialClass() == null) || (playerSocialClass >= skillLearn.getSocialClass().ordinal())) { player.addSkill(skill, false); // Skill is not saved to player DB } } - if (player.getPledgeType() == 0) { for (Skill skill : _subPledgeSkills.values()) { - player.addSkill(skill, false); // Skill is not saved to player DB + final L2SkillLearn skillLearn = SkillTreesData.getInstance().getSubPledgeSkill(skill.getId(), skill.getLevel()); + if ((skillLearn == null) || (skillLearn.getSocialClass() == null) || (playerSocialClass >= skillLearn.getSocialClass().ordinal())) + { + player.addSkill(skill, false); // Skill is not saved to player DB + } } } else @@ -2491,7 +2497,7 @@ public class L2Clan implements IIdentifiable, INamable boolean increaseClanLevel = false; - // Such as https://l2wiki.com/classic/Clans_–_Clan_Level + // Such as https://l2wiki.com/classic/Clans_οΏ½_Clan_Level switch (_level) { case 0: diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/residences/AbstractResidence.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/residences/AbstractResidence.java index 81ec17cf73..11c78a1a47 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/residences/AbstractResidence.java +++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/residences/AbstractResidence.java @@ -28,11 +28,12 @@ import java.util.logging.Level; import java.util.logging.Logger; import com.l2jmobius.commons.database.DatabaseFactory; +import com.l2jmobius.gameserver.data.xml.impl.SkillData; import com.l2jmobius.gameserver.data.xml.impl.SkillTreesData; import com.l2jmobius.gameserver.model.L2SkillLearn; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; +import com.l2jmobius.gameserver.model.base.SocialClass; import com.l2jmobius.gameserver.model.events.ListenersContainer; -import com.l2jmobius.gameserver.model.holders.SkillHolder; import com.l2jmobius.gameserver.model.interfaces.INamable; import com.l2jmobius.gameserver.model.zone.type.L2ResidenceZone; @@ -47,7 +48,7 @@ public abstract class AbstractResidence extends ListenersContainer implements IN private L2ResidenceZone _zone = null; private final Map _functions = new ConcurrentHashMap<>(); - private final List _residentialSkills = new ArrayList<>(); + private List _residentialSkills = new ArrayList<>(); public AbstractResidence(int residenceId) { @@ -63,11 +64,7 @@ public abstract class AbstractResidence extends ListenersContainer implements IN protected void initResidentialSkills() { - final List residentialSkills = SkillTreesData.getInstance().getAvailableResidentialSkills(getResidenceId()); - for (L2SkillLearn s : residentialSkills) - { - _residentialSkills.add(new SkillHolder(s.getSkillId(), s.getSkillLevel())); - } + _residentialSkills = SkillTreesData.getInstance().getAvailableResidentialSkills(getResidenceId()); } public final int getResidenceId() @@ -97,18 +94,18 @@ public abstract class AbstractResidence extends ListenersContainer implements IN _zone = zone; } - public final List getResidentialSkills() - { - return _residentialSkills; - } - public void giveResidentialSkills(L2PcInstance player) { if ((_residentialSkills != null) && !_residentialSkills.isEmpty()) { - for (SkillHolder sh : _residentialSkills) + final int playerSocialClass = player.getPledgeClass() + 1; + for (L2SkillLearn skill : _residentialSkills) { - player.addSkill(sh.getSkill(), false); + final SocialClass skillSocialClass = skill.getSocialClass(); + if ((skillSocialClass == null) || (playerSocialClass >= skillSocialClass.ordinal())) + { + player.addSkill(SkillData.getInstance().getSkill(skill.getSkillId(), skill.getSkillLevel()), false); + } } } } @@ -117,9 +114,9 @@ public abstract class AbstractResidence extends ListenersContainer implements IN { if ((_residentialSkills != null) && !_residentialSkills.isEmpty()) { - for (SkillHolder sh : _residentialSkills) + for (L2SkillLearn skill : _residentialSkills) { - player.removeSkill(sh.getSkill(), false); + player.removeSkill(skill.getSkillId(), false); } } } diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/data/xml/impl/SkillTreesData.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/data/xml/impl/SkillTreesData.java index 0ae19f1ae8..b463616b5d 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/data/xml/impl/SkillTreesData.java +++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/data/xml/impl/SkillTreesData.java @@ -1271,7 +1271,7 @@ public final class SkillTreesData implements IGameXmlReader * @param lvl the pledge skill level * @return the pledge skill from the Pledge Skill Tree for a given {@code id} and {@code lvl} */ - private L2SkillLearn getPledgeSkill(int id, int lvl) + public L2SkillLearn getPledgeSkill(int id, int lvl) { return _pledgeSkillTree.get(SkillData.getSkillHashCode(id, lvl)); } @@ -1282,7 +1282,7 @@ public final class SkillTreesData implements IGameXmlReader * @param lvl the sub-pledge skill level * @return the sub-pledge skill from the Sub-Pledge Skill Tree for a given {@code id} and {@code lvl} */ - private L2SkillLearn getSubPledgeSkill(int id, int lvl) + public L2SkillLearn getSubPledgeSkill(int id, int lvl) { return _subPledgeSkillTree.get(SkillData.getSkillHashCode(id, lvl)); } diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/L2Clan.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/L2Clan.java index 85cd93e136..02322037c9 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/L2Clan.java +++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/L2Clan.java @@ -41,6 +41,7 @@ import com.l2jmobius.gameserver.data.sql.impl.CharNameTable; import com.l2jmobius.gameserver.data.sql.impl.ClanTable; import com.l2jmobius.gameserver.data.sql.impl.CrestTable; import com.l2jmobius.gameserver.data.xml.impl.SkillData; +import com.l2jmobius.gameserver.data.xml.impl.SkillTreesData; import com.l2jmobius.gameserver.enums.ClanRewardType; import com.l2jmobius.gameserver.enums.UserInfoType; import com.l2jmobius.gameserver.instancemanager.CastleManager; @@ -1448,19 +1449,24 @@ public class L2Clan implements IIdentifiable, INamable return; } + final int playerSocialClass = player.getPledgeClass() + 1; for (Skill skill : _skills.values()) { - if (skill.getMinPledgeClass() <= player.getPledgeClass()) + final L2SkillLearn skillLearn = SkillTreesData.getInstance().getPledgeSkill(skill.getId(), skill.getLevel()); + if ((skillLearn == null) || (skillLearn.getSocialClass() == null) || (playerSocialClass >= skillLearn.getSocialClass().ordinal())) { player.addSkill(skill, false); // Skill is not saved to player DB } } - if (player.getPledgeType() == 0) { for (Skill skill : _subPledgeSkills.values()) { - player.addSkill(skill, false); // Skill is not saved to player DB + final L2SkillLearn skillLearn = SkillTreesData.getInstance().getSubPledgeSkill(skill.getId(), skill.getLevel()); + if ((skillLearn == null) || (skillLearn.getSocialClass() == null) || (playerSocialClass >= skillLearn.getSocialClass().ordinal())) + { + player.addSkill(skill, false); // Skill is not saved to player DB + } } } else @@ -2491,7 +2497,7 @@ public class L2Clan implements IIdentifiable, INamable boolean increaseClanLevel = false; - // Such as https://l2wiki.com/classic/Clans_–_Clan_Level + // Such as https://l2wiki.com/classic/Clans_οΏ½_Clan_Level switch (_level) { case 0: diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/residences/AbstractResidence.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/residences/AbstractResidence.java index 81ec17cf73..11c78a1a47 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/residences/AbstractResidence.java +++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/residences/AbstractResidence.java @@ -28,11 +28,12 @@ import java.util.logging.Level; import java.util.logging.Logger; import com.l2jmobius.commons.database.DatabaseFactory; +import com.l2jmobius.gameserver.data.xml.impl.SkillData; import com.l2jmobius.gameserver.data.xml.impl.SkillTreesData; import com.l2jmobius.gameserver.model.L2SkillLearn; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; +import com.l2jmobius.gameserver.model.base.SocialClass; import com.l2jmobius.gameserver.model.events.ListenersContainer; -import com.l2jmobius.gameserver.model.holders.SkillHolder; import com.l2jmobius.gameserver.model.interfaces.INamable; import com.l2jmobius.gameserver.model.zone.type.L2ResidenceZone; @@ -47,7 +48,7 @@ public abstract class AbstractResidence extends ListenersContainer implements IN private L2ResidenceZone _zone = null; private final Map _functions = new ConcurrentHashMap<>(); - private final List _residentialSkills = new ArrayList<>(); + private List _residentialSkills = new ArrayList<>(); public AbstractResidence(int residenceId) { @@ -63,11 +64,7 @@ public abstract class AbstractResidence extends ListenersContainer implements IN protected void initResidentialSkills() { - final List residentialSkills = SkillTreesData.getInstance().getAvailableResidentialSkills(getResidenceId()); - for (L2SkillLearn s : residentialSkills) - { - _residentialSkills.add(new SkillHolder(s.getSkillId(), s.getSkillLevel())); - } + _residentialSkills = SkillTreesData.getInstance().getAvailableResidentialSkills(getResidenceId()); } public final int getResidenceId() @@ -97,18 +94,18 @@ public abstract class AbstractResidence extends ListenersContainer implements IN _zone = zone; } - public final List getResidentialSkills() - { - return _residentialSkills; - } - public void giveResidentialSkills(L2PcInstance player) { if ((_residentialSkills != null) && !_residentialSkills.isEmpty()) { - for (SkillHolder sh : _residentialSkills) + final int playerSocialClass = player.getPledgeClass() + 1; + for (L2SkillLearn skill : _residentialSkills) { - player.addSkill(sh.getSkill(), false); + final SocialClass skillSocialClass = skill.getSocialClass(); + if ((skillSocialClass == null) || (playerSocialClass >= skillSocialClass.ordinal())) + { + player.addSkill(SkillData.getInstance().getSkill(skill.getSkillId(), skill.getSkillLevel()), false); + } } } } @@ -117,9 +114,9 @@ public abstract class AbstractResidence extends ListenersContainer implements IN { if ((_residentialSkills != null) && !_residentialSkills.isEmpty()) { - for (SkillHolder sh : _residentialSkills) + for (L2SkillLearn skill : _residentialSkills) { - player.removeSkill(sh.getSkill(), false); + player.removeSkill(skill.getSkillId(), false); } } }