public void onTransferOnlyRemoveSkills(Player player, int toFinalClass, int baseKeepSkills) { boolean delete = false; if (Config.ALT_DELETE_AWAKEN_SKILL_FROM_DB) { delete = true; } List<Integer> allSkillsId = SkillAcquireHolder.getInstance().getAllClassSkillId(); List<Integer> skillsToMantain = SkillAcquireHolder.getInstance().getMaintainSkillOnAwake(baseKeepSkills, toFinalClass); for (Skill skl : player.getAllSkills()) { if (allSkillsId.contains(skl.getId())) { player.removeSkill(skl, delete); } } for (int skillId : skillsToMantain) { int skillLv = SkillTable.getInstance().getBaseLevel(skillId); Skill newSkill = SkillTable.getInstance().getInfo(skillId, skillLv); player.addSkill(newSkill, true); } for (int alterSkill : ALTER_SKILLS.get(toFinalClass)) { int skillLv = SkillTable.getInstance().getBaseLevel(alterSkill); Skill newSkillAlter = SkillTable.getInstance().getInfo(alterSkill, skillLv); player.addSkill(newSkillAlter, true); } player.sendSkillList(); }
public void checkAwakenPlayerSkills(Player player) // For check on subclass change and logon { int classId = player.getActiveClassId(); boolean delete = false; if (Config.ALT_DELETE_AWAKEN_SKILL_FROM_DB) { delete = true; } List<Integer> SkillsCheck = new ArrayList<>(); List<Integer> SkillsToRemove = new ArrayList<>(); List<Integer> allSkillsId = SkillAcquireHolder.getInstance().getAllClassSkillId(); SkillsCheck.addAll(SkillAcquireHolder.getInstance().getAwakenGeneralKeepSkillList()); SkillsCheck.addAll(SkillAcquireHolder.getInstance().getAwakenClassSkillForCheck(classId)); SkillsCheck.addAll(SkillAcquireHolder.getInstance().getAllAwakenSkillsByClass(classId)); if (player.getTransformation() == 0) // if the character log on with a transformation, do not remove any skill { for (Skill skl : player.getAllSkills()) { if (!SkillsCheck.contains(skl.getId()) && allSkillsId.contains(skl.getId())) { SkillsToRemove.add(skl.getId()); } } } else { for (Skill skl : player.getAllSkills()) { if (!SkillsCheck.contains(skl.getId()) && SkillsCheck.contains(skl.getId())) { SkillsToRemove.add(skl.getId()); } } } player.removeSkills(SkillsToRemove, delete); for (int alterSkill : ALTER_SKILLS.get(classId)) { int skillLv = SkillTable.getInstance().getBaseLevel(alterSkill); Skill newSkillAlter = SkillTable.getInstance().getInfo(alterSkill, skillLv); player.addSkill(newSkillAlter, true); } player.sendSkillList(); }