Configuration for auto learning Forgotten Power skills.

This commit is contained in:
MobiusDevelopment 2019-03-18 10:45:04 +00:00
parent 9ea7c14c41
commit 31077f99a5
10 changed files with 34 additions and 24 deletions

View File

@ -81,6 +81,10 @@ AutoLearnSkills = False
# Default: False
AutoLearnForgottenScrollSkills = False
# If it's true skills from forgotten power books will be delivered upon level up and login, require AutoLearnSkills.
# Default: False
AutoLearnForgottenPowerSkills = False
# Maximum number of buffs and songs/dances.
# Remember that Divine Inspiration will give players 4 additional buff slots on top of the number specified in "maxbuffamount".
# Default: 20, 12, 12

View File

@ -32,7 +32,7 @@
<td><button value="Give taken skills" action="bypass -h admin_reset_skills" width=130 height=21 back="L2UI_CT1.Button_DF_Down" fore="L2UI_CT1.Button_DF"></td>
</tr>
<tr>
<td><button value="Give All Skills FS" action="bypass -h admin_give_all_skills_fs" width=130 height=21 back="L2UI_CT1.Button_DF_Down" fore="L2UI_CT1.Button_DF"></td>
<td><button value="Give All Skills FS/FP" action="bypass -h admin_give_all_skills_fs" width=130 height=21 back="L2UI_CT1.Button_DF_Down" fore="L2UI_CT1.Button_DF"></td>
<td><button value="Remove All Skills" action="bypass -h admin_remove_all_skills" width=130 height=21 back="L2UI_CT1.Button_DF_Down" fore="L2UI_CT1.Button_DF"></td>
</tr>
</table>

View File

@ -432,7 +432,7 @@ public final class ClassMaster extends AbstractNpcAI implements IGameXmlReader
}
if (Config.AUTO_LEARN_SKILLS)
{
player.giveAvailableSkills(Config.AUTO_LEARN_FS_SKILLS, true);
player.giveAvailableSkills(Config.AUTO_LEARN_FS_SKILLS, Config.AUTO_LEARN_FP_SKILLS, true);
}
player.store(false); // Save player cause if server crashes before this char is saved, he will lose class and the money payed for class change.
player.broadcastUserInfo();
@ -456,7 +456,7 @@ public final class ClassMaster extends AbstractNpcAI implements IGameXmlReader
}
else
{
player.giveAvailableSkills(true, true);
player.giveAvailableSkills(true, true, true);
}
break;
}
@ -863,7 +863,7 @@ public final class ClassMaster extends AbstractNpcAI implements IGameXmlReader
}
if (Config.AUTO_LEARN_SKILLS)
{
player.giveAvailableSkills(Config.AUTO_LEARN_FS_SKILLS, true);
player.giveAvailableSkills(Config.AUTO_LEARN_FS_SKILLS, Config.AUTO_LEARN_FP_SKILLS, true);
}
player.store(false); // Save player cause if server crashes before this char is saved, he will lose class and the money payed for class change.
player.broadcastUserInfo();

View File

@ -153,11 +153,11 @@ public class AdminSkill implements IAdminCommandHandler
}
else if (command.equals("admin_give_all_skills"))
{
adminGiveAllSkills(activeChar, false);
adminGiveAllSkills(activeChar, false, false);
}
else if (command.equals("admin_give_all_skills_fs"))
{
adminGiveAllSkills(activeChar, true);
adminGiveAllSkills(activeChar, true, true);
}
else if (command.equals("admin_give_clan_skills"))
{
@ -275,8 +275,9 @@ public class AdminSkill implements IAdminCommandHandler
* This function will give all the skills that the target can learn at his/her level
* @param activeChar the active char
* @param includedByFs if {@code true} Forgotten Scroll skills will be delivered.
* @param includedByFp if {@code true} Forgotten Power skills will be delivered.
*/
private void adminGiveAllSkills(L2PcInstance activeChar, boolean includedByFs)
private void adminGiveAllSkills(L2PcInstance activeChar, boolean includedByFs, boolean includedByFp)
{
final L2Object target = activeChar.getTarget();
if ((target == null) || !target.isPlayer())
@ -286,7 +287,7 @@ public class AdminSkill implements IAdminCommandHandler
}
final L2PcInstance player = target.getActingPlayer();
// Notify player and admin
BuilderUtil.sendSysMessage(activeChar, "You gave " + player.giveAvailableSkills(includedByFs, true) + " skills to " + player.getName());
BuilderUtil.sendSysMessage(activeChar, "You gave " + player.giveAvailableSkills(includedByFs, includedByFp, true) + " skills to " + player.getName());
player.sendSkillList();
player.sendPacket(new AcquireSkillList(player));
}

View File

@ -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);

View File

@ -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;
}

View File

@ -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);

View File

@ -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)

View File

@ -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);
}

View File

@ -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