StatsSet info = _storedInfo.get(id);
if(info == null)
{
_storedInfo.put(id, info = new StatsSet());
}
L2RaidBossInstance raidboss = _bosses.get(id);
if(raidboss instanceof L2ReflectionBossInstance)
{
return;
}
if(raidboss != null && raidboss.getRaidStatus() == Status.ALIVE)
{
info.set("current_hp", raidboss.getCurrentHp());
info.set("current_mp", raidboss.getCurrentMp());
info.set("respawn_delay", 0);
}
else
{
info.set("current_hp", 0);
info.set("current_mp", 0);
if(raidboss != null && raidboss.getSpawn() != null)
{
info.set("respawn_delay", raidboss.getSpawn().getRespawnTime());
}
}
ThreadConnection con = null;
FiltredPreparedStatement statement = null;
try
{
con = L2DatabaseFactory.getInstance().getConnection();
statement = con.prepareStatement("REPLACE INTO `raidboss_status` (id, current_hp, current_mp, respawn_delay) VALUES (?,?,?,?)");
statement.setInt(1, id);
statement.setDouble(2, info.getDouble("current_hp"));
statement.setDouble(3, info.getDouble("current_mp"));
statement.setInt(4, info.getInteger("respawn_delay", 0));
statement.execute();
if(raidboss != null)
{
_log.fine("RaidBossSpawnManager: Saved status for raidboss " + raidboss.getName());
}
else
{
_log.fine("RaidBossSpawnManager: Saved respawn time for raidboss " + id);
}