Small improvement for storeEffect method.

Contributed by Sahar.
This commit is contained in:
MobiusDevelopment
2019-10-05 18:17:31 +00:00
parent 5f6fbdecdf
commit 59f77b7e12
15 changed files with 1410 additions and 1350 deletions
@@ -7258,20 +7258,23 @@ public class PlayerInstance extends Playable
return;
}
try (Connection con = DatabaseFactory.getConnection();
PreparedStatement delete = con.prepareStatement(DELETE_SKILL_SAVE);
PreparedStatement statement = con.prepareStatement(ADD_SKILL_SAVE))
try (Connection con = DatabaseFactory.getConnection())
{
// Delete all current stored effects for char to avoid dupe
try (PreparedStatement delete = con.prepareStatement(DELETE_SKILL_SAVE))
{
delete.setInt(1, getObjectId());
delete.setInt(2, _classIndex);
delete.execute();
}
int buff_index = 0;
final List<Long> storedSkills = new ArrayList<>();
// Store all effect data along with calulated remaining
// reuse delays for matching skills. 'restore_type'= 0.
try (PreparedStatement statement = con.prepareStatement(ADD_SKILL_SAVE))
{
if (storeEffects)
{
for (BuffInfo info : getEffectList().getEffects())
@@ -7334,7 +7337,6 @@ public class PlayerInstance extends Playable
statement.setInt(10, ++buff_index);
statement.addBatch();
}
statement.executeBatch();
}
// Skills under reuse.
@@ -7367,6 +7369,8 @@ public class PlayerInstance extends Playable
statement.addBatch();
}
}
}
statement.executeBatch();
}
}
@@ -7265,20 +7265,23 @@ public class PlayerInstance extends Playable
return;
}
try (Connection con = DatabaseFactory.getConnection();
PreparedStatement delete = con.prepareStatement(DELETE_SKILL_SAVE);
PreparedStatement statement = con.prepareStatement(ADD_SKILL_SAVE))
try (Connection con = DatabaseFactory.getConnection())
{
// Delete all current stored effects for char to avoid dupe
try (PreparedStatement delete = con.prepareStatement(DELETE_SKILL_SAVE))
{
delete.setInt(1, getObjectId());
delete.setInt(2, _classIndex);
delete.execute();
}
int buff_index = 0;
final List<Long> storedSkills = new ArrayList<>();
// Store all effect data along with calulated remaining
// reuse delays for matching skills. 'restore_type'= 0.
try (PreparedStatement statement = con.prepareStatement(ADD_SKILL_SAVE))
{
if (storeEffects)
{
for (BuffInfo info : getEffectList().getEffects())
@@ -7341,7 +7344,6 @@ public class PlayerInstance extends Playable
statement.setInt(10, ++buff_index);
statement.addBatch();
}
statement.executeBatch();
}
// Skills under reuse.
@@ -7374,6 +7376,8 @@ public class PlayerInstance extends Playable
statement.addBatch();
}
}
}
statement.executeBatch();
}
}
@@ -7267,20 +7267,23 @@ public class PlayerInstance extends Playable
return;
}
try (Connection con = DatabaseFactory.getConnection();
PreparedStatement delete = con.prepareStatement(DELETE_SKILL_SAVE);
PreparedStatement statement = con.prepareStatement(ADD_SKILL_SAVE))
try (Connection con = DatabaseFactory.getConnection())
{
// Delete all current stored effects for char to avoid dupe
try (PreparedStatement delete = con.prepareStatement(DELETE_SKILL_SAVE))
{
delete.setInt(1, getObjectId());
delete.setInt(2, _classIndex);
delete.execute();
}
int buff_index = 0;
final List<Long> storedSkills = new ArrayList<>();
// Store all effect data along with calulated remaining
// reuse delays for matching skills. 'restore_type'= 0.
try (PreparedStatement statement = con.prepareStatement(ADD_SKILL_SAVE))
{
if (storeEffects)
{
for (BuffInfo info : getEffectList().getEffects())
@@ -7343,7 +7346,6 @@ public class PlayerInstance extends Playable
statement.setInt(10, ++buff_index);
statement.addBatch();
}
statement.executeBatch();
}
// Skills under reuse.
@@ -7376,6 +7378,8 @@ public class PlayerInstance extends Playable
statement.addBatch();
}
}
}
statement.executeBatch();
}
}
@@ -7261,20 +7261,23 @@ public class PlayerInstance extends Playable
return;
}
try (Connection con = DatabaseFactory.getConnection();
PreparedStatement delete = con.prepareStatement(DELETE_SKILL_SAVE);
PreparedStatement statement = con.prepareStatement(ADD_SKILL_SAVE))
try (Connection con = DatabaseFactory.getConnection())
{
// Delete all current stored effects for char to avoid dupe
try (PreparedStatement delete = con.prepareStatement(DELETE_SKILL_SAVE))
{
delete.setInt(1, getObjectId());
delete.setInt(2, _classIndex);
delete.execute();
}
int buff_index = 0;
final List<Long> storedSkills = new ArrayList<>();
// Store all effect data along with calulated remaining
// reuse delays for matching skills. 'restore_type'= 0.
try (PreparedStatement statement = con.prepareStatement(ADD_SKILL_SAVE))
{
if (storeEffects)
{
for (BuffInfo info : getEffectList().getEffects())
@@ -7337,7 +7340,6 @@ public class PlayerInstance extends Playable
statement.setInt(10, ++buff_index);
statement.addBatch();
}
statement.executeBatch();
}
// Skills under reuse.
@@ -7370,6 +7372,8 @@ public class PlayerInstance extends Playable
statement.addBatch();
}
}
}
statement.executeBatch();
}
}
@@ -7243,20 +7243,23 @@ public class PlayerInstance extends Playable
return;
}
try (Connection con = DatabaseFactory.getConnection();
PreparedStatement delete = con.prepareStatement(DELETE_SKILL_SAVE);
PreparedStatement statement = con.prepareStatement(ADD_SKILL_SAVE))
try (Connection con = DatabaseFactory.getConnection())
{
// Delete all current stored effects for char to avoid dupe
try (PreparedStatement delete = con.prepareStatement(DELETE_SKILL_SAVE))
{
delete.setInt(1, getObjectId());
delete.setInt(2, _classIndex);
delete.execute();
}
int buff_index = 0;
final List<Long> storedSkills = new ArrayList<>();
// Store all effect data along with calulated remaining
// reuse delays for matching skills. 'restore_type'= 0.
try (PreparedStatement statement = con.prepareStatement(ADD_SKILL_SAVE))
{
if (storeEffects)
{
for (BuffInfo info : getEffectList().getEffects())
@@ -7319,7 +7322,6 @@ public class PlayerInstance extends Playable
statement.setInt(10, ++buff_index);
statement.addBatch();
}
statement.executeBatch();
}
// Skills under reuse.
@@ -7352,6 +7354,8 @@ public class PlayerInstance extends Playable
statement.addBatch();
}
}
}
statement.executeBatch();
}
}
@@ -7243,20 +7243,23 @@ public class PlayerInstance extends Playable
return;
}
try (Connection con = DatabaseFactory.getConnection();
PreparedStatement delete = con.prepareStatement(DELETE_SKILL_SAVE);
PreparedStatement statement = con.prepareStatement(ADD_SKILL_SAVE))
try (Connection con = DatabaseFactory.getConnection())
{
// Delete all current stored effects for char to avoid dupe
try (PreparedStatement delete = con.prepareStatement(DELETE_SKILL_SAVE))
{
delete.setInt(1, getObjectId());
delete.setInt(2, _classIndex);
delete.execute();
}
int buff_index = 0;
final List<Long> storedSkills = new ArrayList<>();
// Store all effect data along with calulated remaining
// reuse delays for matching skills. 'restore_type'= 0.
try (PreparedStatement statement = con.prepareStatement(ADD_SKILL_SAVE))
{
if (storeEffects)
{
for (BuffInfo info : getEffectList().getEffects())
@@ -7319,7 +7322,6 @@ public class PlayerInstance extends Playable
statement.setInt(10, ++buff_index);
statement.addBatch();
}
statement.executeBatch();
}
// Skills under reuse.
@@ -7352,6 +7354,8 @@ public class PlayerInstance extends Playable
statement.addBatch();
}
}
}
statement.executeBatch();
}
}
@@ -7244,20 +7244,23 @@ public class PlayerInstance extends Playable
return;
}
try (Connection con = DatabaseFactory.getConnection();
PreparedStatement delete = con.prepareStatement(DELETE_SKILL_SAVE);
PreparedStatement statement = con.prepareStatement(ADD_SKILL_SAVE))
try (Connection con = DatabaseFactory.getConnection())
{
// Delete all current stored effects for char to avoid dupe
try (PreparedStatement delete = con.prepareStatement(DELETE_SKILL_SAVE))
{
delete.setInt(1, getObjectId());
delete.setInt(2, _classIndex);
delete.execute();
}
int buff_index = 0;
final List<Long> storedSkills = new ArrayList<>();
// Store all effect data along with calulated remaining
// reuse delays for matching skills. 'restore_type'= 0.
try (PreparedStatement statement = con.prepareStatement(ADD_SKILL_SAVE))
{
if (storeEffects)
{
for (BuffInfo info : getEffectList().getEffects())
@@ -7320,7 +7323,6 @@ public class PlayerInstance extends Playable
statement.setInt(10, ++buff_index);
statement.addBatch();
}
statement.executeBatch();
}
// Skills under reuse.
@@ -7353,6 +7355,8 @@ public class PlayerInstance extends Playable
statement.addBatch();
}
}
}
statement.executeBatch();
}
}
@@ -7149,20 +7149,23 @@ public class PlayerInstance extends Playable
return;
}
try (Connection con = DatabaseFactory.getConnection();
PreparedStatement delete = con.prepareStatement(DELETE_SKILL_SAVE);
PreparedStatement statement = con.prepareStatement(ADD_SKILL_SAVE))
try (Connection con = DatabaseFactory.getConnection())
{
// Delete all current stored effects for char to avoid dupe
try (PreparedStatement delete = con.prepareStatement(DELETE_SKILL_SAVE))
{
delete.setInt(1, getObjectId());
delete.setInt(2, _classIndex);
delete.execute();
}
int buff_index = 0;
final List<Long> storedSkills = new ArrayList<>();
// Store all effect data along with calulated remaining
// reuse delays for matching skills. 'restore_type'= 0.
try (PreparedStatement statement = con.prepareStatement(ADD_SKILL_SAVE))
{
if (storeEffects)
{
for (BuffInfo info : getEffectList().getEffects())
@@ -7225,7 +7228,6 @@ public class PlayerInstance extends Playable
statement.setInt(10, ++buff_index);
statement.addBatch();
}
statement.executeBatch();
}
// Skills under reuse.
@@ -7258,6 +7260,8 @@ public class PlayerInstance extends Playable
statement.addBatch();
}
}
}
statement.executeBatch();
}
}
@@ -7453,20 +7453,23 @@ public class PlayerInstance extends Playable
return;
}
try (Connection con = DatabaseFactory.getConnection();
PreparedStatement delete = con.prepareStatement(DELETE_SKILL_SAVE);
PreparedStatement statement = con.prepareStatement(ADD_SKILL_SAVE);)
try (Connection con = DatabaseFactory.getConnection())
{
// Delete all current stored effects for char to avoid dupe
try (PreparedStatement delete = con.prepareStatement(DELETE_SKILL_SAVE))
{
delete.setInt(1, getObjectId());
delete.setInt(2, _classIndex);
delete.execute();
}
int buff_index = 0;
final List<Integer> storedSkills = new ArrayList<>();
// Store all effect data along with calulated remaining
// reuse delays for matching skills. 'restore_type'= 0.
try (PreparedStatement statement = con.prepareStatement(ADD_SKILL_SAVE))
{
if (storeEffects)
{
for (BuffInfo info : getEffectList().getEffects())
@@ -7515,7 +7518,6 @@ public class PlayerInstance extends Playable
statement.setInt(9, ++buff_index);
statement.addBatch();
}
statement.executeBatch();
}
// Skills under reuse.
@@ -7547,6 +7549,8 @@ public class PlayerInstance extends Playable
statement.addBatch();
}
}
}
statement.executeBatch();
}
}
@@ -7229,20 +7229,23 @@ public class PlayerInstance extends Playable
return;
}
try (Connection con = DatabaseFactory.getConnection();
PreparedStatement delete = con.prepareStatement(DELETE_SKILL_SAVE);
PreparedStatement statement = con.prepareStatement(ADD_SKILL_SAVE))
try (Connection con = DatabaseFactory.getConnection())
{
// Delete all current stored effects for char to avoid dupe
try (PreparedStatement delete = con.prepareStatement(DELETE_SKILL_SAVE))
{
delete.setInt(1, getObjectId());
delete.setInt(2, _classIndex);
delete.execute();
}
int buff_index = 0;
final List<Long> storedSkills = new ArrayList<>();
// Store all effect data along with calulated remaining
// reuse delays for matching skills. 'restore_type'= 0.
try (PreparedStatement statement = con.prepareStatement(ADD_SKILL_SAVE))
{
if (storeEffects)
{
for (BuffInfo info : getEffectList().getEffects())
@@ -7305,7 +7308,6 @@ public class PlayerInstance extends Playable
statement.setInt(10, ++buff_index);
statement.addBatch();
}
statement.executeBatch();
}
// Skills under reuse.
@@ -7338,6 +7340,8 @@ public class PlayerInstance extends Playable
statement.addBatch();
}
}
}
statement.executeBatch();
}
}
@@ -7230,20 +7230,23 @@ public class PlayerInstance extends Playable
return;
}
try (Connection con = DatabaseFactory.getConnection();
PreparedStatement delete = con.prepareStatement(DELETE_SKILL_SAVE);
PreparedStatement statement = con.prepareStatement(ADD_SKILL_SAVE))
try (Connection con = DatabaseFactory.getConnection())
{
// Delete all current stored effects for char to avoid dupe
try (PreparedStatement delete = con.prepareStatement(DELETE_SKILL_SAVE))
{
delete.setInt(1, getObjectId());
delete.setInt(2, _classIndex);
delete.execute();
}
int buff_index = 0;
final List<Long> storedSkills = new ArrayList<>();
// Store all effect data along with calulated remaining
// reuse delays for matching skills. 'restore_type'= 0.
try (PreparedStatement statement = con.prepareStatement(ADD_SKILL_SAVE))
{
if (storeEffects)
{
for (BuffInfo info : getEffectList().getEffects())
@@ -7306,7 +7309,6 @@ public class PlayerInstance extends Playable
statement.setInt(10, ++buff_index);
statement.addBatch();
}
statement.executeBatch();
}
// Skills under reuse.
@@ -7339,6 +7341,8 @@ public class PlayerInstance extends Playable
statement.addBatch();
}
}
}
statement.executeBatch();
}
}
@@ -7215,20 +7215,23 @@ public class PlayerInstance extends Playable
return;
}
try (Connection con = DatabaseFactory.getConnection();
PreparedStatement delete = con.prepareStatement(DELETE_SKILL_SAVE);
PreparedStatement statement = con.prepareStatement(ADD_SKILL_SAVE))
try (Connection con = DatabaseFactory.getConnection())
{
// Delete all current stored effects for char to avoid dupe
try (PreparedStatement delete = con.prepareStatement(DELETE_SKILL_SAVE))
{
delete.setInt(1, getObjectId());
delete.setInt(2, _classIndex);
delete.execute();
}
int buff_index = 0;
final List<Long> storedSkills = new ArrayList<>();
// Store all effect data along with calulated remaining
// reuse delays for matching skills. 'restore_type'= 0.
try (PreparedStatement statement = con.prepareStatement(ADD_SKILL_SAVE))
{
if (storeEffects)
{
for (BuffInfo info : getEffectList().getEffects())
@@ -7291,7 +7294,6 @@ public class PlayerInstance extends Playable
statement.setInt(10, ++buff_index);
statement.addBatch();
}
statement.executeBatch();
}
// Skills under reuse.
@@ -7324,6 +7326,8 @@ public class PlayerInstance extends Playable
statement.addBatch();
}
}
}
statement.executeBatch();
}
}
@@ -7242,20 +7242,23 @@ public class PlayerInstance extends Playable
return;
}
try (Connection con = DatabaseFactory.getConnection();
PreparedStatement delete = con.prepareStatement(DELETE_SKILL_SAVE);
PreparedStatement statement = con.prepareStatement(ADD_SKILL_SAVE))
try (Connection con = DatabaseFactory.getConnection())
{
// Delete all current stored effects for char to avoid dupe
try (PreparedStatement delete = con.prepareStatement(DELETE_SKILL_SAVE))
{
delete.setInt(1, getObjectId());
delete.setInt(2, _classIndex);
delete.execute();
}
int buff_index = 0;
final List<Long> storedSkills = new ArrayList<>();
// Store all effect data along with calulated remaining
// reuse delays for matching skills. 'restore_type'= 0.
try (PreparedStatement statement = con.prepareStatement(ADD_SKILL_SAVE))
{
if (storeEffects)
{
for (BuffInfo info : getEffectList().getEffects())
@@ -7318,7 +7321,6 @@ public class PlayerInstance extends Playable
statement.setInt(10, ++buff_index);
statement.addBatch();
}
statement.executeBatch();
}
// Skills under reuse.
@@ -7351,6 +7353,8 @@ public class PlayerInstance extends Playable
statement.addBatch();
}
}
}
statement.executeBatch();
}
}
@@ -7242,20 +7242,23 @@ public class PlayerInstance extends Playable
return;
}
try (Connection con = DatabaseFactory.getConnection();
PreparedStatement delete = con.prepareStatement(DELETE_SKILL_SAVE);
PreparedStatement statement = con.prepareStatement(ADD_SKILL_SAVE))
try (Connection con = DatabaseFactory.getConnection())
{
// Delete all current stored effects for char to avoid dupe
try (PreparedStatement delete = con.prepareStatement(DELETE_SKILL_SAVE))
{
delete.setInt(1, getObjectId());
delete.setInt(2, _classIndex);
delete.execute();
}
int buff_index = 0;
final List<Long> storedSkills = new ArrayList<>();
// Store all effect data along with calulated remaining
// reuse delays for matching skills. 'restore_type'= 0.
try (PreparedStatement statement = con.prepareStatement(ADD_SKILL_SAVE))
{
if (storeEffects)
{
for (BuffInfo info : getEffectList().getEffects())
@@ -7318,7 +7321,6 @@ public class PlayerInstance extends Playable
statement.setInt(10, ++buff_index);
statement.addBatch();
}
statement.executeBatch();
}
// Skills under reuse.
@@ -7351,6 +7353,8 @@ public class PlayerInstance extends Playable
statement.addBatch();
}
}
}
statement.executeBatch();
}
}
@@ -7133,20 +7133,23 @@ public class PlayerInstance extends Playable
return;
}
try (Connection con = DatabaseFactory.getConnection();
PreparedStatement delete = con.prepareStatement(DELETE_SKILL_SAVE);
PreparedStatement statement = con.prepareStatement(ADD_SKILL_SAVE))
try (Connection con = DatabaseFactory.getConnection())
{
// Delete all current stored effects for char to avoid dupe
try (PreparedStatement delete = con.prepareStatement(DELETE_SKILL_SAVE))
{
delete.setInt(1, getObjectId());
delete.setInt(2, _classIndex);
delete.execute();
}
int buff_index = 0;
final List<Long> storedSkills = new ArrayList<>();
// Store all effect data along with calulated remaining
// reuse delays for matching skills. 'restore_type'= 0.
try (PreparedStatement statement = con.prepareStatement(ADD_SKILL_SAVE))
{
if (storeEffects)
{
for (BuffInfo info : getEffectList().getEffects())
@@ -7209,7 +7212,6 @@ public class PlayerInstance extends Playable
statement.setInt(10, ++buff_index);
statement.addBatch();
}
statement.executeBatch();
}
// Skills under reuse.
@@ -7242,6 +7244,8 @@ public class PlayerInstance extends Playable
statement.addBatch();
}
}
}
statement.executeBatch();
}
}