@Override public void run() { L2RaidBossInstance raidboss = null; if (bossId == 25328) raidboss = DayNightSpawnManager.getInstance().handleBoss(_spawns.get(bossId)); else raidboss = (L2RaidBossInstance) _spawns.get(bossId).doSpawn(); if (raidboss != null) { raidboss.setRaidStatus(StatusEnum.ALIVE); final StatsSet info = new StatsSet(); info.set("currentHP", raidboss.getCurrentHp()); info.set("currentMP", raidboss.getCurrentMp()); info.set("respawnTime", 0L); _storedInfo.put(bossId, info); _log.info("RaidBoss: " + raidboss.getName() + " has spawned."); _bosses.put(bossId, raidboss); } _schedules.remove(bossId); }
public void notifySpawnNightBoss(L2RaidBossInstance raidboss) { final StatsSet info = new StatsSet(); info.set("currentHP", raidboss.getCurrentHp()); info.set("currentMP", raidboss.getCurrentMp()); info.set("respawnTime", 0L); raidboss.setRaidStatus(StatusEnum.ALIVE); _storedInfo.put(raidboss.getNpcId(), info); _bosses.put(raidboss.getNpcId(), raidboss); _log.info("RaidBossSpawnManager: Spawning Night Raid Boss " + raidboss.getName()); }
public void updateStatus(L2RaidBossInstance boss, boolean isBossDead) { if (!_storedInfo.containsKey(boss.getNpcId())) return; final StatsSet info = _storedInfo.get(boss.getNpcId()); if (isBossDead) { boss.setRaidStatus(StatusEnum.DEAD); // getRespawnMinDelay() is used as fixed timer, while getRespawnMaxDelay() is used as random // timer. final int respawnDelay = boss.getSpawn().getRespawnMinDelay() + Rnd.get( -boss.getSpawn().getRespawnMaxDelay(), boss.getSpawn().getRespawnMaxDelay()); final long respawnTime = Calendar.getInstance().getTimeInMillis() + (respawnDelay * 3600000); info.set("currentHP", boss.getMaxHp()); info.set("currentMP", boss.getMaxMp()); info.set("respawnTime", respawnTime); if (!_schedules.containsKey(boss.getNpcId())) { final Calendar time = Calendar.getInstance(); time.setTimeInMillis(respawnTime); _log.info( "RaidBoss: " + boss.getName() + " - " + Util.formatDate(time.getTime(), "d MMM yyyy HH:mm") + " (" + respawnDelay + "h)."); _schedules.put( boss.getNpcId(), ThreadPoolManager.getInstance() .scheduleGeneral(new spawnSchedule(boss.getNpcId()), respawnDelay * 3600000)); updateDb(); } } else { boss.setRaidStatus(StatusEnum.ALIVE); info.set("currentHP", boss.getCurrentHp()); info.set("currentMP", boss.getCurrentMp()); info.set("respawnTime", 0L); } _storedInfo.put(boss.getNpcId(), info); }