Sarada-L2

Raid Info para frozen command

Jan 13th, 2021 (edited)
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.30 KB | None | 0 0
  1. package com.l2jfrozen.gameserver.handler.voicedcommandhandlers;
  2.  
  3. import java.util.logging.Logger;
  4.  
  5. import com.l2jfrozen.Config;
  6. import com.l2jfrozen.gameserver.datatables.sql.NpcTable;
  7. import com.l2jfrozen.gameserver.handler.IVoicedCommandHandler;
  8. import com.l2jfrozen.gameserver.managers.GrandBossManager;
  9. import com.l2jfrozen.gameserver.managers.RaidBossSpawnManager;
  10. import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
  11. import com.l2jfrozen.gameserver.network.serverpackets.NpcHtmlMessage;
  12. import com.l2jfrozen.gameserver.templates.L2NpcTemplate;
  13. import com.l2jfrozen.gameserver.templates.StatsSet;
  14.  
  15. import javolution.text.TextBuilder;
  16.  
  17. public class GrandBossSpawn implements IVoicedCommandHandler
  18. {
  19. private static final String[] _voicedCommands =
  20. {
  21. "raidinfo"
  22. };
  23.  
  24. @Override
  25. public boolean useVoicedCommand(String command, L2PcInstance activeChar, String target)
  26. {
  27. if (command.startsWith("raidinfo"))
  28. {
  29. showMainPage(activeChar);
  30. }
  31.  
  32. return true;
  33. }
  34.  
  35. private static void showMainPage(L2PcInstance activeChar)
  36. {
  37. TextBuilder tb = new TextBuilder();
  38. tb.append("<html><title>Boss Spawn</title><body><center>");
  39. tb.append("<img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br>");
  40. tb.append("Epic's Boss respawn time<br>");
  41. tb.append("<img src=\"sek.cbui32\" width=210 height=1><br>");
  42.  
  43. for(int boss : Config.RAID_INFO_IDS_LIST)
  44. {
  45. String name = "";
  46. L2NpcTemplate template = null;
  47. if((template = NpcTable.getInstance().getTemplate(boss)) != null){
  48. name = template.getName();
  49. }
  50. else
  51. {
  52.  
  53. continue;
  54. }
  55.  
  56. StatsSet actual_boss_stat = null;
  57. GrandBossManager.getInstance().getStatsSet(boss);
  58. long delay = 0;
  59.  
  60. if(NpcTable.getInstance().getTemplate(boss).type.equals("L2RaidBoss"))
  61. {
  62. actual_boss_stat=RaidBossSpawnManager.getInstance().getStatsSet(boss);
  63. if(actual_boss_stat!=null)
  64. delay = actual_boss_stat.getLong("respawnTime");
  65. }
  66. else if(NpcTable.getInstance().getTemplate(boss).type.equals("L2GrandBoss"))
  67. {
  68. actual_boss_stat=GrandBossManager.getInstance().getStatsSet(boss);
  69. if(actual_boss_stat!=null)
  70. delay = actual_boss_stat.getLong("respawn_time");
  71. }
  72. else
  73. continue;
  74.  
  75. if (delay <= System.currentTimeMillis())
  76. {
  77. tb.append("<font color=\"00C3FF\">" + name + "</font>: " + "<font color=\"9CC300\">Is Alive</font>"+"<br1>");
  78. }
  79. else
  80. {
  81. int hours = (int) ((delay - System.currentTimeMillis()) / 1000 / 60 / 60);
  82. int mins = (int) (((delay - (hours * 60 * 60 * 1000)) - System.currentTimeMillis()) / 1000 / 60);
  83. int seconts = (int) (((delay - ((hours * 60 * 60 * 1000) + (mins * 60 * 1000))) - System.currentTimeMillis()) / 1000);
  84. tb.append("<font color=\"00C3FF\">" + name + "</font>" + "<font color=\"FFFFFF\">" +" " + "Respawn in :</font>" + " " + " <font color=\"32C332\">" + hours + " : " + mins + " : " + seconts + "</font><br1>");
  85. }
  86. }
  87.  
  88. tb.append("<img src=\"sek.cbui32\" width=210 height=1><br>");
  89. tb.append("<img src=\"L2UI_CH3.herotower_deco\" width=256 height=32>");
  90. tb.append("</center></body></html>");
  91.  
  92. NpcHtmlMessage msg = new NpcHtmlMessage(5);
  93. msg.setHtml(tb.toString());
  94.  
  95. activeChar.sendPacket(msg);
  96. }
  97.  
  98. @Override
  99. public String[] getVoicedCommandList()
  100. {
  101. return _voicedCommands;
  102. }
  103. }
Add Comment
Please, Sign In to add comment