Jump to content

Question

Posted

when i got to shop and try to buy weapon please help

java.lang.NullPointerException
        at com.l2jserver.gameserver.model.actor.instance.L2MerchantInstance.showBuyWindow(L2MerchantInstance.java:107)
        at com.l2jserver.gameserver.model.actor.instance.L2MerchantInstance.showBuyWindow(L2MerchantInstance.java:87)
        at handlers.bypasshandlers.Buy.useBypass(Buy.java:54)
        at com.l2jserver.gameserver.model.actor.L2Npc.onBypassFeedback(L2Npc.java:776)
        at com.l2jserver.gameserver.model.actor.instance.L2PetManagerInstance.onBypassFeedback(L2PetManagerInstance.java:164)
        at com.l2jserver.gameserver.network.clientpackets.RequestBypassToServer.runImpl(RequestBypassToServer.java:197)
        at com.l2jserver.gameserver.network.clientpackets.L2GameClientPacket.run(L2GameClientPacket.java:68)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)

 

 

/*
 * Copyright (C) 2004-2016 L2J Server
 * 
 * This file is part of L2J Server.
 * 
 * L2J Server is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * L2J Server is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 */
package com.l2jserver.gameserver.model.actor.instance;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.l2jserver.gameserver.data.xml.impl.BuyListData;
import com.l2jserver.gameserver.datatables.MerchantPriceConfigTable;
import com.l2jserver.gameserver.datatables.MerchantPriceConfigTable.MerchantPriceConfig;
import com.l2jserver.gameserver.enums.InstanceType;
import com.l2jserver.gameserver.model.actor.templates.L2NpcTemplate;
import com.l2jserver.gameserver.model.buylist.L2BuyList;
import com.l2jserver.gameserver.network.serverpackets.ActionFailed;
import com.l2jserver.gameserver.network.serverpackets.BuyList;
import com.l2jserver.gameserver.network.serverpackets.ExBuySellList;

/**
 * This class ...
 * @version $Revision: 1.10.4.9 $ $Date: 2005/04/11 10:06:08 $
 */
public class L2MerchantInstance extends L2NpcInstance
{
	private static final Logger LOG = LoggerFactory.getLogger(L2MerchantInstance.class);
	private MerchantPriceConfig _mpc;
	
	/**
	 * Creates a merchant,
	 * @param template the merchant NPC template
	 */
	public L2MerchantInstance(L2NpcTemplate template)
	{
		super(template);
		setInstanceType(InstanceType.L2MerchantInstance);
	}
	
	@Override
	public void onSpawn()
	{
		super.onSpawn();
		_mpc = MerchantPriceConfigTable.getInstance().getMerchantPriceConfig(this);
	}
	
	@Override
	public String getHtmlPath(int npcId, int val)
	{
		String pom = "";
		
		if (val == 0)
		{
			pom = "" + npcId;
		}
		else
		{
			pom = npcId + "-" + val;
		}
		
		return "data/html/merchant/" + pom + ".htm";
	}
	
	/**
	 * @return Returns the mpc.
	 */
	public MerchantPriceConfig getMpc()
	{
		return _mpc;
	}
	
	public final void showBuyWindow(L2PcInstance player, int val)
	{
		showBuyWindow(player, val, true);
	}
	
	public final void showBuyWindow(L2PcInstance player, int val, boolean applyTax)
	{
		final L2BuyList buyList = BuyListData.getInstance().getBuyList(val);
		if (buyList == null)
		{
			LOG.warn("BuyList not found! BuyListId: {}", val);
			player.sendPacket(ActionFailed.STATIC_PACKET);
			return;
		}
		
		if (!buyList.isNpcAllowed(getId()))
		{
			LOG.warn("Npc not allowed in BuyList! BuyListId: {} NpcId: {}", val, getId());
			player.sendPacket(ActionFailed.STATIC_PACKET);
			return;
		}
		
		final double taxRate = (applyTax) ? getMpc().getTotalTaxRate() : 0;
		
		player.setInventoryBlockingStatus(true);
		if (player.isGM())
		{
			player.sendMessage("Buy List [" + buyList.getListId() + "]");
		}
		player.sendPacket(new BuyList(buyList, player.getAdena(), taxRate));
		player.sendPacket(new ExBuySellList(player, taxRate, false));
		player.sendPacket(ActionFailed.STATIC_PACKET);
	}
}

 

6 answers to this question

Recommended Posts

  • 0
Posted

It have something to do with buylists 

If npc id is custom you may have to add it in allowednpcs for acis is castles.xml as i remember l2jserver i dont know

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   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.



  • Posts

    • Hello everyone, Martin here - aka tehSx1, junior developer. I’m currently looking for work in private server development. I have experience working with L2JLucera, L2JEternity, L2JMobius, with Classic, Interlude, and H5 clients. The last project I participated in was L2-Avalon, a rework of Interlude using Classic files. I’m from Argentina, but I understand English very well for fluent communication. I can work on configuration, maintenance, creating NPCs, mobs, items, fixing skills, or anything related to the server side. I also have basic knowledge to work on the client side as well. I have some self-taught knowledge of Java, so with a bit of time and ChatGPT I can get things done there too. Anyone interested can contact me on Discord (Smookes420#4425) to discuss terms. I’m open to new opportunities and excited to take part in new projects to continue my learning process. P.S.: I’ve been playing Lineage 2 since I was 6 years old on Chronicle C1. I’m 26 now. It’s all about the passion for the game, bro. 
    • What does ‘half-finished’ even mean? Most projects based on L2Off use essentially the same files made for gold-style servers, and they’re fully functional. As for the L2J branches, calling them ‘half-finished’ couldn’t be further from the truth, they’re not only complete in the sense of gold-style projects but are actually extended with even more features.
    • Discord         :  utchiha_market Telegram        : https://t.me/utchiha_market Auto Buy Store  : https://utchiha-market.mysellauth.com/ Not sure if we’re legit? Check Our server — real reviews, real buyers https://discord.gg/4EPpYhe2HA  | https://campsite.bio/utchihaamkt  
    • sell adena l2rebon signature x1 - 1kk = 1 dollars l2reborn x10 - 500kk = 4.7 dollars E-Global x Lu4 - 1kk = 2.7 dollars BOHPTS - x20-x500 TOP PRICE DISCORD - GODDARDSHOP TELEGRAM - MMOPROMO Also on sale are Epic jewelry, Clothes at a very good price
    • For wholesale clients   We understand that favorable terms are especially important when dealing with large volumes. That’s why we offer a flexible system for wholesale clients  we can discuss pricing and provide personalized solutions tailored to your needs. With us, you get not only a reliable service but also support focused on long-term cooperation. We value partners who operate at scale and do everything possible to make it convenient and profitable for you to grow together with Vibe SMS.   Website link — https://vibe-sms.net/ Our Telegram channel — https://t.me/vibe_sms   Quality in the Details     As Henry Ford said: "Quality means doing it right even when no one is looking."   At Vibe SMS, we believe the same. Every number and every feature is designed to make your work easy and stress-free. With us, it’s simple: grab a number, complete your task, and move forward. Reliability, comfort, and attention to detail — that’s our vibe, helping you focus on what really matters.   Website link — https://vibe-sms.net/ Our Telegram channel — https://t.me/vibe_sms  
  • 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