Jump to content
  • 0

L2NpcInstance - showEnchantSkillList


Question

Posted

Hello I wanted to create custom npc which has also ability to enchant skills. I copied function from L2NpcInstance:

public static void showEnchantSkillList(L2PcInstance player, L2Npc npc, ClassId classId)
{
	if (((L2NpcInstance) npc).getClassesToTeach() == null)
	{
		NpcHtmlMessage html = new NpcHtmlMessage(npc.getObjectId());
		final String sb = StringUtil.concat("<html><body>I cannot teach you. 
My class list is empty.<br>Ask admin to fix it. Need add my npcid and classes to skill_learn.sql.<br>NpcId:", 
String.valueOf(npc.getTemplate().getNpcId()), ", Your classId:", String.valueOf(player.getClassId().getId()), "<br></body></html>");
		html.setHtml(sb);
		player.sendPacket(html);
		return;
	}

	if (!npc.getTemplate().canTeach(classId))
	{
		NpcHtmlMessage html = new NpcHtmlMessage(npc.getObjectId());
		html.setHtml("<html><body>I cannot teach you any skills.<br>You must find your current class teachers. </body></html>");
		player.sendPacket(html);
		return;
	}

	if (player.getClassId().level() < 3)
	{
		NpcHtmlMessage html = new NpcHtmlMessage(npc.getObjectId());
		html.setHtml("<html><body> You must have 3rd class change quest completed.</body></html>");
		player.sendPacket(html);
		return;
	}

	ExEnchantSkillList esl = new ExEnchantSkillList();
	boolean empty = true;

	List<L2EnchantSkillLearn> esll = SkillTreeTable.getInstance().getAvailableEnchantSkills(player);
	for (L2EnchantSkillLearn skill : esll)
	{
		L2Skill sk = SkillTable.getInstance().getInfo(skill.getId(), skill.getLevel());
		if (sk == null)
			continue;

		L2EnchantSkillData data = SkillTreeTable.getInstance().getEnchantSkillData(skill.getEnchant());
		if (data == null)
			continue;

		esl.addSkill(skill.getId(), skill.getLevel(), data.getCostSp(), data.getCostExp());
		empty = false;
	}

	if (empty)
	{
		player.sendPacket(SystemMessageId.THERE_IS_NO_SKILL_THAT_ENABLES_ENCHANT);

		if (player.getLevel() < 74)
			player.sendPacket(SystemMessage.getSystemMessage(
                                   SystemMessageId.DO_NOT_HAVE_FURTHER_SKILLS_TO_LEARN_S1).addNumber(74));
		else
			player.sendPacket(SystemMessageId.NO_MORE_SKILLS_TO_LEARN);
	}
	else
		player.sendPacket(esl);

	player.sendPacket(ActionFailed.STATIC_PACKET);
}

When I click on button it shows me list with all availables skill which can be enchanted, but when I click on any window dissapears. This function is called from :

public void onBypassFeedback(L2PcInstance player, String command)
{
	if (command.startsWith("SkillList"))
	{
		player.setSkillLearningClassId(player.getClassId());
		showSkillList(player, player.getCurrentFolkNPC(), player.getClassId());
	}
	else if (command.startsWith("EnchantSkillList"))
		showEnchantSkillList(player, player.getCurrentFolkNPC(), player.getClassId());
	else if (command.startsWith("GiveBlessing"))
		giveBlessingSupport(player);
	else
		super.onBypassFeedback(player, command);
}

So I thought it is enough just to copy it, because there is nothing more called to show description after clicking on skill. Anybody knows where can I intercept that clicking on skill so I could write that code to display it?

15 answers to this question

Recommended Posts

  • 0
Posted

Bubu Labiel,

 

A NPC is linked by classes via getClassesToTeach(). Did you add such info on your custom NPC (classesToTeach from memory) ? See how current NPCs are working.

 

Be sure the bypass is currently good aswell.

 

If you created a new instance, the NPC has to be that type aswell in npcs.xml. The simpliest is probably to extends L2NpcInstance to get access to previous bypasses and add yours, or write your own bypass after existing ones on L2NpcInstance directly.

  • 0
Posted

Ok I used addTeachInfo() and it worked, thanks. However I still need that code which is responsible for displaying that skill info, do You know which htm it is or is it hardcoded somewhere ?

  • 0
Posted

Ok I used addTeachInfo() and it worked, thanks. However I still need that code which is responsible for displaying that skill info, do You know which htm it is or is it hardcoded somewhere ?

 

Ur talking about the server packet ?

 

  • 0
Posted

Check the xmls or sql, it should be named enchant_skills_tree.

 

xDDDDDDD

 

mp1q.jpg

I am talking about this window. How called is this htm ? Or is it hardcoded ? If yes then where?

 

 

it's definetly a serverpacket ExShowSkilllist.java

  • 0
Posted

mp1q.jpg

I am talking about this window. How called is this htm ? Or is it hardcoded ? If yes then where?

 

Do you want to duplicate this system just to add other items instead of Secret Book of Giants or?

 

