Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package net.sf.l2j.gameserver.handler.voicedcommandhandlers;
- import java.text.SimpleDateFormat;
- import net.sf.l2j.Config;
- import net.sf.l2j.gameserver.data.xml.NpcData;
- import net.sf.l2j.gameserver.handler.IVoicedCommandHandler;
- import net.sf.l2j.gameserver.data.manager.GrandBossManager;
- import net.sf.l2j.gameserver.data.manager.RaidBossInfoManager;
- import net.sf.l2j.gameserver.model.actor.Player;
- import net.sf.l2j.gameserver.network.serverpackets.NpcHtmlMessage;
- import net.sf.l2j.commons.data.StatSet;
- public class GrandBossInfo implements IVoicedCommandHandler
- {
- private static final String[] _voicedCommands =
- {
- "rb"
- };
- private static final int[] raidbosses = new int[]
- {
- 51006 // Zaken
- };
- private static final int[] GRAND = new int[]
- {
- 29001, // Queen Ant
- 29006, // Core
- 29014 // Orfen
- };
- private static final int[] GRAND2 = new int[]
- {
- 29019, // Antharas
- 29028, // Valakas
- 29047 // Halisha
- };
- private static final int BAIUM = 29020;
- @Override
- public boolean useVoicedCommand(String command, Player activeChar, String params)
- {
- if (command.equals("rb") && Config.ENABLE_COMMAND_RB)
- {
- final StringBuilder sb = new StringBuilder();
- NpcHtmlMessage html = new NpcHtmlMessage(0);
- for (int raidboss : raidbosses)
- {
- String name = NpcData.getInstance().getTemplate(raidboss).getName();
- long delay = RaidBossInfoManager.getInstance().getRaidBossRespawnTime(raidboss);
- sb.append("<html><head><title>Epic Boss Manager</title></head><body>");
- sb.append("<center>");
- sb.append("<img src=\"L2UI.SquareGray\" width=300 height=1><br>");
- if (delay <= System.currentTimeMillis())
- {
- sb.append("" + name + ": <font color=\"4d94ff\">Is Alive!</font><br1>");
- }
- else
- {
- sb.append("" + name + ": <br1>");
- sb.append(" <font color=\"FFFFFF\">" + " " + "Respawn at:</font>" + "" + "<font color=\"FF9900\"> " + new SimpleDateFormat("dd-MM-yyyy HH:mm").format(delay) + "</font><br>");
- }
- }
- // Case of Queen/Core/Orfen
- for (int grandboss : GRAND)
- {
- StatSet info = GrandBossManager.getInstance().getStatSet(grandboss);
- long temp = info.getLong("respawn_time");
- String Grand = NpcData.getInstance().getTemplate(grandboss).getName();
- sb.append("<center>");
- sb.append("<img src=\"L2UI.SquareGray\" width=300 height=1><br>");
- if (temp <= System.currentTimeMillis())
- {
- sb.append("" + Grand + ": <font color=\"4d94ff\">Is Alive!</font><br1>");
- }
- else
- {
- sb.append("" + Grand + ": <br1>");
- sb.append(" <font color=\"FFFFFF\">" + " " + "Respawn at:</font>" + "" + "<font color=\"FF9900\"> " + new SimpleDateFormat("dd-MM-yyyy HH:mm").format(temp) + "</font><br>");
- }
- }
- // Case of Baium
- StatSet infobaium = GrandBossManager.getInstance().getStatSet(BAIUM);
- long tempbaium = infobaium.getLong("respawn_time");
- String Baium = NpcData.getInstance().getTemplate(BAIUM).getName();
- int BaiumStatus = GrandBossManager.getInstance().getBossStatus(BAIUM);
- sb.append("<center>");
- sb.append("<img src=\"L2UI.SquareGray\" width=300 height=1><br>");
- if (tempbaium <= System.currentTimeMillis() && BaiumStatus == 0)
- {
- sb.append("" + Baium + ": <font color=\"ff4d4d\">Is Asleep!</font><br1>");
- }
- else if (BaiumStatus == 1)
- {
- sb.append("" + Baium + ": <font color=\"ff4d4d\">Is Awake and fighting. Entry is locked.</font><br1>");
- }
- else
- {
- sb.append("" + Baium + ": <br1>");
- sb.append(" <font color=\"FFFFFF\">" + " " + "Respawn at:</font>" + "" + "<font color=\"FF9900\"> " + new SimpleDateFormat("dd-MM-yyyy HH:mm").format(tempbaium) + "</font><br>");
- }
- // Case of Antharas/Valakas/Halisha
- for (int grandboss : GRAND2)
- {
- StatSet infogrand = GrandBossManager.getInstance().getStatSet(grandboss);
- long tempgrand = infogrand.getLong("respawn_time");
- String Grand = NpcData.getInstance().getTemplate(grandboss).getName();
- int BossStatus = GrandBossManager.getInstance().getBossStatus(grandboss);
- sb.append("<center>");
- sb.append("<img src=\"L2UI.SquareGray\" width=300 height=1><br>");
- if (tempgrand <= System.currentTimeMillis() && BossStatus == 0)
- {
- sb.append("" + Grand + ": <font color=\"4d94ff\">Is spawned. Entry is unlocked.</font><br1>");
- }
- else if (BossStatus == 1)
- {
- sb.append("" + Grand + ": <font color=\"ff4d4d\">Someone has entered. Hurry!</font><br1>");
- }
- else if (BossStatus == 2)
- {
- sb.append("" + Grand + ": <font color=\"ff4d4d\">Is engaged in battle. Entry is locked.</font><br1>");
- }
- else
- {
- sb.append("" + Grand + ": <br1>");
- sb.append(" <font color=\"FFFFFF\">" + " " + "Respawn at:</font>" + "" + "<font color=\"FF9900\"> " + new SimpleDateFormat("dd-MM-yyyy HH:mm").format(tempgrand) + "</font><br>");
- }
- }
- html.setHtml(sb.toString());
- html.replace("%bosslist%", sb.toString());
- activeChar.sendPacket(html);
- }
- return true;
- }
- @Override
- public String[] getVoicedCommandList()
- {
- return _voicedCommands;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement