Jump to content
  • 0

Request little help


Leon29

Question

What is wrong with this code

/*
* This program 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.
* 
* This program 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 teleports.GrandBossTeleporters;

import com.l2jserver.Config;
import com.l2jserver.gameserver.datatables.DoorTable;
import com.l2jserver.gameserver.instancemanager.GrandBossManager;
import com.l2jserver.gameserver.instancemanager.QuestManager;
import com.l2jserver.gameserver.model.L2CommandChannel;
import com.l2jserver.gameserver.model.L2Party;
import com.l2jserver.gameserver.model.actor.L2Npc;
import com.l2jserver.gameserver.model.actor.instance.L2GrandBossInstance;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.quest.Quest;
import com.l2jserver.gameserver.model.quest.QuestState;
import com.l2jserver.gameserver.model.zone.type.L2BossZone;
import com.l2jserver.gameserver.util.Util;

/**
* @author Plim
* Original python script by Emperorc
*/
public class GrandBossTeleporters extends Quest
{
private static final int[] NPCs = 
{ 
	13001, //Heart of Warding : Teleport into Lair of Antharas
	36600, //Heart of Volcano : Teleport into Lair of Valakas

	31859, //Teleportation Cubic : Teleport out of Lair of Antharas
	31384, //Gatekeeper of Fire Dragon : Opening some doors
	31540, //Watcher of Valakas Klein : Teleport into Hall of Flames
	31686, //Gatekeeper of Fire Dragon : Opens doors to Heart of Volcano
	31687, //Gatekeeper of Fire Dragon : Opens doors to Heart of Volcano
	31759 //Teleportation Cubic : Teleport out of Lair of Valakas
};
  
    private Quest antharasAI()
    {
        return QuestManager.getInstance().getQuest("antharas");
    }
    private Quest valakasAI()
    {
        return QuestManager.getInstance().getQuest("valakas");
    }

private static int playerCount = 0;

@Override
public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
{
	String htmltext = "";
	QuestState st = player.getQuestState(getName());

	if (st == null)
		st = newQuestState(player);

		player.teleToLocation(183813, -115157, -3303);
		st.set("allowEnter", "1");

	return htmltext;
}

@Override
public String onTalk(L2Npc npc, L2PcInstance player)
{
	String htmltext = "";
	QuestState st = player.getQuestState(getName());

	if (st == null)
		return null;

	switch (npc.getNpcId())
	{
		case 13001:
			if (antharasAI() != null)
			{
				if (player.getParty() == null)
				{
					htmltext = "test.htm";
				}

				if (player.getParty().getCommandChannel() == null)
				{
					htmltext = "test.htm";
				}

				if (player.getParty().getCommandChannel().getLeader() != player)
				{
					htmltext = "test.htm";
				}

				if (player.getParty().getCommandChannel().getMemberCount() < 2 || player.getParty().getCommandChannel().getMemberCount() > 65)
				{
					htmltext = "test.htm";
				}

				for (L2PcInstance channelMember : player.getParty().getCommandChannel().getMembers())
				{
					if (!Util.checkIfInRange(1000, player, channelMember, true))
					{
						htmltext = "test.htm";
					}
				}
				int status = GrandBossManager.getInstance().getBossStatus(29019);
				int statusW = GrandBossManager.getInstance().getBossStatus(29066);
				int statusN = GrandBossManager.getInstance().getBossStatus(29067);
				int statusS = GrandBossManager.getInstance().getBossStatus(29068);

				if (status == 2 || statusW == 2 || statusN == 2 || statusS == 2)
					htmltext = "13001-02.htm";

				else if (status == 3 || statusW == 3 || statusN == 3 || statusS == 3)
					htmltext = "13001-01.htm";

				else if (status == 0 || status == 1) //If entrance to see Antharas is unlocked (he is Dormant or Waiting)
				{
						// st.takeItems(3865, 1); // No longer consumed in h5
						L2BossZone zone = GrandBossManager.getInstance().getZone(179700, 113800, -7709);

						if (zone != null)
							zone.allowPlayerEntry(player, 30);

						for (L2PcInstance channelMember : player.getParty().getCommandChannel().getMembers())
						{
							channelMember.teleToLocation(179700 + getRandom(700), 113800 + getRandom(2100), -7709);
						}



						if (status == 0)
						{
							L2GrandBossInstance antharas = GrandBossManager.getInstance().getBoss(29019);
							antharasAI().notifyEvent("waiting", antharas, player);
						}
				}
			}
			break;

		case 31859:
			player.teleToLocation(79800 + getRandom(600), 151200 + getRandom(1100), -3534);
			break;

		case 31385:
			if (valakasAI() != null)
			{
				int status = GrandBossManager.getInstance().getBossStatus(29028);

				if (status == 0 || status == 1)
				{
					if (playerCount >= 200)
						htmltext = "31385-03.htm";

						st.unset("allowEnter");
						L2BossZone zone = GrandBossManager.getInstance().getZone(212852, -114842, -1632);

						if (zone != null)
							zone.allowPlayerEntry(player, 30);

						player.teleToLocation(204328 + getRandom(600), -111874 + getRandom(600), 70);

						playerCount++;

						if (status == 0)
						{
							L2GrandBossInstance valakas = GrandBossManager.getInstance().getBoss(29028);
							valakasAI().startQuestTimer("1001", Config.Valakas_Wait_Time, valakas, null);
							GrandBossManager.getInstance().setBossStatus(29028, 1);
						}
				}
				else if (status == 2)
					htmltext = "31385-02.htm";
				else
					htmltext = "31385-01.htm";
			}

			else
				htmltext = "31385-01.htm";
			break;

		case 31384:
			DoorTable.getInstance().getDoor(24210004).openMe();
			break;

		case 31686:
			DoorTable.getInstance().getDoor(24210006).openMe();
			break;

		case 31687:
			DoorTable.getInstance().getDoor(24210005).openMe();
			break;

		case 31540:
			if (playerCount < 50)
				htmltext = "31540-01.htm";

			else if (playerCount < 100)
				htmltext = "31540-02.htm";

			else if (playerCount < 150)
				htmltext = "31540-03.htm";

			else if (playerCount < 200)
				htmltext = "31540-04.htm";

			else
				htmltext = "31540-05.htm";
			break;

		case 31759:
			player.teleToLocation(150037 + getRandom(500), -57720 + getRandom(500), -2976);
			break;
	}

	return htmltext;
}

public GrandBossTeleporters(int questId, String name, String descr)
{
	super(questId, name, descr);

	for (int npcId : NPCs)
	{
		addStartNpc(npcId);
		addTalkId(npcId);
	}
}

public static void main(String[] args)
{
	new GrandBossTeleporters(-1, GrandBossTeleporters.class.getSimpleName(), "teleports");
}
}

 

