First you will create a new .java file
ItemSpawn.java
net.sf.l2j.gameserver.handler.itemhandlers
now go to net.sf.l2j.gameserver.handler.ItemHandler.java
-----------------------------------------
template = NpcTable.getInstance().getTemplate(100052); -> ID NPC/MOB/BOSS
private static final int[] ITEM_IDS = { 6673 }; -> ID Item Spawn
Hugs
ItemSpawn.java
net.sf.l2j.gameserver.handler.itemhandlers
- Code:
// by KallonE v-Final Copyright 2023 KallonE
// L2JLisvus!
// Source File Name: ItemSpawn.java
package net.sf.l2j.gameserver.handler.itemhandlers;
import java.util.logging.Logger;
import net.sf.l2j.Config;
import net.sf.l2j.gameserver.ThreadPoolManager;
import net.sf.l2j.gameserver.datatables.NpcTable;
import net.sf.l2j.gameserver.handler.IItemHandler;
import net.sf.l2j.gameserver.idfactory.IdFactory;
import net.sf.l2j.gameserver.model.L2ItemInstance;
import net.sf.l2j.gameserver.model.actor.instance.L2MonsterInstance;
import net.sf.l2j.gameserver.model.actor.instance.L2NpcInstance;
import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
import net.sf.l2j.gameserver.model.actor.instance.L2PlayableInstance;
import net.sf.l2j.gameserver.model.actor.instance.L2RaidBossInstance;
import net.sf.l2j.gameserver.network.serverpackets.ActionFailed;
import net.sf.l2j.gameserver.network.serverpackets.SocialAction;
import net.sf.l2j.gameserver.network.serverpackets.SystemMessage;
import net.sf.l2j.gameserver.templates.L2NpcTemplate;
/**
* Created by KallonE
* User: L2jlisvus
* Date: 16.04.23
* Time: 11:30
* To change this template use File | Settings | File Templates.
*/
public class ItemSpawn implements IItemHandler
{
protected static Logger _log = Logger.getLogger(ItemSpawn.class.getName());
private static final int[] ITEM_IDS = { 6673 };
public void useItem(L2PcInstance activeChar, String monsterId, L2ItemInstance item, boolean par){}
public int[] getItemIds()
{
return ITEM_IDS;
}
public void useItem(L2PlayableInstance playable, L2ItemInstance item)
{
_log.info("use item" +item);
L2PcInstance activeChar;
activeChar = (L2PcInstance) playable;
L2NpcTemplate template;
template = NpcTable.getInstance().getTemplate(100052);
if (activeChar.isInOlympiadMode())
{
return;
}
//TODO flood protector
L2RaidBossInstance id = new L2RaidBossInstance(IdFactory.getInstance().getNextId(), template);
id.spawnMe(activeChar.getX(), activeChar.getY(), activeChar.getZ());
id.setHeading(activeChar.getHeading());
id.setCurrentHpMp(id.getMaxHp(), id.getMaxMp());
id.setIsRaid(true);
ThreadPoolManager.getInstance().scheduleGeneral(new deleteNPC(id), 100052);
activeChar.destroyItem("Summon", item.getObjectId(), 1, null, true);
}
public class deleteNPC implements Runnable
{
protected L2NpcInstance _npc;
public void run()
{
_npc.deleteMe();
}
deleteNPC(L2NpcInstance npc)
{
_npc = npc;
}
}
}
now go to net.sf.l2j.gameserver.handler.ItemHandler.java
- Code:
import net.sf.l2j.gameserver.handler.itemhandlers.SummonItems;
+import net.sf.l2j.gameserver.handler.itemhandlers.ItemSpawn;
registerItemHandler(new ScrollOfEscape());
+ registerItemHandler(new ItemSpawn());
-----------------------------------------
template = NpcTable.getInstance().getTemplate(100052); -> ID NPC/MOB/BOSS
private static final int[] ITEM_IDS = { 6673 }; -> ID Item Spawn
Hugs