[/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 .
*/
package custom.BossRespawn;
import net.sf.l2j.gameserver.datatables.NpcTable;
import net.sf.l2j.gameserver.instancemanager.GrandBossManager;
import net.sf.l2j.gameserver.model.actor.L2Npc;
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;
public class BossRespawn extends Quest
{
private static final int NPC_ID = 30951;
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)
{
StringBuilder tb = new StringBuilder();
tb.append("Grand Boss Info By Dleogr");
tb.append("");
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("" + name + ": " + "Is Alive"+"");
}
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("" + name + "" + "" +" " + "Respawn in :" + " " + " " + hours + " : " + mins + " : " + seconts + "");
}
}
tb.append("");
tb.append("");
NpcHtmlMessage msg = new NpcHtmlMessage(NPC_ID);
msg.setHtml(tb.toString());
activeChar.sendPacket(msg);
}
public static void main(String[] args)
{
new BossRespawn(-1, "BossRespawn", "custom");
}
}[code]
pats nenaudoju bet gal geresnis
Paskutinį kartą redagavo: 12 Spalio 2014 - 11:53