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

    • https://jmp.sh/akQ30Yon   Watch the video and see if the spirit of Lineage 2 is still there?
    • 新产品!快来抢购独家新品,以最优价格购买! ➡带文件验证的 Facebook Business Manager (BM) | 绑定到已激活的 Business Manager 账户 | 限额 $50(第一天)+ $250(后续天数)| 价格从 $25 起 ➡在 Fragment.com 上验证的 Telegram 资料 | 账户通过真实文件验证 | 包含 Telegram 账户格式:TDATA + SESSION + JSON + 2FA + 密码 | 地区:MIX | 价格从 $30 起 ➡Telegram 哈萨克斯坦 +7 | 格式:TDATA + SESSION + JSON | 无垃圾邮件限制 | 2FA 启用 | 账户年龄:从 3 天起 | 价格从 $2.5 起 ➡Adobe Creative Cloud 订阅 7 天 / 30 天 / 3 个月 / 1 年(任选时长)| 所有应用和所有语言可用 | AI 功能 1000+ 积分 | 个人账户 | 价格从 $5 起 可通过网站或 Bot 在我们的商店购买! 有效链接: 数字商品商店(网站):进入 商店 Telegram Bot:进入 – 通过 Telegram 方便访问商店。 其他服务: Telegram Stars 购买 Bot:进入 – 快速且划算地购买 Telegram Stars。 SMM 面板:进入 – 推广您的社交媒体账户。 我们为您呈现当前购买我们产品和服务的促销和特别优惠列表: 1. 九月在我们的商店(网站、Bot)购买可使用优惠码 OCTOBER2025(8% 折扣)!首次购买也可使用优惠码:SOCNET(15% 折扣) 2. 获取 $1 商店余额或 10–20% 折扣 — 注册后按照格式发布用户名:“SEND ME BONUS, MY USERNAME IS…” — 发布在我们的论坛帖中! 3. 第一次 SMM 面板试用可获得 $1 — 只需在我们网站(Support)打开主题为 “Get Trial Bonus” 的工单。 4. 每周在我们的 Telegram 频道和 Stars 购买 Bot 中赠送 Telegram Stars! 新闻: ➡ Telegram 频道:https://t.me/accsforyou_shop ➡ WhatsApp 频道:https://chat.whatsapp.com/K8rBy500nA73z27PxgaJUw?mode=ems_copy_t ➡ Discord 服务器:https://discord.gg/y9AStFFsrh 联系方式与支持: ➡ Telegram:https://t.me/socnet_support ➡ WhatsApp:https://wa.me/79051904467 ➡ Discord:socnet_support ➡ ✉ 邮箱:solomonbog@socnet.store
    • 新产品!快来抢购独家新品,以最优价格购买! ➡带文件验证的 Facebook Business Manager (BM) | 绑定到已激活的 Business Manager 账户 | 限额 $50(第一天)+ $250(后续天数)| 价格从 $25 起 ➡在 Fragment.com 上验证的 Telegram 资料 | 账户通过真实文件验证 | 包含 Telegram 账户格式:TDATA + SESSION + JSON + 2FA + 密码 | 地区:MIX | 价格从 $30 起 ➡Telegram 哈萨克斯坦 +7 | 格式:TDATA + SESSION + JSON | 无垃圾邮件限制 | 2FA 启用 | 账户年龄:从 3 天起 | 价格从 $2.5 起 ➡Adobe Creative Cloud 订阅 7 天 / 30 天 / 3 个月 / 1 年(任选时长)| 所有应用和所有语言可用 | AI 功能 1000+ 积分 | 个人账户 | 价格从 $5 起 可通过网站或 Bot 在我们的商店购买! 有效链接: 数字商品商店(网站):进入 商店 Telegram Bot:进入 – 通过 Telegram 方便访问商店。 其他服务: Telegram Stars 购买 Bot:进入 – 快速且划算地购买 Telegram Stars。 SMM 面板:进入 – 推广您的社交媒体账户。 我们为您呈现当前购买我们产品和服务的促销和特别优惠列表: 1. 九月在我们的商店(网站、Bot)购买可使用优惠码 OCTOBER2025(8% 折扣)!首次购买也可使用优惠码:SOCNET(15% 折扣) 2. 获取 $1 商店余额或 10–20% 折扣 — 注册后按照格式发布用户名:“SEND ME BONUS, MY USERNAME IS…” — 发布在我们的论坛帖中! 3. 第一次 SMM 面板试用可获得 $1 — 只需在我们网站(Support)打开主题为 “Get Trial Bonus” 的工单。 4. 每周在我们的 Telegram 频道和 Stars 购买 Bot 中赠送 Telegram Stars! 新闻: ➡ Telegram 频道:https://t.me/accsforyou_shop ➡ WhatsApp 频道:https://chat.whatsapp.com/K8rBy500nA73z27PxgaJUw?mode=ems_copy_t ➡ Discord 服务器:https://discord.gg/y9AStFFsrh 联系方式与支持: ➡ Telegram:https://t.me/socnet_support ➡ WhatsApp:https://wa.me/79051904467 ➡ Discord:socnet_support ➡ ✉ 邮箱:solomonbog@socnet.store
    • New Products! Hurry up and buy exclusive new arrivals at the best prices. ➡ Verified Facebook Business Manager (BM) with documents | Linked to an account with an active Business Manager | Limit $50 (first day) + $250 (next days) | Price from: $25 ➡ Verified Telegram profile on Fragment.com | Account verified with real documents | Includes Telegram account in TDATA + SESSION + JSON + 2FA + password format | GEO: MIX | Price from: $30 ➡ Telegram Kazakhstan +7 | Format: TDATA + SESSION + JSON | No spam-block | 2FA enabled | Age: from 3 days | Price from: $2.5 ➡ Adobe Creative Cloud subscription for 7 days / 30 days / 3 months / 1 year (duration of your choice) | All apps and all languages available | 1000+ credits for AI features | Personal account | Price from: $5 Buy in our store via website or bot! Active Links: Digital Goods Store (Website): Go Store Telegram Bot: Go – convenient access to the store via Telegram messenger. Other Services: Telegram Bot for purchasing Telegram Stars: Go – fast and profitable purchase of Telegram Stars. SMM Panel: Go – promote your social media accounts. We would like to present to you the current list of promotions and special offers for purchasing our products and services: 1. Promo code OCTOBER2025 (8% discount) for purchases in our store (Website, Bot) in September! You can also use the first-purchase promo code: SOCNET (15% discount) 2. Get $1 credited to your store balance or a 10–20% discount — simply write your username after registration on our website using the following format: “SEND ME BONUS, MY USERNAME IS…” — post it in our forum thread! 3. Get $1 for your first SMM Panel trial — just open a ticket titled “Get Trial Bonus” on our website (Support). 4. Weekly Telegram Stars giveaways in our Telegram channel and in our Stars purchasing bot! News: ➡ Telegram Channel: https://t.me/accsforyou_shop ➡ WhatsApp Channel: https://chat.whatsapp.com/K8rBy500nA73z27PxgaJUw?mode=ems_copy_t ➡ Discord Server: https://discord.gg/y9AStFFsrh Contacts & Support: ➡ Telegram: https://t.me/socnet_support ➡ WhatsApp: https://wa.me/79051904467 ➡ Discord: socnet_support ➡ ✉ Email: solomonbog@socnet.store
  • 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