Sawadee Posted May 9, 2017 Share Posted May 9, 2017 (edited) Hello guys i want this feature so bad and if someone could adapt it for acis i will be glad take a look at the code below. package handlers.voice; import javolution.text.TextBuilder; import ru.la2bygaga.gameserver.datatables.NpcTable; import ru.la2bygaga.gameserver.handler.IVoicedCommandHandler; import ru.la2bygaga.gameserver.handler.VoicedCommandHandler; import ru.la2bygaga.gameserver.instancemanager.GrandBossManager; import ru.la2bygaga.gameserver.model.actor.instance.L2PcInstance; import ru.la2bygaga.gameserver.model.entity.GrandBossState; import ru.la2bygaga.gameserver.network.serverpackets.NpcHtmlMessage; public class GrandBossSpawn implements IVoicedCommandHandler { private static final int[] BOSSES = {29001, 29006, 29014, 29019, 29020, 29022, 29028, 29045}; // QueenAnt, Core, Orfen, Antharas, Baium, Zaken, Valakas, Frintezza private static final String [] VOICED_COMMANDS = {"epic"}; @Override public boolean useVoicedCommand(String command, L2PcInstance activeChar, String target) { if (activeChar == null) { return false; } if (command.startsWith("epic")) { NpcHtmlMessage epic = new NpcHtmlMessage(5); TextBuilder html = new TextBuilder("<html><body><br>"); html.append("<html><title>Grand Boss Info By Dleogr</title><body><br><center>"); html.append("<img src=\"legen.logogo\" width=231 height=76><br><br>"); for (int bossid : BOSSES) { String name = NpcTable.getInstance().getTemplate(bossid).getName(); long delay = GrandBossManager.getInstance().getGrandBossRespawnDate(bossid); GrandBossState.StateEnum state = GrandBossManager.getInstance().getGrandBossSpawnState(bossid); html.append("<font color=\"00C3FF\">" + name + "</font>: <font color=\""); switch (state) { case NOTSPAWN: html.append("FFFFFF\">Sleep/Not spawn</font>" + "<br1>"); //Спит или не заспавнен break; case ALIVE: html.append("9CC300\">Is Alive</font>" + "<br1>"); //Живой break; case DEAD: html.append("FFFFFF\">Is Dead </font>" + "<br1>"); //Вот-вот умер break; case INTERVAL: if (System.currentTimeMillis() < delay) { // Мертв int hours = (int) ((delay - System.currentTimeMillis()) / 1000 / 60 / 60); if (hours < 10) { int mins = (int) (((delay - (hours * 60 * 60 * 1000)) - System.currentTimeMillis()) / 1000 / 60); html.append("FFFFFF\">Respawn in:</font><font color=\"32C332\"> " + hours + " ч. " + mins + " мин.</font><br1>"); } else { html.append("FFFFFF\">Is Dead</font><br1>"); //Еще мертв } } else { html.append("9CC300\">Is Now Alive</font><br1>"); // Ожил (delay = currentUnixTime) } // либо delay < currentUnixTime но флаг INTERVAL еще не снят break; // TODO: Проверить, возможно ли такое вообще case SLEEP: html.append("FFFFFF\">Sleep</font>" + "<br1>"); // Точно спит break; case UNKNOWN: html.append("FFFFFF\">Unknown</font>" + "<br1>"); // Хз как так - проверь БД grandboss_intervallist break; } } html.append("<br><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br>"); html.append("</center></body></html>"); epic.setHtml(html.toString()); activeChar.sendPacket(epic); return true; } return false; } @Override public String getDescription(String command) { if (command.equals("epic")) { return "Показать статус Эпик Босов"; } return null; } @Override public String[] getVoicedCommandList() { return VOICED_COMMANDS; } public static void main(String[] args) { VoicedCommandHandler.getInstance().registerVoicedCommandHandler(new GrandBossSpawn()); } } Edited May 9, 2017 by Sawadee Quote Link to comment Share on other sites More sharing options...
0 MarGaZeaS Posted May 9, 2017 Share Posted May 9, 2017 What does the code do? Quote Link to comment Share on other sites More sharing options...
0 Celestine Posted May 9, 2017 Share Posted May 9, 2017 What does the code do? you can see epics respawn time if rb Dead if rb alive if rb sleep what date it gonna be respawn + / - time Quote Link to comment Share on other sites More sharing options...
0 Reborn12 Posted May 9, 2017 Share Posted May 9, 2017 3 lines to addapt :p One method to remove public static void main(String[] args) { VoicedCommandHandler.getInstance().registerVoicedCommandHandler(new GrandBossSpawn()); And register file in voicedcommandhandler.java Quote Link to comment Share on other sites More sharing options...
0 melron Posted May 9, 2017 Share Posted May 9, 2017 i doubt you want a code that every player can easily spam this command and fuck your srv... OnTopic: Isnt that hard to adapted. if i have time i will do it Quote Link to comment Share on other sites More sharing options...
0 Sawadee Posted May 9, 2017 Author Share Posted May 9, 2017 i will be glad if somone do this for aCis i try to learn but im on the very first stage yet. Quote Link to comment Share on other sites More sharing options...
0 L2DragonWind Posted May 13, 2017 Share Posted May 13, 2017 I think its need other part of code, because l2jacis don't have GrandBossState Quote Link to comment Share on other sites More sharing options...
0 melron Posted May 14, 2017 Share Posted May 14, 2017 I think its need other part of code, because l2jacis don't have GrandBossState It haven't boss state as enum state but there is getBossStatus as integer... The only thing you have to do is define status like alive =1 etc and adapt the other part Quote Link to comment Share on other sites More sharing options...
0 SweeTs Posted May 14, 2017 Share Posted May 14, 2017 Create new enums, add them into Grand bosses files according to state, done. Gotta touch all GB files. Quote Link to comment Share on other sites More sharing options...
Question
Sawadee
Hello guys i want this feature so bad and if someone could adapt it for acis i will be glad take a look at the code below.
Edited by SawadeeLink to comment
Share on other sites
8 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.