LifeDragon 5 Опубликовано 28 апреля, 2021 Скрипт выводит дату смерти подправьте меня что бы выводила дату респа package l2jorion.game.powerpack.bossInfo; import org.slf4j.LoggerFactory; import java.sql.ResultSet; import java.sql.PreparedStatement; import java.sql.Connection; import l2jorion.util.CloseUtil; import l2jorion.util.database.L2DatabaseFactory; import java.util.Collection; import l2jorion.game.model.actor.instance.L2RaidBossInstance; import l2jorion.game.managers.RaidBossSpawnManager; import l2jorion.game.model.actor.instance.L2GrandBossInstance; import l2jorion.game.templates.StatsSet; import l2jorion.game.templates.L2NpcTemplate; import java.util.Iterator; import l2jorion.game.managers.GrandBossManager; import l2jorion.game.datatables.sql.NpcTable; import l2jorion.game.powerpack.PowerPackConfig; import javolution.text.TextBuilder; import l2jorion.game.thread.ThreadPoolManager; import l2jorion.game.network.serverpackets.ShowMiniMap; import java.util.StringTokenizer; import l2jorion.game.network.serverpackets.L2GameServerPacket; import l2jorion.game.cache.HtmCache; import l2jorion.game.network.serverpackets.NpcHtmlMessage; import l2jorion.game.model.actor.instance.L2PcInstance; import org.slf4j.Logger; import l2jorion.game.handler.ICustomByPassHandler; import l2jorion.game.handler.IVoicedCommandHandler; public class RaidInfoHandler implements IVoicedCommandHandler, ICustomByPassHandler { private static Logger LOG; private String ROOT; private static boolean open; public RaidInfoHandler() { this.ROOT = "data/html/mods/boss/"; } public String[] getVoicedCommandList() { return new String[] { "boss" }; } public boolean useVoicedCommand(final String command, final L2PcInstance player, final String target) { if (player == null) { return false; } if (command.equalsIgnoreCase("boss")) { this.showHtm(player); return RaidInfoHandler.open = false; } return true; } private void showHtm(final L2PcInstance player) { final NpcHtmlMessage htm = new NpcHtmlMessage(1); final String text = HtmCache.getInstance().getHtm(this.ROOT + "index.htm"); htm.setHtml(text); player.sendPacket((L2GameServerPacket)htm); } private void showRbListHtm(final L2PcInstance player) { final NpcHtmlMessage htm = new NpcHtmlMessage(1); final String text = HtmCache.getInstance().getHtm(this.ROOT + "rb_list.htm"); htm.setHtml(text); if (player.GetSelectedBoss().size() > 0) { htm.replace("%selected%", "<font color=3399ff>" + player.GetSelectedBoss().get(0) + "</font> <a action=\"bypass -h custom_bosses_rb_list_unselect\">Unselect</a>"); } else { htm.replace("%selected%", "-"); } player.sendPacket((L2GameServerPacket)htm); } public String[] getByPassCommands() { return new String[] { "bosses_gb_list", "bosses_rb_list", "bosses_rb_list_unselect", "bosses_rb_bylevels", "bosses_rb_loc", "bosses_index" }; } public void handleCommand(final String command, final L2PcInstance player, final String parameters) { final StringTokenizer st = new StringTokenizer(command); final StringTokenizer st2 = new StringTokenizer(parameters, " "); final StringTokenizer st3 = new StringTokenizer(parameters, "_"); final RaidInfoHandler.CommandEnum comm = RaidInfoHandler.CommandEnum.valueOf(st.nextToken()); if (comm == null) { return; } Label_0215: { switch (RaidInfoHandler.RaidInfoHandler$1.$SwitchMap$l2jorion$game$powerpack$bossInfo$RaidInfoHandler$CommandEnum[comm.ordinal()]) { case 1: { this.sendGrandBossesInfo(player); break; } case 2: { this.showRbListHtm(player); break; } case 3: { player.GetSelectedBoss().clear(); player.getRadar().removeAllMarkers(); this.showRbListHtm(player); break; } case 4: { String val = ""; String val2 = ""; String val3 = ""; if (st2.hasMoreTokens()) { val = st2.nextToken(); val2 = st2.nextToken(); val3 = st2.nextToken(); try { final int minLv = Integer.parseInt(val); final int maxLv = Integer.parseInt(val2); final int page = Integer.parseInt(val3); this.sendRaidBossesInfo(player, minLv, maxLv, page); return; } catch (NumberFormatException ex) { break; } break Label_0215; } break; } case 5: { String x = ""; String y = ""; String z = ""; String name = ""; if (st2.hasMoreTokens()) { x = st2.nextToken(); y = st2.nextToken(); z = st2.nextToken(); name = st3.nextToken(); final int locx = Integer.parseInt(x); final int locy = Integer.parseInt(y); final int locz = Integer.parseInt(z); final String locname = name; final int substring = String.valueOf(locx).length() + String.valueOf(locy).length() + String.valueOf(locz).length() + 3; player.getRadar().removeAllMarkers(); player.getRadar().addMarker(locx, locy, locz); if (!RaidInfoHandler.open) { player.sendPacket((L2GameServerPacket)new ShowMiniMap(1665)); RaidInfoHandler.open = true; } player.GetSelectedBoss().clear(); player.GetSelectedBoss().add(locname.substring(substring)); ThreadPoolManager.getInstance().scheduleGeneral((Runnable)new RaidInfoHandler.loadMarkers(player), 500L); break; } break; } case 6: { this.showHtm(player); RaidInfoHandler.open = false; break; } } } } private void sendGrandBossesInfo(final L2PcInstance activeChar) { final NpcHtmlMessage htm = new NpcHtmlMessage(5); htm.setFile(this.ROOT + "gb_list.htm"); final TextBuilder t = new TextBuilder(); int color = 1; for (final int boss : PowerPackConfig.RAID_INFO_IDS_LIST) { String name = ""; L2NpcTemplate template = null; if ((template = NpcTable.getInstance().getTemplate(boss)) != null) { name = template.getName(); final StatsSet info = GrandBossManager.getInstance().getStatsSet(boss); final L2GrandBossInstance grand_boss = GrandBossManager.getInstance().getBoss(boss); final long delay = info.getLong("respawn_time"); if (grand_boss != null && grand_boss.isChampion()) { name = "<font color=\"ff0000\">" + name + "</font>"; } name = name + " <font color=\"ffff00\">" + template.getLevel() + "</font>"; if (color == 1) { t.append("<table width=300 border=0 bgcolor=000000><tr>"); t.append("<td width=150>" + name + "</td><td width=150>" + ((delay <= System.currentTimeMillis()) ? "<font color=\"009900\">Alive</font>" : ("<font color=\"FF0000\">Dead: " + GetGrandBossKilledTime(boss) + "</font>")) + "</td>"); t.append("</tr></table>"); color = 2; } else { t.append("<table width=300 border=0><tr>"); t.append("<td width=150>" + name + "</td><td width=150>" + ((delay <= System.currentTimeMillis()) ? "<font color=\"009900\">Alive</font>" : ("<font color=\"FF0000\">Dead: " + GetGrandBossKilledTime(boss) + "</font>")) + "</td>"); t.append("</tr></table>"); color = 1; } } else { RaidInfoHandler.LOG.warn("Raid Boss with ID " + boss + " is not defined into NpcTable"); } } htm.replace("%bosses%", t.toString()); activeChar.sendPacket((L2GameServerPacket)htm); } private void sendRaidBossesInfo(final L2PcInstance activeChar, final int minLv, final int maxLv, int page) { final Collection<L2RaidBossInstance> rBosses = RaidBossSpawnManager._bossesForCommand.values(); RaidBossSpawnManager.BOSSES_LIST.clear(); for (final L2RaidBossInstance actual_boss : rBosses) { if (actual_boss.getLevel() >= minLv && actual_boss.getLevel() <= maxLv) { RaidBossSpawnManager.BOSSES_LIST.add(actual_boss); } } RaidBossSpawnManager.BOSSES_LIST.sort((o1, o2) -> o1.getLevels().compareTo(o2.getLevels())); final L2RaidBossInstance[] bossses = RaidBossSpawnManager.BOSSES_LIST.toArray(new L2RaidBossInstance[RaidBossSpawnManager.BOSSES_LIST.size()]); final int MaxCharactersPerPage = 15; int MaxPages = bossses.length / 15; if (bossses.length > 15 * MaxPages) { ++MaxPages; } if (page > MaxPages) { page = MaxPages; } final int CharactersStart = 15 * page; int CharactersEnd = bossses.length; if (CharactersEnd - CharactersStart > 15) { CharactersEnd = CharactersStart + 15; } final NpcHtmlMessage html = new NpcHtmlMessage(6); html.setFile(this.ROOT + "rb_list_bylevels.htm"); final TextBuilder th = new TextBuilder(); int count = CharactersStart; int color = 1; for (int i = CharactersStart; i < CharactersEnd; ++i) { ++count; String name = ""; final int rboss = bossses[i].getNpcId(); final L2NpcTemplate template = NpcTable.getInstance().getTemplate(rboss); final StatsSet rInfo = RaidBossSpawnManager.getInstance().getStatsSet(rboss); final L2RaidBossInstance raid_boss = RaidBossSpawnManager.getInstance().getBoss(rboss); long delay = 0L; String deadTime = ""; int x = 0; int y = 0; int z = 0; if (rInfo != null) { name = template.getName(); final String locname = template.getName(); if (name.length() >= 16) { name = name.substring(0, 16) + "..."; } if (raid_boss != null && raid_boss.isChampion()) { name = "<font color=\"ff0000\">" + name + "</font>"; } name = name + " <font color=\"ffff00\">" + template.getLevel() + "</font>"; if (template.aggroRange > 0) { name += "<font color=\"ff0000\">*</font>"; } delay = rInfo.getLong("respawnTime"); deadTime = GetRaidBossKilledTime(rboss); if (raid_boss != null && raid_boss.getSpawn() != null) { x = raid_boss.getSpawn().getLocx(); y = raid_boss.getSpawn().getLocy(); z = raid_boss.getSpawn().getLocz(); } else { x = rInfo.getInteger("loc_x"); y = rInfo.getInteger("loc_y"); z = rInfo.getInteger("loc_z"); } if (color == 1) { th.append("<table width=300 border=0 bgcolor=000000><tr>"); th.append("<td width=20>" + count + ".</td><td width=130><a action=\"bypass custom_bosses_rb_loc " + x + " " + y + " " + z + " " + locname + "\">" + name + "</a></td><td width=150>" + ((delay <= System.currentTimeMillis()) ? "<font color=\"009900\">Alive</font>" : ("<font color=\"FF0000\">Dead: " + deadTime + "</font>")) + "</td>"); th.append("</tr></table>"); color = 2; } else { th.append("<table width=300 border=0><tr>"); th.append("<td width=20>" + count + ".</td><td width=130><a action=\"bypass custom_bosses_rb_loc " + x + " " + y + " " + z + " " + locname + "\">" + name + "</a></td><td width=150>" + ((delay <= System.currentTimeMillis()) ? "<font color=\"009900\">Alive</font>" : ("<font color=\"FF0000\">Dead: " + deadTime + "</font>")) + "</td>"); th.append("</tr></table>"); color = 1; } } } html.replace("%raidbosses%", th.toString()); th.clear(); th.append("<center><table><tr>"); for (int x2 = 0; x2 < MaxPages; ++x2) { final int pagenr = x2 + 1; if (page == x2) { th.append("<td width=20>[" + pagenr + "] </td>"); } else { th.append("<td width=20><a action=\"bypass -h custom_bosses_rb_bylevels " + minLv + " " + maxLv + " " + x2 + "\">[" + pagenr + "]</a> </td>"); } } th.append("</tr></table></center>"); html.replace("%pages%", th.toString()); activeChar.sendPacket((L2GameServerPacket)html); } public static String GetGrandBossKilledTime(final int BossId) { Connection con = null; String killed_time = ""; try { con = L2DatabaseFactory.getInstance().getConnection(); final PreparedStatement statement = con.prepareStatement("SELECT killed_time FROM grandboss_data WHERE boss_id=?"); statement.setInt(1, BossId); final ResultSet rset = statement.executeQuery(); rset.next(); killed_time = rset.getString("killed_time"); rset.close(); statement.close(); con.close(); } catch (Exception ex) {} finally { CloseUtil.close(con); } return killed_time; } public static String GetRaidBossKilledTime(final int BossId) { Connection con = null; String killed_time = ""; try { con = L2DatabaseFactory.getInstance().getConnection(); final PreparedStatement statement = con.prepareStatement("SELECT killed_time FROM raidboss_spawnlist WHERE boss_id=?"); statement.setInt(1, BossId); final ResultSet rset = statement.executeQuery(); rset.next(); killed_time = rset.getString("killed_time"); rset.close(); statement.close(); con.close(); } catch (Exception ex) {} finally { CloseUtil.close(con); } return killed_time; } static { RaidInfoHandler.LOG = LoggerFactory.getLogger((Class)RaidInfoHandler.class); RaidInfoHandler.open = false; } } Поделиться сообщением Ссылка на сообщение Поделиться на другие сайты
Rogue 248 Опубликовано 28 апреля, 2021 SELECT killed_time FROM raidboss_spawnlist WHERE boss_id=? killed_time поменяй на нужную тебе колонку и всё. 1 Поделиться сообщением Ссылка на сообщение Поделиться на другие сайты
LifeDragon 5 Опубликовано 28 апреля, 2021 27 минут назад, Rogue сказал: SELECT killed_time FROM raidboss_spawnlist WHERE boss_id=? killed_time поменяй на нужную тебе колонку и всё. щас попробую Поделиться сообщением Ссылка на сообщение Поделиться на другие сайты
LifeDragon 5 Опубликовано 28 апреля, 2021 33 минуты назад, Rogue сказал: SELECT killed_time FROM raidboss_spawnlist WHERE boss_id=? killed_time поменяй на нужную тебе колонку и всё. вот что из этого вышло https://skr.sh/s7ncgihULla?a Поделиться сообщением Ссылка на сообщение Поделиться на другие сайты
LifeDragon 5 Опубликовано 28 апреля, 2021 решил вопрос тем что выстовил Respawn_next Поделиться сообщением Ссылка на сообщение Поделиться на другие сайты
LifeDragon 5 Опубликовано 28 апреля, 2021 а нет ошибся при компиляции [javac] symbol: class loadMarkers [javac] location: class RaidInfoHandler [javac] D:\Sborki\Asgard\l2core\src\l2jorion\game\powerpack\bossInfo\RaidInfoHandler.java:88: error: cannot find symbol [javac] final RaidInfoHandler.CommandEnum comm = RaidInfoHandler.CommandEnum.valueOf(st.nextToken()); [javac] ^ [javac] symbol: class CommandEnum [javac] location: class RaidInfoHandler [javac] D:\Sborki\Asgard\l2core\src\l2jorion\game\powerpack\bossInfo\RaidInfoHandler.java:88: error: cannot find symbol [javac] final RaidInfoHandler.CommandEnum comm = RaidInfoHandler.CommandEnum.valueOf(st.nextToken()); [javac] ^ [javac] symbol: variable CommandEnum [javac] location: class RaidInfoHandler [javac] D:\Sborki\Asgard\l2core\src\l2jorion\game\powerpack\bossInfo\RaidInfoHandler.java:93: error: cannot find symbol [javac] switch (RaidInfoHandler.RaidInfoHandler$1.$SwitchMap$l2jorion$game$powerpack$bossInfo$RaidInfoHandler$CommandEnum[comm.ordinal()]) { [javac] ^ [javac] symbol: variable RaidInfoHandler$1 [javac] location: class RaidInfoHandler [javac] D:\Sborki\Asgard\l2core\src\l2jorion\game\powerpack\bossInfo\RaidInfoHandler.java:153: error: cannot find symbol [javac] ThreadPoolManager.getInstance().scheduleGeneral((Runnable)new RaidInfoHandler.loadMarkers(player), 500L); [javac] ^ [javac] symbol: class loadMarkers [javac] location: class RaidInfoHandler [javac] 5 errors Поделиться сообщением Ссылка на сообщение Поделиться на другие сайты