0flee Posted May 12, 2021 Posted May 12, 2021 (edited) Hello, when i learn the skill from npc fishing skills, i get error on some skills. I learn level 3 of skill. All good. But after restart, skill become level 1. on fishingskilltree.xml i have put 3 levels. Here it's error. https://vimeo.com/548519579 P.S for L2j-Mobius Edited May 12, 2021 by 0flee
0 0flee Posted May 12, 2021 Author Posted May 12, 2021 I do not know from where, what class, i don't know
0 nikpappa Posted May 12, 2021 Posted May 12, 2021 should be on playerinstance, onSubclassChange or smthing like that, otherwise it could be at the npc that handles subs
0 0flee Posted May 12, 2021 Author Posted May 12, 2021 I have like this: Original - private static final String RESTORE_SKILLS_FOR_CHAR = "SELECT skill_id,skill_level FROM character_skills WHERE charId=? AND class_index=?"; try (Connection con = DatabaseFactory.getConnection(); PreparedStatement ps = con.prepareStatement(RESTORE_SKILLS_FOR_CHAR)) { // Retrieve all skills of this PlayerInstance from the database ps.setInt(1, getObjectId()); ps.setInt(2, _classIndex); My private static final String RESTORE_SKILLS_FOR_CHAR = "SELECT skill_id,skill_level FROM character_skills WHERE charId=?"; try (Connection con = DatabaseFactory.getConnection(); PreparedStatement ps = con.prepareStatement(RESTORE_SKILLS_FOR_CHAR)) { // Retrieve all skills of this PlayerInstance from the database ps.setInt(1, getObjectId()); All this i do for stack sub. Idk if it's ok. But i get help here. Also, VillageMasterInstance.java if (player.modifySubClass(paramOne, paramTwo)) { player.abortCast(); player.stopAllEffectsExceptThoseThatLastThroughDeath(); // all effects from old subclass stopped! player.stopAllEffectsNotStayOnSubclassChange(); player.stopCubics(); player.setActiveClass(paramOne); html.setFile(player, "data/html/villagemaster/SubClass_ModifyOk.htm"); html.replace("%name%", ClassListData.getInstance().getClass(paramTwo).getClientCode()); player.sendPacket(SystemMessageId.THE_NEW_SUBCLASS_HAS_BEEN_ADDED); // Subclass added. } i have to do something here?
0 Zake Posted May 13, 2021 Posted May 13, 2021 A quick guess would be addSkill method doesn't check if skill is already owned. Some skills may be equal between subclasses, so probably a skill level check upon adding a skill could fix the issue.
0 0flee Posted May 13, 2021 Author Posted May 13, 2021 (edited) U right Zake. I have find this on FishermanInstance.java public static void showFishSkillList(PlayerInstance player) { final List<SkillLearn> skills = SkillTreeData.getInstance().getAvailableFishingSkills(player); final AcquireSkillList asl = new AcquireSkillList(AcquireSkillType.FISHING); int count = 0; for (SkillLearn s : skills) { final Skill sk = SkillData.getInstance().getSkill(s.getSkillId(), s.getSkillLevel()); if (sk == null) { continue; } count++; asl.addSkill(s.getSkillId(), s.getSkillLevel(), s.getSkillLevel(), s.getLevelUpSp(), 1); } if (count == 0) { final int minlLevel = SkillTreeData.getInstance().getMinLevelForNewSkill(player, SkillTreeData.getInstance().getFishingSkillTree()); if (minlLevel > 0) { final SystemMessage sm = new SystemMessage(SystemMessageId.YOU_DO_NOT_HAVE_ANY_FURTHER_SKILLS_TO_LEARN_COME_BACK_WHEN_YOU_HAVE_REACHED_LEVEL_S1); sm.addInt(minlLevel); player.sendPacket(sm); } else { player.sendPacket(SystemMessageId.THERE_ARE_NO_OTHER_SKILLS_TO_LEARN); } } else { player.sendPacket(asl); } } here, isn;t specified anything about subclass. How i can make this? Edited May 13, 2021 by 0flee
0 Zake Posted May 13, 2021 Posted May 13, 2021 It doesn't have to do with fishing. Check restore method in PlayerInstance
0 0flee Posted May 13, 2021 Author Posted May 13, 2021 private void storeSkill(Skill newSkill, Skill oldSkill, int newClassIndex) { final int classIndex = (newClassIndex > -1) ? newClassIndex : _classIndex; try (Connection con = DatabaseFactory.getConnection()) { if ((oldSkill != null) && (newSkill != null)) { try (PreparedStatement ps = con.prepareStatement(UPDATE_CHARACTER_SKILL_LEVEL)) { ps.setInt(1, newSkill.getLevel()); ps.setInt(2, oldSkill.getId()); ps.setInt(3, getObjectId()); ps.setInt(4, classIndex); ps.execute(); } } else if (newSkill != null) { try (PreparedStatement ps = con.prepareStatement(ADD_NEW_SKILLS)) { ps.setInt(1, getObjectId()); ps.setInt(2, newSkill.getId()); ps.setInt(3, newSkill.getLevel()); ps.setInt(4, classIndex); ps.execute(); } } // else // { // LOGGER.warning("Could not store new skill, it's null!"); // } } catch (Exception e) { LOGGER.log(Level.WARNING, "Error could not store char skills: " + e.getMessage(), e); } } All this? What i have to change here? I have to delete from here ps.setInt(4, classIndex); ?
Question
0flee
Hello, when i learn the skill from npc fishing skills, i get error on some skills. I learn level 3 of skill. All good. But after restart, skill become level 1.
on fishingskilltree.xml i have put 3 levels. Here it's error.
https://vimeo.com/548519579
P.S for L2j-Mobius
22 answers to this question
Recommended Posts