Otherwise, check RequestExEnchantSkill/RequestExEnchantSkillInfo. Basically, it's all connected to the L2EnchantSkillData, so you can search for it to find all the ways.

  • 0
Posted

 

it's definetly a serverpacket ExShowSkilllist.java

In aCis pack there isnt anything like that.

 

Do you want to duplicate this system just to add other items instead of Secret Book of Giants or?

 

Otherwise, check RequestExEnchantSkill/RequestExEnchantSkillInfo. Basically, it's all connected to the L2EnchantSkillData, so you can search for it to find all the ways.

I want to duplicate this so I need its code. I have already checked RequestExEnchantSkill,RequestExEnchantSkillInfo, L2EnchantSkillData but there isn't that what I wanted, anyway ty for trying to help.

  • 0
Posted

In aCis pack there isnt anything like that.

I want to duplicate this so I need its code. I have already checked RequestExEnchantSkill,RequestExEnchantSkillInfo, L2EnchantSkillData but there isn't that what I wanted, anyway ty for trying to help.

 

first you create the packet, then you send it on the player with player.sendPacket

  • 0
Posted

I know how it works lol, but if I could get that htm it would save me a lot of work thats why I need it.

 

so you want it's htm value ? forget about that, because its static on your client, the server just writtes the values as bytes to the client not the whole structure of it.

  • 0
Posted

so you want it's htm value ? forget about that, because its static on your client, the server just writtes the values as bytes to the client not the whole structure of it.

Ok, thanks for info. Anyway thats not what I wanted to hear :D, but now I know I have to write it by my own. Or maybe You know if it is possible to intercept that request for showing skill (skill list -> then u click on skill -> and this request) so I could redirect it to my own class ?

  • 0
Posted

Ok, thanks for info. Anyway thats not what I wanted to hear :D, but now I know I have to write it by my own. Or maybe You know if it is possible to intercept that request for showing skill (skill list -> then u click on skill -> and this request) so I could redirect it to my own class ?

 

The only thing you can sniff from this, are only the values. Since the htm is hardcoded in the client it stays into client so there is no possible way to get it's source. you have to rewrite it on your own and then instead of using writeD writeS and etc you should work with String.replace but with the same style as the packet works, and then maybe your results are close enough

  • 0
Posted

Ok, thanks for info. Anyway thats not what I wanted to hear :D, but now I know I have to write it by my own. Or maybe You know if it is possible to intercept that request for showing skill (skill list -> then u click on skill -> and this request) so I could redirect it to my own class ?

If you want to add extra items you just need to send them to player in the packet.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Posts

    • Good luck with your project!
    • Hola Fissban , che queria preguntarte algo estoy tratando de hacer que el testserver ande pro que cuando logeo y voy a elejir el servidor no aparece y he estado con la ia incluso buscando que puede ser pero no e logrado decifrarlo me darias una mano o alguien ?  
    • The Return of L2Elixir – A Legacy Reborn in 2025 Read more features: https://l2elixir.org/features/ It’s time to relive the magic. Many of you remember L2Elixir, first launched in 2008 – a server that brought players together, created friendships, rivalries, and unforgettable memories. For two+ incredible years, until its closure in 2010, Elixir was more than just a server… it was home. In 2018, a fake project borrowed the name and damaged that legacy, but the true memories of L2Elixir never died. Today, in 2025, we are proud to announce that a new dedicated team has taken up the mantle to bring L2Elixir back to life – with respect for the past and a fresh vision for the future.   What to Expect We’re not here to be “just another server.” Our mission is to bring back nostalgia with innovation, offering a unique progression experience: Interlude-Like start, capturing that classic old-school feeling. A natural evolution into Gracia Final. Followed by Gracia Epilogue, keeping the journey alive without losing balance. This is not a copy-paste server – it’s a carefully crafted world designed to honor the spirit of Lineage II while introducing fresh ideas to keep the gameplay alive and rewarding. Why L2Elixir? A balanced environment where community comes first. A project built with passion, not profit. A server that values longevity, fairness, and nostalgia.   📅 Launch Date & Details Closed Beta: Online. Open Beta & Rewards: November 15 & 21:00 UTC +2 Launch: November 28 & 21:00 UTC +2   🔗 Join the Community Be part of history once again. Follow our Discord, join the discussion, and prepare to step back into the world where legends were made.   https://l2elixir.org/ https://discord.gg/5ydPHvhbxs L2Elixir 2025 – Honoring the Past. Building the Future.
    • 10-24-2025 - OUR TOPIC IS RELEVANT! CONTACT US BY THE CONTACTS BELOW
    • Can someone decompile in classes this LineageSkilleffect.u ? I am willing to pay if needed,  protocol god any. https://wormhole.app/BEj0pr#osVXtnL9Q-AmmVmxOcEZfw found, ty
  • Topics

×
×
  • Create New...

AdBlock Extension Detected!

Our website is made possible by displaying online advertisements to our members.

Please disable AdBlock browser extension first, to be able to use our community.

I've Disabled AdBlock