Jump to content

Help Npc Skill Seler


l2weeds
 Share

Recommended Posts

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

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share



×
×
  • 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 Disbaled AdBlock