Skip to content

Instantly share code, notes, and snippets.

@JMD13
Last active November 18, 2019 11:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JMD13/38d1eac0635aa504833d4c53b3a5d5cc to your computer and use it in GitHub Desktop.
Save JMD13/38d1eac0635aa504833d4c53b3a5d5cc to your computer and use it in GitHub Desktop.
grandboss status voiced command for l2jlisvus rev 690
diff --git a/Lisvus_GameServer/java/net/sf/l2j/gameserver/handler/VoicedCommandHandler.java b/Lisvus_GameServer/java/net/sf/l2j/gameserver/handler/VoicedCommandHandler.java
index 533fb58..b2455d2 100644
--- a/Lisvus_GameServer/java/net/sf/l2j/gameserver/handler/VoicedCommandHandler.java
+++ b/Lisvus_GameServer/java/net/sf/l2j/gameserver/handler/VoicedCommandHandler.java
@@ -21,6 +21,7 @@
import net.sf.l2j.Config;
import net.sf.l2j.gameserver.handler.voicedcommandhandlers.Banking;
import net.sf.l2j.gameserver.handler.voicedcommandhandlers.ChangePassword;
+import net.sf.l2j.gameserver.handler.voicedcommandhandlers.Epic;
import net.sf.l2j.gameserver.handler.voicedcommandhandlers.TvTCommand;
import net.sf.l2j.gameserver.handler.voicedcommandhandlers.VoiceExperience;
import net.sf.l2j.gameserver.handler.voicedcommandhandlers.Wedding;
@@ -51,6 +52,7 @@
{
registerVoicedCommandHandler(new Banking());
registerVoicedCommandHandler(new ChangePassword());
+ registerVoicedCommandHandler(new Epic());
registerVoicedCommandHandler(new TvTCommand());
registerVoicedCommandHandler(new VoiceExperience());
registerVoicedCommandHandler(new Wedding());
diff --git a/Lisvus_GameServer/java/net/sf/l2j/gameserver/handler/voicedcommandhandlers/Epic.java b/Lisvus_GameServer/java/net/sf/l2j/gameserver/handler/voicedcommandhandlers/Epic.java
new file mode 100644
index 0000000..9e503d4
--- /dev/null
+++ b/Lisvus_GameServer/java/net/sf/l2j/gameserver/handler/voicedcommandhandlers/Epic.java
@@ -0,0 +1,105 @@
+/*
+ * Copyright (C) 2004-2014 L2J DataPack
+ *
+ * This file is part of L2J DataPack.
+ *
+ * L2J DataPack 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.
+ *
+ * L2J DataPack 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 net.sf.l2j.gameserver.handler.voicedcommandhandlers;
+
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.logging.Logger;
+
+import net.sf.l2j.gameserver.datatables.NpcTable;
+import net.sf.l2j.gameserver.handler.IVoicedCommandHandler;
+import net.sf.l2j.gameserver.instancemanager.GrandBossManager;
+import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
+import net.sf.l2j.gameserver.network.serverpackets.NpcHtmlMessage;
+import net.sf.l2j.gameserver.templates.StatsSet;
+
+/**
+ * @author JMD.
+ */
+
+public class Epic implements IVoicedCommandHandler
+{
+ static final Logger _log = Logger.getLogger(Epic.class.getName());
+ private static final String[] VOICED_COMMANDS =
+ {
+ "epic"
+ };
+
+ @Override
+ public boolean useVoicedCommand(String command, L2PcInstance activeChar, String params)
+ {
+ if (command.startsWith("epic"))
+ {
+ return Status(activeChar);
+ }
+ return false;
+ }
+
+ public boolean Status(L2PcInstance activeChar)
+ {
+
+ int[] BOSSES =
+ {
+ 12001,
+ 12052,
+ 12169,
+ 12211,
+ 12372,
+ 12374,
+ 12899,
+
+ };
+ SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss");
+ final StringBuilder replyMSG = new StringBuilder("<html><body><center>");
+ replyMSG.append("<font color=\"LEVEL\">* Grand Boss Status & Respawn Time *</font><br>");
+ for (int boss : BOSSES)
+ {
+ String name = NpcTable.getInstance().getTemplate(boss).name;
+ StatsSet stats = GrandBossManager.getInstance().getStatsSet(boss);
+ if (stats == null)
+ {
+ replyMSG.append("Stats for GrandBoss " + boss + " not found!<br>");
+ continue;
+ }
+
+ long delay = stats.getLong("respawn_time");
+ long currentTime = System.currentTimeMillis();
+ if (delay <= currentTime)
+ {
+ replyMSG.append("(" + name + ") is <font color=\"00FF00\">Alive</font><br>");
+
+ }
+ else
+ {
+ replyMSG.append("(" + name + ") is <font color=\"FF0000\">Dead</font> <font color=\"FF9900\">( " + sdf.format(new Date(delay)) + " )</font><br>");
+ }
+ }
+ replyMSG.append("</center></body></html>");
+ final NpcHtmlMessage adminReply = new NpcHtmlMessage(0);
+ adminReply.setHtml(replyMSG.toString());
+ activeChar.sendPacket(adminReply);
+ return true;
+ }
+
+ @Override
+ public String[] getVoicedCommandList()
+ {
+ return VOICED_COMMANDS;
+ }
+}
\ No newline at end of file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment