Jump to content
  • 0

Cancel subclass keep skills


Question

Posted

Hello fooooolks, i have one and big problem. I have stacksub server based on l2j-mobius. And i have npc Maximilian where player can add/change/cancel a subclass. All good. But, when player cancel a subclass to do another instead, skills from canceled subclass are retained. How i can make this to disappear one with cancel?

 

Thank you !

7 answers to this question

Recommended Posts

  • 0
Posted

            player.giveAvailableSkills();
            player.sendSkillList();

            player.checkAllowedSkills();

 

maybe this will help you 

  • 0
Posted

look one way is go to player.java or pcisntance.java what you have and search for

 

public boolean setActiveClass(int classIndex)

 

search for

restoreHenna(); or

 

            restoreSkills();
            rewardSkills();
            regiveTemporarySkills();  

and try to add checkAllowedSkills();  or restoreSkills();

  • 0
Posted

This is method available to restore player skills. An here should be a check for all subclasses available. And for that available subclasses to give their skills. And rest of skills to be deleted

 

private void restoreSkills()
	{
		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());
			try (ResultSet rs = ps.executeQuery())
			{
				while (rs.next())
				{
					final int id = rs.getInt("skill_id");
					final int level = rs.getInt("skill_level");
					
					// Create a Skill object for each record
					final Skill skill = SkillData.getInstance().getSkill(id, level);
					if (skill == null)
					{
						LOGGER.warning("Skipped null skill Id: " + id + " Level: " + level + " while restoring player skills for playerObjId: " + getObjectId());
						continue;
					}
					
					// Add the Skill object to the Creature _skills and its Func objects to the calculator set of the Creature
					addSkill(skill);
					
					if (Config.SKILL_CHECK_ENABLE && (!canOverrideCond(PlayerCondOverride.SKILL_CONDITIONS) || Config.SKILL_CHECK_GM) && !SkillTreeData.getInstance().isSkillAllowed(this, skill))
					{
						Util.handleIllegalPlayerAction(this, "Player " + getName() + " has invalid skill " + skill.getName() + " (" + skill.getId() + "/" + skill.getLevel() + "), class:" + ClassListData.getInstance().getClass(getClassId()).getClassName(), IllegalActionPunishmentType.BROADCAST);
						if (Config.SKILL_CHECK_REMOVE)
						{
							removeSkill(skill);
						}
					}
				}
			}
		}
		catch (Exception e)
		{
			LOGGER.log(Level.WARNING, "Could not restore character " + this + " skills: " + e.getMessage(), e);
		}
	}

 

  • 0
Posted

yes this is what it does but you need to make it run when players get class changed , you need to search for "public boolean setActiveClass(int classIndex)" or something like this fiind exact moment when class is changed and after that add 

checkAllowedSkills(); or  restoreSkills();

 

i try to help you but i have 0 experience in substack type servers

 

 

Guest
This topic is now closed to further replies.


×
×
  • Create New...