Advertisement
scraw

.raidinfo

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