i get this error:

Jun 21, 2012 1:32:15 AM com.l2jserver.gameserver.model.quest.Quest showError
WARNING: D:\h5 svr\game\data\scripts\teleports\GrandBossTeleporters\GrandBossTeleporters.java
java.lang.NullPointerException
at teleports.GrandBossTeleporters.GrandBossTeleporters.onTalk(GrandBossTeleporters.java:95)
at com.l2jserver.gameserver.model.quest.Quest.notifyTalk(Quest.java:636)
at handlers.bypasshandlers.QuestLink.showQuestWindow(QuestLink.java:197)
at handlers.bypasshandlers.QuestLink.useBypass(QuestLink.java:65)
at com.l2jserver.gameserver.model.actor.L2Npc.onBypassFeedback(L2Npc.java:945)
at com.l2jserver.gameserver.network.clientpackets.RequestBypassToServer.runImpl(RequestBypassToServer.java:145)
at com.l2jserver.gameserver.network.clientpackets.L2GameClientPacket.run(L2GameClientPacket.java:62)
at com.l2jserver.gameserver.network.L2GameClient.run(L2GameClient.java:1097)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

 

line 95: if (player.getParty().getCommandChannel() == null)

 

:o

Link to comment
Share on other sites

9 answers to this question

Recommended Posts

  • 0

mhm how can i make it to be only in one npc ?

 

/*
* This program 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.
* 
* This program 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 teleports.GrandBossTeleporters;

import com.l2jserver.Config;
import com.l2jserver.gameserver.datatables.DoorTable;
import com.l2jserver.gameserver.instancemanager.GrandBossManager;
import com.l2jserver.gameserver.instancemanager.QuestManager;
import com.l2jserver.gameserver.model.actor.L2Npc;
import com.l2jserver.gameserver.model.actor.instance.L2GrandBossInstance;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.quest.Quest;
import com.l2jserver.gameserver.model.quest.QuestState;
import com.l2jserver.gameserver.model.zone.type.L2BossZone;

/**
* @author Plim
* Original python script by Emperorc
*/
public class GrandBossTeleporters extends Quest
{
private static final int[] NPCs = 
{
	31384, //Gatekeeper of Fire Dragon : Opening some doors
	31540, //Watcher of Valakas Klein : Teleport into Hall of Flames
	31686, //Gatekeeper of Fire Dragon : Opens doors to Heart of Volcano
	31687, //Gatekeeper of Fire Dragon : Opens doors to Heart of Volcano
	31759 //Teleportation Cubic : Teleport out of Lair of Valakas
};
  
    private Quest antharasAI()
    {
        return QuestManager.getInstance().getQuest("antharas");
    }
    private Quest valakasAI()
    {
        return QuestManager.getInstance().getQuest("valakas");
    }

private static int playerCount = 0;

@Override
public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
{
	String htmltext = "";
	QuestState st = player.getQuestState(getName());

	if (st == null)
		st = newQuestState(player);

		player.teleToLocation(183813, -115157, -3303);
		st.set("allowEnter", "1");

	return htmltext;

}

public String onTalk(String event, L2Npc npc, L2PcInstance player)
{
	String htmltext = "";
	QuestState st = player.getQuestState(getName());

	if (st == null)
		return null;

	if ( event.equalsIgnoreCase("antharas") && npc.getNpcId() == 36600)
	{
			if (antharasAI() != null)
			{
				int status = GrandBossManager.getInstance().getBossStatus(29019);
				int statusW = GrandBossManager.getInstance().getBossStatus(29066);
				int statusN = GrandBossManager.getInstance().getBossStatus(29067);
				int statusS = GrandBossManager.getInstance().getBossStatus(29068);

				if (player.getParty() == null)
					htmltext = "36600-03.htm";

				else if (player.getParty().getCommandChannel() == null)
					htmltext = "36600-04.htm";

				else if (player.getParty().getCommandChannel().getLeader() != player)
					htmltext = "36600-05.htm";

				else if (player.getParty().getCommandChannel().getMemberCount() < 2 || player.getParty().getCommandChannel().getMemberCount() > 65)
					htmltext = "36600-06.htm";

				else if (status == 2 || statusW == 2 || statusN == 2 || statusS == 2)
					htmltext = "36600-02.htm";

				else if (status == 3 || statusW == 3 || statusN == 3 || statusS == 3)
					htmltext = "36600-01.htm";

				else if (status == 0 || status == 1) //If entrance to see Antharas is unlocked (he is Dormant or Waiting)
				{
						L2BossZone zone = GrandBossManager.getInstance().getZone(179700, 113800, -7709);

						if (zone != null)
							zone.allowPlayerEntry(player, 30);

						for (L2PcInstance channelMember : player.getParty().getCommandChannel().getMembers())
						{
							channelMember.teleToLocation(179700 + getRandom(700), 113800 + getRandom(2100), -7709);
						}



						if (status == 0)
						{
							L2GrandBossInstance antharas = GrandBossManager.getInstance().getBoss(29019);
							antharasAI().notifyEvent("waiting", antharas, player);
						}
				}
			}
		}
		else if ( event.equalsIgnoreCase("valakas") && npc.getNpcId() == 36600)
		{
			if (valakasAI() != null)
			{
				int status = GrandBossManager.getInstance().getBossStatus(29028);

				if (status == 0 || status == 1)
				{
					if (playerCount >= 200)
						htmltext = "36601-03.htm";

						st.unset("allowEnter");
						L2BossZone zone = GrandBossManager.getInstance().getZone(212852, -114842, -1632);

						if (zone != null)
							zone.allowPlayerEntry(player, 30);

						if (player.getParty() == null)
							htmltext = "36601-04.htm";

						else if (player.getParty().getCommandChannel() == null)
							htmltext = "36601-05.htm";

						else if (player.getParty().getCommandChannel().getLeader() != player)
							htmltext = "36601-06.htm";

						else if (player.getParty().getCommandChannel().getMemberCount() < 2 || player.getParty().getCommandChannel().getMemberCount() > 65)
							htmltext = "36601-07.htm";

						for (L2PcInstance channelMember : player.getParty().getCommandChannel().getMembers())
						{
							channelMember.teleToLocation(204328 + getRandom(600), -111874 + getRandom(600), 70);
						}

						playerCount++;

						if (status == 0)
						{
							L2GrandBossInstance valakas = GrandBossManager.getInstance().getBoss(29028);
							valakasAI().startQuestTimer("1001", Config.Valakas_Wait_Time, valakas, null);
							GrandBossManager.getInstance().setBossStatus(29028, 1);
						}
				}
				else if (status == 2)
					htmltext = "36601-02.htm";
				else
					htmltext = "36601-01.htm";
			}

			else
				htmltext = "31385-01.htm";
		}

	switch (npc.getNpcId())
	{
		case 31859:
			player.teleToLocation(79800 + getRandom(600), 151200 + getRandom(1100), -3534);
			break;

		case 31384:
			DoorTable.getInstance().getDoor(24210004).openMe();
			break;

		case 31686:
			DoorTable.getInstance().getDoor(24210006).openMe();
			break;

		case 31687:
			DoorTable.getInstance().getDoor(24210005).openMe();
			break;

		case 31540:
			if (playerCount < 50)
				htmltext = "31540-01.htm";

			else if (playerCount < 100)
				htmltext = "31540-02.htm";

			else if (playerCount < 150)
				htmltext = "31540-03.htm";

			else if (playerCount < 200)
				htmltext = "31540-04.htm";

			else
				htmltext = "31540-05.htm";
			break;

		case 31759:
			player.teleToLocation(150037 + getRandom(500), -57720 + getRandom(500), -2976);
			break;
	}

	return htmltext;
}

public GrandBossTeleporters(int questId, String name, String descr)
{
	super(questId, name, descr);

	for (int npcId : NPCs)
	{
		addStartNpc(npcId);
		addTalkId(npcId);
	}
}

public static void main(String[] args)
{
	new GrandBossTeleporters(-1, GrandBossTeleporters.class.getSimpleName(), "teleports");
}
}

 

html

<a action="bypass -h npc_%objectId%_Quest GrandBossTeleporters antharas">Antharas.</a><br>
<a action="bypass -h npc_%objectId%_Quest GrandBossTeleporters valakas">Valakas.</a>

 

when i press Antharas / Valakas i get " You are either not on a quest, . . . . . . . . . . "

Link to comment
Share on other sites

  • 0

try something like that

 

/*
* This program 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.
* 
* This program 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 teleports.GrandBossTeleporters;

import com.l2jserver.Config;
import com.l2jserver.gameserver.datatables.DoorTable;
import com.l2jserver.gameserver.instancemanager.GrandBossManager;
import com.l2jserver.gameserver.instancemanager.QuestManager;
import com.l2jserver.gameserver.model.actor.L2Npc;
import com.l2jserver.gameserver.model.actor.instance.L2GrandBossInstance;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.quest.Quest;
import com.l2jserver.gameserver.model.quest.QuestState;
import com.l2jserver.gameserver.model.zone.type.L2BossZone;



public class GrandBossTeleporters extends Quest
{
private static final int[] NPCs = 
{
	31384, //Gatekeeper of Fire Dragon : Opening some doors
	31540, //Watcher of Valakas Klein : Teleport into Hall of Flames
	31686, //Gatekeeper of Fire Dragon : Opens doors to Heart of Volcano
	31687, //Gatekeeper of Fire Dragon : Opens doors to Heart of Volcano
	31759 //Teleportation Cubic : Teleport out of Lair of Valakas
};
   	
private Quest antharasAI()
    	{
      		return QuestManager.getInstance().getQuest("antharas");
    	}
   	
private Quest valakasAI()
    	{
    	    return QuestManager.getInstance().getQuest("valakas");
    	}

private static int playerCount = 0;

@Override
public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
{
	String htmltext = "";
	QuestState st = player.getQuestState(getName());

	if (st == null)
	{
		st = newQuestState(player);
	}	

	if (event.equalsIgnoreCase("antharas") && npc.getNpcId() == 36600)
	{
			if (antharasAI() != null)
			{
				int status = GrandBossManager.getInstance().getBossStatus(29019);
				int statusW = GrandBossManager.getInstance().getBossStatus(29066);
				int statusN = GrandBossManager.getInstance().getBossStatus(29067);
				int statusS = GrandBossManager.getInstance().getBossStatus(29068);

				if (player.getParty() == null)
					htmltext = "36600-03.htm";

				else if (player.getParty().getCommandChannel() == null)
					htmltext = "36600-04.htm";

				else if (player.getParty().getCommandChannel().getLeader() != player)
					htmltext = "36600-05.htm";

				else if (player.getParty().getCommandChannel().getMemberCount() < 2 || player.getParty().getCommandChannel().getMemberCount() > 65)
					htmltext = "36600-06.htm";

				else if (status == 2 || statusW == 2 || statusN == 2 || statusS == 2)
					htmltext = "36600-02.htm";

				else if (status == 3 || statusW == 3 || statusN == 3 || statusS == 3)
					htmltext = "36600-01.htm";

				else if (status == 0 || status == 1) //If entrance to see Antharas is unlocked (he is Dormant or Waiting)
				{
						L2BossZone zone = GrandBossManager.getInstance().getZone(179700, 113800, -7709);

						if (zone != null)
							zone.allowPlayerEntry(player, 30);

						for (L2PcInstance channelMember : player.getParty().getCommandChannel().getMembers())
						{
							channelMember.teleToLocation(179700 + getRandom(700), 113800 + getRandom(2100), -7709);
						}



						if (status == 0)
						{
							L2GrandBossInstance antharas = GrandBossManager.getInstance().getBoss(29019);
							antharasAI().notifyEvent("waiting", antharas, player);
						}
				}
			}
		}

		else if (event.equalsIgnoreCase("valakas") && npc.getNpcId() == 36600)
		{
			if (valakasAI() != null)
			{
				int status = GrandBossManager.getInstance().getBossStatus(29028);

				if (status == 0 || status == 1)
				{
					if (playerCount >= 200)
						htmltext = "36601-03.htm";

						st.unset("allowEnter");
						L2BossZone zone = GrandBossManager.getInstance().getZone(212852, -114842, -1632);

						if (zone != null)
							zone.allowPlayerEntry(player, 30);

						if (player.getParty() == null)
							htmltext = "36601-04.htm";

						else if (player.getParty().getCommandChannel() == null)
							htmltext = "36601-05.htm";

						else if (player.getParty().getCommandChannel().getLeader() != player)
							htmltext = "36601-06.htm";

						else if (player.getParty().getCommandChannel().getMemberCount() < 2 || player.getParty().getCommandChannel().getMemberCount() > 65)
							htmltext = "36601-07.htm";

						for (L2PcInstance channelMember : player.getParty().getCommandChannel().getMembers())
						{
							channelMember.teleToLocation(204328 + getRandom(600), -111874 + getRandom(600), 70);
						}

						playerCount++;

						if (status == 0)
						{
							L2GrandBossInstance valakas = GrandBossManager.getInstance().getBoss(29028);
							valakasAI().startQuestTimer("1001", Config.Valakas_Wait_Time, valakas, null);
							GrandBossManager.getInstance().setBossStatus(29028, 1);
						}
				}
				else if (status == 2)
					htmltext = "36601-02.htm";
				else
					htmltext = "36601-01.htm";
			}

			else
				htmltext = "31385-01.htm";
		}

		else
		{
			if (st.hasQuestItems(7267))
			{
				player.teleToLocation(183813, -115157, -3303);
				st.set("allowEnter", "1");
			}
		}

	return htmltext;

}

public String onTalk(String event, L2Npc npc, L2PcInstance player)
{
	String htmltext = "";
	QuestState st = player.getQuestState(getName());

	if (st == null)
	{
		return null;
	}

	switch (npc.getNpcId())
	{
		case 31859:
			player.teleToLocation(79800 + getRandom(600), 151200 + getRandom(1100), -3534);
			break;

		case 31384:
			DoorTable.getInstance().getDoor(24210004).openMe();
			break;

		case 31686:
			DoorTable.getInstance().getDoor(24210006).openMe();
			break;

		case 31687:
			DoorTable.getInstance().getDoor(24210005).openMe();
			break;

		case 31540:
			if (playerCount < 50)
				htmltext = "31540-01.htm";

			else if (playerCount < 100)
				htmltext = "31540-02.htm";

			else if (playerCount < 150)
				htmltext = "31540-03.htm";

			else if (playerCount < 200)
				htmltext = "31540-04.htm";

			else
				htmltext = "31540-05.htm";
			break;

		case 31759:
			player.teleToLocation(150037 + getRandom(500), -57720 + getRandom(500), -2976);
			break;
	}

	return htmltext;
}

public GrandBossTeleporters(int questId, String name, String descr)
{
	super(questId, name, descr);

	for (int npcId : NPCs)
	{
		addStartNpc(npcId);
		addTalkId(npcId);
	}
}

public static void main(String[] args)
{
	new GrandBossTeleporters(-1, GrandBossTeleporters.class.getSimpleName(), "teleports");
}
} 

Link to comment
Share on other sites

  • 0

try something like that

 

/*
* This program 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.
* 
* This program 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 teleports.GrandBossTeleporters;

import com.l2jserver.Config;
import com.l2jserver.gameserver.datatables.DoorTable;
import com.l2jserver.gameserver.instancemanager.GrandBossManager;
import com.l2jserver.gameserver.instancemanager.QuestManager;
import com.l2jserver.gameserver.model.actor.L2Npc;
import com.l2jserver.gameserver.model.actor.instance.L2GrandBossInstance;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.quest.Quest;
import com.l2jserver.gameserver.model.quest.QuestState;
import com.l2jserver.gameserver.model.zone.type.L2BossZone;



public class GrandBossTeleporters extends Quest
{
private static final int[] NPCs = 
{
	31384, //Gatekeeper of Fire Dragon : Opening some doors
	31540, //Watcher of Valakas Klein : Teleport into Hall of Flames
	31686, //Gatekeeper of Fire Dragon : Opens doors to Heart of Volcano
	31687, //Gatekeeper of Fire Dragon : Opens doors to Heart of Volcano
	31759 //Teleportation Cubic : Teleport out of Lair of Valakas
};
   	
private Quest antharasAI()
    	{
      		return QuestManager.getInstance().getQuest("antharas");
    	}
   	
private Quest valakasAI()
    	{
    	    return QuestManager.getInstance().getQuest("valakas");
    	}

private static int playerCount = 0;

@Override
public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
{
	String htmltext = "";
	QuestState st = player.getQuestState(getName());

	if (st == null)
	{
		st = newQuestState(player);
	}	

	if (event.equalsIgnoreCase("antharas") && npc.getNpcId() == 36600)
	{
			if (antharasAI() != null)
			{
				int status = GrandBossManager.getInstance().getBossStatus(29019);
				int statusW = GrandBossManager.getInstance().getBossStatus(29066);
				int statusN = GrandBossManager.getInstance().getBossStatus(29067);
				int statusS = GrandBossManager.getInstance().getBossStatus(29068);

				if (player.getParty() == null)
					htmltext = "36600-03.htm";

				else if (player.getParty().getCommandChannel() == null)
					htmltext = "36600-04.htm";

				else if (player.getParty().getCommandChannel().getLeader() != player)
					htmltext = "36600-05.htm";

				else if (player.getParty().getCommandChannel().getMemberCount() < 2 || player.getParty().getCommandChannel().getMemberCount() > 65)
					htmltext = "36600-06.htm";

				else if (status == 2 || statusW == 2 || statusN == 2 || statusS == 2)
					htmltext = "36600-02.htm";

				else if (status == 3 || statusW == 3 || statusN == 3 || statusS == 3)
					htmltext = "36600-01.htm";

				else if (status == 0 || status == 1) //If entrance to see Antharas is unlocked (he is Dormant or Waiting)
				{
						L2BossZone zone = GrandBossManager.getInstance().getZone(179700, 113800, -7709);

						if (zone != null)
							zone.allowPlayerEntry(player, 30);

						for (L2PcInstance channelMember : player.getParty().getCommandChannel().getMembers())
						{
							channelMember.teleToLocation(179700 + getRandom(700), 113800 + getRandom(2100), -7709);
						}



						if (status == 0)
						{
							L2GrandBossInstance antharas = GrandBossManager.getInstance().getBoss(29019);
							antharasAI().notifyEvent("waiting", antharas, player);
						}
				}
			}
		}

		else if (event.equalsIgnoreCase("valakas") && npc.getNpcId() == 36600)
		{
			if (valakasAI() != null)
			{
				int status = GrandBossManager.getInstance().getBossStatus(29028);

				if (status == 0 || status == 1)
				{
					if (playerCount >= 200)
						htmltext = "36601-03.htm";

						st.unset("allowEnter");
						L2BossZone zone = GrandBossManager.getInstance().getZone(212852, -114842, -1632);

						if (zone != null)
							zone.allowPlayerEntry(player, 30);

						if (player.getParty() == null)
							htmltext = "36601-04.htm";

						else if (player.getParty().getCommandChannel() == null)
							htmltext = "36601-05.htm";

						else if (player.getParty().getCommandChannel().getLeader() != player)
							htmltext = "36601-06.htm";

						else if (player.getParty().getCommandChannel().getMemberCount() < 2 || player.getParty().getCommandChannel().getMemberCount() > 65)
							htmltext = "36601-07.htm";

						for (L2PcInstance channelMember : player.getParty().getCommandChannel().getMembers())
						{
							channelMember.teleToLocation(204328 + getRandom(600), -111874 + getRandom(600), 70);
						}

						playerCount++;

						if (status == 0)
						{
							L2GrandBossInstance valakas = GrandBossManager.getInstance().getBoss(29028);
							valakasAI().startQuestTimer("1001", Config.Valakas_Wait_Time, valakas, null);
							GrandBossManager.getInstance().setBossStatus(29028, 1);
						}
				}
				else if (status == 2)
					htmltext = "36601-02.htm";
				else
					htmltext = "36601-01.htm";
			}

			else
				htmltext = "31385-01.htm";
		}

		else
		{
			if (st.hasQuestItems(7267))
			{
				player.teleToLocation(183813, -115157, -3303);
				st.set("allowEnter", "1");
			}
		}

	return htmltext;

}

public String onTalk(String event, L2Npc npc, L2PcInstance player)
{
	String htmltext = "";
	QuestState st = player.getQuestState(getName());

	if (st == null)
	{
		return null;
	}

	switch (npc.getNpcId())
	{
		case 31859:
			player.teleToLocation(79800 + getRandom(600), 151200 + getRandom(1100), -3534);
			break;

		case 31384:
			DoorTable.getInstance().getDoor(24210004).openMe();
			break;

		case 31686:
			DoorTable.getInstance().getDoor(24210006).openMe();
			break;

		case 31687:
			DoorTable.getInstance().getDoor(24210005).openMe();
			break;

		case 31540:
			if (playerCount < 50)
				htmltext = "31540-01.htm";

			else if (playerCount < 100)
				htmltext = "31540-02.htm";

			else if (playerCount < 150)
				htmltext = "31540-03.htm";

			else if (playerCount < 200)
				htmltext = "31540-04.htm";

			else
				htmltext = "31540-05.htm";
			break;

		case 31759:
			player.teleToLocation(150037 + getRandom(500), -57720 + getRandom(500), -2976);
			break;
	}

	return htmltext;
}

public GrandBossTeleporters(int questId, String name, String descr)
{
	super(questId, name, descr);

	for (int npcId : NPCs)
	{
		addStartNpc(npcId);
		addTalkId(npcId);
	}
}

public static void main(String[] args)
{
	new GrandBossTeleporters(-1, GrandBossTeleporters.class.getSimpleName(), "teleports");
}
} 

 

 

same :'(

Link to comment
Share on other sites

  • 0

I forgot it, try

 

private static final int[] NPCs = 
{
	31384, //Gatekeeper of Fire Dragon : Opening some doors
	31540, //Watcher of Valakas Klein : Teleport into Hall of Flames
	31686, //Gatekeeper of Fire Dragon : Opens doors to Heart of Volcano
	31687, //Gatekeeper of Fire Dragon : Opens doors to Heart of Volcano
	31759, //Teleportation Cubic : Teleport out of Lair of Valakas
                36600 // Custom Npc
};
   	

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

    • GRAND START TOMORROW !!! OPENING FROM - 1 DECEMBER 2023, FRIDAY, 20:00 +2GMT.
    • A-grade stage   01.12 at 09:00 we will have a long-awaited transition to a new stage.   What awaits you at the A-grade stage: - The maximum level is 75. - New locations: Goddart and Rune territory, TOI 5+, Silent Valley, LOA (66+ mobs), Catacombs - Witch, Dark Omens, Necropolis - Martyrdom, Saint's, Devotion, Captains rift, Commanders Rift, 60+ festival zones, Wall of Argos, ToI 8-14, Silent Valley, Blazing Swamp, Hot Springs, Varka, Ketra, Stakato Nest; - Added new epic raid bosses Zaken, Core, Orfen (will spawn randomly from 17:00 to 21:00 server time); - Recipes / keys / whole items of S grade  are not available (quests for them as well); - The Grand Olympiad will take place at: 12.12, 14.12, 15.12, 17.12, 19.12, 20.12, 21.12; - To participate in Olympiad, a minimum of level 61 is required; - It will be possible to receive rewards for the B-grade stage on 01.12 from 00:00 server time and hero status from 12:00 server time - Stage duration: 21 days
    • WTS adena Serious trade 25+ KK in stock 6 USD / KK
    • Hello, I edited a quest for the interlude server. However, I want to add a timer to this quest so that it will be reset every 24 hours or at a certain time of the day. I could not do this because my Java knowledge is not very sufficient. If anyone can help me with this, I would be very happy. Note:I created it by editing the existing kill all sphys task.   ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- # Made by Mr. - Version 0.3 by DrLecter import sys from l2jorion.game.model.quest import State from l2jorion.game.model.quest import QuestState from l2jorion.game.model.quest.jython import QuestJython as JQuest qn = "263_KillAllSylphs1" ORB_OF_WATER = 9998 ORB_OF_FIRE = 9999 ORB_OF_WIND = 10000 ORB_OF_EARTH = 10001 STONE_OF_VALOR = 10002 DROPLIST={ 57000:[ORB_OF_WIND,100], 57001:[ORB_OF_EARTH,100], 57002:[ORB_OF_FIRE,100], 57003:[ORB_OF_WATER,100], } class Quest (JQuest) :  def __init__(self,id,name,descr): JQuest.__init__(self,id,name,descr)  def onEvent (self,event,st) :     htmltext = event     if event == "70737-03.htm" :       st.set("cond","1")       st.setState(STARTED)       st.playSound("ItemSound.quest_accept")     elif event == "70737-06.htm" :       st.exitQuest(1)       st.playSound("ItemSound.quest_finish")     return htmltext  def onTalk (self,npc,player):    htmltext = "<html><body>You are either not carrying out your quest or don't meet the criteria.</body></html>    st = player.getQuestState(qn)    if not st : return htmltext    npcId = npc.getNpcId()    id = st.getState()    if id == CREATED :      st.set("cond","0")    if st.getInt("cond")==0 :      if player.getLevel()<76 :        htmltext = "70737-01.htm"        st.exitQuest(1)      else :        htmltext = "70737-02.htm"    else :      water = st.getQuestItemsCount(ORB_OF_WATER)      fire = st.getQuestItemsCount(ORB_OF_FIRE)      wind = st.getQuestItemsCount(ORB_OF_WIND)      earth = st.getQuestItemsCount(ORB_OF_EARTH)      if water == fire == wind == earth == 0 :        htmltext = "70737-04.htm"      if npcId == 70737 and st.getQuestItemsCount(ORB_OF_WATER) and st.getQuestItemsCount(ORB_OF_FIRE) and st.getQuestItemsCount(ORB_OF_WIND) and st.getQuestItemsCount(ORB_OF_EARTH) :        htmltext = "70737-05.htm"        st.giveItems(STONE_OF_VALOR,1)        st.takeItems(ORB_OF_WATER,-1)        st.takeItems(ORB_OF_FIRE,-1)        st.takeItems(ORB_OF_WIND,-1)        st.takeItems(ORB_OF_EARTH,-1)    return htmltext  def onKill(self,npc,player,isPet):    st = player.getQuestState(qn)    if not st : return     if st.getState() != STARTED : return         item,chance=DROPLIST[npc.getNpcId()]    if st.getRandom(100)>1 :      st.giveItems(item,1)      st.playSound("ItemSound.quest_itemget")    return QUEST       = Quest(263,qn,"Kill All Sylphs1") CREATED     = State('Start', QUEST) STARTING    = State('Starting', QUEST) STARTED     = State('Started', QUEST) COMPLETED   = State('Completed', QUEST) QUEST.setInitialState(CREATED) QUEST.addStartNpc(70737) QUEST.addTalkId(70737) QUEST.addKillId(57000) QUEST.addKillId(57001) QUEST.addKillId(57002) QUEST.addKillId(57003) STARTED.addQuestDrop(57002,ORB_OF_FIRE,1) STARTED.addQuestDrop(57003,ORB_OF_WATER,1) STARTED.addQuestDrop(57000,ORB_OF_WIND,1) STARTED.addQuestDrop(57001,ORB_OF_EARTH,1)
  • Topics

×
×
  • Create New...