if(_effectList == null || _effectList.isEmpty())
{
return;
}
int order = 0;
SqlBatch b = new SqlBatch("INSERT IGNORE INTO `character_effects_save` (`char_obj_id`,`skill_id`,`skill_level`,`effect_count`,`effect_cur_time`,`duration`,`order`,`class_index`) VALUES");
synchronized(getEffectList())
{
StringBuilder sb;
for(L2Effect effect : getEffectList().getAllEffects())
{
if(effect != null && effect.isInUse() && !effect.getSkill().isToggle() && effect.getEffectType() != EffectType.HealOverTime && effect.getEffectType() != EffectType.CombatPointHealOverTime)
{
if(effect.isSaveable())
{
sb = new StringBuilder("(");
sb.append(getObjectId()).append(",");
sb.append(effect.getSkill().getId()).append(",");
sb.append(effect.getSkill().getLevel()).append(",");
sb.append(effect.getCount()).append(",");
sb.append(effect.getTime()).append(",");
sb.append(effect.getPeriod()).append(",");
sb.append(order).append(",");
sb.append(getActiveClassId()).append(")");
b.write(sb.toString());
}
while((effect = effect.getNext()) != null && effect.isSaveable())
{
sb = new StringBuilder("(");
sb.append(getObjectId()).append(",");
sb.append(effect.getSkill().getId()).append(",");
sb.append(effect.getSkill().getLevel()).append(",");
sb.append(effect.getCount()).append(",");
sb.append(effect.getTime()).append(",");
sb.append(effect.getPeriod()).append(",");
sb.append(order).append(",");
sb.append(getActiveClassId()).append(")");
b.write(sb.toString());
}
order++;
}
}
if(Config.ALT_SAVE_UNSAVEABLE && _cubics != null)
{
for(L2CubicInstance cubic : _cubics)
{
sb = new StringBuilder("(");
sb.append(getObjectId()).append(",");
sb.append(cubic.getId() + L2CubicInstance.CUBIC_STORE_OFFSET).append(",");
sb.append(cubic.getLevel()).append(",1,");
sb.append(cubic.lifeLeft()).append(",1,");
sb.append(order++).append(",");
sb.append(getActiveClassId()).append(")");
b.write(sb.toString());
}
}
}
if(!b.isEmpty())
{
statement.executeUpdate(b.close());
}
}
catch(final Exception e)
{
_log.warning("Could not store active effects data: " + e);