Jump to content
  • 0

modify script


BlackJack25

Question

Hy all,

maybe someone can help me to modify this script for Interlude? tried to change import's, but in gs have error with L2Npc import.

 

package custom.BossRespawn;


import javolution.text.TextBuilder;

import com.l2jserver.gameserver.instancemanager.GrandBossManager;
import com.l2jserver.gameserver.model.actor.L2Npc;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.quest.Quest;
import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage;
import com.l2jserver.gameserver.datatables.NpcTable;

public class BossRespawn extends Quest
{
private static final int NPC_ID = 93000;
private static final int[] BOSSES = {29001, 29006, 29014, 29019, 29020, 29022, 29028, 29045};

public BossRespawn(int questid, String name, String descr)
{
	super(questid, name, descr);
	addFirstTalkId(NPC_ID);
}

public String onFirstTalk(L2Npc npc, L2PcInstance pc)
{
	if(npc == null || pc == null)
		return null;

	if(npc.getNpcId() == NPC_ID)
	{
		sendInfo(pc);
	}
		return null;
}

private void sendInfo(L2PcInstance activeChar)
{
	TextBuilder tb = new TextBuilder();
	tb.append("<html><title>Grand Boss Info By Dleogr</title><body><br><center>");
	tb.append("<img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br><br>");

	for(int boss : BOSSES)
	{
		String name = NpcTable.getInstance().getTemplate(boss).getName();
		long delay = GrandBossManager.getInstance().getStatsSet(boss).getLong("respawn_time");
		if (delay <= System.currentTimeMillis())
		{
			tb.append("<font color=\"00C3FF\">" + name + "</color>: " + "<font color=\"9CC300\">Is Alive</color>"+"<br1>");
		}
		else
		{
			int hours = (int) ((delay - System.currentTimeMillis()) / 1000 / 60 / 60);
			int mins = (int) (((delay - (hours * 60 * 60 * 1000)) - System.currentTimeMillis()) / 1000 / 60);
			int seconts = (int) (((delay - ((hours * 60 * 60 * 1000) + (mins * 60 * 1000))) - System.currentTimeMillis()) / 1000);
			tb.append("<font color=\"00C3FF\">" + name + "</color>" + "<font color=\"FFFFFF\">" +" " + "Respawn in :</color>" + " " + " <font color=\"32C332\">" + hours + " : " + mins + " : " + seconts + "</color><br1>");
		}
	}

	tb.append("<br><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br>");
	tb.append("</center></body></html>");

	NpcHtmlMessage msg = new NpcHtmlMessage(NPC_ID);
	msg.setHtml(tb.toString());
	activeChar.sendPacket(msg);
}

public static void main(String[] args)
{
	new BossRespawn(-1, "BossRespawn", "custom");
}
}

Link to comment
Share on other sites

5 answers to this question

Recommended Posts

  • 0

package custom.BossRespawn;


import javolution.text.TextBuilder;

import net.sf.l2j.gameserver.instancemanager.GrandBossManager;
import net.sf.l2j.gameserver.model.actor.L2NpcInstance;
import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
import net.sf.l2j.gameserver.model.quest.Quest;
import net.sf.l2j.gameserver.network.serverpackets.NpcHtmlMessage;
import net.sf.l2j.gameserver.datatables.NpcTable;

public class BossRespawn extends Quest
{
private static final int NPC_ID = 93000;
private static final int[] BOSSES = {29001, 29006, 29014, 29019, 29020, 29022, 29028, 29045};

public BossRespawn(int questid, String name, String descr)
{
	super(questid, name, descr);
	addFirstTalkId(NPC_ID);
}

public String onFirstTalk(L2Npc npc, L2PcInstance pc)
{
	if(npc == null || pc == null)
		return null;

	if(npc.getNpcId() == NPC_ID)
	{
		sendInfo(pc);
	}
		return null;
}

private void sendInfo(L2PcInstance activeChar)
{
	TextBuilder tb = new TextBuilder();
	tb.append("<html><title>Grand Boss Info By Dleogr</title><body><br><center>");
	tb.append("<img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br><br>");

	for(int boss : BOSSES)
	{
		String name = NpcTable.getInstance().getTemplate(boss).getName();
		long delay = GrandBossManager.getInstance().getStatsSet(boss).getLong("respawn_time");
		if (delay <= System.currentTimeMillis())
		{
			tb.append("<font color=\"00C3FF\">" + name + "</color>: " + "<font color=\"9CC300\">Is Alive</color>"+"<br1>");
		}
		else
		{
			int hours = (int) ((delay - System.currentTimeMillis()) / 1000 / 60 / 60);
			int mins = (int) (((delay - (hours * 60 * 60 * 1000)) - System.currentTimeMillis()) / 1000 / 60);
			int seconts = (int) (((delay - ((hours * 60 * 60 * 1000) + (mins * 60 * 1000))) - System.currentTimeMillis()) / 1000);
			tb.append("<font color=\"00C3FF\">" + name + "</color>" + "<font color=\"FFFFFF\">" +" " + "Respawn in :</color>" + " " + " <font color=\"32C332\">" + hours + " : " + mins + " : " + seconts + "</color><br1>");
		}
	}

	tb.append("<br><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br>");
	tb.append("</center></body></html>");

	NpcHtmlMessage msg = new NpcHtmlMessage(NPC_ID);
	msg.setHtml(tb.toString());
	activeChar.sendPacket(msg);
}

public static void main(String[] args)
{
	new BossRespawn(-1, "BossRespawn", "custom");
}
}

Try This

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



×
×
  • Create New...