Advertisement
Guest User

boss spawn

a guest
Jul 17th, 2019
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.66 KB | None | 0 0
  1. --- java/net/sf/l2j/gameserver/instancemanager/RaidBossSpawnManager.java (revision 9)
  2. +++ java/net/sf/l2j/gameserver/instancemanager/RaidBossSpawnManager.java (working copy)
  3. @@ -45,6 +45,7 @@
  4.  
  5. protected final static Map<Integer, L2RaidBossInstance> _bosses = new HashMap<>();
  6. protected final static Map<Integer, L2Spawn> _spawns = new HashMap<>();
  7. + protected final static Map<Integer, Long> _respawns = new HashMap<>();
  8. protected final static Map<Integer, StatsSet> _storedInfo = new HashMap<>();
  9. protected final static Map<Integer, ScheduledFuture<?>> _schedules = new HashMap<>();
  10.  
  11. @@ -142,6 +143,7 @@
  12. _log.info("RaidBoss: " + raidboss.getName() + " has spawned.");
  13.  
  14. _bosses.put(bossId, raidboss);
  15. + _respawns.put(bossId,0L);
  16. }
  17.  
  18. _schedules.remove(bossId);
  19. @@ -148,6 +150,14 @@
  20. }
  21. }
  22.  
  23. + public long getRespawntime(int id)
  24. + {
  25. + if(_respawns.containsKey(id))
  26. + return _respawns.get(id);
  27. +
  28. + return -1;
  29. + }
  30. +
  31. public void updateStatus(L2RaidBossInstance boss, boolean isBossDead)
  32. {
  33. if (!_storedInfo.containsKey(boss.getNpcId()))
  34. @@ -171,6 +181,7 @@
  35. {
  36. _log.info("RaidBoss: " + boss.getName() + " - " + StringUtil.DATE_MM.format(respawnTime) + " (" + respawnDelay + "h).");
  37.  
  38. + _respawns.put(boss.getNpcId(), Calendar.getInstance().getTimeInMillis() + (respawnDelay * 3600000L));
  39. _schedules.put(boss.getNpcId(), ThreadPoolManager.getInstance().scheduleGeneral(new spawnSchedule(boss.getNpcId()), respawnDelay * 3600000));
  40. updateDb();
  41. }
  42. @@ -179,6 +190,8 @@
  43. {
  44. boss.setRaidStatus(StatusEnum.ALIVE);
  45.  
  46. + _respawns.put(boss.getNpcId(), 0L);
  47. +
  48. info.set("currentHP", boss.getCurrentHp());
  49. info.set("currentMP", boss.getCurrentMp());
  50. info.set("respawnTime", 0L);
  51. @@ -226,11 +239,13 @@
  52. info.set("respawnTime", 0L);
  53.  
  54. _storedInfo.put(bossId, info);
  55. + _respawns.put(bossId, 0L);
  56. }
  57. }
  58. else
  59. {
  60. long spawnTime = respawnTime - Calendar.getInstance().getTimeInMillis();
  61. + _respawns.put(bossId,respawnTime);
  62. _schedules.put(bossId, ThreadPoolManager.getInstance().scheduleGeneral(new spawnSchedule(bossId), spawnTime));
  63.  }
  64.  
  65. @@ -272,6 +287,9 @@
  66. SpawnTable.getInstance().deleteSpawn(spawnDat, false);
  67. _spawns.remove(bossId);
  68.  
  69. + if (_respawns.containsKey(bossId))
  70. + _respawns.remove(bossId);
  71. +
  72. if (_bosses.containsKey(bossId))
  73. _bosses.remove(bossId);
  74.  
  75. @@ -412,6 +430,7 @@
  76. _schedules.clear();
  77. }
  78.  
  79. + _respawns.clear();
  80. _storedInfo.clear();
  81. _spawns.clear();
  82. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement