L2JLisvus

Would you like to react to this message? Create an account in a few clicks or log in to continue.

    Raid Boss Info

    avatar
    kallone


    Posts : 73
    Join date : 2013-05-27
    Age : 32
    Location : http://l2destruction.com/

    Raid Boss Info Empty Raid Boss Info

    Post  kallone 12th April 2023, 09:52

    I was here doing nothing and ended up creating this raid boss info mod!
    You can edit as you like!!!

    Raid Boss Info Raidbo10


    go to net.sf.l2j.gameserver.model.actor.instance and create the L2RaidBossStatusInstance.java


    Code:
    /*
     * This program 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 2, or (at your option)
     * any later version.
     *
     * This program 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, write to the Free Software
     * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
     * 02111-1307, USA.
     *
     * http://www.gnu.org/copyleft/gpl.html
     */
    package net.sf.l2j.gameserver.model.actor.instance;

    import net.sf.l2j.gameserver.cache.HtmCache;
    import net.sf.l2j.gameserver.instancemanager.RaidBossSpawnManager;
    import net.sf.l2j.gameserver.network.serverpackets.NpcHtmlMessage;
    import net.sf.l2j.gameserver.templates.L2NpcTemplate;

    public final class L2RaidBossStatusInstance extends L2NpcInstance
    {
       
       private static final int[] ABOSSES = {10283};
       private static final int[] BBOSSES = {10286};
       private static final int[] CBOSSES = {10299};
       private static final int[] DBOSSES = {10309};
       private static final int[] EBOSSES = {10339};
       private static final int[] FBOSSES = {10302};
       private static final int[] GBOSSES = {10312};
       private static final int[] HBOSSES = {10319};
       private static final int[] IBOSSES = {10305};
       private static final int[] JBOSSES = {10315};
       private static final int[] KBOSSES = {10306};
       private static final int[] LBOSSES = {10316};

       public L2RaidBossStatusInstance(int objectId, L2NpcTemplate template)
       {
          super(objectId, template);
       }

       @Override
       public void showChatWindow(L2PcInstance player)
        {
          generateFirstWindow(player);
        }
       
       private void generateFirstWindow(L2PcInstance activeChar)
       {
          final StringBuilder sb = new StringBuilder();

          for(int aboss : ABOSSES)
          {
             
             long delay = RaidBossSpawnManager.getInstance().getRespawntime(aboss);
             
             if (delay==0)
             {
                sb.append("*Lilith [Lv.80]* <font color=\\\"00FF00\\\">IS ALIVE!</font><br1>");
             }
             else
             {
                sb.append("*Lilith [Lv.80]* <font color=\\\"FF0000\\\">IS DEAD.</font><br1>");
             }
          }
          for(int bboss : BBOSSES)
          {
             
             long delay = RaidBossSpawnManager.getInstance().getRespawntime(bboss);
             
             if (delay==0)
             {
                sb.append("*Anakin [Lv.80]* <font color=\\\"00FF00\\\">IS ALIVE!</font><br1>");
             }
             else
             {
                sb.append("*Anakin [Lv.80]* <font color=\\\"FF0000\\\">IS DEAD.</font><br1>");
             }
          }
          for(int cboss : CBOSSES)
          {
             
             long delay = RaidBossSpawnManager.getInstance().getRespawntime(cboss);
             
             if (delay==0)
             {
                sb.append("*Ketra Hero Hekaton [Lv.80]* <font color=\\\"00FF00\\\">IS ALIVE!</font><br1>");
             }
             else
             {
                sb.append("*Ketra Hero Hekaton [Lv.80]* <font color=\\\"FF0000\\\">IS DEAD.</font><br1>");
             }
          }
          for(int dboss : DBOSSES)
          {
             
             long delay = RaidBossSpawnManager.getInstance().getRespawntime(dboss);
             
             if (delay==0)
             {
                sb.append("*Varka Hero Sadith [Lv.80]* <font color=\\\"00FF00\\\">IS ALIVE!</font><br1>");
             }
             else
             {
                sb.append("*Varka Hero Sadith [Lv.80]* <font color=\\\"FF0000\\\">IS DEAD.</font><br1>");
             }
          }
          for(int eboss : EBOSSES)
          {
             
             long delay = RaidBossSpawnManager.getInstance().getRespawntime(eboss);
             
             if (delay==0)
             {
                sb.append("*Shadow of Halisha [Lv.81]* <font color=\\\"00FF00\\\">IS ALIVE!</font><br1>");
             }
             else
             {
                sb.append("*Shadow of Halisha [Lv.81]* <font color=\\\"FF0000\\\">IS DEAD.</font><br1>");
             }
          }
          for(int fboss : FBOSSES)
          {
             
             long delay = RaidBossSpawnManager.getInstance().getRespawntime(fboss);
             
             if (delay==0)
             {
                sb.append("*Ketra Commander Tayr [Lv.84]* <font color=\\\"00FF00\\\">IS ALIVE!</font><br1>");
             }
             else
             {
                sb.append("*Ketra Commander Tayr [Lv.84]* <font color=\\\"FF0000\\\">IS DEAD.</font><br1>");
             }
          }
          for(int gboss : GBOSSES)
          {
             
             long delay = RaidBossSpawnManager.getInstance().getRespawntime(gboss);
             
             if (delay==0)
             {
                sb.append("*Varka Commander Mos [Lv.84]* <font color=\\\"00FF00\\\">IS ALIVE!</font><br1>");
             }
             else
             {
                sb.append("*Varka Commander Mos [Lv.84]* <font color=\\\"FF0000\\\">IS DEAD.</font><br1>");
             }
          }
          for(int hboss : HBOSSES)
          {
             
             long delay = RaidBossSpawnManager.getInstance().getRespawntime(hboss);
             
             if (delay==0)
             {
                sb.append("*Ember [Lv.85]* <font color=\\\"00FF00\\\">IS ALIVE!</font><br1>");
             }
             else
             {
                sb.append("*Ember [Lv.85]* <font color=\\\"FF0000\\\">IS DEAD.</font><br1>");
             }
          }
          for(int iboss : IBOSSES)
          {
             
             long delay = RaidBossSpawnManager.getInstance().getRespawntime(iboss);
             
             if (delay==0)
             {
                sb.append("*Ketra Chief Brakki [Lv.87]* <font color=\\\"00FF00\\\">IS ALIVE!</font><br1>");
             }
             else
             {
                sb.append("*Ketra Chief Brakki [Lv.87]* <font color=\\\"FF0000\\\">IS DEAD.</font><br1>");
             }
          }
          for(int jboss : JBOSSES)
          {
             
             long delay = RaidBossSpawnManager.getInstance().getRespawntime(jboss);
             
             if (delay==0)
             {
                sb.append("*Varka Chief Horus [Lv.87]* <font color=\\\"00FF00\\\">IS ALIVE!</font><br1>");
             }
             else
             {
                sb.append("*Varka Chief Horus [Lv.87]* <font color=\\\"FF0000\\\">IS DEAD.</font><br1>");
             }
          }
          for(int kboss : KBOSSES)
          {
             
             long delay = RaidBossSpawnManager.getInstance().getRespawntime(kboss);
             
             if (delay==0)
             {
                sb.append("*Soul Of Fire Nastron [Lv.87]* <font color=\\\"00FF00\\\">IS ALIVE!</font><br1>");
             }
             else
             {
                sb.append("*Soul Of Fire Nastron [Lv.87]* <font color=\\\"FF0000\\\">IS DEAD.</font><br1>");
             }
          }
          for(int lboss : LBOSSES)
          {
             
             long delay = RaidBossSpawnManager.getInstance().getRespawntime(lboss);
             
             if (delay==0)
             {
                sb.append("*Soul Of Water Ashutar [Lv.87]* <font color=\\\"00FF00\\\">IS ALIVE!</font><br1>");
             }
             else
             {
                sb.append("*Soul Of Water Ashutar [Lv.87]* <font color=\\\"FF0000\\\">IS DEAD.</font><br1>");
             }
          }
          NpcHtmlMessage html = new NpcHtmlMessage(1);
           html.setFile(getHtmlPath(getNpcId(), 0));
           html.replace("%bosslist%", sb.toString());
           activeChar.sendPacket(html);
       }
       
       @Override
       public String getHtmlPath(int npcId, int val)
       {
          String filename;
          
          if (val == 0)
             filename = "data/html/mods/RaidBossStatus/" + npcId + ".htm";
          else
             filename = "data/html/mods/RaidBossStatus/" + npcId + "-" + val + ".htm";
          
          if (HtmCache.getInstance().isLoadable(filename))
             return filename;
          
          return "data/html/mods/RaidBossStatus/" + npcId + ".htm";
       }
    }



    go to net.sf.l2j.gameserver.instancemanager.RaidBossSpawnManager.java
    and add

    Code:
    +   protected final static Map<Integer, Long> _respawns = new HashMap<>();
        protected final static Map<Integer, StatsSet> _storedInfo = new HashMap<>();
        protected final static Map<Integer, ScheduledFuture<?>> _schedules = new HashMap<>();
        
    @@ -142,6 +143,7 @@
                 _log.info("RaidBoss: " + raidboss.getName() + " has spawned.");
                 
                 _bosses.put(bossId, raidboss);
    +            _respawns.put(bossId,0L);
              }
              
              _schedules.remove(bossId);
    @@ -148,6 +150,14 @@
           }
        }
        
    +   public long getRespawntime(int id)
    +   {
    +      if(_respawns.containsKey(id))
    +      return _respawns.get(id);
    +   
    +      return -1;
    +   }
    +   
        public void updateStatus(L2RaidBossInstance boss, boolean isBossDead)
        {
           if (!_storedInfo.containsKey(boss.getNpcId()))
    @@ -171,6 +181,7 @@
              {
                 _log.info("RaidBoss: " + boss.getName() + " - " + StringUtil.DATE_MM.format(respawnTime) + " (" + respawnDelay + "h).");
                 
    +            _respawns.put(boss.getNpcId(),  Calendar.getInstance().getTimeInMillis() + (respawnDelay * 3600000L));
                 _schedules.put(boss.getNpcId(), ThreadPoolManager.getInstance().scheduleGeneral(new spawnSchedule(boss.getNpcId()), respawnDelay * 3600000));
                 updateDb();
              }
    @@ -179,6 +190,8 @@
           {
              boss.setRaidStatus(StatusEnum.ALIVE);
              
    +         _respawns.put(boss.getNpcId(), 0L);
    +         
              info.set("currentHP", boss.getCurrentHp());
              info.set("currentMP", boss.getCurrentMp());
              info.set("respawnTime", 0L);
    @@ -226,11 +239,13 @@
                 info.set("respawnTime", 0L);
                 
                 _storedInfo.put(bossId, info);
    +            _respawns.put(bossId, 0L);
              }
           }
           else
           {
              long spawnTime = respawnTime - Calendar.getInstance().getTimeInMillis();
    +         _respawns.put(bossId,respawnTime);
              _schedules.put(bossId, ThreadPoolManager.getInstance().scheduleGeneral(new spawnSchedule(bossId), spawnTime));
           }
           
    @@ -272,6 +287,9 @@
           SpawnTable.getInstance().deleteSpawn(spawnDat, false);
           _spawns.remove(bossId);
           
    +      if (_respawns.containsKey(bossId))
    +         _respawns.remove(bossId);
    +      
           if (_bosses.containsKey(bossId))
              _bosses.remove(bossId);
           
    @@ -412,6 +430,7 @@
              _schedules.clear();
           }
           
    +      _respawns.clear();
           _storedInfo.clear();
           _spawns.clear();
        }


    Download npc.sql

    download gameserver\data\html\mods

      Current date/time is 19th May 2024, 14:16