try
{
con = L2DatabaseFactory.getInstance().getConnection(false);
for(Integer bossId : _storedInfo.keySet())
{
L2ScarletInstance boss = _bosses.get(bossId);
StatsSet info = _storedInfo.get(bossId);
if(boss == null || info == null)
{
PreparedStatement update2 = con.prepareStatement(UPDATE_GRAND_BOSS_DATA2);
update2.setInt(1, _bossStatus.get(bossId));
update2.setInt(2, bossId);
update2.executeUpdate();
update2.close();
}
else
{
PreparedStatement update1 = con.prepareStatement(UPDATE_GRAND_BOSS_DATA);
update1.setInt(1, boss.getX());
update1.setInt(2, boss.getY());
update1.setInt(3, boss.getZ());
update1.setInt(4, boss.getHeading());
update1.setLong(5, info.getLong("respawn_time"));
double hp = boss.getCurrentHp();
double mp = boss.getCurrentMp();
if(boss.isDead())
{
hp = boss.getMaxHp();
mp = boss.getMaxMp();
}
update1.setDouble(6, hp);
update1.setDouble(7, mp);
update1.setInt(8, _bossStatus.get(bossId));
update1.setInt(9, bossId);