Configuration for auto learning Forgotten Power skills.
This commit is contained in:
@ -167,6 +167,7 @@ public final class Config
|
||||
public static Map<Integer, Integer> SKILL_REUSE_LIST;
|
||||
public static boolean AUTO_LEARN_SKILLS;
|
||||
public static boolean AUTO_LEARN_FS_SKILLS;
|
||||
public static boolean AUTO_LEARN_FP_SKILLS;
|
||||
public static boolean AUTO_LOOT_HERBS;
|
||||
public static byte BUFFS_MAX_AMOUNT;
|
||||
public static byte TRIGGERED_BUFFS_MAX_AMOUNT;
|
||||
@ -1492,6 +1493,7 @@ public final class Config
|
||||
|
||||
AUTO_LEARN_SKILLS = Character.getBoolean("AutoLearnSkills", false);
|
||||
AUTO_LEARN_FS_SKILLS = Character.getBoolean("AutoLearnForgottenScrollSkills", false);
|
||||
AUTO_LEARN_FP_SKILLS = Character.getBoolean("AutoLearnForgottenPowerSkills", false);
|
||||
AUTO_LOOT_HERBS = Character.getBoolean("AutoLootHerbs", false);
|
||||
BUFFS_MAX_AMOUNT = Character.getByte("MaxBuffAmount", (byte) 20);
|
||||
TRIGGERED_BUFFS_MAX_AMOUNT = Character.getByte("MaxTriggeredBuffAmount", (byte) 12);
|
||||
|
@ -632,12 +632,13 @@ public final class SkillTreesData implements IGameXmlReader
|
||||
* @param player the learning skill player
|
||||
* @param classId the learning skill class Id
|
||||
* @param includeByFs if {@code true} skills from Forgotten Scroll will be included
|
||||
* @param includeByFp if {@code true} skills from Forgotten Power books will be included
|
||||
* @param includeAutoGet if {@code true} Auto-Get skills will be included
|
||||
* @return all available skills for a given {@code player}, {@code classId}, {@code includeByFs} and {@code includeAutoGet}
|
||||
*/
|
||||
public List<L2SkillLearn> getAvailableSkills(L2PcInstance player, ClassId classId, boolean includeByFs, boolean includeAutoGet)
|
||||
public List<L2SkillLearn> getAvailableSkills(L2PcInstance player, ClassId classId, boolean includeByFs, boolean includeByFp, boolean includeAutoGet)
|
||||
{
|
||||
return getAvailableSkills(player, classId, includeByFs, includeAutoGet, player);
|
||||
return getAvailableSkills(player, classId, includeByFs, includeByFp, includeAutoGet, player);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -645,11 +646,12 @@ public final class SkillTreesData implements IGameXmlReader
|
||||
* @param player the learning skill player
|
||||
* @param classId the learning skill class Id
|
||||
* @param includeByFs if {@code true} skills from Forgotten Scroll will be included
|
||||
* @param includeByFp if {@code true} skills from Forgotten Power books will be included
|
||||
* @param includeAutoGet if {@code true} Auto-Get skills will be included
|
||||
* @param holder
|
||||
* @return all available skills for a given {@code player}, {@code classId}, {@code includeByFs} and {@code includeAutoGet}
|
||||
*/
|
||||
private List<L2SkillLearn> getAvailableSkills(L2PcInstance player, ClassId classId, boolean includeByFs, boolean includeAutoGet, ISkillsHolder holder)
|
||||
private List<L2SkillLearn> getAvailableSkills(L2PcInstance player, ClassId classId, boolean includeByFs, boolean includeByFp, boolean includeAutoGet, ISkillsHolder holder)
|
||||
{
|
||||
final List<L2SkillLearn> result = new LinkedList<>();
|
||||
final Map<Long, L2SkillLearn> skills = getCompleteClassSkillTree(classId);
|
||||
@ -667,7 +669,7 @@ public final class SkillTreesData implements IGameXmlReader
|
||||
{
|
||||
final L2SkillLearn skill = entry.getValue();
|
||||
|
||||
if (((skill.getSkillId() == CommonSkill.DIVINE_INSPIRATION.getId()) && (!Config.AUTO_LEARN_DIVINE_INSPIRATION && includeAutoGet) && !player.isGM()) || (!includeAutoGet && skill.isAutoGet()) || (!includeByFs && skill.isLearnedByFS()) || isRemoveSkill(classId, skill.getSkillId()))
|
||||
if (((skill.getSkillId() == CommonSkill.DIVINE_INSPIRATION.getId()) && (!Config.AUTO_LEARN_DIVINE_INSPIRATION && includeAutoGet) && !player.isGM()) || (!includeAutoGet && skill.isAutoGet()) || (!includeByFs && skill.isLearnedByFS()) || (!includeByFp && (skill.getSkillId() > 11399) && (skill.getSkillId() < 11405)) || isRemoveSkill(classId, skill.getSkillId()))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@ -702,14 +704,14 @@ public final class SkillTreesData implements IGameXmlReader
|
||||
return result;
|
||||
}
|
||||
|
||||
public Collection<Skill> getAllAvailableSkills(L2PcInstance player, ClassId classId, boolean includeByFs, boolean includeAutoGet)
|
||||
public Collection<Skill> getAllAvailableSkills(L2PcInstance player, ClassId classId, boolean includeByFs, boolean includeByFp, boolean includeAutoGet)
|
||||
{
|
||||
// Get available skills
|
||||
final PlayerSkillHolder holder = new PlayerSkillHolder(player);
|
||||
final Set<Integer> removed = new HashSet<>();
|
||||
for (int i = 0; i < 1000; i++) // Infinite loop warning
|
||||
{
|
||||
final List<L2SkillLearn> learnable = getAvailableSkills(player, classId, includeByFs, includeAutoGet, holder);
|
||||
final List<L2SkillLearn> learnable = getAvailableSkills(player, classId, includeByFs, includeByFp, includeAutoGet, holder);
|
||||
if (learnable.isEmpty())
|
||||
{
|
||||
// No more skills to learn
|
||||
@ -1407,7 +1409,7 @@ public final class SkillTreesData implements IGameXmlReader
|
||||
return minLevel;
|
||||
}
|
||||
|
||||
public List<L2SkillLearn> getNextAvailableSkills(L2PcInstance player, ClassId classId, boolean includeByFs, boolean includeAutoGet)
|
||||
public List<L2SkillLearn> getNextAvailableSkills(L2PcInstance player, ClassId classId, boolean includeByFs, boolean includeByFp, boolean includeAutoGet)
|
||||
{
|
||||
final Map<Long, L2SkillLearn> completeClassSkillTree = getCompleteClassSkillTree(classId);
|
||||
final List<L2SkillLearn> result = new LinkedList<>();
|
||||
@ -1425,7 +1427,7 @@ public final class SkillTreesData implements IGameXmlReader
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if ((!includeAutoGet && skill.isAutoGet()) || (!includeByFs && skill.isLearnedByFS()))
|
||||
if ((!includeAutoGet && skill.isAutoGet()) || (!includeByFs && skill.isLearnedByFS()) || (!includeByFp && (skill.getSkillId() > 11399) && (skill.getSkillId() < 11405)))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
@ -87,7 +87,7 @@ public class L2NpcInstance extends L2Npc
|
||||
}
|
||||
|
||||
// Normal skills, No LearnedByFS, no AutoGet skills.
|
||||
final List<L2SkillLearn> skills = SkillTreesData.getInstance().getAvailableSkills(player, classId, false, false);
|
||||
final List<L2SkillLearn> skills = SkillTreesData.getInstance().getAvailableSkills(player, classId, false, true, false);
|
||||
if (skills.isEmpty())
|
||||
{
|
||||
final Map<Long, L2SkillLearn> skillTree = SkillTreesData.getInstance().getCompleteClassSkillTree(classId);
|
||||
|
@ -2520,7 +2520,7 @@ public final class L2PcInstance extends L2Playable
|
||||
// Give all normal skills if activated Auto-Learn is activated, included AutoGet skills.
|
||||
if (Config.AUTO_LEARN_SKILLS)
|
||||
{
|
||||
giveAvailableSkills(Config.AUTO_LEARN_FS_SKILLS, true);
|
||||
giveAvailableSkills(Config.AUTO_LEARN_FS_SKILLS, Config.AUTO_LEARN_FP_SKILLS, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -2581,14 +2581,15 @@ public final class L2PcInstance extends L2Playable
|
||||
/**
|
||||
* Give all available skills to the player.
|
||||
* @param includedByFs if {@code true} forgotten scroll skills present in the skill tree will be added
|
||||
* @param includedByFp if {@code true} forgotten power skills present in the skill tree will be added
|
||||
* @param includeAutoGet if {@code true} auto-get skills present in the skill tree will be added
|
||||
* @return the amount of new skills earned
|
||||
*/
|
||||
public int giveAvailableSkills(boolean includedByFs, boolean includeAutoGet)
|
||||
public int giveAvailableSkills(boolean includedByFs, boolean includedByFp, boolean includeAutoGet)
|
||||
{
|
||||
int skillCounter = 0;
|
||||
// Get available skills
|
||||
final Collection<Skill> skills = SkillTreesData.getInstance().getAllAvailableSkills(this, getTemplate().getClassId(), includedByFs, includeAutoGet);
|
||||
final Collection<Skill> skills = SkillTreesData.getInstance().getAllAvailableSkills(this, getTemplate().getClassId(), includedByFs, includedByFp, includeAutoGet);
|
||||
final List<Skill> skillsForStore = new ArrayList<>();
|
||||
|
||||
for (Skill skill : skills)
|
||||
|
@ -291,7 +291,7 @@ public final class CharacterCreate implements IClientIncomingPacket
|
||||
|
||||
if (Config.BALTHUS_KNIGHTS_REWARD_SKILLS)
|
||||
{
|
||||
newChar.giveAvailableSkills(Config.AUTO_LEARN_FS_SKILLS, true);
|
||||
newChar.giveAvailableSkills(Config.AUTO_LEARN_FS_SKILLS, Config.AUTO_LEARN_FP_SKILLS, true);
|
||||
}
|
||||
}
|
||||
|
||||
@ -378,7 +378,7 @@ public final class CharacterCreate implements IClientIncomingPacket
|
||||
}
|
||||
}
|
||||
|
||||
for (L2SkillLearn skill : SkillTreesData.getInstance().getAvailableSkills(newChar, newChar.getClassId(), false, true))
|
||||
for (L2SkillLearn skill : SkillTreesData.getInstance().getAvailableSkills(newChar, newChar.getClassId(), false, false, true))
|
||||
{
|
||||
newChar.addSkill(SkillData.getInstance().getSkill(skill.getSkillId(), skill.getSkillLevel()), true);
|
||||
}
|
||||
|
@ -39,8 +39,8 @@ public class AcquireSkillList implements IClientOutgoingPacket
|
||||
public AcquireSkillList(L2PcInstance activeChar)
|
||||
{
|
||||
_activeChar = activeChar;
|
||||
_learnable = SkillTreesData.getInstance().getAvailableSkills(activeChar, activeChar.getClassId(), false, false);
|
||||
_learnable.addAll(SkillTreesData.getInstance().getNextAvailableSkills(activeChar, activeChar.getClassId(), false, false));
|
||||
_learnable = SkillTreesData.getInstance().getAvailableSkills(activeChar, activeChar.getClassId(), false, true, false);
|
||||
_learnable.addAll(SkillTreesData.getInstance().getNextAvailableSkills(activeChar, activeChar.getClassId(), false, true, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Reference in New Issue
Block a user