Addition of AutoLearnSkillsWithoutItems configuration.
This commit is contained in:
@@ -77,6 +77,10 @@ SkillReuseList =
|
|||||||
# Default: False
|
# Default: False
|
||||||
AutoLearnSkills = False
|
AutoLearnSkills = False
|
||||||
|
|
||||||
|
# Auto learn skills that need items to be learned.
|
||||||
|
# Default: False
|
||||||
|
AutoLearnSkillsWithoutItems = False
|
||||||
|
|
||||||
# If it's true skills from forgotten scrolls will be delivered upon level up and login, require AutoLearnSkills.
|
# If it's true skills from forgotten scrolls will be delivered upon level up and login, require AutoLearnSkills.
|
||||||
# Default: False
|
# Default: False
|
||||||
AutoLearnForgottenScrollSkills = False
|
AutoLearnForgottenScrollSkills = False
|
||||||
|
|||||||
+3
-3
@@ -429,7 +429,7 @@ public class ClassMaster extends AbstractNpcAI implements IXmlReader
|
|||||||
}
|
}
|
||||||
if (Config.AUTO_LEARN_SKILLS)
|
if (Config.AUTO_LEARN_SKILLS)
|
||||||
{
|
{
|
||||||
player.giveAvailableSkills(Config.AUTO_LEARN_FS_SKILLS, true);
|
player.giveAvailableSkills(Config.AUTO_LEARN_FS_SKILLS, true, Config.AUTO_LEARN_SKILLS_WITHOUT_ITEMS);
|
||||||
}
|
}
|
||||||
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.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();
|
player.broadcastUserInfo();
|
||||||
@@ -453,7 +453,7 @@ public class ClassMaster extends AbstractNpcAI implements IXmlReader
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
player.giveAvailableSkills(true, true);
|
player.giveAvailableSkills(true, true, true);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -868,7 +868,7 @@ public class ClassMaster extends AbstractNpcAI implements IXmlReader
|
|||||||
}
|
}
|
||||||
if (Config.AUTO_LEARN_SKILLS)
|
if (Config.AUTO_LEARN_SKILLS)
|
||||||
{
|
{
|
||||||
player.giveAvailableSkills(Config.AUTO_LEARN_FS_SKILLS, true);
|
player.giveAvailableSkills(Config.AUTO_LEARN_FS_SKILLS, true, Config.AUTO_LEARN_SKILLS_WITHOUT_ITEMS);
|
||||||
}
|
}
|
||||||
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.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();
|
player.broadcastUserInfo();
|
||||||
|
|||||||
Vendored
+6
-5
@@ -156,11 +156,11 @@ public class AdminSkill implements IAdminCommandHandler
|
|||||||
}
|
}
|
||||||
else if (command.equals("admin_give_all_skills"))
|
else if (command.equals("admin_give_all_skills"))
|
||||||
{
|
{
|
||||||
adminGiveAllSkills(activeChar, false);
|
adminGiveAllSkills(activeChar, false, false);
|
||||||
}
|
}
|
||||||
else if (command.equals("admin_give_all_skills_fs"))
|
else if (command.equals("admin_give_all_skills_fs"))
|
||||||
{
|
{
|
||||||
adminGiveAllSkills(activeChar, true);
|
adminGiveAllSkills(activeChar, true, true);
|
||||||
}
|
}
|
||||||
else if (command.equals("admin_give_clan_skills"))
|
else if (command.equals("admin_give_clan_skills"))
|
||||||
{
|
{
|
||||||
@@ -277,9 +277,10 @@ public class AdminSkill implements IAdminCommandHandler
|
|||||||
/**
|
/**
|
||||||
* This function will give all the skills that the target can learn at his/her level
|
* This function will give all the skills that the target can learn at his/her level
|
||||||
* @param activeChar the player
|
* @param activeChar the player
|
||||||
* @param includedByFs if {@code true} Forgotten Scroll skills will be delivered.
|
* @param includeByFs if {@code true} Forgotten Scroll skills will be delivered.
|
||||||
|
* @param includeRequiredItems if {@code true} skills that have required items will be added
|
||||||
*/
|
*/
|
||||||
private void adminGiveAllSkills(PlayerInstance activeChar, boolean includedByFs)
|
private void adminGiveAllSkills(PlayerInstance activeChar, boolean includeByFs, boolean includeRequiredItems)
|
||||||
{
|
{
|
||||||
final WorldObject target = activeChar.getTarget();
|
final WorldObject target = activeChar.getTarget();
|
||||||
if ((target == null) || !target.isPlayer())
|
if ((target == null) || !target.isPlayer())
|
||||||
@@ -289,7 +290,7 @@ public class AdminSkill implements IAdminCommandHandler
|
|||||||
}
|
}
|
||||||
final PlayerInstance player = target.getActingPlayer();
|
final PlayerInstance player = target.getActingPlayer();
|
||||||
// Notify player and admin
|
// Notify player and admin
|
||||||
BuilderUtil.sendSysMessage(activeChar, "You gave " + player.giveAvailableSkills(includedByFs, true) + " skills to " + player.getName());
|
BuilderUtil.sendSysMessage(activeChar, "You gave " + player.giveAvailableSkills(includeByFs, true, includeRequiredItems) + " skills to " + player.getName());
|
||||||
player.sendSkillList();
|
player.sendSkillList();
|
||||||
player.sendPacket(new AcquireSkillList(player));
|
player.sendPacket(new AcquireSkillList(player));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -165,6 +165,7 @@ public class Config
|
|||||||
public static boolean ENABLE_MODIFY_SKILL_REUSE;
|
public static boolean ENABLE_MODIFY_SKILL_REUSE;
|
||||||
public static Map<Integer, Integer> SKILL_REUSE_LIST;
|
public static Map<Integer, Integer> SKILL_REUSE_LIST;
|
||||||
public static boolean AUTO_LEARN_SKILLS;
|
public static boolean AUTO_LEARN_SKILLS;
|
||||||
|
public static boolean AUTO_LEARN_SKILLS_WITHOUT_ITEMS;
|
||||||
public static boolean AUTO_LEARN_FS_SKILLS;
|
public static boolean AUTO_LEARN_FS_SKILLS;
|
||||||
public static boolean AUTO_LOOT_HERBS;
|
public static boolean AUTO_LOOT_HERBS;
|
||||||
public static byte BUFFS_MAX_AMOUNT;
|
public static byte BUFFS_MAX_AMOUNT;
|
||||||
@@ -1707,6 +1708,7 @@ public class Config
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
AUTO_LEARN_SKILLS = Character.getBoolean("AutoLearnSkills", false);
|
AUTO_LEARN_SKILLS = Character.getBoolean("AutoLearnSkills", false);
|
||||||
|
AUTO_LEARN_SKILLS_WITHOUT_ITEMS = Character.getBoolean("AutoLearnSkillsWithoutItems", false);
|
||||||
AUTO_LEARN_FS_SKILLS = Character.getBoolean("AutoLearnForgottenScrollSkills", false);
|
AUTO_LEARN_FS_SKILLS = Character.getBoolean("AutoLearnForgottenScrollSkills", false);
|
||||||
AUTO_LOOT_HERBS = Character.getBoolean("AutoLootHerbs", false);
|
AUTO_LOOT_HERBS = Character.getBoolean("AutoLootHerbs", false);
|
||||||
BUFFS_MAX_AMOUNT = Character.getByte("MaxBuffAmount", (byte) 20);
|
BUFFS_MAX_AMOUNT = Character.getByte("MaxBuffAmount", (byte) 20);
|
||||||
|
|||||||
@@ -729,7 +729,16 @@ public class SkillTreeData implements IXmlReader
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Collection<Skill> getAllAvailableSkills(PlayerInstance player, ClassId classId, boolean includeByFs, boolean includeAutoGet)
|
/**
|
||||||
|
* Used by auto learn configuration.
|
||||||
|
* @param player
|
||||||
|
* @param classId
|
||||||
|
* @param includeByFs if {@code true} forgotten scroll 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
|
||||||
|
* @param includeRequiredItems if {@code true} skills that have required items will be added
|
||||||
|
* @return a list of auto learnable skills for the player.
|
||||||
|
*/
|
||||||
|
public Collection<Skill> getAllAvailableSkills(PlayerInstance player, ClassId classId, boolean includeByFs, boolean includeAutoGet, boolean includeRequiredItems)
|
||||||
{
|
{
|
||||||
// Get available skills
|
// Get available skills
|
||||||
final PlayerSkillHolder holder = new PlayerSkillHolder(player);
|
final PlayerSkillHolder holder = new PlayerSkillHolder(player);
|
||||||
@@ -749,8 +758,13 @@ public class SkillTreeData implements IXmlReader
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (SkillLearn skillLearn : learnable)
|
SEARCH: for (SkillLearn skillLearn : learnable)
|
||||||
{
|
{
|
||||||
|
if (!includeRequiredItems && !skillLearn.getRequiredItems().isEmpty())
|
||||||
|
{
|
||||||
|
continue SEARCH;
|
||||||
|
}
|
||||||
|
|
||||||
final Skill skill = SkillData.getInstance().getSkill(skillLearn.getSkillId(), skillLearn.getSkillLevel());
|
final Skill skill = SkillData.getInstance().getSkill(skillLearn.getSkillId(), skillLearn.getSkillLevel());
|
||||||
// Cleanup skills that has to be removed
|
// Cleanup skills that has to be removed
|
||||||
for (int skillId : skillLearn.getRemoveSkills())
|
for (int skillId : skillLearn.getRemoveSkills())
|
||||||
|
|||||||
+5
-4
@@ -2583,7 +2583,7 @@ public class PlayerInstance extends Playable
|
|||||||
// Give all normal skills if activated Auto-Learn is activated, included AutoGet skills.
|
// Give all normal skills if activated Auto-Learn is activated, included AutoGet skills.
|
||||||
if (Config.AUTO_LEARN_SKILLS)
|
if (Config.AUTO_LEARN_SKILLS)
|
||||||
{
|
{
|
||||||
giveAvailableSkills(Config.AUTO_LEARN_FS_SKILLS, true);
|
giveAvailableSkills(Config.AUTO_LEARN_FS_SKILLS, true, Config.AUTO_LEARN_SKILLS_WITHOUT_ITEMS);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -2643,15 +2643,16 @@ public class PlayerInstance extends Playable
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Give all available skills to the player.
|
* Give all available skills to the player.
|
||||||
* @param includedByFs if {@code true} forgotten scroll skills present in the skill tree will be added
|
* @param includeByFs if {@code true} forgotten scroll 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
|
* @param includeAutoGet if {@code true} auto-get skills present in the skill tree will be added
|
||||||
|
* @param includeRequiredItems if {@code true} skills that have required items will be added
|
||||||
* @return the amount of new skills earned
|
* @return the amount of new skills earned
|
||||||
*/
|
*/
|
||||||
public int giveAvailableSkills(boolean includedByFs, boolean includeAutoGet)
|
public int giveAvailableSkills(boolean includeByFs, boolean includeAutoGet, boolean includeRequiredItems)
|
||||||
{
|
{
|
||||||
int skillCounter = 0;
|
int skillCounter = 0;
|
||||||
// Get available skills
|
// Get available skills
|
||||||
final Collection<Skill> skills = SkillTreeData.getInstance().getAllAvailableSkills(this, getTemplate().getClassId(), includedByFs, includeAutoGet);
|
final Collection<Skill> skills = SkillTreeData.getInstance().getAllAvailableSkills(this, getTemplate().getClassId(), includeByFs, includeAutoGet, includeRequiredItems);
|
||||||
final List<Skill> skillsForStore = new ArrayList<>();
|
final List<Skill> skillsForStore = new ArrayList<>();
|
||||||
for (Skill skill : skills)
|
for (Skill skill : skills)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -77,6 +77,10 @@ SkillReuseList =
|
|||||||
# Default: False
|
# Default: False
|
||||||
AutoLearnSkills = False
|
AutoLearnSkills = False
|
||||||
|
|
||||||
|
# Auto learn skills that need items to be learned.
|
||||||
|
# Default: False
|
||||||
|
AutoLearnSkillsWithoutItems = False
|
||||||
|
|
||||||
# If it's true skills from forgotten scrolls will be delivered upon level up and login, require AutoLearnSkills.
|
# If it's true skills from forgotten scrolls will be delivered upon level up and login, require AutoLearnSkills.
|
||||||
# Default: False
|
# Default: False
|
||||||
AutoLearnForgottenScrollSkills = False
|
AutoLearnForgottenScrollSkills = False
|
||||||
|
|||||||
+3
-3
@@ -429,7 +429,7 @@ public class ClassMaster extends AbstractNpcAI implements IXmlReader
|
|||||||
}
|
}
|
||||||
if (Config.AUTO_LEARN_SKILLS)
|
if (Config.AUTO_LEARN_SKILLS)
|
||||||
{
|
{
|
||||||
player.giveAvailableSkills(Config.AUTO_LEARN_FS_SKILLS, true);
|
player.giveAvailableSkills(Config.AUTO_LEARN_FS_SKILLS, true, Config.AUTO_LEARN_SKILLS_WITHOUT_ITEMS);
|
||||||
}
|
}
|
||||||
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.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();
|
player.broadcastUserInfo();
|
||||||
@@ -453,7 +453,7 @@ public class ClassMaster extends AbstractNpcAI implements IXmlReader
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
player.giveAvailableSkills(true, true);
|
player.giveAvailableSkills(true, true, true);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -868,7 +868,7 @@ public class ClassMaster extends AbstractNpcAI implements IXmlReader
|
|||||||
}
|
}
|
||||||
if (Config.AUTO_LEARN_SKILLS)
|
if (Config.AUTO_LEARN_SKILLS)
|
||||||
{
|
{
|
||||||
player.giveAvailableSkills(Config.AUTO_LEARN_FS_SKILLS, true);
|
player.giveAvailableSkills(Config.AUTO_LEARN_FS_SKILLS, true, Config.AUTO_LEARN_SKILLS_WITHOUT_ITEMS);
|
||||||
}
|
}
|
||||||
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.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();
|
player.broadcastUserInfo();
|
||||||
|
|||||||
Vendored
+6
-5
@@ -156,11 +156,11 @@ public class AdminSkill implements IAdminCommandHandler
|
|||||||
}
|
}
|
||||||
else if (command.equals("admin_give_all_skills"))
|
else if (command.equals("admin_give_all_skills"))
|
||||||
{
|
{
|
||||||
adminGiveAllSkills(activeChar, false);
|
adminGiveAllSkills(activeChar, false, false);
|
||||||
}
|
}
|
||||||
else if (command.equals("admin_give_all_skills_fs"))
|
else if (command.equals("admin_give_all_skills_fs"))
|
||||||
{
|
{
|
||||||
adminGiveAllSkills(activeChar, true);
|
adminGiveAllSkills(activeChar, true, true);
|
||||||
}
|
}
|
||||||
else if (command.equals("admin_give_clan_skills"))
|
else if (command.equals("admin_give_clan_skills"))
|
||||||
{
|
{
|
||||||
@@ -277,9 +277,10 @@ public class AdminSkill implements IAdminCommandHandler
|
|||||||
/**
|
/**
|
||||||
* This function will give all the skills that the target can learn at his/her level
|
* This function will give all the skills that the target can learn at his/her level
|
||||||
* @param activeChar the player
|
* @param activeChar the player
|
||||||
* @param includedByFs if {@code true} Forgotten Scroll skills will be delivered.
|
* @param includeByFs if {@code true} Forgotten Scroll skills will be delivered.
|
||||||
|
* @param includeRequiredItems if {@code true} skills that have required items will be added
|
||||||
*/
|
*/
|
||||||
private void adminGiveAllSkills(PlayerInstance activeChar, boolean includedByFs)
|
private void adminGiveAllSkills(PlayerInstance activeChar, boolean includeByFs, boolean includeRequiredItems)
|
||||||
{
|
{
|
||||||
final WorldObject target = activeChar.getTarget();
|
final WorldObject target = activeChar.getTarget();
|
||||||
if ((target == null) || !target.isPlayer())
|
if ((target == null) || !target.isPlayer())
|
||||||
@@ -289,7 +290,7 @@ public class AdminSkill implements IAdminCommandHandler
|
|||||||
}
|
}
|
||||||
final PlayerInstance player = target.getActingPlayer();
|
final PlayerInstance player = target.getActingPlayer();
|
||||||
// Notify player and admin
|
// Notify player and admin
|
||||||
BuilderUtil.sendSysMessage(activeChar, "You gave " + player.giveAvailableSkills(includedByFs, true) + " skills to " + player.getName());
|
BuilderUtil.sendSysMessage(activeChar, "You gave " + player.giveAvailableSkills(includeByFs, true, includeRequiredItems) + " skills to " + player.getName());
|
||||||
player.sendSkillList();
|
player.sendSkillList();
|
||||||
player.sendPacket(new AcquireSkillList(player));
|
player.sendPacket(new AcquireSkillList(player));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -172,6 +172,7 @@ public class Config
|
|||||||
public static boolean ENABLE_MODIFY_SKILL_REUSE;
|
public static boolean ENABLE_MODIFY_SKILL_REUSE;
|
||||||
public static Map<Integer, Integer> SKILL_REUSE_LIST;
|
public static Map<Integer, Integer> SKILL_REUSE_LIST;
|
||||||
public static boolean AUTO_LEARN_SKILLS;
|
public static boolean AUTO_LEARN_SKILLS;
|
||||||
|
public static boolean AUTO_LEARN_SKILLS_WITHOUT_ITEMS;
|
||||||
public static boolean AUTO_LEARN_FS_SKILLS;
|
public static boolean AUTO_LEARN_FS_SKILLS;
|
||||||
public static boolean AUTO_LOOT_HERBS;
|
public static boolean AUTO_LOOT_HERBS;
|
||||||
public static byte BUFFS_MAX_AMOUNT;
|
public static byte BUFFS_MAX_AMOUNT;
|
||||||
@@ -1727,6 +1728,7 @@ public class Config
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
AUTO_LEARN_SKILLS = Character.getBoolean("AutoLearnSkills", false);
|
AUTO_LEARN_SKILLS = Character.getBoolean("AutoLearnSkills", false);
|
||||||
|
AUTO_LEARN_SKILLS_WITHOUT_ITEMS = Character.getBoolean("AutoLearnSkillsWithoutItems", false);
|
||||||
AUTO_LEARN_FS_SKILLS = Character.getBoolean("AutoLearnForgottenScrollSkills", false);
|
AUTO_LEARN_FS_SKILLS = Character.getBoolean("AutoLearnForgottenScrollSkills", false);
|
||||||
AUTO_LOOT_HERBS = Character.getBoolean("AutoLootHerbs", false);
|
AUTO_LOOT_HERBS = Character.getBoolean("AutoLootHerbs", false);
|
||||||
BUFFS_MAX_AMOUNT = Character.getByte("MaxBuffAmount", (byte) 20);
|
BUFFS_MAX_AMOUNT = Character.getByte("MaxBuffAmount", (byte) 20);
|
||||||
|
|||||||
+16
-2
@@ -729,7 +729,16 @@ public class SkillTreeData implements IXmlReader
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Collection<Skill> getAllAvailableSkills(PlayerInstance player, ClassId classId, boolean includeByFs, boolean includeAutoGet)
|
/**
|
||||||
|
* Used by auto learn configuration.
|
||||||
|
* @param player
|
||||||
|
* @param classId
|
||||||
|
* @param includeByFs if {@code true} forgotten scroll 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
|
||||||
|
* @param includeRequiredItems if {@code true} skills that have required items will be added
|
||||||
|
* @return a list of auto learnable skills for the player.
|
||||||
|
*/
|
||||||
|
public Collection<Skill> getAllAvailableSkills(PlayerInstance player, ClassId classId, boolean includeByFs, boolean includeAutoGet, boolean includeRequiredItems)
|
||||||
{
|
{
|
||||||
// Get available skills
|
// Get available skills
|
||||||
final PlayerSkillHolder holder = new PlayerSkillHolder(player);
|
final PlayerSkillHolder holder = new PlayerSkillHolder(player);
|
||||||
@@ -749,8 +758,13 @@ public class SkillTreeData implements IXmlReader
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (SkillLearn skillLearn : learnable)
|
SEARCH: for (SkillLearn skillLearn : learnable)
|
||||||
{
|
{
|
||||||
|
if (!includeRequiredItems && !skillLearn.getRequiredItems().isEmpty())
|
||||||
|
{
|
||||||
|
continue SEARCH;
|
||||||
|
}
|
||||||
|
|
||||||
final Skill skill = SkillData.getInstance().getSkill(skillLearn.getSkillId(), skillLearn.getSkillLevel());
|
final Skill skill = SkillData.getInstance().getSkill(skillLearn.getSkillId(), skillLearn.getSkillLevel());
|
||||||
// Cleanup skills that has to be removed
|
// Cleanup skills that has to be removed
|
||||||
for (int skillId : skillLearn.getRemoveSkills())
|
for (int skillId : skillLearn.getRemoveSkills())
|
||||||
|
|||||||
+5
-4
@@ -2585,7 +2585,7 @@ public class PlayerInstance extends Playable
|
|||||||
// Give all normal skills if activated Auto-Learn is activated, included AutoGet skills.
|
// Give all normal skills if activated Auto-Learn is activated, included AutoGet skills.
|
||||||
if (Config.AUTO_LEARN_SKILLS)
|
if (Config.AUTO_LEARN_SKILLS)
|
||||||
{
|
{
|
||||||
giveAvailableSkills(Config.AUTO_LEARN_FS_SKILLS, true);
|
giveAvailableSkills(Config.AUTO_LEARN_FS_SKILLS, true, Config.AUTO_LEARN_SKILLS_WITHOUT_ITEMS);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -2645,15 +2645,16 @@ public class PlayerInstance extends Playable
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Give all available skills to the player.
|
* Give all available skills to the player.
|
||||||
* @param includedByFs if {@code true} forgotten scroll skills present in the skill tree will be added
|
* @param includeByFs if {@code true} forgotten scroll 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
|
* @param includeAutoGet if {@code true} auto-get skills present in the skill tree will be added
|
||||||
|
* @param includeRequiredItems if {@code true} skills that have required items will be added
|
||||||
* @return the amount of new skills earned
|
* @return the amount of new skills earned
|
||||||
*/
|
*/
|
||||||
public int giveAvailableSkills(boolean includedByFs, boolean includeAutoGet)
|
public int giveAvailableSkills(boolean includeByFs, boolean includeAutoGet, boolean includeRequiredItems)
|
||||||
{
|
{
|
||||||
int skillCounter = 0;
|
int skillCounter = 0;
|
||||||
// Get available skills
|
// Get available skills
|
||||||
final Collection<Skill> skills = SkillTreeData.getInstance().getAllAvailableSkills(this, getTemplate().getClassId(), includedByFs, includeAutoGet);
|
final Collection<Skill> skills = SkillTreeData.getInstance().getAllAvailableSkills(this, getTemplate().getClassId(), includeByFs, includeAutoGet, includeRequiredItems);
|
||||||
final List<Skill> skillsForStore = new ArrayList<>();
|
final List<Skill> skillsForStore = new ArrayList<>();
|
||||||
for (Skill skill : skills)
|
for (Skill skill : skills)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -77,6 +77,10 @@ SkillReuseList =
|
|||||||
# Default: False
|
# Default: False
|
||||||
AutoLearnSkills = False
|
AutoLearnSkills = False
|
||||||
|
|
||||||
|
# Auto learn skills that need items to be learned.
|
||||||
|
# Default: False
|
||||||
|
AutoLearnSkillsWithoutItems = False
|
||||||
|
|
||||||
# If it's true skills from forgotten scrolls will be delivered upon level up and login, require AutoLearnSkills.
|
# If it's true skills from forgotten scrolls will be delivered upon level up and login, require AutoLearnSkills.
|
||||||
# Default: False
|
# Default: False
|
||||||
AutoLearnForgottenScrollSkills = False
|
AutoLearnForgottenScrollSkills = False
|
||||||
|
|||||||
+3
-3
@@ -429,7 +429,7 @@ public class ClassMaster extends AbstractNpcAI implements IXmlReader
|
|||||||
}
|
}
|
||||||
if (Config.AUTO_LEARN_SKILLS)
|
if (Config.AUTO_LEARN_SKILLS)
|
||||||
{
|
{
|
||||||
player.giveAvailableSkills(Config.AUTO_LEARN_FS_SKILLS, true);
|
player.giveAvailableSkills(Config.AUTO_LEARN_FS_SKILLS, true, Config.AUTO_LEARN_SKILLS_WITHOUT_ITEMS);
|
||||||
}
|
}
|
||||||
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.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();
|
player.broadcastUserInfo();
|
||||||
@@ -453,7 +453,7 @@ public class ClassMaster extends AbstractNpcAI implements IXmlReader
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
player.giveAvailableSkills(true, true);
|
player.giveAvailableSkills(true, true, true);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -868,7 +868,7 @@ public class ClassMaster extends AbstractNpcAI implements IXmlReader
|
|||||||
}
|
}
|
||||||
if (Config.AUTO_LEARN_SKILLS)
|
if (Config.AUTO_LEARN_SKILLS)
|
||||||
{
|
{
|
||||||
player.giveAvailableSkills(Config.AUTO_LEARN_FS_SKILLS, true);
|
player.giveAvailableSkills(Config.AUTO_LEARN_FS_SKILLS, true, Config.AUTO_LEARN_SKILLS_WITHOUT_ITEMS);
|
||||||
}
|
}
|
||||||
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.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();
|
player.broadcastUserInfo();
|
||||||
|
|||||||
Vendored
+6
-5
@@ -156,11 +156,11 @@ public class AdminSkill implements IAdminCommandHandler
|
|||||||
}
|
}
|
||||||
else if (command.equals("admin_give_all_skills"))
|
else if (command.equals("admin_give_all_skills"))
|
||||||
{
|
{
|
||||||
adminGiveAllSkills(activeChar, false);
|
adminGiveAllSkills(activeChar, false, false);
|
||||||
}
|
}
|
||||||
else if (command.equals("admin_give_all_skills_fs"))
|
else if (command.equals("admin_give_all_skills_fs"))
|
||||||
{
|
{
|
||||||
adminGiveAllSkills(activeChar, true);
|
adminGiveAllSkills(activeChar, true, true);
|
||||||
}
|
}
|
||||||
else if (command.equals("admin_give_clan_skills"))
|
else if (command.equals("admin_give_clan_skills"))
|
||||||
{
|
{
|
||||||
@@ -277,9 +277,10 @@ public class AdminSkill implements IAdminCommandHandler
|
|||||||
/**
|
/**
|
||||||
* This function will give all the skills that the target can learn at his/her level
|
* This function will give all the skills that the target can learn at his/her level
|
||||||
* @param activeChar the player
|
* @param activeChar the player
|
||||||
* @param includedByFs if {@code true} Forgotten Scroll skills will be delivered.
|
* @param includeByFs if {@code true} Forgotten Scroll skills will be delivered.
|
||||||
|
* @param includeRequiredItems if {@code true} skills that have required items will be added
|
||||||
*/
|
*/
|
||||||
private void adminGiveAllSkills(PlayerInstance activeChar, boolean includedByFs)
|
private void adminGiveAllSkills(PlayerInstance activeChar, boolean includeByFs, boolean includeRequiredItems)
|
||||||
{
|
{
|
||||||
final WorldObject target = activeChar.getTarget();
|
final WorldObject target = activeChar.getTarget();
|
||||||
if ((target == null) || !target.isPlayer())
|
if ((target == null) || !target.isPlayer())
|
||||||
@@ -289,7 +290,7 @@ public class AdminSkill implements IAdminCommandHandler
|
|||||||
}
|
}
|
||||||
final PlayerInstance player = target.getActingPlayer();
|
final PlayerInstance player = target.getActingPlayer();
|
||||||
// Notify player and admin
|
// Notify player and admin
|
||||||
BuilderUtil.sendSysMessage(activeChar, "You gave " + player.giveAvailableSkills(includedByFs, true) + " skills to " + player.getName());
|
BuilderUtil.sendSysMessage(activeChar, "You gave " + player.giveAvailableSkills(includeByFs, true, includeRequiredItems) + " skills to " + player.getName());
|
||||||
player.sendSkillList();
|
player.sendSkillList();
|
||||||
player.sendPacket(new AcquireSkillList(player));
|
player.sendPacket(new AcquireSkillList(player));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -172,6 +172,7 @@ public class Config
|
|||||||
public static boolean ENABLE_MODIFY_SKILL_REUSE;
|
public static boolean ENABLE_MODIFY_SKILL_REUSE;
|
||||||
public static Map<Integer, Integer> SKILL_REUSE_LIST;
|
public static Map<Integer, Integer> SKILL_REUSE_LIST;
|
||||||
public static boolean AUTO_LEARN_SKILLS;
|
public static boolean AUTO_LEARN_SKILLS;
|
||||||
|
public static boolean AUTO_LEARN_SKILLS_WITHOUT_ITEMS;
|
||||||
public static boolean AUTO_LEARN_FS_SKILLS;
|
public static boolean AUTO_LEARN_FS_SKILLS;
|
||||||
public static boolean AUTO_LOOT_HERBS;
|
public static boolean AUTO_LOOT_HERBS;
|
||||||
public static byte BUFFS_MAX_AMOUNT;
|
public static byte BUFFS_MAX_AMOUNT;
|
||||||
@@ -1740,6 +1741,7 @@ public class Config
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
AUTO_LEARN_SKILLS = Character.getBoolean("AutoLearnSkills", false);
|
AUTO_LEARN_SKILLS = Character.getBoolean("AutoLearnSkills", false);
|
||||||
|
AUTO_LEARN_SKILLS_WITHOUT_ITEMS = Character.getBoolean("AutoLearnSkillsWithoutItems", false);
|
||||||
AUTO_LEARN_FS_SKILLS = Character.getBoolean("AutoLearnForgottenScrollSkills", false);
|
AUTO_LEARN_FS_SKILLS = Character.getBoolean("AutoLearnForgottenScrollSkills", false);
|
||||||
AUTO_LOOT_HERBS = Character.getBoolean("AutoLootHerbs", false);
|
AUTO_LOOT_HERBS = Character.getBoolean("AutoLootHerbs", false);
|
||||||
BUFFS_MAX_AMOUNT = Character.getByte("MaxBuffAmount", (byte) 20);
|
BUFFS_MAX_AMOUNT = Character.getByte("MaxBuffAmount", (byte) 20);
|
||||||
|
|||||||
@@ -729,7 +729,16 @@ public class SkillTreeData implements IXmlReader
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Collection<Skill> getAllAvailableSkills(PlayerInstance player, ClassId classId, boolean includeByFs, boolean includeAutoGet)
|
/**
|
||||||
|
* Used by auto learn configuration.
|
||||||
|
* @param player
|
||||||
|
* @param classId
|
||||||
|
* @param includeByFs if {@code true} forgotten scroll 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
|
||||||
|
* @param includeRequiredItems if {@code true} skills that have required items will be added
|
||||||
|
* @return a list of auto learnable skills for the player.
|
||||||
|
*/
|
||||||
|
public Collection<Skill> getAllAvailableSkills(PlayerInstance player, ClassId classId, boolean includeByFs, boolean includeAutoGet, boolean includeRequiredItems)
|
||||||
{
|
{
|
||||||
// Get available skills
|
// Get available skills
|
||||||
final PlayerSkillHolder holder = new PlayerSkillHolder(player);
|
final PlayerSkillHolder holder = new PlayerSkillHolder(player);
|
||||||
@@ -749,8 +758,13 @@ public class SkillTreeData implements IXmlReader
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (SkillLearn skillLearn : learnable)
|
SEARCH: for (SkillLearn skillLearn : learnable)
|
||||||
{
|
{
|
||||||
|
if (!includeRequiredItems && !skillLearn.getRequiredItems().isEmpty())
|
||||||
|
{
|
||||||
|
continue SEARCH;
|
||||||
|
}
|
||||||
|
|
||||||
final Skill skill = SkillData.getInstance().getSkill(skillLearn.getSkillId(), skillLearn.getSkillLevel());
|
final Skill skill = SkillData.getInstance().getSkill(skillLearn.getSkillId(), skillLearn.getSkillLevel());
|
||||||
// Cleanup skills that has to be removed
|
// Cleanup skills that has to be removed
|
||||||
for (int skillId : skillLearn.getRemoveSkills())
|
for (int skillId : skillLearn.getRemoveSkills())
|
||||||
|
|||||||
+5
-4
@@ -2587,7 +2587,7 @@ public class PlayerInstance extends Playable
|
|||||||
// Give all normal skills if activated Auto-Learn is activated, included AutoGet skills.
|
// Give all normal skills if activated Auto-Learn is activated, included AutoGet skills.
|
||||||
if (Config.AUTO_LEARN_SKILLS)
|
if (Config.AUTO_LEARN_SKILLS)
|
||||||
{
|
{
|
||||||
giveAvailableSkills(Config.AUTO_LEARN_FS_SKILLS, true);
|
giveAvailableSkills(Config.AUTO_LEARN_FS_SKILLS, true, Config.AUTO_LEARN_SKILLS_WITHOUT_ITEMS);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -2647,15 +2647,16 @@ public class PlayerInstance extends Playable
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Give all available skills to the player.
|
* Give all available skills to the player.
|
||||||
* @param includedByFs if {@code true} forgotten scroll skills present in the skill tree will be added
|
* @param includeByFs if {@code true} forgotten scroll 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
|
* @param includeAutoGet if {@code true} auto-get skills present in the skill tree will be added
|
||||||
|
* @param includeRequiredItems if {@code true} skills that have required items will be added
|
||||||
* @return the amount of new skills earned
|
* @return the amount of new skills earned
|
||||||
*/
|
*/
|
||||||
public int giveAvailableSkills(boolean includedByFs, boolean includeAutoGet)
|
public int giveAvailableSkills(boolean includeByFs, boolean includeAutoGet, boolean includeRequiredItems)
|
||||||
{
|
{
|
||||||
int skillCounter = 0;
|
int skillCounter = 0;
|
||||||
// Get available skills
|
// Get available skills
|
||||||
final Collection<Skill> skills = SkillTreeData.getInstance().getAllAvailableSkills(this, getTemplate().getClassId(), includedByFs, includeAutoGet);
|
final Collection<Skill> skills = SkillTreeData.getInstance().getAllAvailableSkills(this, getTemplate().getClassId(), includeByFs, includeAutoGet, includeRequiredItems);
|
||||||
final List<Skill> skillsForStore = new ArrayList<>();
|
final List<Skill> skillsForStore = new ArrayList<>();
|
||||||
for (Skill skill : skills)
|
for (Skill skill : skills)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -77,6 +77,10 @@ SkillReuseList =
|
|||||||
# Default: False
|
# Default: False
|
||||||
AutoLearnSkills = False
|
AutoLearnSkills = False
|
||||||
|
|
||||||
|
# Auto learn skills that need items to be learned.
|
||||||
|
# Default: False
|
||||||
|
AutoLearnSkillsWithoutItems = False
|
||||||
|
|
||||||
# If it's true skills from forgotten scrolls will be delivered upon level up and login, require AutoLearnSkills.
|
# If it's true skills from forgotten scrolls will be delivered upon level up and login, require AutoLearnSkills.
|
||||||
# Default: False
|
# Default: False
|
||||||
AutoLearnForgottenScrollSkills = False
|
AutoLearnForgottenScrollSkills = False
|
||||||
|
|||||||
+3
-3
@@ -429,7 +429,7 @@ public class ClassMaster extends AbstractNpcAI implements IXmlReader
|
|||||||
}
|
}
|
||||||
if (Config.AUTO_LEARN_SKILLS)
|
if (Config.AUTO_LEARN_SKILLS)
|
||||||
{
|
{
|
||||||
player.giveAvailableSkills(Config.AUTO_LEARN_FS_SKILLS, true);
|
player.giveAvailableSkills(Config.AUTO_LEARN_FS_SKILLS, true, Config.AUTO_LEARN_SKILLS_WITHOUT_ITEMS);
|
||||||
}
|
}
|
||||||
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.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();
|
player.broadcastUserInfo();
|
||||||
@@ -453,7 +453,7 @@ public class ClassMaster extends AbstractNpcAI implements IXmlReader
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
player.giveAvailableSkills(true, true);
|
player.giveAvailableSkills(true, true, true);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -868,7 +868,7 @@ public class ClassMaster extends AbstractNpcAI implements IXmlReader
|
|||||||
}
|
}
|
||||||
if (Config.AUTO_LEARN_SKILLS)
|
if (Config.AUTO_LEARN_SKILLS)
|
||||||
{
|
{
|
||||||
player.giveAvailableSkills(Config.AUTO_LEARN_FS_SKILLS, true);
|
player.giveAvailableSkills(Config.AUTO_LEARN_FS_SKILLS, true, Config.AUTO_LEARN_SKILLS_WITHOUT_ITEMS);
|
||||||
}
|
}
|
||||||
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.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();
|
player.broadcastUserInfo();
|
||||||
|
|||||||
Vendored
+6
-5
@@ -156,11 +156,11 @@ public class AdminSkill implements IAdminCommandHandler
|
|||||||
}
|
}
|
||||||
else if (command.equals("admin_give_all_skills"))
|
else if (command.equals("admin_give_all_skills"))
|
||||||
{
|
{
|
||||||
adminGiveAllSkills(activeChar, false);
|
adminGiveAllSkills(activeChar, false, false);
|
||||||
}
|
}
|
||||||
else if (command.equals("admin_give_all_skills_fs"))
|
else if (command.equals("admin_give_all_skills_fs"))
|
||||||
{
|
{
|
||||||
adminGiveAllSkills(activeChar, true);
|
adminGiveAllSkills(activeChar, true, true);
|
||||||
}
|
}
|
||||||
else if (command.equals("admin_give_clan_skills"))
|
else if (command.equals("admin_give_clan_skills"))
|
||||||
{
|
{
|
||||||
@@ -277,9 +277,10 @@ public class AdminSkill implements IAdminCommandHandler
|
|||||||
/**
|
/**
|
||||||
* This function will give all the skills that the target can learn at his/her level
|
* This function will give all the skills that the target can learn at his/her level
|
||||||
* @param activeChar the player
|
* @param activeChar the player
|
||||||
* @param includedByFs if {@code true} Forgotten Scroll skills will be delivered.
|
* @param includeByFs if {@code true} Forgotten Scroll skills will be delivered.
|
||||||
|
* @param includeRequiredItems if {@code true} skills that have required items will be added
|
||||||
*/
|
*/
|
||||||
private void adminGiveAllSkills(PlayerInstance activeChar, boolean includedByFs)
|
private void adminGiveAllSkills(PlayerInstance activeChar, boolean includeByFs, boolean includeRequiredItems)
|
||||||
{
|
{
|
||||||
final WorldObject target = activeChar.getTarget();
|
final WorldObject target = activeChar.getTarget();
|
||||||
if ((target == null) || !target.isPlayer())
|
if ((target == null) || !target.isPlayer())
|
||||||
@@ -289,7 +290,7 @@ public class AdminSkill implements IAdminCommandHandler
|
|||||||
}
|
}
|
||||||
final PlayerInstance player = target.getActingPlayer();
|
final PlayerInstance player = target.getActingPlayer();
|
||||||
// Notify player and admin
|
// Notify player and admin
|
||||||
BuilderUtil.sendSysMessage(activeChar, "You gave " + player.giveAvailableSkills(includedByFs, true) + " skills to " + player.getName());
|
BuilderUtil.sendSysMessage(activeChar, "You gave " + player.giveAvailableSkills(includeByFs, true, includeRequiredItems) + " skills to " + player.getName());
|
||||||
player.sendSkillList();
|
player.sendSkillList();
|
||||||
player.sendPacket(new AcquireSkillList(player));
|
player.sendPacket(new AcquireSkillList(player));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -172,6 +172,7 @@ public class Config
|
|||||||
public static boolean ENABLE_MODIFY_SKILL_REUSE;
|
public static boolean ENABLE_MODIFY_SKILL_REUSE;
|
||||||
public static Map<Integer, Integer> SKILL_REUSE_LIST;
|
public static Map<Integer, Integer> SKILL_REUSE_LIST;
|
||||||
public static boolean AUTO_LEARN_SKILLS;
|
public static boolean AUTO_LEARN_SKILLS;
|
||||||
|
public static boolean AUTO_LEARN_SKILLS_WITHOUT_ITEMS;
|
||||||
public static boolean AUTO_LEARN_FS_SKILLS;
|
public static boolean AUTO_LEARN_FS_SKILLS;
|
||||||
public static boolean AUTO_LOOT_HERBS;
|
public static boolean AUTO_LOOT_HERBS;
|
||||||
public static byte BUFFS_MAX_AMOUNT;
|
public static byte BUFFS_MAX_AMOUNT;
|
||||||
@@ -1727,6 +1728,7 @@ public class Config
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
AUTO_LEARN_SKILLS = Character.getBoolean("AutoLearnSkills", false);
|
AUTO_LEARN_SKILLS = Character.getBoolean("AutoLearnSkills", false);
|
||||||
|
AUTO_LEARN_SKILLS_WITHOUT_ITEMS = Character.getBoolean("AutoLearnSkillsWithoutItems", false);
|
||||||
AUTO_LEARN_FS_SKILLS = Character.getBoolean("AutoLearnForgottenScrollSkills", false);
|
AUTO_LEARN_FS_SKILLS = Character.getBoolean("AutoLearnForgottenScrollSkills", false);
|
||||||
AUTO_LOOT_HERBS = Character.getBoolean("AutoLootHerbs", false);
|
AUTO_LOOT_HERBS = Character.getBoolean("AutoLootHerbs", false);
|
||||||
BUFFS_MAX_AMOUNT = Character.getByte("MaxBuffAmount", (byte) 20);
|
BUFFS_MAX_AMOUNT = Character.getByte("MaxBuffAmount", (byte) 20);
|
||||||
|
|||||||
+16
-2
@@ -729,7 +729,16 @@ public class SkillTreeData implements IXmlReader
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Collection<Skill> getAllAvailableSkills(PlayerInstance player, ClassId classId, boolean includeByFs, boolean includeAutoGet)
|
/**
|
||||||
|
* Used by auto learn configuration.
|
||||||
|
* @param player
|
||||||
|
* @param classId
|
||||||
|
* @param includeByFs if {@code true} forgotten scroll 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
|
||||||
|
* @param includeRequiredItems if {@code true} skills that have required items will be added
|
||||||
|
* @return a list of auto learnable skills for the player.
|
||||||
|
*/
|
||||||
|
public Collection<Skill> getAllAvailableSkills(PlayerInstance player, ClassId classId, boolean includeByFs, boolean includeAutoGet, boolean includeRequiredItems)
|
||||||
{
|
{
|
||||||
// Get available skills
|
// Get available skills
|
||||||
final PlayerSkillHolder holder = new PlayerSkillHolder(player);
|
final PlayerSkillHolder holder = new PlayerSkillHolder(player);
|
||||||
@@ -749,8 +758,13 @@ public class SkillTreeData implements IXmlReader
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (SkillLearn skillLearn : learnable)
|
SEARCH: for (SkillLearn skillLearn : learnable)
|
||||||
{
|
{
|
||||||
|
if (!includeRequiredItems && !skillLearn.getRequiredItems().isEmpty())
|
||||||
|
{
|
||||||
|
continue SEARCH;
|
||||||
|
}
|
||||||
|
|
||||||
final Skill skill = SkillData.getInstance().getSkill(skillLearn.getSkillId(), skillLearn.getSkillLevel());
|
final Skill skill = SkillData.getInstance().getSkill(skillLearn.getSkillId(), skillLearn.getSkillLevel());
|
||||||
// Cleanup skills that has to be removed
|
// Cleanup skills that has to be removed
|
||||||
for (int skillId : skillLearn.getRemoveSkills())
|
for (int skillId : skillLearn.getRemoveSkills())
|
||||||
|
|||||||
+5
-4
@@ -2595,7 +2595,7 @@ public class PlayerInstance extends Playable
|
|||||||
// Give all normal skills if activated Auto-Learn is activated, included AutoGet skills.
|
// Give all normal skills if activated Auto-Learn is activated, included AutoGet skills.
|
||||||
if (Config.AUTO_LEARN_SKILLS)
|
if (Config.AUTO_LEARN_SKILLS)
|
||||||
{
|
{
|
||||||
giveAvailableSkills(Config.AUTO_LEARN_FS_SKILLS, true);
|
giveAvailableSkills(Config.AUTO_LEARN_FS_SKILLS, true, Config.AUTO_LEARN_SKILLS_WITHOUT_ITEMS);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -2655,15 +2655,16 @@ public class PlayerInstance extends Playable
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Give all available skills to the player.
|
* Give all available skills to the player.
|
||||||
* @param includedByFs if {@code true} forgotten scroll skills present in the skill tree will be added
|
* @param includeByFs if {@code true} forgotten scroll 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
|
* @param includeAutoGet if {@code true} auto-get skills present in the skill tree will be added
|
||||||
|
* @param includeRequiredItems if {@code true} skills that have required items will be added
|
||||||
* @return the amount of new skills earned
|
* @return the amount of new skills earned
|
||||||
*/
|
*/
|
||||||
public int giveAvailableSkills(boolean includedByFs, boolean includeAutoGet)
|
public int giveAvailableSkills(boolean includeByFs, boolean includeAutoGet, boolean includeRequiredItems)
|
||||||
{
|
{
|
||||||
int skillCounter = 0;
|
int skillCounter = 0;
|
||||||
// Get available skills
|
// Get available skills
|
||||||
final Collection<Skill> skills = SkillTreeData.getInstance().getAllAvailableSkills(this, getTemplate().getClassId(), includedByFs, includeAutoGet);
|
final Collection<Skill> skills = SkillTreeData.getInstance().getAllAvailableSkills(this, getTemplate().getClassId(), includeByFs, includeAutoGet, includeRequiredItems);
|
||||||
final List<Skill> skillsForStore = new ArrayList<>();
|
final List<Skill> skillsForStore = new ArrayList<>();
|
||||||
for (Skill skill : skills)
|
for (Skill skill : skills)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -77,6 +77,10 @@ SkillReuseList =
|
|||||||
# Default: False
|
# Default: False
|
||||||
AutoLearnSkills = False
|
AutoLearnSkills = False
|
||||||
|
|
||||||
|
# Auto learn skills that need items to be learned.
|
||||||
|
# Default: False
|
||||||
|
AutoLearnSkillsWithoutItems = False
|
||||||
|
|
||||||
# If it's true skills from forgotten scrolls will be delivered upon level up and login, require AutoLearnSkills.
|
# If it's true skills from forgotten scrolls will be delivered upon level up and login, require AutoLearnSkills.
|
||||||
# Default: False
|
# Default: False
|
||||||
AutoLearnForgottenScrollSkills = False
|
AutoLearnForgottenScrollSkills = False
|
||||||
|
|||||||
+3
-3
@@ -429,7 +429,7 @@ public class ClassMaster extends AbstractNpcAI implements IXmlReader
|
|||||||
}
|
}
|
||||||
if (Config.AUTO_LEARN_SKILLS)
|
if (Config.AUTO_LEARN_SKILLS)
|
||||||
{
|
{
|
||||||
player.giveAvailableSkills(Config.AUTO_LEARN_FS_SKILLS, true);
|
player.giveAvailableSkills(Config.AUTO_LEARN_FS_SKILLS, true, Config.AUTO_LEARN_SKILLS_WITHOUT_ITEMS);
|
||||||
}
|
}
|
||||||
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.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();
|
player.broadcastUserInfo();
|
||||||
@@ -453,7 +453,7 @@ public class ClassMaster extends AbstractNpcAI implements IXmlReader
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
player.giveAvailableSkills(true, true);
|
player.giveAvailableSkills(true, true, true);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -868,7 +868,7 @@ public class ClassMaster extends AbstractNpcAI implements IXmlReader
|
|||||||
}
|
}
|
||||||
if (Config.AUTO_LEARN_SKILLS)
|
if (Config.AUTO_LEARN_SKILLS)
|
||||||
{
|
{
|
||||||
player.giveAvailableSkills(Config.AUTO_LEARN_FS_SKILLS, true);
|
player.giveAvailableSkills(Config.AUTO_LEARN_FS_SKILLS, true, Config.AUTO_LEARN_SKILLS_WITHOUT_ITEMS);
|
||||||
}
|
}
|
||||||
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.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();
|
player.broadcastUserInfo();
|
||||||
|
|||||||
Vendored
+6
-5
@@ -156,11 +156,11 @@ public class AdminSkill implements IAdminCommandHandler
|
|||||||
}
|
}
|
||||||
else if (command.equals("admin_give_all_skills"))
|
else if (command.equals("admin_give_all_skills"))
|
||||||
{
|
{
|
||||||
adminGiveAllSkills(activeChar, false);
|
adminGiveAllSkills(activeChar, false, false);
|
||||||
}
|
}
|
||||||
else if (command.equals("admin_give_all_skills_fs"))
|
else if (command.equals("admin_give_all_skills_fs"))
|
||||||
{
|
{
|
||||||
adminGiveAllSkills(activeChar, true);
|
adminGiveAllSkills(activeChar, true, true);
|
||||||
}
|
}
|
||||||
else if (command.equals("admin_give_clan_skills"))
|
else if (command.equals("admin_give_clan_skills"))
|
||||||
{
|
{
|
||||||
@@ -277,9 +277,10 @@ public class AdminSkill implements IAdminCommandHandler
|
|||||||
/**
|
/**
|
||||||
* This function will give all the skills that the target can learn at his/her level
|
* This function will give all the skills that the target can learn at his/her level
|
||||||
* @param activeChar the player
|
* @param activeChar the player
|
||||||
* @param includedByFs if {@code true} Forgotten Scroll skills will be delivered.
|
* @param includeByFs if {@code true} Forgotten Scroll skills will be delivered.
|
||||||
|
* @param includeRequiredItems if {@code true} skills that have required items will be added
|
||||||
*/
|
*/
|
||||||
private void adminGiveAllSkills(PlayerInstance activeChar, boolean includedByFs)
|
private void adminGiveAllSkills(PlayerInstance activeChar, boolean includeByFs, boolean includeRequiredItems)
|
||||||
{
|
{
|
||||||
final WorldObject target = activeChar.getTarget();
|
final WorldObject target = activeChar.getTarget();
|
||||||
if ((target == null) || !target.isPlayer())
|
if ((target == null) || !target.isPlayer())
|
||||||
@@ -289,7 +290,7 @@ public class AdminSkill implements IAdminCommandHandler
|
|||||||
}
|
}
|
||||||
final PlayerInstance player = target.getActingPlayer();
|
final PlayerInstance player = target.getActingPlayer();
|
||||||
// Notify player and admin
|
// Notify player and admin
|
||||||
BuilderUtil.sendSysMessage(activeChar, "You gave " + player.giveAvailableSkills(includedByFs, true) + " skills to " + player.getName());
|
BuilderUtil.sendSysMessage(activeChar, "You gave " + player.giveAvailableSkills(includeByFs, true, includeRequiredItems) + " skills to " + player.getName());
|
||||||
player.sendSkillList();
|
player.sendSkillList();
|
||||||
player.sendPacket(new AcquireSkillList(player));
|
player.sendPacket(new AcquireSkillList(player));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -179,6 +179,7 @@ public class Config
|
|||||||
public static boolean ENABLE_MODIFY_SKILL_REUSE;
|
public static boolean ENABLE_MODIFY_SKILL_REUSE;
|
||||||
public static Map<Integer, Integer> SKILL_REUSE_LIST;
|
public static Map<Integer, Integer> SKILL_REUSE_LIST;
|
||||||
public static boolean AUTO_LEARN_SKILLS;
|
public static boolean AUTO_LEARN_SKILLS;
|
||||||
|
public static boolean AUTO_LEARN_SKILLS_WITHOUT_ITEMS;
|
||||||
public static boolean AUTO_LEARN_FS_SKILLS;
|
public static boolean AUTO_LEARN_FS_SKILLS;
|
||||||
public static boolean AUTO_LOOT_HERBS;
|
public static boolean AUTO_LOOT_HERBS;
|
||||||
public static byte BUFFS_MAX_AMOUNT;
|
public static byte BUFFS_MAX_AMOUNT;
|
||||||
@@ -1728,6 +1729,7 @@ public class Config
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
AUTO_LEARN_SKILLS = Character.getBoolean("AutoLearnSkills", false);
|
AUTO_LEARN_SKILLS = Character.getBoolean("AutoLearnSkills", false);
|
||||||
|
AUTO_LEARN_SKILLS_WITHOUT_ITEMS = Character.getBoolean("AutoLearnSkillsWithoutItems", false);
|
||||||
AUTO_LEARN_FS_SKILLS = Character.getBoolean("AutoLearnForgottenScrollSkills", false);
|
AUTO_LEARN_FS_SKILLS = Character.getBoolean("AutoLearnForgottenScrollSkills", false);
|
||||||
AUTO_LOOT_HERBS = Character.getBoolean("AutoLootHerbs", false);
|
AUTO_LOOT_HERBS = Character.getBoolean("AutoLootHerbs", false);
|
||||||
BUFFS_MAX_AMOUNT = Character.getByte("MaxBuffAmount", (byte) 20);
|
BUFFS_MAX_AMOUNT = Character.getByte("MaxBuffAmount", (byte) 20);
|
||||||
|
|||||||
+16
-2
@@ -729,7 +729,16 @@ public class SkillTreeData implements IXmlReader
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Collection<Skill> getAllAvailableSkills(PlayerInstance player, ClassId classId, boolean includeByFs, boolean includeAutoGet)
|
/**
|
||||||
|
* Used by auto learn configuration.
|
||||||
|
* @param player
|
||||||
|
* @param classId
|
||||||
|
* @param includeByFs if {@code true} forgotten scroll 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
|
||||||
|
* @param includeRequiredItems if {@code true} skills that have required items will be added
|
||||||
|
* @return a list of auto learnable skills for the player.
|
||||||
|
*/
|
||||||
|
public Collection<Skill> getAllAvailableSkills(PlayerInstance player, ClassId classId, boolean includeByFs, boolean includeAutoGet, boolean includeRequiredItems)
|
||||||
{
|
{
|
||||||
// Get available skills
|
// Get available skills
|
||||||
final PlayerSkillHolder holder = new PlayerSkillHolder(player);
|
final PlayerSkillHolder holder = new PlayerSkillHolder(player);
|
||||||
@@ -749,8 +758,13 @@ public class SkillTreeData implements IXmlReader
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (SkillLearn skillLearn : learnable)
|
SEARCH: for (SkillLearn skillLearn : learnable)
|
||||||
{
|
{
|
||||||
|
if (!includeRequiredItems && !skillLearn.getRequiredItems().isEmpty())
|
||||||
|
{
|
||||||
|
continue SEARCH;
|
||||||
|
}
|
||||||
|
|
||||||
final Skill skill = SkillData.getInstance().getSkill(skillLearn.getSkillId(), skillLearn.getSkillLevel());
|
final Skill skill = SkillData.getInstance().getSkill(skillLearn.getSkillId(), skillLearn.getSkillLevel());
|
||||||
// Cleanup skills that has to be removed
|
// Cleanup skills that has to be removed
|
||||||
for (int skillId : skillLearn.getRemoveSkills())
|
for (int skillId : skillLearn.getRemoveSkills())
|
||||||
|
|||||||
+5
-4
@@ -2591,7 +2591,7 @@ public class PlayerInstance extends Playable
|
|||||||
// Give all normal skills if activated Auto-Learn is activated, included AutoGet skills.
|
// Give all normal skills if activated Auto-Learn is activated, included AutoGet skills.
|
||||||
if (Config.AUTO_LEARN_SKILLS)
|
if (Config.AUTO_LEARN_SKILLS)
|
||||||
{
|
{
|
||||||
giveAvailableSkills(Config.AUTO_LEARN_FS_SKILLS, true);
|
giveAvailableSkills(Config.AUTO_LEARN_FS_SKILLS, true, Config.AUTO_LEARN_SKILLS_WITHOUT_ITEMS);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -2651,15 +2651,16 @@ public class PlayerInstance extends Playable
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Give all available skills to the player.
|
* Give all available skills to the player.
|
||||||
* @param includedByFs if {@code true} forgotten scroll skills present in the skill tree will be added
|
* @param includeByFs if {@code true} forgotten scroll 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
|
* @param includeAutoGet if {@code true} auto-get skills present in the skill tree will be added
|
||||||
|
* @param includeRequiredItems if {@code true} skills that have required items will be added
|
||||||
* @return the amount of new skills earned
|
* @return the amount of new skills earned
|
||||||
*/
|
*/
|
||||||
public int giveAvailableSkills(boolean includedByFs, boolean includeAutoGet)
|
public int giveAvailableSkills(boolean includeByFs, boolean includeAutoGet, boolean includeRequiredItems)
|
||||||
{
|
{
|
||||||
int skillCounter = 0;
|
int skillCounter = 0;
|
||||||
// Get available skills
|
// Get available skills
|
||||||
final Collection<Skill> skills = SkillTreeData.getInstance().getAllAvailableSkills(this, getTemplate().getClassId(), includedByFs, includeAutoGet);
|
final Collection<Skill> skills = SkillTreeData.getInstance().getAllAvailableSkills(this, getTemplate().getClassId(), includeByFs, includeAutoGet, includeRequiredItems);
|
||||||
final List<Skill> skillsForStore = new ArrayList<>();
|
final List<Skill> skillsForStore = new ArrayList<>();
|
||||||
for (Skill skill : skills)
|
for (Skill skill : skills)
|
||||||
{
|
{
|
||||||
|
|||||||
+1
-1
@@ -287,7 +287,7 @@ public class CharacterCreate implements IClientIncomingPacket
|
|||||||
newChar.getStat().setLevel((byte) Config.BALTHUS_KNIGHTS_LEVEL);
|
newChar.getStat().setLevel((byte) Config.BALTHUS_KNIGHTS_LEVEL);
|
||||||
if (Config.BALTHUS_KNIGHTS_REWARD_SKILLS)
|
if (Config.BALTHUS_KNIGHTS_REWARD_SKILLS)
|
||||||
{
|
{
|
||||||
newChar.giveAvailableSkills(Config.AUTO_LEARN_FS_SKILLS, true);
|
newChar.giveAvailableSkills(Config.AUTO_LEARN_FS_SKILLS, true, Config.AUTO_LEARN_SKILLS_WITHOUT_ITEMS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -77,6 +77,10 @@ SkillReuseList =
|
|||||||
# Default: False
|
# Default: False
|
||||||
AutoLearnSkills = False
|
AutoLearnSkills = False
|
||||||
|
|
||||||
|
# Auto learn skills that need items to be learned.
|
||||||
|
# Default: False
|
||||||
|
AutoLearnSkillsWithoutItems = False
|
||||||
|
|
||||||
# If it's true skills from forgotten scrolls will be delivered upon level up and login, require AutoLearnSkills.
|
# If it's true skills from forgotten scrolls will be delivered upon level up and login, require AutoLearnSkills.
|
||||||
# Default: False
|
# Default: False
|
||||||
AutoLearnForgottenScrollSkills = False
|
AutoLearnForgottenScrollSkills = False
|
||||||
|
|||||||
+3
-3
@@ -429,7 +429,7 @@ public class ClassMaster extends AbstractNpcAI implements IXmlReader
|
|||||||
}
|
}
|
||||||
if (Config.AUTO_LEARN_SKILLS)
|
if (Config.AUTO_LEARN_SKILLS)
|
||||||
{
|
{
|
||||||
player.giveAvailableSkills(Config.AUTO_LEARN_FS_SKILLS, true);
|
player.giveAvailableSkills(Config.AUTO_LEARN_FS_SKILLS, true, Config.AUTO_LEARN_SKILLS_WITHOUT_ITEMS);
|
||||||
}
|
}
|
||||||
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.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();
|
player.broadcastUserInfo();
|
||||||
@@ -453,7 +453,7 @@ public class ClassMaster extends AbstractNpcAI implements IXmlReader
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
player.giveAvailableSkills(true, true);
|
player.giveAvailableSkills(true, true, true);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -868,7 +868,7 @@ public class ClassMaster extends AbstractNpcAI implements IXmlReader
|
|||||||
}
|
}
|
||||||
if (Config.AUTO_LEARN_SKILLS)
|
if (Config.AUTO_LEARN_SKILLS)
|
||||||
{
|
{
|
||||||
player.giveAvailableSkills(Config.AUTO_LEARN_FS_SKILLS, true);
|
player.giveAvailableSkills(Config.AUTO_LEARN_FS_SKILLS, true, Config.AUTO_LEARN_SKILLS_WITHOUT_ITEMS);
|
||||||
}
|
}
|
||||||
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.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();
|
player.broadcastUserInfo();
|
||||||
|
|||||||
Vendored
+6
-5
@@ -156,11 +156,11 @@ public class AdminSkill implements IAdminCommandHandler
|
|||||||
}
|
}
|
||||||
else if (command.equals("admin_give_all_skills"))
|
else if (command.equals("admin_give_all_skills"))
|
||||||
{
|
{
|
||||||
adminGiveAllSkills(activeChar, false);
|
adminGiveAllSkills(activeChar, false, false);
|
||||||
}
|
}
|
||||||
else if (command.equals("admin_give_all_skills_fs"))
|
else if (command.equals("admin_give_all_skills_fs"))
|
||||||
{
|
{
|
||||||
adminGiveAllSkills(activeChar, true);
|
adminGiveAllSkills(activeChar, true, true);
|
||||||
}
|
}
|
||||||
else if (command.equals("admin_give_clan_skills"))
|
else if (command.equals("admin_give_clan_skills"))
|
||||||
{
|
{
|
||||||
@@ -277,9 +277,10 @@ public class AdminSkill implements IAdminCommandHandler
|
|||||||
/**
|
/**
|
||||||
* This function will give all the skills that the target can learn at his/her level
|
* This function will give all the skills that the target can learn at his/her level
|
||||||
* @param activeChar the player
|
* @param activeChar the player
|
||||||
* @param includedByFs if {@code true} Forgotten Scroll skills will be delivered.
|
* @param includeByFs if {@code true} Forgotten Scroll skills will be delivered.
|
||||||
|
* @param includeRequiredItems if {@code true} skills that have required items will be added
|
||||||
*/
|
*/
|
||||||
private void adminGiveAllSkills(PlayerInstance activeChar, boolean includedByFs)
|
private void adminGiveAllSkills(PlayerInstance activeChar, boolean includeByFs, boolean includeRequiredItems)
|
||||||
{
|
{
|
||||||
final WorldObject target = activeChar.getTarget();
|
final WorldObject target = activeChar.getTarget();
|
||||||
if ((target == null) || !target.isPlayer())
|
if ((target == null) || !target.isPlayer())
|
||||||
@@ -289,7 +290,7 @@ public class AdminSkill implements IAdminCommandHandler
|
|||||||
}
|
}
|
||||||
final PlayerInstance player = target.getActingPlayer();
|
final PlayerInstance player = target.getActingPlayer();
|
||||||
// Notify player and admin
|
// Notify player and admin
|
||||||
BuilderUtil.sendSysMessage(activeChar, "You gave " + player.giveAvailableSkills(includedByFs, true) + " skills to " + player.getName());
|
BuilderUtil.sendSysMessage(activeChar, "You gave " + player.giveAvailableSkills(includeByFs, true, includeRequiredItems) + " skills to " + player.getName());
|
||||||
player.sendSkillList();
|
player.sendSkillList();
|
||||||
player.sendPacket(new AcquireSkillList(player));
|
player.sendPacket(new AcquireSkillList(player));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -179,6 +179,7 @@ public class Config
|
|||||||
public static boolean ENABLE_MODIFY_SKILL_REUSE;
|
public static boolean ENABLE_MODIFY_SKILL_REUSE;
|
||||||
public static Map<Integer, Integer> SKILL_REUSE_LIST;
|
public static Map<Integer, Integer> SKILL_REUSE_LIST;
|
||||||
public static boolean AUTO_LEARN_SKILLS;
|
public static boolean AUTO_LEARN_SKILLS;
|
||||||
|
public static boolean AUTO_LEARN_SKILLS_WITHOUT_ITEMS;
|
||||||
public static boolean AUTO_LEARN_FS_SKILLS;
|
public static boolean AUTO_LEARN_FS_SKILLS;
|
||||||
public static boolean AUTO_LOOT_HERBS;
|
public static boolean AUTO_LOOT_HERBS;
|
||||||
public static byte BUFFS_MAX_AMOUNT;
|
public static byte BUFFS_MAX_AMOUNT;
|
||||||
@@ -1735,6 +1736,7 @@ public class Config
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
AUTO_LEARN_SKILLS = Character.getBoolean("AutoLearnSkills", false);
|
AUTO_LEARN_SKILLS = Character.getBoolean("AutoLearnSkills", false);
|
||||||
|
AUTO_LEARN_SKILLS_WITHOUT_ITEMS = Character.getBoolean("AutoLearnSkillsWithoutItems", false);
|
||||||
AUTO_LEARN_FS_SKILLS = Character.getBoolean("AutoLearnForgottenScrollSkills", false);
|
AUTO_LEARN_FS_SKILLS = Character.getBoolean("AutoLearnForgottenScrollSkills", false);
|
||||||
AUTO_LOOT_HERBS = Character.getBoolean("AutoLootHerbs", false);
|
AUTO_LOOT_HERBS = Character.getBoolean("AutoLootHerbs", false);
|
||||||
BUFFS_MAX_AMOUNT = Character.getByte("MaxBuffAmount", (byte) 20);
|
BUFFS_MAX_AMOUNT = Character.getByte("MaxBuffAmount", (byte) 20);
|
||||||
|
|||||||
+16
-2
@@ -729,7 +729,16 @@ public class SkillTreeData implements IXmlReader
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Collection<Skill> getAllAvailableSkills(PlayerInstance player, ClassId classId, boolean includeByFs, boolean includeAutoGet)
|
/**
|
||||||
|
* Used by auto learn configuration.
|
||||||
|
* @param player
|
||||||
|
* @param classId
|
||||||
|
* @param includeByFs if {@code true} forgotten scroll 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
|
||||||
|
* @param includeRequiredItems if {@code true} skills that have required items will be added
|
||||||
|
* @return a list of auto learnable skills for the player.
|
||||||
|
*/
|
||||||
|
public Collection<Skill> getAllAvailableSkills(PlayerInstance player, ClassId classId, boolean includeByFs, boolean includeAutoGet, boolean includeRequiredItems)
|
||||||
{
|
{
|
||||||
// Get available skills
|
// Get available skills
|
||||||
final PlayerSkillHolder holder = new PlayerSkillHolder(player);
|
final PlayerSkillHolder holder = new PlayerSkillHolder(player);
|
||||||
@@ -749,8 +758,13 @@ public class SkillTreeData implements IXmlReader
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (SkillLearn skillLearn : learnable)
|
SEARCH: for (SkillLearn skillLearn : learnable)
|
||||||
{
|
{
|
||||||
|
if (!includeRequiredItems && !skillLearn.getRequiredItems().isEmpty())
|
||||||
|
{
|
||||||
|
continue SEARCH;
|
||||||
|
}
|
||||||
|
|
||||||
final Skill skill = SkillData.getInstance().getSkill(skillLearn.getSkillId(), skillLearn.getSkillLevel());
|
final Skill skill = SkillData.getInstance().getSkill(skillLearn.getSkillId(), skillLearn.getSkillLevel());
|
||||||
// Cleanup skills that has to be removed
|
// Cleanup skills that has to be removed
|
||||||
for (int skillId : skillLearn.getRemoveSkills())
|
for (int skillId : skillLearn.getRemoveSkills())
|
||||||
|
|||||||
+5
-4
@@ -2591,7 +2591,7 @@ public class PlayerInstance extends Playable
|
|||||||
// Give all normal skills if activated Auto-Learn is activated, included AutoGet skills.
|
// Give all normal skills if activated Auto-Learn is activated, included AutoGet skills.
|
||||||
if (Config.AUTO_LEARN_SKILLS)
|
if (Config.AUTO_LEARN_SKILLS)
|
||||||
{
|
{
|
||||||
giveAvailableSkills(Config.AUTO_LEARN_FS_SKILLS, true);
|
giveAvailableSkills(Config.AUTO_LEARN_FS_SKILLS, true, Config.AUTO_LEARN_SKILLS_WITHOUT_ITEMS);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -2651,15 +2651,16 @@ public class PlayerInstance extends Playable
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Give all available skills to the player.
|
* Give all available skills to the player.
|
||||||
* @param includedByFs if {@code true} forgotten scroll skills present in the skill tree will be added
|
* @param includeByFs if {@code true} forgotten scroll 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
|
* @param includeAutoGet if {@code true} auto-get skills present in the skill tree will be added
|
||||||
|
* @param includeRequiredItems if {@code true} skills that have required items will be added
|
||||||
* @return the amount of new skills earned
|
* @return the amount of new skills earned
|
||||||
*/
|
*/
|
||||||
public int giveAvailableSkills(boolean includedByFs, boolean includeAutoGet)
|
public int giveAvailableSkills(boolean includeByFs, boolean includeAutoGet, boolean includeRequiredItems)
|
||||||
{
|
{
|
||||||
int skillCounter = 0;
|
int skillCounter = 0;
|
||||||
// Get available skills
|
// Get available skills
|
||||||
final Collection<Skill> skills = SkillTreeData.getInstance().getAllAvailableSkills(this, getTemplate().getClassId(), includedByFs, includeAutoGet);
|
final Collection<Skill> skills = SkillTreeData.getInstance().getAllAvailableSkills(this, getTemplate().getClassId(), includeByFs, includeAutoGet, includeRequiredItems);
|
||||||
final List<Skill> skillsForStore = new ArrayList<>();
|
final List<Skill> skillsForStore = new ArrayList<>();
|
||||||
for (Skill skill : skills)
|
for (Skill skill : skills)
|
||||||
{
|
{
|
||||||
|
|||||||
+1
-1
@@ -287,7 +287,7 @@ public class CharacterCreate implements IClientIncomingPacket
|
|||||||
newChar.getStat().setLevel((byte) Config.BALTHUS_KNIGHTS_LEVEL);
|
newChar.getStat().setLevel((byte) Config.BALTHUS_KNIGHTS_LEVEL);
|
||||||
if (Config.BALTHUS_KNIGHTS_REWARD_SKILLS)
|
if (Config.BALTHUS_KNIGHTS_REWARD_SKILLS)
|
||||||
{
|
{
|
||||||
newChar.giveAvailableSkills(Config.AUTO_LEARN_FS_SKILLS, true);
|
newChar.giveAvailableSkills(Config.AUTO_LEARN_FS_SKILLS, true, Config.AUTO_LEARN_SKILLS_WITHOUT_ITEMS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -77,6 +77,10 @@ SkillReuseList =
|
|||||||
# Default: False
|
# Default: False
|
||||||
AutoLearnSkills = False
|
AutoLearnSkills = False
|
||||||
|
|
||||||
|
# Auto learn skills that need items to be learned.
|
||||||
|
# Default: False
|
||||||
|
AutoLearnSkillsWithoutItems = False
|
||||||
|
|
||||||
# If it's true skills from forgotten scrolls will be delivered upon level up and login, require AutoLearnSkills.
|
# If it's true skills from forgotten scrolls will be delivered upon level up and login, require AutoLearnSkills.
|
||||||
# Default: False
|
# Default: False
|
||||||
AutoLearnForgottenScrollSkills = False
|
AutoLearnForgottenScrollSkills = False
|
||||||
|
|||||||
+3
-3
@@ -429,7 +429,7 @@ public class ClassMaster extends AbstractNpcAI implements IXmlReader
|
|||||||
}
|
}
|
||||||
if (Config.AUTO_LEARN_SKILLS)
|
if (Config.AUTO_LEARN_SKILLS)
|
||||||
{
|
{
|
||||||
player.giveAvailableSkills(Config.AUTO_LEARN_FS_SKILLS, Config.AUTO_LEARN_FP_SKILLS, true);
|
player.giveAvailableSkills(Config.AUTO_LEARN_FS_SKILLS, Config.AUTO_LEARN_FP_SKILLS, true, Config.AUTO_LEARN_SKILLS_WITHOUT_ITEMS);
|
||||||
}
|
}
|
||||||
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.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();
|
player.broadcastUserInfo();
|
||||||
@@ -453,7 +453,7 @@ public class ClassMaster extends AbstractNpcAI implements IXmlReader
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
player.giveAvailableSkills(true, true, true);
|
player.giveAvailableSkills(true, true, true, true);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -868,7 +868,7 @@ public class ClassMaster extends AbstractNpcAI implements IXmlReader
|
|||||||
}
|
}
|
||||||
if (Config.AUTO_LEARN_SKILLS)
|
if (Config.AUTO_LEARN_SKILLS)
|
||||||
{
|
{
|
||||||
player.giveAvailableSkills(Config.AUTO_LEARN_FS_SKILLS, Config.AUTO_LEARN_FP_SKILLS, true);
|
player.giveAvailableSkills(Config.AUTO_LEARN_FS_SKILLS, Config.AUTO_LEARN_FP_SKILLS, true, Config.AUTO_LEARN_SKILLS_WITHOUT_ITEMS);
|
||||||
}
|
}
|
||||||
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.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();
|
player.broadcastUserInfo();
|
||||||
|
|||||||
Vendored
+7
-6
@@ -156,11 +156,11 @@ public class AdminSkill implements IAdminCommandHandler
|
|||||||
}
|
}
|
||||||
else if (command.equals("admin_give_all_skills"))
|
else if (command.equals("admin_give_all_skills"))
|
||||||
{
|
{
|
||||||
adminGiveAllSkills(activeChar, false, false);
|
adminGiveAllSkills(activeChar, false, false, false);
|
||||||
}
|
}
|
||||||
else if (command.equals("admin_give_all_skills_fs"))
|
else if (command.equals("admin_give_all_skills_fs"))
|
||||||
{
|
{
|
||||||
adminGiveAllSkills(activeChar, true, true);
|
adminGiveAllSkills(activeChar, true, true, true);
|
||||||
}
|
}
|
||||||
else if (command.equals("admin_give_clan_skills"))
|
else if (command.equals("admin_give_clan_skills"))
|
||||||
{
|
{
|
||||||
@@ -277,10 +277,11 @@ public class AdminSkill implements IAdminCommandHandler
|
|||||||
/**
|
/**
|
||||||
* This function will give all the skills that the target can learn at his/her level
|
* This function will give all the skills that the target can learn at his/her level
|
||||||
* @param activeChar the player
|
* @param activeChar the player
|
||||||
* @param includedByFs if {@code true} Forgotten Scroll skills will be delivered.
|
* @param includeByFs if {@code true} Forgotten Scroll skills will be delivered.
|
||||||
* @param includedByFp if {@code true} Forgotten Power skills will be delivered.
|
* @param includeByFp if {@code true} Forgotten Power skills will be delivered.
|
||||||
|
* @param includeRequiredItems if {@code true} skills that have required items will be added
|
||||||
*/
|
*/
|
||||||
private void adminGiveAllSkills(PlayerInstance activeChar, boolean includedByFs, boolean includedByFp)
|
private void adminGiveAllSkills(PlayerInstance activeChar, boolean includeByFs, boolean includeByFp, boolean includeRequiredItems)
|
||||||
{
|
{
|
||||||
final WorldObject target = activeChar.getTarget();
|
final WorldObject target = activeChar.getTarget();
|
||||||
if ((target == null) || !target.isPlayer())
|
if ((target == null) || !target.isPlayer())
|
||||||
@@ -290,7 +291,7 @@ public class AdminSkill implements IAdminCommandHandler
|
|||||||
}
|
}
|
||||||
final PlayerInstance player = target.getActingPlayer();
|
final PlayerInstance player = target.getActingPlayer();
|
||||||
// Notify player and admin
|
// Notify player and admin
|
||||||
BuilderUtil.sendSysMessage(activeChar, "You gave " + player.giveAvailableSkills(includedByFs, includedByFp, true) + " skills to " + player.getName());
|
BuilderUtil.sendSysMessage(activeChar, "You gave " + player.giveAvailableSkills(includeByFs, includeByFp, true, includeRequiredItems) + " skills to " + player.getName());
|
||||||
player.sendSkillList();
|
player.sendSkillList();
|
||||||
player.sendPacket(new AcquireSkillList(player));
|
player.sendPacket(new AcquireSkillList(player));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -179,6 +179,7 @@ public class Config
|
|||||||
public static boolean ENABLE_MODIFY_SKILL_REUSE;
|
public static boolean ENABLE_MODIFY_SKILL_REUSE;
|
||||||
public static Map<Integer, Integer> SKILL_REUSE_LIST;
|
public static Map<Integer, Integer> SKILL_REUSE_LIST;
|
||||||
public static boolean AUTO_LEARN_SKILLS;
|
public static boolean AUTO_LEARN_SKILLS;
|
||||||
|
public static boolean AUTO_LEARN_SKILLS_WITHOUT_ITEMS;
|
||||||
public static boolean AUTO_LEARN_FS_SKILLS;
|
public static boolean AUTO_LEARN_FS_SKILLS;
|
||||||
public static boolean AUTO_LEARN_FP_SKILLS;
|
public static boolean AUTO_LEARN_FP_SKILLS;
|
||||||
public static boolean AUTO_LOOT_HERBS;
|
public static boolean AUTO_LOOT_HERBS;
|
||||||
@@ -1769,6 +1770,7 @@ public class Config
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
AUTO_LEARN_SKILLS = Character.getBoolean("AutoLearnSkills", false);
|
AUTO_LEARN_SKILLS = Character.getBoolean("AutoLearnSkills", false);
|
||||||
|
AUTO_LEARN_SKILLS_WITHOUT_ITEMS = Character.getBoolean("AutoLearnSkillsWithoutItems", false);
|
||||||
AUTO_LEARN_FS_SKILLS = Character.getBoolean("AutoLearnForgottenScrollSkills", false);
|
AUTO_LEARN_FS_SKILLS = Character.getBoolean("AutoLearnForgottenScrollSkills", false);
|
||||||
AUTO_LEARN_FP_SKILLS = Character.getBoolean("AutoLearnForgottenPowerSkills", false);
|
AUTO_LEARN_FP_SKILLS = Character.getBoolean("AutoLearnForgottenPowerSkills", false);
|
||||||
AUTO_LOOT_HERBS = Character.getBoolean("AutoLootHerbs", false);
|
AUTO_LOOT_HERBS = Character.getBoolean("AutoLootHerbs", false);
|
||||||
|
|||||||
@@ -731,7 +731,17 @@ public class SkillTreeData implements IXmlReader
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Collection<Skill> getAllAvailableSkills(PlayerInstance player, ClassId classId, boolean includeByFs, boolean includeByFp, boolean includeAutoGet)
|
/**
|
||||||
|
* Used by auto learn configuration.
|
||||||
|
* @param player
|
||||||
|
* @param classId
|
||||||
|
* @param includeByFs if {@code true} forgotten scroll skills present in the skill tree will be added
|
||||||
|
* @param includeByFp 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
|
||||||
|
* @param includeRequiredItems if {@code true} skills that have required items will be added
|
||||||
|
* @return a list of auto learnable skills for the player.
|
||||||
|
*/
|
||||||
|
public Collection<Skill> getAllAvailableSkills(PlayerInstance player, ClassId classId, boolean includeByFs, boolean includeByFp, boolean includeAutoGet, boolean includeRequiredItems)
|
||||||
{
|
{
|
||||||
// Get available skills
|
// Get available skills
|
||||||
final PlayerSkillHolder holder = new PlayerSkillHolder(player);
|
final PlayerSkillHolder holder = new PlayerSkillHolder(player);
|
||||||
@@ -751,8 +761,13 @@ public class SkillTreeData implements IXmlReader
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (SkillLearn skillLearn : learnable)
|
SEARCH: for (SkillLearn skillLearn : learnable)
|
||||||
{
|
{
|
||||||
|
if (!includeRequiredItems && !skillLearn.getRequiredItems().isEmpty())
|
||||||
|
{
|
||||||
|
continue SEARCH;
|
||||||
|
}
|
||||||
|
|
||||||
final Skill skill = SkillData.getInstance().getSkill(skillLearn.getSkillId(), skillLearn.getSkillLevel());
|
final Skill skill = SkillData.getInstance().getSkill(skillLearn.getSkillId(), skillLearn.getSkillLevel());
|
||||||
// Cleanup skills that has to be removed
|
// Cleanup skills that has to be removed
|
||||||
for (int skillId : skillLearn.getRemoveSkills())
|
for (int skillId : skillLearn.getRemoveSkills())
|
||||||
|
|||||||
+6
-5
@@ -2591,7 +2591,7 @@ public class PlayerInstance extends Playable
|
|||||||
// Give all normal skills if activated Auto-Learn is activated, included AutoGet skills.
|
// Give all normal skills if activated Auto-Learn is activated, included AutoGet skills.
|
||||||
if (Config.AUTO_LEARN_SKILLS)
|
if (Config.AUTO_LEARN_SKILLS)
|
||||||
{
|
{
|
||||||
giveAvailableSkills(Config.AUTO_LEARN_FS_SKILLS, Config.AUTO_LEARN_FP_SKILLS, true);
|
giveAvailableSkills(Config.AUTO_LEARN_FS_SKILLS, Config.AUTO_LEARN_FP_SKILLS, true, Config.AUTO_LEARN_SKILLS_WITHOUT_ITEMS);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -2651,16 +2651,17 @@ public class PlayerInstance extends Playable
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Give all available skills to the player.
|
* Give all available skills to the player.
|
||||||
* @param includedByFs if {@code true} forgotten scroll skills present in the skill tree will be added
|
* @param includeByFs 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 includeByFp 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
|
* @param includeAutoGet if {@code true} auto-get skills present in the skill tree will be added
|
||||||
|
* @param includeRequiredItems if {@code true} skills that have required items will be added
|
||||||
* @return the amount of new skills earned
|
* @return the amount of new skills earned
|
||||||
*/
|
*/
|
||||||
public int giveAvailableSkills(boolean includedByFs, boolean includedByFp, boolean includeAutoGet)
|
public int giveAvailableSkills(boolean includeByFs, boolean includeByFp, boolean includeAutoGet, boolean includeRequiredItems)
|
||||||
{
|
{
|
||||||
int skillCounter = 0;
|
int skillCounter = 0;
|
||||||
// Get available skills
|
// Get available skills
|
||||||
final Collection<Skill> skills = SkillTreeData.getInstance().getAllAvailableSkills(this, getTemplate().getClassId(), includedByFs, includedByFp, includeAutoGet);
|
final Collection<Skill> skills = SkillTreeData.getInstance().getAllAvailableSkills(this, getTemplate().getClassId(), includeByFs, includeByFp, includeAutoGet, includeRequiredItems);
|
||||||
final List<Skill> skillsForStore = new ArrayList<>();
|
final List<Skill> skillsForStore = new ArrayList<>();
|
||||||
for (Skill skill : skills)
|
for (Skill skill : skills)
|
||||||
{
|
{
|
||||||
|
|||||||
+1
-1
@@ -287,7 +287,7 @@ public class CharacterCreate implements IClientIncomingPacket
|
|||||||
newChar.getStat().setLevel((byte) Config.BALTHUS_KNIGHTS_LEVEL);
|
newChar.getStat().setLevel((byte) Config.BALTHUS_KNIGHTS_LEVEL);
|
||||||
if (Config.BALTHUS_KNIGHTS_REWARD_SKILLS)
|
if (Config.BALTHUS_KNIGHTS_REWARD_SKILLS)
|
||||||
{
|
{
|
||||||
newChar.giveAvailableSkills(Config.AUTO_LEARN_FS_SKILLS, Config.AUTO_LEARN_FP_SKILLS, true);
|
newChar.giveAvailableSkills(Config.AUTO_LEARN_FS_SKILLS, Config.AUTO_LEARN_FP_SKILLS, true, Config.AUTO_LEARN_SKILLS_WITHOUT_ITEMS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -77,6 +77,10 @@ SkillReuseList =
|
|||||||
# Default: False
|
# Default: False
|
||||||
AutoLearnSkills = False
|
AutoLearnSkills = False
|
||||||
|
|
||||||
|
# Auto learn skills that need items to be learned.
|
||||||
|
# Default: False
|
||||||
|
AutoLearnSkillsWithoutItems = False
|
||||||
|
|
||||||
# If it's true skills from forgotten scrolls will be delivered upon level up and login, require AutoLearnSkills.
|
# If it's true skills from forgotten scrolls will be delivered upon level up and login, require AutoLearnSkills.
|
||||||
# Default: False
|
# Default: False
|
||||||
AutoLearnForgottenScrollSkills = False
|
AutoLearnForgottenScrollSkills = False
|
||||||
|
|||||||
+3
-3
@@ -431,7 +431,7 @@ public class ClassMaster extends AbstractNpcAI implements IXmlReader
|
|||||||
|
|
||||||
if (Config.AUTO_LEARN_SKILLS)
|
if (Config.AUTO_LEARN_SKILLS)
|
||||||
{
|
{
|
||||||
player.giveAvailableSkills(Config.AUTO_LEARN_FS_SKILLS, Config.AUTO_LEARN_FP_SKILLS, true);
|
player.giveAvailableSkills(Config.AUTO_LEARN_FS_SKILLS, Config.AUTO_LEARN_FP_SKILLS, true, Config.AUTO_LEARN_SKILLS_WITHOUT_ITEMS);
|
||||||
}
|
}
|
||||||
|
|
||||||
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.store(false); // Save player cause if server crashes before this char is saved, he will lose class and the money payed for class change.
|
||||||
@@ -456,7 +456,7 @@ public class ClassMaster extends AbstractNpcAI implements IXmlReader
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
player.giveAvailableSkills(true, true, true);
|
player.giveAvailableSkills(true, true, true, true);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -873,7 +873,7 @@ public class ClassMaster extends AbstractNpcAI implements IXmlReader
|
|||||||
|
|
||||||
if (Config.AUTO_LEARN_SKILLS)
|
if (Config.AUTO_LEARN_SKILLS)
|
||||||
{
|
{
|
||||||
player.giveAvailableSkills(Config.AUTO_LEARN_FS_SKILLS, Config.AUTO_LEARN_FP_SKILLS, true);
|
player.giveAvailableSkills(Config.AUTO_LEARN_FS_SKILLS, Config.AUTO_LEARN_FP_SKILLS, true, Config.AUTO_LEARN_SKILLS_WITHOUT_ITEMS);
|
||||||
}
|
}
|
||||||
|
|
||||||
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.store(false); // Save player cause if server crashes before this char is saved, he will lose class and the money payed for class change.
|
||||||
|
|||||||
Vendored
+7
-6
@@ -156,11 +156,11 @@ public class AdminSkill implements IAdminCommandHandler
|
|||||||
}
|
}
|
||||||
else if (command.equals("admin_give_all_skills"))
|
else if (command.equals("admin_give_all_skills"))
|
||||||
{
|
{
|
||||||
adminGiveAllSkills(activeChar, false, false);
|
adminGiveAllSkills(activeChar, false, false, false);
|
||||||
}
|
}
|
||||||
else if (command.equals("admin_give_all_skills_fs"))
|
else if (command.equals("admin_give_all_skills_fs"))
|
||||||
{
|
{
|
||||||
adminGiveAllSkills(activeChar, true, true);
|
adminGiveAllSkills(activeChar, true, true, true);
|
||||||
}
|
}
|
||||||
else if (command.equals("admin_give_clan_skills"))
|
else if (command.equals("admin_give_clan_skills"))
|
||||||
{
|
{
|
||||||
@@ -277,10 +277,11 @@ public class AdminSkill implements IAdminCommandHandler
|
|||||||
/**
|
/**
|
||||||
* This function will give all the skills that the target can learn at his/her level
|
* This function will give all the skills that the target can learn at his/her level
|
||||||
* @param activeChar the player
|
* @param activeChar the player
|
||||||
* @param includedByFs if {@code true} Forgotten Scroll skills will be delivered.
|
* @param includeByFs if {@code true} Forgotten Scroll skills will be delivered.
|
||||||
* @param includedByFp if {@code true} Forgotten Power skills will be delivered.
|
* @param includeByFp if {@code true} Forgotten Power skills will be delivered.
|
||||||
|
* @param includeRequiredItems if {@code true} skills that have required items will be added
|
||||||
*/
|
*/
|
||||||
private void adminGiveAllSkills(PlayerInstance activeChar, boolean includedByFs, boolean includedByFp)
|
private void adminGiveAllSkills(PlayerInstance activeChar, boolean includeByFs, boolean includeByFp, boolean includeRequiredItems)
|
||||||
{
|
{
|
||||||
final WorldObject target = activeChar.getTarget();
|
final WorldObject target = activeChar.getTarget();
|
||||||
if ((target == null) || !target.isPlayer())
|
if ((target == null) || !target.isPlayer())
|
||||||
@@ -290,7 +291,7 @@ public class AdminSkill implements IAdminCommandHandler
|
|||||||
}
|
}
|
||||||
final PlayerInstance player = target.getActingPlayer();
|
final PlayerInstance player = target.getActingPlayer();
|
||||||
// Notify player and admin
|
// Notify player and admin
|
||||||
BuilderUtil.sendSysMessage(activeChar, "You gave " + player.giveAvailableSkills(includedByFs, includedByFp, true) + " skills to " + player.getName());
|
BuilderUtil.sendSysMessage(activeChar, "You gave " + player.giveAvailableSkills(includeByFs, includeByFp, true, includeRequiredItems) + " skills to " + player.getName());
|
||||||
player.sendSkillList();
|
player.sendSkillList();
|
||||||
player.sendPacket(new AcquireSkillList(player));
|
player.sendPacket(new AcquireSkillList(player));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -179,6 +179,7 @@ public class Config
|
|||||||
public static boolean ENABLE_MODIFY_SKILL_REUSE;
|
public static boolean ENABLE_MODIFY_SKILL_REUSE;
|
||||||
public static Map<Integer, Integer> SKILL_REUSE_LIST;
|
public static Map<Integer, Integer> SKILL_REUSE_LIST;
|
||||||
public static boolean AUTO_LEARN_SKILLS;
|
public static boolean AUTO_LEARN_SKILLS;
|
||||||
|
public static boolean AUTO_LEARN_SKILLS_WITHOUT_ITEMS;
|
||||||
public static boolean AUTO_LEARN_FS_SKILLS;
|
public static boolean AUTO_LEARN_FS_SKILLS;
|
||||||
public static boolean AUTO_LEARN_FP_SKILLS;
|
public static boolean AUTO_LEARN_FP_SKILLS;
|
||||||
public static boolean AUTO_LOOT_HERBS;
|
public static boolean AUTO_LOOT_HERBS;
|
||||||
@@ -1777,6 +1778,7 @@ public class Config
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
AUTO_LEARN_SKILLS = Character.getBoolean("AutoLearnSkills", false);
|
AUTO_LEARN_SKILLS = Character.getBoolean("AutoLearnSkills", false);
|
||||||
|
AUTO_LEARN_SKILLS_WITHOUT_ITEMS = Character.getBoolean("AutoLearnSkillsWithoutItems", false);
|
||||||
AUTO_LEARN_FS_SKILLS = Character.getBoolean("AutoLearnForgottenScrollSkills", false);
|
AUTO_LEARN_FS_SKILLS = Character.getBoolean("AutoLearnForgottenScrollSkills", false);
|
||||||
AUTO_LEARN_FP_SKILLS = Character.getBoolean("AutoLearnForgottenPowerSkills", false);
|
AUTO_LEARN_FP_SKILLS = Character.getBoolean("AutoLearnForgottenPowerSkills", false);
|
||||||
AUTO_LOOT_HERBS = Character.getBoolean("AutoLootHerbs", false);
|
AUTO_LOOT_HERBS = Character.getBoolean("AutoLootHerbs", false);
|
||||||
|
|||||||
+17
-2
@@ -731,7 +731,17 @@ public class SkillTreeData implements IXmlReader
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Collection<Skill> getAllAvailableSkills(PlayerInstance player, ClassId classId, boolean includeByFs, boolean includeByFp, boolean includeAutoGet)
|
/**
|
||||||
|
* Used by auto learn configuration.
|
||||||
|
* @param player
|
||||||
|
* @param classId
|
||||||
|
* @param includeByFs if {@code true} forgotten scroll skills present in the skill tree will be added
|
||||||
|
* @param includeByFp 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
|
||||||
|
* @param includeRequiredItems if {@code true} skills that have required items will be added
|
||||||
|
* @return a list of auto learnable skills for the player.
|
||||||
|
*/
|
||||||
|
public Collection<Skill> getAllAvailableSkills(PlayerInstance player, ClassId classId, boolean includeByFs, boolean includeByFp, boolean includeAutoGet, boolean includeRequiredItems)
|
||||||
{
|
{
|
||||||
// Get available skills
|
// Get available skills
|
||||||
final PlayerSkillHolder holder = new PlayerSkillHolder(player);
|
final PlayerSkillHolder holder = new PlayerSkillHolder(player);
|
||||||
@@ -751,8 +761,13 @@ public class SkillTreeData implements IXmlReader
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (SkillLearn skillLearn : learnable)
|
SEARCH: for (SkillLearn skillLearn : learnable)
|
||||||
{
|
{
|
||||||
|
if (!includeRequiredItems && !skillLearn.getRequiredItems().isEmpty())
|
||||||
|
{
|
||||||
|
continue SEARCH;
|
||||||
|
}
|
||||||
|
|
||||||
final Skill skill = SkillData.getInstance().getSkill(skillLearn.getSkillId(), skillLearn.getSkillLevel());
|
final Skill skill = SkillData.getInstance().getSkill(skillLearn.getSkillId(), skillLearn.getSkillLevel());
|
||||||
// Cleanup skills that has to be removed
|
// Cleanup skills that has to be removed
|
||||||
for (int skillId : skillLearn.getRemoveSkills())
|
for (int skillId : skillLearn.getRemoveSkills())
|
||||||
|
|||||||
+6
-5
@@ -2527,7 +2527,7 @@ public class PlayerInstance extends Playable
|
|||||||
// Give all normal skills if activated Auto-Learn is activated, included AutoGet skills.
|
// Give all normal skills if activated Auto-Learn is activated, included AutoGet skills.
|
||||||
if (Config.AUTO_LEARN_SKILLS)
|
if (Config.AUTO_LEARN_SKILLS)
|
||||||
{
|
{
|
||||||
giveAvailableSkills(Config.AUTO_LEARN_FS_SKILLS, Config.AUTO_LEARN_FP_SKILLS, true);
|
giveAvailableSkills(Config.AUTO_LEARN_FS_SKILLS, Config.AUTO_LEARN_FP_SKILLS, true, Config.AUTO_LEARN_SKILLS_WITHOUT_ITEMS);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -2587,16 +2587,17 @@ public class PlayerInstance extends Playable
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Give all available skills to the player.
|
* Give all available skills to the player.
|
||||||
* @param includedByFs if {@code true} forgotten scroll skills present in the skill tree will be added
|
* @param includeByFs 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 includeByFp 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
|
* @param includeAutoGet if {@code true} auto-get skills present in the skill tree will be added
|
||||||
|
* @param includeRequiredItems if {@code true} skills that have required items will be added
|
||||||
* @return the amount of new skills earned
|
* @return the amount of new skills earned
|
||||||
*/
|
*/
|
||||||
public int giveAvailableSkills(boolean includedByFs, boolean includedByFp, boolean includeAutoGet)
|
public int giveAvailableSkills(boolean includeByFs, boolean includeByFp, boolean includeAutoGet, boolean includeRequiredItems)
|
||||||
{
|
{
|
||||||
int skillCounter = 0;
|
int skillCounter = 0;
|
||||||
// Get available skills
|
// Get available skills
|
||||||
final Collection<Skill> skills = SkillTreeData.getInstance().getAllAvailableSkills(this, getTemplate().getClassId(), includedByFs, includedByFp, includeAutoGet);
|
final Collection<Skill> skills = SkillTreeData.getInstance().getAllAvailableSkills(this, getTemplate().getClassId(), includeByFs, includeByFp, includeAutoGet, includeRequiredItems);
|
||||||
final List<Skill> skillsForStore = new ArrayList<>();
|
final List<Skill> skillsForStore = new ArrayList<>();
|
||||||
for (Skill skill : skills)
|
for (Skill skill : skills)
|
||||||
{
|
{
|
||||||
|
|||||||
+1
-1
@@ -287,7 +287,7 @@ public class CharacterCreate implements IClientIncomingPacket
|
|||||||
newChar.getStat().setLevel((byte) Config.BALTHUS_KNIGHTS_LEVEL);
|
newChar.getStat().setLevel((byte) Config.BALTHUS_KNIGHTS_LEVEL);
|
||||||
if (Config.BALTHUS_KNIGHTS_REWARD_SKILLS)
|
if (Config.BALTHUS_KNIGHTS_REWARD_SKILLS)
|
||||||
{
|
{
|
||||||
newChar.giveAvailableSkills(Config.AUTO_LEARN_FS_SKILLS, Config.AUTO_LEARN_FP_SKILLS, true);
|
newChar.giveAvailableSkills(Config.AUTO_LEARN_FS_SKILLS, Config.AUTO_LEARN_FP_SKILLS, true, Config.AUTO_LEARN_SKILLS_WITHOUT_ITEMS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -114,7 +114,7 @@ public class ExRequestClassChange implements IClientIncomingPacket
|
|||||||
|
|
||||||
if (Config.AUTO_LEARN_SKILLS)
|
if (Config.AUTO_LEARN_SKILLS)
|
||||||
{
|
{
|
||||||
player.giveAvailableSkills(Config.AUTO_LEARN_FS_SKILLS, Config.AUTO_LEARN_FP_SKILLS, true);
|
player.giveAvailableSkills(Config.AUTO_LEARN_FS_SKILLS, Config.AUTO_LEARN_FP_SKILLS, true, Config.AUTO_LEARN_SKILLS_WITHOUT_ITEMS);
|
||||||
}
|
}
|
||||||
|
|
||||||
player.store(false); // Save player cause if server crashes before this char is saved, he will lose class.
|
player.store(false); // Save player cause if server crashes before this char is saved, he will lose class.
|
||||||
|
|||||||
@@ -77,6 +77,10 @@ SkillReuseList =
|
|||||||
# Default: False
|
# Default: False
|
||||||
AutoLearnSkills = False
|
AutoLearnSkills = False
|
||||||
|
|
||||||
|
# Auto learn skills that need items to be learned.
|
||||||
|
# Default: False
|
||||||
|
AutoLearnSkillsWithoutItems = False
|
||||||
|
|
||||||
# If it's true skills from forgotten scrolls will be delivered upon level up and login, require AutoLearnSkills.
|
# If it's true skills from forgotten scrolls will be delivered upon level up and login, require AutoLearnSkills.
|
||||||
# Default: False
|
# Default: False
|
||||||
AutoLearnForgottenScrollSkills = False
|
AutoLearnForgottenScrollSkills = False
|
||||||
|
|||||||
+3
-3
@@ -431,7 +431,7 @@ public class ClassMaster extends AbstractNpcAI implements IXmlReader
|
|||||||
|
|
||||||
if (Config.AUTO_LEARN_SKILLS)
|
if (Config.AUTO_LEARN_SKILLS)
|
||||||
{
|
{
|
||||||
player.giveAvailableSkills(Config.AUTO_LEARN_FS_SKILLS, Config.AUTO_LEARN_FP_SKILLS, true);
|
player.giveAvailableSkills(Config.AUTO_LEARN_FS_SKILLS, Config.AUTO_LEARN_FP_SKILLS, true, Config.AUTO_LEARN_SKILLS_WITHOUT_ITEMS);
|
||||||
}
|
}
|
||||||
|
|
||||||
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.store(false); // Save player cause if server crashes before this char is saved, he will lose class and the money payed for class change.
|
||||||
@@ -456,7 +456,7 @@ public class ClassMaster extends AbstractNpcAI implements IXmlReader
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
player.giveAvailableSkills(true, true, true);
|
player.giveAvailableSkills(true, true, true, true);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -873,7 +873,7 @@ public class ClassMaster extends AbstractNpcAI implements IXmlReader
|
|||||||
|
|
||||||
if (Config.AUTO_LEARN_SKILLS)
|
if (Config.AUTO_LEARN_SKILLS)
|
||||||
{
|
{
|
||||||
player.giveAvailableSkills(Config.AUTO_LEARN_FS_SKILLS, Config.AUTO_LEARN_FP_SKILLS, true);
|
player.giveAvailableSkills(Config.AUTO_LEARN_FS_SKILLS, Config.AUTO_LEARN_FP_SKILLS, true, Config.AUTO_LEARN_SKILLS_WITHOUT_ITEMS);
|
||||||
}
|
}
|
||||||
|
|
||||||
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.store(false); // Save player cause if server crashes before this char is saved, he will lose class and the money payed for class change.
|
||||||
|
|||||||
Vendored
+7
-6
@@ -156,11 +156,11 @@ public class AdminSkill implements IAdminCommandHandler
|
|||||||
}
|
}
|
||||||
else if (command.equals("admin_give_all_skills"))
|
else if (command.equals("admin_give_all_skills"))
|
||||||
{
|
{
|
||||||
adminGiveAllSkills(activeChar, false, false);
|
adminGiveAllSkills(activeChar, false, false, false);
|
||||||
}
|
}
|
||||||
else if (command.equals("admin_give_all_skills_fs"))
|
else if (command.equals("admin_give_all_skills_fs"))
|
||||||
{
|
{
|
||||||
adminGiveAllSkills(activeChar, true, true);
|
adminGiveAllSkills(activeChar, true, true, true);
|
||||||
}
|
}
|
||||||
else if (command.equals("admin_give_clan_skills"))
|
else if (command.equals("admin_give_clan_skills"))
|
||||||
{
|
{
|
||||||
@@ -277,10 +277,11 @@ public class AdminSkill implements IAdminCommandHandler
|
|||||||
/**
|
/**
|
||||||
* This function will give all the skills that the target can learn at his/her level
|
* This function will give all the skills that the target can learn at his/her level
|
||||||
* @param activeChar the player
|
* @param activeChar the player
|
||||||
* @param includedByFs if {@code true} Forgotten Scroll skills will be delivered.
|
* @param includeByFs if {@code true} Forgotten Scroll skills will be delivered.
|
||||||
* @param includedByFp if {@code true} Forgotten Power skills will be delivered.
|
* @param includeByFp if {@code true} Forgotten Power skills will be delivered.
|
||||||
|
* @param includeRequiredItems if {@code true} skills that have required items will be added
|
||||||
*/
|
*/
|
||||||
private void adminGiveAllSkills(PlayerInstance activeChar, boolean includedByFs, boolean includedByFp)
|
private void adminGiveAllSkills(PlayerInstance activeChar, boolean includeByFs, boolean includeByFp, boolean includeRequiredItems)
|
||||||
{
|
{
|
||||||
final WorldObject target = activeChar.getTarget();
|
final WorldObject target = activeChar.getTarget();
|
||||||
if ((target == null) || !target.isPlayer())
|
if ((target == null) || !target.isPlayer())
|
||||||
@@ -290,7 +291,7 @@ public class AdminSkill implements IAdminCommandHandler
|
|||||||
}
|
}
|
||||||
final PlayerInstance player = target.getActingPlayer();
|
final PlayerInstance player = target.getActingPlayer();
|
||||||
// Notify player and admin
|
// Notify player and admin
|
||||||
BuilderUtil.sendSysMessage(activeChar, "You gave " + player.giveAvailableSkills(includedByFs, includedByFp, true) + " skills to " + player.getName());
|
BuilderUtil.sendSysMessage(activeChar, "You gave " + player.giveAvailableSkills(includeByFs, includeByFp, true, includeRequiredItems) + " skills to " + player.getName());
|
||||||
player.sendSkillList();
|
player.sendSkillList();
|
||||||
player.sendPacket(new AcquireSkillList(player));
|
player.sendPacket(new AcquireSkillList(player));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -179,6 +179,7 @@ public class Config
|
|||||||
public static boolean ENABLE_MODIFY_SKILL_REUSE;
|
public static boolean ENABLE_MODIFY_SKILL_REUSE;
|
||||||
public static Map<Integer, Integer> SKILL_REUSE_LIST;
|
public static Map<Integer, Integer> SKILL_REUSE_LIST;
|
||||||
public static boolean AUTO_LEARN_SKILLS;
|
public static boolean AUTO_LEARN_SKILLS;
|
||||||
|
public static boolean AUTO_LEARN_SKILLS_WITHOUT_ITEMS;
|
||||||
public static boolean AUTO_LEARN_FS_SKILLS;
|
public static boolean AUTO_LEARN_FS_SKILLS;
|
||||||
public static boolean AUTO_LEARN_FP_SKILLS;
|
public static boolean AUTO_LEARN_FP_SKILLS;
|
||||||
public static boolean AUTO_LOOT_HERBS;
|
public static boolean AUTO_LOOT_HERBS;
|
||||||
@@ -1775,6 +1776,7 @@ public class Config
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
AUTO_LEARN_SKILLS = Character.getBoolean("AutoLearnSkills", false);
|
AUTO_LEARN_SKILLS = Character.getBoolean("AutoLearnSkills", false);
|
||||||
|
AUTO_LEARN_SKILLS_WITHOUT_ITEMS = Character.getBoolean("AutoLearnSkillsWithoutItems", false);
|
||||||
AUTO_LEARN_FS_SKILLS = Character.getBoolean("AutoLearnForgottenScrollSkills", false);
|
AUTO_LEARN_FS_SKILLS = Character.getBoolean("AutoLearnForgottenScrollSkills", false);
|
||||||
AUTO_LEARN_FP_SKILLS = Character.getBoolean("AutoLearnForgottenPowerSkills", false);
|
AUTO_LEARN_FP_SKILLS = Character.getBoolean("AutoLearnForgottenPowerSkills", false);
|
||||||
AUTO_LOOT_HERBS = Character.getBoolean("AutoLootHerbs", false);
|
AUTO_LOOT_HERBS = Character.getBoolean("AutoLootHerbs", false);
|
||||||
|
|||||||
+17
-2
@@ -731,7 +731,17 @@ public class SkillTreeData implements IXmlReader
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Collection<Skill> getAllAvailableSkills(PlayerInstance player, ClassId classId, boolean includeByFs, boolean includeByFp, boolean includeAutoGet)
|
/**
|
||||||
|
* Used by auto learn configuration.
|
||||||
|
* @param player
|
||||||
|
* @param classId
|
||||||
|
* @param includeByFs if {@code true} forgotten scroll skills present in the skill tree will be added
|
||||||
|
* @param includeByFp 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
|
||||||
|
* @param includeRequiredItems if {@code true} skills that have required items will be added
|
||||||
|
* @return a list of auto learnable skills for the player.
|
||||||
|
*/
|
||||||
|
public Collection<Skill> getAllAvailableSkills(PlayerInstance player, ClassId classId, boolean includeByFs, boolean includeByFp, boolean includeAutoGet, boolean includeRequiredItems)
|
||||||
{
|
{
|
||||||
// Get available skills
|
// Get available skills
|
||||||
final PlayerSkillHolder holder = new PlayerSkillHolder(player);
|
final PlayerSkillHolder holder = new PlayerSkillHolder(player);
|
||||||
@@ -751,8 +761,13 @@ public class SkillTreeData implements IXmlReader
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (SkillLearn skillLearn : learnable)
|
SEARCH: for (SkillLearn skillLearn : learnable)
|
||||||
{
|
{
|
||||||
|
if (!includeRequiredItems && !skillLearn.getRequiredItems().isEmpty())
|
||||||
|
{
|
||||||
|
continue SEARCH;
|
||||||
|
}
|
||||||
|
|
||||||
final Skill skill = SkillData.getInstance().getSkill(skillLearn.getSkillId(), skillLearn.getSkillLevel());
|
final Skill skill = SkillData.getInstance().getSkill(skillLearn.getSkillId(), skillLearn.getSkillLevel());
|
||||||
// Cleanup skills that has to be removed
|
// Cleanup skills that has to be removed
|
||||||
for (int skillId : skillLearn.getRemoveSkills())
|
for (int skillId : skillLearn.getRemoveSkills())
|
||||||
|
|||||||
+6
-5
@@ -2557,7 +2557,7 @@ public class PlayerInstance extends Playable
|
|||||||
// Give all normal skills if activated Auto-Learn is activated, included AutoGet skills.
|
// Give all normal skills if activated Auto-Learn is activated, included AutoGet skills.
|
||||||
if (Config.AUTO_LEARN_SKILLS)
|
if (Config.AUTO_LEARN_SKILLS)
|
||||||
{
|
{
|
||||||
giveAvailableSkills(Config.AUTO_LEARN_FS_SKILLS, Config.AUTO_LEARN_FP_SKILLS, true);
|
giveAvailableSkills(Config.AUTO_LEARN_FS_SKILLS, Config.AUTO_LEARN_FP_SKILLS, true, Config.AUTO_LEARN_SKILLS_WITHOUT_ITEMS);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -2617,16 +2617,17 @@ public class PlayerInstance extends Playable
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Give all available skills to the player.
|
* Give all available skills to the player.
|
||||||
* @param includedByFs if {@code true} forgotten scroll skills present in the skill tree will be added
|
* @param includeByFs 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 includeByFp 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
|
* @param includeAutoGet if {@code true} auto-get skills present in the skill tree will be added
|
||||||
|
* @param includeRequiredItems if {@code true} skills that have required items will be added
|
||||||
* @return the amount of new skills earned
|
* @return the amount of new skills earned
|
||||||
*/
|
*/
|
||||||
public int giveAvailableSkills(boolean includedByFs, boolean includedByFp, boolean includeAutoGet)
|
public int giveAvailableSkills(boolean includeByFs, boolean includeByFp, boolean includeAutoGet, boolean includeRequiredItems)
|
||||||
{
|
{
|
||||||
int skillCounter = 0;
|
int skillCounter = 0;
|
||||||
// Get available skills
|
// Get available skills
|
||||||
final Collection<Skill> skills = SkillTreeData.getInstance().getAllAvailableSkills(this, getTemplate().getClassId(), includedByFs, includedByFp, includeAutoGet);
|
final Collection<Skill> skills = SkillTreeData.getInstance().getAllAvailableSkills(this, getTemplate().getClassId(), includeByFs, includeByFp, includeAutoGet, includeRequiredItems);
|
||||||
final List<Skill> skillsForStore = new ArrayList<>();
|
final List<Skill> skillsForStore = new ArrayList<>();
|
||||||
for (Skill skill : skills)
|
for (Skill skill : skills)
|
||||||
{
|
{
|
||||||
|
|||||||
+1
-1
@@ -287,7 +287,7 @@ public class CharacterCreate implements IClientIncomingPacket
|
|||||||
newChar.getStat().setLevel(Config.BALTHUS_KNIGHTS_LEVEL);
|
newChar.getStat().setLevel(Config.BALTHUS_KNIGHTS_LEVEL);
|
||||||
if (Config.BALTHUS_KNIGHTS_REWARD_SKILLS)
|
if (Config.BALTHUS_KNIGHTS_REWARD_SKILLS)
|
||||||
{
|
{
|
||||||
newChar.giveAvailableSkills(Config.AUTO_LEARN_FS_SKILLS, Config.AUTO_LEARN_FP_SKILLS, true);
|
newChar.giveAvailableSkills(Config.AUTO_LEARN_FS_SKILLS, Config.AUTO_LEARN_FP_SKILLS, true, Config.AUTO_LEARN_SKILLS_WITHOUT_ITEMS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -114,7 +114,7 @@ public class ExRequestClassChange implements IClientIncomingPacket
|
|||||||
|
|
||||||
if (Config.AUTO_LEARN_SKILLS)
|
if (Config.AUTO_LEARN_SKILLS)
|
||||||
{
|
{
|
||||||
player.giveAvailableSkills(Config.AUTO_LEARN_FS_SKILLS, Config.AUTO_LEARN_FP_SKILLS, true);
|
player.giveAvailableSkills(Config.AUTO_LEARN_FS_SKILLS, Config.AUTO_LEARN_FP_SKILLS, true, Config.AUTO_LEARN_SKILLS_WITHOUT_ITEMS);
|
||||||
}
|
}
|
||||||
|
|
||||||
player.store(false); // Save player cause if server crashes before this char is saved, he will lose class.
|
player.store(false); // Save player cause if server crashes before this char is saved, he will lose class.
|
||||||
|
|||||||
@@ -77,6 +77,10 @@ SkillReuseList =
|
|||||||
# Default: False
|
# Default: False
|
||||||
AutoLearnSkills = False
|
AutoLearnSkills = False
|
||||||
|
|
||||||
|
# Auto learn skills that need items to be learned.
|
||||||
|
# Default: False
|
||||||
|
AutoLearnSkillsWithoutItems = False
|
||||||
|
|
||||||
# If it's true skills from forgotten scrolls will be delivered upon level up and login, require AutoLearnSkills.
|
# If it's true skills from forgotten scrolls will be delivered upon level up and login, require AutoLearnSkills.
|
||||||
# Default: False
|
# Default: False
|
||||||
AutoLearnForgottenScrollSkills = False
|
AutoLearnForgottenScrollSkills = False
|
||||||
|
|||||||
Vendored
+3
-3
@@ -431,7 +431,7 @@ public class ClassMaster extends AbstractNpcAI implements IXmlReader
|
|||||||
|
|
||||||
if (Config.AUTO_LEARN_SKILLS)
|
if (Config.AUTO_LEARN_SKILLS)
|
||||||
{
|
{
|
||||||
player.giveAvailableSkills(Config.AUTO_LEARN_FS_SKILLS, Config.AUTO_LEARN_FP_SKILLS, true);
|
player.giveAvailableSkills(Config.AUTO_LEARN_FS_SKILLS, Config.AUTO_LEARN_FP_SKILLS, true, Config.AUTO_LEARN_SKILLS_WITHOUT_ITEMS);
|
||||||
}
|
}
|
||||||
|
|
||||||
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.store(false); // Save player cause if server crashes before this char is saved, he will lose class and the money payed for class change.
|
||||||
@@ -456,7 +456,7 @@ public class ClassMaster extends AbstractNpcAI implements IXmlReader
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
player.giveAvailableSkills(true, true, true);
|
player.giveAvailableSkills(true, true, true, true);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -873,7 +873,7 @@ public class ClassMaster extends AbstractNpcAI implements IXmlReader
|
|||||||
|
|
||||||
if (Config.AUTO_LEARN_SKILLS)
|
if (Config.AUTO_LEARN_SKILLS)
|
||||||
{
|
{
|
||||||
player.giveAvailableSkills(Config.AUTO_LEARN_FS_SKILLS, Config.AUTO_LEARN_FP_SKILLS, true);
|
player.giveAvailableSkills(Config.AUTO_LEARN_FS_SKILLS, Config.AUTO_LEARN_FP_SKILLS, true, Config.AUTO_LEARN_SKILLS_WITHOUT_ITEMS);
|
||||||
}
|
}
|
||||||
|
|
||||||
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.store(false); // Save player cause if server crashes before this char is saved, he will lose class and the money payed for class change.
|
||||||
|
|||||||
+7
-6
@@ -156,11 +156,11 @@ public class AdminSkill implements IAdminCommandHandler
|
|||||||
}
|
}
|
||||||
else if (command.equals("admin_give_all_skills"))
|
else if (command.equals("admin_give_all_skills"))
|
||||||
{
|
{
|
||||||
adminGiveAllSkills(activeChar, false, false);
|
adminGiveAllSkills(activeChar, false, false, false);
|
||||||
}
|
}
|
||||||
else if (command.equals("admin_give_all_skills_fs"))
|
else if (command.equals("admin_give_all_skills_fs"))
|
||||||
{
|
{
|
||||||
adminGiveAllSkills(activeChar, true, true);
|
adminGiveAllSkills(activeChar, true, true, true);
|
||||||
}
|
}
|
||||||
else if (command.equals("admin_give_clan_skills"))
|
else if (command.equals("admin_give_clan_skills"))
|
||||||
{
|
{
|
||||||
@@ -277,10 +277,11 @@ public class AdminSkill implements IAdminCommandHandler
|
|||||||
/**
|
/**
|
||||||
* This function will give all the skills that the target can learn at his/her level
|
* This function will give all the skills that the target can learn at his/her level
|
||||||
* @param activeChar the player
|
* @param activeChar the player
|
||||||
* @param includedByFs if {@code true} Forgotten Scroll skills will be delivered.
|
* @param includeByFs if {@code true} Forgotten Scroll skills will be delivered.
|
||||||
* @param includedByFp if {@code true} Forgotten Power skills will be delivered.
|
* @param includeByFp if {@code true} Forgotten Power skills will be delivered.
|
||||||
|
* @param includeRequiredItems if {@code true} skills that have required items will be added
|
||||||
*/
|
*/
|
||||||
private void adminGiveAllSkills(PlayerInstance activeChar, boolean includedByFs, boolean includedByFp)
|
private void adminGiveAllSkills(PlayerInstance activeChar, boolean includeByFs, boolean includeByFp, boolean includeRequiredItems)
|
||||||
{
|
{
|
||||||
final WorldObject target = activeChar.getTarget();
|
final WorldObject target = activeChar.getTarget();
|
||||||
if ((target == null) || !target.isPlayer())
|
if ((target == null) || !target.isPlayer())
|
||||||
@@ -290,7 +291,7 @@ public class AdminSkill implements IAdminCommandHandler
|
|||||||
}
|
}
|
||||||
final PlayerInstance player = target.getActingPlayer();
|
final PlayerInstance player = target.getActingPlayer();
|
||||||
// Notify player and admin
|
// Notify player and admin
|
||||||
BuilderUtil.sendSysMessage(activeChar, "You gave " + player.giveAvailableSkills(includedByFs, includedByFp, true) + " skills to " + player.getName());
|
BuilderUtil.sendSysMessage(activeChar, "You gave " + player.giveAvailableSkills(includeByFs, includeByFp, true, includeRequiredItems) + " skills to " + player.getName());
|
||||||
player.sendSkillList();
|
player.sendSkillList();
|
||||||
player.sendPacket(new AcquireSkillList(player));
|
player.sendPacket(new AcquireSkillList(player));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -179,6 +179,7 @@ public class Config
|
|||||||
public static boolean ENABLE_MODIFY_SKILL_REUSE;
|
public static boolean ENABLE_MODIFY_SKILL_REUSE;
|
||||||
public static Map<Integer, Integer> SKILL_REUSE_LIST;
|
public static Map<Integer, Integer> SKILL_REUSE_LIST;
|
||||||
public static boolean AUTO_LEARN_SKILLS;
|
public static boolean AUTO_LEARN_SKILLS;
|
||||||
|
public static boolean AUTO_LEARN_SKILLS_WITHOUT_ITEMS;
|
||||||
public static boolean AUTO_LEARN_FS_SKILLS;
|
public static boolean AUTO_LEARN_FS_SKILLS;
|
||||||
public static boolean AUTO_LEARN_FP_SKILLS;
|
public static boolean AUTO_LEARN_FP_SKILLS;
|
||||||
public static boolean AUTO_LOOT_HERBS;
|
public static boolean AUTO_LOOT_HERBS;
|
||||||
@@ -1775,6 +1776,7 @@ public class Config
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
AUTO_LEARN_SKILLS = Character.getBoolean("AutoLearnSkills", false);
|
AUTO_LEARN_SKILLS = Character.getBoolean("AutoLearnSkills", false);
|
||||||
|
AUTO_LEARN_SKILLS_WITHOUT_ITEMS = Character.getBoolean("AutoLearnSkillsWithoutItems", false);
|
||||||
AUTO_LEARN_FS_SKILLS = Character.getBoolean("AutoLearnForgottenScrollSkills", false);
|
AUTO_LEARN_FS_SKILLS = Character.getBoolean("AutoLearnForgottenScrollSkills", false);
|
||||||
AUTO_LEARN_FP_SKILLS = Character.getBoolean("AutoLearnForgottenPowerSkills", false);
|
AUTO_LEARN_FP_SKILLS = Character.getBoolean("AutoLearnForgottenPowerSkills", false);
|
||||||
AUTO_LOOT_HERBS = Character.getBoolean("AutoLootHerbs", false);
|
AUTO_LOOT_HERBS = Character.getBoolean("AutoLootHerbs", false);
|
||||||
|
|||||||
+17
-2
@@ -731,7 +731,17 @@ public class SkillTreeData implements IXmlReader
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Collection<Skill> getAllAvailableSkills(PlayerInstance player, ClassId classId, boolean includeByFs, boolean includeByFp, boolean includeAutoGet)
|
/**
|
||||||
|
* Used by auto learn configuration.
|
||||||
|
* @param player
|
||||||
|
* @param classId
|
||||||
|
* @param includeByFs if {@code true} forgotten scroll skills present in the skill tree will be added
|
||||||
|
* @param includeByFp 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
|
||||||
|
* @param includeRequiredItems if {@code true} skills that have required items will be added
|
||||||
|
* @return a list of auto learnable skills for the player.
|
||||||
|
*/
|
||||||
|
public Collection<Skill> getAllAvailableSkills(PlayerInstance player, ClassId classId, boolean includeByFs, boolean includeByFp, boolean includeAutoGet, boolean includeRequiredItems)
|
||||||
{
|
{
|
||||||
// Get available skills
|
// Get available skills
|
||||||
final PlayerSkillHolder holder = new PlayerSkillHolder(player);
|
final PlayerSkillHolder holder = new PlayerSkillHolder(player);
|
||||||
@@ -751,8 +761,13 @@ public class SkillTreeData implements IXmlReader
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (SkillLearn skillLearn : learnable)
|
SEARCH: for (SkillLearn skillLearn : learnable)
|
||||||
{
|
{
|
||||||
|
if (!includeRequiredItems && !skillLearn.getRequiredItems().isEmpty())
|
||||||
|
{
|
||||||
|
continue SEARCH;
|
||||||
|
}
|
||||||
|
|
||||||
final Skill skill = SkillData.getInstance().getSkill(skillLearn.getSkillId(), skillLearn.getSkillLevel());
|
final Skill skill = SkillData.getInstance().getSkill(skillLearn.getSkillId(), skillLearn.getSkillLevel());
|
||||||
// Cleanup skills that has to be removed
|
// Cleanup skills that has to be removed
|
||||||
for (int skillId : skillLearn.getRemoveSkills())
|
for (int skillId : skillLearn.getRemoveSkills())
|
||||||
|
|||||||
+6
-5
@@ -2574,7 +2574,7 @@ public class PlayerInstance extends Playable
|
|||||||
// Give all normal skills if activated Auto-Learn is activated, included AutoGet skills.
|
// Give all normal skills if activated Auto-Learn is activated, included AutoGet skills.
|
||||||
if (Config.AUTO_LEARN_SKILLS)
|
if (Config.AUTO_LEARN_SKILLS)
|
||||||
{
|
{
|
||||||
giveAvailableSkills(Config.AUTO_LEARN_FS_SKILLS, Config.AUTO_LEARN_FP_SKILLS, true);
|
giveAvailableSkills(Config.AUTO_LEARN_FS_SKILLS, Config.AUTO_LEARN_FP_SKILLS, true, Config.AUTO_LEARN_SKILLS_WITHOUT_ITEMS);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -2634,16 +2634,17 @@ public class PlayerInstance extends Playable
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Give all available skills to the player.
|
* Give all available skills to the player.
|
||||||
* @param includedByFs if {@code true} forgotten scroll skills present in the skill tree will be added
|
* @param includeByFs 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 includeByFp 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
|
* @param includeAutoGet if {@code true} auto-get skills present in the skill tree will be added
|
||||||
|
* @param includeRequiredItems if {@code true} skills that have required items will be added
|
||||||
* @return the amount of new skills earned
|
* @return the amount of new skills earned
|
||||||
*/
|
*/
|
||||||
public int giveAvailableSkills(boolean includedByFs, boolean includedByFp, boolean includeAutoGet)
|
public int giveAvailableSkills(boolean includeByFs, boolean includeByFp, boolean includeAutoGet, boolean includeRequiredItems)
|
||||||
{
|
{
|
||||||
int skillCounter = 0;
|
int skillCounter = 0;
|
||||||
// Get available skills
|
// Get available skills
|
||||||
final Collection<Skill> skills = SkillTreeData.getInstance().getAllAvailableSkills(this, getTemplate().getClassId(), includedByFs, includedByFp, includeAutoGet);
|
final Collection<Skill> skills = SkillTreeData.getInstance().getAllAvailableSkills(this, getTemplate().getClassId(), includeByFs, includeByFp, includeAutoGet, includeRequiredItems);
|
||||||
final List<Skill> skillsForStore = new ArrayList<>();
|
final List<Skill> skillsForStore = new ArrayList<>();
|
||||||
for (Skill skill : skills)
|
for (Skill skill : skills)
|
||||||
{
|
{
|
||||||
|
|||||||
+1
-1
@@ -287,7 +287,7 @@ public class CharacterCreate implements IClientIncomingPacket
|
|||||||
newChar.getStat().setLevel(Config.BALTHUS_KNIGHTS_LEVEL);
|
newChar.getStat().setLevel(Config.BALTHUS_KNIGHTS_LEVEL);
|
||||||
if (Config.BALTHUS_KNIGHTS_REWARD_SKILLS)
|
if (Config.BALTHUS_KNIGHTS_REWARD_SKILLS)
|
||||||
{
|
{
|
||||||
newChar.giveAvailableSkills(Config.AUTO_LEARN_FS_SKILLS, Config.AUTO_LEARN_FP_SKILLS, true);
|
newChar.giveAvailableSkills(Config.AUTO_LEARN_FS_SKILLS, Config.AUTO_LEARN_FP_SKILLS, true, Config.AUTO_LEARN_SKILLS_WITHOUT_ITEMS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -114,7 +114,7 @@ public class ExRequestClassChange implements IClientIncomingPacket
|
|||||||
|
|
||||||
if (Config.AUTO_LEARN_SKILLS)
|
if (Config.AUTO_LEARN_SKILLS)
|
||||||
{
|
{
|
||||||
player.giveAvailableSkills(Config.AUTO_LEARN_FS_SKILLS, Config.AUTO_LEARN_FP_SKILLS, true);
|
player.giveAvailableSkills(Config.AUTO_LEARN_FS_SKILLS, Config.AUTO_LEARN_FP_SKILLS, true, Config.AUTO_LEARN_SKILLS_WITHOUT_ITEMS);
|
||||||
}
|
}
|
||||||
|
|
||||||
player.store(false); // Save player cause if server crashes before this char is saved, he will lose class.
|
player.store(false); // Save player cause if server crashes before this char is saved, he will lose class.
|
||||||
|
|||||||
@@ -77,6 +77,10 @@ SkillReuseList =
|
|||||||
# Default: False
|
# Default: False
|
||||||
AutoLearnSkills = False
|
AutoLearnSkills = False
|
||||||
|
|
||||||
|
# Auto learn skills that need items to be learned.
|
||||||
|
# Default: False
|
||||||
|
AutoLearnSkillsWithoutItems = False
|
||||||
|
|
||||||
# If it's true skills from forgotten scrolls will be delivered upon level up and login, require AutoLearnSkills.
|
# If it's true skills from forgotten scrolls will be delivered upon level up and login, require AutoLearnSkills.
|
||||||
# Default: False
|
# Default: False
|
||||||
AutoLearnForgottenScrollSkills = False
|
AutoLearnForgottenScrollSkills = False
|
||||||
|
|||||||
+3
-3
@@ -431,7 +431,7 @@ public class ClassMaster extends AbstractNpcAI implements IXmlReader
|
|||||||
|
|
||||||
if (Config.AUTO_LEARN_SKILLS)
|
if (Config.AUTO_LEARN_SKILLS)
|
||||||
{
|
{
|
||||||
player.giveAvailableSkills(Config.AUTO_LEARN_FS_SKILLS, Config.AUTO_LEARN_FP_SKILLS, true);
|
player.giveAvailableSkills(Config.AUTO_LEARN_FS_SKILLS, Config.AUTO_LEARN_FP_SKILLS, true, Config.AUTO_LEARN_SKILLS_WITHOUT_ITEMS);
|
||||||
}
|
}
|
||||||
|
|
||||||
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.store(false); // Save player cause if server crashes before this char is saved, he will lose class and the money payed for class change.
|
||||||
@@ -456,7 +456,7 @@ public class ClassMaster extends AbstractNpcAI implements IXmlReader
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
player.giveAvailableSkills(true, true, true);
|
player.giveAvailableSkills(true, true, true, true);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -873,7 +873,7 @@ public class ClassMaster extends AbstractNpcAI implements IXmlReader
|
|||||||
|
|
||||||
if (Config.AUTO_LEARN_SKILLS)
|
if (Config.AUTO_LEARN_SKILLS)
|
||||||
{
|
{
|
||||||
player.giveAvailableSkills(Config.AUTO_LEARN_FS_SKILLS, Config.AUTO_LEARN_FP_SKILLS, true);
|
player.giveAvailableSkills(Config.AUTO_LEARN_FS_SKILLS, Config.AUTO_LEARN_FP_SKILLS, true, Config.AUTO_LEARN_SKILLS_WITHOUT_ITEMS);
|
||||||
}
|
}
|
||||||
|
|
||||||
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.store(false); // Save player cause if server crashes before this char is saved, he will lose class and the money payed for class change.
|
||||||
|
|||||||
Vendored
+7
-6
@@ -156,11 +156,11 @@ public class AdminSkill implements IAdminCommandHandler
|
|||||||
}
|
}
|
||||||
else if (command.equals("admin_give_all_skills"))
|
else if (command.equals("admin_give_all_skills"))
|
||||||
{
|
{
|
||||||
adminGiveAllSkills(activeChar, false, false);
|
adminGiveAllSkills(activeChar, false, false, false);
|
||||||
}
|
}
|
||||||
else if (command.equals("admin_give_all_skills_fs"))
|
else if (command.equals("admin_give_all_skills_fs"))
|
||||||
{
|
{
|
||||||
adminGiveAllSkills(activeChar, true, true);
|
adminGiveAllSkills(activeChar, true, true, true);
|
||||||
}
|
}
|
||||||
else if (command.equals("admin_give_clan_skills"))
|
else if (command.equals("admin_give_clan_skills"))
|
||||||
{
|
{
|
||||||
@@ -277,10 +277,11 @@ public class AdminSkill implements IAdminCommandHandler
|
|||||||
/**
|
/**
|
||||||
* This function will give all the skills that the target can learn at his/her level
|
* This function will give all the skills that the target can learn at his/her level
|
||||||
* @param activeChar the player
|
* @param activeChar the player
|
||||||
* @param includedByFs if {@code true} Forgotten Scroll skills will be delivered.
|
* @param includeByFs if {@code true} Forgotten Scroll skills will be delivered.
|
||||||
* @param includedByFp if {@code true} Forgotten Power skills will be delivered.
|
* @param includeByFp if {@code true} Forgotten Power skills will be delivered.
|
||||||
|
* @param includeRequiredItems if {@code true} skills that have required items will be added
|
||||||
*/
|
*/
|
||||||
private void adminGiveAllSkills(PlayerInstance activeChar, boolean includedByFs, boolean includedByFp)
|
private void adminGiveAllSkills(PlayerInstance activeChar, boolean includeByFs, boolean includeByFp, boolean includeRequiredItems)
|
||||||
{
|
{
|
||||||
final WorldObject target = activeChar.getTarget();
|
final WorldObject target = activeChar.getTarget();
|
||||||
if ((target == null) || !target.isPlayer())
|
if ((target == null) || !target.isPlayer())
|
||||||
@@ -290,7 +291,7 @@ public class AdminSkill implements IAdminCommandHandler
|
|||||||
}
|
}
|
||||||
final PlayerInstance player = target.getActingPlayer();
|
final PlayerInstance player = target.getActingPlayer();
|
||||||
// Notify player and admin
|
// Notify player and admin
|
||||||
BuilderUtil.sendSysMessage(activeChar, "You gave " + player.giveAvailableSkills(includedByFs, includedByFp, true) + " skills to " + player.getName());
|
BuilderUtil.sendSysMessage(activeChar, "You gave " + player.giveAvailableSkills(includeByFs, includeByFp, true, includeRequiredItems) + " skills to " + player.getName());
|
||||||
player.sendSkillList();
|
player.sendSkillList();
|
||||||
player.sendPacket(new AcquireSkillList(player));
|
player.sendPacket(new AcquireSkillList(player));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -179,6 +179,7 @@ public class Config
|
|||||||
public static boolean ENABLE_MODIFY_SKILL_REUSE;
|
public static boolean ENABLE_MODIFY_SKILL_REUSE;
|
||||||
public static Map<Integer, Integer> SKILL_REUSE_LIST;
|
public static Map<Integer, Integer> SKILL_REUSE_LIST;
|
||||||
public static boolean AUTO_LEARN_SKILLS;
|
public static boolean AUTO_LEARN_SKILLS;
|
||||||
|
public static boolean AUTO_LEARN_SKILLS_WITHOUT_ITEMS;
|
||||||
public static boolean AUTO_LEARN_FS_SKILLS;
|
public static boolean AUTO_LEARN_FS_SKILLS;
|
||||||
public static boolean AUTO_LEARN_FP_SKILLS;
|
public static boolean AUTO_LEARN_FP_SKILLS;
|
||||||
public static boolean AUTO_LOOT_HERBS;
|
public static boolean AUTO_LOOT_HERBS;
|
||||||
@@ -1775,6 +1776,7 @@ public class Config
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
AUTO_LEARN_SKILLS = Character.getBoolean("AutoLearnSkills", false);
|
AUTO_LEARN_SKILLS = Character.getBoolean("AutoLearnSkills", false);
|
||||||
|
AUTO_LEARN_SKILLS_WITHOUT_ITEMS = Character.getBoolean("AutoLearnSkillsWithoutItems", false);
|
||||||
AUTO_LEARN_FS_SKILLS = Character.getBoolean("AutoLearnForgottenScrollSkills", false);
|
AUTO_LEARN_FS_SKILLS = Character.getBoolean("AutoLearnForgottenScrollSkills", false);
|
||||||
AUTO_LEARN_FP_SKILLS = Character.getBoolean("AutoLearnForgottenPowerSkills", false);
|
AUTO_LEARN_FP_SKILLS = Character.getBoolean("AutoLearnForgottenPowerSkills", false);
|
||||||
AUTO_LOOT_HERBS = Character.getBoolean("AutoLootHerbs", false);
|
AUTO_LOOT_HERBS = Character.getBoolean("AutoLootHerbs", false);
|
||||||
|
|||||||
+17
-2
@@ -731,7 +731,17 @@ public class SkillTreeData implements IXmlReader
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Collection<Skill> getAllAvailableSkills(PlayerInstance player, ClassId classId, boolean includeByFs, boolean includeByFp, boolean includeAutoGet)
|
/**
|
||||||
|
* Used by auto learn configuration.
|
||||||
|
* @param player
|
||||||
|
* @param classId
|
||||||
|
* @param includeByFs if {@code true} forgotten scroll skills present in the skill tree will be added
|
||||||
|
* @param includeByFp 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
|
||||||
|
* @param includeRequiredItems if {@code true} skills that have required items will be added
|
||||||
|
* @return a list of auto learnable skills for the player.
|
||||||
|
*/
|
||||||
|
public Collection<Skill> getAllAvailableSkills(PlayerInstance player, ClassId classId, boolean includeByFs, boolean includeByFp, boolean includeAutoGet, boolean includeRequiredItems)
|
||||||
{
|
{
|
||||||
// Get available skills
|
// Get available skills
|
||||||
final PlayerSkillHolder holder = new PlayerSkillHolder(player);
|
final PlayerSkillHolder holder = new PlayerSkillHolder(player);
|
||||||
@@ -751,8 +761,13 @@ public class SkillTreeData implements IXmlReader
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (SkillLearn skillLearn : learnable)
|
SEARCH: for (SkillLearn skillLearn : learnable)
|
||||||
{
|
{
|
||||||
|
if (!includeRequiredItems && !skillLearn.getRequiredItems().isEmpty())
|
||||||
|
{
|
||||||
|
continue SEARCH;
|
||||||
|
}
|
||||||
|
|
||||||
final Skill skill = SkillData.getInstance().getSkill(skillLearn.getSkillId(), skillLearn.getSkillLevel());
|
final Skill skill = SkillData.getInstance().getSkill(skillLearn.getSkillId(), skillLearn.getSkillLevel());
|
||||||
// Cleanup skills that has to be removed
|
// Cleanup skills that has to be removed
|
||||||
for (int skillId : skillLearn.getRemoveSkills())
|
for (int skillId : skillLearn.getRemoveSkills())
|
||||||
|
|||||||
+6
-5
@@ -2575,7 +2575,7 @@ public class PlayerInstance extends Playable
|
|||||||
// Give all normal skills if activated Auto-Learn is activated, included AutoGet skills.
|
// Give all normal skills if activated Auto-Learn is activated, included AutoGet skills.
|
||||||
if (Config.AUTO_LEARN_SKILLS)
|
if (Config.AUTO_LEARN_SKILLS)
|
||||||
{
|
{
|
||||||
giveAvailableSkills(Config.AUTO_LEARN_FS_SKILLS, Config.AUTO_LEARN_FP_SKILLS, true);
|
giveAvailableSkills(Config.AUTO_LEARN_FS_SKILLS, Config.AUTO_LEARN_FP_SKILLS, true, Config.AUTO_LEARN_SKILLS_WITHOUT_ITEMS);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -2635,16 +2635,17 @@ public class PlayerInstance extends Playable
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Give all available skills to the player.
|
* Give all available skills to the player.
|
||||||
* @param includedByFs if {@code true} forgotten scroll skills present in the skill tree will be added
|
* @param includeByFs 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 includeByFp 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
|
* @param includeAutoGet if {@code true} auto-get skills present in the skill tree will be added
|
||||||
|
* @param includeRequiredItems if {@code true} skills that have required items will be added
|
||||||
* @return the amount of new skills earned
|
* @return the amount of new skills earned
|
||||||
*/
|
*/
|
||||||
public int giveAvailableSkills(boolean includedByFs, boolean includedByFp, boolean includeAutoGet)
|
public int giveAvailableSkills(boolean includeByFs, boolean includeByFp, boolean includeAutoGet, boolean includeRequiredItems)
|
||||||
{
|
{
|
||||||
int skillCounter = 0;
|
int skillCounter = 0;
|
||||||
// Get available skills
|
// Get available skills
|
||||||
final Collection<Skill> skills = SkillTreeData.getInstance().getAllAvailableSkills(this, getTemplate().getClassId(), includedByFs, includedByFp, includeAutoGet);
|
final Collection<Skill> skills = SkillTreeData.getInstance().getAllAvailableSkills(this, getTemplate().getClassId(), includeByFs, includeByFp, includeAutoGet, includeRequiredItems);
|
||||||
final List<Skill> skillsForStore = new ArrayList<>();
|
final List<Skill> skillsForStore = new ArrayList<>();
|
||||||
for (Skill skill : skills)
|
for (Skill skill : skills)
|
||||||
{
|
{
|
||||||
|
|||||||
+1
-1
@@ -287,7 +287,7 @@ public class CharacterCreate implements IClientIncomingPacket
|
|||||||
newChar.getStat().setLevel(Config.BALTHUS_KNIGHTS_LEVEL);
|
newChar.getStat().setLevel(Config.BALTHUS_KNIGHTS_LEVEL);
|
||||||
if (Config.BALTHUS_KNIGHTS_REWARD_SKILLS)
|
if (Config.BALTHUS_KNIGHTS_REWARD_SKILLS)
|
||||||
{
|
{
|
||||||
newChar.giveAvailableSkills(Config.AUTO_LEARN_FS_SKILLS, Config.AUTO_LEARN_FP_SKILLS, true);
|
newChar.giveAvailableSkills(Config.AUTO_LEARN_FS_SKILLS, Config.AUTO_LEARN_FP_SKILLS, true, Config.AUTO_LEARN_SKILLS_WITHOUT_ITEMS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -114,7 +114,7 @@ public class ExRequestClassChange implements IClientIncomingPacket
|
|||||||
|
|
||||||
if (Config.AUTO_LEARN_SKILLS)
|
if (Config.AUTO_LEARN_SKILLS)
|
||||||
{
|
{
|
||||||
player.giveAvailableSkills(Config.AUTO_LEARN_FS_SKILLS, Config.AUTO_LEARN_FP_SKILLS, true);
|
player.giveAvailableSkills(Config.AUTO_LEARN_FS_SKILLS, Config.AUTO_LEARN_FP_SKILLS, true, Config.AUTO_LEARN_SKILLS_WITHOUT_ITEMS);
|
||||||
}
|
}
|
||||||
|
|
||||||
player.store(false); // Save player cause if server crashes before this char is saved, he will lose class.
|
player.store(false); // Save player cause if server crashes before this char is saved, he will lose class.
|
||||||
|
|||||||
@@ -90,6 +90,10 @@ SkillReuseList =
|
|||||||
# Default: False
|
# Default: False
|
||||||
AutoLearnSkills = False
|
AutoLearnSkills = False
|
||||||
|
|
||||||
|
# Auto learn skills that need items to be learned.
|
||||||
|
# Default: False
|
||||||
|
AutoLearnSkillsWithoutItems = False
|
||||||
|
|
||||||
# If it's true skills from forgotten scrolls will be delivered upon level up and login, require AutoLearnSkills.
|
# If it's true skills from forgotten scrolls will be delivered upon level up and login, require AutoLearnSkills.
|
||||||
# Default: False
|
# Default: False
|
||||||
AutoLearnForgottenScrollSkills = False
|
AutoLearnForgottenScrollSkills = False
|
||||||
|
|||||||
Vendored
+6
-5
@@ -152,11 +152,11 @@ public class AdminSkill implements IAdminCommandHandler
|
|||||||
}
|
}
|
||||||
else if (command.equals("admin_give_all_skills"))
|
else if (command.equals("admin_give_all_skills"))
|
||||||
{
|
{
|
||||||
adminGiveAllSkills(activeChar, false);
|
adminGiveAllSkills(activeChar, false, false);
|
||||||
}
|
}
|
||||||
else if (command.equals("admin_give_all_skills_fs"))
|
else if (command.equals("admin_give_all_skills_fs"))
|
||||||
{
|
{
|
||||||
adminGiveAllSkills(activeChar, true);
|
adminGiveAllSkills(activeChar, true, true);
|
||||||
}
|
}
|
||||||
else if (command.equals("admin_give_clan_skills"))
|
else if (command.equals("admin_give_clan_skills"))
|
||||||
{
|
{
|
||||||
@@ -212,9 +212,10 @@ public class AdminSkill implements IAdminCommandHandler
|
|||||||
/**
|
/**
|
||||||
* This function will give all the skills that the target can learn at his/her level
|
* This function will give all the skills that the target can learn at his/her level
|
||||||
* @param activeChar the player
|
* @param activeChar the player
|
||||||
* @param includedByFs if {@code true} Forgotten Scroll skills will be delivered.
|
* @param includeByFs if {@code true} Forgotten Scroll skills will be delivered.
|
||||||
|
* @param includeRequiredItems if {@code true} skills that have required items will be added
|
||||||
*/
|
*/
|
||||||
private void adminGiveAllSkills(PlayerInstance activeChar, boolean includedByFs)
|
private void adminGiveAllSkills(PlayerInstance activeChar, boolean includeByFs, boolean includeRequiredItems)
|
||||||
{
|
{
|
||||||
final WorldObject target = activeChar.getTarget();
|
final WorldObject target = activeChar.getTarget();
|
||||||
if ((target == null) || !target.isPlayer())
|
if ((target == null) || !target.isPlayer())
|
||||||
@@ -224,7 +225,7 @@ public class AdminSkill implements IAdminCommandHandler
|
|||||||
}
|
}
|
||||||
final PlayerInstance player = target.getActingPlayer();
|
final PlayerInstance player = target.getActingPlayer();
|
||||||
// Notify player and admin
|
// Notify player and admin
|
||||||
BuilderUtil.sendSysMessage(activeChar, "You gave " + player.giveAvailableSkills(includedByFs, true) + " skills to " + player.getName());
|
BuilderUtil.sendSysMessage(activeChar, "You gave " + player.giveAvailableSkills(includeByFs, true, includeRequiredItems) + " skills to " + player.getName());
|
||||||
player.sendSkillList();
|
player.sendSkillList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -162,6 +162,7 @@ public class Config
|
|||||||
public static boolean ENABLE_MODIFY_SKILL_REUSE;
|
public static boolean ENABLE_MODIFY_SKILL_REUSE;
|
||||||
public static Map<Integer, Integer> SKILL_REUSE_LIST;
|
public static Map<Integer, Integer> SKILL_REUSE_LIST;
|
||||||
public static boolean AUTO_LEARN_SKILLS;
|
public static boolean AUTO_LEARN_SKILLS;
|
||||||
|
public static boolean AUTO_LEARN_SKILLS_WITHOUT_ITEMS;
|
||||||
public static boolean AUTO_LEARN_FS_SKILLS;
|
public static boolean AUTO_LEARN_FS_SKILLS;
|
||||||
public static boolean AUTO_LOOT_HERBS;
|
public static boolean AUTO_LOOT_HERBS;
|
||||||
public static byte BUFFS_MAX_AMOUNT;
|
public static byte BUFFS_MAX_AMOUNT;
|
||||||
@@ -1744,6 +1745,7 @@ public class Config
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
AUTO_LEARN_SKILLS = Character.getBoolean("AutoLearnSkills", false);
|
AUTO_LEARN_SKILLS = Character.getBoolean("AutoLearnSkills", false);
|
||||||
|
AUTO_LEARN_SKILLS_WITHOUT_ITEMS = Character.getBoolean("AutoLearnSkillsWithoutItems", false);
|
||||||
AUTO_LEARN_FS_SKILLS = Character.getBoolean("AutoLearnForgottenScrollSkills", false);
|
AUTO_LEARN_FS_SKILLS = Character.getBoolean("AutoLearnForgottenScrollSkills", false);
|
||||||
AUTO_LOOT_HERBS = Character.getBoolean("AutoLootHerbs", false);
|
AUTO_LOOT_HERBS = Character.getBoolean("AutoLootHerbs", false);
|
||||||
BUFFS_MAX_AMOUNT = Character.getByte("MaxBuffAmount", (byte) 20);
|
BUFFS_MAX_AMOUNT = Character.getByte("MaxBuffAmount", (byte) 20);
|
||||||
|
|||||||
+19
-5
@@ -558,17 +558,31 @@ public class SkillTreeData implements IXmlReader
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Collection<Skill> getAllAvailableSkills(PlayerInstance player, ClassId classId, boolean includeByFs, boolean includeAutoGet)
|
/**
|
||||||
|
* Used by auto learn configuration.
|
||||||
|
* @param player
|
||||||
|
* @param classId
|
||||||
|
* @param includeByFs if {@code true} forgotten scroll 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
|
||||||
|
* @param includeRequiredItems if {@code true} skills that have required items will be added
|
||||||
|
* @return a list of auto learnable skills for the player.
|
||||||
|
*/
|
||||||
|
public Collection<Skill> getAllAvailableSkills(PlayerInstance player, ClassId classId, boolean includeByFs, boolean includeAutoGet, boolean includeRequiredItems)
|
||||||
{
|
{
|
||||||
// Get available skills
|
// Get available skills
|
||||||
final PlayerSkillHolder holder = new PlayerSkillHolder(player);
|
final PlayerSkillHolder holder = new PlayerSkillHolder(player);
|
||||||
List<SkillLearn> learnable = getAvailableSkills(player, classId, includeByFs, includeAutoGet, holder);
|
List<SkillLearn> learnable = getAvailableSkills(player, classId, includeByFs, includeAutoGet, holder);
|
||||||
while (!learnable.isEmpty())
|
for (int i = 0; i < 1000; i++) // Infinite loop warning
|
||||||
{
|
{
|
||||||
for (SkillLearn s : learnable)
|
SEARCH: for (SkillLearn skillLearn : learnable)
|
||||||
{
|
{
|
||||||
final Skill sk = SkillData.getInstance().getSkill(s.getSkillId(), s.getSkillLevel());
|
if (!includeRequiredItems && !skillLearn.getRequiredItems().isEmpty())
|
||||||
holder.addSkill(sk);
|
{
|
||||||
|
continue SEARCH;
|
||||||
|
}
|
||||||
|
|
||||||
|
final Skill skill = SkillData.getInstance().getSkill(skillLearn.getSkillId(), skillLearn.getSkillLevel());
|
||||||
|
holder.addSkill(skill);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get new available skills, some skills depend of previous skills to be available.
|
// Get new available skills, some skills depend of previous skills to be available.
|
||||||
|
|||||||
+1
-1
@@ -104,7 +104,7 @@ public class ClassMasterInstance extends MerchantInstance
|
|||||||
}
|
}
|
||||||
else if (command.startsWith("learn_skills"))
|
else if (command.startsWith("learn_skills"))
|
||||||
{
|
{
|
||||||
player.giveAvailableSkills(Config.AUTO_LEARN_FS_SKILLS, true);
|
player.giveAvailableSkills(Config.AUTO_LEARN_FS_SKILLS, true, Config.AUTO_LEARN_SKILLS_WITHOUT_ITEMS);
|
||||||
}
|
}
|
||||||
else if (command.startsWith("increase_clan_level"))
|
else if (command.startsWith("increase_clan_level"))
|
||||||
{
|
{
|
||||||
|
|||||||
+5
-4
@@ -2628,7 +2628,7 @@ public class PlayerInstance extends Playable
|
|||||||
// Give all normal skills if activated Auto-Learn is activated, included AutoGet skills.
|
// Give all normal skills if activated Auto-Learn is activated, included AutoGet skills.
|
||||||
if (Config.AUTO_LEARN_SKILLS)
|
if (Config.AUTO_LEARN_SKILLS)
|
||||||
{
|
{
|
||||||
giveAvailableSkills(Config.AUTO_LEARN_FS_SKILLS, true);
|
giveAvailableSkills(Config.AUTO_LEARN_FS_SKILLS, true, Config.AUTO_LEARN_SKILLS_WITHOUT_ITEMS);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -2691,15 +2691,16 @@ public class PlayerInstance extends Playable
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Give all available skills to the player.
|
* Give all available skills to the player.
|
||||||
* @param includedByFs if {@code true} forgotten scroll skills present in the skill tree will be added
|
* @param includeByFs if {@code true} forgotten scroll 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
|
* @param includeAutoGet if {@code true} auto-get skills present in the skill tree will be added
|
||||||
|
* @param includeRequiredItems if {@code true} skills that have required items will be added
|
||||||
* @return the amount of new skills earned
|
* @return the amount of new skills earned
|
||||||
*/
|
*/
|
||||||
public int giveAvailableSkills(boolean includedByFs, boolean includeAutoGet)
|
public int giveAvailableSkills(boolean includeByFs, boolean includeAutoGet, boolean includeRequiredItems)
|
||||||
{
|
{
|
||||||
int skillCounter = 0;
|
int skillCounter = 0;
|
||||||
// Get available skills.
|
// Get available skills.
|
||||||
final Collection<Skill> skills = SkillTreeData.getInstance().getAllAvailableSkills(this, getClassId(), includedByFs, includeAutoGet);
|
final Collection<Skill> skills = SkillTreeData.getInstance().getAllAvailableSkills(this, getClassId(), includeByFs, includeAutoGet, includeRequiredItems);
|
||||||
final List<Skill> skillsForStore = new ArrayList<>();
|
final List<Skill> skillsForStore = new ArrayList<>();
|
||||||
for (Skill sk : skills)
|
for (Skill sk : skills)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -90,6 +90,10 @@ SkillReuseList =
|
|||||||
# Default: False
|
# Default: False
|
||||||
AutoLearnSkills = False
|
AutoLearnSkills = False
|
||||||
|
|
||||||
|
# Auto learn skills that need items to be learned.
|
||||||
|
# Default: False
|
||||||
|
AutoLearnSkillsWithoutItems = False
|
||||||
|
|
||||||
# If it's true skills from forgotten scrolls will be delivered upon level up and login, require AutoLearnSkills.
|
# If it's true skills from forgotten scrolls will be delivered upon level up and login, require AutoLearnSkills.
|
||||||
# Default: False
|
# Default: False
|
||||||
AutoLearnForgottenScrollSkills = False
|
AutoLearnForgottenScrollSkills = False
|
||||||
|
|||||||
Vendored
+6
-5
@@ -152,11 +152,11 @@ public class AdminSkill implements IAdminCommandHandler
|
|||||||
}
|
}
|
||||||
else if (command.equals("admin_give_all_skills"))
|
else if (command.equals("admin_give_all_skills"))
|
||||||
{
|
{
|
||||||
adminGiveAllSkills(activeChar, false);
|
adminGiveAllSkills(activeChar, false, false);
|
||||||
}
|
}
|
||||||
else if (command.equals("admin_give_all_skills_fs"))
|
else if (command.equals("admin_give_all_skills_fs"))
|
||||||
{
|
{
|
||||||
adminGiveAllSkills(activeChar, true);
|
adminGiveAllSkills(activeChar, true, true);
|
||||||
}
|
}
|
||||||
else if (command.equals("admin_give_clan_skills"))
|
else if (command.equals("admin_give_clan_skills"))
|
||||||
{
|
{
|
||||||
@@ -212,9 +212,10 @@ public class AdminSkill implements IAdminCommandHandler
|
|||||||
/**
|
/**
|
||||||
* This function will give all the skills that the target can learn at his/her level
|
* This function will give all the skills that the target can learn at his/her level
|
||||||
* @param activeChar the player
|
* @param activeChar the player
|
||||||
* @param includedByFs if {@code true} Forgotten Scroll skills will be delivered.
|
* @param includeByFs if {@code true} Forgotten Scroll skills will be delivered.
|
||||||
|
* @param includeRequiredItems if {@code true} skills that have required items will be added
|
||||||
*/
|
*/
|
||||||
private void adminGiveAllSkills(PlayerInstance activeChar, boolean includedByFs)
|
private void adminGiveAllSkills(PlayerInstance activeChar, boolean includeByFs, boolean includeRequiredItems)
|
||||||
{
|
{
|
||||||
final WorldObject target = activeChar.getTarget();
|
final WorldObject target = activeChar.getTarget();
|
||||||
if ((target == null) || !target.isPlayer())
|
if ((target == null) || !target.isPlayer())
|
||||||
@@ -224,7 +225,7 @@ public class AdminSkill implements IAdminCommandHandler
|
|||||||
}
|
}
|
||||||
final PlayerInstance player = target.getActingPlayer();
|
final PlayerInstance player = target.getActingPlayer();
|
||||||
// Notify player and admin
|
// Notify player and admin
|
||||||
BuilderUtil.sendSysMessage(activeChar, "You gave " + player.giveAvailableSkills(includedByFs, true) + " skills to " + player.getName());
|
BuilderUtil.sendSysMessage(activeChar, "You gave " + player.giveAvailableSkills(includeByFs, true, includeRequiredItems) + " skills to " + player.getName());
|
||||||
player.sendSkillList();
|
player.sendSkillList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -162,6 +162,7 @@ public class Config
|
|||||||
public static boolean ENABLE_MODIFY_SKILL_REUSE;
|
public static boolean ENABLE_MODIFY_SKILL_REUSE;
|
||||||
public static Map<Integer, Integer> SKILL_REUSE_LIST;
|
public static Map<Integer, Integer> SKILL_REUSE_LIST;
|
||||||
public static boolean AUTO_LEARN_SKILLS;
|
public static boolean AUTO_LEARN_SKILLS;
|
||||||
|
public static boolean AUTO_LEARN_SKILLS_WITHOUT_ITEMS;
|
||||||
public static boolean AUTO_LEARN_FS_SKILLS;
|
public static boolean AUTO_LEARN_FS_SKILLS;
|
||||||
public static boolean AUTO_LOOT_HERBS;
|
public static boolean AUTO_LOOT_HERBS;
|
||||||
public static byte BUFFS_MAX_AMOUNT;
|
public static byte BUFFS_MAX_AMOUNT;
|
||||||
@@ -1744,6 +1745,7 @@ public class Config
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
AUTO_LEARN_SKILLS = Character.getBoolean("AutoLearnSkills", false);
|
AUTO_LEARN_SKILLS = Character.getBoolean("AutoLearnSkills", false);
|
||||||
|
AUTO_LEARN_SKILLS_WITHOUT_ITEMS = Character.getBoolean("AutoLearnSkillsWithoutItems", false);
|
||||||
AUTO_LEARN_FS_SKILLS = Character.getBoolean("AutoLearnForgottenScrollSkills", false);
|
AUTO_LEARN_FS_SKILLS = Character.getBoolean("AutoLearnForgottenScrollSkills", false);
|
||||||
AUTO_LOOT_HERBS = Character.getBoolean("AutoLootHerbs", false);
|
AUTO_LOOT_HERBS = Character.getBoolean("AutoLootHerbs", false);
|
||||||
BUFFS_MAX_AMOUNT = Character.getByte("MaxBuffAmount", (byte) 20);
|
BUFFS_MAX_AMOUNT = Character.getByte("MaxBuffAmount", (byte) 20);
|
||||||
|
|||||||
+19
-5
@@ -558,17 +558,31 @@ public class SkillTreeData implements IXmlReader
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Collection<Skill> getAllAvailableSkills(PlayerInstance player, ClassId classId, boolean includeByFs, boolean includeAutoGet)
|
/**
|
||||||
|
* Used by auto learn configuration.
|
||||||
|
* @param player
|
||||||
|
* @param classId
|
||||||
|
* @param includeByFs if {@code true} forgotten scroll 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
|
||||||
|
* @param includeRequiredItems if {@code true} skills that have required items will be added
|
||||||
|
* @return a list of auto learnable skills for the player.
|
||||||
|
*/
|
||||||
|
public Collection<Skill> getAllAvailableSkills(PlayerInstance player, ClassId classId, boolean includeByFs, boolean includeAutoGet, boolean includeRequiredItems)
|
||||||
{
|
{
|
||||||
// Get available skills
|
// Get available skills
|
||||||
final PlayerSkillHolder holder = new PlayerSkillHolder(player);
|
final PlayerSkillHolder holder = new PlayerSkillHolder(player);
|
||||||
List<SkillLearn> learnable = getAvailableSkills(player, classId, includeByFs, includeAutoGet, holder);
|
List<SkillLearn> learnable = getAvailableSkills(player, classId, includeByFs, includeAutoGet, holder);
|
||||||
while (!learnable.isEmpty())
|
for (int i = 0; i < 1000; i++) // Infinite loop warning
|
||||||
{
|
{
|
||||||
for (SkillLearn s : learnable)
|
SEARCH: for (SkillLearn skillLearn : learnable)
|
||||||
{
|
{
|
||||||
final Skill sk = SkillData.getInstance().getSkill(s.getSkillId(), s.getSkillLevel());
|
if (!includeRequiredItems && !skillLearn.getRequiredItems().isEmpty())
|
||||||
holder.addSkill(sk);
|
{
|
||||||
|
continue SEARCH;
|
||||||
|
}
|
||||||
|
|
||||||
|
final Skill skill = SkillData.getInstance().getSkill(skillLearn.getSkillId(), skillLearn.getSkillLevel());
|
||||||
|
holder.addSkill(skill);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get new available skills, some skills depend of previous skills to be available.
|
// Get new available skills, some skills depend of previous skills to be available.
|
||||||
|
|||||||
+1
-1
@@ -104,7 +104,7 @@ public class ClassMasterInstance extends MerchantInstance
|
|||||||
}
|
}
|
||||||
else if (command.startsWith("learn_skills"))
|
else if (command.startsWith("learn_skills"))
|
||||||
{
|
{
|
||||||
player.giveAvailableSkills(Config.AUTO_LEARN_FS_SKILLS, true);
|
player.giveAvailableSkills(Config.AUTO_LEARN_FS_SKILLS, true, Config.AUTO_LEARN_SKILLS_WITHOUT_ITEMS);
|
||||||
}
|
}
|
||||||
else if (command.startsWith("increase_clan_level"))
|
else if (command.startsWith("increase_clan_level"))
|
||||||
{
|
{
|
||||||
|
|||||||
+5
-4
@@ -2539,7 +2539,7 @@ public class PlayerInstance extends Playable
|
|||||||
// Give all normal skills if activated Auto-Learn is activated, included AutoGet skills.
|
// Give all normal skills if activated Auto-Learn is activated, included AutoGet skills.
|
||||||
if (Config.AUTO_LEARN_SKILLS)
|
if (Config.AUTO_LEARN_SKILLS)
|
||||||
{
|
{
|
||||||
giveAvailableSkills(Config.AUTO_LEARN_FS_SKILLS, true);
|
giveAvailableSkills(Config.AUTO_LEARN_FS_SKILLS, true, Config.AUTO_LEARN_SKILLS_WITHOUT_ITEMS);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -2602,15 +2602,16 @@ public class PlayerInstance extends Playable
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Give all available skills to the player.
|
* Give all available skills to the player.
|
||||||
* @param includedByFs if {@code true} forgotten scroll skills present in the skill tree will be added
|
* @param includeByFs if {@code true} forgotten scroll 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
|
* @param includeAutoGet if {@code true} auto-get skills present in the skill tree will be added
|
||||||
|
* @param includeRequiredItems if {@code true} skills that have required items will be added
|
||||||
* @return the amount of new skills earned
|
* @return the amount of new skills earned
|
||||||
*/
|
*/
|
||||||
public int giveAvailableSkills(boolean includedByFs, boolean includeAutoGet)
|
public int giveAvailableSkills(boolean includeByFs, boolean includeAutoGet, boolean includeRequiredItems)
|
||||||
{
|
{
|
||||||
int skillCounter = 0;
|
int skillCounter = 0;
|
||||||
// Get available skills.
|
// Get available skills.
|
||||||
final Collection<Skill> skills = SkillTreeData.getInstance().getAllAvailableSkills(this, getClassId(), includedByFs, includeAutoGet);
|
final Collection<Skill> skills = SkillTreeData.getInstance().getAllAvailableSkills(this, getClassId(), includeByFs, includeAutoGet, includeRequiredItems);
|
||||||
final List<Skill> skillsForStore = new ArrayList<>();
|
final List<Skill> skillsForStore = new ArrayList<>();
|
||||||
for (Skill sk : skills)
|
for (Skill sk : skills)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -73,6 +73,10 @@ SkillReuseList =
|
|||||||
# Default: False
|
# Default: False
|
||||||
AutoLearnSkills = False
|
AutoLearnSkills = False
|
||||||
|
|
||||||
|
# Auto learn skills that need items to be learned.
|
||||||
|
# Default: False
|
||||||
|
AutoLearnSkillsWithoutItems = False
|
||||||
|
|
||||||
# If it's true skills from forgotten scrolls will be delivered upon level up and login, require AutoLearnSkills.
|
# If it's true skills from forgotten scrolls will be delivered upon level up and login, require AutoLearnSkills.
|
||||||
# Default: False
|
# Default: False
|
||||||
AutoLearnForgottenScrollSkills = False
|
AutoLearnForgottenScrollSkills = False
|
||||||
|
|||||||
Vendored
+3
-3
@@ -396,7 +396,7 @@ public class ClassMaster extends AbstractNpcAI implements IXmlReader
|
|||||||
}
|
}
|
||||||
if (Config.AUTO_LEARN_SKILLS)
|
if (Config.AUTO_LEARN_SKILLS)
|
||||||
{
|
{
|
||||||
player.giveAvailableSkills(Config.AUTO_LEARN_FS_SKILLS, true);
|
player.giveAvailableSkills(Config.AUTO_LEARN_FS_SKILLS, true, Config.AUTO_LEARN_SKILLS_WITHOUT_ITEMS);
|
||||||
}
|
}
|
||||||
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.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();
|
player.broadcastUserInfo();
|
||||||
@@ -420,7 +420,7 @@ public class ClassMaster extends AbstractNpcAI implements IXmlReader
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
player.giveAvailableSkills(true, true);
|
player.giveAvailableSkills(true, true, true);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -835,7 +835,7 @@ public class ClassMaster extends AbstractNpcAI implements IXmlReader
|
|||||||
}
|
}
|
||||||
if (Config.AUTO_LEARN_SKILLS)
|
if (Config.AUTO_LEARN_SKILLS)
|
||||||
{
|
{
|
||||||
player.giveAvailableSkills(Config.AUTO_LEARN_FS_SKILLS, true);
|
player.giveAvailableSkills(Config.AUTO_LEARN_FS_SKILLS, true, Config.AUTO_LEARN_SKILLS_WITHOUT_ITEMS);
|
||||||
}
|
}
|
||||||
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.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();
|
player.broadcastUserInfo();
|
||||||
|
|||||||
Vendored
+6
-5
@@ -156,11 +156,11 @@ public class AdminSkill implements IAdminCommandHandler
|
|||||||
}
|
}
|
||||||
else if (command.equals("admin_give_all_skills"))
|
else if (command.equals("admin_give_all_skills"))
|
||||||
{
|
{
|
||||||
adminGiveAllSkills(activeChar, false);
|
adminGiveAllSkills(activeChar, false, false);
|
||||||
}
|
}
|
||||||
else if (command.equals("admin_give_all_skills_fs"))
|
else if (command.equals("admin_give_all_skills_fs"))
|
||||||
{
|
{
|
||||||
adminGiveAllSkills(activeChar, true);
|
adminGiveAllSkills(activeChar, true, true);
|
||||||
}
|
}
|
||||||
else if (command.equals("admin_give_clan_skills"))
|
else if (command.equals("admin_give_clan_skills"))
|
||||||
{
|
{
|
||||||
@@ -277,9 +277,10 @@ public class AdminSkill implements IAdminCommandHandler
|
|||||||
/**
|
/**
|
||||||
* This function will give all the skills that the target can learn at his/her level
|
* This function will give all the skills that the target can learn at his/her level
|
||||||
* @param activeChar the player
|
* @param activeChar the player
|
||||||
* @param includedByFs if {@code true} Forgotten Scroll skills will be delivered.
|
* @param includeByFs if {@code true} Forgotten Scroll skills will be delivered.
|
||||||
|
* @param includeRequiredItems if {@code true} skills that have required items will be added
|
||||||
*/
|
*/
|
||||||
private void adminGiveAllSkills(PlayerInstance activeChar, boolean includedByFs)
|
private void adminGiveAllSkills(PlayerInstance activeChar, boolean includeByFs, boolean includeRequiredItems)
|
||||||
{
|
{
|
||||||
final WorldObject target = activeChar.getTarget();
|
final WorldObject target = activeChar.getTarget();
|
||||||
if ((target == null) || !target.isPlayer())
|
if ((target == null) || !target.isPlayer())
|
||||||
@@ -289,7 +290,7 @@ public class AdminSkill implements IAdminCommandHandler
|
|||||||
}
|
}
|
||||||
final PlayerInstance player = target.getActingPlayer();
|
final PlayerInstance player = target.getActingPlayer();
|
||||||
// Notify player and admin
|
// Notify player and admin
|
||||||
BuilderUtil.sendSysMessage(activeChar, "You gave " + player.giveAvailableSkills(includedByFs, true) + " skills to " + player.getName());
|
BuilderUtil.sendSysMessage(activeChar, "You gave " + player.giveAvailableSkills(includeByFs, true, includeRequiredItems) + " skills to " + player.getName());
|
||||||
player.sendSkillList();
|
player.sendSkillList();
|
||||||
player.sendPacket(new AcquireSkillList(player));
|
player.sendPacket(new AcquireSkillList(player));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -174,6 +174,7 @@ public class Config
|
|||||||
public static boolean ENABLE_MODIFY_SKILL_REUSE;
|
public static boolean ENABLE_MODIFY_SKILL_REUSE;
|
||||||
public static Map<Integer, Integer> SKILL_REUSE_LIST;
|
public static Map<Integer, Integer> SKILL_REUSE_LIST;
|
||||||
public static boolean AUTO_LEARN_SKILLS;
|
public static boolean AUTO_LEARN_SKILLS;
|
||||||
|
public static boolean AUTO_LEARN_SKILLS_WITHOUT_ITEMS;
|
||||||
public static boolean AUTO_LEARN_FS_SKILLS;
|
public static boolean AUTO_LEARN_FS_SKILLS;
|
||||||
public static boolean AUTO_LOOT_HERBS;
|
public static boolean AUTO_LOOT_HERBS;
|
||||||
public static byte BUFFS_MAX_AMOUNT;
|
public static byte BUFFS_MAX_AMOUNT;
|
||||||
@@ -1696,6 +1697,7 @@ public class Config
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
AUTO_LEARN_SKILLS = Character.getBoolean("AutoLearnSkills", false);
|
AUTO_LEARN_SKILLS = Character.getBoolean("AutoLearnSkills", false);
|
||||||
|
AUTO_LEARN_SKILLS_WITHOUT_ITEMS = Character.getBoolean("AutoLearnSkillsWithoutItems", false);
|
||||||
AUTO_LEARN_FS_SKILLS = Character.getBoolean("AutoLearnForgottenScrollSkills", false);
|
AUTO_LEARN_FS_SKILLS = Character.getBoolean("AutoLearnForgottenScrollSkills", false);
|
||||||
AUTO_LOOT_HERBS = Character.getBoolean("AutoLootHerbs", false);
|
AUTO_LOOT_HERBS = Character.getBoolean("AutoLootHerbs", false);
|
||||||
BUFFS_MAX_AMOUNT = Character.getByte("MaxBuffAmount", (byte) 20);
|
BUFFS_MAX_AMOUNT = Character.getByte("MaxBuffAmount", (byte) 20);
|
||||||
|
|||||||
+16
-2
@@ -729,7 +729,16 @@ public class SkillTreeData implements IXmlReader
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Collection<Skill> getAllAvailableSkills(PlayerInstance player, ClassId classId, boolean includeByFs, boolean includeAutoGet)
|
/**
|
||||||
|
* Used by auto learn configuration.
|
||||||
|
* @param player
|
||||||
|
* @param classId
|
||||||
|
* @param includeByFs if {@code true} forgotten scroll 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
|
||||||
|
* @param includeRequiredItems if {@code true} skills that have required items will be added
|
||||||
|
* @return a list of auto learnable skills for the player.
|
||||||
|
*/
|
||||||
|
public Collection<Skill> getAllAvailableSkills(PlayerInstance player, ClassId classId, boolean includeByFs, boolean includeAutoGet, boolean includeRequiredItems)
|
||||||
{
|
{
|
||||||
// Get available skills
|
// Get available skills
|
||||||
final PlayerSkillHolder holder = new PlayerSkillHolder(player);
|
final PlayerSkillHolder holder = new PlayerSkillHolder(player);
|
||||||
@@ -749,8 +758,13 @@ public class SkillTreeData implements IXmlReader
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (SkillLearn skillLearn : learnable)
|
SEARCH: for (SkillLearn skillLearn : learnable)
|
||||||
{
|
{
|
||||||
|
if (!includeRequiredItems && !skillLearn.getRequiredItems().isEmpty())
|
||||||
|
{
|
||||||
|
continue SEARCH;
|
||||||
|
}
|
||||||
|
|
||||||
final Skill skill = SkillData.getInstance().getSkill(skillLearn.getSkillId(), skillLearn.getSkillLevel());
|
final Skill skill = SkillData.getInstance().getSkill(skillLearn.getSkillId(), skillLearn.getSkillLevel());
|
||||||
// Cleanup skills that has to be removed
|
// Cleanup skills that has to be removed
|
||||||
for (int skillId : skillLearn.getRemoveSkills())
|
for (int skillId : skillLearn.getRemoveSkills())
|
||||||
|
|||||||
+5
-4
@@ -2550,7 +2550,7 @@ public class PlayerInstance extends Playable
|
|||||||
// Give all normal skills if activated Auto-Learn is activated, included AutoGet skills.
|
// Give all normal skills if activated Auto-Learn is activated, included AutoGet skills.
|
||||||
if (Config.AUTO_LEARN_SKILLS)
|
if (Config.AUTO_LEARN_SKILLS)
|
||||||
{
|
{
|
||||||
giveAvailableSkills(Config.AUTO_LEARN_FS_SKILLS, true);
|
giveAvailableSkills(Config.AUTO_LEARN_FS_SKILLS, true, Config.AUTO_LEARN_SKILLS_WITHOUT_ITEMS);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -2610,15 +2610,16 @@ public class PlayerInstance extends Playable
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Give all available skills to the player.
|
* Give all available skills to the player.
|
||||||
* @param includedByFs if {@code true} forgotten scroll skills present in the skill tree will be added
|
* @param includeByFs if {@code true} forgotten scroll 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
|
* @param includeAutoGet if {@code true} auto-get skills present in the skill tree will be added
|
||||||
|
* @param includeRequiredItems if {@code true} skills that have required items will be added
|
||||||
* @return the amount of new skills earned
|
* @return the amount of new skills earned
|
||||||
*/
|
*/
|
||||||
public int giveAvailableSkills(boolean includedByFs, boolean includeAutoGet)
|
public int giveAvailableSkills(boolean includeByFs, boolean includeAutoGet, boolean includeRequiredItems)
|
||||||
{
|
{
|
||||||
int skillCounter = 0;
|
int skillCounter = 0;
|
||||||
// Get available skills
|
// Get available skills
|
||||||
final Collection<Skill> skills = SkillTreeData.getInstance().getAllAvailableSkills(this, getTemplate().getClassId(), includedByFs, includeAutoGet);
|
final Collection<Skill> skills = SkillTreeData.getInstance().getAllAvailableSkills(this, getTemplate().getClassId(), includeByFs, includeAutoGet, includeRequiredItems);
|
||||||
final List<Skill> skillsForStore = new ArrayList<>();
|
final List<Skill> skillsForStore = new ArrayList<>();
|
||||||
for (Skill skill : skills)
|
for (Skill skill : skills)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -73,6 +73,10 @@ SkillReuseList =
|
|||||||
# Default: False
|
# Default: False
|
||||||
AutoLearnSkills = False
|
AutoLearnSkills = False
|
||||||
|
|
||||||
|
# Auto learn skills that need items to be learned.
|
||||||
|
# Default: False
|
||||||
|
AutoLearnSkillsWithoutItems = False
|
||||||
|
|
||||||
# If it's true skills from forgotten scrolls will be delivered upon level up and login, require AutoLearnSkills.
|
# If it's true skills from forgotten scrolls will be delivered upon level up and login, require AutoLearnSkills.
|
||||||
# Default: False
|
# Default: False
|
||||||
AutoLearnForgottenScrollSkills = False
|
AutoLearnForgottenScrollSkills = False
|
||||||
|
|||||||
+3
-3
@@ -396,7 +396,7 @@ public class ClassMaster extends AbstractNpcAI implements IXmlReader
|
|||||||
}
|
}
|
||||||
if (Config.AUTO_LEARN_SKILLS)
|
if (Config.AUTO_LEARN_SKILLS)
|
||||||
{
|
{
|
||||||
player.giveAvailableSkills(Config.AUTO_LEARN_FS_SKILLS, true);
|
player.giveAvailableSkills(Config.AUTO_LEARN_FS_SKILLS, true, Config.AUTO_LEARN_SKILLS_WITHOUT_ITEMS);
|
||||||
}
|
}
|
||||||
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.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();
|
player.broadcastUserInfo();
|
||||||
@@ -420,7 +420,7 @@ public class ClassMaster extends AbstractNpcAI implements IXmlReader
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
player.giveAvailableSkills(true, true);
|
player.giveAvailableSkills(true, true, true);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -835,7 +835,7 @@ public class ClassMaster extends AbstractNpcAI implements IXmlReader
|
|||||||
}
|
}
|
||||||
if (Config.AUTO_LEARN_SKILLS)
|
if (Config.AUTO_LEARN_SKILLS)
|
||||||
{
|
{
|
||||||
player.giveAvailableSkills(Config.AUTO_LEARN_FS_SKILLS, true);
|
player.giveAvailableSkills(Config.AUTO_LEARN_FS_SKILLS, true, Config.AUTO_LEARN_SKILLS_WITHOUT_ITEMS);
|
||||||
}
|
}
|
||||||
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.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();
|
player.broadcastUserInfo();
|
||||||
|
|||||||
Vendored
+6
-5
@@ -156,11 +156,11 @@ public class AdminSkill implements IAdminCommandHandler
|
|||||||
}
|
}
|
||||||
else if (command.equals("admin_give_all_skills"))
|
else if (command.equals("admin_give_all_skills"))
|
||||||
{
|
{
|
||||||
adminGiveAllSkills(activeChar, false);
|
adminGiveAllSkills(activeChar, false, false);
|
||||||
}
|
}
|
||||||
else if (command.equals("admin_give_all_skills_fs"))
|
else if (command.equals("admin_give_all_skills_fs"))
|
||||||
{
|
{
|
||||||
adminGiveAllSkills(activeChar, true);
|
adminGiveAllSkills(activeChar, true, true);
|
||||||
}
|
}
|
||||||
else if (command.equals("admin_give_clan_skills"))
|
else if (command.equals("admin_give_clan_skills"))
|
||||||
{
|
{
|
||||||
@@ -277,9 +277,10 @@ public class AdminSkill implements IAdminCommandHandler
|
|||||||
/**
|
/**
|
||||||
* This function will give all the skills that the target can learn at his/her level
|
* This function will give all the skills that the target can learn at his/her level
|
||||||
* @param activeChar the player
|
* @param activeChar the player
|
||||||
* @param includedByFs if {@code true} Forgotten Scroll skills will be delivered.
|
* @param includeByFs if {@code true} Forgotten Scroll skills will be delivered.
|
||||||
|
* @param includeRequiredItems if {@code true} skills that have required items will be added
|
||||||
*/
|
*/
|
||||||
private void adminGiveAllSkills(PlayerInstance activeChar, boolean includedByFs)
|
private void adminGiveAllSkills(PlayerInstance activeChar, boolean includeByFs, boolean includeRequiredItems)
|
||||||
{
|
{
|
||||||
final WorldObject target = activeChar.getTarget();
|
final WorldObject target = activeChar.getTarget();
|
||||||
if ((target == null) || !target.isPlayer())
|
if ((target == null) || !target.isPlayer())
|
||||||
@@ -289,7 +290,7 @@ public class AdminSkill implements IAdminCommandHandler
|
|||||||
}
|
}
|
||||||
final PlayerInstance player = target.getActingPlayer();
|
final PlayerInstance player = target.getActingPlayer();
|
||||||
// Notify player and admin
|
// Notify player and admin
|
||||||
BuilderUtil.sendSysMessage(activeChar, "You gave " + player.giveAvailableSkills(includedByFs, true) + " skills to " + player.getName());
|
BuilderUtil.sendSysMessage(activeChar, "You gave " + player.giveAvailableSkills(includeByFs, true, includeRequiredItems) + " skills to " + player.getName());
|
||||||
player.sendSkillList();
|
player.sendSkillList();
|
||||||
player.sendPacket(new AcquireSkillList(player));
|
player.sendPacket(new AcquireSkillList(player));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -174,6 +174,7 @@ public class Config
|
|||||||
public static boolean ENABLE_MODIFY_SKILL_REUSE;
|
public static boolean ENABLE_MODIFY_SKILL_REUSE;
|
||||||
public static Map<Integer, Integer> SKILL_REUSE_LIST;
|
public static Map<Integer, Integer> SKILL_REUSE_LIST;
|
||||||
public static boolean AUTO_LEARN_SKILLS;
|
public static boolean AUTO_LEARN_SKILLS;
|
||||||
|
public static boolean AUTO_LEARN_SKILLS_WITHOUT_ITEMS;
|
||||||
public static boolean AUTO_LEARN_FS_SKILLS;
|
public static boolean AUTO_LEARN_FS_SKILLS;
|
||||||
public static boolean AUTO_LOOT_HERBS;
|
public static boolean AUTO_LOOT_HERBS;
|
||||||
public static byte BUFFS_MAX_AMOUNT;
|
public static byte BUFFS_MAX_AMOUNT;
|
||||||
@@ -1700,6 +1701,7 @@ public class Config
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
AUTO_LEARN_SKILLS = Character.getBoolean("AutoLearnSkills", false);
|
AUTO_LEARN_SKILLS = Character.getBoolean("AutoLearnSkills", false);
|
||||||
|
AUTO_LEARN_SKILLS_WITHOUT_ITEMS = Character.getBoolean("AutoLearnSkillsWithoutItems", false);
|
||||||
AUTO_LEARN_FS_SKILLS = Character.getBoolean("AutoLearnForgottenScrollSkills", false);
|
AUTO_LEARN_FS_SKILLS = Character.getBoolean("AutoLearnForgottenScrollSkills", false);
|
||||||
AUTO_LOOT_HERBS = Character.getBoolean("AutoLootHerbs", false);
|
AUTO_LOOT_HERBS = Character.getBoolean("AutoLootHerbs", false);
|
||||||
BUFFS_MAX_AMOUNT = Character.getByte("MaxBuffAmount", (byte) 20);
|
BUFFS_MAX_AMOUNT = Character.getByte("MaxBuffAmount", (byte) 20);
|
||||||
|
|||||||
+16
-2
@@ -729,7 +729,16 @@ public class SkillTreeData implements IXmlReader
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Collection<Skill> getAllAvailableSkills(PlayerInstance player, ClassId classId, boolean includeByFs, boolean includeAutoGet)
|
/**
|
||||||
|
* Used by auto learn configuration.
|
||||||
|
* @param player
|
||||||
|
* @param classId
|
||||||
|
* @param includeByFs if {@code true} forgotten scroll 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
|
||||||
|
* @param includeRequiredItems if {@code true} skills that have required items will be added
|
||||||
|
* @return a list of auto learnable skills for the player.
|
||||||
|
*/
|
||||||
|
public Collection<Skill> getAllAvailableSkills(PlayerInstance player, ClassId classId, boolean includeByFs, boolean includeAutoGet, boolean includeRequiredItems)
|
||||||
{
|
{
|
||||||
// Get available skills
|
// Get available skills
|
||||||
final PlayerSkillHolder holder = new PlayerSkillHolder(player);
|
final PlayerSkillHolder holder = new PlayerSkillHolder(player);
|
||||||
@@ -749,8 +758,13 @@ public class SkillTreeData implements IXmlReader
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (SkillLearn skillLearn : learnable)
|
SEARCH: for (SkillLearn skillLearn : learnable)
|
||||||
{
|
{
|
||||||
|
if (!includeRequiredItems && !skillLearn.getRequiredItems().isEmpty())
|
||||||
|
{
|
||||||
|
continue SEARCH;
|
||||||
|
}
|
||||||
|
|
||||||
final Skill skill = SkillData.getInstance().getSkill(skillLearn.getSkillId(), skillLearn.getSkillLevel());
|
final Skill skill = SkillData.getInstance().getSkill(skillLearn.getSkillId(), skillLearn.getSkillLevel());
|
||||||
// Cleanup skills that has to be removed
|
// Cleanup skills that has to be removed
|
||||||
for (int skillId : skillLearn.getRemoveSkills())
|
for (int skillId : skillLearn.getRemoveSkills())
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user