Fixed skill learn after class change.

Thanks Sdw for the pointers.
This commit is contained in:
MobiusDev
2016-12-22 14:43:54 +00:00
parent 67fe2b56b6
commit 42d3a8cf68
18 changed files with 41 additions and 176 deletions

View File

@@ -21,10 +21,8 @@ import java.util.HashSet;
import java.util.List;
import java.util.Set;
import com.l2jmobius.Config;
import com.l2jmobius.gameserver.data.xml.impl.SkillData;
import com.l2jmobius.gameserver.enums.Race;
import com.l2jmobius.gameserver.model.base.ClassId;
import com.l2jmobius.gameserver.model.base.SocialClass;
import com.l2jmobius.gameserver.model.holders.ItemHolder;
import com.l2jmobius.gameserver.model.holders.SkillHolder;
@@ -276,38 +274,6 @@ public final class L2SkillLearn
return _pointsRequired;
}
/**
* Used for AltGameSkillLearn mod.<br>
* If the alternative skill learn system is enabled and the player is learning a skill from a different class apply a fee.<br>
* If the player is learning a skill from other class type (mage learning warrior skills or vice versa) the fee is higher.
* @param playerClass the player class Id.
* @param learningClass the skill learning player class Id.
* @return the amount of SP required to acquire this skill, by calculating the cost for the alternative skill learn system.
*/
public int getCalculatedLevelUpSp(ClassId playerClass, ClassId learningClass)
{
if ((playerClass == null) || (learningClass == null))
{
return _levelUpSp;
}
int levelUpSp = _levelUpSp;
// If the alternative skill learn system is enabled and the player is learning a skill from a different class apply a fee.
if (Config.ALT_GAME_SKILL_LEARN && (playerClass != learningClass))
{
// If the player is learning a skill from other class type (mage learning warrior skills or vice versa) the fee is higher.
if (playerClass.isMage() != learningClass.isMage())
{
levelUpSp *= 3;
}
else
{
levelUpSp *= 2;
}
}
return levelUpSp;
}
@Override
public String toString()
{

View File

@@ -134,8 +134,6 @@ public class L2NpcInstance extends L2Npc
// Normal skills, No LearnedByFS, no AutoGet skills.
final List<L2SkillLearn> skills = SkillTreesData.getInstance().getAvailableSkills(player, classId, false, false);
player.setLearningClass(classId);
if (skills.isEmpty())
{
final Map<Long, L2SkillLearn> skillTree = SkillTreesData.getInstance().getCompleteClassSkillTree(classId);

View File

@@ -2384,27 +2384,6 @@ public final class L2PcInstance extends L2Playable
}
}
/**
* Used for AltGameSkillLearn to set a custom skill learning class Id.
*/
private ClassId _learningClass = getClassId();
/**
* @return the custom skill learning class Id.
*/
public ClassId getLearningClass()
{
return _learningClass;
}
/**
* @param learningClass the custom skill learning class Id to set.
*/
public void setLearningClass(ClassId learningClass)
{
_learningClass = learningClass;
}
/**
* @return the Experience of the L2PcInstance.
*/
@@ -9636,8 +9615,6 @@ public final class L2PcInstance extends L2Playable
}
_classIndex = classIndex;
setLearningClass(getClassId());
if (isInParty())
{
getParty().recalculatePartyLevel();