Skip to content

Npc Skill Seler

Featured Replies

Who can help me add to this npc skill seller the restriction that a plaque can not buy more than 6 skill

 

package com.l2jfrozen.gameserver.model.actor.instance;

import com.l2jfrozen.gameserver.datatables.SkillTable;
import com.l2jfrozen.gameserver.model.L2Skill;
import com.l2jfrozen.gameserver.network.serverpackets.NpcHtmlMessage;
import com.l2jfrozen.gameserver.templates.L2NpcTemplate;
/*
 * @author Rizlaaa
 * 
 * @editor Gabriel Fleck
 * @Date 2018/12/15
 * @version 1.1
 */
public class L2SkillSellerInstance extends L2NpcInstance
{
    public final static int ITEM_ID = 3470;
    public final static int ITEM_COUNT = 20;

buy restriction skill = max 6

    private final int[] SKILL_IDS =
    {
        3124, 3125, 3132, 3133, 
        3134, 3135, 3136, 3137, 
        3138, 3139, 3140, 3141
    };
        
    public L2SkillSellerInstance(int objectId, L2NpcTemplate template)
    {
        super(objectId, template);
    }
    
    @Override
    public void showChatWindow(L2PcInstance j, int val)
    {
        if (j == null)
            return;
        StringBuilder t = new StringBuilder();
        NpcHtmlMessage n = new NpcHtmlMessage(getObjectId());
        sendHtml(t, n, j);
    }
        
    private void sendHtml(StringBuilder t, NpcHtmlMessage n, L2PcInstance j)
    {
        t.append("<html><body><center>");
        t.append("Hello, do you want some special skills?<br1>");
        t.append("Choose whatever you want but don't forget<br1>");
        t.append("you need 20 Gold Bars for each one.<br>");
        for (int i : SKILL_IDS)
        {
            L2Skill s = SkillTable.getInstance().getInfo(i, 10);
            String name = "";
            if (s != null)
                name = s.getName();
            if (name != "")
                t.append("<center><a action=\"bypass -h skill" + i + "\">" + name + " Lv 10</a><br1>");
        }
        t.append("</center></body></html>");
        n.setHtml(t.toString());
        j.sendPacket(n);
    }
}

please beautifully helped as a little bit kicking this restriction code

 

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.