public static void SqlLog(L2Character activeObject, L2Character target, Integer log_id, L2ItemInstance Item, String etc_str1, String etc_str2, String etc_str3, Integer etc_num1, Integer etc_num2, Integer etc_num3, Integer etc_num4, Integer etc_num5, Integer etc_num6, Integer etc_num7, Integer etc_num8, Long etc_num9, Long etc_num10)
{
if(Config.SQL_LOG)
{
ThreadConnection con = null;
FiltredPreparedStatement statement = null;
try
{
con = L2DatabaseFactory.getInstance().getConnection();
statement = con.prepareStatement("INSERT INTO game_log (serv_id, act_time, log_id, actor, actor_type, target, target_type, location_x, location_y, location_z, etc_str1, etc_str2, etc_str3, etc_num1, etc_num2, etc_num3, etc_num4, etc_num5, etc_num6, etc_num7, etc_num8, etc_num9, etc_num10, STR_actor, STR_actor_account, STR_target, STR_target_account, item_id) " + "VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?);");
statement.setInt(1, 0); //serv_id
statement.setLong(2, System.currentTimeMillis() / 1000); //act_time
statement.setInt(3, log_id); //log_id
if(activeObject != null)
{
statement.setInt(4, activeObject.isNpc() ? activeObject.getNpcId() : activeObject.getObjectId());
statement.setString(5, activeObject.getClass().getName());
}
else
{
statement.setInt(4, 0);
statement.setString(5, "");
}
if(target != null && activeObject != null)
{
statement.setInt(6, target.isNpc() ? target.getNpcId() : target.getObjectId());
statement.setString(7, target.getClass().getName());
statement.setInt(8, activeObject.getX()); //location_x,
statement.setInt(9, activeObject.getY()); //location_y,
statement.setInt(10, activeObject.getZ()); //location_z,
}
else
{
statement.setInt(6, 0);
statement.setString(7, "");
statement.setInt(8, 0);
statement.setInt(9, 0);
statement.setInt(10, 0);
}
statement.setString(11, etc_str1); //etc_str1,
statement.setString(12, etc_str2); //etc_str2
statement.setString(13, etc_str3); //etc_str3,
statement.setInt(14, etc_num1); //etc_num1,
statement.setInt(15, etc_num2); //etc_num2,
statement.setInt(16, etc_num3); //etc_num3,
statement.setInt(17, etc_num4); //etc_num4,
statement.setInt(18, etc_num5); //etc_num5,
statement.setInt(19, etc_num6); //etc_num6,
statement.setInt(20, etc_num7); //etc_num7,
statement.setInt(21, etc_num8);
statement.setLong(22, etc_num9);
statement.setLong(23, etc_num10);
if(activeObject != null)
{
statement.setString(24, activeObject.getName()); //STR_actor,
statement.setString(25, activeObject.isPlayer() ? ((L2Player) activeObject).getAccountName() : ""); //STR_actor_account,
}
else
{
statement.setString(24, "");
statement.setString(25, "");
}
if(target != null)
{
statement.setString(26, target.getName()); //STR_target,
statement.setString(27, target.isPlayer() ? ((L2Player) target).getAccountName() : ""); //STR_target_account
}
else
{
statement.setString(26, "");
statement.setString(27, "");
}
statement.setInt(28, Item != null ? Item.getObjectId() : 0); //item_id
statement.executeUpdate();
}
catch(Exception e)
{
_log.log(Level.SEVERE, "Could not insert log into DB:", e);
}