Fixed skills ignoring social class.
This commit is contained in:
@ -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));
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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<Integer, ResidenceFunction> _functions = new ConcurrentHashMap<>();
|
||||
private final List<SkillHolder> _residentialSkills = new ArrayList<>();
|
||||
private List<L2SkillLearn> _residentialSkills = new ArrayList<>();
|
||||
|
||||
public AbstractResidence(int residenceId)
|
||||
{
|
||||
@ -63,11 +64,7 @@ public abstract class AbstractResidence extends ListenersContainer implements IN
|
||||
|
||||
protected void initResidentialSkills()
|
||||
{
|
||||
final List<L2SkillLearn> 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<SkillHolder> 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user